export popup close

This commit is contained in:
insanity 2018-10-24 00:26:00 +09:00
parent 00ad65e00f
commit 6383f1a403
5 changed files with 19 additions and 11 deletions

View File

@ -35,27 +35,27 @@
<p-dialog header="Export as JPEG" [(visible)]="displayExportJPEG" [modal]="true" [responsive]="true" [width]="350"
[minWidth]="200" [minY]="70" [closable]="false">
<app-menu-export-jpeg #exportJPEG></app-menu-export-jpeg>
<app-menu-export-jpeg #exportJPEG (close)="onMenuClosed()"></app-menu-export-jpeg>
<p-footer>
<button type="button" pButton icon="pi pi-check" (click)="exportJPEG.export();" label="Yes"></button>
<button type="button" pButton icon="pi pi-check" (click)="exportJPEG.export()" label="Yes"></button>
<button type="button" pButton icon="pi pi-close" (click)="onMenuClosed()" label="No" class="ui-button-secondary"></button>
</p-footer>
</p-dialog>
<p-dialog header="Export as PNG" [(visible)]="displayExportPNG" [modal]="true" [responsive]="true" [width]="350"
[minWidth]="200" [minY]="70" [closable]="false">
<app-menu-export-png #exportPNG></app-menu-export-png>
<app-menu-export-png #exportPNG (close)="onMenuClosed()"></app-menu-export-png>
<p-footer>
<button type="button" pButton icon="pi pi-check" (click)="exportPNG.export();" label="Yes"></button>
<button type="button" pButton icon="pi pi-check" (click)="exportPNG.export()" label="Yes"></button>
<button type="button" pButton icon="pi pi-close" (click)="onMenuClosed()" label="No" class="ui-button-secondary"></button>
</p-footer>
</p-dialog>
<p-dialog header="Export as SVG" [(visible)]="displayExportSVG" [modal]="true" [responsive]="true" [width]="350"
[minWidth]="200" [minY]="70" [closable]="false">
<app-menu-export-svg #exportSVG></app-menu-export-svg>
<app-menu-export-svg #exportSVG (close)="onMenuClosed()"></app-menu-export-svg>
<p-footer>
<button type="button" pButton icon="pi pi-check" (click)="exportSVG.export();" label="Yes"></button>
<button type="button" pButton icon="pi pi-check" (click)="exportSVG.export()" label="Yes"></button>
<button type="button" pButton icon="pi pi-close" (click)="onMenuClosed()" label="No" class="ui-button-secondary"></button>
</p-footer>
</p-dialog>

View File

@ -91,7 +91,7 @@ export class HostComponent implements OnChanges {
map((pingResult: PingResult) => {
if (pingResult) {
this.pingResult = pingResult;
this.pingResultRaw = pingResult.raw.join('\r\n');
this.pingResultRaw = pingResult.raw.join('\n');
}
this.pingWaiting = false;
}),

View File

@ -1,4 +1,4 @@
import { Component, OnInit, AfterContentInit, OnDestroy, } from '@angular/core';
import { Component, OnInit, AfterContentInit, OnDestroy, Output, EventEmitter, } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { take } from 'rxjs/operators';
@ -15,6 +15,7 @@ const { saveSvgAsPng, svgAsDataUri } = require('save-svg-as-png');
})
export class ExportJPEGComponent implements OnInit, AfterContentInit, OnDestroy {
msgs: Message[] = [];
@Output() close = new EventEmitter();
constructor(
private store: Store<any>,
@ -29,7 +30,7 @@ export class ExportJPEGComponent implements OnInit, AfterContentInit, OnDestroy
}
ngOnDestroy(): void {
this.msgs = [];
}
export() {
@ -54,6 +55,7 @@ export class ExportJPEGComponent implements OnInit, AfterContentInit, OnDestroy
// console.log(`uri: ${uri}`);
// });
saveSvgAsPng(infraDisplayElementRef.nativeElement, 'diagram.jpeg', { backgroundColor: '#ffffff', encoderType: 'image/jpeg' });
this.close.emit();
}),
).subscribe();
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit, AfterContentInit, OnDestroy, } from '@angular/core';
import { Component, OnInit, AfterContentInit, OnDestroy, Output, EventEmitter, } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { take } from 'rxjs/operators';
@ -15,6 +15,7 @@ const { saveSvgAsPng, svgAsDataUri } = require('save-svg-as-png');
})
export class ExportPNGComponent implements OnInit, AfterContentInit, OnDestroy {
msgs: Message[] = [];
@Output() close = new EventEmitter();
constructor(
private store: Store<any>,
@ -54,6 +55,7 @@ export class ExportPNGComponent implements OnInit, AfterContentInit, OnDestroy {
// console.log(`uri: ${uri}`);
// });
saveSvgAsPng(infraDisplayElementRef.nativeElement, 'diagram.png', { backgroundColor: '#ffffff' });
this.close.emit();
}),
).subscribe();
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit, AfterContentInit, OnDestroy, } from '@angular/core';
import { Component, OnInit, AfterContentInit, OnDestroy, Output, EventEmitter, } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { take } from 'rxjs/operators';
@ -15,6 +15,7 @@ const { saveSvgAsPng, svgAsDataUri, download } = require('save-svg-as-png');
})
export class ExportSVGComponent implements OnInit, AfterContentInit, OnDestroy {
msgs: Message[] = [];
@Output() close = new EventEmitter();
constructor(
private store: Store<any>,
@ -53,6 +54,9 @@ export class ExportSVGComponent implements OnInit, AfterContentInit, OnDestroy {
svgAsDataUri(infraDisplayElementRef.nativeElement, { backgroundColor: '#ffffff' }, function (uri) {
download('diagram.svg', uri);
});
this.close.emit();
}),
).subscribe();
}