允许SID使用/
This commit is contained in:
parent
bf4e31397e
commit
87f45787a8
|
@ -40,6 +40,8 @@ def get_service():
|
|||
|
||||
def add_service(module,company,project,env,name,instance):
|
||||
sid = f"{module}/{company}/{project}/{env}@{name}"
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
data = {
|
||||
"id": sid,
|
||||
"name": 'blackbox_exporter',
|
||||
|
|
|
@ -77,6 +77,9 @@ def del_instance(service_id):
|
|||
return {"code": 50000, "data": f"{reg.status_code}【{service_id}】{reg.text}"}
|
||||
|
||||
def add_instance(instance_dict):
|
||||
sid = instance_dict['ID']
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
isMeta = instance_dict['metaInfo']['isMeta']
|
||||
isCheck = instance_dict['checkInfo']['isCheck']
|
||||
address = instance_dict['address']
|
||||
|
@ -112,7 +115,6 @@ def add_instance(instance_dict):
|
|||
print(instance_dict)
|
||||
|
||||
reg = requests.put(f'{consul_url}/agent/service/register', headers=headers, data=json.dumps(instance_dict))
|
||||
sid = instance_dict['ID']
|
||||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{sid}】增加成功!"}
|
||||
else:
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
首页
|
||||
</el-dropdown-item>
|
||||
</router-link>
|
||||
<a target="_blank" href="https://github.com/starsliao/Prometheus">
|
||||
<a target="_blank" href="https://github.com/starsliao/ConsulManager">
|
||||
<el-dropdown-item>GitHub</el-dropdown-item>
|
||||
</a>
|
||||
<el-dropdown-item divided @click.native="logout">
|
||||
|
|
|
@ -112,7 +112,12 @@ export const constantRoutes = [
|
|||
{
|
||||
path: 'https://starsl.cn/static/img/qr.png',
|
||||
meta: { title: '我的公众号', icon: 'el-icon-chat-dot-round' }
|
||||
},
|
||||
{
|
||||
path: 'https://element.eleme.cn',
|
||||
meta: { title: 'Element', icon: 'el-icon-eleme' }
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-alert type="success" center close-text="知道了">
|
||||
<el-link icon="el-icon-warning" type="success" href="https://github.com/starsliao/ConsulManager#%E5%BA%94%E7%94%A8%E5%9C%BA%E6%99%AF%E5%A6%82%E4%BD%95%E4%BC%98%E9%9B%85%E7%9A%84%E4%BD%BF%E7%94%A8consul%E7%AE%A1%E7%90%86blackbox%E7%AB%99%E7%82%B9%E7%9B%91%E6%8E%A7" target="_blank">应用场景:如何优雅的使用Consul管理Blackbox站点监控</el-link>
|
||||
</el-alert>
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.module" placeholder="监控类型" clearable collapse-tags style="width: 150px" class="filter-item">
|
||||
<el-option v-for="item in module_list" :key="item" :label="item" :value="item" />
|
||||
|
@ -156,7 +159,7 @@ export default {
|
|||
data() {
|
||||
const validateInput = (rule, value, callback) => {
|
||||
if (!this.checkSpecialKey(value)) {
|
||||
callback(new Error('不能含有空格或 [ ]`~!#$^&*=|"{}\':;/?'))
|
||||
callback(new Error('不能含有空格或 [ ]`~!#$^&*=|"{}\':;?'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
|
@ -264,7 +267,7 @@ export default {
|
|||
this.multipleSelection = val
|
||||
},
|
||||
checkSpecialKey(str) {
|
||||
const specialKey = '[]`~!#$^&*=|{}\'":;/? '
|
||||
const specialKey = '[]`~!#$^&*=|{}\'":;? '
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
if (specialKey.indexOf(str.substr(i, 1)) !== -1) {
|
||||
return false
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-alert v-if="services_name === 'blackbox_exporter'" title="如需管理【blackbox_exporter】的监控实例,建议使用左侧菜单【Blackbox 站点监控】来维护,更加方便直观。" type="success" center close-text="知道了" />
|
||||
<el-select v-model="services_name" placeholder="请选择 Services" filterable collapse-tags style="width: 250px" class="filter-item" @change="fetchData(services_name)">
|
||||
<el-option v-for="item in services_name_list" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
|
@ -194,7 +195,7 @@ export default {
|
|||
data() {
|
||||
const validateInput = (rule, value, callback) => {
|
||||
if (!this.checkSpecialKey(value)) {
|
||||
callback(new Error('不能含有空格或 [ ]`~!#$^&*=|"{}\':;/?'))
|
||||
callback(new Error('不能含有空格或 [ ]`~!#$^&*=|"{}\':;?'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
|
@ -295,7 +296,7 @@ export default {
|
|||
this.inputValue = ''
|
||||
},
|
||||
checkSpecialKey(str) {
|
||||
const specialKey = '[]`~!#$^&*=|{}\'":;/? '
|
||||
const specialKey = '[]`~!#$^&*=|{}\'":;? '
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
if (specialKey.indexOf(str.substr(i, 1)) !== -1) {
|
||||
return false
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-alert title="如需管理【blackbox_exporter】的监控实例,建议使用左侧菜单【Blackbox 站点监控】来维护,更加方便直观。" type="success" center close-text="知道了" />
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="services"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
</el-form>
|
||||
<div align="center" class="title-container">
|
||||
<span style="font-size:10px" class="title">v0.3.0</span>
|
||||
<span style="font-size:10px" class="title">v0.3.1</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue