scan condition apply or cancel

This commit is contained in:
insanity 2018-09-10 17:51:14 +09:00
parent c170301c42
commit 16b37e5061
5 changed files with 21 additions and 11 deletions

View File

@ -2,7 +2,7 @@
<ng-content select="p-header"></ng-content> <ng-content select="p-header"></ng-content>
</div> </div>
<of-p-popupPanel #popupPanel [style]="style" [styleClass]="styleClass" [blockTarget]="blockTarget"> <of-p-popupPanel #popupPanel [style]="style" [styleClass]="styleClass" [blockTarget]="blockTarget" (cancel)="cancel.emit($event)">
<div [ngClass]="'ui-popuppanel-content'"> <div [ngClass]="'ui-popuppanel-content'">
<ng-content></ng-content> <ng-content></ng-content>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Component, Input, ContentChild, ViewChild } from '@angular/core'; import { Component, Input, ContentChild, ViewChild, Output, EventEmitter } from '@angular/core';
import { Header, Footer } from 'primeng/primeng'; import { Header, Footer } from 'primeng/primeng';
import { PopupPanelComponent } from './popup-panel.component'; import { PopupPanelComponent } from './popup-panel.component';
@ -28,6 +28,8 @@ export class DropdownPanelComponent {
@ViewChild('popupPanel') popupPanel: PopupPanelComponent; @ViewChild('popupPanel') popupPanel: PopupPanelComponent;
@Output() cancel = new EventEmitter();
constructor() { } constructor() { }
hide(): void { hide(): void {

View File

@ -1,4 +1,4 @@
import { NgModule, Component, ElementRef, OnDestroy, Input, Renderer2, ViewChild, Inject, forwardRef } from '@angular/core'; import { NgModule, Component, ElementRef, OnDestroy, Input, Renderer2, ViewChild, Inject, forwardRef, Output, EventEmitter } from '@angular/core';
import { trigger, state, style, transition, animate, AnimationEvent } from '@angular/animations'; import { trigger, state, style, transition, animate, AnimationEvent } from '@angular/animations';
import { DomHandler } from 'primeng/primeng'; import { DomHandler } from 'primeng/primeng';
@ -36,6 +36,8 @@ export class PopupPanelComponent implements OnDestroy {
@Input() baseZIndex = 0; @Input() baseZIndex = 0;
@Output() cancel = new EventEmitter();
@ViewChild('container') containerViewChild: ElementRef; @ViewChild('container') containerViewChild: ElementRef;
readonly popup = true; readonly popup = true;
@ -129,6 +131,7 @@ export class PopupPanelComponent implements OnDestroy {
if (!this.documentClickListener) { if (!this.documentClickListener) {
this.documentClickListener = this.renderer.listen('document', 'click', () => { this.documentClickListener = this.renderer.listen('document', 'click', () => {
if (!this.preventDocumentDefault) { if (!this.preventDocumentDefault) {
this.cancel.emit();
this.hide(); this.hide();
} }

View File

@ -1,4 +1,4 @@
<of-p-dropdownPanel #panel [style]="{'width':'400px'}" [headerStyle]="{'width':'300px'}" [blockTarget]="blockTarget"> <of-p-dropdownPanel #panel [style]="{'width':'400px'}" [headerStyle]="{'width':'300px'}" [blockTarget]="blockTarget" (cancel)="setDefault()">
<p-header class="toolbar-button"> <p-header class="toolbar-button">
<button _ngcontent-c1="" class="button-component" type="button"> <button _ngcontent-c1="" class="button-component" type="button">
<!-- <svg _ngcontent-c1="" aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 10 16" width="16px" height="16px"> <!-- <svg _ngcontent-c1="" aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 10 16" width="16px" height="16px">
@ -87,7 +87,8 @@
</p-panel> </p-panel>
--> -->
<div class="ui-g-12"> <div class="ui-g-12">
<button type="button" pButton label="확인" style="float: right;" (click)="done()" [disabled]="portErrMsg || ipErrMsg"></button> <button type="button" pButton label="Reset" style="float: right;" (click)="setDefault()"></button>
<button type="button" pButton label="Apply" style="float: right;" (click)="done()" [disabled]="portErrMsg || ipErrMsg"></button>
</div> </div>
<!-- <p-footer> <!-- <p-footer>
Footer content here Footer content here

View File

@ -33,6 +33,8 @@ export class ScannerSettingDropdownComponent implements OnInit {
ipErrMsg: string; ipErrMsg: string;
portErrMsg: string; portErrMsg: string;
zone: Zone;
constructor( constructor(
private discoveryConfigService: DiscoveryConfigService private discoveryConfigService: DiscoveryConfigService
) { ) {
@ -40,18 +42,18 @@ export class ScannerSettingDropdownComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.discoveryConfigService.zone.subscribe(res => { this.discoveryConfigService.zone.subscribe(res => {
var zone = res as Zone; this.zone = res as Zone;
this.setDefault(zone); this.setDefault();
}); });
} }
setDefault(zone: Zone): void { setDefault(): void {
if (zone === null) { if (this.zone === null) {
return; return;
} }
const cidr = new IPCIDR(zone.network); const cidr = new IPCIDR(this.zone.network);
this.ipType = MetaIPTypeEnum.V4; this.ipType = MetaIPTypeEnum.V4;
this.firstIP = cidr.start(); this.firstIP = cidr.start();
@ -135,13 +137,14 @@ export class ScannerSettingDropdownComponent implements OnInit {
done() { done() {
// TODO: re-validation // TODO: re-validation
this.setSummary(); this.setSummary();
this.panel.hide();
} }
setSummary(): void { setSummary(): void {
this.ipSummary = this.ipType + ' (' + this.firstIP + ' - ' + this.lastIP + ')'; this.ipSummary = this.ipType + ' (' + this.firstIP + ' - ' + this.lastIP + ')';
this.portSummary = this.includePortType.join(','); this.portSummary = this.includePortType.join(',');
this.portSummary += ' (' + this.firstPort + ' - ' + this.lastPort + ')'; this.portSummary += ' (' + this.firstPort + ' - ' + this.lastPort + ')';
this.panel.hide();
this.configDiscoverHost(); this.configDiscoverHost();
} }
@ -160,4 +163,5 @@ export class ScannerSettingDropdownComponent implements OnInit {
} }
this.ready.emit(discoverHost); this.ready.emit(discoverHost);
} }
} }