From 76b9fbc267a9af137aee32d9a92e4a891ee4e122 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 7 Jan 2025 08:21:09 +0100 Subject: [PATCH 01/11] perf: redirect transition list to card --- src/composables/useArrayData.js | 37 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index fd6e3a9b3..d09030de1 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -124,8 +124,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { const { limit } = filter; store.hasMoreData = limit && response.data.length >= limit; + if (!append && !isDialogOpened() && updateRouter) { + const res = updateStateParams(response.data); + if (res?.redirect) return; + } processData(response.data, { map: !!store.mapKey, append }); - if (!append && !isDialogOpened()) updateRouter && updateStateParams(); store.isLoading = false; canceller = null; @@ -259,7 +262,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (Object.values(store.userParams).length) await fetch({}); } - function updateStateParams() { + function updateStateParams(data) { if (!route?.path) return; const newUrl = { path: route.path, query: { ...(route.query ?? {}) } }; if (store?.searchUrl) @@ -276,15 +279,15 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { const { path } = matches.at(-1); const to = - store?.data?.length === 1 - ? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`) + data?.length === 1 + ? path.replace(/\/(list|:id)|-list/, `/${data[0].id}`) : path.replace(/:id.*/, ''); if (route.path != to) { const pushUrl = { path: to }; if (to.endsWith('/list') || to.endsWith('/')) pushUrl.query = newUrl.query; - return router.push(pushUrl); + return router.push(pushUrl) && { redirect: true }; } } @@ -292,28 +295,32 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } function processData(data, { map = true, append = true }) { + let newData; + let newMap; if (!append) { - store.data = []; - store.map = new Map(); + newData = []; + newMap = new Map(); } - if (!Array.isArray(data)) store.data = data; - else if (!map && append) for (const row of data) store.data.push(row); + if (!Array.isArray(data)) newData = data; + else if (!map && append) for (const row of data) newData.push(row); else for (const row of data) { const key = row[store.mapKey]; const val = { ...row, key }; - if (key && store.map.has(key)) { + if (key && newMap.has(key)) { const { position } = store.map.get(key); val.position = position; - store.map.set(key, val); - store.data[position] = val; + newMap.set(key, val); + newData[position] = val; } else { - val.position = store.map.size; - store.map.set(key, val); - store.data.push(val); + val.position = newMap.size; + newMap.set(key, val); + newData.push(val); } } + store.data = data; + store.map = map; } const totalRows = computed(() => (store.data && store.data.length) || 0); From d8c3e6bce7e3afc1a73ae5207aed40aad9534ef7 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 7 Jan 2025 08:24:37 +0100 Subject: [PATCH 02/11] perf: revert processData --- src/composables/useArrayData.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index d09030de1..93d3a2e52 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -295,32 +295,28 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } function processData(data, { map = true, append = true }) { - let newData; - let newMap; if (!append) { - newData = []; - newMap = new Map(); + store.data = []; + store.map = new Map(); } - if (!Array.isArray(data)) newData = data; - else if (!map && append) for (const row of data) newData.push(row); + if (!Array.isArray(data)) store.data = data; + else if (!map && append) for (const row of data) store.data.push(row); else for (const row of data) { const key = row[store.mapKey]; const val = { ...row, key }; - if (key && newMap.has(key)) { + if (key && store.map.has(key)) { const { position } = store.map.get(key); val.position = position; - newMap.set(key, val); - newData[position] = val; + store.map.set(key, val); + store.data[position] = val; } else { - val.position = newMap.size; - newMap.set(key, val); - newData.push(val); + val.position = store.map.size; + store.map.set(key, val); + store.data.push(val); } } - store.data = data; - store.map = map; } const totalRows = computed(() => (store.data && store.data.length) || 0); From 97fee8d1d0f82dbf439a773c79024392fe70d519 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 7 Jan 2025 08:26:33 +0100 Subject: [PATCH 03/11] perf: order --- src/composables/useArrayData.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 93d3a2e52..e59ee398f 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -128,11 +128,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { const res = updateStateParams(response.data); if (res?.redirect) return; } - processData(response.data, { map: !!store.mapKey, append }); - store.isLoading = false; canceller = null; + processData(response.data, { map: !!store.mapKey, append }); + return response; } From 1a72eda35955afb42e0094f9b72003408808a7a2 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 8 Jan 2025 12:44:35 +0100 Subject: [PATCH 04/11] fix: refs #8001 change link grafana --- src/pages/Ticket/Card/TicketExpedition.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Ticket/Card/TicketExpedition.vue b/src/pages/Ticket/Card/TicketExpedition.vue index 7da049124..56e2c6455 100644 --- a/src/pages/Ticket/Card/TicketExpedition.vue +++ b/src/pages/Ticket/Card/TicketExpedition.vue @@ -201,7 +201,7 @@ const getExpeditionState = async (expedition) => { const openGrafana = (expeditionFk) => { useOpenURL( - `https://grafana.verdnatura.es/d/d552ab74-85b4-4e7f-a279-fab7cd9c6124/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}` + `https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}` ); }; From e69332316679e7e9fd4397140bb0397bbc79a523 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 8 Jan 2025 12:57:15 +0100 Subject: [PATCH 05/11] fix: workerTimeControl state week colors --- src/pages/Worker/Card/WorkerTimeControl.vue | 2 +- src/pages/Worker/Card/WorkerTimeControlCalendar.vue | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue index 0870c78b7..65fbf4b43 100644 --- a/src/pages/Worker/Card/WorkerTimeControl.vue +++ b/src/pages/Worker/Card/WorkerTimeControl.vue @@ -345,7 +345,7 @@ const getMailStates = async (date) => { const prevMonth = month == 1 ? 12 : month - 1; const params = { month, - year: selectedDateYear.value, + year: date.getFullYear(), }; const curMonthStates = (await axios.get(url, { params })).data; diff --git a/src/pages/Worker/Card/WorkerTimeControlCalendar.vue b/src/pages/Worker/Card/WorkerTimeControlCalendar.vue index 2717a71f4..46ae4b698 100644 --- a/src/pages/Worker/Card/WorkerTimeControlCalendar.vue +++ b/src/pages/Worker/Card/WorkerTimeControlCalendar.vue @@ -102,8 +102,7 @@ const getWorkWeekElements = () => { }; const paintWorkWeeks = async () => { - for (var i = 0; i < workWeeksElements.value.length; i++) { - const element = workWeeksElements.value[i]; + for (const element of workWeeksElements.value) { const week = Number(element.innerHTML); const weekState = workerTimeControlMailsMap.value.get(week); const { className, title } = stateClasses[weekState] || {}; From 5e31b936753d630f457f8ab3e47b5929e24c3736 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 9 Jan 2025 08:00:30 +0100 Subject: [PATCH 06/11] fix: modelName --- src/pages/Supplier/Card/SupplierSummary.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Supplier/Card/SupplierSummary.vue b/src/pages/Supplier/Card/SupplierSummary.vue index a08561933..8ba61afb9 100644 --- a/src/pages/Supplier/Card/SupplierSummary.vue +++ b/src/pages/Supplier/Card/SupplierSummary.vue @@ -39,6 +39,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`; :url="`Suppliers/${entityId}/getSummary`" @on-fetch="(data) => setData(data)" data-key="SupplierSummary" + module-name="Supplier" >