|
|
@@ -14,7 +14,7 @@
|
|
|
<el-option label="mgr" value="mgr" />
|
|
|
<el-option label="agent" value="agent" />
|
|
|
</el-select>
|
|
|
- <el-button size="mini" type="warning" icon="el-icon-files" style="margin-left: 5px" @click="handleAgentConfig">agent 节点配置列表</el-button>
|
|
|
+ <el-button size="mini" type="warning" icon="el-icon-files" style="margin-left: 5px" @click="handleAgentConfig">节点配置列表</el-button>
|
|
|
<el-button size="mini" type="warning" icon="el-icon-refresh" style="margin-left: 5px" @click="getData">刷新</el-button>
|
|
|
<el-button size="mini" type="warning" icon="el-icon-plus" style="margin-left: 5px" @click="handleAdd">添加节点</el-button>
|
|
|
<el-button size="mini" type="warning" icon="el-icon-upload" style="margin-left: 5px" @click="handleUpdate">更新</el-button>
|
|
|
@@ -82,6 +82,7 @@
|
|
|
</el-main>
|
|
|
|
|
|
<el-dialog
|
|
|
+ title="添加节点"
|
|
|
append-to-body
|
|
|
:visible.sync="showAddDialog"
|
|
|
width="50%"
|
|
|
@@ -122,16 +123,30 @@
|
|
|
<el-form-item label="应用目录">
|
|
|
<el-input v-model="addForm.appDir" style="width: 70%; padding-right: 2px" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="queryInfo.nodeType === 'agent'" label="连接的 mgr 地址" style="width: 70%; padding-right: 2px">
|
|
|
- <el-select v-model="addForm.remoteAgentConfig" placeholder="选择 mgr 地址">
|
|
|
- <el-option
|
|
|
- v-for="(item, index) in agentConfigList"
|
|
|
- :key="index"
|
|
|
- :label="item.mgrHost"
|
|
|
- :value="item.id"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
+ <div v-if="queryInfo.nodeType === 'agent'">
|
|
|
+ <el-form-item label="连接的 mgr 地址" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-select v-model="addForm.remoteAgentConfig" placeholder="选择 mgr 地址">
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in agentConfigList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.mgrHost"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <el-form-item label="mgr 配置" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-select v-model="addForm.remoteAgentConfig" placeholder="选择 mgr 配置">
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in agentConfigList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="onAdd">确定</el-button>
|
|
|
</el-form-item>
|
|
|
@@ -139,7 +154,7 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
- title="agent 节点配置列表"
|
|
|
+ title="节点配置列表"
|
|
|
append-to-body
|
|
|
:visible.sync="showAgentConfigDialog"
|
|
|
center
|
|
|
@@ -152,6 +167,14 @@
|
|
|
height="480"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
+ <el-table-column
|
|
|
+ prop="id"
|
|
|
+ label="ID"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="nodeType"
|
|
|
+ label="节点类型"
|
|
|
+ />
|
|
|
<el-table-column
|
|
|
prop="mgrProtocol"
|
|
|
label="协议"
|
|
|
@@ -164,6 +187,10 @@
|
|
|
prop="mgrPort"
|
|
|
label="mgr 端口"
|
|
|
/>
|
|
|
+ <el-table-column
|
|
|
+ prop="mgrConfig"
|
|
|
+ label="mgr 配置"
|
|
|
+ />
|
|
|
<el-table-column
|
|
|
fixed="right"
|
|
|
label="操作"
|
|
|
@@ -182,25 +209,41 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
- title="添加 agent 节点配置"
|
|
|
+ title="添加节点配置"
|
|
|
append-to-body
|
|
|
:visible.sync="addAgentConfigDialog"
|
|
|
center
|
|
|
>
|
|
|
<template>
|
|
|
<el-form :model="configForm" label-width="80px">
|
|
|
- <el-form-item label="mgr 协议" style="width: 70%; padding-right: 2px">
|
|
|
- <el-select v-model="configForm.mgrProtocol" placeholder="选择 websocket 协议">
|
|
|
- <el-option label="ws" value="ws" />
|
|
|
- <el-option label="wss" value="wss" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="mgr 地址" style="width: 70%; padding-right: 2px">
|
|
|
- <el-input v-model="configForm.mgrHost" style="width: 70%; padding-right: 2px" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="mgr 端口" style="width: 70%; padding-right: 2px">
|
|
|
- <el-input v-model="configForm.mgrPort" style="width: 70%; padding-right: 2px" />
|
|
|
+ <el-form-item label="节点类型" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="queryInfo.nodeType" style="width: 70%; padding-right: 2px" />
|
|
|
</el-form-item>
|
|
|
+ <div v-if="queryInfo.nodeType === 'agent'">
|
|
|
+ <el-form-item label="mgr 协议" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-select v-model="configForm.mgrProtocol" placeholder="选择 websocket 协议">
|
|
|
+ <el-option label="ws" value="ws" />
|
|
|
+ <el-option label="wss" value="wss" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="mgr 地址" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="configForm.mgrHost" style="width: 70%; padding-right: 2px" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="mgr 端口" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input v-model="configForm.mgrPort" style="width: 70%; padding-right: 2px" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <el-form-item label="mgr 配置" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input
|
|
|
+ v-model="configForm.mgrConfig"
|
|
|
+ type="textarea"
|
|
|
+ maxlength="10000"
|
|
|
+ :rows="10"
|
|
|
+ style="padding: 5px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="onAgentConfigAdd">确定</el-button>
|
|
|
</el-form-item>
|
|
|
@@ -228,7 +271,18 @@
|
|
|
</el-form>
|
|
|
</span>
|
|
|
<span v-else>
|
|
|
- {{ mgrConfig }}
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="mgr 配置" style="width: 70%; padding-right: 2px">
|
|
|
+ <el-input
|
|
|
+ v-model="configForm.mgrConfig"
|
|
|
+ type="textarea"
|
|
|
+ maxlength="10000"
|
|
|
+ :rows="10"
|
|
|
+ style="padding: 5px"
|
|
|
+ readonly
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
@@ -240,7 +294,7 @@ import {
|
|
|
addAgentConfig,
|
|
|
addRemoteHost, deleteAgentConfig,
|
|
|
deleteRemoteHost,
|
|
|
- getAgentConfigList, getMgrCofig,
|
|
|
+ getAgentConfigList,
|
|
|
getRemoteHostList,
|
|
|
updateRemoteApp
|
|
|
} from '@/api/devops'
|
|
|
@@ -271,9 +325,11 @@ export default {
|
|
|
agentConfigList: [],
|
|
|
addAgentConfigDialog: false,
|
|
|
configForm: {
|
|
|
+ nodeType: '',
|
|
|
mgrProtocol: 'ws',
|
|
|
mgrHost: '127.0.0.1',
|
|
|
- mgrPort: 4030
|
|
|
+ mgrPort: 4030,
|
|
|
+ mgrConfig: ''
|
|
|
},
|
|
|
// **********************************************************************
|
|
|
showConfigDialog: false,
|
|
|
@@ -302,20 +358,16 @@ export default {
|
|
|
this.getData()
|
|
|
},
|
|
|
handleAdd() {
|
|
|
- if (this.queryInfo.nodeType === 'agent') {
|
|
|
- getAgentConfigList(this.queryInfo).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.agentConfigList = resp.data
|
|
|
- this.showAddDialog = true
|
|
|
- } else {
|
|
|
- this.$message.warning(resp.msg)
|
|
|
- }
|
|
|
- }).catch(error => {
|
|
|
- this.$message.error(error.message)
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.showAddDialog = true
|
|
|
- }
|
|
|
+ getAgentConfigList(this.queryInfo).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.agentConfigList = resp.data
|
|
|
+ this.showAddDialog = true
|
|
|
+ } else {
|
|
|
+ this.$message.warning(resp.msg)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
},
|
|
|
onAdd() {
|
|
|
this.addForm.nodeType = this.queryInfo.nodeType
|
|
|
@@ -371,10 +423,6 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleAgentConfig() {
|
|
|
- if (this.queryInfo.nodeType === 'mgr') {
|
|
|
- this.$message.warning('mgr 节点无配置可查看')
|
|
|
- return
|
|
|
- }
|
|
|
getAgentConfigList(this.queryInfo).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
this.agentConfigList = resp.data
|
|
|
@@ -390,6 +438,7 @@ export default {
|
|
|
this.addAgentConfigDialog = true
|
|
|
},
|
|
|
onAgentConfigAdd() {
|
|
|
+ this.configForm.nodeType = this.queryInfo.nodeType
|
|
|
addAgentConfig(this.configForm).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
this.handleAgentConfig()
|
|
|
@@ -416,20 +465,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleShowConfig(index, row) {
|
|
|
- if (this.queryInfo.nodeType === 'agent') {
|
|
|
- this.configForm = row.remoteAgentConfig
|
|
|
- } else {
|
|
|
- getMgrCofig().then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.mgrConfig = resp.data
|
|
|
- } else {
|
|
|
- this.$message.warning(resp.msg)
|
|
|
- }
|
|
|
- }).catch(error => {
|
|
|
- this.$message.error(error.message)
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
+ this.configForm = row.remoteAgentConfig
|
|
|
this.title = this.queryInfo.nodeType + ' 节点配置'
|
|
|
this.showConfigDialog = true
|
|
|
}
|