From e3c1a077dd35c93bcbcbfb4d65a1039c2a011a10 Mon Sep 17 00:00:00 2001 From: kbeyro <121854496+kbeyro@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:20:33 +0100 Subject: [PATCH] Update bulks roles --- .../bulk-list/bulk-list.component.html | 12 +++---- .../bulk-list/bulk-list.component.ts | 35 +++++++++++++++++-- .../bulk-view/bulk-view.component.html | 2 +- .../domain-groups.component.html | 2 +- src/app/appmarket/domains/domains.routes.ts | 2 +- src/app/appmarket/users/users.routes.ts | 2 +- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.html b/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.html index 56fe2058..7d52cd49 100644 --- a/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.html +++ b/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.html @@ -27,14 +27,14 @@ </div> </div> <table *ngIf="mode === 'DOMAIN'" class="table table-hover table-condensed" style="margin-top: 3rem" - aria-describedby="Bulk deployment table"> + aria-describedby="Bulk deployment table" sortable-table (sorted)="onSort($event)"> <thead> <tr> - <th scope="col">{{'BULK.LIST.ID' | translate}}</th> - <th scope="col">{{'BULK.LIST.CREATOR' | translate}}</th> - <th scope="col">{{'BULK.LIST.CREATION_DATE' | translate}}</th> - <th scope="col">{{'BULK.LIST.STATE' | translate}}</th> - <th scope="col"></th> + <th scope="col" class="column-sortable" sortable-column="id">{{'BULK.LIST.ID' | translate}}</th> + <th scope="col" class="column-sortable" sortable-column="creator">{{'BULK.LIST.CREATOR' | translate}}</th> + <th scope="col" class="column-sortable" sortable-column="date">{{'BULK.LIST.CREATION_DATE' | translate}}</th> + <th scope="col" class="column-sortable" sortable-column="state">{{'BULK.LIST.STATE' | translate}}</th> + <th scope="col" ></th> </tr> </thead> diff --git a/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.ts b/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.ts index fe2a2ded..eaf7318d 100644 --- a/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.ts +++ b/src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.ts @@ -78,7 +78,29 @@ export class BulkListComponent { this.bulks.sort((a, b) => new Date(a.creationDate).getTime() - new Date(b.creationDate).getTime()) } - } else { + } else if (sortColumn === "app_name" || sortColumn === 'instance_no') { + this.bulks.sort((a, b) => { + if (direction === 'asc') { + if (this.getProperty(a, sortColumn) > this.getProperty(b, sortColumn) ) { + return 1; + } + + if (this.getProperty(a, sortColumn) < this.getProperty(b, sortColumn)) { + return -1; + } + return 0; + } else { + if (this.getProperty(a, sortColumn) > this.getProperty(b, sortColumn)) { + return -1; + } + + if (this.getProperty(a, sortColumn) < this.getProperty(b, sortColumn)) { + return 1; + } + return 0; + } + }) + }else { this.bulks.sort((a, b) => { if (direction === 'asc') { if (a[sortColumn] > b[sortColumn]) { @@ -105,7 +127,6 @@ export class BulkListComponent { public getAppBulkDetails(id: number) { this.appDeploy.getAppBulkDetails(id).subscribe( (data: Blob) => { - console.warn(data) const blob = new Blob([data], { type: 'text/csv' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); @@ -116,4 +137,14 @@ export class BulkListComponent { window.URL.revokeObjectURL(url); }) } + + private getProperty(bulk: BulkDeployment, key : string) { + if(key === 'app_name') { + return bulk.details['appName'] + + } else if(key === "instance_no") { + return bulk.details['appInstanceNo'] + } + return null + } } diff --git a/src/app/appmarket/bulkDeployment/bulk-view/bulk-view.component.html b/src/app/appmarket/bulkDeployment/bulk-view/bulk-view.component.html index d77979a1..215014b6 100644 --- a/src/app/appmarket/bulkDeployment/bulk-view/bulk-view.component.html +++ b/src/app/appmarket/bulkDeployment/bulk-view/bulk-view.component.html @@ -224,7 +224,7 @@ <td>{{getAppInstanceName(response)}}</td> <td>{{getDomainCodeName(response)}}</td> <td style="width: 5%" class="text-right"> - <span *ngif="response.type === 'APPLICATION' && response?.details['appInstanceId'] !== undefined" class="dropdown"> + <span class="dropdown"> <a style="display: inline-block" class="dropdown-toggle " aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" href="#" role="button"> <em class="fas fa-cog icon-black icon-bigger"></em> diff --git a/src/app/appmarket/domains/domain-groups/domain-groups.component.html b/src/app/appmarket/domains/domain-groups/domain-groups.component.html index 266d8fe9..53ae0e20 100644 --- a/src/app/appmarket/domains/domain-groups/domain-groups.component.html +++ b/src/app/appmarket/domains/domain-groups/domain-groups.component.html @@ -2,7 +2,7 @@ <h3>{{'DOMAINS.LIST.GROUPS' | translate}}</h3> <div class="flex space-between"> <div class="flex"> - <a *roles="['ROLE_SYSTEM_ADMIN']" [routerLink]="['/admin/domains/groups/add']" class="btn btn-primary" + <a *roles="['ROLE_SYSTEM_ADMIN', 'ROLE_VL_MANAGER']" [routerLink]="['/admin/domains/groups/add']" class="btn btn-primary" role="button">{{'DOMAINS.ADD_BUTTON' | translate}}</a> </div> <div class="flex"> diff --git a/src/app/appmarket/domains/domains.routes.ts b/src/app/appmarket/domains/domains.routes.ts index 6f68ce22..12fb5a90 100644 --- a/src/app/appmarket/domains/domains.routes.ts +++ b/src/app/appmarket/domains/domains.routes.ts @@ -13,7 +13,7 @@ import { DomainAnnotationsComponent } from './domain-annotations/domain-annotati export const DomainsRoutes: Route[] = [ { path: 'admin/domains', component: DomainsListComponent, canActivate: [AuthGuard, RoleGuard], - data: {roles: ['ROLE_SYSTEM_ADMIN', 'ROLE_DOMAIN_ADMIN', 'ROLE_OPERATOR', 'ROLE_VL_DOMAIN_ADMIN']} + data: {roles: ['ROLE_SYSTEM_ADMIN', 'ROLE_DOMAIN_ADMIN', 'ROLE_OPERATOR', 'ROLE_VL_DOMAIN_ADMIN', 'ROLE_VL_MANAGER']} }, { path: 'admin/domains/add', component: DomainComponent, canActivate: [AuthGuard, RoleGuard], diff --git a/src/app/appmarket/users/users.routes.ts b/src/app/appmarket/users/users.routes.ts index 24df650e..abe74e43 100644 --- a/src/app/appmarket/users/users.routes.ts +++ b/src/app/appmarket/users/users.routes.ts @@ -10,5 +10,5 @@ export const UsersRoutes: Route[] = [ { path: 'admin/users/view/:id', component: UserDetailsComponent, canActivate: [AuthGuard, RoleGuard], data: {mode: ComponentMode.VIEW, roles: ['ROLE_SYSTEM_ADMIN']} }, { path: 'domain/users', component: UsersListComponent, canActivate: [AuthGuard, RoleGuard], - data: {roles: ['ROLE_DOMAIN_ADMIN', 'ROLE_VL_MANAGER']}}, + data: {roles: ['ROLE_DOMAIN_ADMIN', 'ROLE_VL_MANAGER', 'ROLE_VL_MANAGER']}}, ]; -- GitLab