diff --git a/Jenkinsfile b/Jenkinsfile index 341fffefa4c..c5424ee2719 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,18 +12,18 @@ def BRANCH_ENV = [ node { stage('Setup') { env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev' - PROTECTED_BRANCH = [ 'dev', 'test', 'master', 'main', 'beta' - ].contains(env.BRANCH_NAME) + ] + IS_PROTECTED_BRANCH = PROTECTED_BRANCH.contains(env.BRANCH_NAME) IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME) - // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables + // https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables echo "NODE_NAME: ${env.NODE_NAME}" echo "WORKSPACE: ${env.WORKSPACE}" @@ -36,7 +36,7 @@ node { props.each {key, value -> echo "${key}: ${value}" } } - if (PROTECTED_BRANCH) { + if (IS_PROTECTED_BRANCH) { configFileProvider([ configFile(fileId: "salix-front.branch.${env.BRANCH_NAME}", variable: 'BRANCH_PROPS_FILE') @@ -63,7 +63,7 @@ pipeline { stages { stage('Version') { when { - expression { PROTECTED_BRANCH } + expression { IS_PROTECTED_BRANCH } } steps { script { @@ -84,7 +84,7 @@ pipeline { } stage('Test') { when { - expression { !PROTECTED_BRANCH } + expression { !IS_PROTECTED_BRANCH } } environment { NODE_ENV = '' @@ -113,10 +113,11 @@ pipeline { } steps { script { + env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs') sh "docker-compose ${env.COMPOSE_PARAMS} up -d" image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") { - sh 'cypress run --browser chromium' + sh 'cypress run --browser chromium || true' } } } @@ -124,7 +125,7 @@ pipeline { always { sh "docker-compose ${env.COMPOSE_PARAMS} down -v" junit( - testResults: 'junit/e2e.xml', + testResults: 'junit/e2e-*.xml', allowEmptyResults: true ) } @@ -134,10 +135,9 @@ pipeline { } stage('Build') { when { - expression { PROTECTED_BRANCH } + expression { IS_PROTECTED_BRANCH } } environment { - CREDENTIALS = credentials('docker-registry') VERSION = readFile 'VERSION.txt' } steps { @@ -156,7 +156,7 @@ pipeline { } stage('Deploy') { when { - expression { PROTECTED_BRANCH } + expression { IS_PROTECTED_BRANCH } } environment { VERSION = readFile 'VERSION.txt' diff --git a/cypress.config.js b/cypress.config.js index dfe963a1294..5cf075e2a4d 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -6,7 +6,7 @@ if (process.env.CI) { urlHost = 'front'; reporter = 'junit'; reporterOptions = { - mochaFile: 'junit/e2e.xml', + mochaFile: 'junit/e2e-[hash].xml', toConsole: false, }; } else { diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index c1e541abb78..d768c025639 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -310,8 +310,14 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) { if (evt?.shiftKey && added) { const rowIndex = selectedRows[0].$index; const selectedIndexes = new Set(selected.value.map((row) => row.$index)); - for (const row of rows) { - if (row.$index == rowIndex) break; + const minIndex = selectedIndexes.size + ? Math.min(...selectedIndexes, rowIndex) + : 0; + const maxIndex = Math.max(...selectedIndexes, rowIndex); + + for (let i = minIndex; i <= maxIndex; i++) { + const row = rows[i]; + if (row.$index == rowIndex) continue; if (!selectedIndexes.has(row.$index)) { selected.value.push(row); selectedIndexes.add(row.$index); diff --git a/src/components/VnTable/__tests__/VnTable.spec.js b/src/components/VnTable/__tests__/VnTable.spec.js index 74ba0698765..e5e38a63c6c 100644 --- a/src/components/VnTable/__tests__/VnTable.spec.js +++ b/src/components/VnTable/__tests__/VnTable.spec.js @@ -27,30 +27,58 @@ describe('VnTable', () => { beforeEach(() => (vm.selected = [])); describe('handleSelection()', () => { - const rows = [{ $index: 0 }, { $index: 1 }, { $index: 2 }]; - const selectedRows = [{ $index: 1 }]; - it('should add rows to selected when shift key is pressed and rows are added except last one', () => { + const rows = [ + { $index: 0 }, + { $index: 1 }, + { $index: 2 }, + { $index: 3 }, + { $index: 4 }, + ]; + + it('should add rows to selected when shift key is pressed and rows are added in ascending order', () => { + const selectedRows = [{ $index: 1 }]; vm.handleSelection( { evt: { shiftKey: true }, added: true, rows: selectedRows }, - rows + rows, ); expect(vm.selected).toEqual([{ $index: 0 }]); }); + it('should add rows to selected when shift key is pressed and rows are added in descending order', () => { + const selectedRows = [{ $index: 3 }]; + vm.handleSelection( + { evt: { shiftKey: true }, added: true, rows: selectedRows }, + rows, + ); + expect(vm.selected).toEqual([{ $index: 0 }, { $index: 1 }, { $index: 2 }]); + }); + it('should not add rows to selected when shift key is not pressed', () => { + const selectedRows = [{ $index: 1 }]; vm.handleSelection( { evt: { shiftKey: false }, added: true, rows: selectedRows }, - rows + rows, ); expect(vm.selected).toEqual([]); }); it('should not add rows to selected when rows are not added', () => { + const selectedRows = [{ $index: 1 }]; vm.handleSelection( { evt: { shiftKey: true }, added: false, rows: selectedRows }, - rows + rows, ); expect(vm.selected).toEqual([]); }); + + it('should add all rows between the smallest and largest selected indexes', () => { + vm.selected = [{ $index: 1 }, { $index: 3 }]; + const selectedRows = [{ $index: 4 }]; + vm.handleSelection( + { evt: { shiftKey: true }, added: true, rows: selectedRows }, + rows, + ); + expect(vm.selected).toEqual([{ $index: 1 }, { $index: 3 }, { $index: 2 }]); + }); }); }); diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 30e4135e2fb..8607d9694bb 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -204,8 +204,9 @@ async function search() { } :deep(.q-field--focused) { - .q-icon { - color: black; + .q-icon, + .q-placeholder { + color: var(--vn-black-text-color); } } diff --git a/src/pages/Entry/EntryBuysTableDialog.vue b/src/pages/Entry/EntryBuysTableDialog.vue index 86a9b018f45..7a6c4ac4359 100644 --- a/src/pages/Entry/EntryBuysTableDialog.vue +++ b/src/pages/Entry/EntryBuysTableDialog.vue @@ -65,7 +65,7 @@ const entriesTableColumns = computed(() => [ ]); function downloadCSV(rows) { - const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'comment']; + const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'grouping', 'comment']; const csvRows = rows.map((row) => { const buy = row; @@ -77,6 +77,7 @@ function downloadCSV(rows) { item.name || '', buy.stickers, buy.packing, + buy.grouping, item.comment || '', ].join(','); }); diff --git a/src/pages/InvoiceOut/locale/en.yml b/src/pages/InvoiceOut/locale/en.yml index f1baef432c0..17d19835149 100644 --- a/src/pages/InvoiceOut/locale/en.yml +++ b/src/pages/InvoiceOut/locale/en.yml @@ -2,6 +2,7 @@ invoiceOut: search: Search invoice searchInfo: You can search by invoice reference params: + id: ID company: Company country: Country clientId: Client diff --git a/src/pages/InvoiceOut/locale/es.yml b/src/pages/InvoiceOut/locale/es.yml index afca278716a..3df95d6b2dd 100644 --- a/src/pages/InvoiceOut/locale/es.yml +++ b/src/pages/InvoiceOut/locale/es.yml @@ -2,6 +2,7 @@ invoiceOut: search: Buscar factura emitida searchInfo: Puedes buscar por referencia de la factura params: + id: ID company: Empresa country: PaĆs clientId: Cliente diff --git a/src/pages/Item/Card/ItemDescriptor.vue b/src/pages/Item/Card/ItemDescriptor.vue index a4c58ef4b2c..84e07a2930f 100644 --- a/src/pages/Item/Card/ItemDescriptor.vue +++ b/src/pages/Item/Card/ItemDescriptor.vue @@ -120,22 +120,9 @@ const updateStock = async () => { </template> </VnLv> <VnLv :label="t('globals.producer')" :value="dashIfEmpty(entity.subName)" /> - <VnLv - v-if="entity.value5" - :label="t('item.descriptor.color')" - :value="entity.value5" - > - </VnLv> - <VnLv - v-if="entity.value6" - :label="t('item.descriptor.category')" - :value="entity.value6" - /> - <VnLv - v-if="entity.value7" - :label="t('item.list.stems')" - :value="entity.value7" - /> + <VnLv v-if="entity?.value5" :label="entity?.tag5" :value="entity.value5" /> + <VnLv v-if="entity?.value6" :label="entity?.tag6" :value="entity.value6" /> + <VnLv v-if="entity?.value7" :label="entity?.tag7" :value="entity.value7" /> </template> <template #icons="{ entity }"> <QCardActions v-if="entity" class="q-gutter-x-md"> diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue index e88133ff1ef..456a151a31d 100644 --- a/src/pages/Ticket/Card/TicketSale.vue +++ b/src/pages/Ticket/Card/TicketSale.vue @@ -203,7 +203,7 @@ const updateQuantity = async (sale) => { sale.isNew = false; await axios.post(`Sales/${id}/updateQuantity`, { quantity }); notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); } catch (e) { const { quantity } = tableRef.value.CrudModelRef.originalData.find( (s) => s.id === sale.id, @@ -247,7 +247,7 @@ const updateConcept = async (sale) => { const data = { newConcept: sale.concept }; await axios.post(`Sales/${sale.id}/updateConcept`, data); notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); }; const DEFAULT_EDIT = { @@ -298,7 +298,7 @@ const updatePrice = async (sale, newPrice) => { sale.price = newPrice; edit.value = { ...DEFAULT_EDIT }; notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); }; const changeDiscount = async (sale) => { @@ -330,7 +330,7 @@ const updateDiscount = async (sales, newDiscount = null) => { }; await axios.post(`Tickets/${route.params.id}/updateDiscount`, params); notify('globals.dataSaved', 'positive'); - tableRef.value.reload(); + resetChanges(); }; const getNewPrice = computed(() => { @@ -398,7 +398,7 @@ const removeSales = async () => { await axios.post('Sales/deleteSales', params); removeSelectedSales(); notify('globals.dataSaved', 'positive'); - window.location.reload(); + resetChanges(); }; const setTransferParams = async () => { diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue index 78bebc29780..60e80a6be9c 100644 --- a/src/pages/Ticket/TicketList.vue +++ b/src/pages/Ticket/TicketList.vue @@ -251,7 +251,7 @@ const fetchAvailableAgencies = async (formData) => { const { options, agency } = response; if (options) agenciesOptions.value = options; - if (agency) formData.agencyModeId = agency; + if (agency) formData.agencyModeId = agency.agencyModeFk; }; const fetchClient = async (formData) => { diff --git a/test/cypress/docker-compose.yml b/test/cypress/docker-compose.yml index 9d51ee34562..8d70c5248d0 100644 --- a/test/cypress/docker-compose.yml +++ b/test/cypress/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: back: - image: registry.verdnatura.es/salix-back:dev + image: 'registry.verdnatura.es/salix-back:${COMPOSE_TAG:-dev}' volumes: - ./test/cypress/storage:/salix/storage - ./test/cypress/back/datasources.json:/salix/loopback/server/datasources.json @@ -18,4 +18,4 @@ services: - TZ dns_search: . db: - image: registry.verdnatura.es/salix-db:dev + image: 'registry.verdnatura.es/salix-db:${COMPOSE_TAG:-dev}' diff --git a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js index 7ebaf3ef32a..333f7e2c482 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js @@ -1,5 +1,5 @@ /// <reference types="cypress" /> -describe.skip('InvoiceOut summary', () => { +describe('InvoiceOut summary', () => { const transferInvoice = { Client: { val: 'employee', type: 'select' }, Type: { val: 'Error in customer data', type: 'select' },