<template>
  <el-dialog v-dialogDrag style="font-size: 10px;" width='650px'
     @close="close"
     @opened="createSDNCInit"
     :title="$t('SDNCDeviceDialog.controllerManagementDeviceList')"
     :visible.sync="dialog_showDemoList">

    <el-table
      header-row-class-name="table-header"
      cell-class-name="table-cell"
      ref="singleTable"
      :data="serverShowList"
      height="250"
      highlight-current-row
      stripe
      tooltip-effect="dark"
    >
      <el-table-column
        prop="deviceName"
        :label="$t('SDNCDeviceDialog.deviceName')"
        align="center"
        :show-overflow-tooltip="true"
        width="200"
        style="font-size: 10px;">
      </el-table-column>
      <el-table-column
        width="200"
        :show-overflow-tooltip="true"
        prop="uuid"
        align="center"
        :label="$t('SDNCDeviceDialog.UUID')">
      </el-table-column>
      <el-table-column
        width="200"
        :show-overflow-tooltip="true"
        prop="ipAddress"
        align="center"
        :label="$t('SDNCDeviceDialog.deviceIP')">
      </el-table-column>

    </el-table>
  </el-dialog>

</template>

<script>
    import ServerService from "../../../domain/services/ServerService";

    export default {
      name: "SDNCDeviceDialog",
      props: ['command'],
      data:function(){
        return {
          dialog_showDemoList:false,
          serverObj: this.command.target,
          serverShowList:[],

        }
      },

      methods:{
        createSDNCInit:function(){
          let _this=this;
          ServerService.getDevicesUnderServer(_this.serverObj.serverKey).then(result=>{
            _this.serverShowList=Object.values(result);
          }).catch(err=>{
          });
        },

        close:function(){
          this.command.done();
        },
      },

      mounted() {
        this.dialog_showDemoList = true;
      },


    }
</script>

<style scoped>

</style>
