From a35ccb5b5180e731e5e92ef5bc9fa2b8af3cab8a Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 16 May 2024 16:38:27 -0300 Subject: [PATCH 01/24] Zone Locations --- .../Worker}/CreateDepartmentChild.vue | 0 src/pages/Worker/WorkerDepartment.vue | 4 +- .../Worker/WorkerDepartmentTree.vue} | 2 +- src/pages/Zone/Card/ZoneLocations.vue | 10 +- src/pages/Zone/Card/ZoneLocationsTree.vue | 169 ++++++++++++++++++ src/pages/Zone/locale/en.yml | 3 + src/pages/Zone/locale/es.yml | 3 + src/router/modules/zone.js | 2 +- 8 files changed, 188 insertions(+), 5 deletions(-) rename src/{components => pages/Worker}/CreateDepartmentChild.vue (100%) rename src/{components/ui/VnTree.vue => pages/Worker/WorkerDepartmentTree.vue} (99%) create mode 100644 src/pages/Zone/Card/ZoneLocationsTree.vue diff --git a/src/components/CreateDepartmentChild.vue b/src/pages/Worker/CreateDepartmentChild.vue similarity index 100% rename from src/components/CreateDepartmentChild.vue rename to src/pages/Worker/CreateDepartmentChild.vue diff --git a/src/pages/Worker/WorkerDepartment.vue b/src/pages/Worker/WorkerDepartment.vue index 3c0e5fdd0..fe4c23051 100644 --- a/src/pages/Worker/WorkerDepartment.vue +++ b/src/pages/Worker/WorkerDepartment.vue @@ -1,10 +1,10 @@ diff --git a/src/components/ui/VnTree.vue b/src/pages/Worker/WorkerDepartmentTree.vue similarity index 99% rename from src/components/ui/VnTree.vue rename to src/pages/Worker/WorkerDepartmentTree.vue index 13aa05635..09220be7e 100644 --- a/src/components/ui/VnTree.vue +++ b/src/pages/Worker/WorkerDepartmentTree.vue @@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n'; import { useState } from 'src/composables/useState'; import { useQuasar } from 'quasar'; import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue'; -import CreateDepartmentChild from '../CreateDepartmentChild.vue'; +import CreateDepartmentChild from './CreateDepartmentChild.vue'; import axios from 'axios'; import useNotify from 'src/composables/useNotify.js'; import { useRouter } from 'vue-router'; diff --git a/src/pages/Zone/Card/ZoneLocations.vue b/src/pages/Zone/Card/ZoneLocations.vue index e4305c898..e04442080 100644 --- a/src/pages/Zone/Card/ZoneLocations.vue +++ b/src/pages/Zone/Card/ZoneLocations.vue @@ -1 +1,9 @@ - + + + diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue new file mode 100644 index 000000000..0940e071d --- /dev/null +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index 746d3f2e7..39f065496 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -5,6 +5,7 @@ zone: zoneCreate: Create zone deliveryList: Delivery days upcomingList: Upcoming deliveries + locations: Locations list: clone: Clone id: Id @@ -40,3 +41,5 @@ summary: filterPanel: name: Name agencyModeFk: Agency +zoneLocations: + locations: Locations diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index d9266b150..aa7b7d2b4 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -5,6 +5,7 @@ zone: zoneCreate: Nueva zona deliveryList: Días de entrega upcomingList: Próximos repartos + locations: Localizaciones list: clone: Clonar id: Id @@ -40,3 +41,5 @@ summary: filterPanel: name: Nombre agencyModeFk: Agencia +zoneLocations: + locations: Localizaciones diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index 9c917c301..0628c00aa 100644 --- a/src/router/modules/zone.js +++ b/src/router/modules/zone.js @@ -79,7 +79,7 @@ export default { path: 'location', meta: { title: 'locations', - icon: 'vn:greuge', + icon: 'my_location', }, component: () => import('src/pages/Zone/Card/ZoneLocations.vue'), }, From b26bf10e7094daddd5563d1df19d23919a1184b7 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 20 May 2024 15:53:38 -0300 Subject: [PATCH 02/24] Apply searchbar logic --- src/components/common/VnCard.vue | 4 ++++ src/pages/Zone/Card/ZoneCard.vue | 29 ++++++++--------------- src/pages/Zone/Card/ZoneLocationsTree.vue | 18 ++++++++++++-- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index 58cb12708..e836badec 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -20,6 +20,8 @@ const props = defineProps({ searchUrl: { type: String, default: undefined }, searchbarLabel: { type: String, default: '' }, searchbarInfo: { type: String, default: '' }, + searchCustomRouteRedirect: { type: String, default: undefined }, + searchRedirect: { type: Boolean, default: false }, }); const stateStore = useStateStore(); @@ -62,6 +64,8 @@ watchEffect(() => { :url="props.searchUrl" :label="props.searchbarLabel" :info="props.searchbarInfo" + :custom-route-redirect-name="searchCustomRouteRedirect" + :redirect="searchRedirect" /> diff --git a/src/pages/Zone/Card/ZoneCard.vue b/src/pages/Zone/Card/ZoneCard.vue index 6451fe00c..1abbb78bf 100644 --- a/src/pages/Zone/Card/ZoneCard.vue +++ b/src/pages/Zone/Card/ZoneCard.vue @@ -5,38 +5,29 @@ import { computed } from 'vue'; import VnCard from 'components/common/VnCard.vue'; import ZoneDescriptor from './ZoneDescriptor.vue'; -import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; - -import { useStateStore } from 'stores/useStateStore'; const { t } = useI18n(); -const stateStore = useStateStore(); const route = useRoute(); const routeName = computed(() => route.name); +const customRouteRedirectName = computed(() => { + if (routeName.value === 'ZoneLocations') return null; + return routeName.value; +}); const searchBarDataKeys = { ZoneWarehouses: 'ZoneWarehouses', ZoneSummary: 'ZoneSummary', + ZoneLocations: 'ZoneLocations', }; diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 0940e071d..df3f8ef25 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -1,18 +1,25 @@ diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 0bc141efa..6b36b6109 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -159,55 +159,8 @@ onMounted(async () => { class="qtr row justify-between full-width q-pr-md cursor-pointer" > {{ node.name }} - + - - From b408e0daaf4fd9d8a2bbf488f2e5f0e00e505b55 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 27 May 2024 08:29:52 -0300 Subject: [PATCH 14/24] remove on selected --- src/pages/Zone/Card/ZoneLocationsTree.vue | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 6b36b6109..69ace53e2 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -81,16 +81,6 @@ const fetchNodeLeaves = async (nodeKey) => { } }; -const onSelected = async (val, node) => { - try { - if (val === null) val = undefined; - const params = { geoId: node.id, isIncluded: val }; - await axios.post(`Zones/${route.params.id}/toggleIsIncluded`, params); - } catch (err) { - console.error('Error updating included', err); - } -}; - function getNodeIds(node) { let ids = []; if (node.id) ids.push(node.id); From 3a2b0e757a3d88623b103f6e7e78896897cc1daf Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 27 May 2024 13:31:40 +0200 Subject: [PATCH 15/24] ci: refs #7442 Kubernetes deploy --- Jenkinsfile | 12 +++++++----- docker-compose.yml | 12 +----------- package.json | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7d2957a1c..7cad5ef41 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,7 +54,6 @@ pipeline { } environment { PROJECT_NAME = 'lilium' - STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" } stages { stage('Install') { @@ -104,15 +103,18 @@ pipeline { when { expression { PROTECTED_BRANCH } } - environment { - DOCKER_HOST = "${env.SWARM_HOST}" - } steps { script { def packageJson = readJSON file: 'package.json' env.VERSION = packageJson.version } - sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" + withKubeConfig([ + serverUrl: "$KUBERNETES_API", + credentialsId: 'kubernetes', + namespace: 'lilium' + ]) { + sh 'kubectl set image deployment/lilium-$BRANCH_NAME lilium-$BRANCH_NAME=$REGISTRY/salix-frontend:$VERSION' + } } } } diff --git a/docker-compose.yml b/docker-compose.yml index 6494739f2..df793fc75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,7 @@ version: '3.7' services: main: - image: registry.verdnatura.es/salix-frontend:${BRANCH_NAME:?} + image: registry.verdnatura.es/salix-frontend:${VERSION:?} build: context: . dockerfile: ./Dockerfile - ports: - - 4000 - deploy: - replicas: ${FRONT_REPLICAS:?} - placement: - constraints: - - node.role == worker - resources: - limits: - memory: 1G diff --git a/package.json b/package.json index 7be20a842..b96159be6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.22.0", + "version": "24.22.1", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", From f2df252a94ae4d9238ec3c526b0e27802ab5d63d Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 27 May 2024 10:32:10 -0300 Subject: [PATCH 16/24] improvement --- src/pages/Zone/Card/ZoneLocationsTree.vue | 51 +++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 69ace53e2..f924a2e21 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -21,7 +21,7 @@ const { store } = arrayData; const storeData = computed(() => store.data); const nodes = ref([ - { id: null, name: t('zoneLocations.locations'), sons: true, children: [{}] }, + { id: null, name: t('zoneLocations.locations'), sons: true, childs: [{}] }, ]); const previousExpandedNodes = ref(new Set()); @@ -30,7 +30,6 @@ const onNodeExpanded = async (nodeKeysArray) => { const nodeKeysSet = new Set(nodeKeysArray); const lastNodeKey = nodeKeysArray.at(-1); const wasExpanded = !previousExpandedNodes.value.has(lastNodeKey); - if (wasExpanded) await fetchNodeLeaves(lastNodeKey); else { const difference = new Set( @@ -48,6 +47,16 @@ const onNodeExpanded = async (nodeKeysArray) => { const formatNodeSelected = (node) => { if (node.selected === 1) node.selected = true; else if (node.selected === 0) node.selected = false; + + if (node.childs && node.childs.length > 0) { + expanded.value.push(node.id); + + node.childs.forEach((childNode) => { + formatNodeSelected(childNode); + }); + } + + if (node.sons > 0 && !node.childs) node.childs = [{}]; }; const fetchNodeLeaves = async (nodeKey) => { @@ -60,16 +69,8 @@ const fetchNodeLeaves = async (nodeKey) => { params, }); if (response.data) { - node.children = response.data.map((n) => { - const hasChildrens = n.sons > 0; - n.children = hasChildrens ? [{}] : null; + node.childs = response.data.map((n) => { formatNodeSelected(n); - - if (n.child && n.child.length > 0) { - n.child.forEach((childNode) => { - formatNodeSelected(childNode); - }); - } return n; }); } @@ -85,24 +86,30 @@ function getNodeIds(node) { let ids = []; if (node.id) ids.push(node.id); - const children = node.childs || node.children; - if (children) { - children.forEach((child) => { + if (node.childs) + node.childs.forEach((child) => { ids = ids.concat(getNodeIds(child)); }); - } return ids; } watch(storeData, async (val) => { // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar - nodes.value[0].children = [...val]; + nodes.value[0].childs = [...val]; const fetchedNodeKeys = val.flatMap(getNodeIds); state.set('Tree', [...fetchedNodeKeys]); - for (let n of state.get('Tree')) { - await fetchNodeLeaves(n); + + if (store.userParams?.search === '') { + val.forEach((n) => { + formatNodeSelected(n); + }); + } else { + for (let n of state.get('Tree')) { + await fetchNodeLeaves(n); + } + expanded.value = [null]; } - expanded.value = [null, 1, ...fetchedNodeKeys]; + previousExpandedNodes.value = new Set(expanded.value); }); onMounted(async () => { @@ -111,13 +118,12 @@ onMounted(async () => { return; } const stateTree = state.get('Tree'); - const tree = stateTree ? [...state.get('Tree'), 1] : [null, 1]; + const tree = stateTree ? [...state.get('Tree')] : [null]; const lastStateTree = state.get('TreeState'); if (tree) { for (let n of tree) { await fetchNodeLeaves(n); } - expanded.value = tree; if (lastStateTree) { tree.push(lastStateTree); @@ -130,6 +136,8 @@ onMounted(async () => { document.getElementById(lastStateTree).scrollIntoView(); } }, 1000); + + previousExpandedNodes.value = new Set(expanded.value); }); @@ -139,6 +147,7 @@ onMounted(async () => { :nodes="nodes" node-key="id" label-key="name" + children-key="childs" v-model:expanded="expanded" @update:expanded="onNodeExpanded($event)" :default-expand-all="true" From f7a6e3d4719bad97ea280bee2f0df881703b9701 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 27 May 2024 16:13:40 +0200 Subject: [PATCH 17/24] test(ClaimPhoto): refs #7589 fix e2e --- test/cypress/integration/claim/claimPhoto.spec.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/cypress/integration/claim/claimPhoto.spec.js b/test/cypress/integration/claim/claimPhoto.spec.js index 6ea1fd8b7..9b2978b19 100755 --- a/test/cypress/integration/claim/claimPhoto.spec.js +++ b/test/cypress/integration/claim/claimPhoto.spec.js @@ -21,8 +21,7 @@ describe('ClaimPhoto', () => { cy.get('.q-notification__message').should('have.text', 'Data saved'); }); - /* it.skip('should open first image dialog change to second and close', () => { - skiped fix on https://redmine.verdnatura.es/issues/7113 + it('should open first image dialog change to second and close', () => { cy.get( ':nth-child(1) > .q-card > .q-img > .q-img__container > .q-img__image' ).click(); @@ -38,19 +37,23 @@ describe('ClaimPhoto', () => { cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should( 'not.be.visible' ); - }); */ + }); it('should remove third and fourth file', () => { cy.get( '.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon' ).click(); - cy.get('.q-btn--unelevated > .q-btn__content > .block').click(); + cy.get( + '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' + ).click(); cy.get('.q-notification__message').should('have.text', 'Data deleted'); cy.get( '.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon' ).click(); - cy.get('.q-btn--unelevated > .q-btn__content > .block').click(); + cy.get( + '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' + ).click(); cy.get('.q-notification__message').should('have.text', 'Data deleted'); }); }); From 3ae523ef040f9113aaae0971771cd4e693202abe Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 27 May 2024 16:52:53 +0200 Subject: [PATCH 18/24] test(WorkerList): refs #7589 fix e2e --- src/components/ui/CardSummary.vue | 17 +++++++++++++---- .../integration/worker/workerList.spec.js | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index 57d1cb19a..ae9a43578 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -56,11 +56,20 @@ async function fetch() { } const showRedirectToSummaryIcon = computed(() => { - const routeExists = route.matched.some( - (route) => route.name === `${route.meta.moduleName}Summary` - ); - return !isSummary.value && route.meta.moduleName && routeExists; + const exist = existSummary(route.matched); + return !isSummary.value && route.meta.moduleName && exist; }); + +function existSummary(routes) { + const hasSummary = routes.some((r) => r.name === `${route.meta.moduleName}Summary`); + if (hasSummary) return hasSummary; + for (const current of routes) { + if (current.path != '/' && current.children) { + const exist = existSummary(current.children); + if (exist) return exist; + } + } +}