2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   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=========================================================
 
  25  * @contributor Chunmeng Guo
 
  29 import {Component, Input, Output, EventEmitter, ViewChild, ElementRef} from "@angular/core";
 
  30 import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
 
  31 import { Db } from "src/app/core/models/db.model";
 
  32 import { AdminService } from "src/app/core/services/admin.service";
 
  33 import {NgxSpinnerService} from "ngx-spinner";
 
  36   selector: "app-druid",
 
  37   templateUrl: "./druid.component.html",
 
  38   styleUrls: ["./druid.component.css"]
 
  40 export class DruidComponent {
 
  41   @Output() passEntry: EventEmitter<any> = new EventEmitter();
 
  44   @Input() dbList_length;
 
  46   dbTypeIdList: Array<string> = ["DRUID"];
 
  47   @ViewChild("d_dbTypeId") d_dbTypeId: ElementRef;
 
  49   defaultDbType: string;
 
  52     public activeModal: NgbActiveModal,
 
  53     public adminService: AdminService,
 
  54     private spinner: NgxSpinnerService
 
  58     if (this.editDb == null) {
 
  59       this.dbInput = new Db();
 
  63         enabled: this.db.enabled,
 
  66         database: this.db.database,
 
  67         encrypt: this.db.encrypt,
 
  70         dbTypeId: this.db.dbTypeId
 
  73       this.dbInputTitle = "New Druid";
 
  74       console.log("create db");
 
  77       this.dbInput = this.editDb;
 
  78       this.dbInputTitle = "Edit" + "-" + this.editDb.dbTypeId + "-" + this.editDb.name;
 
  79       this.defaultDbType = this.dbInput.dbTypeId;
 
  80       console.log("edit db");
 
  86     if (this.dbInput.name == '' || this.dbInput.name == undefined) {
 
  89     this.editDb = this.dbInput;
 
  90     this.editDb.dbTypeId = this.d_dbTypeId.nativeElement.value;
 
  91     console.log(this.editDb, "db");
 
  92     this.passEntry.emit(this.editDb);