Adding all versions listing and new version form for description templates
This commit is contained in:
parent
9d4e814d1c
commit
f255f61ee6
|
@ -17,6 +17,16 @@ export interface DescriptionTemplatePersist extends BaseEntityPersist {
|
|||
users: UserDescriptionTemplatePersist[];
|
||||
}
|
||||
|
||||
export interface NewVersionDescriptionTemplatePersist extends BaseEntityPersist {
|
||||
label: string;
|
||||
description: string;
|
||||
language: string;
|
||||
type: Guid;
|
||||
status: DescriptionTemplateStatus;
|
||||
definition: DescriptionTemplateDefinitionPersist;
|
||||
users: UserDescriptionTemplatePersist[];
|
||||
}
|
||||
|
||||
export interface UserDescriptionTemplatePersist {
|
||||
userId?: Guid;
|
||||
role?: UserDescriptionTemplateRole;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
|||
import { Injectable } from '@angular/core';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
||||
import { DescriptionTemplatePersist } from '@app/core/model/description-template/description-template-persist';
|
||||
import { DescriptionTemplatePersist, NewVersionDescriptionTemplatePersist } from '@app/core/model/description-template/description-template-persist';
|
||||
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
|
@ -68,6 +68,15 @@ export class DescriptionTemplateService {
|
|||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
newVersion(item: NewVersionDescriptionTemplatePersist, reqFields: string[] = []): Observable<DescriptionTemplate> {
|
||||
const url = `${this.apiBase}/new-version`;
|
||||
const options = { params: { f: reqFields } };
|
||||
|
||||
return this.http
|
||||
.post<DescriptionTemplate>(url, item).pipe(
|
||||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
downloadXML(id: Guid): Observable<HttpResponse<Blob>> {
|
||||
const url = `${this.apiBase}/xml/export/${id}`;
|
||||
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml');
|
||||
|
|
|
@ -14,6 +14,14 @@ const routes: Routes = [
|
|||
component: DescriptionTemplateListingComponent,
|
||||
canActivate: [AuthGuard]
|
||||
},
|
||||
{
|
||||
path: 'versions/:groupid',
|
||||
component: DescriptionTemplateListingComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
mode: 'versions-listing'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
canActivate: [AuthGuard],
|
||||
|
@ -24,7 +32,7 @@ const routes: Routes = [
|
|||
permissions: [AppPermission.EditDescriptionTemplate]
|
||||
},
|
||||
...BreadcrumbService.generateRouteDataConfiguration({
|
||||
title: 'BREADCRUMBS.NEW-DMP-BLUEPRINT'
|
||||
title: 'BREADCRUMBS.NEW-DESCRIPTION-TEMPLATES'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -38,13 +46,31 @@ const routes: Routes = [
|
|||
},
|
||||
data: {
|
||||
...BreadcrumbService.generateRouteDataConfiguration({
|
||||
title: 'BREADCRUMBS.EDIT-DMP-BLUEPRINT'
|
||||
title: 'BREADCRUMBS.EDIT-DESCRIPTION-TEMPLATES'
|
||||
}),
|
||||
authContext: {
|
||||
permissions: [AppPermission.EditDescriptionTemplate]
|
||||
}
|
||||
},
|
||||
action: 'clone'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'new-version/:newversionid',
|
||||
canActivate: [AuthGuard],
|
||||
component: DescriptionTemplateEditorComponent,
|
||||
canDeactivate: [PendingChangesGuard],
|
||||
resolve: {
|
||||
'entity': DescriptionTemplateEditorResolver
|
||||
},
|
||||
data: {
|
||||
...BreadcrumbService.generateRouteDataConfiguration({
|
||||
title: 'BREADCRUMBS.EDIT-DESCRIPTION-TEMPLATES'
|
||||
}),
|
||||
authContext: {
|
||||
permissions: [AppPermission.EditDescriptionTemplate]
|
||||
},
|
||||
action: 'new-version'
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
|
@ -56,7 +82,7 @@ const routes: Routes = [
|
|||
},
|
||||
data: {
|
||||
...BreadcrumbService.generateRouteDataConfiguration({
|
||||
title: 'BREADCRUMBS.EDIT-DMP-BLUEPRINT'
|
||||
title: 'BREADCRUMBS.EDIT-DESCRIPTION-TEMPLATES'
|
||||
}),
|
||||
authContext: {
|
||||
permissions: [AppPermission.EditDescriptionTemplate]
|
||||
|
|
|
@ -103,10 +103,13 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
|
|||
];
|
||||
const id = route.paramMap.get('id');
|
||||
const cloneid = route.paramMap.get('cloneid');
|
||||
const newversion = route.paramMap.get('newversionid');
|
||||
if (id != null) {
|
||||
return this.descriptionTemplateService.getSingle(Guid.parse(id), fieldSets).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
|
||||
} else if (cloneid != null) {
|
||||
return this.descriptionTemplateService.clone(Guid.parse(cloneid), fieldSets).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
|
||||
} else if (newversion != null) {
|
||||
return this.descriptionTemplateService.getSingle(Guid.parse(newversion), fieldSets).pipe(tap(x => this.breadcrumbService.addIdResolvedValue(x.id?.toString(), x.label)), takeUntil(this._destroyed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns" [count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size" [defaultSort]="lookup.order?.items" [externalSorting]="true" (rowActivated)="onRowActivated($event)" (pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)" (columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate">
|
||||
<app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns" [count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size" [defaultSort]="lookup.order?.items" [externalSorting]="true" (rowActivated)="onRowActivated($event, '/description-templates')" (pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)" (columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate">
|
||||
|
||||
<app-description-template-listing-filters hybrid-listing-filters [(filter)]="lookup" (filterChange)="filterChanged($event)" />
|
||||
|
||||
|
@ -95,23 +95,23 @@
|
|||
<mat-icon>more_horiz</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button mat-menu-item [routerLink]="['./' + row.id]">
|
||||
<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]="['./new-version/' + row.id]">
|
||||
<button 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 (click)="newVersionFromFile(row.id, row.label)">
|
||||
<mat-icon>file_copy</mat-icon>{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.NEW-VERSION-FROM-FILE' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item [routerLink]="['./clone/' + row.id]">
|
||||
<button mat-menu-item [routerLink]="['/description-templates/clone/', row.id]">
|
||||
<mat-icon>content_copy</mat-icon>{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.CLONE' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item [routerLink]="['./versions/' + row.id]">
|
||||
<button mat-menu-item [routerLink]="['/description-templates/versions/', row.groupId]">
|
||||
<mat-icon>library_books</mat-icon>
|
||||
{{'DESCRIPTION-TEMPLATE-LISTING.ACTIONS.VIEW-VERSIONS' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="export(row.id)" [routerLink]="['./' + row.id]">
|
||||
<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)">
|
||||
|
|
|
@ -40,6 +40,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
userSettingsKey = { key: 'DescriptionTemplateListingUserSettings' };
|
||||
propertiesAvailableForOrder: ColumnDefinition[];
|
||||
descriptionTemplateStatuses = DescriptionTemplateStatus;
|
||||
mode;
|
||||
|
||||
@ViewChild('descriptionTemplateStatus', { static: true }) descriptionTemplateStatus?: TemplateRef<any>;
|
||||
@ViewChild('actions', { static: true }) actions?: TemplateRef<any>;
|
||||
|
@ -50,6 +51,8 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
nameof<DescriptionTemplate>(x => x.label),
|
||||
nameof<DescriptionTemplate>(x => x.description),
|
||||
nameof<DescriptionTemplate>(x => x.status),
|
||||
nameof<DescriptionTemplate>(x => x.version),
|
||||
nameof<DescriptionTemplate>(x => x.groupId),
|
||||
nameof<DescriptionTemplate>(x => x.updatedAt),
|
||||
nameof<DescriptionTemplate>(x => x.createdAt),
|
||||
nameof<DescriptionTemplate>(x => x.hash),
|
||||
|
@ -76,6 +79,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
|
||||
// Lookup setup
|
||||
// Default lookup values are defined in the user settings class.
|
||||
this.mode = this.route.snapshot?.data['mode'];
|
||||
this.lookup = this.initializeLookup();
|
||||
}
|
||||
|
||||
|
@ -90,6 +94,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
|
||||
lookup.isActive = [IsActive.Active];
|
||||
lookup.order = { items: [this.toDescSortField(nameof<DescriptionTemplate>(x => x.createdAt))] };
|
||||
if (this.mode && this.mode == 'versions-listing') lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))]
|
||||
this.updateOrderUiFields(lookup.order);
|
||||
|
||||
lookup.project = {
|
||||
|
@ -116,6 +121,11 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.STATUS',
|
||||
cellTemplate: this.descriptionTemplateStatus
|
||||
},
|
||||
{
|
||||
prop: nameof<DescriptionTemplate>(x => x.version),
|
||||
sortable: true,
|
||||
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.VERSION'
|
||||
},
|
||||
{
|
||||
prop: nameof<DescriptionTemplate>(x => x.createdAt),
|
||||
sortable: true,
|
||||
|
|
|
@ -1074,6 +1074,7 @@
|
|||
"NAME": "Name",
|
||||
"DESCRIPTION": "Description",
|
||||
"STATUS": "Status",
|
||||
"VERSION": "Version",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created",
|
||||
"PUBLISHED-AT": "Published",
|
||||
|
|
Loading…
Reference in New Issue