Commit c6a367ae authored by kewei.jia's avatar kewei.jia

修改页面 域名跳转 更新 ingress创建服务 默认执行 对应的ingress

parent 1d4ff89b
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
更多操作 更多操作
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item>从线上同步DB</el-dropdown-item> <el-dropdown-item @click.native="syncDb">从线上同步DB</el-dropdown-item>
<el-dropdown-item>从线上同步MQ</el-dropdown-item> <el-dropdown-item @click.native="syncMq">从线上同步MQ</el-dropdown-item>
<el-dropdown-item>清理Redis缓存</el-dropdown-item> <el-dropdown-item @click.native="clearRedis">清理Redis缓存</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="getServiceDetails(scope.row)">详细信息</el-dropdown-item> <el-dropdown-item @click.native="getServiceDetails(scope.row)">详细信息</el-dropdown-item>
<el-dropdown-item>重置服务</el-dropdown-item> <el-dropdown-item @click.native="restartService(scope.row)">重置服务</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<svg-icon icon-class="service"/> <svg-icon icon-class="service"/>
{{ item._id }}服务 {{ item._id }}服务
<div style="float: right"> <div style="float: right">
<el-button type="warning" size="mini" round @click="getRepository(item._id)">新增服务</el-button> <el-button type="warning" size="mini" round @click="getRepository(item._id,item)">新增服务</el-button>
<el-button type="warning" size="mini" round @click="refresh">刷新状态</el-button> <el-button type="warning" size="mini" round @click="refresh">刷新状态</el-button>
</div> </div>
</div> </div>
...@@ -111,12 +111,26 @@ ...@@ -111,12 +111,26 @@
点击 点击
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="getServiceDetails(scope.row)"><svg-icon icon-class="detail"/> <el-dropdown-item @click.native="getServiceDetails(scope.row)">
详细信息</el-dropdown-item> <svg-icon icon-class="detail"/>
<el-dropdown-item @click.native="updateService(scope.row)"><svg-icon icon-class="f5"/>更新服务</el-dropdown-item> 详细信息
<el-dropdown-item @click.native="updateDomain(scope.row)"><svg-icon icon-class="doamin"/>更新域名</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item @click.native="restartService(scope.row)"><svg-icon icon-class="restart"/>重置服务</el-dropdown-item> <el-dropdown-item @click.native="updateService(scope.row)">
<el-dropdown-item style="color: red" @click.native="deleteService(scope.row) "><svg-icon icon-class="delete"/>删除服务</el-dropdown-item> <svg-icon icon-class="f5"/>
更新服务
</el-dropdown-item>
<el-dropdown-item @click.native="updateDomain(scope.row)">
<svg-icon icon-class="doamin"/>
更新域名
</el-dropdown-item>
<el-dropdown-item @click.native="restartService(scope.row)">
<svg-icon icon-class="restart"/>
重置服务
</el-dropdown-item>
<el-dropdown-item style="color: red" @click.native="deleteService(scope.row) ">
<svg-icon icon-class="delete"/>
删除服务
</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
...@@ -217,6 +231,17 @@ ...@@ -217,6 +231,17 @@
<el-button type="primary" @click="centerDialogVisible = false">确 定</el-button> <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogHost" title="更新域名">
<el-form ref="form" :model="form" :rules="rules">
<el-form-item label="域名" prop="host">
<el-input v-model="form.host" autocomplete="off"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="resetForm('form')">取 消</el-button>
<el-button type="primary" @click="submitHost('form')">确 定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -230,7 +255,10 @@ import { ...@@ -230,7 +255,10 @@ import {
modifyCluService, modifyCluService,
fetchServiceInstance, fetchServiceInstance,
deleteClusterService, deleteClusterService,
redeployClusterService redeployClusterService,
flushRedis,
modifyIngressHost,
ingressHost
} from '@/api/docker' } from '@/api/docker'
import JsonEditor from '@/components/JsonEditor' import JsonEditor from '@/components/JsonEditor'
...@@ -252,6 +280,7 @@ export default { ...@@ -252,6 +280,7 @@ export default {
type: '', type: '',
value: null, value: null,
images: null, images: null,
ingressName: null,
dialogVisible: false, dialogVisible: false,
title: '添加服务', title: '添加服务',
formInline: { formInline: {
...@@ -259,7 +288,16 @@ export default { ...@@ -259,7 +288,16 @@ export default {
region: '' region: ''
}, },
updateDialog: false, updateDialog: false,
rename: '' rename: '',
form: {
host: ''
},
rules: {
host: [
{ required: true, message: '请输入更新的域名信息', trigger: 'blur' }
]
},
dialogHost: false
} }
}, },
created() { created() {
...@@ -283,7 +321,7 @@ export default { ...@@ -283,7 +321,7 @@ export default {
type: 'success' type: 'success'
}) })
}, },
getRepository(type) { getRepository(type, item) {
this.type = type this.type = type
this.reponame = '' this.reponame = ''
this.tagName = '' this.tagName = ''
...@@ -293,6 +331,7 @@ export default { ...@@ -293,6 +331,7 @@ export default {
this.options = res.data.data.repoInfo this.options = res.data.data.repoInfo
this.server = res.data.data.server this.server = res.data.data.server
}) })
// fetchHost({ system_name: 'xjd-ui', namespace: this.namespace }).then(res => { console.log(res) })
this.dialogVisible = true this.dialogVisible = true
}, },
getTag() { getTag() {
...@@ -329,8 +368,12 @@ export default { ...@@ -329,8 +368,12 @@ export default {
} }
}) })
}, },
handleDetail() { handleDetail(data) {
alert('暂未开发') ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => {
// console.log(res.data.data.body.spec.rules[0].host)
const url = res.data.data.body.spec.rules[0].host
window.open(`http://${url}/`, '_blank')
})
}, },
getServiceDetails(value) { getServiceDetails(value) {
fetchServiceDetails({ serviceName: value.serviceName, namespace: value.namespace }).then(res => { fetchServiceDetails({ serviceName: value.serviceName, namespace: value.namespace }).then(res => {
...@@ -338,6 +381,30 @@ export default { ...@@ -338,6 +381,30 @@ export default {
this.value = res.data.data.service this.value = res.data.data.service
}) })
}, },
submitHost(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
modifyIngressHost({
namespace: this.namespace,
serviceName: this.ingressName,
host: this.form.host
}).then(res => {
this.$message({
message: '域名更新成功',
type: 'success'
})
this.dialogHost = false
})
} else {
console.log('error submit!!')
return false
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields()
this.dialogHost = false
},
updateService(value) { updateService(value) {
this.tagName = '' this.tagName = ''
this.updateDialog = true this.updateDialog = true
...@@ -387,8 +454,31 @@ export default { ...@@ -387,8 +454,31 @@ export default {
} }
}) })
}, },
updateDomain() { syncDb() {
alert('更新域名') this.$router.push({
path: '/dbsync',
query: { namespace: this.namespace }
})
},
syncMq() {
alert('同步mq')
},
clearRedis() {
flushRedis({ namespace: this.namespace }).then(res => {
this.$message({
message: '清理redis缓存成功',
type: 'success'
})
})
},
updateDomain(data) {
this.dialogHost = true
this.form.host = ''
this.ingressName = data.serviceName
ingressHost({ namespace: data.namespace, serviceName: data.serviceName }).then(res => {
// console.log(res.data.data.body.spec.rules[0].host)
this.form.host = res.data.data.body.spec.rules[0].host
})
}, },
deleteService(data) { deleteService(data) {
this.$confirm('此操作将永久此服务, 是否继续?', '提示', { this.$confirm('此操作将永久此服务, 是否继续?', '提示', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment