import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { OverAllService } from "../../overAll/overAll.service";

@Component({
  selector: 'smart-basic-key',
  templateUrl: './basic-key.component.html',
  styles: []
})
export class BasicKeyComponent implements OnInit {
    @Output() keyValue = new EventEmitter<string>();
    isKey = false;
    keyType;  //类型
    keyList:any[]; //键值列表

  constructor( private overAllSer: OverAllService) { }

  ngOnInit() {
      this.keyType = '1';
      this.findList();
  }

  findList(){
      this.overAllSer.zabbixKey(this.keyType).subscribe(
          (res)=>{
              this.keyList = res.data;
          }
      )
  }

  showKeyModal(){
      this.isKey = true;
  }

    handleKeyCancel(){
        this.isKey = false;
    }

    handleKeyOk(){
        this.isKey = false;
    }

    setKey(data){
        this.isKey = false;
        this.keyValue.emit(data.zabbixKey);
    }

}
