1a3484bae9bed8a62a8025e176e1075ad9224030
[ccsdk/cds.git] /
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : CDS
4 * ================================================================================
5 * Copyright (C) 2020 TechMahindra
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 */
20 import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
21 import { Router } from '@angular/router';
22 import { DictionaryCreationStore } from './dictionary-creation.store';
23 import { DictionaryModel } from '../model/dictionary.model';
24 import { Definition } from '../model/definition.model';
25 import { DictionaryMetadataComponent } from './dictionary-metadata/dictionary-metadata.component';
26 import { SourcesTemplateComponent } from './sources-template/sources-template.component';
27
28 @Component({
29   selector: 'app-resource-dictionary-creation',
30   templateUrl: './resource-dictionary-creation.component.html',
31   styleUrls: ['./resource-dictionary-creation.component.css']
32 })
33 export class ResourceDictionaryCreationComponent implements OnInit {
34
35   constructor(private router: Router, private dictionaryCreationStore: DictionaryCreationStore) {
36   }
37
38   modes: object[] = [
39     {name: 'Designer Mode', style: 'mode-icon icon-designer-mode'},
40     {name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode'}
41   ];
42
43   private metaDataTab: DictionaryModel = new DictionaryModel();
44   private definition: Definition = new Definition();
45
46   @ViewChild(DictionaryMetadataComponent, {static: false})
47   private metadataTabComponent: DictionaryMetadataComponent;
48
49   @ViewChild(SourcesTemplateComponent, {static: false})
50   private sourcesTemplateComponent: SourcesTemplateComponent;
51
52   @ViewChild('nameit', {static: true})
53   private elementRef: ElementRef;
54
55   ngOnInit() {
56     this.elementRef.nativeElement.focus();
57     // this.elementRef2.nativeElement.focus();
58   }
59
60   saveDictionaryToStore() {
61     this.dictionaryCreationStore.getSources();
62     this.dictionaryCreationStore.state$.subscribe(dd => {
63       console.log(dd);
64     });
65   }
66
67   test() {
68     this.metadataTabComponent.saveMetaDataToStore();
69     this.sourcesTemplateComponent.saveSorcesDataToStore();
70   }
71
72   goBackToDashBorad() {
73     this.router.navigate(['/resource-dictionary']);
74   }
75
76 }