feat: redis支持sentinel

This commit is contained in:
meilin.huang
2022-08-23 18:50:07 +08:00
parent b1ee9b65ff
commit 98a4c92576
9 changed files with 50 additions and 11 deletions

View File

@@ -25,7 +25,7 @@
</div>
</div>
<el-table :data="projects" @current-change="choose" ref="table" style="width: 100%">
<el-table-column label="选择" width="50px">
<el-table-column label="选择" width="55px">
<template #default="scope">
<el-radio v-model="chooseId" :label="scope.row.id">
<i></i>

View File

@@ -17,12 +17,13 @@
<el-select style="width: 100%" v-model="form.mode" placeholder="请选择模式">
<el-option label="standalone" value="standalone"> </el-option>
<el-option label="cluster" value="cluster"> </el-option>
<el-option label="sentinel" value="sentinel"> </el-option>
</el-select>
</el-form-item>
<el-form-item prop="host" label="host:" required>
<el-input
v-model.trim="form.host"
placeholder="请输入host:port,集群模式用','分割"
placeholder="请输入host:portsentinel模式为: mastername=sentinelhost:port若集群或哨兵需设多个节点可使用','分割"
auto-complete="off"
type="textarea"
></el-input>
@@ -113,7 +114,7 @@ export default defineComponent({
id: null,
name: null,
mode: 'standalone',
host: null,
host: '',
password: null,
project: null,
projectId: null,
@@ -219,6 +220,10 @@ export default defineComponent({
redisForm.value.validate(async (valid: boolean) => {
if (valid) {
const reqForm = { ...state.form };
if (reqForm.mode == 'sentinel' && reqForm.host.split('=').length != 2) {
ElMessage.error('sentinel模式host需为: mastername=sentinelhost:sentinelport模式');
return;
}
reqForm.password = await RsaEncrypt(reqForm.password);
redisApi.saveRedis.request(reqForm).then(() => {
ElMessage.success('保存成功');

View File

@@ -31,7 +31,7 @@
<el-table-column prop="creator" label="创建人" min-width="100"></el-table-column>
<el-table-column label="更多" min-width="130" fixed="right">
<template #default="scope">
<el-link v-if="scope.row.mode == 'standalone'" type="primary" @click="info(scope.row)" :underline="false">单机信息</el-link>
<el-link v-if="scope.row.mode == 'standalone' || scope.row.mode == 'sentinel'" type="primary" @click="info(scope.row)" :underline="false">单机信息</el-link>
<el-link @click="onShowClusterInfo(scope.row)" v-if="scope.row.mode == 'cluster'" type="success" :underline="false"
>集群信息</el-link
>