diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml new file mode 100644 index 0000000..aa65f53 --- /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-user:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-user: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-user:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-user:latest + condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL + triggers: + - !TagCreateTrigger + tags: prod-* + branches: main + retryCondition: never + maxRetries: 3 + retryDelay: 30 + timeout: 14400 diff --git a/docker/Dockerfile b/docker/Dockerfile index 62b1cee..dce3021 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ # docker buildx build --platform=linux/amd64 -f docker/Dockerfile . -t hrms-git.chin.in.th/bma-hrms/hrms-user:0.1 # Build Stage -FROM node:20-alpine as build-stage +FROM node:20-alpine AS build-stage WORKDIR /app COPY package*.json ./ RUN npm install diff --git a/src/modules/02_transfer/views/AddTransfer.vue b/src/modules/02_transfer/views/AddTransfer.vue index e72f495..fa53bde 100644 --- a/src/modules/02_transfer/views/AddTransfer.vue +++ b/src/modules/02_transfer/views/AddTransfer.vue @@ -1,64 +1,60 @@ diff --git a/src/modules/15_probationReport/components/01_SurveyPage.vue b/src/modules/15_probationReport/components/01_SurveyPage.vue index f6fcaaf..f623bcc 100644 --- a/src/modules/15_probationReport/components/01_SurveyPage.vue +++ b/src/modules/15_probationReport/components/01_SurveyPage.vue @@ -45,6 +45,7 @@ async function getSurveyData() { .then(async (res: any) => { const data = await res.data.result.data; assignId.value = res.data.result.assignId; + store.assignId = res.data.result.assignId; if (data !== null) { answer1.value = data.answer1; answer2.value = data.answer2; diff --git a/src/modules/15_probationReport/components/02_ResultPage.vue b/src/modules/15_probationReport/components/02_ResultPage.vue index f5a4359..553f2c5 100644 --- a/src/modules/15_probationReport/components/02_ResultPage.vue +++ b/src/modules/15_probationReport/components/02_ResultPage.vue @@ -5,12 +5,13 @@ import { useRoute, useRouter } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; import { useQuasar } from "quasar"; +import { useProbationReport } from "@/modules/15_probationReport/store"; const mixin = useCounterMixin(); +const store = useProbationReport(); const { date2Thai, showLoader, hideLoader, messageError } = mixin; const route = useRoute(); -const assignId = ref("baa3d9f6-9d21-4c58-85f2-114abf8de25c"); const status = ref(false); const $q = useQuasar(); @@ -52,7 +53,7 @@ const result_option = reactive([ async function getReportScore() { showLoader(); await http - .get(config.API.summaryReportDetail(assignId.value)) + .get(config.API.summaryReportDetail(store.assignId)) .then((res) => { const data = res.data.result; develop_orientation_score.value = data.develop_orientation_score; @@ -95,8 +96,19 @@ async function getReportScore() { }); } +/** ดึง ข้อมูลแบบสำรวจ */ +async function getAssignId() { + await http.get(config.API.summaryDetail()).then(async (res: any) => { + store.assignId = res.data.result.assignId; + }); +} + /** get ค่า เมื่อโหลดหน้า */ -onMounted(() => { +onMounted(async () => { + if (!store.assignId) { + await getAssignId(); + } + getReportScore(); }); diff --git a/src/modules/15_probationReport/store.ts b/src/modules/15_probationReport/store.ts index 0d20211..8698668 100644 --- a/src/modules/15_probationReport/store.ts +++ b/src/modules/15_probationReport/store.ts @@ -4,5 +4,6 @@ import type { DataOption } from "@/modules/10_registry/interface/index/Main"; export const useProbationReport = defineStore("ProbationReportStore", () => { const tabMain = ref("SURVEY"); - return { tabMain }; + const assignId = ref(""); + return { tabMain, assignId }; }); diff --git a/src/router/index.ts b/src/router/index.ts index 103e994..04b4901 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -22,8 +22,7 @@ import ModulePortfolio from "@/modules/13_portfolio/router"; import ModuleDevelop from "@/modules/14_IDP/router"; import ModuleProbationReport from "@/modules/15_probationReport/router"; -import { authenticated, tokenParsed } from "@/plugins/auth"; -import { ro } from "date-fns/locale"; +import { authenticated, logout } from "@/plugins/auth"; // TODO: ใช้หรือไม่? const router = createRouter({ @@ -96,7 +95,7 @@ router.beforeEach(async (to, from, next) => { if (to.meta.Auth) { const checkAuthen = await authenticated(); if (!checkAuthen && to.meta.Auth) { - router.push({ name: "loginMain" }); + logout(); } } next();