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>
</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'">
<ng-content></ng-content>
</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 { PopupPanelComponent } from './popup-panel.component';
@ -28,6 +28,8 @@ export class DropdownPanelComponent {
@ViewChild('popupPanel') popupPanel: PopupPanelComponent;
@Output() cancel = new EventEmitter();
constructor() { }
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 { DomHandler } from 'primeng/primeng';
@ -36,6 +36,8 @@ export class PopupPanelComponent implements OnDestroy {
@Input() baseZIndex = 0;
@Output() cancel = new EventEmitter();
@ViewChild('container') containerViewChild: ElementRef;
readonly popup = true;
@ -129,6 +131,7 @@ export class PopupPanelComponent implements OnDestroy {
if (!this.documentClickListener) {
this.documentClickListener = this.renderer.listen('document', 'click', () => {
if (!this.preventDocumentDefault) {
this.cancel.emit();
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">
<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">
@ -87,7 +87,8 @@
</p-panel>
-->
<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>
<!-- <p-footer>
Footer content here

View File

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