From 4a6bf097379e646d0b3a0f23e6fe9c32234e8274 Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 23 Oct 2024 21:00:38 +0800 Subject: [PATCH 1/3] fix(client): fix special white space happens when paste content (#5497) --- .../client/src/schema-component/antd/variable/TextArea.tsx | 5 +++-- .../src/server/RequestInstruction.ts | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx index 89ea49ad3f..724e9f4f1e 100644 --- a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx +++ b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx @@ -210,7 +210,7 @@ function getCurrentRange(element: HTMLElement): RangeIndexes { export function TextArea(props) { const { wrapSSR, hashId, componentCls } = useStyles(); - const { value = '', scope, onChange, multiline = true, changeOnSelect, style } = props; + const { value = '', scope, onChange, changeOnSelect, style } = props; const inputRef = useRef(null); const [options, setOptions] = useState([]); const form = useForm(); @@ -420,9 +420,10 @@ export function TextArea(props) { hashId, 'ant-input', { 'ant-input-disabled': disabled }, + // NOTE: `pre-wrap` here for avoid the ` ` (\x160) issue when paste content, we need normal space (\x32). css` overflow: auto; - white-space: ${multiline ? 'normal' : 'nowrap'}; + white-space: pre-wrap; &[placeholder]:empty::before { content: attr(placeholder); diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts index 95e0bf0ea6..b3c41b0434 100644 --- a/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts +++ b/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts @@ -25,8 +25,8 @@ export type RequestConfig = Pick Date: Wed, 23 Oct 2024 23:36:10 +0800 Subject: [PATCH 2/3] chore(ci): optimize (#5501) * chore(ci): optimize * chore: update * chore: update * chore: update * chore: update * chore: update * chore: update * chore: update * chore: update --- .github/workflows/changelog-and-release.yml | 30 ++++++++++--------- .github/workflows/manual-build-pro-image.yml | 31 ++++++++++---------- .github/workflows/release-next.yml | 8 ++++- scripts/release/changelogAndRelease.js | 11 ++++--- 4 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.github/workflows/changelog-and-release.yml b/.github/workflows/changelog-and-release.yml index 4567e26fb1..da1e7fe5da 100644 --- a/.github/workflows/changelog-and-release.yml +++ b/.github/workflows/changelog-and-release.yml @@ -22,31 +22,33 @@ jobs: write-changelog-and-release: runs-on: ubuntu-latest steps: + - name: Get info + id: get-info + run: | + if [[ "${{ inputs.version }}" == "alpha" ]]; then + echo "branch=$(echo 'next')" >> $GITHUB_OUTPUT + echo "proRepos=$(echo '${{ vars.NEXT_PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT + else + echo "branch=$(echo 'main')" >> $GITHUB_OUTPUT + echo "proRepos=$(echo '${{ vars.PRO_PLUGIN_REPOS }}')" >> $GITHUB_OUTPUT + fi - uses: actions/create-github-app-token@v1 id: app-token with: app-id: ${{ vars.NOCOBASE_APP_ID }} private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }} - repositories: nocobase,pro-plugins,${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ',') }} + repositories: nocobase,pro-plugins,${{ join(fromJSON(steps.get-info.outputs.proRepos), ',') }} skip-token-revoke: true - name: Get GitHub App User ID id: get-user-id run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ steps.app-token.outputs.token }} - - name: Get branch - id: get-branch - run: | - if [[ "${{ inputs.version }}" == "alpha" ]]; then - echo "branch=$(echo 'next')" >> $GITHUB_OUTPUT - else - echo "branch=$(echo 'main')" >> $GITHUB_OUTPUT - fi - name: Checkout uses: actions/checkout@v4 with: repository: nocobase/nocobase - ref: ${{ steps.get-branch.outputs.branch }} + ref: ${{ steps.get-info.outputs.branch }} token: ${{ steps.app-token.outputs.token }} persist-credentials: true fetch-depth: 0 @@ -55,16 +57,16 @@ jobs: with: repository: nocobase/pro-plugins path: packages/pro-plugins - ref: ${{ steps.get-branch.outputs.branch }} + ref: ${{ steps.get-info.outputs.branch }} fetch-depth: 0 token: ${{ steps.app-token.outputs.token }} persist-credentials: true - name: Clone pro repos shell: bash run: | - for repo in ${{ join(fromJSON(vars.PRO_PLUGIN_REPOS), ' ') }} + for repo in ${{ join(fromJSON(steps.get-info.outputs.proRepos), ' ') }} do - git clone -b ${{ steps.get-branch.outputs.branch }} https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo + git clone -b ${{ steps.get-info.outputs.branch }} https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/nocobase/$repo.git packages/pro-plugins/@nocobase/$repo done - name: Set user run: | @@ -81,7 +83,7 @@ jobs: run: | node scripts/release/changelogAndRelease.js --ver ${{ inputs.version }} --cmsURL ${{ secrets.CMS_URL }} --cmsToken ${{ secrets.CMS_TOKEN }} env: - PRO_PLUGIN_REPOS: ${{ vars.PRO_PLUGIN_REPOS }} + PRO_PLUGIN_REPOS: ${{ steps.get-info.outputs.proRepos }} GH_TOKEN: ${{ steps.app-token.outputs.token }} - name: Commit and push run: | diff --git a/.github/workflows/manual-build-pro-image.yml b/.github/workflows/manual-build-pro-image.yml index 17db19f1da..3330327a35 100644 --- a/.github/workflows/manual-build-pro-image.yml +++ b/.github/workflows/manual-build-pro-image.yml @@ -88,23 +88,24 @@ jobs: uses: docker/setup-buildx-action@v2 with: driver-opts: network=host - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - nocobase/nocobase - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - name: Login to Aliyun Container Registry uses: docker/login-action@v2 with: registry: ${{ secrets.ALI_DOCKER_REGISTRY }} username: ${{ secrets.ALI_DOCKER_USERNAME }} password: ${{ secrets.ALI_DOCKER_PASSWORD }} + - name: Get tag + id: get-tag + run: | + if [ "${{ inputs.pr_number }}" != "" ]; then + echo "tag=pr-${{ inputs.pr_number }}" >> "$GITHUB_OUTPUT" + else + echo "tag=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_OUTPUT" + fi + - name: Set tags + id: set-tags + run: | + echo "::set-output name=tags::${{ secrets.ALI_DOCKER_REGISTRY }}/nocobase/nocobase:${{ steps.get-tag.outputs.tag }}-pro - name: Set variables run: | target_directory="./packages/pro-plugins/@nocobase" @@ -117,7 +118,7 @@ jobs: echo "var1=$BEFORE_PACK_NOCOBASE" >> $GITHUB_OUTPUT echo "var2=$APPEND_PRESET_LOCAL_PLUGINS" >> $GITHUB_OUTPUT id: vars - - name: Build and push - pr-${{ inputs.pr_number }}-pro + - name: Build and push - ${{ steps.get-tag.outputs.tag }}-pro uses: docker/build-push-action@v3 with: context: . @@ -129,12 +130,12 @@ jobs: BEFORE_PACK_NOCOBASE=${{ steps.vars.outputs.var1 }} APPEND_PRESET_LOCAL_PLUGINS=${{ steps.vars.outputs.var2 }} push: true - tags: ${{ secrets.ALI_DOCKER_REGISTRY }}/nocobase/nocobase:pr-${{ inputs.pr_number }}-pro + tags: ${{ steps.set-tags.outputs.tags }} - name: Deploy NocoBase run: | - curl --retry 2 --location --request POST "${{secrets.NOCOBASE_DEPLOY_HOST}}pr-${{ inputs.pr_number }}-pro" \ + curl --retry 2 --location --request POST "${{secrets.NOCOBASE_DEPLOY_HOST}}${{ steps.get-tag.outputs.tag }}-pro" \ --header 'Content-Type: application/json' \ -d "{ - \"tag\": \"pr-${{ inputs.pr_number }}-pro\", + \"tag\": \"${{ steps.get-tag.outputs.tag }}-pro\", \"dialect\": \"postgres\" }" diff --git a/.github/workflows/release-next.yml b/.github/workflows/release-next.yml index 240075a57f..d22d208ae1 100644 --- a/.github/workflows/release-next.yml +++ b/.github/workflows/release-next.yml @@ -10,8 +10,11 @@ on: jobs: publish-npm: runs-on: ubuntu-latest - container: node:18 steps: + - name: Set Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 - uses: actions/create-github-app-token@v1 id: app-token with: @@ -27,7 +30,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + repository: nocobase/nocobase ref: next + token: ${{ steps.app-token.outputs.token }} + persist-credentials: true fetch-depth: 0 - name: Send curl request and parse response env: diff --git a/scripts/release/changelogAndRelease.js b/scripts/release/changelogAndRelease.js index ad39e59f7c..afd3e84a13 100644 --- a/scripts/release/changelogAndRelease.js +++ b/scripts/release/changelogAndRelease.js @@ -381,7 +381,7 @@ async function getVersion() { return { from, to }; } -async function postCMS(title, content, contentCN) { +async function postCMS(tag, content, contentCN) { const { cmsToken, cmsURL } = program.opts(); if (!cmsToken || !cmsURL) { console.error('No cmsToken or cmsURL provided'); @@ -394,13 +394,16 @@ async function postCMS(title, content, contentCN) { Authorization: `Bearer ${cmsToken}`, }, params: { - filterKeys: ['title'], + filterKeys: ['slug'], }, data: { - title, - title_cn: title, + slug: tag, + title: `Nocobase ${tag}`, + title_cn: `Nocobase ${tag}`, content, content_cn: contentCN, + description: `Release Note of ${tag}`, + description_cn: `${tag} 更新日志`, tags: [4], status: 'drafted', author: 'nocobase [bot]', From f7a368f802400b23229e497c17afa8ee3902fda7 Mon Sep 17 00:00:00 2001 From: Sheldon Guo Date: Thu, 24 Oct 2024 09:29:43 +0800 Subject: [PATCH 3/3] refactor(form): optimize useDataFormItemProps hook (#5484) --- .../blocks/data-blocks/form/hooks/useDataFormItemProps.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts b/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts index b9e50ff5f0..934e66acc5 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts @@ -8,9 +8,10 @@ */ import { useForm } from '@formily/react'; +import { useCollectionRecordData } from '../../../../../data-source/collection-record/CollectionRecordProvider'; import { useSatisfiedActionValues } from '../../../../../schema-settings/LinkageRules/useActionValues'; export function useDataFormItemProps() { - const form = useForm(); - const { valueMap: style } = useSatisfiedActionValues({ category: 'style', formValues: form?.values }); + const data = useCollectionRecordData(); + const { valueMap: style } = useSatisfiedActionValues({ category: 'style', formValues: data }); return { wrapperStyle: style }; }