Modify framework of front-end
[dcaegen2/services.git] / components / datalake-handler / admin / src / src / app / database / database-list / dbs-modal / druid / druid.component.ts
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : DataLake
4  * ================================================================================
5  * Copyright 2019 QCT
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
21 /**
22  *
23  * @author Ekko Chang
24  *
25  */
26
27 import { Component, Input, Output, EventEmitter } from "@angular/core";
28 import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
29 import { Db } from "src/app/core/models/db.model";
30
31 @Component({
32   selector: "app-druid",
33   templateUrl: "./druid.component.html",
34   styleUrls: ["./druid.component.css"]
35 })
36 export class DruidComponent {
37   @Output() passEntry: EventEmitter<any> = new EventEmitter();
38   @Input() db: Db;
39   tempDb: Db;
40
41   constructor(public activeModal: NgbActiveModal) {}
42
43   ngOnInit() {
44     // cache for display
45     this.tempDb = new Db();
46     const feed = {
47       name: "Druid",
48       enabled: true, // TODO: enable
49       host: this.db.host,
50       port: this.db.port,
51       database: this.db.database,
52       encrypt: this.db.encrypt,
53       login: this.db.login,
54       pass: this.db.pass
55     };
56     this.tempDb = feed;
57   }
58
59   passBack() {
60     this.db = this.tempDb;
61
62     console.log("==================================");
63     console.log("Update db name: " + this.db.name);
64     console.log("Update db enabled: " + this.db.enabled);
65     console.log("Update db host: " + this.db.host);
66     console.log("Update db port: " + this.db.port);
67     console.log("Update db database: " + this.db.database);
68     console.log("Update db encrypt: " + this.db.encrypt);
69     console.log("Update db login: " + this.db.login);
70     console.log("Update db pass: " + this.db.pass);
71     console.log("==================================");
72
73     this.passEntry.emit(this.db);
74   }
75 }