diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..c4746ff --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,50 @@ +# /.forgejo/workflows/build.yml +name: Build + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+*" + workflow_dispatch: + +env: + REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }} + IMAGE_VERSION: build + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."${{ env.REGISTRY }}"] + ca=["/etc/ssl/certs/ca-certificates.crt"] + - name: Tag Version + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/v//g' >> $GITHUB_ENV + else + echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV + fi + - name: Login in to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ env.REGISTRY_PASSWORD }} + - name: Build and push docker image + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: . + file: ./docker/Dockerfile + tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }} + push: true \ No newline at end of file diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..900559d --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: Build + +on: + workflow_dispatch: + inputs: + version: + description: "Version to deploy" + type: string + required: false + default: "latest" + +env: + IMAGE_VERSION: build + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Remote Deploy + uses: appleboy/ssh-action@v1.2.1 + with: + host: ${{ vars.SSH_DEPLOY_HOST }} + port: ${{ vars.SSH_DEPLOY_PORT }} + username: ${{ secrets.SSH_DEPLOY_USER }} + password: ${{ secrets.SSH_DEPLOY_PASSWORD }} + script: | + cd ~/repo + ./replace-env.sh APP_USER "${{ inputs.version }}" + ./deploy.sh hrms-user diff --git a/src/api/appeal/api.appeal.ts b/src/api/appeal/api.appeal.ts index 7fb0a1f..daa4886 100644 --- a/src/api/appeal/api.appeal.ts +++ b/src/api/appeal/api.appeal.ts @@ -7,15 +7,7 @@ export default { profileBykeycloak: () => `${profile}`, // positionBykeycloak: () => `${env.API_URI}/org/profile/keycloak/position`, - appealMainList: ( - status: string, - type: string, - year: number, - page: number, - pageSize: number, - keyword: string - ) => - `${appeal}/user?status=${status}&type=${type}&year=${year}&page=${page}&pageSize=${pageSize}&keyword=${keyword}`, + appealMainList: () => `${appeal}/user`, appealAdd: () => `${appeal}`, appealByID: (id: string) => `${appeal}/${id}`, diff --git a/src/components/TableD.vue b/src/components/TableD.vue index a669956..691aef7 100644 --- a/src/components/TableD.vue +++ b/src/components/TableD.vue @@ -138,9 +138,9 @@ function onRequest(requestProp: any) { ...newPagination, }; - if (isPageChange) { - emit("request", requestProp); - } + // if (isPageChange) { + emit("request", requestProp); + // } } function handlePageChange(newPage: number) { diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index 9dfae70..d2fc964 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -7,9 +7,9 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; -import type { Pagination } from "@/components/Workflow/interface/index/Main"; import type { DataQuery } from "@/components/Workflow/interface/request/Main"; import type { DataCommander } from "@/components/Workflow/interface/response/Main"; +import type { PropsTable } from "@/interface/PropsTable"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -76,17 +76,19 @@ const columns = ref([ style: "font-size: 14px", }, ]); - -const total = ref(0); -const totalList = ref(1); +const pagination = ref({ + sortBy: "", + descending: true, + page: 1, + rowsPerPage: 10, + rowsNumber: 0, +}); const isAcceptSetting = ref(false); const isApproveSetting = ref(false); const isReasonSetting = ref(false); const formDataQuery = reactive({ - page: 1, - pageSize: 10, isAct: false, keyword: "", }); @@ -97,12 +99,11 @@ async function fetchLists() { .put(config.API.workflow + `commander/${props.type}`, { ...formDataQuery, keycloakId: props.keycloakId, + page: pagination.value.page, + pageSize: pagination.value.rowsPerPage, }) .then(async (res) => { - totalList.value = Math.ceil( - res.data.result.total / formDataQuery.pageSize - ); - total.value = res.data.result.total; + pagination.value.rowsNumber = res.data.result.total; rows.value = res.data.result.data; }) .catch((err) => { @@ -139,7 +140,7 @@ function onSubmit() { } function onSearchData() { - formDataQuery.page = 1; + pagination.value.page = 1; fetchLists(); } @@ -150,32 +151,25 @@ function onCloseModal() { isAcceptSetting.value = false; isApproveSetting.value = false; isReasonSetting.value = false; - formDataQuery.page = 1; - formDataQuery.pageSize = 10; formDataQuery.isAct = false; formDataQuery.keyword = ""; } +/** + * ฟังก์ชันรับ request จากตาราง เมื่อมีการเปลี่ยน pagination + * @param requestProps ข้อมูลการร้องขอจากตาราง + */ +function onTableRequest(requestProps: PropsTable.RequestProps) { + const newPagination = requestProps?.pagination || requestProps; + if (!newPagination?.page || !newPagination?.rowsPerPage) return; + pagination.value = { ...newPagination }; +} + watch(modal, (val) => { if (val) { fetchLists(); } }); - -// watch( -// () => [formDataQuery.isAct, formDataQuery.pageSize], -// () => { -// onSearchData(); -// } -// ); - -/** - * function updatePagination - * @param newPagination ข้อมูล Pagination ใหม่ - */ -function updatePagination(newPagination: Pagination) { - formDataQuery.pageSize = newPagination.rowsPerPage; -}