fixed sensor setting

This commit is contained in:
snoop 2018-02-27 17:36:31 +09:00
parent 12da2e0550
commit 72a958fe4b
5 changed files with 34 additions and 15 deletions

View File

@ -44,7 +44,9 @@
<mat-grid-tile>{{sir.sensorItemName}}</mat-grid-tile> <mat-grid-tile>{{sir.sensorItemName}}</mat-grid-tile>
<mat-grid-tile>{{sir.sensorItemUnit}}</mat-grid-tile> <mat-grid-tile>{{sir.sensorItemUnit}}</mat-grid-tile>
<mat-grid-tile>{{sir.sensorItemKey}}</mat-grid-tile> <mat-grid-tile>{{sir.sensorItemKey}}</mat-grid-tile>
<mat-grid-tile><button mat-button>Save</button><button mat-button>Cancel</button></mat-grid-tile> <mat-grid-tile>
<button mat-button>Save</button><button mat-button>Cancel</button>
</mat-grid-tile>
</mat-grid-list> </mat-grid-list>
<!-- <mat-grid-list cols="4" rowHeight="8:1"> <!-- <mat-grid-list cols="4" rowHeight="8:1">

View File

@ -3,6 +3,7 @@ import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
export class SensorItemResult { export class SensorItemResult {
id?: number;
sensorItemName?: String; sensorItemName?: String;
sensorItemUnit?: String; sensorItemUnit?: String;
sensorKeyName?: String; sensorKeyName?: String;
@ -18,6 +19,7 @@ export class SettingResultComponent implements OnInit, AfterContentInit {
favoriteSeason: string; favoriteSeason: string;
sensorItemResultList: Array<SensorItemResult>; sensorItemResultList: Array<SensorItemResult>;
optionList: Array<number>;
constructor() { } constructor() { }
@ -30,20 +32,24 @@ export class SettingResultComponent implements OnInit, AfterContentInit {
ngAfterContentInit() { ngAfterContentInit() {
this.sensorItemResultList = new Array(); this.sensorItemResultList = new Array();
this.optionList = new Array();
const ctu: SensorItemResult = { const ctu: SensorItemResult = {
id: 1,
sensorItemName: 'CPU Total Usage', sensorItemName: 'CPU Total Usage',
sensorItemUnit: '%', sensorItemUnit: '%',
sensorKeyName: 'wmi.cpu.usage.total' sensorKeyName: 'wmi.cpu.usage.total'
}; };
const cfu: SensorItemResult = { const cfu: SensorItemResult = {
id: 2,
sensorItemName: 'CPU Free Usage', sensorItemName: 'CPU Free Usage',
sensorItemUnit: 'kb', sensorItemUnit: 'kb',
sensorKeyName: 'wmi.cpu.usage.free' sensorKeyName: 'wmi.cpu.usage.free'
}; };
const mtu: SensorItemResult = { const mtu: SensorItemResult = {
id: 3,
sensorItemName: 'Mem Total Usage', sensorItemName: 'Mem Total Usage',
sensorItemUnit: '%', sensorItemUnit: '%',
sensorKeyName: 'wmi.mem.usage.total' sensorKeyName: 'wmi.mem.usage.total'
@ -53,6 +59,10 @@ export class SettingResultComponent implements OnInit, AfterContentInit {
this.sensorItemResultList.push(cfu); this.sensorItemResultList.push(cfu);
this.sensorItemResultList.push(mtu); this.sensorItemResultList.push(mtu);
for ( let indexI = 0; indexI < this.sensorItemResultList.length; ++indexI) {
this.optionList.push(this.sensorItemResultList[indexI].id);
}
} }
ngOnInit() { ngOnInit() {

View File

@ -40,12 +40,12 @@
<mat-card-subtitle>Select Crawler</mat-card-subtitle> <mat-card-subtitle>Select Crawler</mat-card-subtitle>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-radio-group class="example-radio-group"> <mat-radio-group class="example-radio-group" [(ngModel)]="selectCrawler">
<mat-radio-button class="example-radio-button" *ngFor="let season of seasons" [value]="season"> <mat-radio-button class="example-radio-button" *ngFor="let crawler of crawlerList" [value]="crawler">
{{season}} {{crawler}}
</mat-radio-button> </mat-radio-button>
</mat-radio-group> </mat-radio-group>
<div class="example-selected-value">Your favorite season is: {{favoriteSeason}}</div> <div class="example-selected-value">Your select crawler is: {{selectCrawler}}</div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -1,24 +1,31 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
@Component({ @Component({
selector: 'of-sensor-setting', selector: 'of-sensor-setting',
templateUrl: './setting.component.html', templateUrl: './setting.component.html',
styleUrls: ['./setting.component.scss'] styleUrls: ['./setting.component.scss']
}) })
export class SettingComponent implements OnInit { export class SettingComponent implements OnInit, AfterContentInit {
constructor() { } constructor() { }
favoriteSeason: string; selectCrawler: String;
seasons = [ crawlerList: Array<String>;
'Winter',
'Spring',
'Summer',
'Autumn',
];
ngOnInit() { ngOnInit() {
} }
ngAfterContentInit() {
this.crawlerList = new Array();
this.crawlerList.push('SSH Crawler');
this.crawlerList.push('WMI Crawler');
this.crawlerList.push('MySQL Crawler');
this.crawlerList.push('PostgreSQL Crawler');
}
} }

View File

@ -1,8 +1,8 @@
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="center"> <div fxLayout="row" fxLayoutWrap fxLayoutAlign="center">
<div *ngIf="step == 2"> <div *ngIf="step == 1">
<of-sensor-setting></of-sensor-setting> <of-sensor-setting></of-sensor-setting>
</div> </div>
<div *ngIf="step == 1"> <div *ngIf="step == 2">
<of-sensor-setting-result></of-sensor-setting-result> <of-sensor-setting-result></of-sensor-setting-result>
</div> </div>
<div fxLayout="col" fxLayoutWrap fxLayoutAlign="center"> <div fxLayout="col" fxLayoutWrap fxLayoutAlign="center">