- @if (!isReview) {
+ @if ((!dialogData || !dialogData?.noType) && !isReview) {
extends DialogSuperclass<
CreateDomainObjectDialogComponent,
- { objectType?: keyof ReflessDomainObject } | void
+ {
+ objectType?: T;
+ noType?: boolean;
+ initValue?: Partial;
+ noNavigate?: boolean;
+ } | void
>
implements OnInit
{
@@ -89,7 +97,7 @@ export class CreateDomainObjectDialogComponent
typeControl = new FormControl(null, { nonNullable: true });
forceRefControl = new FormControl(false, { nonNullable: true });
- control = new FormControl(null, {
+ control = new FormControl((this.dialogData && this.dialogData?.initValue) ?? null, {
validators: [Validators.required],
nonNullable: true,
});
@@ -110,8 +118,13 @@ export class CreateDomainObjectDialogComponent
metadata$,
getValueChanges(this.forceRefControl),
]).pipe(
- map(([fieldName, metadata, isForceRef]) =>
- this.getType(metadata, fieldName, isForceRef ? 'DomainObject' : 'ReflessDomainObject'),
+ map(
+ ([fieldName, metadata, isForceRef]) =>
+ this.getType(
+ metadata,
+ fieldName,
+ isForceRef ? 'DomainObject' : 'ReflessDomainObject',
+ ) as string,
),
shareReplay({ refCount: true, bufferSize: 1 }),
);
@@ -151,9 +164,11 @@ export class CreateDomainObjectDialogComponent
.pipe(progressTo(this.progress$), takeUntilDestroyed(this.destroyRef))
.subscribe(() => {
this.log.successOperation('create', 'domain object');
- void this.navigateService.navigate(APP_ROUTES.domain.root, {
- type: getUnionKey(this.control.value),
- });
+ if (!this.dialogData || !this.dialogData.noNavigate) {
+ void this.navigateService.navigate(APP_ROUTES.domain.root, {
+ type: getUnionKey(this.control.value),
+ });
+ }
this.closeWithSuccess();
});
}
diff --git a/src/services/config/index.ts b/src/services/config/index.ts
index 90392254a..293b57bea 100644
--- a/src/services/config/index.ts
+++ b/src/services/config/index.ts
@@ -1 +1,2 @@
export * from './config.service';
+export * from './types/app-config';
diff --git a/src/services/config/types/app-config.ts b/src/services/config/types/app-config.ts
index 11380887b..34e5a7971 100644
--- a/src/services/config/types/app-config.ts
+++ b/src/services/config/types/app-config.ts
@@ -5,9 +5,29 @@ interface Endpoint {
https?: boolean;
}
+interface PresetConfig {
+ paymentInstitution: number;
+ category: number;
+ termset?: number;
+}
+
+export const PRESETS = [
+ {
+ label: 'Production',
+ value: 'prod',
+ },
+ {
+ label: 'Test',
+ value: 'test',
+ },
+] as const satisfies readonly { label: string; value: string }[];
+export const DEFAULT_PRESET = PRESETS[0].value;
+export type Preset = (typeof PRESETS)[number]['value'];
+
export interface AppConfig {
api: {
wachter: Endpoint;
};
checkout: Endpoint;
+ default: Record;
}
diff --git a/tsconfig.spec.json b/tsconfig.spec.json
index 3998ac810..8319be646 100644
--- a/tsconfig.spec.json
+++ b/tsconfig.spec.json
@@ -4,7 +4,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
- "types": ["jasmine"]
+ "types": ["vitest/globals"]
},
"include": ["src/**/*.ts"],
"angularCompilerOptions": {