rsanchez
2017-03-20 1a0491f2462d2c309bd8e310b22c11019a79ce1e
securis/src/main/webapp/src/app/forms/license.form.component.ts
....@@ -7,7 +7,7 @@
77 import { AfterViewInit, Component, ViewChild } from '@angular/core';
88 import { ActivatedRoute, Router } from '@angular/router';
99
10
-import { TdMediaService, TdFileInputComponent } from '@covalent/core';
10
+import { TdMediaService, TdFileInputComponent, TdDialogService } from '@covalent/core';
1111 import { FormBase, IComboOption } from './base';
1212 import { ToastsManager } from "ng2-toastr/ng2-toastr";
1313
....@@ -20,11 +20,7 @@
2020 export class LicenseFormComponent extends FormBase {
2121
2222 @ViewChild('requestFileUploader') requestFileUploader : TdFileInputComponent;
23
- form_title: string = '';
24
- form_subtitle: string = '';
25
- data: any = {};
2623 pack: any = null;
27
- isNew : boolean = true;
2824
2925 constructor(private http: Http,
3026 private licenses: LicensesService,
....@@ -32,8 +28,9 @@
3228 private packs: PacksService,
3329 toaster: ToastsManager,
3430 route: ActivatedRoute,
35
- $L: LocaleService) {
36
- super($L, route, toaster, licenses, $L.get('license'));
31
+ $L: LocaleService,
32
+ dialogs: TdDialogService) {
33
+ super($L, route, toaster, licenses, $L.get('license'), dialogs);
3734 }
3835
3936 requestFileSelected(file: File) : void {
....@@ -41,7 +38,7 @@
4138 console.log(this.requestFileUploader);
4239 if (!window.FileReader) { // Browser is not
4340 // compatible
44
- console.log(this.$L.get("Open your .req file with a text editor and copy&paste the content in the form text field?"));
41
+ console.log(this.$L.get("Open your .req file with a text editor and copy&paste the content in the form text field"));
4542 return;
4643 }
4744 var reader = new FileReader();
....@@ -54,6 +51,7 @@
5451 this.requestFileUploader.clear();
5552 }
5653
54
+
5755 requestFileUploaded(file: File) : void {
5856 console.log(file);
5957 }
....@@ -82,10 +80,16 @@
8280
8381 this.route.params.subscribe(params => {
8482 var packId = +params['packId']; // (+) converts string 'id' to a number
85
- super.prepareData('licenseId', {
83
+ super.prepareInitialData('licenseId', {
8684 pack_id: packId,
8785 activation_code: this.createActivationCode()
8886 });
87
+ this.packs.get(packId).subscribe(
88
+ packData => {
89
+ this.pack = packData;
90
+ },
91
+ err => console.error(err)
92
+ );
8993 });
9094 }
9195 }