diff --git a/Jenkinsfile b/Jenkinsfile index 178fbcbcc..c4e87be4a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,13 +13,13 @@ pipeline { steps { script { switch (env.BRANCH_NAME) { - // case 'master': - // env.NODE_ENV = 'production' - // env.BACK_REPLICAS = 1 - // break + case 'master': + env.NODE_ENV = 'production' + env.FRONT_REPLICAS = 2 + break case 'test': env.NODE_ENV = 'test' - env.BACK_REPLICAS = 1 + env.FRONT_REPLICAS = 1 break } } @@ -58,7 +58,7 @@ pipeline { stage('Build') { when { anyOf { branch 'test' - // branch 'master' + branch 'master' }} environment { CREDENTIALS = credentials('docker-registry') @@ -73,7 +73,7 @@ pipeline { stage('Deploy') { when { anyOf { branch 'test' - // branch 'master' + branch 'master' }} environment { DOCKER_HOST = "${env.SWARM_HOST}" diff --git a/docker-compose.yml b/docker-compose.yml index 0ab098249..33d8c2809 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: ports: - 4000 deploy: - replicas: 2 + replicas: ${FRONT_REPLICAS:?} placement: constraints: - node.role == worker \ No newline at end of file diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index fea777704..b535f32ee 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -168,6 +168,15 @@ export default { shipped: 'Shipped', warehouse: 'Warehouse', customerCard: 'Customer card' + }, + boxing: { + expedition: 'Expedition', + item: 'Item', + created: 'Created', + worker: 'Worker', + selectTime: 'Select time:', + selectVideo: 'Select video:', + notFound: 'No videos available' } }, claim: { diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 5a46932b2..1c06fa94c 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -167,6 +167,15 @@ export default { shipped: 'Enviado', warehouse: 'Almacén', customerCard: 'Ficha del cliente' + }, + boxing: { + expedition: 'Expedición', + item: 'Artículo', + created: 'Creado', + worker: 'Trabajador', + selectTime: 'Seleccionar hora:', + selectVideo: 'Seleccionar vídeo:', + notFound: 'No hay vídeos disponibles' } }, claim: { @@ -202,15 +211,6 @@ export default { customerSummary: 'Resumen del cliente', claimedTicket: 'Ticket reclamado' }, - basicData: { - customer: 'Cliente', - assignedTo: 'Asignada a', - created: 'Creada', - state: 'Estado', - packages: 'Bultos', - picked: 'Recogida', - returnOfMaterial: 'Autorización de retorno de materiales (RMA)' - }, summary: { customer: 'Cliente', assignedTo: 'Asignada a', @@ -225,6 +225,15 @@ export default { quantity: 'Cantidad' } }, + }, + basicData: { + customer: 'Cliente', + assignedTo: 'Asignada a', + created: 'Creada', + state: 'Estado', + packages: 'Bultos', + picked: 'Recogida', + returnOfMaterial: 'Autorización de retorno de materiales (RMA)' } }, components: { diff --git a/src/pages/Customer/CustomerMain.vue b/src/pages/Customer/CustomerMain.vue index 099e82879..ea8b53330 100644 --- a/src/pages/Customer/CustomerMain.vue +++ b/src/pages/Customer/CustomerMain.vue @@ -1,6 +1,6 @@ diff --git a/src/pages/Login/__tests__/Login.spec.js b/src/pages/Login/__tests__/Login.spec.js index 87f8de487..ee5ef237b 100644 --- a/src/pages/Login/__tests__/Login.spec.js +++ b/src/pages/Login/__tests__/Login.spec.js @@ -33,7 +33,7 @@ describe('Login', () => { } jest.spyOn(axios, 'post').mockResolvedValue({ data: { token: 'token' } }); jest.spyOn(axios, 'get').mockResolvedValue({ data: { roles: [], user: expectedUser } }); - jest.spyOn(vm.quasar, 'notify') + jest.spyOn(vm.quasar, 'notify'); expect(vm.session.getToken()).toEqual(''); diff --git a/src/pages/Ticket/Card/TicketBoxing.vue b/src/pages/Ticket/Card/TicketBoxing.vue new file mode 100644 index 000000000..81d6fa77b --- /dev/null +++ b/src/pages/Ticket/Card/TicketBoxing.vue @@ -0,0 +1,159 @@ + + + diff --git a/src/pages/Ticket/Card/TicketCard.vue b/src/pages/Ticket/Card/TicketCard.vue index 16a145782..115c97ff9 100644 --- a/src/pages/Ticket/Card/TicketCard.vue +++ b/src/pages/Ticket/Card/TicketCard.vue @@ -154,8 +154,8 @@ function stateColor(state) { {{ t('ticket.pageTitles.basicData') }} --> - - + --> diff --git a/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js b/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js new file mode 100644 index 000000000..078350471 --- /dev/null +++ b/src/pages/Ticket/Card/__tests__/TicketBoxing.spec.js @@ -0,0 +1,69 @@ +import { jest, describe, expect, it, beforeAll } from '@jest/globals'; +import { createWrapper, axios } from 'app/tests/jest/jestHelpers'; +import TicketBoxing from '../TicketBoxing.vue'; + +const mockPush = jest.fn(); + +jest.mock('vue-router', () => ({ + useRouter: () => ({ + push: mockPush, + currentRoute: { + value: { + params: { + id: 1 + } + } + } + }), +})); + +describe('TicketBoxing', () => { + let vm; + beforeAll(() => { + vm = createWrapper(TicketBoxing).vm; + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + describe('getVideoList()', () => { + it('should when response videoList use to list', async () => { + const expeditionId = 1; + const timed = { + min: 1, + max: 2 + } + const videoList = [ + "2022-01-01T01-01-00.mp4", + "2022-02-02T02-02-00.mp4", + "2022-03-03T03-03-00.mp4", + ] + + jest.spyOn(axios, 'get').mockResolvedValue({ data: videoList }); + jest.spyOn(vm.quasar, 'notify'); + + await vm.getVideoList(expeditionId, timed); + + expect(vm.videoList.length).toEqual(videoList.length); + expect(vm.slide).toEqual(videoList.reverse()[0]); + }); + + it('should if not have video show notify', async () => { + const expeditionId = 1; + const timed = { + min: 1, + max: 2 + } + + jest.spyOn(axios, 'get').mockResolvedValue({ data: [] }); + jest.spyOn(vm.quasar, 'notify') + + await vm.getVideoList(expeditionId, timed); + + expect(vm.quasar.notify).toHaveBeenCalledWith(expect.objectContaining( + { 'type': 'negative' } + )); + }); + }); +}); diff --git a/src/pages/Ticket/TicketMain.vue b/src/pages/Ticket/TicketMain.vue index 9787fc415..ed84a7ca6 100644 --- a/src/pages/Ticket/TicketMain.vue +++ b/src/pages/Ticket/TicketMain.vue @@ -1,7 +1,7 @@