Skip to content

Commit

Permalink
Merge pull request primefaces#398 from atretyak1985/issue_#NNTR-357
Browse files Browse the repository at this point in the history
[NNTR-357]Add a new column group to the Assets list (/device) called Asset RISC…
  • Loading branch information
Gunnsteinn Hall authored Jan 6, 2020
2 parents c475707 + fd8c9b9 commit 88b0d1e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class ColumnSort {
export class ColumnWithSort {
field: string;
header: string;
tooltip?: string;
order: number;
width: string;
disabled: boolean;
Expand Down
22 changes: 21 additions & 1 deletion src/organization/device/device_list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,22 @@ <h1 class="panel-title">
</th>
<ng-container *ngFor="let col of cols">
<th *ngIf="needDisplay(col.field)" class="table-header-cell" [pSortableColumn]="col.field" [pSortableColumnDisabled]="col.disabled" [ngStyle]="{'width': col.width}">
<div>{{col.header}}<p-sortIcon *ngIf="!col.disabled" [field]="col.field"></p-sortIcon></div>
<div *ngIf="col.field !== 'asset_risc'">{{col.header}}<p-sortIcon *ngIf="!col.disabled" [field]="col.field"></p-sortIcon></div>
<div *ngIf="col.field === 'asset_risc'">
<div class="text-center">{{col.header}}</div>
<div style="display: flex;">
<div *ngFor="let item of assetRiscColumn"
class="text-center"
style="font-size: 12px;"
[pTooltip]="item.tooltip"
tooltipPosition="bottom"
[pSortableColumn]="item.field"
[pSortableColumnDisabled]="item.disabled"
[ngStyle]="{'width': item.width}">{{item.header}}
<p-sortIcon [field]="item.field"></p-sortIcon>
</div>
</div>
</div>
</th>
</ng-container>
</tr>
Expand All @@ -91,6 +106,11 @@ <h1 class="panel-title">
<ng-container *ngFor="let col of cols">
<td *ngIf="col.field === 'hostname' && needDisplay(col.field)" class="table-cell" [ngStyle]="{'width': getColumnWidth('hostname')}"><a href="#" (click)="itemSelected($event, rowData)">{{ rowData['hostname'] }}</a></td>
<td *ngIf="col.field === 'ip_addresses' && needDisplay(col.field)" class="table-cell" [ngStyle]="{'width': getColumnWidth('ip_addresses')}">{{ getIpAddresses(rowData) }}</td>
<td *ngIf="col.field === 'asset_risc' && needDisplay(col.field)" class="table-cell" [ngStyle]="{'width': getColumnWidth('asset_risc')}">
<div style="display: flex;">
<div *ngFor="let item of assetRiscColumn" class="text-center"[ngStyle]="{'width': item.width}">{{rowData[item.field]}}</div>
</div>
</td>
<td *ngIf="col.field === 'os_description' && needDisplay(col.field)" class="table-cell" [ngStyle]="{'width': getColumnWidth('os_description')}">{{ getOperatingSystem(rowData) }}</td>
<td *ngIf="col.field === 'type' && needDisplay(col.field)" class="table-cell" [ngStyle]="{'width': getColumnWidth('type')}">{{ stringUtils.typeToString(rowData['type'], rowData['system_type']) }}</td>
<td *ngIf="col.field === 'shouldDisplayLabelColumn' && needDisplay(col.field)" #badges style="height:40px" class="table-cell" [ngStyle]="{'width': getColumnWidth('shouldDisplayLabelColumn')}">
Expand Down
6 changes: 6 additions & 0 deletions src/organization/device/device_list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export class DeviceListComponent extends BaseDevice {
{ label: '5000', value: 5000 },
{ label: '10000', value: 10000 }
];
public assetRiscColumn: Array<ColumnWithSort> = [
{ field: 'risc_rating_c', header: 'C', tooltip: 'Confidentiality', order: 0, width: '50px', disabled: false },
{ field: 'risc_rating_i', header: 'I', tooltip: 'Integrity', order: 0, width: '50px', disabled: false },
{ field: 'risc_rating_a', header: 'A', tooltip: 'Availability', order: 0, width: '50px', disabled: false }
];
public isUpgrade: boolean = false;

constructor(
Expand All @@ -56,6 +61,7 @@ export class DeviceListComponent extends BaseDevice {
let defaultCols = [
{ field: 'hostname', header: 'Hostname', order: 0, width: '180px', disabled: false },
{ field: 'ip_addresses', header: 'IP Addresses', order: 0, width: '180px', disabled: false },
{ field: 'asset_risc', header: 'Asset RISC', order: 0, width: '150px', disabled: true },
{ field: 'os_description', header: 'OS', order: 0, width: '180px', disabled: false },
{ field: 'type', header: 'Type', order: 0, width: '140px', disabled: false },
{ field: 'shouldDisplayLabelColumn', header: 'Labels', order: 0, width: '140px', disabled: true },
Expand Down
3 changes: 3 additions & 0 deletions src/organization/device/device_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export interface DeviceListItem {
device_labels: number[];
ip_addresses: string[];
os_version: string;
risc_rating_c: number;
risc_rating_i: number;
risc_rating_a: number;
}

export interface DeviceDetailResponse {
Expand Down

0 comments on commit 88b0d1e

Please sign in to comment.