Commit cb52e1a0 authored by Łukasz Szymański's avatar Łukasz Szymański
Browse files

working on "deployed artifacts" view - monitor

parent eca0b457
Pipeline #15088 passed with stages
in 7 minutes and 33 seconds
export class MonitorProactive {
id: string;
authorizationBearer: string;
baguetteIp: string;
baguettePort: number
targetOs: string;
targetType: string;
targetName: string;
targetProvider: string;
location: string;
isUsingHttps: boolean
nodeId: string;
}
......@@ -6,7 +6,7 @@
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
<table mat-table [dataSource]="data" matSort matSortActive="metric" matSortDisableClear
<table mat-table [dataSource]="data" matSort matSortActive="nodeId" matSortDisableClear
matSortDirection="asc">
<ng-container matColumnDef="no">
......@@ -16,102 +16,59 @@
</td>
</ng-container>
<ng-container matColumnDef="metric">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Metric</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.metric}}</td>
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Id</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.id}}</td>
</ng-container>
<ng-container matColumnDef="sensorType">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Sensor type</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.sensor.type}}</td>
<ng-container matColumnDef="nodeId">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Node Id</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.nodeId}}</td>
</ng-container>
<ng-container matColumnDef="sensorPort">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Sensor port</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.sensor.port}}</td>
<ng-container matColumnDef="baguetteIp">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Baguette Ip</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.baguetteIp}}</td>
</ng-container>
<ng-container matColumnDef="targets">
<th mat-header-cell *matHeaderCellDef>Targets</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">
<mat-accordion>
<!--targets list-->
<mat-expansion-panel (opened)="panelOpenState = true"
(closed)="panelOpenState = false">
<mat-expansion-panel-header>
<mat-panel-title>
<span>targets</span>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-accordion>
<mat-card *ngFor="let targetItem of row.targets" class="monitor-element-mat-card">
<p> type: {{targetItem.type}} </p>
<p> identifier: {{targetItem.identifier}} </p>
</mat-card>
</mat-accordion>
</mat-expansion-panel>
</mat-accordion>
</td>
<ng-container matColumnDef="baguettePort">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Baguette Port</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.baguettePort}}</td>
</ng-container>
<ng-container matColumnDef="sinks">
<th mat-header-cell *matHeaderCellDef>Sinks</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">
<mat-accordion>
<!--sinks list-->
<mat-expansion-panel (opened)="panelOpenState = true"
(closed)="panelOpenState = false">
<mat-expansion-panel-header>
<mat-panel-title>
<span>sinks</span>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-accordion>
<mat-card *ngFor="let sinkItem of row.sinks" class="monitor-element-mat-card">
type: {{sinkItem.type}}
<mat-expansion-panel (opened)="panelOpenState = true"
(closed)="panelOpenState = false">
<mat-expansion-panel-header>
<mat-panel-title>
<span>configuration</span>
</mat-panel-title>
</mat-expansion-panel-header>
<pre>{{ sinkItem.configuration | json }}</pre>
</mat-expansion-panel>
</mat-card>
</mat-accordion>
</mat-expansion-panel>
</mat-accordion>
</td>
<ng-container matColumnDef="targetOs">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Target Os</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.targetOs}}</td>
</ng-container>
<ng-container matColumnDef="targetType">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Target Type</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.targetType}}</td>
</ng-container>
<ng-container matColumnDef="targetName">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Target Name</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.targetName}}</td>
</ng-container>
<ng-container matColumnDef="tags">
<th mat-header-cell *matHeaderCellDef>Tags</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">
<mat-accordion>
<ng-container matColumnDef="targetProvider">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Target Provider</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.targetProvider}}</td>
</ng-container>
<!--tags list-->
<mat-expansion-panel (opened)="panelOpenState = true"
(closed)="panelOpenState = false">
<mat-expansion-panel-header>
<mat-panel-title>
<span>tags</span>
</mat-panel-title>
</mat-expansion-panel-header>
<ng-container matColumnDef="location">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Location</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.location}}</td>
</ng-container>
<pre>{{ row.tags | json }}</pre>
<ng-container matColumnDef="isUsingHttps">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Is Using Https</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.isUsingHttps}}</td>
</ng-container>
</mat-expansion-panel>
</mat-accordion>
</td>
<ng-container matColumnDef="authorizationBearer">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Authorization Bearer</th>
<td mat-cell class="field-with-wrapping" *matCellDef="let row">{{row.authorizationBearer}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
......
......@@ -4,6 +4,7 @@ import {MatPaginator, MatSnackBar, MatSort, MatTableDataSource} from '@angular/m
import {DeploymentDetailsService} from '../service/deployment-details.service';
import {MonitoringTargetCloudiator} from '../model/monitoring-target-cloudiator';
import {DataSinkCloudiator} from '../model/data-sink-cloudiator';
import {MonitorProactive} from "../model/monitor-proactive";
@Component({
selector: 'app-monitor-list',
......@@ -13,11 +14,11 @@ import {DataSinkCloudiator} from '../model/data-sink-cloudiator';
export class MonitorListComponent implements OnInit {
panelOpenState = false;
monitorCloudiatorList: MonitorCloudiator[];
monitorProactiveList: MonitorProactive[];
loadingMonitorCloudiatorListInProgress = false;
data: MatTableDataSource<MonitorCloudiator>;
displayedColumns: string[] = ['no', 'metric', 'sensorType', 'sensorPort', 'targets', 'sinks', 'tags'];
data: MatTableDataSource<MonitorProactive>;
displayedColumns: string[] = ['no', 'id', 'nodeId', 'baguetteIp', 'baguettePort', 'targetOs', 'targetType', 'targetName', 'targetProvider', 'location', 'isUsingHttps', 'authorizationBearer'];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
......@@ -33,29 +34,14 @@ export class MonitorListComponent implements OnInit {
},
error1 => {
this.updateTableData([]);
this.snackBar.open(`Problem by getting monitors list from Cloudiator: ${error1.error.message}`, 'Close');
this.snackBar.open(`Problem by getting monitors list from ProActive: ${error1.error.message}`, 'Close');
});
}
updateTableData(monitorsList: MonitorCloudiator[]) {
updateTableData(monitorsList: MonitorProactive[]) {
this.loadingMonitorCloudiatorListInProgress = false;
this.monitorCloudiatorList = monitorsList;
this.data = new MatTableDataSource<MonitorCloudiator>(this.monitorCloudiatorList);
this.data.filterPredicate = (filteringData, filter) => {
return this.getMonitorCloudiatorForFilteringAsString(filteringData).indexOf(filter) !== -1;
};
this.data.sortingDataAccessor = this.data.sortingDataAccessor = (item, property) => {
switch (property) {
case 'sensorType':
return item.sensor.type;
case 'sensorPort':
return item.sensor.port;
default:
return item[property];
}
};
this.monitorProactiveList = monitorsList;
this.data = new MatTableDataSource<MonitorProactive>(this.monitorProactiveList);
this.data.paginator = this.paginator;
this.data.sort = this.sort;
......@@ -69,33 +55,4 @@ export class MonitorListComponent implements OnInit {
}
}
private getMonitorCloudiatorForFilteringAsString(filteringData: MonitorCloudiator) {
return filteringData.metric + filteringData.sensor.type + filteringData.sensor.port
+ this.getTargetsListAsString(filteringData.targets) + this.getSinksListAsString(filteringData.sinks)
+ this.getMapAsString(filteringData.tags);
}
private getTargetsListAsString(targets: Array<MonitoringTargetCloudiator>) {
let result = '';
targets.forEach(value => {
result += value.type + value.identifier;
});
return result;
}
private getSinksListAsString(sinks: Array<DataSinkCloudiator>) {
let result = '';
sinks.forEach(value => {
result += value.type + this.getMapAsString(value.configuration);
});
return result;
}
private getMapAsString(mapOfStrings: Map<string, string>) {
let result = '';
Object.keys(mapOfStrings).forEach(key => {
result += key + mapOfStrings[key];
});
return result;
}
}
......@@ -8,7 +8,7 @@ import {NodeCloudiator} from '../../../../application/model/node-cloudiator';
import {QueueCloudiator} from '../model/queue-cloudiator';
import {JobMelodic} from '../model/job-melodic';
import {ScheduleCloudiator} from '../model/schedule-cloudiator';
import {MonitorCloudiator} from '../model/monitor-cloudiator';
import {MonitorProactive} from "../model/monitor-proactive";
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
......@@ -51,8 +51,8 @@ export class DeploymentDetailsService {
getJobCloudiatorList(): Observable<Array<JobMelodic>> {
const requestUrl = `${this.apiUrl}/job`;
return this.http.get(requestUrl, httpOptions).pipe(
tap((response: Array<JobMelodic>) => console.log(`Response from cloudiator jobs list with ${response.length} elements`),
e => console.log('Error by getting cloudiator job list', e))
tap((response: Array<JobMelodic>) => console.log(`Response from ProActive jobs list with ${response.length} elements`),
e => console.log('Error by getting ProActive job list', e))
);
}
......@@ -64,11 +64,11 @@ export class DeploymentDetailsService {
);
}
getMonitorCloudiatorList(): Observable<Array<MonitorCloudiator>> {
getMonitorCloudiatorList(): Observable<Array<MonitorProactive>> {
const requestUrl = `${this.apiUrl}/monitor`;
return this.http.get(requestUrl, httpOptions).pipe(
tap((response: Array<MonitorCloudiator>) => console.log(`Response from cloudiator monitor list with ${response.length} elements`),
e => console.log('Error by getting cloudiator monitor list: ', e))
tap((response: Array<MonitorProactive>) => console.log(`Response from ProActive monitor list with ${response.length} elements`),
e => console.log('Error by getting ProActive monitor list: ', e))
);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment