Skip to content
Snippets Groups Projects
Commit cbafec81 authored by Joanna Kaźmierczak's avatar Joanna Kaźmierczak
Browse files

dashboard + remote clusters

parent 08821a1b
No related branches found
No related tags found
2 merge requests!258Develop,!197Resolve "Improve new layout"
......@@ -66,4 +66,6 @@ th{
width:100%
}
}
:host ::ng-deep .p-datatable>.p-datatable-wrapper {
overflow: auto;
}
......@@ -26,7 +26,7 @@
selectionMode="range"
[readonlyInput]="true"
(ngModelChange)="onDateChange($event)"
placeholder="Select date range"
showClear="true"
dateFormat="dd.mm.yy"
/>
......@@ -42,8 +42,9 @@
</tr>
</ng-template>
<ng-template pTemplate="body" let-instance>
<tr>
<td><img style="height: 40px" [src]="(appImagesService.getAppLogoUrl(instance.appId) | secure) || '../../../assets/images/app-logo-example.png'"/></td>
<tr [ngClass]="{'clickable': !userHasGuestRoleInCurrentDomain()}"
[routerLink]="userHasGuestRoleInCurrentDomain() ? [] : [instance.id]">
<td><img style="width: 40px" [src]="(appImagesService.getAppLogoUrl(instance.appId) | secure) || '../../../assets/images/app-logo-example.png'"/></td>
<td>{{instance.applicationName}}</td>
<td>{{instance.applicationVersion}}</td>
<td>{{instance.domainName}}</td>
......@@ -113,7 +114,7 @@
</ng-template>
<ng-template pTemplate="body" let-app>
<tr>
<td><img style="height: 40px" [src]="(appImagesService.getAppLogoUrl(app.appId) | secure) || '../../../assets/images/app-logo-example.png'"/></td>
<td><img style="width: 40px" [src]="(appImagesService.getAppLogoUrl(app.appId) | secure) || '../../../assets/images/app-logo-example.png'"/></td>
<td>{{app.appName}}</td>
<td>{{app.appId}}</td>
<td>{{app.instanceName}}</td>
......
......@@ -6,6 +6,7 @@ import { UserDataService } from '../../service/userdata.service';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import {AppImagesService, AppsService} from '../../service';
import {ActivatedRoute} from '@angular/router';
import {AuthService} from '../../auth/auth.service';
describe('AdminDashboardComponent', () => {
let component: AdminDashboardComponent;
......@@ -19,6 +20,8 @@ describe('AdminDashboardComponent', () => {
];
beforeEach(async () => {
const authServiceSpy = jasmine.createSpyObj('AuthService', ['hasDomainRole']);
authServiceSpy.hasDomainRole.and.returnValue(true)
mockDashboardService = jasmine.createSpyObj('DashboardService', ['getAdmin', 'getDomainAdmin']);
mockUserDataService = jasmine.createSpyObj('UserDataService', ['selectedDomainId']);
const appImagesServiceSpy = jasmine.createSpyObj('AppImagesService', ['getAppLogoUrl']);
......@@ -40,7 +43,8 @@ describe('AdminDashboardComponent', () => {
{provide: AppImagesService, useValue: appImagesServiceSpy},
{ provide: UserDataService, useValue: mockUserDataService },
{provide: ActivatedRoute, useValue: {params: of({id: 1})}},
{ provide: AppsService, useValue: appsServiceSpy }
{ provide: AppsService, useValue: appsServiceSpy },
{provide: AuthService, useValue: authServiceSpy}
],
schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA] // Add this to allow unknown properties
}).compileComponents();
......
......@@ -3,6 +3,7 @@ import {DashboardService} from '../../service/dashboard.service';
import {UserDataService} from '../../service/userdata.service';
import {AppImagesService, AppsService} from '../../service';
import {ActivatedRoute} from '@angular/router';
import {AuthService} from '../../auth/auth.service';
@Component({
selector: 'app-admin-dashboard',
......@@ -29,7 +30,8 @@ export class AdminDashboardComponent {
private userDataService: UserDataService,
public appImagesService: AppImagesService,
private route: ActivatedRoute,
private appsService: AppsService) {
private appsService: AppsService,
public authService: AuthService) {
}
......@@ -145,5 +147,9 @@ export class AdminDashboardComponent {
start.setDate(start.getDate() - 7);
this.startDate = start.toISOString();
this.endDate = end.toISOString();
this.rangeDates = [new Date(start.setDate(start.getDate() - 7)), end]
}
public userHasGuestRoleInCurrentDomain(): boolean {
return this.authService.hasDomainRole(this.domainId, 'ROLE_GUEST');
}
}
......@@ -23,9 +23,6 @@
[responsiveLayout]="'scroll'">
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="id" id="id"> {{ 'CLUSTERS.ID' | translate }}
<p-sortIcon field="id"></p-sortIcon>
</th>
<th pSortableColumn="name" id="name"> {{ 'CLUSTERS.NAME' | translate }}
<p-sortIcon field="name"></p-sortIcon>
</th>
......@@ -35,23 +32,14 @@
<th pSortableColumn="state" id="state"> {{ 'CLUSTERS.STATE' | translate }}
<p-sortIcon field="state"></p-sortIcon>
</th>
<th pSortableColumn="creationDate" id="creationDate"> {{ 'CLUSTERS.CREATION_DATE' | translate }}
<p-sortIcon field="creationDate"></p-sortIcon>
</th>
<th pSortableColumn="modificationDate" id="modificationDate"> {{ 'CLUSTERS.MODIFICATION_DATE' | translate }}
<p-sortIcon field="modificationDate"></p-sortIcon>
</th>
<th></th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-cluster>
<tr>
<td [routerLink]="[cluster.id]">{{cluster.id}}</td>
<td [routerLink]="[cluster.id]">{{cluster.name}}</td>
<td [routerLink]="[cluster.id]">{{cluster.codename}}</td>
<td [routerLink]="[cluster.id]">{{('CLUSTERS.'+cluster.state.toString().toUpperCase() ) | translate}}</td>
<td [routerLink]="[cluster.id]">{{cluster.creationDate | date: 'dd-MM-yyyy HH:mm'}}</td>
<td [routerLink]="[cluster.id]">{{cluster.modificationDate | date: 'dd-MM-yyyy HH:mm'}}</td>
<td class="text-right">
<span class="dropdown">
<a style="display: inline-block" class="dropdown-toggle" aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" href="#" role="button">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment