diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index ed2d8d5fa..4a2df5ee5 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -15,7 +15,7 @@ class DashboardController < ActionController::Base private def ensure_html_format - head :not_acceptable unless request.format.html? + render json: { error: 'Please use API routes instead of dashboard routes for JSON requests' }, status: :not_acceptable if request.format.json? end def set_global_config diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 098bc41c1..de895c76e 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -853,6 +853,8 @@ watch(conversationFilters, (newVal, oldVal) => { :has-active-folders="hasActiveFolders" :active-status="activeStatus" :is-on-expanded-layout="isOnExpandedLayout" + :conversation-stats="conversationStats" + :is-list-loading="chatListLoading" @add-folders="onClickOpenAddFoldersModal" @delete-folders="onClickOpenDeleteFoldersModal" @filters-modal="onToggleAdvanceFiltersModal" diff --git a/app/javascript/dashboard/components/ChatListHeader.vue b/app/javascript/dashboard/components/ChatListHeader.vue index b4ce9f342..c184103c0 100644 --- a/app/javascript/dashboard/components/ChatListHeader.vue +++ b/app/javascript/dashboard/components/ChatListHeader.vue @@ -2,6 +2,7 @@ import { computed } from 'vue'; import { useUISettings } from 'dashboard/composables/useUISettings'; import { useMapGetter } from 'dashboard/composables/store.js'; +import { formatNumber } from '@chatwoot/utils'; import wootConstants from 'dashboard/constants/globals'; import { FEATURE_FLAGS } from 'dashboard/featureFlags'; @@ -10,26 +11,13 @@ import SwitchLayout from 'dashboard/routes/dashboard/conversation/search/SwitchL import NextButton from 'dashboard/components-next/button/Button.vue'; const props = defineProps({ - pageTitle: { - type: String, - required: true, - }, - hasAppliedFilters: { - type: Boolean, - required: true, - }, - hasActiveFolders: { - type: Boolean, - required: true, - }, - activeStatus: { - type: String, - required: true, - }, - isOnExpandedLayout: { - type: Boolean, - required: true, - }, + pageTitle: { type: String, required: true }, + hasAppliedFilters: { type: Boolean, required: true }, + hasActiveFolders: { type: Boolean, required: true }, + activeStatus: { type: String, required: true }, + isOnExpandedLayout: { type: Boolean, required: true }, + conversationStats: { type: Object, required: true }, + isListLoading: { type: Boolean, required: true }, }); const emit = defineEmits([ @@ -62,6 +50,9 @@ const showV4View = computed(() => { ); }); +const allCount = computed(() => props.conversationStats?.allCount || 0); +const formattedAllCount = computed(() => formatNumber(allCount.value)); + const toggleConversationLayout = () => { const { LAYOUT_TYPES } = wootConstants; const { @@ -92,6 +83,15 @@ const toggleConversationLayout = () => { > {{ pageTitle }} + + {{ formattedAllCount }} + store.getters.getSelectedChat); const accountId = computed(() => store.getters.getCurrentAccountId); -const isFeatureEnabledonAccount = computed( - () => store.getters['accounts/isFeatureEnabledonAccount'] -); -const appIntegrations = computed( - () => store.getters['integrations/getAppIntegrations'] -); const chatMetadata = computed(() => props.chat.meta); @@ -92,16 +84,6 @@ const hasMultipleInboxes = computed( ); const hasSlaPolicyId = computed(() => props.chat?.sla_policy_id); - -const isLinearIntegrationEnabled = computed(() => - appIntegrations.value.find( - integration => integration.id === 'linear' && !!integration.hooks.length - ) -); - -const isLinearFeatureEnabled = computed(() => - isFeatureEnabledonAccount.value(accountId.value, FEATURE_FLAGS.LINEAR) -);