2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 import { Component, OnInit } from '@angular/core';
21 import { ActivatedRoute } from '@angular/router';
22 import { DictionaryModel } from '../../model/dictionary.model';
23 import { DictionaryCreationService } from '../dictionary-creation.service';
24 import { DictionaryCreationStore } from '../dictionary-creation.store';
25 import { MetaData } from '../../model/metaData.model';
28 selector: 'app-dictionary-metadata',
29 templateUrl: './dictionary-metadata.component.html',
30 styleUrls: ['./dictionary-metadata.component.css']
32 export class DictionaryMetadataComponent implements OnInit {
33 packageNameAndVersionEnables = true;
35 tags = new Set<string>();
36 metaDataTab: MetaData = new MetaData();
40 private route: ActivatedRoute,
41 private dictionaryCreationService: DictionaryCreationService,
42 private dictionaryCreationStore: DictionaryCreationStore
46 this.dictionaryCreationStore.state$.subscribe(element => {
47 console.log(this.metaDataTab);
48 if (element && element.metaData) {
49 this.metaDataTab = element.metaData;
50 this.metaDataTab.property.entry_schema = element.metaData.property.entry_schema;
51 this.tags = new Set(element.metaData.tags.split(','));
53 this.tags.delete(' ');
55 // console.log(element);
56 // console.log(element.metaData.property['entry_schema']);
63 // this.dictionaryCreationService.getSources().subscribe(res => {
69 this.tags.delete(value);
74 const value = event.target.value;
76 if (value && value.trim().length > 0) {
78 event.target.value = '';
80 this.tags.forEach(val => {
86 saveMetaDataToStore() {
87 console.log(this.metaDataTab);
88 this.dictionaryCreationStore.changeMetaData(this.metaDataTab);