From 4d53cb4c10b6365af64ed84a4842340c07d375e7 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 3 Dec 2024 09:39:47 +0700 Subject: [PATCH 01/10] add buildspec --- .onedev-buildspec.yml | 102 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .onedev-buildspec.yml diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml new file mode 100644 index 000000000..8ba5b5947 --- /dev/null +++ b/.onedev-buildspec.yml @@ -0,0 +1,102 @@ +version: 37 +jobs: + - name: CI for UAT + steps: + - !CheckoutStep + name: checkout code + cloneCredential: !DefaultCredential {} + withLfs: false + withSubmodules: false + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !GenerateChecksumStep + name: generate package checksum + files: package-lock.json yarn.lock + targetFile: checksum + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetupCacheStep + name: set up npm cache + key: node_modules_@file:checksum@ + loadKeys: + - node_modules + paths: + - node_modules + uploadStrategy: UPLOAD_IF_NOT_HIT + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetBuildVersionStep + name: set build version + buildVersion: "@tag@" + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: build & test + runInContainer: true + image: node + interpreter: !DefaultInterpreter + commands: | + npm install + npm run build + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !BuildImageStep + name: build docker image + dockerfile: ./docker/Dockerfile + output: !RegistryOutput + tags: hrms-git.chin.in.th/bma-hrms/hrms-mgt:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-mgt:latest + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + triggers: + - !TagCreateTrigger + tags: uat-* + branches: main + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400 + - name: CI for PROD + steps: + - !CheckoutStep + name: checkout code + cloneCredential: !DefaultCredential {} + withLfs: false + withSubmodules: false + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !GenerateChecksumStep + name: generate package checksum + files: package-lock.json yarn.lock + targetFile: checksum + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetupCacheStep + name: set up npm cache + key: node_modules_@file:checksum@ + loadKeys: + - node_modules + paths: + - node_modules + uploadStrategy: UPLOAD_IF_NOT_HIT + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !SetBuildVersionStep + name: set build version + buildVersion: "@tag@" + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !CommandStep + name: build & test + runInContainer: true + image: node + interpreter: !DefaultInterpreter + commands: | + npm install + npm run build + useTTY: true + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + - !BuildImageStep + name: build docker image + dockerfile: ./docker/Dockerfile + output: !RegistryOutput + tags: hrms-git.bangkok.go.th/bma-hrms/hrms-mgt:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-mgt:latest + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + triggers: + - !TagCreateTrigger + tags: prod-* + branches: main + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400 From b99c71410b8aba2b2abd105cd319b62a35e53e73 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 3 Dec 2024 10:07:22 +0700 Subject: [PATCH 02/10] remove & move config --- Dockerfile | 21 --------------------- docker/Dockerfile | 19 +++++++++++++++++++ entrypoint.sh => docker/entrypoint.sh | 4 ---- nginx.conf => docker/nginx.conf | 0 4 files changed, 19 insertions(+), 25 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker/Dockerfile rename entrypoint.sh => docker/entrypoint.sh (76%) rename nginx.conf => docker/nginx.conf (100%) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 6f2553eaf..000000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# docker build . -t docker.frappet.com/demo/fe:latest -FROM node:lts as build-stage -WORKDIR /app -COPY package*.json ./ -RUN npm install -COPY ./ . - -RUN npm run build - -FROM nginx as production-stage - -RUN mkdir /app -COPY --from=build-stage /app/dist /app -COPY nginx.conf /etc/nginx/nginx.conf - -COPY entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod u+x /usr/local/bin/entrypoint.sh - - -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] -CMD ["nginx", "-g", "daemon off;"] diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..12a0cacc8 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,19 @@ +# docker buildx build --platform=linux/amd64 -f docker/Dockerfile . -t hrms-git.chin.in.th/bma-hrms/hrms-mgt:0.1 + +# Build Stage +FROM node:lts-alpine AS build-stage +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY ./ . +RUN npm run build + +# Production Stage +FROM nginx:stable-alpine AS production-stage +RUN mkdir /app +COPY --from=build-stage /app/dist /app +COPY docker/nginx.conf /etc/nginx/nginx.conf +COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod u+x /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/entrypoint.sh b/docker/entrypoint.sh similarity index 76% rename from entrypoint.sh rename to docker/entrypoint.sh index 4e86264d7..02a61c45c 100644 --- a/entrypoint.sh +++ b/docker/entrypoint.sh @@ -14,10 +14,6 @@ do sed -i 's|VITE_S3CLUSTER_PUBLIC_URL|'${VITE_S3CLUSTER_PUBLIC_URL}'|g' $file sed -i 's|VITE_API_PUBLISH_URL|'${VITE_API_PUBLISH_URL}'|g' $file sed -i 's|VITE_API_REPORT_URL|'${VITE_API_REPORT_URL}'|g' $file - sed -i 's|VITE_URL_KEYCLOAK|'${VITE_URL_KEYCLOAK}'|g' $file - sed -i 's|VITE_REALM_KEYCLOAK|'${VITE_REALM_KEYCLOAK}'|g' $file - sed -i 's|VITE_CLIENTID_KEYCLOAK|'${VITE_CLIENTID_KEYCLOAK}'|g' $file - sed -i 's|VITE_CLIENTSECRET_KEYCLOAK|'${VITE_CLIENTSECRET_KEYCLOAK}'|g' $file sed -i 's|VITE_MANUAL_URL|'${VITE_MANUAL_URL}'|g' $file sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file diff --git a/nginx.conf b/docker/nginx.conf similarity index 100% rename from nginx.conf rename to docker/nginx.conf From 62e7284d5d105d59cd67b0c555c9694309f4c609 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 3 Dec 2024 16:27:30 +0700 Subject: [PATCH 03/10] =?UTF-8?q?fix=20bug=20=E0=B9=82=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/DialogMovePos.vue | 156 ++++++++++-------- .../02_organization/components/MainView.vue | 2 +- .../02_organization/components/TableMain.vue | 7 +- .../components/DialogMovePos.vue | 34 ++-- .../components/TableMain.vue | 7 +- .../16_positionEmployee/views/main.vue | 2 +- 6 files changed, 118 insertions(+), 90 deletions(-) diff --git a/src/modules/02_organization/components/DialogMovePos.vue b/src/modules/02_organization/components/DialogMovePos.vue index 3c3062858..2a9a3f992 100644 --- a/src/modules/02_organization/components/DialogMovePos.vue +++ b/src/modules/02_organization/components/DialogMovePos.vue @@ -67,6 +67,7 @@ const props = defineProps({ type: Object, required: true, }, + fetchDataTable: Function, }); const title = ref("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน"); //title Dialog @@ -93,14 +94,6 @@ const isDisable = computed(() => { } else return false; }); -/** - * function รีเช็ด filter - */ -function resetFilter() { - filterTree.value = ""; - filterRef.value.focus(); -} - /** * function เลือกข้อมูลหน่วยงาน */ @@ -157,6 +150,12 @@ function updatePagination(newPagination: NewPagination) { reqMaster.value.page = 1; } +function onSearchData() { + reqMaster.value.page = 1; + reqMaster.value.keyword = filterTable.value; + props.fetchDataTable?.(store.treeId, store.level, false); +} + /** * ดูการเปลี่ยนแปลง modal เมื่อเป็น true */ @@ -165,6 +164,7 @@ watch( () => { reqMaster.value.page = 1; filterTree.value = ""; + filterTable.value = ""; pagination.value.rowsPerPage = reqMaster.value.pageSize; title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`; @@ -190,7 +190,10 @@ watch( > - + @@ -206,7 +209,13 @@ watch(
- + @@ -214,71 +223,72 @@ watch(
- - - + + + { - posMaster.value = []; const dataMain: PosMaster[] = []; totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize); res.data.result.data.forEach((e: PosMaster) => { diff --git a/src/modules/02_organization/components/TableMain.vue b/src/modules/02_organization/components/TableMain.vue index fa12946eb..db853c03e 100644 --- a/src/modules/02_organization/components/TableMain.vue +++ b/src/modules/02_organization/components/TableMain.vue @@ -528,6 +528,10 @@ watch( if (!modalDialogMMove.value) { pagination.value.page = 1; pagination.value.rowsPerPage = reqMaster.value.pageSize; + + if (posMaster.value.length === 0) { + props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false); + } } } ); @@ -616,7 +620,7 @@ watch( @keydown.enter.prevent="props.filterKeyword(reqMaster.keyword)" > @@ -936,6 +940,7 @@ watch( :type="typeMove" :rowId="rowId" :mainTree="props.mainTree ? props.mainTree : []" + :fetchDataTable="props.fetchDataTable" /> diff --git a/src/modules/16_positionEmployee/components/DialogMovePos.vue b/src/modules/16_positionEmployee/components/DialogMovePos.vue index e2b9d4cd1..a9ba3b081 100644 --- a/src/modules/16_positionEmployee/components/DialogMovePos.vue +++ b/src/modules/16_positionEmployee/components/DialogMovePos.vue @@ -41,7 +41,6 @@ const { messageError, dialogMessageNotify, success, - onSearchDataTable, } = useCounterMixin(); /** @@ -70,6 +69,7 @@ const props = defineProps({ type: Object, required: true, }, + fetchDataTable: Function, }); const title = ref("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน"); @@ -80,7 +80,14 @@ const levelTree = ref(0); const filterTable = ref(""); const selectedFilter = ref([]); -const dataMain = ref([...rows.value]); + +/** + * function รีเช็ด filter + */ +function resetFilter() { + filterTree.value = ""; + filterRef.value.focus(); +} /** * function เลือกข้อมูลหน่วยงาน @@ -149,12 +156,10 @@ const pagination = ref({ rowsPerPage: reqMaster.value.pageSize, }); -function onSearchTable() { - rows.value = onSearchDataTable( - filterTable.value, - dataMain.value, - columns.value ? columns.value : [] - ); +function onSearchData() { + reqMaster.value.page = 1; + reqMaster.value.keyword = filterTable.value; + props.fetchDataTable?.(store.treeId, store.level, false); } watch( @@ -162,9 +167,8 @@ watch( () => { reqMaster.value.page = 1; filterTree.value = ""; - pagination.value.rowsPerPage = reqMaster.value.pageSize; - dataMain.value = rows.value; filterTable.value = ""; + pagination.value.rowsPerPage = reqMaster.value.pageSize; title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`; if (modal.value && props.type === "SINGER") { @@ -188,7 +192,10 @@ watch( > - + @@ -209,7 +216,7 @@ watch( dense v-model="filterTable" label="ค้นหา" - @keydown.enter="onSearchTable" + @keydown.enter="onSearchData" >