César Calvo
2017-03-15 abb9cc75e166c32cfa97244c497e6a69d14ea114
securis/src/main/webapp/src/app/license.list.component.ts
....@@ -1,5 +1,5 @@
11 import { Router } from '@angular/router';
2
-import { MdDialog } from '@angular/material';
2
+import { MdDialog, MdDialogConfig } from '@angular/material';
33 import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
44 import { IPageChangeEvent } from '@covalent/core';
55 import { Component, AfterViewInit } from '@angular/core';
....@@ -22,6 +22,11 @@
2222 pack_id: 18,
2323 request_data: '{"appCode":"CISA","activationCode":"19fa8d30-29cb-4b59-81b5-3837af8204b6","arch":"x86_64","osName":"Mac OS X","macAddresses":["60-03-08-95-AE-D0","B6-2B-33-E9-64-2D"],"crcLogo":"10f6379e0e1c00ebc403160307e3c5d0aba0727c9cae0bf1ac7cd19d84fdc80f"}',
2424 status: 'AC' }
25
+
26
+const DIALOG_OPTIONS : MdDialogConfig = {
27
+ height: '80%', // can be px or %
28
+ width: '45%', // can be px or %
29
+}
2530
2631 @Component({
2732 selector: 'license-list',
....@@ -85,27 +90,22 @@
8590 this.filter();
8691 }
8792
88
- createPack() : void {
89
- var ref = this.dialog.open(LicenseFormComponent, {
90
- height: '50%', // can be px or %
91
- width: '40%', // can be px or %
92
- });
93
+ createLicense() : void {
94
+ let ref = this.dialog.open(LicenseFormComponent, DIALOG_OPTIONS);
95
+
9396 ref.componentInstance.isNew = true;
97
+ ref.componentInstance.data = {};
9498 ref.afterClosed().subscribe(result => {
95
- console.log(result);
9699 this.filter();
97100 });
101
+
98102 }
99103
100104 editLicense(lic: any) : void {
101
- var ref = this.dialog.open(LicenseFormComponent, {
102
- height: '50%', // can be px or %
103
- width: '40%', // can be px or %
104
- });
105
+ let ref = this.dialog.open(LicenseFormComponent, DIALOG_OPTIONS);
105106 ref.componentInstance.isNew = false;
106107 ref.componentInstance.data = lic;
107108 ref.afterClosed().subscribe(result => {
108
- console.log(result);
109109 this.filter();
110110 });
111111 }