admin pages ui fixes on deleted state

This commit is contained in:
amentis 2024-07-16 11:40:36 +03:00
parent 27b6643180
commit 6173f088ed
12 changed files with 52 additions and 31 deletions

View File

@ -218,7 +218,7 @@ public class UsageLimitQuery extends QueryBase<UsageLimitEntity> {
return UsageLimitEntity._updatedAt;
else if (item.match(UsageLimit._isActive))
return UsageLimitEntity._isActive;
else if (item.prefix(UsageLimit._belongsToCurrentTenant))
else if (item.match(UsageLimit._belongsToCurrentTenant))
return UsageLimitEntity._tenantId;
else
return null;

View File

@ -8,7 +8,7 @@
<div class="col-auto">
<button mat-button class="action-btn" (click)="cancel()" type="button">{{'LANGUAGE-EDITOR.ACTIONS.CANCEL' | translate}}</button>
</div>
<div class="col-auto" *ngIf="!isNew && this.editorModel.belongsToCurrentTenant != false">
<div class="col-auto" *ngIf="!isNew && this.editorModel.belongsToCurrentTenant != false && canDelete">
<button mat-button class="action-btn" type="button" (click)="delete()">
<mat-icon>delete</mat-icon>
{{'LANGUAGE-EDITOR.ACTIONS.DELETE' | translate}}
@ -65,7 +65,7 @@
<mat-error *ngIf="formGroup.get('payload').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<h9 class="col-12">{{'LANGUAGE-EDITOR.FIELDS.OVERRIDE' | translate}}
<mat-checkbox [disabled]="this.editorModel.belongsToCurrentTenant == false" (change)="overrideFromFile($event, formGroup.get('code').value)"></mat-checkbox>
<mat-checkbox [disabled]="this.editorModel.belongsToCurrentTenant == false || isDeleted" (change)="overrideFromFile($event, formGroup.get('code').value)"></mat-checkbox>
</h9>
</div>
</div>

View File

@ -37,6 +37,7 @@ export class PrefillingSourceEditorModel extends BaseEditorModel implements Pref
code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
definition: this.definition.buildForm({
rootPath: `definition.`,
disabled: disabled
}),
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators]
});
@ -123,26 +124,30 @@ export class PrefillingSourceDefinitionEditorModel implements PrefillingSourceDe
fields: this.formBuilder.array(
(this.fields ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}fields[${index}].`
rootPath: `${rootPath}fields[${index}].`,
disabled: disabled
})
), context.getValidation('fields')
),
fixedValueFields: this.formBuilder.array(
(this.fixedValueFields ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}fixedValueFields[${index}].`
rootPath: `${rootPath}fixedValueFields[${index}].`,
disabled: disabled
})
), context.getValidation('fixedValueFields')
),
searchConfiguration: this.searchConfiguration.buildForm({
rootPath: `${rootPath}searchConfiguration.`
rootPath: `${rootPath}searchConfiguration.`,
disabled: disabled
}),
getEnabled: [{ value: this.getEnabled, disabled: disabled }, context.getValidation('getEnabled').validators],
});
if (this.getEnabled == true) {
form.addControl('getConfiguration', this.getConfiguration.buildForm({
rootPath: `${rootPath}getConfiguration.`
rootPath: `${rootPath}getConfiguration.`,
disabled: disabled
}));
}
return form;

View File

@ -41,7 +41,8 @@ export class ReferenceTypeEditorModel extends BaseEditorModel implements Referen
name: [{ value: this.name, disabled: disabled }, context.getValidation('name').validators],
code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
definition: this.definition.buildForm({
rootPath: `definition.`
rootPath: `definition.`,
disabled: disabled
}),
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators]
});
@ -138,14 +139,16 @@ export class ReferenceTypeDefinitionEditorModel implements ReferenceTypeDefiniti
fields: this.formBuilder.array(
(this.fields ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}fields[${index}].`
rootPath: `${rootPath}fields[${index}].`,
disabled: disabled
})
), context.getValidation('fields').validators
),
sources: this.formBuilder.array(
(this.sources ?? []).map(
(item, index) =>item.buildForm({
rootPath: `${rootPath}sources[${index}].`
rootPath: `${rootPath}sources[${index}].`,
disabled: disabled
})
), context.getValidation('sources').validators
)

View File

@ -49,7 +49,8 @@ export class ReferenceEditorModel extends BaseEditorModel implements ReferencePe
typeId: [{ value: this.typeId, disabled: disabled }, context.getValidation('typeId').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
definition: this.definition.buildForm({
rootPath: `definition.`
rootPath: `definition.`,
disabled: disabled
}),
reference: [{ value: this.reference, disabled: disabled }, context.getValidation('reference').validators],
abbreviation: [{ value: this.abbreviation, disabled: disabled }, context.getValidation('abbreviation').validators],
@ -130,7 +131,8 @@ export class DefinitionEditorModel implements DefinitionPersist {
fields: this.formBuilder.array(
(this.fields ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}fields[${index}].`
rootPath: `${rootPath}fields[${index}].`,
disabled: disabled
})
), context.getValidation('fields').validators
),

View File

@ -8,7 +8,7 @@
<div class="col-auto">
<button mat-button class="action-btn" (click)="cancel()" type="button">{{'USAGE-LIMIT-EDITOR.ACTIONS.CANCEL' | translate}}</button>
</div>
<div class="col-auto" *ngIf="!isNew">
<div class="col-auto" *ngIf="canDelete">
<button mat-button class="action-btn" type="button" (click)="delete()">
<mat-icon>delete</mat-icon>
{{'USAGE-LIMIT-EDITOR.ACTIONS.DELETE' | translate}}

View File

@ -45,15 +45,15 @@ export class UsageLimitEditorComponent extends BaseEditor<UsageLimitEditorModel,
targetMetricEnum = this.enumUtils.getEnumValues<UsageLimitTargetMetric>(UsageLimitTargetMetric);
protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteUsageLimit);
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteUsageLimit) && this.editorModel.belongsToCurrentTenant != false;;
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditUsageLimit);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditUsageLimit) && this.editorModel.belongsToCurrentTenant != false;;
}
protected get canFinalize(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditUsageLimit);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditUsageLimit) && this.editorModel.belongsToCurrentTenant != false;;
}

View File

@ -46,7 +46,8 @@ export class UsageLimitListingComponent extends BaseListingComponent<UsageLimit,
nameof<UsageLimit>(x => x.updatedAt),
nameof<UsageLimit>(x => x.createdAt),
nameof<UsageLimit>(x => x.hash),
nameof<UsageLimit>(x => x.isActive)
nameof<UsageLimit>(x => x.isActive),
nameof<UsageLimit>(x => x.belongsToCurrentTenant)
];
rowIdentity = x => x.id;

View File

@ -81,6 +81,7 @@ export class ExternalFetcherBaseSourceConfigurationEditorModel implements Extern
url: [{ value: this.url, disabled: disabled }, context.getValidation('url').validators],
results: this.results.buildForm({
rootPath: `${rootPath}results.`,
disabled: disabled
}),
paginationPath: [{ value: this.paginationPath, disabled: disabled }, context.getValidation('paginationPath').validators],
contentType: [{ value: this.contentType, disabled: disabled }, context.getValidation('contentType').validators],
@ -89,19 +90,22 @@ export class ExternalFetcherBaseSourceConfigurationEditorModel implements Extern
requestBody: [{ value: this.requestBody, disabled: disabled }, context.getValidation('requestBody').validators],
filterType: [{ value: this.filterType, disabled: disabled }, context.getValidation('filterType').validators],
auth: this.auth.buildForm({
rootPath: `${rootPath}auth.`
rootPath: `${rootPath}auth.`,
disabled: disabled
}),
queries: this.formBuilder.array(
(this.queries ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}queries[${index}].`
rootPath: `${rootPath}queries[${index}].`,
disabled: disabled
})
), context.getValidation('queries').validators
),
items: this.formBuilder.array(
(this.items ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}items[${index}].`
rootPath: `${rootPath}items[${index}].`,
disabled: disabled
})
), context.getValidation('items').validators
),
@ -230,7 +234,8 @@ export class ResultsConfigurationEditorModel implements ResultsConfigurationPers
fieldsMapping: this.formBuilder.array(
(this.fieldsMapping ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}fieldsMapping[${index}].`
rootPath: `${rootPath}fieldsMapping[${index}].`,
disabled: disabled
})
), context.getValidation('fieldsMapping').validators
)
@ -478,7 +483,8 @@ export class QueryConfigEditorModel implements QueryConfigPersist {
cases: this.formBuilder.array(
(this.cases ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}cases[${index}].`
rootPath: `${rootPath}cases[${index}].`,
disabled: disabled
})
), context.getValidation('cases').validators
)

View File

@ -8,7 +8,7 @@
<div class="col-auto">
<button mat-button class="action-btn" (click)="cancel()" type="button">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.ACTIONS.CANCEL' | translate}}</button>
</div>
<div class="col-auto" *ngIf="!isNew">
<div class="col-auto" *ngIf="canDelete">
<button mat-button class="action-btn" type="button" (click)="delete()">
<mat-icon>delete</mat-icon>
{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.ACTIONS.DELETE' | translate}}
@ -113,7 +113,7 @@
<div class="container-fluid">
<div class="row">
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-FIELD-OPTIONS' | translate}}
<mat-checkbox [checked]="subjectFieldOptionsEnabled" (change)="subjectFieldOptionsSelectionChanged($event)"></mat-checkbox>
<mat-checkbox [checked]="subjectFieldOptionsEnabled" (change)="subjectFieldOptionsSelectionChanged($event)" [disabled]="isDeleted"></mat-checkbox>
</h4>
</div>
</div>
@ -176,7 +176,7 @@
<div class="container-fluid">
<div class="row">
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-FIELD-OPTIONS' | translate}}
<mat-checkbox [checked]="bodyFieldOptionsEnabled" (change)="bodyFieldOptionsSelectionChanged($event)"></mat-checkbox>
<mat-checkbox [checked]="bodyFieldOptionsEnabled" (change)="bodyFieldOptionsSelectionChanged($event)" [disabled]="isDeleted"></mat-checkbox>
</h4>
</div>
</div>

View File

@ -66,11 +66,11 @@ export class NotificationTemplateEditorComponent extends BaseEditor<Notification
public emailOverrideModeEnum = this.enumUtils.getEnumValues(EmailOverrideMode);
protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteNotificationTemplate);
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteNotificationTemplate) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditNotificationTemplate);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditNotificationTemplate) && this.editorModel.belongsToCurrentTenant != false;
}
private hasPermission(permission: AppPermission): boolean {

View File

@ -47,7 +47,8 @@ export class NotificationTemplateEditorModel extends BaseEditorModel implements
kind: [{ value: this.kind, disabled: disabled }, context.getValidation('kind').validators],
languageCode: [{ value: this.languageCode, disabled: disabled }, context.getValidation('languageCode').validators],
value: this.value.buildForm({
rootPath: `value.`
rootPath: `value.`,
disabled: disabled
}),
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators],
});
@ -139,7 +140,8 @@ export class NotificationTemplateValueEditorModel implements NotificationTemplat
subjectText: [{ value: this.subjectText, disabled: disabled }, context.getValidation('subjectText').validators],
subjectKey: [{ value: this.subjectKey, disabled: disabled }, context.getValidation('subjectKey').validators],
subjectFieldOptions: this.subjectFieldOptions.buildForm({
rootPath: `${rootPath}subjectFieldOptions.`
rootPath: `${rootPath}subjectFieldOptions.`,
disabled: disabled
}),
bodyText: [{ value: this.bodyText, disabled: disabled }, context.getValidation('bodyText').validators],
bodyKey: [{ value: this.bodyKey, disabled: disabled }, context.getValidation('bodyKey').validators],
@ -151,7 +153,8 @@ export class NotificationTemplateValueEditorModel implements NotificationTemplat
bccMode: [{ value: this.bccMode, disabled: disabled }, context.getValidation('bccMode').validators],
extraDataKeys: [{ value: this.extraDataKeys, disabled: disabled }, context.getValidation('extraDataKeys').validators],
bodyFieldOptions: this.bodyFieldOptions.buildForm({
rootPath: `${rootPath}bodyFieldOptions.`
rootPath: `${rootPath}bodyFieldOptions.`,
disabled: disabled
}),
});
}
@ -251,7 +254,8 @@ export class NotificationFieldOptionsEditorModel implements NotificationFieldOpt
optional: this.formBuilder.array(
(this.optional ?? []).map(
(item, index) => item.buildForm({
rootPath: `${rootPath}optional[${index}].`
rootPath: `${rootPath}optional[${index}].`,
disabled: disabled
})
), context.getValidation('optional').validators
),