sensor config popup is in progress

This commit is contained in:
insanity 2018-04-12 21:13:19 +09:00
parent 59be65ca67
commit 3d80b212d2
14 changed files with 140 additions and 295 deletions

View File

@ -5,6 +5,7 @@ import { TargetSelectorComponent } from './setting/target-selector/target-select
import { CrawlerSelectorComponent } from './setting/crawler-selector/crawler-selector.component';
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';
@ -19,10 +20,11 @@ export const COMPONENTS = [
CrawlerSelectorComponent,
CrawlerAuthComponent,
SensorItemSelectorComponent,
// SettingResultComponent,
SettingETCComponent,
// SettingResultComponent,
ListComponent,
// FilterComponent,
// DetailComponent,
// SettingETCComponent,
// NameTagComponent,
// FilterComponent,
// DetailComponent,
// SettingETCComponent,
// NameTagComponent,
];

View File

@ -1,9 +1,11 @@
<div>
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false">
<of-sensor-setting [selectedTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
<of-sensor-setting [isAllTarget]="isAllTarget" [selectedTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog>
<button type="button" label="Add Sensor" icon="ui-icon-add" pButton (click)="onAddSensor()"></button>
<button type="button" label="Add Sensor with Target" icon="ui-icon-add" pButton (click)="onAddSensorWithTarget()"></button>
<button type="button" label="Add Sensor with Target2" icon="ui-icon-add" pButton (click)="onAddSensorWithTarget2()"></button>
</div>
<div>sensor list</div>

View File

@ -28,6 +28,7 @@ export class ListComponent implements OnInit, AfterContentInit {
sensorSettingDisplay = false;
target: Target = null;
isAllTarget = false;
constructor(private router: Router,
private store: Store<ListStore.State>,
@ -44,14 +45,6 @@ export class ListComponent implements OnInit, AfterContentInit {
// console.log(error.response.message);
// }
// );
// Test
// this.target = {
// id: 1,
// createDate: new Date(),
// displayName: 'Alredy selected target',
// description: 'Desc..',
// };
}
ngAfterContentInit() {
@ -81,11 +74,32 @@ export class ListComponent implements OnInit, AfterContentInit {
}
onAddSensor() {
this.isAllTarget = true;
this.sensorSettingDisplay = true;
}
onAddSensorWithTarget() {
this.isAllTarget = false;
this.target = {
id: 1,
createDate: new Date(),
displayName: 'Alredy selected target111',
description: 'Desc..',
};
this.sensorSettingDisplay = true;
}
onAddSensorWithTarget2() {
this.isAllTarget = false;
this.target = {
id: 2,
createDate: new Date(),
displayName: 'Alredy selected target222',
description: 'Desc..',
};
this.sensorSettingDisplay = true;
}
onSensorSettingClose() {
this.sensorSettingDisplay = false;
}
}

View File

@ -1,6 +1,5 @@
<p-panel header="{{title}}">
<div class="ui-g" style="height: 180px; overflow: auto">
<div *ngIf="crawler; else info" class="ui-g" style="height: 180px; overflow: auto">
<div class="ui-g-12" *ngFor="let item of inputItems">
<span class="md-inputfield">
<input id="name" type="text" pInputText />
@ -8,6 +7,10 @@
</span>
</div>
</div>
<ng-template #info>
<div>개발자의 배려가 돋보이는 친절한 안내 메시지</div>
</ng-template>
<button *ngIf="crawler" type="button" label="Test" icon="ui-icon-send" pButton (click)="testCredentials()"></button>
</p-panel>

View File

@ -1,31 +1,16 @@
<p-orderList [value]="crawlers" [listStyle]="{'height':'200px'}" [responsive]="true" header="2. Choose a Crawler" filterBy="name"
(onSelectionChange)="onSelectionChange($event)">
<ng-template let-crawler pTemplate="item">
<div class="ui-helper-clearfix">
<div style="font-size:14px;float:right;margin:15px 5px 0 0">{{crawler.name}}</div>
</div>
</ng-template>
</p-orderList>
<div *ngIf="target; else info">
<p-orderList [value]="crawlers" [listStyle]="{'height':'200px'}" [responsive]="true" header="2. Choose a Crawler" filterBy="name"
(onSelectionChange)="onSelectionChange($event)">
<ng-template let-crawler pTemplate="item">
<div class="ui-helper-clearfix">
<div style="font-size:14px;float:right;margin:15px 5px 0 0">{{crawler.name}}</div>
</div>
</ng-template>
</p-orderList>
</div>
<!-- <div>
<mat-card>
<mat-card-header>
<mat-card-title>Step 2</mat-card-title>
<mat-card-subtitle>Crawler 선택</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<perfect-scrollbar style="height: 150px">
<mat-radio-group class="radio-group">
<mat-radio-button class="radio-button" *ngFor="let crawler of crawlers" value={{crawler.id}} (change)="crawlerSelected(crawler)" [checked]="crawler.id === selectedCrawlerId">
{{crawler.name}}
</mat-radio-button>
</mat-radio-group>
</perfect-scrollbar>
</mat-card-content>
</mat-card>
</div> -->
<ng-template #info>
<p-panel header="2. Choose a Crawler">
<div>개발자의 배려가 돋보이는 친절한 안내 메시지</div>
</p-panel>
</ng-template>

View File

@ -1,41 +1,10 @@
<p-panel header="4. Choose sensor items">
<div class="ui-g" style="height: 200px; overflow: auto">
<div *ngIf="crawler && target; else info" class="ui-g" style="height: 200px; overflow: auto">
<p-tree [value]="itemTreeNode" selectionMode="checkbox" [(selection)]="selectedItems" (onNodeSelect)="onNodeSelect($event)"
(onNodeUnselect)="onNodeUnselect($event)"></p-tree>
</div>
</p-panel>
<!-- <div>
<mat-card>
<mat-card-header>
<mat-card-title>Step 4</mat-card-title>
<mat-card-subtitle>Select Sensor Items</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<perfect-scrollbar style="height: 150px">
<tree-root #tree [focused]="true" [nodes]="nodes" (updateData)="onTreeDataLoad($event)">
<ng-template #treeNodeFullTemplate let-node let-index="index" let-templates="templates">
<div class="tree-node">
<tree-node-expander [node]="node" ></tree-node-expander>
<mat-checkbox [checked]="node.isActive" (change)="checkItem(node)"></mat-checkbox>
<div
class="node-content-wrapper"
[class.node-content-wrapper-active]="node.isActive"
[class.node-content-wrapper-focused]="node.isFocused"
(click)="checkItem(node)">
<mat-chip *ngIf="node.data.default" color="primary" (click)="checkItem(node)" >Recommend!</mat-chip>
<span [class]="node.data.className" [class.title]="true">{{ node.data.title }} {{node.data.key}}</span>
</div>
<tree-node-children [node]="node" [templates]="templates"></tree-node-children>
</div>
</ng-template>
</tree-root>
</perfect-scrollbar>
</mat-card-content>
</mat-card>
</div> -->
<ng-template #info>
<div>개발자의 배려가 돋보이는 친절한 안내 메시지</div>
</ng-template>
</p-panel>

View File

@ -1,56 +1,3 @@
<div>
<mat-grid-list cols="2" rowHeight="5:1">
<mat-grid-tile [colspan]="1" [rowspan]="2" style="background-color: lightblue">
<div>
<div>
<mat-form-field hintLabel="Max 15 characters">
<input matInput #input maxlength="15" placeholder="Sensor Alias">
<mat-hint align="end">{{input.value?.length || 0}}/15</mat-hint>
</mat-form-field>
</div>
<div>
<div>Interval</div>
<mat-radio-group class="radio-group" [(ngModel)]="interval">
<mat-radio-button class="radio-button" *ngFor="let interval of intervals" [value]="interval">
{{interval}}
</mat-radio-button>
</mat-radio-group>
</div>
</div>
</mat-grid-tile>
<mat-grid-tile [colspan]="1" [rowspan]="2" style="background-color: lightcoral">
<of-info-table [data]="targetInfo"></of-info-table>
</mat-grid-tile>
<mat-grid-tile [colspan]="2" [rowspan]="3" style="background-color: lightpink">
<!-- (change)="handleNotificationOn(item)" -->
<mat-list #items style="width: 70%">
<mat-list-item *ngFor="let item of selectedItems">
<h4 mat-line>{{item.displayName}}</h4>
<mat-slide-toggle [(ngModel)]="notiOn">[Notification]</mat-slide-toggle>
<!-- <p mat-line> {{item.key}} </p> -->
<h4 mat-line>
<!-- <div *ngIf="opened.indexOf(item.id) >= 0"> -->
<div *ngIf="notiOn">
<form>
<mat-form-field>
<input matInput placeholder="Min" value="">
</mat-form-field>
~
<mat-form-field>
<input matInput placeholder="Max" value="">
</mat-form-field>
</form>
</div>
</h4>
</mat-list-item>
</mat-list>
</mat-grid-tile>
</mat-grid-list>
page 2222222
</div>

View File

@ -1,9 +0,0 @@
.radio-group {
display: inline-flex;
flex-direction: column;
}
.radio-button {
margin: 5px;
}

View File

@ -1,62 +1,32 @@
// import { Component, OnInit, Input } from '@angular/core';
// import { Router } from '@angular/router';
// import { MetaCrawler } from 'packages/meta/crawler/model/MetaCrawler';
// import { MetaSensorDisplayItem } from '../../../../meta/sensor-display-item/model/MetaSensorDisplayItem';
// import { Target } from 'packages/target/model';
// import { MatSnackBar } from '@angular/material';
import { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router';
import { MetaCrawler } from 'packages/meta/crawler/model/MetaCrawler';
import { MetaSensorDisplayItem } from '../../../../meta/sensor-display-item/model/MetaSensorDisplayItem';
import { Target } from 'packages/target/model';
// @Component({
// selector: 'of-sensor-setting-etc',
// templateUrl: './setting-etc.component.html',
// styleUrls: ['./setting-etc.component.scss']
// })
// export class SettingETCComponent implements OnInit {
@Component({
selector: 'of-sensor-setting-etc',
templateUrl: './setting-etc.component.html',
})
export class SettingETCComponent implements OnInit {
// @Input() selectedTarget: Target;
// @Input() selectedCrawler: MetaCrawler;
// @Input() selectedItems: MetaSensorDisplayItem[];
@Input() selectedTarget: Target;
@Input() selectedCrawler: MetaCrawler;
@Input() selectedItems: MetaSensorDisplayItem[];
// intervals = [
// '600 sec',
// '400 sec',
// '200 sec',
// ];
intervals = [
'600 sec',
'400 sec',
'200 sec',
];
// targetInfo;
// opened = [];
// constructor(
// private router: Router,
// private snackBar: MatSnackBar
// ) { }
constructor(
private router: Router,
) { }
// ngOnInit() {
// this.targetInfo = [
// {
// key: 'IP',
// value: 'todo',
// },
// {
// key: 'Mac Address',
// value: 'todo',
// },
// {
// key: 'OS',
// value: 'todo',
// },
// {
// key: 'Crawler',
// value: this.selectedCrawler ? this.selectedCrawler.name : '',
// },
// ];
// }
ngOnInit() {
}
// onChange(e: any) {
// this.opened = e;
// }
// handleTitleClick(e: Event) {
// e.preventDefault();
// }
// }
}

View File

@ -1,19 +1,28 @@
<div class="ui-g">
<div class="ui-g-6">
<of-target-selector [target]="selectedTarget" (targetSelected)="onTargetSelect($event)"></of-target-selector>
</div>
<div class="ui-g-6">
<of-crawler-auth [crawler]="selectedCrawler" (credentialPassed)="onCredentialPass($event)"></of-crawler-auth>
</div>
<div class="ui-g-6">
<of-crawler-selector [target]="selectedTarget" (crawlerSelected)="onCrawlerSelect($event)"></of-crawler-selector>
</div>
<div class="ui-g-6">
<of-sensor-item-selector [target]="selectedTarget" [crawler]="selectedCrawler" (sensorItemsSelected)="onItemsSelect($event)"></of-sensor-item-selector>
<div [hidden]="step !== 1">
<div class="ui-g">
<div class="ui-g-6">
<of-target-selector [target]="selectedTarget" (targetSelected)="onTargetSelect($event)" [isAllTarget]="isAllTarget"></of-target-selector>
</div>
<div class="ui-g-6">
<of-crawler-auth [crawler]="selectedCrawler" (credentialPassed)="onCredentialPass($event)"></of-crawler-auth>
</div>
<div class="ui-g-6">
<of-crawler-selector [target]="selectedTarget" (crawlerSelected)="onCrawlerSelect($event)"></of-crawler-selector>
</div>
<div class="ui-g-6">
<of-sensor-item-selector [target]="selectedTarget" [crawler]="selectedCrawler" (sensorItemsSelected)="onItemsSelect($event)"></of-sensor-item-selector>
</div>
</div>
</div>
<div *ngIf="step === 2">
<of-sensor-setting-etc [selectedTarget]="selectedTarget" [selectedCrawler]="selectedCrawler" [selectedItems]="selectedSensorDisplayItems"></of-sensor-setting-etc>
</div>
<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="step === 1" class="ui-button-danger" type="button" label="Cancel" icon="ui-icon-close" (click)="onCancel()"></button>
<button pButton *ngIf="step === 2" class="ui-button-danger" type="button" label="Prev" icon="ui-icon-close" (click)="onPrev()"></button>
<button pButton *ngIf="step === 1" [disabled]="!nextable" type="button" label="Next" icon="fa-check" (click)="onNext()"></button>
<button pButton *ngIf="step === 2" type="button" label="Done" icon="fa-check" (click)="onDone()"></button>
</div>

View File

@ -1,26 +0,0 @@
.ui-steps .ui-steps-item {
width: 25%;
}
.ui-steps.steps-custom {
margin-bottom: 30px;
}
.ui-steps.steps-custom .ui-steps-item .ui-menuitem-link {
height: 10px;
padding: 0 1em;
}
.ui-steps.steps-custom .ui-steps-item .ui-steps-number {
background-color: #0081c2;
color: #FFFFFF;
display: inline-block;
width: 36px;
border-radius: 50%;
margin-top: -14px;
margin-bottom: 10px;
}
.ui-steps.steps-custom .ui-steps-item .ui-steps-title {
color: #555555;
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, Inject, DoCheck, ViewEncapsulation, Output, EventEmitter, OnDestroy } from '@angular/core';
import { Component, OnInit, Input, Inject, DoCheck, ViewEncapsulation, Output, EventEmitter, OnDestroy, OnChanges } from '@angular/core';
import { Target } from 'packages/target/model';
import { Infra } from 'packages/infra/model';
import { MetaCrawler } from 'packages/meta/crawler/model/MetaCrawler';
@ -16,18 +16,18 @@ import { TreeNode } from 'primeng/primeng';
templateUrl: './setting.component.html',
encapsulation: ViewEncapsulation.None
})
export class SettingComponent implements OnInit, DoCheck {
export class SettingComponent implements OnInit, DoCheck, OnChanges {
@Input() isAllTarget: boolean;
@Input() selectedTarget: Target;
@Output() close = new EventEmitter();
nextable = false;
sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list')));
@Input() selectedTarget: Target;
selectedCrawler: MetaCrawler;
credentialPassed: boolean;
selectedSensorDisplayItems: MetaSensorDisplayItem[];
itemNodes: TreeNode[];
step = 1;
constructor(
private keyListStore: Store<SensorItemKeyListStore.State>,
@ -47,6 +47,9 @@ export class SettingComponent implements OnInit, DoCheck {
// );
}
ngOnChanges() {
}
ngDoCheck() {
try {
if (
@ -60,18 +63,24 @@ export class SettingComponent implements OnInit, DoCheck {
} else {
this.nextable = true;
}
} catch (exception) {}
} catch (exception) {
this.nextable = false;
}
}
onCancel() {
this.selectedTarget = null;
this.selectedCrawler = null;
this.credentialPassed = false;
this.selectedSensorDisplayItems = null;
this.close.emit();
}
onNext() {
this.step += 1;
}
onPrev() {
this.step -= 1;
}
onDone() {
this.selectedSensorDisplayItems = [];
for (const node of this.itemNodes) {
if (node.data && node.data !== undefined) {

View File

@ -1,44 +1,9 @@
<div>
<p-orderList [value]="targets" [listStyle]="{'height':'200px'}" [responsive]="true" header="1. Choose a target" filterBy="displayName"
(onSelectionChange)="onSelectionChange($event)">
<ng-template let-target pTemplate="item">
<div class="ui-helper-clearfix">
<img src="assets/demo/images/car/BMW.gif" style="display:inline-block;margin:2px 0 2px 2px" />
<div style="font-size:14px;float:right;margin:15px 5px 0 0">{{target.displayName}}</div>
</div>
</ng-template>
</p-orderList>
</div>
<!-- <div *ngIf="target">
<p-panel header="1. Target">
<div>
{{target.displayName}}
<p-orderList [value]="targets" [listStyle]="{'height':'200px'}" [responsive]="true" header="1. Choose a target" filterBy="displayName"
(onSelectionChange)="onSelectionChange($event)">
<ng-template let-target pTemplate="item">
<div class="ui-helper-clearfix">
<img src="assets/demo/images/car/BMW.gif" style="display:inline-block;margin:2px 0 2px 2px" />
<div style="font-size:14px;float:right;margin:15px 5px 0 0">{{target.displayName}}</div>
</div>
<div>
{{target.description}}
</div>
</p-panel>
</div> -->
<!-- <div style="width:100%">
<mat-card>
<mat-card-header>
<mat-card-title>Step 1</mat-card-title>
<mat-card-subtitle>Select Target</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<perfect-scrollbar style="height: 150px">
<mat-radio-group class="radio-group" >
<mat-radio-button class="radio-button" *ngFor="let t of targets" value={{t.id}} (change)="targetSelected(t)" [checked]="targets.length === 1 && t.id === target.id">
{{t.displayName}}
</mat-radio-button>
</mat-radio-group>
</perfect-scrollbar>
</mat-card-content>
</mat-card>
</div> -->
</ng-template>
</p-orderList>

View File

@ -19,6 +19,7 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
targets$ = this.store.pipe(select(ListSelector.select('page')));
@Input() target: Target = null;
@Input() isAllTarget: boolean;
@Output() targetSelected = new EventEmitter<Target>();
targets: Target[] = null;
@ -33,7 +34,6 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
this.getTargetList();
} else {
this.targets.push(this.target);
this.targetSelected.emit(this.target);
}
// this.targets$.subscribe(
@ -49,7 +49,12 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
}
ngOnChanges() {
this.targets = new Array();
if (this.isAllTarget) {
this.getTargetList();
} else {
this.targets.push(this.target);
}
}
convertInfraToTarget(page: Page) {