added model

This commit is contained in:
snoop 2018-02-26 18:54:53 +09:00
parent 00c7f59d02
commit 12da2e0550
2 changed files with 55 additions and 13 deletions

View File

@ -39,11 +39,19 @@
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="center">
<mat-card class="example-card2">
<mat-card-content>
<mat-grid-list cols="4" rowHeight="8:1">
<mat-grid-list cols="4" rowHeight="8:1" *ngFor="let sir of sensorItemResultList">
<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-list>
<!-- <mat-grid-list cols="4" rowHeight="8:1">
<mat-grid-tile>CPU Total Usage</mat-grid-tile>
<mat-grid-tile>(%)</mat-grid-tile>
<mat-grid-tile>wmi.cpu.usage.total</mat-grid-tile>
<mat-grid-tile>[Add Notification]</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="1" rowHeight="8:1">
<mat-grid-tile>
@ -67,8 +75,14 @@
<mat-grid-tile>CPU Free Usage</mat-grid-tile>
<mat-grid-tile>(kb)</mat-grid-tile>
<mat-grid-tile>wmi.cpu.usage.free</mat-grid-tile>
<mat-grid-tile>[Add Notification]</mat-grid-tile>
<mat-grid-tile><button mat-button>Add Notification</button></mat-grid-tile>
</mat-grid-list>
<mat-grid-list cols="4" rowHeight="8:1">
<mat-grid-tile>CPU Free Usage</mat-grid-tile>
<mat-grid-tile>(kb)</mat-grid-tile>
<mat-grid-tile>wmi.cpu.usage.free</mat-grid-tile>
<mat-grid-tile><button mat-button>Add Notification</button></mat-grid-tile>
</mat-grid-list> -->
</mat-card-content>
</mat-card>
</div>

View File

@ -1,5 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup , FormControl } from '@angular/forms';
import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks';
import {FormsModule} from '@angular/forms';
export class SensorItemResult {
sensorItemName?: String;
sensorItemUnit?: String;
sensorKeyName?: String;
}
@Component({
@ -7,13 +14,10 @@ import { FormGroup , FormControl } from '@angular/forms';
templateUrl: './setting-result.component.html',
styleUrls: ['./setting-result.component.scss']
})
export class SettingResultComponent implements OnInit {
export class SettingResultComponent implements OnInit, AfterContentInit {
favoriteSeason: string;
selectedStatus: number ;
eventEditForm: FormGroup;
public toggleForm: boolean;
sensorItemResultList: Array<SensorItemResult>;
constructor() { }
@ -23,11 +27,35 @@ export class SettingResultComponent implements OnInit {
'200',
];
ngAfterContentInit() {
this.sensorItemResultList = new Array();
const ctu: SensorItemResult = {
sensorItemName: 'CPU Total Usage',
sensorItemUnit: '%',
sensorKeyName: 'wmi.cpu.usage.total'
};
const cfu: SensorItemResult = {
sensorItemName: 'CPU Free Usage',
sensorItemUnit: 'kb',
sensorKeyName: 'wmi.cpu.usage.free'
};
const mtu: SensorItemResult = {
sensorItemName: 'Mem Total Usage',
sensorItemUnit: '%',
sensorKeyName: 'wmi.mem.usage.total'
};
this.sensorItemResultList.push(ctu);
this.sensorItemResultList.push(cfu);
this.sensorItemResultList.push(mtu);
}
ngOnInit() {
this.eventEditForm = new FormGroup({
'completed': new FormControl()
});
this.selectedStatus = 2;
}
}