Skip to content

Commit

Permalink
Merge pull request primefaces#415 from atretyak1985/issue_#NNTR-350
Browse files Browse the repository at this point in the history
[NNTR-350]Change column name and content in Asset list (Benchmark Score => "cor…
  • Loading branch information
Gunnsteinn Hall authored Jan 10, 2020
2 parents 2d00cce + 089902b commit f0b16d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/organization/device/device_list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ <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 *ngIf="col.field !== 'asset_risc'">{{col.header}}<p-sortIcon *ngIf="!col.disabled" [field]="col.field"></p-sortIcon></div>
<div *ngIf="col.field !== 'asset_risc'">
{{ col.field === 'cis' ? primaryFrameworkName : 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; justify-content: center;">
Expand Down Expand Up @@ -190,7 +193,9 @@ <h2 class="modal-title">Customize Columns</h2>
<ng-container *ngFor="let col of customizedColumns">
<div class="customize-column-item cursor-grab" cdkDrag>
<i class="fa fa-bars" aria-hidden="true"></i>
<label for="col-{{ col.field }}" class="cursor-grab" style="padding-left: 10px;">{{ col.header }}</label>
<label for="col-{{ col.field }}" class="cursor-grab" style="padding-left: 10px;">
{{ col.field === 'cis' ? primaryFrameworkName : col.header }}
</label>
<input id="col-{{ col.field }}" type="checkbox" [disabled]="col.field == 'hostname'" [checked]="!disabledColumns[col.field]"
(change)="onColumnCheckboxClick($event, col.field)" style="margin-left: 5px;" />
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/organization/device/device_list.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, ViewChild, Injector } from '@angular/core';
import { DeviceService } from './device.service';
import { FormGroup, FormControl } from '@angular/forms';
import { DeviceListItem, RequestExportForm } from './device_response';
import { DeviceListItem, RequestExportForm, DeviceListResponse } from './device_response';
import { LabelListItem } from 'organization/admin/label/label.response';
import { ColumnWithSort } from 'common/object';
import { LabelCreateDialogComponent } from 'organization/admin/label/label_create_dialog.component';
Expand Down Expand Up @@ -40,6 +40,7 @@ export class DeviceListComponent extends BaseDevice {
{ field: 'risc_rating_a', header: 'A', tooltip: 'Availability', order: 0, width: '50px', disabled: false }
];
public isUpgrade: boolean = false;
public primaryFrameworkName: string;

constructor(
service: DeviceService,
Expand Down Expand Up @@ -94,6 +95,11 @@ export class DeviceListComponent extends BaseDevice {
this.service.setDisabledColumns(this.disabledColumns);
}

listResponseHandler(response: DeviceListResponse) {
super.listResponseHandler(response);
this.primaryFrameworkName = response.hasOwnProperty('primary_framework_name') ? `${response.primary_framework_name} Score` : 'Benchmark Score';
}

refresh() {
super.refresh();
this.setLabels();
Expand Down
6 changes: 3 additions & 3 deletions src/organization/device/device_response.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {BasicListResponse} from '../../common/response';
import {LoggedInUserDetailItem} from '../loggedin_user/loggedin_user_response';
import {BasicListRequest} from '../../common/request';
import { BasicListResponse } from '../../common/response';
import { LoggedInUserDetailItem } from '../loggedin_user/loggedin_user_response';
import { DeviceSoftwareItem } from './detail/software/device-software.response';
import { SubnetDevice } from 'organization/admin/subnets/subnet_response';

export interface DeviceListResponse extends BasicListResponse {
items: Array<DeviceListItem>;
primary_framework_name: string;
}

export interface BenchmarkTemp {
Expand Down

0 comments on commit f0b16d4

Please sign in to comment.