add belongsToCurrentTenant to ui

This commit is contained in:
Efstratios Giannopoulos 2024-04-05 15:20:03 +03:00
parent 6a89feb31b
commit 4963d8ffc3
29 changed files with 84 additions and 70 deletions

View File

@ -5,6 +5,7 @@ import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.enums.*;
import eu.eudat.commons.scope.tenant.TenantScope;
import eu.eudat.commons.types.dmpblueprint.*;
import eu.eudat.commons.types.dmpblueprint.importexport.*;
import eu.eudat.convention.ConventionService;
@ -51,10 +52,7 @@ import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.*;
@Service
public class DmpBlueprintServiceImpl implements DmpBlueprintService {
@ -82,19 +80,19 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
private final ErrorThesaurusProperties errors;
private final ValidatorFactory validatorFactory;
private final TenantScope tenantScope;
@Autowired
public DmpBlueprintServiceImpl(
TenantEntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
MessageSource messageSource, QueryFactory queryFactory,
ResponseUtilsService responseUtilsService,
XmlHandlingService xmlHandlingService,
ErrorThesaurusProperties errors,
ValidatorFactory validatorFactory) {
TenantEntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
MessageSource messageSource, QueryFactory queryFactory,
ResponseUtilsService responseUtilsService,
XmlHandlingService xmlHandlingService,
ErrorThesaurusProperties errors,
ValidatorFactory validatorFactory, TenantScope tenantScope) {
this.entityManager = entityManager;
this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory;
@ -106,6 +104,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
this.xmlHandlingService = xmlHandlingService;
this.errors = errors;
this.validatorFactory = validatorFactory;
this.tenantScope = tenantScope;
}
//region Persist
@ -394,6 +393,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(oldDmpBlueprintEntity.getUpdatedAt()).equals(model.getHash()))
throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
if (!this.tenantScope.isSet() || !Objects.equals(oldDmpBlueprintEntity.getTenantId(), this.tenantScope.getTenant())) throw new MyForbiddenException(this.errors.getTenantTampering().getCode(), this.errors.getTenantTampering().getMessage());
List<DmpBlueprintEntity> latestVersionDmpBlueprints = this.queryFactory.query(DmpBlueprintQuery.class)
.versionStatuses(DmpBlueprintVersionStatus.Current)

View File

@ -10,6 +10,7 @@ export interface Lock {
lockedBy: User;
lockedAt: Date;
touchedAt: Date;
belongsToCurrentTenant?: boolean;
hash: String;
}

View File

@ -98,7 +98,7 @@
<button mat-menu-item [routerLink]="['/description-templates/', row.id]">
<mat-icon>edit</mat-icon>{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item [routerLink]="['/description-templates/new-version/', row.id]">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item [routerLink]="['/description-templates/new-version/', row.id]">
<mat-icon>queue</mat-icon>{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item [routerLink]="['/description-templates/clone/', row.id]">
@ -111,7 +111,7 @@
<button mat-menu-item (click)="export(row.id)" [routerLink]="['/description-templates/', row.id]">
<mat-icon>download</mat-icon>{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.DOWNLOAD-XML' | translate}}
</button>
<button mat-menu-item (click)="delete(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="delete(row.id)">
<mat-icon>delete</mat-icon>
{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.DELETE' | translate}}
</button>
@ -119,4 +119,4 @@
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -57,6 +57,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
nameof<DescriptionTemplate>(x => x.updatedAt),
nameof<DescriptionTemplate>(x => x.createdAt),
nameof<DescriptionTemplate>(x => x.hash),
nameof<DescriptionTemplate>(x => x.belongsToCurrentTenant),
nameof<DescriptionTemplate>(x => x.isActive)
];

View File

@ -40,17 +40,17 @@ export class DescriptionTemplateTypeEditorComponent extends BaseEditor<Descripti
protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDescriptionTemplateType);
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canFinalize(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDescriptionTemplateType) && this.editorModel.belongsToCurrentTenant != false;
}
private hasPermission(permission: AppPermission): boolean {
return this.authService.hasPermission(permission) || this.editorModel?.permissions?.includes(permission);

View File

@ -18,6 +18,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen
public fromModel(item: DescriptionTemplateType): DescriptionTemplateTypeEditorModel {
if (item) {
super.fromModel(item);
this.id = item.id;
this.name = item.name;
this.status = item.status;

View File

@ -98,7 +98,7 @@
<button mat-menu-item [routerLink]="['/description-template-type/' + row.id]">
<mat-icon>edit</mat-icon>{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item (click)="deleteType(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="deleteType(row.id)">
<mat-icon>delete</mat-icon>
{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.ACTIONS.DELETE' | translate}}
</button>
@ -106,4 +106,4 @@
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -45,6 +45,7 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
nameof<DescriptionTemplateType>(x => x.updatedAt),
nameof<DescriptionTemplateType>(x => x.createdAt),
nameof<DescriptionTemplateType>(x => x.hash),
nameof<DescriptionTemplateType>(x => x.belongsToCurrentTenant),
nameof<DescriptionTemplateType>(x => x.isActive)
];

View File

@ -14,7 +14,7 @@
{{formGroup.get('label').value}}
</h3>
</div>
<div class="col-md-auto mb-md-0 col-12 mb-2" *ngIf="!isNew">
<div class="col-md-auto mb-md-0 col-12 mb-2" *ngIf="!isNew && this.editorModel.belongsToCurrentTenant != false">
<button [disabled]="isLocked" mat-button class="action-btn" type="button" (click)="delete()">
<mat-icon>delete</mat-icon>
{{'DMP-BLUEPRINT-EDITOR.ACTIONS.DELETE' | translate}}
@ -104,7 +104,7 @@
</div>
<div class="col">
<div class="row">
<div class="col-12 col-xl-4">
<mat-form-field class="mt-3 w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.CATEGORY' | translate}}</mat-label>
@ -237,8 +237,8 @@
<div class="col-auto pr-0 section-options-horizontal">
<span *ngIf="!isDescriptionTemplateSelected(descriptionTemplateIndex)" style="font-size: 18px; box-sizing: border-box; display: inline-block; padding: 0.85rem 0.45rem;">{{descriptionTemplateIndex + 1}}</span>
<mat-icon *ngIf="isDescriptionTemplateSelected(descriptionTemplateIndex)" [ngClass]="{'drag-handle-disabled': formGroup.disabled}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon>
</div>
</div>
<div class="col">
<div class="row">
<div class="col-12 col-lg-6 col-xl-3">
@ -283,7 +283,7 @@
</button>
</div>
</div>
</div>
</div>
</div>
<mat-error *ngIf="section.get('descriptionTemplates').hasError('backendError')">{{section.get('descriptionTemplates').getError('backendError').message}}</mat-error>
</div>

View File

@ -33,7 +33,7 @@
<mat-icon>download</mat-icon>
</button> -->
</app-hybrid-listing>
</div>
</div>
</div>
</div>
@ -94,7 +94,7 @@
<button mat-menu-item [routerLink]="['/dmp-blueprints/', row.id]">
<mat-icon>edit</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item [routerLink]="['/dmp-blueprints/new-version' , row.id]">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item [routerLink]="['/dmp-blueprints/new-version' , row.id]">
<mat-icon>queue</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item [routerLink]="['/dmp-blueprints/clone' , row.id]">
@ -107,7 +107,7 @@
<button mat-menu-item (click)="export(row.id)" [routerLink]="['/dmp-blueprints/', row.id]">
<mat-icon>download</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}}
</button>
<button mat-menu-item (click)="delete(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="delete(row.id)">
<mat-icon>delete</mat-icon>
{{'DMP-BLUEPRINT-LISTING.ACTIONS.DELETE' | translate}}
</button>
@ -115,4 +115,4 @@
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -56,7 +56,8 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
nameof<DmpBlueprint>(x => x.updatedAt),
nameof<DmpBlueprint>(x => x.createdAt),
nameof<DmpBlueprint>(x => x.hash),
nameof<DmpBlueprint>(x => x.isActive)
nameof<DmpBlueprint>(x => x.isActive),
nameof<DmpBlueprint>(x => x.belongsToCurrentTenant)
];
rowIdentity = x => x.id;
@ -114,7 +115,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
prop: nameof<DmpBlueprint>(x => x.label),
sortable: true,
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.NAME'
},
},
{
prop: nameof<DmpBlueprint>(x => x.status),
sortable: true,

View File

@ -12,7 +12,7 @@
<app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns"
[count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size"
[defaultSort]="lookup.order?.items" [externalSorting]="true"
[defaultSort]="lookup.order?.items" [externalSorting]="true"
(pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)"
(columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate">
@ -69,18 +69,18 @@
</span>
<br>
</ng-container> -->
</div>
</div>
</ng-template>
<ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()">
<div *ngIf="row.belongsToCurrentTenant != false" class="row" (click)="$event.stopPropagation()">
<div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon>
</button>
<mat-menu #actionsMenu="matMenu">
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="deleteType(row.id, row.target)">
<mat-icon>delete</mat-icon>
{{'LOCK-LISTING.ACTIONS.DELETE' | translate}}
@ -88,4 +88,4 @@
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -43,6 +43,7 @@ export class LockListingComponent extends BaseListingComponent<Lock, LockLookup>
[nameof<Lock>(x => x.lockedBy), nameof<User>(x => x.name)].join('.'),
nameof<Lock>(x => x.lockedAt),
nameof<Lock>(x => x.touchedAt),
nameof<Lock>(x => x.belongsToCurrentTenant),
nameof<Lock>(x => x.hash),
];
@ -96,7 +97,7 @@ export class LockListingComponent extends BaseListingComponent<Lock, LockLookup>
sortable: true,
languageName: 'LOCK-LISTING.FIELDS.TARGET-TYPE',
pipe: this.pipeService.getPipe<LockTargetTypePipe>(LockTargetTypePipe)
},
},
{
prop: nameof<Lock>(x => x.lockedBy.name),
sortable: true,

View File

@ -9,7 +9,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">
<div class="col-auto" *ngIf="!isNew && this.editorModel.belongsToCurrentTenant != false">
<button mat-button class="action-btn" type="button" (click)="delete()">
<mat-icon>delete</mat-icon>
{{'LANGUAGE-EDITOR.ACTIONS.DELETE' | translate}}
@ -66,7 +66,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 (change)="overrideFromFile($event, formGroup.get('code').value)"></mat-checkbox>
<mat-checkbox [disabled]="this.editorModel.belongsToCurrentTenant == false" (change)="overrideFromFile($event, formGroup.get('code').value)"></mat-checkbox>
</h9>
</div>
</div>

View File

@ -53,7 +53,7 @@ export class LanguageEditorComponent extends BaseEditor<LanguageEditorModel, Lan
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditLanguage);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditLanguage) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canFinalize(): boolean {

View File

@ -86,11 +86,11 @@
<button mat-menu-item [routerLink]="['/language/' + row.id]">
<mat-icon>edit</mat-icon>{{'LANGUAGE-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item (click)="deleteType(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="deleteType(row.id)">
<mat-icon>delete</mat-icon>
{{'LANGUAGE-LISTING.ACTIONS.DELETE' | translate}}
</button>
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -42,6 +42,7 @@ export class LanguageListingComponent extends BaseListingComponent<Language, Lan
nameof<Language>(x => x.updatedAt),
nameof<Language>(x => x.createdAt),
nameof<Language>(x => x.hash),
nameof<Language>(x => x.belongsToCurrentTenant),
nameof<Language>(x => x.isActive)
];

View File

@ -45,11 +45,11 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
showInactiveDetails = false;
protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeletePrefillingSource);
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeletePrefillingSource) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditPrefillingSource);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditPrefillingSource) && this.editorModel.belongsToCurrentTenant != false;
}
private hasPermission(permission: AppPermission): boolean {
@ -186,7 +186,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
if(event.checked == true){
const definition = new PrefillingSourceDefinitionEditorModel(this.editorModel.validationErrorModel);
definition.buildGetConfiguration(this.formGroup.get('definition') as UntypedFormGroup, "definition.");
this.submitFields();
}else{
const definition = this.formGroup.get('definition') as UntypedFormGroup;
@ -297,6 +297,6 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
}
}
}
}

View File

@ -88,11 +88,11 @@
<button mat-menu-item [routerLink]="['/prefilling-sources/' + row.id]">
<mat-icon>edit</mat-icon>{{'PREFILLING-SOURCE-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item (click)="deleteType(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="deleteType(row.id)">
<mat-icon>delete</mat-icon>
{{'PREFILLING-SOURCE-LISTING.ACTIONS.DELETE' | translate}}
</button>
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -42,6 +42,7 @@ export class PrefillingSourceListingComponent extends BaseListingComponent<Prefi
nameof<PrefillingSource>(x => x.updatedAt),
nameof<PrefillingSource>(x => x.createdAt),
nameof<PrefillingSource>(x => x.hash),
nameof<PrefillingSource>(x => x.belongsToCurrentTenant),
nameof<PrefillingSource>(x => x.isActive)
];

View File

@ -53,11 +53,11 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
sourceKeysMap: Map<Guid, string[]> = new Map<Guid, string[]>();
protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteReferenceType);
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteReferenceType) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditReferenceType);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditReferenceType) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canFinalize(): boolean {
@ -229,7 +229,7 @@ export class ReferenceTypeEditorComponent extends BaseEditor<ReferenceTypeEditor
this.removeOption(i, j);
}
}
const fieldMappingFormArray = (sourceFormArray.at(i).get('results').get('fieldsMapping') as FormArray);
for (let j = 0; j < fieldMappingFormArray.length; j++) {
if (fieldCode == fieldMappingFormArray.at(j).get('code').getRawValue()) {

View File

@ -21,6 +21,7 @@ export class ReferenceTypeEditorModel extends BaseEditorModel implements Referen
public fromModel(item: ReferenceType): ReferenceTypeEditorModel {
if (item) {
super.fromModel(item);
this.id = item.id;
this.name = item.name;
this.code = item.code;

View File

@ -7,7 +7,7 @@
<h4>{{'REFERENCE-TYPE-LISTING.TITLE' | translate}}</h4>
<app-navigation-breadcrumb />
</div>
</div>
<div class="col-auto">
<button mat-raised-button class="create-btn"
*ngIf="authService.hasPermission(authService.permissionEnum.EditReferenceType)"
@ -101,7 +101,7 @@
<button mat-menu-item [routerLink]="['/reference-type/' + row.id]">
<mat-icon>edit</mat-icon>{{'REFERENCE-TYPE-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item (click)="deleteType(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="deleteType(row.id)">
<mat-icon>delete</mat-icon>
{{'REFERENCE-TYPE-LISTING.ACTIONS.DELETE' | translate}}
</button>
@ -109,4 +109,4 @@
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -43,6 +43,7 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
nameof<ReferenceType>(x => x.code),
nameof<ReferenceType>(x => x.updatedAt),
nameof<ReferenceType>(x => x.createdAt),
nameof<ReferenceType>(x => x.belongsToCurrentTenant),
nameof<ReferenceType>(x => x.isActive)
];
@ -91,7 +92,7 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
prop: nameof<ReferenceType>(x => x.name),
sortable: true,
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.NAME'
},
},
{
prop: nameof<ReferenceType>(x => x.code),
sortable: true,

View File

@ -9,7 +9,7 @@
<div class="col-auto">
<button mat-button class="action-btn" (click)="cancel()" type="button">{{'REFERENCE-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>
{{'REFERENCE-EDITOR.ACTIONS.DELETE' | translate}}

View File

@ -50,11 +50,11 @@ export class ReferenceEditorComponent extends BaseEditor<ReferenceEditorModel, R
public referenceFieldDataTypeEnum = this.enumUtils.getEnumValues(ReferenceFieldDataType);
protected get canDelete(): boolean {
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteReference);
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeleteReference) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditReference);
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditReference) && this.editorModel.belongsToCurrentTenant != false;
}
protected get canFinalize(): boolean {

View File

@ -58,7 +58,7 @@
</span>
<br>
</ng-container>
<ng-container *ngIf="isColumnSelected('sourceType')">
<span class="col-12">
{{'REFERENCE-LISTING.FIELDS.SOURCE-TYPE' | translate}}:
@ -110,11 +110,11 @@
<button mat-menu-item [routerLink]="['/tenant/' + row.id]">
<mat-icon>edit</mat-icon>{{'REFERENCE-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button mat-menu-item (click)="deleteType(row.id)">
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="deleteType(row.id)">
<mat-icon>delete</mat-icon>
{{'REFERENCE-LISTING.ACTIONS.DELETE' | translate}}
</button>
</mat-menu>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -46,6 +46,7 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
nameof<Reference>(x => x.updatedAt),
nameof<Reference>(x => x.createdAt),
nameof<Reference>(x => x.hash),
nameof<Reference>(x => x.belongsToCurrentTenant),
nameof<Reference>(x => x.isActive)
];
@ -94,7 +95,7 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
prop: nameof<Reference>(x => x.label),
sortable: true,
languageName: 'REFERENCE-LISTING.FIELDS.LABEL'
},
},
{
prop: nameof<Reference>(x => x.source),
sortable: true,

View File

@ -200,10 +200,10 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
if (result) {
result.dmp = this.item.dmp;
result.dmpDescriptionTemplate = this.item.dmpDescriptionTemplate;
const sectionId = this.item.dmpDescriptionTemplate.sectionId;
result.dmpDescriptionTemplate = this.item.dmp.dmpDescriptionTemplates.find(x => x.sectionId == sectionId && x.descriptionTemplateGroupId == result.descriptionTemplate.groupId);
result.dmpDescriptionTemplate = this.item.dmp.dmpDescriptionTemplates.find(x => x.sectionId == sectionId && x.descriptionTemplateGroupId == result.descriptionTemplate.groupId);
this.prepareForm(result);
// this.descriptionModel = this.descriptionModel.fromModel(result);
// this.descriptionModel.dmp = data;
@ -549,6 +549,9 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
}
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
this.buildForm();
if (this.formGroup && this.editorModel.belongsToCurrentTenant == false) {
this.formGroup.disable();
}
} catch (error) {
this.logger.error('Could not parse Description item: ' + data + error);
this.uiNotificationService.snackBarNotification(this.language.instant('COMMONS.ERRORS.DEFAULT'), SnackBarNotificationLevel.Error);
@ -639,7 +642,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
formSubmit(): void {
this.formService.removeAllBackEndErrors(this.formGroup);
this.formService.touchAllFormFields(this.formGroup);
if (this.formGroup.get('label').valid && this.formGroup.get('dmpId').valid && this.formGroup.get('dmpDescriptionTemplateId').valid
if (this.formGroup.get('label').valid && this.formGroup.get('dmpId').valid && this.formGroup.get('dmpDescriptionTemplateId').valid
&& this.formGroup.get('dmpDescriptionTemplateId').valid && this.formGroup.get('status').valid) {
this.persistEntity();
}