This commit is contained in:
insanity 2018-04-16 12:52:51 +09:00
parent a7f7e34f70
commit 0d17ff7db8
8 changed files with 49 additions and 268 deletions

View File

@ -26,45 +26,28 @@ export class ListComponent implements OnInit, AfterContentInit {
}
ngAfterContentInit() {
this.store.select(AuthSelector.select('domain')).subscribe(
(domain: Domain) => {
this.store.dispatch(new ListStore.ReadAllByDomain(domain));
},
(error) => {
console.log(error);
}
);
// this.store.select(AuthSelector.select('domain')).subscribe(
// (domain: Domain) => {
// this.store.dispatch(new ListStore.ReadAllByDomain(domain));
// },
// (error) => {
// console.log(error);
// }
// );
// this.probes$.subscribe(
// (probes: Probe[]) => {
// console.log(probes);
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
this.probes$.subscribe(
(probes: Probe[]) => {
console.log(probes);
this.probes = probes;
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
}
ngOnInit() {
// Temporary data
this.probes = new Array();
for (let i = 0; i < 10; i++) {
const p: Probe = {
id: i,
createDate: new Date(),
description: 'Description' + i,
displayName: 'DisplayName' + i,
cidr: 'CIDR' + i,
authorizeDate: new Date(),
authorizeMember: {
name: 'MemberName' + i,
},
};
this.probes.push(p);
}
}
ngOnInit() {}
onRowSelect(event) {
this.router.navigate(['probe', event.data.id, 'info']);

View File

@ -6,12 +6,9 @@ import { CrawlerSelectorComponent } from './setting/crawler-selector/crawler-sel
import { CrawlerAuthComponent } from './setting/crawler-auth/crawler-auth.component';
import { SensorItemSelectorComponent } from './setting/sensor-item-selector/sensor-item-selector.component';
import { SettingETCComponent } from './setting/setting-etc/setting-etc.component';
// import { SettingResultComponent } from './setting-result/setting-result.component';
// import { FilterComponent } from './list/filter/filter.component';
// import { ListComponent } from './list/list.component';
// import { DetailComponent } from './detail/detail.component';
// import { TargetSelectorComponent } from './setting/target-selector/target-selector.component';
// import { SettingETCComponent } from './setting/setting-etc/setting-etc.component';
// import { NameTagComponent } from './name-tag/name-tag.component';
export const COMPONENTS = [
@ -21,7 +18,6 @@ export const COMPONENTS = [
CrawlerAuthComponent,
SensorItemSelectorComponent,
SettingETCComponent,
// SettingResultComponent,
ListComponent,
// FilterComponent,
// DetailComponent,

View File

@ -1,90 +0,0 @@
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="center">
<mat-card class="example-card">
<mat-card-content>
<mat-form-field class="example-full-width" fxLayoutAlign="center">
<input matInput placeholder="Name" value="Sensor 000000">
</mat-form-field>
<div class="example-selected-value">주기 : {{selectInterval}} 초</div>
<mat-radio-group class="example-radio-group" [(ngModel)]="selectInterval">
<mat-radio-button class="example-radio-button" *ngFor="let interval of intervals" [value]="interval">
{{interval}} 초
</mat-radio-button>
</mat-radio-group>
</mat-card-content>
</mat-card>
<mat-card class="example-card">
<mat-card-content>
<div>
IP : 192.168.1.209
</div>
<div>
MAC : 1111111111
</div>
<div>
OS : Windows 7
</div>
<div>
WMI Crawler
</div>
</mat-card-content>
</mat-card>
</div>
<div fxLayout="row" fxLayoutWrap fxLayoutAlign="center">
<mat-card class="example-card2">
<mat-card-content>
<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><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>
<mat-form-field class="example-full-width22">
<input matInput placeholder="min" value="">
</mat-form-field>
&nbsp;&nbsp;&nbsp;
<mat-form-field class="example-full-width22">
<input matInput placeholder="max" value="">
</mat-form-field>
&nbsp;&nbsp;&nbsp;
<mat-checkbox>local push</mat-checkbox>
&nbsp;&nbsp;&nbsp;
<mat-checkbox>email</mat-checkbox>
&nbsp;&nbsp;&nbsp;
<mat-checkbox>sms</mat-checkbox>
</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-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,25 +0,0 @@
.example-card {
width: 400px;
}
.example-card2 {
width: 600px;
}
.example-radio-group {
display: inline-flex;
flex-direction: column;
}
.example-radio-button {
margin: 5px;
}
.example-selected-value {
margin: 15px 0;
}
.example-full-width22 {
width: 10%;
}

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingResultComponent } from './setting-result.component';
describe('SettingResultComponent', () => {
let component: SettingResultComponent;
let fixture: ComponentFixture<SettingResultComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingResultComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingResultComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,71 +0,0 @@
import { Component, OnInit } from '@angular/core';
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;
}
@Component({
selector: 'of-sensor-setting-result',
templateUrl: './setting-result.component.html',
styleUrls: ['./setting-result.component.scss']
})
export class SettingResultComponent implements OnInit, AfterContentInit {
selectInterval: string;
sensorItemResultList: Array<SensorItemResult>;
optionList: Array<number>;
constructor() { }
intervals = [
'600',
'400',
'200',
];
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'
};
this.sensorItemResultList.push(ctu);
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

@ -1,23 +1,34 @@
<p-accordion [multiple]="false" [activeIndex]="step" (onOpen)="onTabOpen($event)">
<p-accordionTab header="{{getTitle(0)}}" [disabled]="preTarget">
<of-target-selector [visible]="visible" [preTarget]="preTarget" (targetSelected)="onTargetSelect($event)"></of-target-selector>
</p-accordionTab>
<p-accordionTab header="{{getTitle(1)}}">
<of-crawler-selector [target]="selectedTarget" (crawlerSelected)="onCrawlerSelect($event)"></of-crawler-selector>
</p-accordionTab>
<p-accordionTab header="{{getTitle(2)}}">
<of-crawler-auth [crawler]="selectedCrawler" (credentialPassed)="onCredentialPass($event)"></of-crawler-auth>
</p-accordionTab>
<p-accordionTab header="{{getTitle(3)}}">
<of-sensor-item-selector [target]="selectedTarget" [crawler]="selectedCrawler" (sensorItemsSelected)="onItemsSelect($event)"></of-sensor-item-selector>
</p-accordionTab>
</p-accordion>
<div *ngIf="page === 1; else etc">
<p-accordion [multiple]="false" [activeIndex]="step" (onOpen)="onTabOpen($event)">
<p-accordionTab header="{{getTitle(0)}}" [disabled]="preTarget">
<of-target-selector [visible]="visible" [preTarget]="preTarget" (targetSelected)="onTargetSelect($event)"></of-target-selector>
</p-accordionTab>
<p-accordionTab header="{{getTitle(1)}}">
<of-crawler-selector [target]="selectedTarget" (crawlerSelected)="onCrawlerSelect($event)"></of-crawler-selector>
</p-accordionTab>
<p-accordionTab header="{{getTitle(2)}}">
<of-crawler-auth [crawler]="selectedCrawler" (credentialPassed)="onCredentialPass($event)"></of-crawler-auth>
</p-accordionTab>
<p-accordionTab header="{{getTitle(3)}}">
<of-sensor-item-selector [target]="selectedTarget" [crawler]="selectedCrawler" (sensorItemsSelected)="onItemsSelect($event)"></of-sensor-item-selector>
</p-accordionTab>
</p-accordion>
</div>
<ng-template #etc>
<of-sensor-setting-etc></of-sensor-setting-etc>
</ng-template>
<div>
<button pButton class="ui-button-danger" type="button" label="Cancel" icon="ui-icon-close" (click)="onCancel()"></button>
<button pButton [disabled]="!nextable" type="button" label="Next" icon="fa-check" (click)="onNext()"></button>
<button pButton *ngIf="page === 1" class="ui-button-danger" type="button" label="Cancel" icon="ui-icon-close" (click)="onCancel()"></button>
<button pButton *ngIf="page === 2" class="ui-button-danger" type="button" label="Prev" icon="ui-icon-close" (click)="onPrev()"></button>
<button pButton *ngIf="page === 1" [disabled]="!nextable" type="button" label="Next" icon="fa-check" (click)="onNext()"></button>
<button pButton *ngIf="page === 2" type="button" label="Done" icon="fa-check" (click)="onDone()"></button>
</div>
<!-- <div [hidden]="step !== 1">
<div class="ui-g">
<div class="ui-g-6">

View File

@ -29,6 +29,7 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
selectedSensorDisplayItems: MetaSensorDisplayItem[];
itemNodes: TreeNode[];
step = 0;
page = 1;
sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list')));
@ -75,6 +76,7 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
}
onCancel() {
this.page = 1;
this.step = 0;
this.visible = false;
this.nextable = false;
@ -86,11 +88,11 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
}
onNext() {
this.step += 1;
this.page += 1;
}
onPrev() {
this.step -= 1;
this.page -= 1;
}
onDone() {