more ui changes

This commit is contained in:
Diamantis Tziotzios 2023-11-30 10:12:41 +02:00
parent 17d57dbc7a
commit 40ae38e8d9
12 changed files with 165 additions and 102 deletions

View File

@ -1,13 +1,14 @@
import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid';
import { IsActive } from '../common/enum/is-active.enum';
import { DmpBlueprintStatus } from '../common/enum/dmp-blueprint-status';
export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
ids: Guid[];
excludedIds: Guid[];
like: string;
isActive: IsActive[];
typeIds: Guid[];
statuses: DmpBlueprintStatus[];
constructor() {
super();
@ -19,5 +20,5 @@ export interface DmpBlueprintFilter {
excludedIds: Guid[];
like: string;
isActive: IsActive[];
typeIds: Guid[];
statuses: DmpBlueprintStatus[];
}

View File

@ -1,30 +1,32 @@
import { Injectable } from '@angular/core';
import { DescriptionStatus } from '@app/core/common/enum/description-status';
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
import { ReferenceType } from '@app/core/common/enum/reference-type';
import { ReferenceTypeExternalApiHTTPMethodType } from '@app/core/common/enum/reference-type-external-api-http-method-type';
import { ReferenceTypeSourceType } from '@app/core/common/enum/reference-type-source-type';
import { Role } from '@app/core/common/enum/role';
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
import { UserDescriptionTemplateRole } from '@app/core/common/enum/user-description-template-role';
import { ViewStyleType } from '@app/ui/admin/dataset-profile/editor/components/field/view-style-enum';
import { TranslateService } from '@ngx-translate/core';
import { AppRole } from '../../common/enum/app-role';
import { DatasetProfileComboBoxType } from '../../common/enum/dataset-profile-combo-box-type';
import { DatasetProfileFieldViewStyle } from '../../common/enum/dataset-profile-field-view-style';
import { DatasetProfileInternalDmpEntitiesType } from '../../common/enum/dataset-profile-internal-dmp-entities-type';
import { DatasetStatus } from '../../common/enum/dataset-status';
import { DmpBlueprintExtraFieldDataType } from '../../common/enum/dmp-blueprint-field-type';
import { DmpBlueprintType } from '../../common/enum/dmp-blueprint-type';
import { DmpStatus } from '../../common/enum/dmp-status';
import { ValidationType } from '../../common/enum/validation-type';
import { DatasetProfileInternalDmpEntitiesType } from '../../common/enum/dataset-profile-internal-dmp-entities-type';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Role } from '@app/core/common/enum/role';
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
import { ViewStyleType } from '@app/ui/admin/dataset-profile/editor/components/field/view-style-enum';
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
import { DmpBlueprintSystemFieldType } from '@app/core/common/enum/dmp-blueprint-system-field-type';
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
import { ReferenceFieldDataType } from '@app/core/common/enum/reference-field-data-type';
import { ReferenceTypeSourceType } from '@app/core/common/enum/reference-type-source-type';
import { ReferenceTypeExternalApiHTTPMethodType } from '@app/core/common/enum/reference-type-external-api-http-method-type';
import { UserDescriptionTemplateRole } from '@app/core/common/enum/user-description-template-role';
import { ReferenceType } from '@app/core/common/enum/reference-type';
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
import { IsActive } from '@app/core/common/enum/is-active.enum';
@Injectable()
export class EnumUtils {
@ -43,6 +45,13 @@ export class EnumUtils {
return [];
}
toIsActiveString(status: IsActive): string {
switch (status) {
case IsActive.Active: return this.language.instant('TYPES.IS-ACTIVE.ACTIVE');
case IsActive.Inactive: return this.language.instant('TYPES.IS-ACTIVE.INACTIVE');
}
}
toAppRoleString(status: AppRole): string {
switch (status) {
case AppRole.Admin: return this.language.instant('TYPES.APP-ROLE.ADMIN');
@ -118,7 +127,7 @@ export class EnumUtils {
case DatasetProfileFieldViewStyle.Validation: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.VALIDATION');
}
}
toDatasetProfileViewTypeString(status: ViewStyleType) :string{
toDatasetProfileViewTypeString(status: ViewStyleType): string {
switch (status) {
case ViewStyleType.BooleanDecision: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.BOOLEAN-DECISION');
case ViewStyleType.CheckBox: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.CHECKBOX');
@ -250,7 +259,7 @@ export class EnumUtils {
}
}
toDescriptionTemplateFieldTypeString(status: DescriptionTemplateFieldType) :string{
toDescriptionTemplateFieldTypeString(status: DescriptionTemplateFieldType): string {
switch (status) {
case DescriptionTemplateFieldType.COMBO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.COMBO-BOX');
case DescriptionTemplateFieldType.AUTO_COMPLETE: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.AUTO-COMPLETE');
@ -351,4 +360,12 @@ export class EnumUtils {
}
}
toDescriptionStatusString(status: DescriptionStatus): string {
switch (status) {
case DescriptionStatus.Draft: return this.language.instant('TYPES.DESCRIPTION-STATUS.DRAFT');
case DescriptionStatus.Finalized: return this.language.instant('TYPES.DESCRIPTION-STATUS.FINALIZED');
case DescriptionStatus.Canceled: return this.language.instant('TYPES.DESCRIPTION-STATUS.CANCELED');
}
}
}

View File

@ -27,6 +27,7 @@ import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
@Component({
@ -121,6 +122,12 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
},
{
prop: nameof<DmpBlueprint>(x => x.isActive),
sortable: true,
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{
alwaysShown: true,
cellTemplate: this.actions,

View File

@ -20,6 +20,10 @@
{{'DMP-BLUEPRINT-LISTING.FILTER.IS-ACTIVE' | translate}}
</mat-slide-toggle>
<mat-select multiple [(ngModel)]="internalFilters.statuses">
<mat-option *ngFor="let blueprintStatus of dmpBlueprintStatusEnumValues" [value]="blueprintStatus">{{enumUtils.toDmpBlueprintStatusString(blueprintStatus)}}</mat-option>
</mat-select>
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
{{'DMP-BLUEPRINT-LISTING.FILTER.CANCEL' | translate}}

View File

@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { DmpBlueprintFilter } from '@app/core/query/dmp-blueprint.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@ -16,6 +17,8 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement
@Input() readonly filter: DmpBlueprintFilter;
@Output() filterChange = new EventEmitter<DmpBlueprintFilter>();
dmpBlueprintStatusEnumValues = this.enumUtils.getEnumValues<DmpBlueprintStatus>(DmpBlueprintStatus);
// * State
internalFilters: DmpBlueprintListingFilters = this._getEmptyFilters();
@ -46,12 +49,12 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement
}
protected applyFilters(): void {
const { isActive, like, typeIds } = this.internalFilters ?? {}
const { isActive, like, statuses } = this.internalFilters ?? {}
this.filterChange.emit({
...this.filter,
like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
typeIds
statuses
})
}
@ -61,12 +64,12 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement
return this._getEmptyFilters();
}
let { excludedIds, ids, isActive, like, typeIds } = inputFilter;
let { excludedIds, ids, isActive, like, statuses } = inputFilter;
return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like,
typeIds: typeIds
statuses: statuses
}
}
@ -75,7 +78,7 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement
return {
isActive: true,
like: null,
typeIds: null,
statuses: null,
}
}
@ -95,5 +98,5 @@ export class DmpBlueprintListingFiltersComponent extends BaseComponent implement
interface DmpBlueprintListingFilters {
isActive: boolean;
like: string;
typeIds: Guid[];
statuses: DmpBlueprintStatus[];
}

View File

@ -9,7 +9,9 @@ import { ActivatedRoute, Params, Router } from '@angular/router';
import { DescriptionStatus } from '@app/core/common/enum/description-status';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
import { Description } from '@app/core/model/description/description';
import { Description, DescriptionReference } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { Reference } from '@app/core/model/reference/reference';
import { DescriptionLookup } from '@app/core/query/description.lookup';
import { DmpLookup } from '@app/core/query/dmp.lookup';
import { AuthService } from '@app/core/services/auth/auth.service';
@ -173,6 +175,19 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
fields: [
nameof<Description>(x => x.id),
nameof<Description>(x => x.label),
nameof<Description>(x => x.status),
nameof<Description>(x => x.updatedAt),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.accessType)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.roles)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
]
};
this.descriptionService.query(lookup).pipe(takeUntil(this._destroyed))

View File

@ -2,17 +2,17 @@
<a [routerLink]="getItemLink()" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto description-label">{{'DATASET-LISTING.DESCRIPTION' | translate}}</div>
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{description.modified | dateTimeCultureFormatter: "d MMMM y"}}</div>
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}</div>
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.PUBLISHED' | translate}}: {{description.dmpPublishedAt | dateTimeCultureFormatter: "d MMMM y"}}</div>
</div>
<div *ngIf="description.status === 1" class="col-auto description-title">{{description.label}}</div>
<div *ngIf="description.status === 0" class="col-auto description-title-draft">{{description.label}}</div>
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto description-title">{{description.label}}</div>
<div *ngIf="description.status === descriptionStatusEnum.Draft" class="col-auto description-title-draft">{{description.label}}</div>
<div class="description-subtitle">
<span *ngIf="isUserDescriptionRelated()" class="col-auto">{{ roleDisplay(description.users) }}</span>
<span *ngIf="isUserDescriptionRelated()">.</span>
<!-- <span class="col-auto" *ngIf="description.status === 1 && description.public === true"><span class="material-icons icon-align">public</span>{{'DATASET-LISTING.STATES.PUBLIC' | translate}}</span> -->
<!-- <span *ngIf="description.status === 1 && description.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(description.status) }}</span> -->
<span *ngIf="description.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(description.status) }}</span>
<span class="col-auto" *ngIf="description.status === descriptionStatusEnum.Finalized && description.dmp.accessType === dmpAccessTypeEnum.Public"><span class="material-icons icon-align">public</span>{{'DATASET-LISTING.STATES.PUBLIC' | translate}}</span>
<span *ngIf="description.status === descriptionStatusEnum.Finalized && description.dmp.accessType != dmpAccessTypeEnum.Public" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
<span *ngIf="description.status === descriptionStatusEnum.Draft" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
<span>.</span>
<!-- <span class="col">{{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{description.grant}}</span> -->
</div>
@ -20,12 +20,12 @@
<div class="col-auto description-subtitle pr-0">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<div class="col dmp-title">{{description.dmp}}</div>
<div class="col dmp-title">{{description.dmp?.label}}</div>
</div>
</a>
<div class="description-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner" (click)="openShareDialog(description.dmpId, description.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner" (click)="openShareDialog(description.dmp.id, description.dmp.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="openDmpSearchDialogue(description)"><span class="material-icons icon-align pr-2">file_copy</span>{{'DATASET-WIZARD.ACTIONS.COPY-DESCRIPTION' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated() && isUserDescriptionRelated()" (click)="deleteClicked(description.id)"><span class="material-icons icon-align pr-2">delete</span>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}</a>
</div>

View File

@ -22,6 +22,7 @@ import { Description } from '@app/core/model/description/description';
import { DescriptionService } from '@app/core/services/description/description.service';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { Guid } from '@common/types/guid';
import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
@Component({
selector: 'app-description-listing-item-component',
@ -38,6 +39,8 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
isDraft: boolean;
isDeleted: boolean;
isUserOwner: boolean;
descriptionStatusEnum = DescriptionStatus;
dmpAccessTypeEnum = DmpAccessType;
constructor(
private router: Router,

View File

@ -1828,11 +1828,10 @@
"INPUT": "Input"
}
},
"DATASET-STATUS": {
"DESCRIPTION-STATUS": {
"DRAFT": "Draft",
"FINALISED": "Finalized",
"ANY": "Any",
"DRAFT-DESC": "Draft Registrations"
"CANCELED": "Canceled"
},
"DATASET-ROLE": {
"OWNER": "Owner",

View File

@ -4,6 +4,7 @@ import { DataTableDateFormatPipe, DateFormatPipe } from '@common/formatting/pipe
import { DataTableDateOnlyFormatPipe, DateOnlyPipe } from '@common/formatting/pipes/date-only-format.pipe';
import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe';
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
//
//
@ -20,7 +21,7 @@ import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-fir
ArrayToStringPipe,
DateOnlyPipe,
DataTableDateOnlyFormatPipe,
IsActiveTypePipe
],
exports: [
@ -32,6 +33,7 @@ import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-fir
ArrayToStringPipe,
DateOnlyPipe,
DataTableDateOnlyFormatPipe,
IsActiveTypePipe
],
providers: [
DateFormatPipe,
@ -42,6 +44,7 @@ import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-fir
ArrayToStringPipe,
DateOnlyPipe,
DataTableDateOnlyFormatPipe,
IsActiveTypePipe
]
})
export class CommonFormattingModule { }

View File

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@Pipe({ name: 'IsActiveTypeFormat' })
export class IsActiveTypePipe implements PipeTransform {
constructor(private enumUtils: EnumUtils) { }
public transform(value): any {
return this.enumUtils.toIsActiveString(value);
}
}