diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bdef8a2e..2ba36cb5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,6 +9,7 @@ updates: interval: "weekly" day: "tuesday" open-pull-requests-limit: 10 + rebase-strategy: auto labels: - dependencies - go @@ -25,6 +26,7 @@ updates: interval: "weekly" day: "tuesday" open-pull-requests-limit: 10 + rebase-strategy: auto labels: - dependencies - python @@ -32,11 +34,12 @@ updates: reviewers: ["emlowe", "altendky"] - package-ecosystem: "github-actions" - directory: / + directories: ["/", ".github/actions/*"] schedule: interval: "weekly" day: "tuesday" open-pull-requests-limit: 10 + rebase-strategy: auto labels: - dependencies - github_actions @@ -49,6 +52,7 @@ updates: interval: "weekly" day: "tuesday" open-pull-requests-limit: 10 + rebase-strategy: auto labels: - dependencies - javascript @@ -61,6 +65,7 @@ updates: interval: "weekly" day: "tuesday" open-pull-requests-limit: 10 + rebase-strategy: auto labels: - dependencies - rust diff --git a/.github/workflows/auto-release-rc.yml b/.github/workflows/auto-release-rc.yml new file mode 100644 index 00000000..274659b4 --- /dev/null +++ b/.github/workflows/auto-release-rc.yml @@ -0,0 +1,79 @@ +# Compares the version in package.json to tags on the repo. If the tag doesn't exist, a new tag is created, which +# then triggers the normal "on tag" release automation in the build job +name: Auto Tag RC + +on: + push: + branches: + - develop + +concurrency: + group: rc-release-check + +jobs: + release-dev: + name: Release rc version + runs-on: ubuntu-latest + steps: + - name: Checkout current branch + uses: actions/checkout@v4 + with: + # Need REPO_COMMIT token so when the tag is created, the tag automation runs + token: ${{ secrets.REPO_COMMIT }} + fetch-depth: 0 + + - name: Setup commit signing for ChiaAutomation + uses: Chia-Network/actions/commit-sign/gpg@main + with: + gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY }} + passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }} + + - name: Check for current version tag. Create if it doesn't exist + env: + GH_TOKEN: ${{ github.token }} + run: | + stable_version=$(gh release list --limit 1 --order desc --exclude-pre-releases --json tagName --jq ".[].tagName") + echo "Latest release is $stable_version" + rc_version=$(gh release list --json tagName --jq ".[] | select(.tagName | test(\"${version}-rc*\")) | .tagName") + echo "Latest release candidate is $rc_version" + + if [[ -z ${rc_version} ]]; then + # Extract the major, minor, and patch versions + IFS='.' read -r major minor patch <<< "$stable_version" + + # Increment the patch version + new_patch=$((patch + 1)) + + # Construct the new version string + version="$major.$minor.$new_patch-rc1" + + echo "New version: $version" + + else + # Extract the major, minor, patch, and rc parts + IFS='.-' read -r major minor patch rc <<< "$rc_version" + + # Extract just the number of the rc + rc_number="${rc#rc}" + + # Increment the rc number + rc_number=$((rc_number +1)) + + # Construct the new version string + version="$major.$minor.$patch-rc$rc_number" + + echo "New version: $version" + + fi + + if [ $(git tag -l "$version") ]; then + echo "$version tag exists, deleting..." + git tag -d $version + git push --delete origin $version + fi + echo "Tag does not exist. Creating and pushing tag" + rm -f CHANGELOG.md + npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0 + changes=$(npx conventional-changelog-cli -r 1 | tail -n +2) + git tag $version -m "Release $version $changes" + git push origin $version diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index a97318e1..d701107b 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -15,14 +15,11 @@ jobs: name: Check version increment runs-on: ubuntu-latest steps: - - name: Clean workspace - uses: Chia-Network/actions/clean-workspace@main - - name: Checkout current branch uses: actions/checkout@v4 with: - # Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs - token: ${{ secrets.PACKAGE_ADMIN_PAT }} + # Need REPO_COMMIT token so when the tag is created, the tag automation runs + token: ${{ secrets.REPO_COMMIT }} fetch-depth: 0 - name: Setup commit signing for ChiaAutomation diff --git a/.github/workflows/build-installers.yaml b/.github/workflows/build-installers.yaml index 17fc4fe1..5087bdcf 100644 --- a/.github/workflows/build-installers.yaml +++ b/.github/workflows/build-installers.yaml @@ -9,10 +9,10 @@ on: - '**' concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }} cancel-in-progress: true + permissions: id-token: write contents: write @@ -22,8 +22,6 @@ jobs: name: Build Mac Installer runs-on: macos-latest steps: - - uses: Chia-Network/actions/clean-workspace@main - - name: Checkout Code uses: actions/checkout@v4 @@ -38,6 +36,17 @@ jobs: - name: install dmg-license run: npm i dmg-license + - name: Change the package.json version if an RC tag + shell: bash + if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc') + run: | + echo "Github ref: $GITHUB_REF" + IFS='/' read -r base directory tag <<< "$GITHUB_REF" + echo "Extracted tag is $tag" + + jq ".version = \"${tag}\"" package.json > package.tmp + mv package.tmp package.json + - name: npm install run: | npm install @@ -51,10 +60,10 @@ jobs: if [ -n "$SIGNING_SECRET" ]; then HAS_SIGNING_SECRET='true' ; fi echo "HAS_SIGNING_SECRET=${HAS_SIGNING_SECRET}" >> "$GITHUB_OUTPUT" env: - SIGNING_SECRET: "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" - + SIGNING_SECRET: "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" + - name: Import Apple installer signing certificate - if: steps.check_secrets.outputs.HAS_SIGNING_SECRET + if: steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/') && startsWith(github.ref, 'refs/tags/') uses: Apple-Actions/import-codesign-certs@v3 with: p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }} @@ -66,7 +75,7 @@ jobs: run: npm run electron:package:mac - name: Notarize - if: steps.check_secrets.outputs.HAS_SIGNING_SECRET + if: steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/') run: | DMG_FILE=$(find ${{ github.workspace }}/dist/ -type f -name '*.dmg') xcrun notarytool submit \ @@ -100,6 +109,17 @@ jobs: - name: Ignore Husky where not compatible run: npm pkg delete scripts.prepare + - name: Change the package.json version if an RC tag + shell: bash + if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc') + run: | + echo "Github ref: $GITHUB_REF" + IFS='/' read -r base directory tag <<< "$GITHUB_REF" + echo "Extracted tag is $tag" + + jq ".version = \"${tag}\"" package.json > package.tmp + mv package.tmp package.json + - name: npm install run: | node --version @@ -117,8 +137,8 @@ jobs: if [ -n "$SIGNING_SECRET" ]; then HAS_SIGNING_SECRET='true' ; fi echo "HAS_SIGNING_SECRET=${HAS_SIGNING_SECRET}" >> "$GITHUB_OUTPUT" env: - SIGNING_SECRET: "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" - + SIGNING_SECRET: "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" + # Windows Code Signing - name: Get installer name for signing shell: bash @@ -158,6 +178,17 @@ jobs: - name: Install Husky run: npm install --save-dev husky + - name: Change the package.json version if an RC tag + shell: bash + if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc') + run: | + echo "Github ref: $GITHUB_REF" + IFS='/' read -r base directory tag <<< "$GITHUB_REF" + echo "Extracted tag is $tag" + + jq ".version = \"${tag}\"" package.json > package.tmp + mv package.tmp package.json + - name: npm install run: | node --version @@ -167,6 +198,7 @@ jobs: run: npm run electron:package:linux - name: Rename Linux installer to be standard format for apt + shell: bash run: | ORIGINAL=$(ls dist/*.deb) MODIFIED=${ORIGINAL:0:-10}-1${ORIGINAL#${ORIGINAL:0:-10}} @@ -193,6 +225,17 @@ jobs: - name: Install Husky run: npm install --save-dev husky + - name: Change the package.json version if an RC tag + shell: bash + if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc') + run: | + echo "Github ref: $GITHUB_REF" + IFS='/' read -r base directory tag <<< "$GITHUB_REF" + echo "Extracted tag is $tag" + + jq ".version = \"${tag}\"" package.json > package.tmp + mv package.tmp package.json + - name: npm install and build run: | node --version @@ -253,9 +296,33 @@ jobs: echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV + # RC release should not be set as latest + - name: Decide if release should be set as latest + id: is_latest + shell: bash + run: | + unset IS_LATEST + + echo "Github ref is $GITHUB_REF" + + if [[ "$GITHUB_REF" =~ "-rc" ]]; then + echo "release candidate tag matched" + IS_LATEST='false' + IS_PRERELEASE='true' + else + echo "main branch release matched" + IS_LATEST='true' + IS_PRERELEASE='false' + fi + + echo "IS_LATEST=${IS_LATEST}" >> "$GITHUB_OUTPUT" + echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT" + - name: Release - uses: softprops/action-gh-release@v2.1.0 + uses: softprops/action-gh-release@v2 with: + prerelease: ${{steps.is_latest.outputs.IS_PRERELEASE}} + make_latest: "${{steps.is_latest.outputs.IS_LATEST}}" files: | ${{ env.DMG_FILE }} ${{ env.DEB_FILE }} @@ -268,6 +335,7 @@ jobs: echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT - name: Trigger apt repo update + if: startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc') uses: Chia-Network/actions/github/glue@main with: json_data: '{"cadt_repo":"cadt-ui","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' diff --git a/.github/workflows/ensure-version-increment.yml b/.github/workflows/ensure-version-increment.yml index f1f1c02c..316af24a 100644 --- a/.github/workflows/ensure-version-increment.yml +++ b/.github/workflows/ensure-version-increment.yml @@ -16,8 +16,6 @@ jobs: name: Check version increment runs-on: ubuntu-latest steps: - - uses: Chia-Network/actions/clean-workspace@main - - name: Checkout current branch uses: actions/checkout@v4 with: @@ -35,7 +33,7 @@ jobs: branch_version=$(cat $GITHUB_WORKSPACE/branch-repo/package.json | jq -r '.version') echo "Main version: $main_version" echo "Branch version: $branch_version" - + if [[ "$branch_version" == "$main_version" ]]; then echo "Version in package.json on this branch is not changing. Version must incremenet for a merge to main" exit 1 diff --git a/package-lock.json b/package-lock.json index 2f450088..a76c4c9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,8 +8,8 @@ "name": "cadt-ui", "version": "2.0.4", "dependencies": { - "@emotion/react": "^11.13.5", - "@emotion/styled": "^11.13.5", + "@emotion/react": "^11.14.0", + "@emotion/styled": "^11.14.0", "@mui/material": "^5.16.8", "@reduxjs/toolkit": "^2.4.0", "@tailwindcss/aspect-ratio": "^0.4.2", @@ -18,7 +18,7 @@ "@xterm/xterm": "^5.5.0", "components": "^0.1.0", "dayjs": "^1.11.13", - "diff": "^5.2.0", + "diff": "^7.0.0", "flowbite": "^2.5.2", "flowbite-react": "^0.10.2", "flowbite-typography": "^1.0.5", @@ -50,7 +50,7 @@ "@vitejs/plugin-react-swc": "^3.7.2", "autoprefixer": "^10.4.20", "commitlint": "^19.6.0", - "concurrently": "^8.2.2", + "concurrently": "^9.1.0", "cross-env": "^7.0.3", "electron": "^28.3.3", "electron-builder": "^24.13.3", @@ -60,13 +60,13 @@ "husky": "^9.1.7", "lint-staged": "^15.2.10", "postcss": "^8.4.49", - "prettier": "^3.4.1", + "prettier": "^3.4.2", "prettier-eslint": "^16.3.0", "standard-version": "^9.5.0", "tailwindcss": "^3.4.15", "typescript": "^5.7.2", "vite": "^5.4.11", - "wait-on": "^7.2.0" + "wait-on": "^8.0.1" }, "engines": { "node": ">=20.16" @@ -874,10 +874,9 @@ } }, "node_modules/@emotion/cache": { - "version": "11.13.5", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.13.5.tgz", - "integrity": "sha512-Z3xbtJ+UcK76eWkagZ1onvn/wAVb1GOMuR15s30Fm2wrMgC7jzpnO2JZXr4eujTTqoQFUrZIw/rT0c6Zzjca1g==", - "license": "MIT", + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.14.0.tgz", + "integrity": "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==", "dependencies": { "@emotion/memoize": "^0.9.0", "@emotion/sheet": "^1.4.0", @@ -908,16 +907,15 @@ "license": "MIT" }, "node_modules/@emotion/react": { - "version": "11.13.5", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.13.5.tgz", - "integrity": "sha512-6zeCUxUH+EPF1s+YF/2hPVODeV/7V07YU5x+2tfuRL8MdW6rv5vb2+CBEGTGwBdux0OIERcOS+RzxeK80k2DsQ==", - "license": "MIT", + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", + "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", - "@emotion/cache": "^11.13.5", + "@emotion/cache": "^11.14.0", "@emotion/serialize": "^1.3.3", - "@emotion/use-insertion-effect-with-fallbacks": "^1.1.0", + "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", "@emotion/utils": "^1.4.2", "@emotion/weak-memoize": "^0.4.0", "hoist-non-react-statics": "^3.3.1" @@ -951,16 +949,15 @@ "license": "MIT" }, "node_modules/@emotion/styled": { - "version": "11.13.5", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.13.5.tgz", - "integrity": "sha512-gnOQ+nGLPvDXgIx119JqGalys64lhMdnNQA9TMxhDA4K0Hq5+++OE20Zs5GxiCV9r814xQ2K5WmtofSpHVW6BQ==", - "license": "MIT", + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.0.tgz", + "integrity": "sha512-XxfOnXFffatap2IyCeJyNov3kiDQWoR08gPUQxvbL7fxKryGBKUZUkG6Hz48DZwVrJSVh9sJboyV1Ds4OW6SgA==", "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", "@emotion/is-prop-valid": "^1.3.0", "@emotion/serialize": "^1.3.3", - "@emotion/use-insertion-effect-with-fallbacks": "^1.1.0", + "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", "@emotion/utils": "^1.4.2" }, "peerDependencies": { @@ -980,10 +977,9 @@ "license": "MIT" }, "node_modules/@emotion/use-insertion-effect-with-fallbacks": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.1.0.tgz", - "integrity": "sha512-+wBOcIV5snwGgI2ya3u99D7/FJquOIniQT1IKyDsBmEgwvpxMNeS65Oib7OnE2d2aY+3BU4OiH+0Wchf8yk3Hw==", - "license": "MIT", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.2.0.tgz", + "integrity": "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==", "peerDependencies": { "react": ">=16.8.0" } @@ -4651,18 +4647,16 @@ } }, "node_modules/concurrently": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", - "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.1.0.tgz", + "integrity": "sha512-VxkzwMAn4LP7WyMnJNbHN5mKV9L2IbyDjpzemKr99sXNR3GqRNMMHdm7prV1ws9wg7ETj6WUkNOigZVsptwbgg==", "dev": true, "license": "MIT", "dependencies": { "chalk": "^4.1.2", - "date-fns": "^2.30.0", "lodash": "^4.17.21", "rxjs": "^7.8.1", "shell-quote": "^1.8.1", - "spawn-command": "0.0.2", "supports-color": "^8.1.1", "tree-kill": "^1.2.2", "yargs": "^17.7.2" @@ -4672,7 +4666,7 @@ "concurrently": "dist/bin/concurrently.js" }, "engines": { - "node": "^14.13.0 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" @@ -6003,23 +5997,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/date-fns": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.21.0" - }, - "engines": { - "node": ">=0.11" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/date-fns" - } - }, "node_modules/dateformat": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", @@ -6240,9 +6217,9 @@ "license": "Apache-2.0" }, "node_modules/diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" @@ -11018,11 +10995,10 @@ } }, "node_modules/prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", - "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "dev": true, - "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -12219,12 +12195,6 @@ "node": ">=0.10.0" } }, - "node_modules/spawn-command": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", - "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", - "dev": true - }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -13559,14 +13529,14 @@ } }, "node_modules/wait-on": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.2.0.tgz", - "integrity": "sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-8.0.1.tgz", + "integrity": "sha512-1wWQOyR2LVVtaqrcIL2+OM+x7bkpmzVROa0Nf6FryXkS+er5Sa1kzFGjzZRqLnHa3n1rACFLeTwUqE1ETL9Mig==", "dev": true, "license": "MIT", "dependencies": { - "axios": "^1.6.1", - "joi": "^17.11.0", + "axios": "^1.7.7", + "joi": "^17.13.3", "lodash": "^4.17.21", "minimist": "^1.2.8", "rxjs": "^7.8.1" diff --git a/package.json b/package.json index bc540c8d..7667857d 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "electron:package:linux": "npm run clean && npm run build && electron-builder -l -c.extraMetadata.main=build/main.js" }, "dependencies": { - "@emotion/react": "^11.13.5", - "@emotion/styled": "^11.13.5", + "@emotion/react": "^11.14.0", + "@emotion/styled": "^11.14.0", "@mui/material": "^5.16.8", "@reduxjs/toolkit": "^2.4.0", "@tailwindcss/aspect-ratio": "^0.4.2", @@ -36,7 +36,7 @@ "@xterm/xterm": "^5.5.0", "components": "^0.1.0", "dayjs": "^1.11.13", - "diff": "^5.2.0", + "diff": "^7.0.0", "flowbite": "^2.5.2", "flowbite-react": "^0.10.2", "flowbite-typography": "^1.0.5", @@ -68,7 +68,7 @@ "@vitejs/plugin-react-swc": "^3.7.2", "autoprefixer": "^10.4.20", "commitlint": "^19.6.0", - "concurrently": "^8.2.2", + "concurrently": "^9.1.0", "cross-env": "^7.0.3", "electron": "^28.3.3", "electron-builder": "^24.13.3", @@ -78,13 +78,13 @@ "husky": "^9.1.7", "lint-staged": "^15.2.10", "postcss": "^8.4.49", - "prettier": "^3.4.1", + "prettier": "^3.4.2", "prettier-eslint": "^16.3.0", "standard-version": "^9.5.0", "tailwindcss": "^3.4.15", "typescript": "^5.7.2", "vite": "^5.4.11", - "wait-on": "^7.2.0" + "wait-on": "^8.0.1" }, "standard-version": { "skip": { diff --git a/src/renderer/api/cadt/v1/organizations/organizations.api.ts b/src/renderer/api/cadt/v1/organizations/organizations.api.ts index 86a461f4..ab754b8e 100644 --- a/src/renderer/api/cadt/v1/organizations/organizations.api.ts +++ b/src/renderer/api/cadt/v1/organizations/organizations.api.ts @@ -9,7 +9,12 @@ interface GetOrgnaizationsMapResponse { interface CreateOrganizationResponse { message: string; - orgId: string; + orgUid: string; +} + +interface CreateOrganizationParams { + orgUid: string; + isHome: boolean; } const organizationsApi = cadtApi.injectEndpoints({ @@ -59,22 +64,20 @@ const organizationsApi = cadtApi.injectEndpoints({ invalidatesTags: [organizationsTag], }), - importOrganization: builder.mutation({ - query: (orgUid: string) => ({ + importOrganization: builder.mutation({ + query: (createOrgParams) => ({ url: `/v1/organizations`, method: 'PUT', headers: { 'Content-Type': 'application/json' }, - body: { orgUid }, + body: createOrgParams, }), invalidatesTags: [organizationsTag], }), deleteOrganization: builder.mutation({ query: (orgUid: string) => ({ - url: `/v1/organizations`, + url: `/v1/organizations/${orgUid}`, method: 'DELETE', - headers: { 'Content-Type': 'application/json' }, - body: { orgUid }, }), invalidatesTags: [organizationsTag], }), diff --git a/src/renderer/components/blocks/forms/ImportOrganizationForm.tsx b/src/renderer/components/blocks/forms/ImportOrganizationForm.tsx index 3d39141b..902fafb4 100644 --- a/src/renderer/components/blocks/forms/ImportOrganizationForm.tsx +++ b/src/renderer/components/blocks/forms/ImportOrganizationForm.tsx @@ -1,23 +1,28 @@ import React, { useCallback } from 'react'; import { ErrorMessage, Field, Form, Formik } from 'formik'; import * as yup from 'yup'; -import { FloatingLabel, FormButton } from '@/components'; +import { CheckBox, FloatingLabel, FormButton, Label } from '@/components'; import { FormattedMessage, IntlShape, useIntl } from 'react-intl'; const validationSchema = yup.object({ orgUid: yup.string().length(64).required('OrgUid is required'), }); +export interface ImportOrganizationProps { + orgUid: string; + isHome: boolean; +} + interface FormProps { - onSubmit: (orgUid: string) => Promise; + onSubmit: (params: ImportOrganizationProps) => Promise; } const ImportOrganizationForm: React.FC = ({ onSubmit }) => { const intl: IntlShape = useIntl(); const handleSubmit = useCallback( - async (values: { orgUid: string }, { setSubmitting }) => { - await onSubmit(values.orgUid); + async (values: ImportOrganizationProps, { setSubmitting }) => { + await onSubmit(values); setSubmitting(false); }, [onSubmit], @@ -25,7 +30,7 @@ const ImportOrganizationForm: React.FC = ({ onSubmit }) => { return ( <> - + {({ errors, touched, isSubmitting }) => (
@@ -42,6 +47,14 @@ const ImportOrganizationForm: React.FC = ({ onSubmit }) => { )} {touched.orgUid && } +
+ {({ field }) => } + +
diff --git a/src/renderer/components/blocks/modals/CreateOrganizationModal.tsx b/src/renderer/components/blocks/modals/CreateOrganizationModal.tsx index 2192e365..56f2b509 100644 --- a/src/renderer/components/blocks/modals/CreateOrganizationModal.tsx +++ b/src/renderer/components/blocks/modals/CreateOrganizationModal.tsx @@ -1,4 +1,4 @@ -import { Card, CreateOrganizationForm, Modal, Spinner, Tabs } from '@/components'; +import { Card, CreateOrganizationForm, ImportOrganizationProps, Modal, Spinner, Tabs } from '@/components'; import { FormattedMessage } from 'react-intl'; import { useCreateOrganizationMutation, useImportOrganizationMutation } from '@/api'; import { ImportOrganizationForm } from '@/components/blocks/forms/ImportOrganizationForm'; @@ -31,8 +31,9 @@ const CreateOrganizationModal: React.FC = ({ } }; - const handleSubmitImportOrg = async (orgName: string) => { - const createOrgResult: any = await triggerImportOrganization(orgName); + const handleSubmitImportOrg = async (importOrgFormValues: ImportOrganizationProps) => { + const { orgUid, isHome } = importOrgFormValues; + const createOrgResult: any = await triggerImportOrganization({ orgUid, isHome }); if (createOrgResult?.data.success) { onClose(); } else { diff --git a/src/renderer/components/proxy/CheckBox.tsx b/src/renderer/components/proxy/CheckBox.tsx new file mode 100644 index 00000000..7168e1e1 --- /dev/null +++ b/src/renderer/components/proxy/CheckBox.tsx @@ -0,0 +1,7 @@ +import { Checkbox as FlowbiteCheckBox, CheckboxProps } from 'flowbite-react'; + +function CheckBox({ children, ...props }: CheckboxProps) { + return {children}; +} + +export { CheckBox }; diff --git a/src/renderer/components/proxy/index.ts b/src/renderer/components/proxy/index.ts index 07f67578..89c759b4 100644 --- a/src/renderer/components/proxy/index.ts +++ b/src/renderer/components/proxy/index.ts @@ -16,3 +16,4 @@ export * from './FloatingLabel'; export * from './Select'; export * from './Badge'; export * from './Popover'; +export * from './CheckBox'; diff --git a/src/renderer/translations/tokens/en-US.json b/src/renderer/translations/tokens/en-US.json index 427d6fe1..b74174a5 100644 --- a/src/renderer/translations/tokens/en-US.json +++ b/src/renderer/translations/tokens/en-US.json @@ -208,5 +208,6 @@ "api-host-loaded-from-configuration": "API host loaded from configuration", "not-specified": "not specified", "unable-to-load-staging-data": "Unable to load staging data", - "new-unit": "New Unit" + "new-unit": "New Unit", + "import-as-home-organization": "Import as home organization" }