Merge branch 'dev-2.0' of https://git.mesalab.cn/nezha/nezha-fronted into dev-2.0

This commit is contained in:
@changcode
2021-04-27 21:00:11 +08:00
72 changed files with 8388 additions and 2334 deletions

View File

@@ -65,6 +65,7 @@
:sort-orders="['ascending', 'descending']"
:width="`${item.width}`"
class="data-column"
>
<template slot="header">
<span>{{item.label}}</span>
@@ -75,19 +76,19 @@
<span>{{scope.row[item.prop].name}}</span>
</template>
<template v-else-if="item.prop == 'model'">
<span>{{scope.row[item.prop].name}}</span>
<span>{{scope.row[item.prop]?scope.row[item.prop].name : ''}}</span>
</template>
<template v-else-if="item.prop == 'dc'">
<span>{{scope.row[item.prop].name}}</span>
<span>{{scope.row[item.prop]?scope.row[item.prop].name : ''}}</span>
</template>
<template v-else-if="item.prop == 'cabinet'">
<span>{{scope.row[item.prop].name}}</span>
<span>{{scope.row[item.prop]?scope.row[item.prop].name : ''}}</span>
</template>
<template v-else-if="item.prop == 'type'">
<span>{{scope.row[item.prop].name}}</span>
<span>{{scope.row[item.prop]?scope.row[item.prop].name : ''}}</span>
</template>
<template v-else-if="item.prop == 'state'">
<span>{{scope.row[item.prop].name}}</span>
<span>{{scope.row[item.prop]?scope.row[item.prop].name : ''}}</span>
</template>
<span v-else>{{scope.row[item.prop] ? scope.row[item.prop] : ''}}</span>
</template>
@@ -264,7 +265,7 @@ export default {
labelModule: [],
basic_auth: {
username: '',
password: ''
pin: ''
},
bearer_token: ''
},
@@ -754,13 +755,13 @@ export default {
currentModuleCopy: {
immediate: true,
handler (n, o) {
if (n.type && n.type.toLowerCase() == 'snmp') {
this.endpointTableTitle[4].show = false
this.endpointTableTitle[5].show = false
} else {
this.endpointTableTitle[4].show = true
this.endpointTableTitle[5].show = true
}
// if (n.type && n.type.toLowerCase() == 'snmp') {
// this.endpointTableTitle[4].show = false
// this.endpointTableTitle[5].show = false
// } else {
// this.endpointTableTitle[4].show = true
// this.endpointTableTitle[5].show = true
// }
}
}
}
@@ -1130,7 +1131,7 @@ export default {
.add-endpoint{
display: inline-block;
background: #F9F9F9;
border: 1px solid $--primary-border-color;
border: 1px solid #dedede;
border-radius: 2px;
width: 28px;
height: 28px;
@@ -1141,7 +1142,7 @@ export default {
.top-tool-btn{
height: 32px;
width: 32px;
border: 1px solid $--primary-border-color;
border: 1px solid #dedede;
outline: none;
border-radius: 2px;
background-color: #F9F9F9;

View File

@@ -25,16 +25,16 @@
</el-form-item>
<!-- ChartTemplate -->
<el-form-item :label="$t('config.model.ChartTemplate')" prop="ChartTemplate">
<v-selectpage
:data="chartlList"
:tb-columns="ChartSearchShowFields"
:max-select-limit="3"
<v-selectpage
:data="chartlList"
:tb-columns="ChartSearchShowFields"
:max-select-limit="3"
:multiple="true"
title="ChartSearch"
placeholder="Please select item"
key-field="id"
v-model="editModel.chartIds"
show-field="name"
v-model="editModel.chartIds"
show-field="name"
class="form-control"
@values="(data) => {editModel.chartIds = data.map(d => d.id).join(',')}"
></v-selectpage>
@@ -59,7 +59,7 @@ import selectWalk from '../../popBox/selectWalk'
export default {
name: 'modelBox',
components: {
'select-walk': selectWalk,
'select-walk': selectWalk
},
props: {
obj: {
@@ -75,27 +75,27 @@ export default {
},
data () {
return {
editModel: {},
editModel: {},
brandList: [], // brand 列表数据
editModule: {},
editModule: {},
chartlList: [], // chart 列表数据
ChartSearchShowFields: [ // ChartSearch 下拉搜索表头
{title: 'id',data: 'id'},
{title: 'name',data: 'name'},
{title: 'desc',data: 'type'},
{title: 'Description',data: 'Description'}
{ title: 'id', data: 'id' },
{ title: 'name', data: 'name' },
{ title: 'desc', data: 'type' },
{ title: 'Description', data: 'Description' }
],
url: 'asset/model',
brandUrl: 'asset/brand',
rightBox: { model: { show: false } },
roles: [],
rules: {
model: [
{ required: true, message: '必填', trigger: 'blur' }
],
brandId: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
]
model: [
{ required: true, message: '必填', trigger: 'blur' }
],
brandId: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
]
}
}
},
@@ -125,7 +125,7 @@ export default {
this.$refs.modelForm.validate((valid) => {
if (valid) {
if (this.editModel.id) {
console.log(this.editModel);
console.log(this.editModel)
this.$put(this.url, this.editModel).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
@@ -154,7 +154,7 @@ export default {
},
save () {
if (typeof this.editModel.brandId === 'string') { // 判断是否是新增的
this.$post(this.brandUrl, {name: this.editModel.brandId}).then(res => {
this.$post(this.brandUrl, { name: this.editModel.brandId }).then(res => {
if (res.code === 200) { // 新增成功
this.getBrandList().then(res2 => { // 新增成功后重新调用getBrandList刷新brandList
const newBrand = this.brandList.find(b => b.name === this.editModel.brandId) // 取出刚新增的brand对象
@@ -168,10 +168,9 @@ export default {
} else {
this.saveModel()
}
},
selectWalk (walk) {
console.log(walk);
console.log(walk)
if (this.editModule.walk.indexOf(walk) != -1) {
this.editModule.walk.splice(this.editModule.walk.indexOf(walk), 1)
} else {
@@ -191,8 +190,8 @@ export default {
},
/* 获取chart列表数据 */
ChartTemplateList () {
this.$get('visual/panel/chart',{pageSize : -1 , varType : 1, panelId: 0}).then(res => {
console.log(res);
this.$get('visual/panel/chart', { pageSize: -1, varType: 1, panelId: 0 }).then(res => {
console.log(res)
this.chartlList = res.data.list
})
}

View File

@@ -22,11 +22,11 @@
<!--password-->
<el-form-item :label="$t('config.user.pin')" prop="pin">
<el-input id="account-input-password" v-model="editUser.pin" maxlength="16" placeholder=""
show-word-limit size="small" type="password" @blur="passwordBlur"></el-input>
show-word-limit size="small" type="password" @blur="pinBlur"></el-input>
</el-form-item>
<!--passwordChange-->
<el-form-item :label="$t('config.user.confirmPwd')" label-width="200px" prop="pinChange">
<el-input id="account-input-passwordChange" v-model="editUser.pinChange" maxlength="16" placeholder=""
<!--pinChange-->
<el-form-item :label="$t('config.user.confirmPin')" label-width="200px" prop="pinChange">
<el-input id="account-input-pinChange" v-model="editUser.pinChange" maxlength="16" placeholder=""
show-word-limit size="small" type="password"></el-input>
</el-form-item>
<!--email-->
@@ -90,11 +90,11 @@ export default {
},
data () {
const vm = this
const validatePassword = (rule, value, callback) => { // 确认密码的二次校验
const validatePin = (rule, value, callback) => { // 确认密码的二次校验
if (value === '' && this.editUser.pin) {
callback(new Error(this.$t('config.user.inputConfirmPwd')))
callback(new Error(this.$t('config.user.inputConfirmPin')))
} else if (value !== this.editUser.pin) {
callback(new Error(this.$t('config.user.confirmPwdErr')))
callback(new Error(this.$t('config.user.confirmPinErr')))
} else {
callback()
}
@@ -114,7 +114,7 @@ export default {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
pinChange: [
{ validator: validatePassword, trigger: 'blur' },
{ validator: validatePin, trigger: 'blur' },
{ required: true, message: '', trigger: 'blur' }
],
roleIds: [
@@ -129,7 +129,7 @@ export default {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
pinChange: [
{ validator: validatePassword, trigger: 'blur' }
{ validator: validatePin, trigger: 'blur' }
],
roleIds: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
@@ -166,9 +166,9 @@ export default {
this.$emit('close', refresh)
},
/* 密码失去焦点 检验确认密码 */
passwordBlur () {
pinBlur () {
if (this.editUser.pin && this.editUser.pinChange) {
this.$refs.accountForm.validateField('passwordChange')
this.$refs.accountForm.validateField('pinChange')
}
},
getRoles () {

View File

@@ -86,6 +86,7 @@ export default {
data () {
return {
agent2: agent2,
agentPrometheusEnabled: localStorage.getItem('nz-prometheus-federation-enabled'),
rules: {
'dc.name': [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }

View File

@@ -395,10 +395,10 @@ export default {
port: 22,
params: {
user: '',
method: 'password',
password: '',
method: 'pin',
pin: '',
key: '',
keyPassword: ''
keyPin: ''
}
})
} else if (type == 'TELNET') {
@@ -407,9 +407,9 @@ export default {
port: 23,
params: {
user: '',
password: '',
pin: '',
userTip: '',
passwordTip: '',
pinTip: '',
reloginTip: ''
}
})
@@ -422,8 +422,8 @@ export default {
community: 'public',
securityName: '',
securityLevel: '',
password: '',
privPassword: '',
pin: '',
privPin: '',
authProtocol: '',
privProtocol: '',
contextName: ''

View File

@@ -544,10 +544,10 @@ export default {
port: 22,
params: {
user: '',
method: 'password',
password: '',
method: 'pin',
pin: '',
key: '',
passwordKey: ''
pinKey: ''
}
})
} else if (type == 'TELNET') {
@@ -556,9 +556,9 @@ export default {
port: 23,
params: {
user: '',
password: '',
pin: '',
userTip: '',
passwordTip: '',
pinTip: '',
reloginTip: ''
}
})
@@ -571,8 +571,8 @@ export default {
community: 'public',
securityName: '',
securityLevel: '',
password: '',
privPassword: '',
pin: '',
privPin: '',
authProtocol: '',
privProtocol: '',
contextName: ''

View File

@@ -178,7 +178,7 @@ export default {
labelModule: [],
basic_auth: {
username: '',
password: ''
pin: ''
},
bearer_token: ''
},

View File

@@ -84,7 +84,7 @@ export default {
editDc: {},
rules: {
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
state: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }

View File

@@ -117,7 +117,7 @@
</el-form-item>
<!--host-->
<el-form-item :label='$t("project.endpoint.host")' prop="host">
<el-input placeholder="" v-model.number="editEndpoint.configs.host" size="small" id="module-box-input-host"></el-input>
<el-input placeholder="" v-model="editEndpoint.configs.host" size="small" id="module-box-input-host"></el-input>
</el-form-item>
<transition name="el-zoom-in-top">
<div v-show="showAllBasicOption" >
@@ -226,7 +226,7 @@
</el-form-item>
<el-form-item :label='$t("project.endpoint.pin")' prop="authtype" v-if="authType === 1" class="half-form-item">
<el-input placeholder='' v-model.number="editEndpoint.configs.basic_auth.password" size="small" id="module-box-input-password"></el-input>
<el-input placeholder='' v-model.number="editEndpoint.configs.basic_auth.pin" size="small" id="module-box-input-password"></el-input>
</el-form-item>
<!--authtype 2-->
@@ -454,7 +454,7 @@ export default {
params.configs = JSON.stringify(params.configs)
if (this.authType === 2 && !this.editEndpoint.configs.bearer_token) {
this.$message.error("'token' is required")
} else if (this.authType === 1 && !(this.editEndpoint.configs.basic_auth.username && this.editEndpoint.configs.basic_auth.password)) {
} else if (this.authType === 1 && !(this.editEndpoint.configs.basic_auth.username && this.editEndpoint.configs.basic_auth.pin)) {
this.$message.error("'username' and 'password' is required")
} else {
this.authType = 0
@@ -608,7 +608,7 @@ export default {
this.editEndpoint.configs.bearer_token = ''
this.editEndpoint.configs.basic_auth = {
username: '',
password: ''
pin: ''
}
},
copyValue () {
@@ -717,7 +717,7 @@ export default {
if (params.basic_auth && !params.basic_auth.username) {
delete params.basic_auth
}
if (params.basic_auth && !params.basic_auth.password) {
if (params.basic_auth && !params.basic_auth.pin) {
delete params.basic_auth
}
if (params.param && !Object.keys(params.param).length) {

View File

@@ -109,7 +109,7 @@
</el-form-item>
<!--host-->
<el-form-item :label='$t("project.endpoint.host")' prop="host">
<el-input placeholder="" v-model.number="editModule.configs.host" size="small" id="module-box-input-host"></el-input>
<el-input placeholder="" v-model="editModule.configs.host" size="small" id="module-box-input-host"></el-input>
</el-form-item>
<transition name="el-zoom-in-top">
<div v-show="showAllBasicOption" >
@@ -292,10 +292,10 @@ export default {
username: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
password: [
pin: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
priv_password: [
priv_pin: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
max_repetitions: [
@@ -448,7 +448,7 @@ export default {
params.configs = JSON.stringify(params.configs)
if (this.authType === 2 && !this.editModule.configs.bearer_token) {
this.$message.error("'token' is required")
} else if (this.authType === 1 && !(this.editModule.configs.basic_auth.username && this.editModule.configs.basic_auth.password)) {
} else if (this.authType === 1 && !(this.editModule.configs.basic_auth.username && this.editModule.configs.basic_auth.pin)) {
this.$message.error("'username' and 'password' is required")
} else {
this.authType = 0
@@ -588,7 +588,7 @@ export default {
this.editModule.configs.bearer_token = ''
this.editModule.configs.basic_auth = {
username: '',
password: ''
pin: ''
}
},
copyValue () {
@@ -696,7 +696,7 @@ export default {
if (params.basic_auth && !params.basic_auth.username) {
delete params.basic_auth
}
if (params.basic_auth && !params.basic_auth.password) {
if (params.basic_auth && !params.basic_auth.pin) {
delete params.basic_auth
}
if (params.param && !Object.keys(params.param).length) {

View File

@@ -36,101 +36,101 @@
</template>
<script>
export default {
name: "cabinetBox",
props: {
obj: { type: Object },
currentDc: { type: Object }
},
data () {
return {
editCabinet: {},
rules: {
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
uSize: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ type: 'number', min: 1, max: 47, message: this.$t('validate.uSize'), trigger: 'blur' }
]
}
export default {
name: 'cabinetBox',
props: {
obj: { type: Object },
currentDc: { type: Object }
},
data () {
return {
editCabinet: {},
rules: {
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
uSize: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ type: 'number', min: 1, max: 47, message: this.$t('validate.uSize'), trigger: 'blur' }
]
}
}
},
methods: {
clickOutside () {
this.esc(false)
},
methods: {
clickOutside () {
this.esc(false)
},
esc (refresh) {
this.prevent_opt.save = false
this.$emit('close', refresh)
},
save () {
if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true
this.$refs.cabinetForm.validate(valid => {
if (valid) {
this.editCabinet.idcId = this.currentDc.id
if (this.editCabinet.id) {
this.$put('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(res.msg)
}
})
} else {
this.$post('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(res.msg)
}
})
}
esc (refresh) {
this.prevent_opt.save = false
this.$emit('close', refresh)
},
save () {
if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true
this.$refs.cabinetForm.validate(valid => {
if (valid) {
this.editCabinet.idcId = this.currentDc.id
if (this.editCabinet.id) {
this.$put('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(res.msg)
}
})
} else {
this.prevent_opt.save = false
return false
this.$post('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(res.msg)
}
})
}
})
},
del () {
if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true
this.$confirm(this.$t('tip.confirmDelete'), {
confirmButtonText: this.$t('tip.yes'),
cancelButtonText: this.$t('tip.no'),
type: 'warning'
}).then(() => {
this.$delete('/cabinet?ids=' + this.editCabinet.id).then(response => {
this.prevent_opt.save = false
if (response.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(response.msg)
}
})
}).catch(() => {
} else {
this.prevent_opt.save = false
})
}
return false
}
})
},
watch: {
obj: {
deep: true,
immediate: true,
handler: function (n, o) {
if (n) {
this.editCabinet = JSON.parse(JSON.stringify(n))
del () {
if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true
this.$confirm(this.$t('tip.confirmDelete'), {
confirmButtonText: this.$t('tip.yes'),
cancelButtonText: this.$t('tip.no'),
type: 'warning'
}).then(() => {
this.$delete('/cabinet?ids=' + this.editCabinet.id).then(response => {
this.prevent_opt.save = false
if (response.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true)
} else {
this.$message.error(response.msg)
}
})
}).catch(() => {
this.prevent_opt.save = false
})
}
},
watch: {
obj: {
deep: true,
immediate: true,
handler: function (n, o) {
if (n) {
this.editCabinet = JSON.parse(JSON.stringify(n))
}
}
}
}
}
</script>
<style lang="scss">

View File

@@ -61,7 +61,7 @@ export default {
securityLevel: '',
authProtocol: '',
privProtocol: '',
privPassword: ''
privPin: ''
},
configs: [
{
@@ -92,7 +92,7 @@ export default {
securityLevel: '',
authProtocol: '',
privProtocol: '',
privPassword: ''
privPin: ''
},
configs: [
{
@@ -117,7 +117,7 @@ export default {
securityLevel: '',
authProtocol: '',
privProtocol: '',
privPassword: ''
privPin: ''
},
configs: [
{
@@ -240,7 +240,7 @@ export default {
securityLevel: '',
authProtocol: '',
privProtocol: '',
privPassword: ''
privPin: ''
}
}
configs.forEach(item => {
@@ -269,7 +269,7 @@ export default {
securityLevel: '',
authProtocol: '',
privProtocol: '',
privPassword: ''
privPin: ''
},
configs: [
{

View File

@@ -71,7 +71,7 @@
<div class="mib-browser-ad-search-label">{{$t('login.pin')}}</div>
</el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.password" id="traffic-setting-password"></el-input>
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.pin" id="traffic-setting-password"></el-input>
</el-col>
</el-row>
@@ -101,10 +101,10 @@
<el-row class="mib-browser-ad-search-item" v-if="assetSetting.auth.securityLevel == 'authPriv'">
<el-col :span="6">
<div class="mib-browser-ad-search-label">{{$t('project.module.privPassword')}}</div>
<div class="mib-browser-ad-search-label">{{$t('project.module.privPin')}}</div>
</el-col>
<el-col :span="17">
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.privPassword" id="traffic-setting-privPassword"></el-input>
<el-input class="input-x-mini-24" v-model.trim="assetSetting.auth.privPin" id="traffic-setting-privPassword"></el-input>
</el-col>
</el-row>
</template>

View File

@@ -26,11 +26,11 @@
<!--password-->
<el-form-item :label="$t('config.account.pin')" prop="pin">
<el-input id="account-input-password" v-model="editUser.pin" autocomplete="new-password" maxlength="16" placeholder=""
show-word-limit size="small" type="password" @blur="passwordBlur"></el-input>
show-word-limit size="small" type="password" @blur="pinBlur"></el-input>
</el-form-item>
<!--passwordChange-->
<el-form-item :label="$t('config.account.confirmPwd')" label-width="200px" prop="passwordChange">
<el-input id="account-input-passwordChange" v-model="editUser.pinChange" autocomplete="new-password" maxlength="16" placeholder=""
<!--pinChange-->
<el-form-item :label="$t('config.account.confirmPin')" label-width="200px" prop="pinChange">
<el-input id="account-input-pinChange" v-model="editUser.pinChange" autocomplete="new-password" maxlength="16" placeholder=""
show-word-limit size="small" type="password"></el-input>
</el-form-item>
<!--email-->
@@ -109,11 +109,11 @@ export default {
}
},
data () {
const validatePassword = (rule, value, callback) => { // 确认密码的二次校验
const validatepin = (rule, value, callback) => { // 确认密码的二次校验
if (value === '' && this.editUser.pin) {
callback(new Error(this.$t('config.account.inputConfirmPwd')))
callback(new Error(this.$t('config.account.inputConfirmPin')))
} else if (value !== this.editUser.pin) {
callback(new Error(this.$t('config.account.confirmPwdErr')))
callback(new Error(this.$t('config.account.confirmPinErr')))
} else {
callback()
}
@@ -128,7 +128,7 @@ export default {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
pinChange: [
{ validator: validatePassword, trigger: 'blur' },
{ validator: validatepin, trigger: 'blur' },
{ required: true, message: '', trigger: 'blur' }
],
roleIds: [
@@ -143,7 +143,7 @@ export default {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
pinChange: [
{ validator: validatePassword, trigger: 'blur' }
{ validator: validatepin, trigger: 'blur' }
],
roleIds: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
@@ -228,9 +228,9 @@ export default {
})
},
/* 密码失去焦点 检验确认密码 */
passwordBlur () {
pinBlur () {
if (this.editUser.pin && this.editUser.pinChange) {
this.$refs.accountForm.validateField('passwordChange')
this.$refs.accountForm.validateField('pinChange')
}
},
getScripts () {