Skip to content

Commit

Permalink
Merge branch 'master' into feat/enlarge-image-TT-1782
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmonsen authored Dec 19, 2024
2 parents 8d9290b + 4993c95 commit 8ba84d9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 45 deletions.
39 changes: 7 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -119,9 +92,6 @@ jobs:
if: ${{ matrix.windows }}
run: npm install @tauri-apps/[email protected]

- name: NPM; Lint frontend
run: npm run lint

# TODO when tests are set up again
#- name: NPM; Run frontend tests
# run: npm run test
Expand All @@ -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
Expand Down
28 changes: 18 additions & 10 deletions src/features/registration/registration-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down
14 changes: 11 additions & 3 deletions src/model/text-input-dto.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -46,4 +46,12 @@ export class TextInputDto {
return PublicationType.MONOGRAPHIC;
}
}

async setVersion(): Promise<void> {
try {
this.application = 'Trøkk ' + await getVersion();
} catch (error) {
console.error('Failed to set version:', error);
}
}
}

0 comments on commit 8ba84d9

Please sign in to comment.