From 81c9b1f75b80fade52653243b914ccb2677b4a8f Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 22 三月 2022 18:34:17 +0800
Subject: [PATCH] 禅道bug修复
---
src/pages/settings/views/clusterManagement.vue | 106 +++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 83 insertions(+), 23 deletions(-)
diff --git a/src/pages/settings/views/clusterManagement.vue b/src/pages/settings/views/clusterManagement.vue
index 5115d54..4648e4f 100644
--- a/src/pages/settings/views/clusterManagement.vue
+++ b/src/pages/settings/views/clusterManagement.vue
@@ -206,6 +206,7 @@
</el-form-item>
</el-form>
<div class="clu-list">
+ <!-- :class="pickedNodeI == index ? 'clu-item-active' : ''" -->
<div
class="clu-item"
v-for="(item, index) in members"
@@ -245,20 +246,20 @@
export default {
data() {
const checkPwd = (rule, value, callback) => {
- if (!value) {
+ if (value == "") {
return callback(new Error("瀵嗙爜涓嶈兘涓虹┖"));
}
- setTimeout(() => {
- if (value.length != 6) {
- callback(new Error("瀵嗙爜搴斾负6浣�!"));
- } else {
- callback();
- }
- }, 1000);
+ // setTimeout(() => {
+ if (value.length != 6) {
+ callback(new Error("瀵嗙爜搴斾负6浣�!"));
+ } else {
+ callback();
+ }
+ // }, 1000);
};
const checkID = (rule, value, callback) => {
if (!value) {
- return callback(new Error("瀵嗙爜涓嶈兘涓虹┖"));
+ return callback(new Error("ID涓嶈兘涓虹┖"));
}
};
return {
@@ -302,13 +303,13 @@
clustername: [
{ required: true, message: "璇疯緭鍏ラ泦缇ゅ悕绉�", trigger: "blur" },
],
- clusterpwd: [{ validator: checkPwd, required: true }],
+ clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }],
virtualIp: [{ required: true, validator: isIPv4, trigger: "change" }],
},
joinExistRules: {
clusterid: [{ validator: checkID, trigger: "blur" }],
clusterip: [{ validator: isIPv4, trigger: "blur" }],
- clusterpwd: [{ validator: checkPwd, required: true }],
+ clusterpwd: [{ validator: checkPwd, required: true, trigger: "blur" }],
},
};
},
@@ -328,7 +329,55 @@
},
methods: {
pickNode(index) {
- // this.pickedNodeI=index
+ this.pickedNodeI = index;
+ const node = this.members[index];
+ const h = this.$createElement;
+ // Address: "192.168.20.189:30190"
+ // cluster_id: "5ee1dfa8-e3fb-4d62-8692-388d7632859b"
+ // create_time: ""
+ // id: "DSVAD010120190703"
+ // nodeName: "192.168.20.189:30190"
+ // node_id: "DSVAD010120190703"
+ // role: "pc"
+ this.$msgbox({
+ title: "",
+ message: h(
+ "div",
+ {
+ style:
+ "display: flex; flex-direction: column; justify-content: center; align-items: center;",
+ },
+ [
+ h("span", { class: "icon iconfont warn-icon" }, "\ue71c"),
+ h("span", { class: "warn-title" }, "鍔犲叆闆嗙兢"),
+ h(
+ "span",
+ { class: "warn-dec" },
+ `鎮ㄦ槸鍚﹁鍔犲叆 ${node.Address} 鍚楋紵`
+ ),
+ ]
+ ),
+ showCancelButton: true,
+ showClose: true,
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ customClass: "del-account-message-box",
+ }).then(() => {
+ this.joinLoading = true;
+ let data = {
+ clusterId: node.cluster_id,
+ password: this.joinForm.clusterpwd,
+ nodeIps: [node.Address],
+ };
+ this.joinCluster(data)
+ .then(() => {
+ this.joinLoading = false;
+ this.findCluster();
+ })
+ .catch((e) => {
+ this.joinLoading = false;
+ });
+ });
},
async createCluster(json) {
let res = await createSerfCluster(json);
@@ -379,10 +428,6 @@
this.$refs[formName].validate((valid) => {
if (valid) {
_this.joinLoading = true;
- // let nodeIps = _this.members.map((i) => {
- // return i.Address;
- // });
- debugger;
let data = {
clusterId: _this.joinForm.clusterid,
password: _this.joinForm.clusterpwd,
@@ -517,8 +562,19 @@
cancelButtonText: "鍙栨秷",
customClass: "del-account-message-box",
}).then(
+ // () => {
+ // this.showCurCluster = false;
+ // }
async () => {
- let res = await leave();
+ try {
+ res = await leave();
+ } catch (err) {
+ console.log(err);
+ this.$notify.error({
+ title: "澶辫触",
+ message: err.msg,
+ });
+ }
this.$notify({
title: res.success ? "鎴愬姛" : "澶辫触",
message: res.msg,
@@ -806,7 +862,7 @@
.clu-item {
border-radius: 8px;
height: 40px;
- // cursor: pointer;
+ cursor: pointer;
line-height: 40px;
text-align: left;
padding: 0 20px;
@@ -815,10 +871,14 @@
margin-right: 8px;
}
}
- // .clu-item:hover {
- // background: var(--colorCard);
- // color: #fff;
- // }
+ .clu-item:hover {
+ background: var(--colorCard);
+ color: #fff;
+ }
+ .clu-item-active {
+ background: var(--colorCard);
+ color: #fff;
+ }
}
.el-form-item__content {
line-height: 48px;
@@ -851,7 +911,7 @@
left: 20px;
}
.el-form-item {
- margin-bottom: 10px;
+ margin-bottom: 16px;
.el-input__inner {
background-color: #ffffff;
border: 2px solid transparent;
--
Gitblit v1.8.0