Skip to content

Commit

Permalink
Device detail - Show subnet ip addresses primefaces#195 (primefaces#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
atretyak1985 authored and gunnsth committed May 9, 2019
1 parent 0504582 commit 29933d4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/organization/device/device_detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ <h1 class="panel-title">
<div class="row">
<div class="col-md-6 benchmark-heading">
<div class="row" *ngIf="response.item.last_remote_address">
<div class="semi-bold">IP:</div>
<div class="semi-bold">Remote IP:</div>
<div class="">{{ response.item.last_remote_address }}</div>
</div>
<div class="row" *ngIf="response.subnets.length">
<div class="semi-bold">Local IPs:</div>
<div class="">{{ getLocalIPs(response.subnets) }}</div>
</div>
<div class="row">
<div class="semi-bold">OS:</div>
<div class="">{{ response.item.os_description }} {{ response.item.distribution }} ({{
Expand Down
31 changes: 20 additions & 11 deletions src/organization/device/device_detail.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path="../../../custom_typings/bootstrap.d.ts" />
/// <reference path="../../../custom_typings/clipboard.d.ts" />
/// <reference path="../../../custom_typings/custom.d.ts" />
import { Component, OnInit, Renderer2, ViewChild, ViewChildren, ElementRef } from '@angular/core';
import { Component, OnInit, Renderer2, ViewChild, ViewChildren, ElementRef, ChangeDetectorRef } from '@angular/core';
import { DeviceDetailResponse, DeviceDetailItem, DeviceAssigmentItem } from './device_response';
import { BasicResponse } from '../../common/response';
import { DeviceService } from './device.service';
Expand Down Expand Up @@ -29,6 +29,7 @@ import { DeviceUserComponent } from './detail/user/device-user.component';
import { DeviceGroupPolicyComponent } from './detail/group-policy/device-group-policy.component';
import { DevicePatchComponent } from './detail/patch/device-patch.component';
import { DevicePatchService } from './detail/patch/device-patch.service';
import { SubnetDevice } from 'organization/admin/subnets/subnet_response';


declare var jQuery: JQueryStatic;
Expand Down Expand Up @@ -97,17 +98,17 @@ export class DeviceDetailComponent implements OnInit {
public isSoftwareTabActive = false;
public isVulnerabilitiesTabActive = false;

constructor(private serviceDeviceGroupPolicy: DeviceGroupPolicyService, private serviceDeviceSoftware: DeviceSoftwareService, private serviceDeviceUser : DeviceUserService,
constructor(private serviceDeviceGroupPolicy: DeviceGroupPolicyService, private serviceDeviceSoftware: DeviceSoftwareService, private serviceDeviceUser: DeviceUserService,
private serviceDeviceVulnerability: DeviceVulnerabilityService, private serviceDeviceIncident: DeviceIncidentService, private serviceDevicePatch: DevicePatchService,
private service: DeviceService, private route: ActivatedRoute, private router: Router, private spinnerService: SpinnerService, private breadcrumbService: BreadcrumbService,
private renderer: Renderer2) {
this.deviceId = route.snapshot.params['id'];
this.response = null;
this.needsConnectionString = false;
this.tabSelected = 1;
this.vulnerabilityEnabled = false;
this.infoCollapsed = false;
this.disabledColumns = {};
private service: DeviceService, private route: ActivatedRoute, private router: Router, private spinnerService: SpinnerService, private breadcrumbService: BreadcrumbService,
private renderer: Renderer2, private cdr: ChangeDetectorRef) {
this.deviceId = route.snapshot.params['id'];
this.response = null;
this.needsConnectionString = false;
this.tabSelected = 1;
this.vulnerabilityEnabled = false;
this.infoCollapsed = false;
this.disabledColumns = {};
}

ngOnInit() {
Expand Down Expand Up @@ -148,6 +149,10 @@ export class DeviceDetailComponent implements OnInit {
this.service.destroy();
}

ngAfterViewChecked() {
this.cdr.detectChanges();
}

isDeviceLicensed(item: DeviceDetailItem): boolean {
return item.status == 100;
}
Expand Down Expand Up @@ -662,6 +667,10 @@ export class DeviceDetailComponent implements OnInit {
this.numPatches = event;
}
}

getLocalIPs(subnets: SubnetDevice[]): string {
return subnets.slice(0, 10).map(subnet => subnet.ip_address).join(", ");
}
}

class Profile {
Expand Down
2 changes: 2 additions & 0 deletions src/organization/device/device_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {BasicListResponse} from '../../common/response';
import {LoggedInUserDetailItem} from '../loggedin_user/loggedin_user_response';
import {BasicListRequest} from '../../common/request';
import { DeviceSoftwareItem } from './detail/software/device-software.response';
import { SubnetDevice } from 'organization/admin/subnets/subnet_response';

export interface DeviceListResponse extends BasicListResponse {
items: Array<DeviceListItem>;
Expand Down Expand Up @@ -53,6 +54,7 @@ export interface DeviceListItem {

export interface DeviceDetailResponse {
item: DeviceDetailItem;
subnets: Array<SubnetDevice>;
available_assignments: Array<DeviceAvailableAssigmentItem>;
assignments: Array<DeviceAssigmentItem>;
loggedin_users: Array<LoggedInUserDetailItem>;
Expand Down

0 comments on commit 29933d4

Please sign in to comment.