DataLake DB module interface Function modification
[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 import { AdminService } from "src/app/core/services/admin.service";
31
32 @Component({
33   selector: "app-druid",
34   templateUrl: "./druid.component.html",
35   styleUrls: ["./druid.component.css"]
36 })
37 export class DruidComponent {
38   @Output() passEntry: EventEmitter<any> = new EventEmitter();
39   @Input() db: Db;
40   tempDb: Db;
41
42   constructor(
43     public activeModal: NgbActiveModal,
44     public adminService: AdminService
45   ) {}
46
47   ngOnInit() {
48     // cache for display
49     this.tempDb = new Db();
50     const feed = {
51       name: "Druid",
52       enabled: this.db.enabled,
53       host: this.db.host,
54       port: this.db.port,
55       database: this.db.database,
56       encrypt: this.db.encrypt,
57       login: this.db.login,
58       pass: this.db.pass
59     };
60     this.tempDb = feed;
61   }
62
63   passBack() {
64     this.db = this.tempDb;
65     this.passEntry.emit(this.db);
66   }
67 }