RED-3800 Cleanup of system preferences

This commit is contained in:
Timo Bejan 2022-05-24 15:46:10 +03:00
parent 9ca5d22b21
commit 16e32b5191
6 changed files with 33 additions and 11 deletions

View File

@ -5,8 +5,22 @@
<div class="dialog-content">
<div class="dialog-content-left">
<div *ngFor="let key of keys" class="iqser-input-group required">
<label [translate]="translations.label[key]"></label>
<input [formControlName]="key" [name]="key" [placeholder]="translations.placeholder[key] | translate" type="number" />
<label [translate]="translations.label[key.name]"></label>
<input
*ngIf="key.type === 'number'"
[formControlName]="key.name"
[name]="key.name"
[placeholder]="translations.placeholder[key.name] | translate"
type="number"
/>
<input
*ngIf="key.type === 'string'"
[formControlName]="key.name"
[name]="key.name"
[placeholder]="translations.placeholder[key.name] | translate"
type="text"
/>
<mat-slide-toggle color="primary" [formControlName]="key.name" *ngIf="key.type === 'boolean'"></mat-slide-toggle>
</div>
</div>
</div>

View File

@ -6,6 +6,8 @@ import { firstValueFrom } from 'rxjs';
import { SystemPreferencesService } from '@services/system-preferences.service';
import { systemPreferencesTranslations } from '@translations/system-preferences-translations';
export type ValueType = 'number' | 'string' | 'boolean';
@Component({
selector: 'redaction-system-preferences-form',
templateUrl: './system-preferences-form.component.html',
@ -13,10 +15,11 @@ import { systemPreferencesTranslations } from '@translations/system-preferences-
})
export class SystemPreferencesFormComponent extends BaseFormComponent {
readonly translations = systemPreferencesTranslations;
readonly keys: KeysOf<SystemPreferences>[] = [
'softDeleteCleanupTime',
'downloadCleanupDownloadFilesHours',
'downloadCleanupNotDownloadFilesHours',
readonly keys: { name: KeysOf<SystemPreferences>; type: ValueType }[] = [
{ name: 'softDeleteCleanupTime', type: 'number' },
{ name: 'downloadCleanupDownloadFilesHours', type: 'number' },
{ name: 'downloadCleanupNotDownloadFilesHours', type: 'number' },
{ name: 'removeDigitalSignaturesOnUpload', type: 'boolean' },
];
private _initialConfiguration: SystemPreferences;
@ -39,7 +42,7 @@ export class SystemPreferencesFormComponent extends BaseFormComponent {
private _getForm(): FormGroup {
const controlsConfig = {};
this.keys.forEach(key => (controlsConfig[key] = [this._systemPreferencesService.values[key], Validators.required]));
this.keys.forEach(key => (controlsConfig[key.name] = [this._systemPreferencesService.values[key.name], Validators.required]));
return this._formBuilder.group(controlsConfig);
}

View File

@ -9,6 +9,7 @@ export const systemPreferencesTranslations: Record<'label' | 'placeholder', Reco
downloadCleanupNotDownloadFilesHours: _(
'general-config-screen.system-preferences.labels.download-cleanup-not-download-files-hours',
),
removeDigitalSignaturesOnUpload: _('general-config-screen.system-preferences.labels.remove-digital-signature-on-upload'),
},
placeholder: {
softDeleteCleanupTime: _('general-config-screen.system-preferences.placeholders.soft-delete-cleanup-time'),
@ -16,5 +17,6 @@ export const systemPreferencesTranslations: Record<'label' | 'placeholder', Reco
downloadCleanupNotDownloadFilesHours: _(
'general-config-screen.system-preferences.placeholders.download-cleanup-not-download-files-hours',
),
removeDigitalSignaturesOnUpload: _('general-config-screen.system-preferences.placeholders.remove-digital-signature-on-upload'),
},
} as const;

View File

@ -1,7 +1,7 @@
{
"ADMIN_CONTACT_NAME": null,
"ADMIN_CONTACT_URL": null,
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
"API_URL": "https://dev-05.iqser.cloud/redaction-gateway-v1",
"APP_NAME": "RedactManager",
"AUTO_READ_TIME": 3,
"BACKEND_APP_VERSION": "4.4.40",
@ -16,7 +16,7 @@
"MAX_RETRIES_ON_SERVER_ERROR": 3,
"OAUTH_CLIENT_ID": "redaction",
"OAUTH_IDP_HINT": null,
"OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction",
"OAUTH_URL": "https://dev-05.iqser.cloud/auth/realms/redaction",
"RECENT_PERIOD_IN_HOURS": 24,
"SELECTION_MODE": "structural",
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview"

View File

@ -1448,12 +1448,14 @@
"labels": {
"download-cleanup-download-files-hours": "Cleanup time for downloaded files (hours)",
"download-cleanup-not-download-files-hours": "Cleanup time for not downloaded files (hours)",
"soft-delete-cleanup-time": "Soft delete cleanup time (hours)"
"soft-delete-cleanup-time": "Soft delete cleanup time (hours)",
"remove-digital-signature-on-upload": "Remove Digital Signature on Upload"
},
"placeholders": {
"download-cleanup-download-files-hours": "(hours)",
"download-cleanup-not-download-files-hours": "(hours)",
"soft-delete-cleanup-time": "(hours)"
"soft-delete-cleanup-time": "(hours)",
"remove-digital-signature-on-upload": "True / False"
},
"title": "System Preferences"
},

View File

@ -2,4 +2,5 @@ export interface SystemPreferences {
softDeleteCleanupTime: number;
downloadCleanupDownloadFilesHours: number;
downloadCleanupNotDownloadFilesHours: number;
removeDigitalSignaturesOnUpload: boolean;
}