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

View File

@ -40,12 +40,12 @@
<mat-card-subtitle>Select Crawler</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<mat-radio-group class="example-radio-group">
<mat-radio-button class="example-radio-button" *ngFor="let season of seasons" [value]="season">
{{season}}
<mat-radio-group class="example-radio-group" [(ngModel)]="selectCrawler">
<mat-radio-button class="example-radio-button" *ngFor="let crawler of crawlerList" [value]="crawler">
{{crawler}}
</mat-radio-button>
</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>

View File

@ -1,24 +1,31 @@
import { Component, OnInit } from '@angular/core';
import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
@Component({
selector: 'of-sensor-setting',
templateUrl: './setting.component.html',
styleUrls: ['./setting.component.scss']
})
export class SettingComponent implements OnInit {
export class SettingComponent implements OnInit, AfterContentInit {
constructor() { }
favoriteSeason: string;
selectCrawler: String;
seasons = [
'Winter',
'Spring',
'Summer',
'Autumn',
];
crawlerList: Array<String>;
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 *ngIf="step == 2">
<div *ngIf="step == 1">
<of-sensor-setting></of-sensor-setting>
</div>
<div *ngIf="step == 1">
<div *ngIf="step == 2">
<of-sensor-setting-result></of-sensor-setting-result>
</div>
<div fxLayout="col" fxLayoutWrap fxLayoutAlign="center">