From b590985b569791ec101c5a63534e3d0eae30df0f Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 31 Dec 2023 22:24:02 +0530 Subject: [PATCH] fix: removed old filters & sort by logic from all list view --- frontend/src/pages/CallLogs.vue | 33 ++++----------------------- frontend/src/pages/Contacts.vue | 31 +++---------------------- frontend/src/pages/Deals.vue | 31 +++---------------------- frontend/src/pages/Leads.vue | 34 +++------------------------- frontend/src/pages/Organizations.vue | 31 +++---------------------- 5 files changed, 16 insertions(+), 144 deletions(-) diff --git a/frontend/src/pages/CallLogs.vue b/frontend/src/pages/CallLogs.vue index ec7f1454..f0b92fca 100644 --- a/frontend/src/pages/CallLogs.vue +++ b/frontend/src/pages/CallLogs.vue @@ -43,22 +43,17 @@ import { } from '@/utils' import { usersStore } from '@/stores/users' import { contactsStore } from '@/stores/contacts' -import { useOrderBy } from '@/composables/orderby' -import { useFilter } from '@/composables/filter' -import { useDebounceFn } from '@vueuse/core' -import { createResource, Breadcrumbs, FeatherIcon } from 'frappe-ui' -import { computed, watch } from 'vue' +import { createResource, Breadcrumbs } from 'frappe-ui' +import { computed } from 'vue' const { getUser } = usersStore() const { getContact } = contactsStore() -const { get: getOrderBy } = useOrderBy() -const { getArgs, storage } = useFilter() const breadcrumbs = [{ label: 'Call Logs', route: { name: 'Call Logs' } }] function getParams() { - const filters = getArgs() || {} - const order_by = getOrderBy() || 'creation desc' + const filters = {} + const order_by = 'creation desc' return { doctype: 'CRM Call Log', @@ -73,26 +68,6 @@ const callLogs = createResource({ auto: true, }) -watch( - () => getOrderBy(), - (value, old_value) => { - if (!value && !old_value) return - callLogs.params = getParams() - callLogs.reload() - }, - { immediate: true } -) - -watch( - storage, - useDebounceFn((value, old_value) => { - if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return - callLogs.params = getParams() - callLogs.reload() - }, 300), - { deep: true } -) - const rows = computed(() => { if (!callLogs.data?.data) return [] return callLogs.data.data.map((callLog) => { diff --git a/frontend/src/pages/Contacts.vue b/frontend/src/pages/Contacts.vue index 79d7fcbb..6f6d317f 100644 --- a/frontend/src/pages/Contacts.vue +++ b/frontend/src/pages/Contacts.vue @@ -62,16 +62,11 @@ import Filter from '@/components/Filter.vue' import ViewSettings from '@/components/ViewSettings.vue' import { FeatherIcon, Breadcrumbs, Dropdown, createResource } from 'frappe-ui' import { organizationsStore } from '@/stores/organizations.js' -import { useOrderBy } from '@/composables/orderby' -import { useFilter } from '@/composables/filter' import { dateFormat, dateTooltipFormat, timeAgo } from '@/utils' -import { useDebounceFn } from '@vueuse/core' -import { ref, computed, watch } from 'vue' +import { ref, computed } from 'vue' import { useRoute } from 'vue-router' const { getOrganization } = organizationsStore() -const { get: getOrderBy } = useOrderBy() -const { getArgs, storage } = useFilter() const route = useRoute() const showContactModal = ref(false) @@ -101,8 +96,8 @@ const currentView = ref({ }) function getParams() { - const filters = getArgs() || {} - const order_by = getOrderBy() || 'modified desc' + const filters = {} + const order_by = 'modified desc' return { doctype: 'Contact', @@ -117,26 +112,6 @@ const contacts = createResource({ auto: true, }) -watch( - () => getOrderBy(), - (value, old_value) => { - if (!value && !old_value) return - contacts.params = getParams() - contacts.reload() - }, - { immediate: true } -) - -watch( - storage, - useDebounceFn((value, old_value) => { - if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return - contacts.params = getParams() - contacts.reload() - }, 300), - { deep: true } -) - const rows = computed(() => { if (!contacts.data?.data) return [] return contacts.data.data.map((contact) => { diff --git a/frontend/src/pages/Deals.vue b/frontend/src/pages/Deals.vue index c84b9af7..f7bf6f29 100644 --- a/frontend/src/pages/Deals.vue +++ b/frontend/src/pages/Deals.vue @@ -79,9 +79,6 @@ import ViewSettings from '@/components/ViewSettings.vue' import { usersStore } from '@/stores/users' import { organizationsStore } from '@/stores/organizations' import { statusesStore } from '@/stores/statuses' -import { useOrderBy } from '@/composables/orderby' -import { useFilter } from '@/composables/filter' -import { useDebounceFn } from '@vueuse/core' import { dateFormat, dateTooltipFormat, @@ -98,15 +95,13 @@ import { Breadcrumbs, } from 'frappe-ui' import { useRouter } from 'vue-router' -import { ref, computed, reactive, watch } from 'vue' +import { ref, computed, reactive } from 'vue' const breadcrumbs = [{ label: 'Deals', route: { name: 'Deals' } }] const { getUser } = usersStore() const { getOrganization } = organizationsStore() const { getDealStatus } = statusesStore() -const { get: getOrderBy } = useOrderBy() -const { getArgs, storage } = useFilter() const currentView = ref({ label: 'List', @@ -114,8 +109,8 @@ const currentView = ref({ }) function getParams() { - const filters = getArgs() || {} - const order_by = getOrderBy() || 'modified desc' + const filters = {} + const order_by = 'modified desc' return { doctype: 'CRM Deal', @@ -130,26 +125,6 @@ const deals = createResource({ auto: true, }) -watch( - () => getOrderBy(), - (value, old_value) => { - if (!value && !old_value) return - deals.params = getParams() - deals.reload() - }, - { immediate: true } -) - -watch( - storage, - useDebounceFn((value, old_value) => { - if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return - deals.params = getParams() - deals.reload() - }, 300), - { deep: true } -) - const rows = computed(() => { if (!deals.data?.data) return [] return deals.data.data.map((deal) => { diff --git a/frontend/src/pages/Leads.vue b/frontend/src/pages/Leads.vue index 2b13adec..9ed64939 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -78,9 +78,6 @@ import ViewSettings from '@/components/ViewSettings.vue' import { usersStore } from '@/stores/users' import { organizationsStore } from '@/stores/organizations' import { statusesStore } from '@/stores/statuses' -import { useOrderBy } from '@/composables/orderby' -import { useFilter } from '@/composables/filter' -import { useDebounceFn } from '@vueuse/core' import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils' import { FeatherIcon, @@ -91,15 +88,13 @@ import { Breadcrumbs, } from 'frappe-ui' import { useRouter } from 'vue-router' -import { ref, computed, reactive, watch } from 'vue' +import { ref, computed, reactive } from 'vue' const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }] const { getUser } = usersStore() const { getOrganization } = organizationsStore() const { getLeadStatus } = statusesStore() -const { get: getOrderBy } = useOrderBy() -const { getArgs, storage } = useFilter() const currentView = ref({ label: 'List', @@ -107,12 +102,9 @@ const currentView = ref({ }) function getParams() { - const filters = { - converted: 0, - ...(getArgs() || {}), - } + const filters = { converted: 0 } - const order_by = getOrderBy() || 'modified desc' + const order_by = 'modified desc' return { doctype: 'CRM Lead', @@ -127,26 +119,6 @@ const leads = createResource({ auto: true, }) -watch( - () => getOrderBy(), - (value, old_value) => { - if (!value && !old_value) return - leads.params = getParams() - leads.reload() - }, - { immediate: true } -) - -watch( - storage, - useDebounceFn((value, old_value) => { - if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return - leads.params = getParams() - leads.reload() - }, 300), - { deep: true } -) - const rows = computed(() => { if (!leads.data?.data) return [] return leads.data.data.map((lead) => { diff --git a/frontend/src/pages/Organizations.vue b/frontend/src/pages/Organizations.vue index 09ac6b2f..2fe5a1c5 100644 --- a/frontend/src/pages/Organizations.vue +++ b/frontend/src/pages/Organizations.vue @@ -63,9 +63,6 @@ import OrganizationsListView from '@/components/ListViews/OrganizationsListView. import SortBy from '@/components/SortBy.vue' import Filter from '@/components/Filter.vue' import ViewSettings from '@/components/ViewSettings.vue' -import { useOrderBy } from '@/composables/orderby' -import { useFilter } from '@/composables/filter' -import { useDebounceFn } from '@vueuse/core' import { FeatherIcon, Breadcrumbs, Dropdown, createResource } from 'frappe-ui' import { dateFormat, @@ -73,12 +70,10 @@ import { timeAgo, formatNumberIntoCurrency, } from '@/utils' -import { ref, computed, watch } from 'vue' +import { ref, computed } from 'vue' import { useRoute } from 'vue-router' const route = useRoute() -const { get: getOrderBy } = useOrderBy() -const { getArgs, storage } = useFilter() const showOrganizationModal = ref(false) @@ -107,8 +102,8 @@ const currentView = ref({ }) function getParams() { - const filters = getArgs() || {} - const order_by = getOrderBy() || 'modified desc' + const filters = {} + const order_by = 'modified desc' return { doctype: 'CRM Organization', @@ -123,26 +118,6 @@ const organizations = createResource({ auto: true, }) -watch( - () => getOrderBy(), - (value, old_value) => { - if (!value && !old_value) return - organizations.params = getParams() - organizations.reload() - }, - { immediate: true } -) - -watch( - storage, - useDebounceFn((value, old_value) => { - if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return - organizations.params = getParams() - organizations.reload() - }, 300), - { deep: true } -) - const rows = computed(() => { if (!organizations.data?.data) return [] return organizations.data.data.map((organization) => {