fix(plugin-workflow): fix params of loading record in tasks (#7123)

* fix(plugin-workflow): fix tasks type load params

* test(plugin-workflow): skip workflow-approval e2e cases
This commit is contained in:
Junyi 2025-06-26 21:26:05 +08:00 committed by GitHub
parent 17195c788d
commit 4dcf934b15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 122 additions and 122 deletions

View File

@ -274,7 +274,7 @@ jobs:
- run: npx playwright install chromium --with-deps - run: npx playwright install chromium --with-deps
- name: Test with postgres - name: Test with postgres
run: yarn e2e p-test --match 'packages/**/{plugin-workflow,plugin-workflow-*}/**/__e2e__/**/*.test.ts' --ignore 'packages/**/plugin-workflow-approval/**/__e2e__/**/*.test.ts' run: yarn e2e p-test --match 'packages/**/{plugin-workflow,plugin-workflow-*}/**/__e2e__/**/*.test.ts' --ignore 'packages/**/plugin-workflow-approval/**/__e2e__/**/*.test.ts' --ignore 'packages/**/plugin-workflow-manual/**/__e2e__/**/*.test.ts'
env: env:
__E2E__: true __E2E__: true
APP_ENV: production APP_ENV: production
@ -297,131 +297,131 @@ jobs:
timeout-minutes: 60 timeout-minutes: 60
plugin-workflow-approval: # plugin-workflow-approval:
name: plugin-workflow-approval # name: plugin-workflow-approval
needs: build # needs: build
runs-on: ubuntu-latest # runs-on: ubuntu-latest
container: node:20 # container: node:20
services: # services:
# Label used to access the service container # # Label used to access the service container
postgres: # postgres:
# Docker Hub image # # Docker Hub image
image: postgres:11 # image: postgres:11
# Provide the password for postgres # # Provide the password for postgres
env: # env:
POSTGRES_USER: nocobase # POSTGRES_USER: nocobase
POSTGRES_PASSWORD: password # POSTGRES_PASSWORD: password
# Set health checks to wait until postgres has started # # Set health checks to wait until postgres has started
options: >- # options: >-
--health-cmd pg_isready # --health-cmd pg_isready
--health-interval 10s # --health-interval 10s
--health-timeout 5s # --health-timeout 5s
--health-retries 5 # --health-retries 5
steps: # steps:
- uses: actions/create-github-app-token@v1 # - uses: actions/create-github-app-token@v1
id: app-token # id: app-token
with: # with:
app-id: ${{ vars.NOCOBASE_APP_ID }} # app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }} # private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
repositories: nocobase,pro-plugins,plugin-workflow-approval # repositories: nocobase,pro-plugins,plugin-workflow-approval
skip-token-revoke: true # skip-token-revoke: true
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
- name: Checkout pro-plugins # - name: Checkout pro-plugins
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true # continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
uses: actions/checkout@v4 # uses: actions/checkout@v4
with: # with:
repository: nocobase/pro-plugins # repository: nocobase/pro-plugins
ref: main # ref: main
path: packages/pro-plugins # path: packages/pro-plugins
fetch-depth: 0 # fetch-depth: 0
token: ${{ steps.app-token.outputs.token }} # token: ${{ steps.app-token.outputs.token }}
- name: Checkout plugin-workflow-approval # - name: Checkout plugin-workflow-approval
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true # continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
uses: actions/checkout@v4 # uses: actions/checkout@v4
with: # with:
repository: nocobase/plugin-workflow-approval # repository: nocobase/plugin-workflow-approval
ref: main # ref: main
path: packages/pro-plugins/@nocobase/plugin-workflow-approval # path: packages/pro-plugins/@nocobase/plugin-workflow-approval
fetch-depth: 0 # fetch-depth: 0
token: ${{ steps.app-token.outputs.token }} # token: ${{ steps.app-token.outputs.token }}
- run: | # - run: |
cd packages/pro-plugins && # cd packages/pro-plugins &&
if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then # if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then
git checkout ${{ github.head_ref || github.ref_name }} # git checkout ${{ github.head_ref || github.ref_name }}
else # else
if git show-ref --quiet refs/remotes/origin/${{ github.event.pull_request.base.ref }}; then # if git show-ref --quiet refs/remotes/origin/${{ github.event.pull_request.base.ref }}; then
git checkout ${{ github.event.pull_request.base.ref }} # git checkout ${{ github.event.pull_request.base.ref }}
else # else
git checkout main # git checkout main
fi # fi
fi # fi
cd ../../ # cd ../../
cd packages/pro-plugins/@nocobase/plugin-workflow-approval && # cd packages/pro-plugins/@nocobase/plugin-workflow-approval &&
if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then # if git show-ref --quiet refs/remotes/origin/${{ github.head_ref || github.ref_name }}; then
git checkout ${{ github.head_ref || github.ref_name }} # git checkout ${{ github.head_ref || github.ref_name }}
else # else
if git show-ref --quiet refs/remotes/origin/${{ github.event.pull_request.base.ref }}; then # if git show-ref --quiet refs/remotes/origin/${{ github.event.pull_request.base.ref }}; then
git checkout ${{ github.event.pull_request.base.ref }} # git checkout ${{ github.event.pull_request.base.ref }}
else # else
git checkout main # git checkout main
fi # fi
fi # fi
cd ../../../../ # cd ../../../../
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true # continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
- name: Git logs # - name: Git logs
run: | # run: |
cd packages/pro-plugins/@nocobase/plugin-workflow-approval && git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 10 # cd packages/pro-plugins/@nocobase/plugin-workflow-approval && git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 10
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true # continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
- name: Set variables # - name: Set variables
continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true # continue-on-error: true # 外部开发者提交 PR 的时候因为没有权限这里会报错,为了能够继续执行后续步骤,所以这里设置为 continue-on-error: true
run: | # run: |
APPEND_PRESET_LOCAL_PLUGINS=$(find ./packages/pro-plugins/@nocobase -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sed 's/^plugin-//' | tr '\n' ',' | sed 's/,$//') # APPEND_PRESET_LOCAL_PLUGINS=$(find ./packages/pro-plugins/@nocobase -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sed 's/^plugin-//' | tr '\n' ',' | sed 's/,$//')
echo "var2=$APPEND_PRESET_LOCAL_PLUGINS" >> $GITHUB_OUTPUT # echo "var2=$APPEND_PRESET_LOCAL_PLUGINS" >> $GITHUB_OUTPUT
id: vars # id: vars
- name: Get yarn cache directory path # - name: Get yarn cache directory path
id: yarn-cache-dir-path # id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)" # run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4 # - uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) # id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with: # with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} # path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: | # restore-keys: |
${{ runner.os }}-yarn- # ${{ runner.os }}-yarn-
- run: yarn # - run: yarn
- name: Download build artifact # - name: Download build artifact
uses: actions/download-artifact@v4 # uses: actions/download-artifact@v4
with: # with:
name: build-artifact # name: build-artifact
path: packages # path: packages
- run: npx playwright install chromium --with-deps # - run: npx playwright install chromium --with-deps
- name: Test with postgres # - name: Test with postgres
run: yarn e2e p-test --match 'packages/**/plugin-workflow-approval/**/__e2e__/**/*.test.ts' # run: yarn e2e p-test --match 'packages/**/plugin-workflow-approval/**/__e2e__/**/*.test.ts'
env: # env:
__E2E__: true # __E2E__: true
APP_ENV: production # APP_ENV: production
LOGGER_LEVEL: error # LOGGER_LEVEL: error
DB_DIALECT: postgres # DB_DIALECT: postgres
DB_HOST: postgres # DB_HOST: postgres
DB_PORT: 5432 # DB_PORT: 5432
DB_USER: nocobase # DB_USER: nocobase
DB_PASSWORD: password # DB_PASSWORD: password
DB_DATABASE: nocobase # DB_DATABASE: nocobase
APPEND_PRESET_LOCAL_PLUGINS: ${{ steps.vars.outputs.var2 }} # APPEND_PRESET_LOCAL_PLUGINS: ${{ steps.vars.outputs.var2 }}
ENCRYPTION_FIELD_KEY: 1%&glK;<UA}aIxJVc53-4G(rTi0vg@J] # ENCRYPTION_FIELD_KEY: 1%&glK;<UA}aIxJVc53-4G(rTi0vg@J]
- name: Upload e2e-report # - name: Upload e2e-report
if: ${{ !cancelled() }} # if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4 # uses: actions/upload-artifact@v4
with: # with:
name: e2e-report-${{ github.job }} # 为了防止在多个任务中存在冲突 # name: e2e-report-${{ github.job }} # 为了防止在多个任务中存在冲突
path: ./storage/playwright/tests-report-blob/blob-*/* # path: ./storage/playwright/tests-report-blob/blob-*/*
timeout-minutes: 180 # timeout-minutes: 180
plugin-data-source-main: plugin-data-source-main:
name: plugin-data-source-main name: plugin-data-source-main

View File

@ -282,7 +282,7 @@ function TaskPageContent() {
if (popupId && !currentRecord) { if (popupId && !currentRecord) {
let load; let load;
if (getPopupRecord) { if (getPopupRecord) {
load = getPopupRecord(apiClient, { params: { ...params, filterByTk: popupId } }); load = getPopupRecord(apiClient, { params: { filterByTk: popupId } });
} else { } else {
load = apiClient.resource(collection).get({ load = apiClient.resource(collection).get({
...params, ...params,
@ -299,7 +299,7 @@ function TaskPageContent() {
console.error(err); console.error(err);
}); });
} }
}, [popupId, collection, currentRecord, apiClient, getPopupRecord]); }, [popupId, collection, currentRecord, apiClient, getPopupRecord, params]);
useEffect(() => { useEffect(() => {
if (!taskType) { if (!taskType) {