| | |
| | | <!-- <cloud-node :nodes="innerNodes"></cloud-node> -->
|
| | | <net-node :innerNodes="innerNodes"></net-node>
|
| | |
|
| | | <div class="cls-bar">视频分析集群管理</div>
|
| | |
|
| | | <div class="cls-bar">
|
| | | <div class="title">节点状态</div>
|
| | | <div class="input-area">
|
| | | <div class="text" v-show="!isFillingName">
|
| | | {{ ruleForm.state }}
|
| | | </div>
|
| | | <el-switch v-model="masterNode" :disabled="masterNode" style="margin-top:5px" @change="change2Master">
|
| | | </el-switch>
|
| | | </div>
|
| | | </div>
|
| | | <div class="cls-bar">
|
| | | <div class="title">集群名称</div>
|
| | | <div class="input-area">
|
| | |
| | | stopSearching,
|
| | | findCluster,
|
| | | updateClusterName,
|
| | | joinCluster
|
| | | joinCluster,
|
| | | update2Master
|
| | | } from "@/api/clusterManage"
|
| | | // import cloudNode from "../components/CloudNode";
|
| | | import NetNode from "../components/NetNode"
|
| | |
| | | }
|
| | | }
|
| | | return {
|
| | | masterNode: false,
|
| | | innerNodes: [],
|
| | | intervalTimer: null,
|
| | | isFillingName: false,
|
| | |
| | | ruleForm: {
|
| | | clustername: "",
|
| | | clusterpwd: "",
|
| | | virtualIp: ""
|
| | | virtualIp: "",
|
| | | state: "",
|
| | | localId: ""
|
| | | },
|
| | | selfForm: {
|
| | | virtualIp: "",
|
| | |
| | | clusterpwd: ""
|
| | | },
|
| | | isSearch: false,
|
| | | showCurCluster: true,
|
| | | showCurCluster: false,
|
| | | loading: false,
|
| | | joinLoading: false,
|
| | | isHasColony: false,
|
| | |
| | | })
|
| | | },
|
| | | join(formName) {
|
| | | console.log("join", formName)
|
| | | let _this = this
|
| | | _this.joinLoading = true
|
| | | let data = {
|
| | |
| | | password: _this.joinForm.clusterpwd,
|
| | | nodeIps: [_this.joinForm.clusterip]
|
| | | }
|
| | | console.log("body:", data)
|
| | | _this
|
| | | .joinCluster(data)
|
| | | .then(() => {
|
| | |
| | | if (res && res.success) {
|
| | | if (res.data && res.data.clusterId) {
|
| | | this.isHasColony = true
|
| | | this.showCurCluster = true
|
| | | this.clusterid = res.data.clusterId
|
| | | this.ruleForm.clustername = res.data.clusterName
|
| | | this.ruleForm.clusterpwd = "******"
|
| | |
| | | obj.nodeName = i.node_name
|
| | | obj.Address = i.node_ip
|
| | | obj.role = i.drift_state ? i.drift_state : "pc"
|
| | | obj.online = i.online
|
| | |
|
| | | if (obj.id == res.data.localId) {
|
| | | this.ruleForm.state = i.drift_state
|
| | | this.ruleForm.localId = res.data.localId
|
| | | this.masterNode = i.drift_state === "master"
|
| | | }
|
| | | return obj
|
| | | })
|
| | | } else {
|
| | |
| | | },
|
| | | clearInnerNodes() {
|
| | | this.innerNodes = []
|
| | | },
|
| | | async change2Master() {
|
| | | let res = await update2Master({ clusterId: this.clusterid, nodeId: this.ruleForm.localId })
|
| | | if (res && res.success) {
|
| | | this.$message.success("切换成功")
|
| | | this.findCluster()
|
| | | } else {
|
| | | this.$message.warning("切换失败")
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|