Skip to content

Commit

Permalink
Merge pull request #206 from nmaas-platform/149-handle-namespace-crea…
Browse files Browse the repository at this point in the history
…tion-during-domain-provisioning-1

Update bulks roles
  • Loading branch information
llopat authored Mar 13, 2024
2 parents dd6737d + e3c1a07 commit 71942d7
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ <h3>{{header | translate}}</h3>
</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>

Expand Down
35 changes: 33 additions & 2 deletions src/app/appmarket/bulkDeployment/bulk-list/bulk-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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');
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ <h3>{{'BULK.APP.VIEW_HEADER' | translate}}</h3>
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion src/app/appmarket/domains/domains.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion src/app/appmarket/users/users.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']}},
];

0 comments on commit 71942d7

Please sign in to comment.