diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e6c57a..d0132dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,10 +33,6 @@ jobs: VAULT_BASE_URL: ${{ secrets.VAULT_BASE_URL }} VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} - SENTRY_ENVIRONMENT: "stage" # TODO set dynamically when we have prod/stage - SENTRY_URL: ${{ secrets.SENTRY_URL }} - VITE_SENTRY_ENVIRONMENT: "stage" # TODO set dynamically when we have prod/stage - VITE_SENTRY_URL: ${{ secrets.SENTRY_URL }} RUST_BACKTRACE: full RUST_LOG: debug ACTIONS_STEP_DEBUG: true @@ -50,7 +46,8 @@ jobs: roleId: ${{ secrets.VAULT_ROLE_ID }} secretId: ${{ secrets.VAULT_SECRET_ID }} secrets: | - kv/team/text/data/artifactory * | ART_ + kv/team/text/data/artifactory * | ART_ ; + kv/team/text/data/trokk-stage * | TROKK_ ; # Git fix for Windows, workaround for permission issues regarding self-hosted runners - name: Windows; Git fix @@ -82,30 +79,6 @@ jobs: !src-tauri/target/release/bundle key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Rust; Install cargo-audit - run: cargo install cargo-audit - - - name: Rust; Run cargo audit - continue-on-error: true - working-directory: ./src-tauri - run: cargo audit - - - name: Rust; Run cargo fmt - working-directory: ./src-tauri - run: cargo fmt --all -- --check - - - name: Rust; Run cargo clippy - working-directory: ./src-tauri - run: cargo clippy --all -- -D warnings - env: - VAULT_BASE_URL: "PLACEHOLDER" - VAULT_ROLE_ID: "PLACEHOLDER" - VAULT_SECRET_ID: "PLACEHOLDER" - - - name: Rust; Run cargo test - working-directory: ./src-tauri - run: cargo test --all - - name: NPM; Sync node version and setup cache uses: actions/setup-node@v4 with: @@ -119,9 +92,6 @@ jobs: if: ${{ matrix.windows }} run: npm install @tauri-apps/cli-win32-x64-msvc@2.0.0-alpha.21 - - name: NPM; Lint frontend - run: npm run lint - # TODO when tests are set up again #- name: NPM; Run frontend tests # run: npm run test @@ -148,6 +118,11 @@ jobs: - name: Tauri build uses: tauri-apps/tauri-action@v0 + env: + VITE_SENTRY_URL: ${{ steps.import-secrets.outputs.TROKK_SENTRY_DSN }} + VITE_SENTRY_ENVIRONMENT: ${{ steps.import-secrets.outputs.TROKK_SENTRY_ENVIRONMENT }} + SENTRY_URL: ${{ steps.import-secrets.outputs.TROKK_SENTRY_DSN }} + SENTRY_ENVIRONMENT: ${{ steps.import-secrets.outputs.TROKK_SENTRY_ENVIRONMENT }} id: tauri_build - name: Setup JFrog CLI diff --git a/src/features/registration/registration-form.tsx b/src/features/registration/registration-form.tsx index f2af862..4cc879f 100644 --- a/src/features/registration/registration-form.tsx +++ b/src/features/registration/registration-form.tsx @@ -142,22 +142,26 @@ const RegistrationForm: React.FC = () => { return Promise.reject(error); }); + const body = new TextInputDto( + id, + registration.materialType, + auth.userInfo.name, + registration.font, + registration.language, + machineName, + registration.workingTitle, + numberOfPagesTransferred + ); + + await body.setVersion(); + return await fetch(`${papiPath}/v2/item`, { method: 'POST', headers: { 'Authorization': 'Bearer ' + accessToken, 'Content-Type': 'application/json' }, - body: JSON.stringify(new TextInputDto( - id, - registration.materialType, - auth.userInfo.name, - registration.font, - registration.language, - machineName, - registration.workingTitle, - numberOfPagesTransferred - )) + body: JSON.stringify(body) }) .then(async response => { if (response.ok) { @@ -168,6 +172,10 @@ const RegistrationForm: React.FC = () => { console.error(response); handleError(undefined, response.status); } + setAllUploadProgress(progress => { + delete progress.dir[pushedDir]; + return progress; + }); }) .catch(error => { handleError(); diff --git a/src/model/text-input-dto.ts b/src/model/text-input-dto.ts index 446a6ca..0b71236 100644 --- a/src/model/text-input-dto.ts +++ b/src/model/text-input-dto.ts @@ -1,5 +1,5 @@ -import { getMaterialTypeAsKeyString, MaterialType, PublicationType } from './registration-enums.ts'; -import { getVersion } from '@tauri-apps/api/app'; +import {getMaterialTypeAsKeyString, MaterialType, PublicationType} from './registration-enums.ts'; +import {getVersion} from '@tauri-apps/api/app'; export class TextInputDto { id: string; @@ -31,7 +31,7 @@ export class TextInputDto { this.digital = false; this.font = font; this.language = language; - this.application = 'Trøkk ' + getVersion(); + this.application = 'Trøkk'; this.machineName = machineName; this.workName = workName; this.numberOfPages = numberOfPages; @@ -46,4 +46,12 @@ export class TextInputDto { return PublicationType.MONOGRAPHIC; } } + + async setVersion(): Promise { + try { + this.application = 'Trøkk ' + await getVersion(); + } catch (error) { + console.error('Failed to set version:', error); + } + } } \ No newline at end of file