Commit d54f6e50 authored by derong.zhang's avatar derong.zhang

ip设置

parent 358b4e6d
......@@ -19,6 +19,7 @@ module.exports = {
'prettier/prettier': 'error',
// 防止iview的标签报错
'vue/no-parsing-error': [2, { 'x-invalid-end-tag': false }],
'prettier/prettier': 0,
},
}
import axios from '../services/http.service'
import {
sapi
} from '../config'
import qs from 'qs'
let comapi = '/heimdallr-config'
import axios from "../services/http.service";
import { sapi } from "../config";
// import qs from "qs";
// 获取服务列表
export function getservicelist () {
return axios.get(`${sapi}/service/list`)
export function getservicelist() {
return axios.get(`${sapi}/service/list`);
}
// 获取文字说明
export function getkey (key) {
return axios.get(`${sapi}/get-key-explain/${key}`)
export function getkey(key) {
return axios.get(`${sapi}/get-key-explain/${key}`);
}
// 获取配置列表
export function getconfigurelist (data) {
return axios.get(`${sapi}/config/service/${data.key}/${data.service_name}`)
export function getconfigurelist(data) {
return axios.get(`${sapi}/config/service/${data.key}/${data.service_name}`);
}
// 发布
export function postconfigurelist (data, params) {
return axios.post(`${sapi}/config/service/${data.key}/${data.service_name}`, params, {headers: {
'Content-Type': 'application/json'
}})
export function postconfigurelist(data, params) {
return axios.post(
`${sapi}/config/service/${data.key}/${data.service_name}`,
params,
{
headers: {
"Content-Type": "application/json"
}
}
);
}
// 获取版本
export function getVersionnumber (data) {
return axios.get(`${sapi}/config-version/service/${data.key}/${data.service_name}/list`)
export function getVersionnumber(data) {
return axios.get(
`${sapi}/config-version/service/${data.key}/${data.service_name}/list`
);
}
// 回滚版本
export function rollbacknum (data) {
return axios.get(`${sapi}/config-version/service/${data.key}/${data.service_name}/set/${data.version}`)
export function rollbacknum(data) {
return axios.get(
`${sapi}/config-version/service/${data.key}/${data.service_name}/set/${data.version}`
);
}
// 获取节点列表
export function getnodelist (data) {
return axios.get(`${sapi}/node/list/${data.service_name}`)
export function getnodelist(data) {
return axios.get(`${sapi}/node/list/${data.service_name}`);
}
// 获取节点配置
export function getnodeconfig (data) {
return axios.get(`${sapi}/config/node/${data.service_name}/${data.node_id}`)
export function getnodeconfig(data) {
return axios.get(`${sapi}/config/node/${data.service_name}/${data.node_id}`);
}
// 设置节点配置
export function nodeconfig (data, weight) {
return axios.post(`${sapi}/config/node/${data.service_name}/${data.node_id}`, weight, {headers: {
'Content-Type': 'application/json'
}})
export function nodeconfig(data, weight) {
return axios.post(
`${sapi}/config/node/${data.service_name}/${data.node_id}`,
weight,
{
headers: {
"Content-Type": "application/json"
}
}
);
}
// 获取菜单列表
export function getMenuList() {
return axios.get(`${sapi}/key/list`);
}
// 获取标签列表
export function getTypeList() {
return axios.get(`${sapi}/filter/list`);
}
const sapi = "https://kapi-fe.liangkebang.net";
const sapi = "https://kapi-arch.liangkebang.net";
// const sapi = 'http://192.168.29.88:5555'
export { sapi };
......@@ -14,12 +14,7 @@
</div>
<div class="content_header_list">
<div class="header_list_left">
<p class="list_content" @click="authenticationlist('url_auth_list')" :class="{'colorlistone':listonecolorauth}">鉴权URL列表</p>
<p class="list_content" @click="foreignlist('url_white_list')" :class="{'colorlistone':listonecolorfor}">对外URL列表</p>
<p class="list_content" @click="internallylist('url_black_list')" :class="{'colorlistone':listonecolorint}">对内URL列表</p>
<p class="list_content" @click="domainnameprefixlist('domain_prefix')" :class="{'colorlistone':listonecolordoma}">域名前缀列表</p>
<p class="list_content" @click="serviceAdministrator('service_owner')" :class="{'colorlistone':listonecolorserv}">服务管理员列表</p>
<p class="list_content" @click="testmo('test_mode')" :class="{'colorlistone':listonecolortest}">测试模式</p>
<p class="list_content" v-for="(item, index) in menu" :key="index" :class="{'colorlistone':index==colorIndex}" @click="authenticationlist(item.Key,index)"> {{item.Value}}</p>
</div>
<div class="header_list_right">
<div class="list_right_header">
......@@ -27,9 +22,9 @@
<span class="textExplain" v-html="textExplain"></span>
</div>
<div class="list_right_content">
<p class="right_content_btn">
<div class="right_content_btn">
<Button type="primary" size = 'small' @click="configlist" :class="{'colorlistcolor':colorupdata}">发布</Button>
</p>
</div>
<p>
<Button type="primary" size = 'small' @click="rollback">回滚</Button>
</p>
......@@ -37,19 +32,19 @@
</div>
<div class="list_right_configure">
<div class="configure_content" v-show="isShowList">
<p class="configure_content_configure">
<div class="configure_content_configure">
<span><Input v-model="singlebaraddition" placeholder="请输入配置项" style="width: 65%;margin-top:1%;float:left;margin-left:2%" @keyup.enter.native='oneadd'/></span>
<Button type="primary" size = 'small' style="margin:1.2% 0 0 1%;float:left" @click="oneadd">单条添加</Button>
<span style="float:right;margin:1.2% 2% 0% 1%">
<Button type="primary" size = 'small' @click="clear">清空</Button>
<Button type="primary" size = 'small' @click="alladd">批量添加</Button>
</span>
</p>
</div>
<p class="configure_content_page">
<Table :data='logData' :columns='logCol' border ></Table>
</p>
</div>
<div class="configure_content_test" v-show="isShowList == false">
<div class="configure_content_test" v-show="showTestModal">
<p class="test_content">
<span style="margin-left:20px">状态:
<span class="test_conten_status" v-if="testmostatus === true">开启</span>
......@@ -60,6 +55,51 @@
</span>
</p>
</div>
<div class="ipSet" v-show="showIpSet">
<div style="float:right">
<Button type="primary" size = 'small' @click="clear">清空</Button>
<Button type="primary" size = 'small' @click="addIpset">添加</Button>
</div>
<div style="float:left;margin:10px 0">
<Table :data='ipsetData' :columns='ipsetCol' border ></Table>
</div>
</div>
<div class="urlIpSet" v-show="showUrlIpSet">
<div style="float:right">
<Button type="primary" size = 'small' @click="clear">清空</Button>
<Button type="primary" size = 'small' @click="addUrlIpset">添加</Button>
</div>
<div style="float:left;margin:10px 0">
<Table :data='urlIpSetData' :columns='urlIpSetCol' border ></Table>
</div>
</div>
<div class="urlIpSet" v-show="showLimit">
<div style="float:right">
<Button type="primary" size = 'small' @click="clear">清空</Button>
<Button type="primary" size = 'small' @click="addLimit">添加</Button>
</div>
<div style="float:left;margin:10px 0">
<Table :data='limitData' :columns='limitCol' border ></Table>
</div>
</div>
<div class="urlIpSet" v-show="showSpecified">
<div style="float:right">
<Button type="primary" size = 'small' @click="clear">清空</Button>
<Button type="primary" size = 'small' @click="addSpecified">添加</Button>
</div>
<div style="float:left;margin:10px 0">
<Table :data='specifiedData' :columns='specifiedCol' border ></Table>
</div>
</div>
<div class="urlIpSet" v-show="showElse">
<div style="float:right">
<Button type="primary" size = 'small' @click="modify">修改</Button>
<Button type="primary" size = 'small' @click="reduction">还原</Button>
</div>
<div style="float:left;margin:10px 0;border-top:1px solid #999;width:100%;height:100%">
{{origenContent}}
</div>
</div>
</div>
</div>
</div>
......@@ -73,6 +113,77 @@
</div>
</div>
</div>
<Modal v-model="addIpsetModal" :mask-closable = 'false' :footer-hide='true'>
<Form ref="formInline" :model="formInline" :rules="ruleInline" style="margin-top:20px" :label-width="80">
<FormItem prop="alladdcontent" label="名称:">
<Input v-model="ipsetName" type="text" placeholder="请输入名称" style="width: 70%" />
</FormItem>
<FormItem prop="alladdcontent" label="列表:">
<Input v-model="ipsetContent" type="text" placeholder="请输入名称" style="width: 70%" />
</FormItem>
</Form>
<div class="alladdbtn">
<Button type="primary" size='large' style="margin:0 20px" @click="addIpsetModal = false">取消</Button>
<Button type="primary" size='large' @click="confireIpset">保存</Button>
</div>
</Modal>
<Modal v-model="addUrlIpsetModal" :mask-closable = 'false' :footer-hide='true'>
<Form ref="formInline" :model="formInline" :rules="ruleInline" style="margin-top:20px" :label-width="80">
<FormItem prop="alladdcontent" label="路径:">
<Input v-model="urlIpsetPath" type="text" placeholder="请输入名称" style="width: 70%" />
</FormItem>
<FormItem prop="alladdcontent" label="集合:">
<Select v-model="urlIpsetName" style="width:70%" @on-change="selectserver">
<Option v-for="item in ipsetList" :value="item" :key="item">{{ item }}</Option>
</Select>
</FormItem>
</Form>
<div class="alladdbtn">
<Button type="primary" size='large' style="margin:0 20px" @click="addUrlIpsetModal = false">取消</Button>
<Button type="primary" size='large' @click="confireUrlSet">保存</Button>
</div>
</Modal>
<Modal v-model="addLimitModal" :mask-closable = 'false' :footer-hide='true'>
<Form ref="formInline" :model="formInline" :rules="ruleInline" style="margin-top:20px" :label-width="80">
<FormItem prop="alladdcontent" label="路径:">
<Input v-model="limitPath" type="text" placeholder="请输入路径" style="width: 70%" />
</FormItem>
<FormItem prop="alladdcontent" label="单位时间:">
<Input v-model="limitTime" type="text" placeholder="请输入单位时间" style="width: 70%" />
</FormItem>
<FormItem prop="alladdcontent" label="速率:">
<Input v-model="limitRate" type="text" placeholder="请输入速率" style="width: 70%" />
</FormItem>
</Form>
<div class="alladdbtn">
<Button type="primary" size='large' style="margin:0 20px" @click="addLimitModal = false">取消</Button>
<Button type="primary" size='large' @click="confireLimit">保存</Button>
</div>
</Modal>
<Modal v-model="addSpecifiedModal" :mask-closable = 'false' :footer-hide='true'>
<Form ref="formInline" :model="formInline" :rules="ruleInline" style="margin-top:20px" :label-width="80">
<FormItem prop="alladdcontent" label="类型:">
<Select v-model="err_type" style="width:70%" @on-change="selectserver">
<Option v-for="(item, index) in typeList" :value="item.value" :key="index">{{ item.value }}</Option>
</Select>
</FormItem>
<FormItem prop="alladdcontent" label="标签:">
<Select v-model="err_tag" style="width:70%" @on-change="selectserver">
<Option v-for="(item, index) in tageList" :value="item" :key="index">{{ item }}</Option>
</Select>
</FormItem>
<FormItem prop="alladdcontent" label="首部:">
<Input v-model="header" type="text" placeholder="请输入速率" style="width: 70%" />
</FormItem>
<FormItem prop="alladdcontent" label="主体:">
<Input v-model="body" type="text" placeholder="请输入速率" style="width: 70%" />
</FormItem>
</Form>
<div class="alladdbtn">
<Button type="primary" size='large' style="margin:0 20px" @click="addSpecifiedModal = false">取消</Button>
<Button type="primary" size='large' @click="confireSpecified">保存</Button>
</div>
</Modal>
<Modal v-model="alladdModal" :mask-closable = 'false' :footer-hide='true'>
<h2 class="alladdtitle">批量添加</h2>
<Form ref="formInline" :model="formInline" :rules="ruleInline" style="margin-top:20px" :label-width="80">
......@@ -106,6 +217,29 @@
<Button type="primary" size='small' @click="confiredelate">确认</Button>
</div>
</Modal>
<Modal v-model="modifyModal" :mask-closable = 'false' :footer-hide='true' width='300'>
<div style="padding-top:40px">
<Input v-model="updataOrigenContent" type="textarea" clearable style="width: 90%"/>
</div>
<div class="rollbackdivbtn">
<Button type="primary" size='small' style="margin:0 20px" @click="modifyModal = false">取消</Button>
<Button type="primary" size='small' @click="conforeModify">确认</Button>
</div>
</Modal>
<Modal v-model="clearModal" :mask-closable = 'false' :footer-hide='true' width='300'>
<h3 class="delatediv">是否确认清空该列表?</h3>
<div class="rollbackdivbtn">
<Button type="primary" size='small' style="margin:0 20px" @click="clearModal = false">取消</Button>
<Button type="primary" size='small' @click="confireClear">确认</Button>
</div>
</Modal>
<Modal v-model="delateIpModal" :mask-closable = 'false' :footer-hide='true' width='300'>
<h3 class="delatediv">是否确认删除该选项?</h3>
<div class="rollbackdivbtn">
<Button type="primary" size='small' style="margin:0 20px" @click="delateIpModal = false">取消</Button>
<Button type="primary" size='small' @click="confierDelateOne">确认</Button>
</div>
</Modal>
<Modal v-model="changeserverModal" :mask-closable = 'false' :footer-hide='true' width='300'>
<h3 class="delatediv">有尚未发布的配置,是否确认切换服务?切换会导致未发布的配置丢失。</h3>
<div class="rollbackdivbtn">
......@@ -169,6 +303,36 @@
<Button type="primary" size='small' @click="confirfabu">发布</Button>
</div>
</Modal>
<Modal v-model="elseConfireModal" :mask-closable = 'false' :footer-hide='true' width='500'>
<h3 class="updatediv">是否确认发布?</h3>
<div class="updatetestclass">
<p>
<span>原配置:{{netModily}}</span>
</p>
<p>
<span>新配置:{{origenContent}}</span>
</p>
</div>
<div class="rollbackdivbtn">
<Button type="primary" size='small' style="margin:0 20px" @click="elseConfireModal = false">取消</Button>
<Button type="primary" size='small' @click="confirfabu">发布</Button>
</div>
</Modal>
<Modal v-model="contrastIpset" :mask-closable = 'false' :footer-hide='true' width='500'>
<h3 class="updatediv">是否确认发布?</h3>
<div class="updatetestclass">
<p>
<span>原配置:{{needModilyArr}}</span>
</p>
<p>
<span>新配置:{{newIpsetData}}</span>
</p>
</div>
<div class="rollbackdivbtn">
<Button type="primary" size='small' style="margin:0 20px" @click="contrastIpset = false">取消</Button>
<Button type="primary" size='small' @click="confirfabu">发布</Button>
</div>
</Modal>
<Modal v-model="ContrasttestModal" :mask-closable = 'false' :footer-hide='true' width='500'>
<h3 class="updatediv">是否确认发布?</h3>
<div class="updatetestclass">
......@@ -202,11 +366,279 @@
</div>
</template>
<script>
import {getservicelist, getkey, getconfigurelist, postconfigurelist, getVersionnumber, rollbacknum, getnodelist, nodeconfig} from '../../api/mainconfigguration.server'
import {getservicelist, getkey, getTypeList, getconfigurelist, postconfigurelist, getVersionnumber, rollbacknum, getnodelist, nodeconfig, getMenuList} from '../../api/mainconfigguration.server'
export default {
data () {
return {
menu: [],
colorIndex: '',
changeIndex: '',
addIpsetModal: false,
elseConfireModal: false,
addUrlIpsetModal: false,
addSpecifiedModal: false,
addLimitModal: false,
showSpecified: false,
showElse: false,
contrastIpset: false,
updataIpsetSta: false,
updataUrlSta: false,
updataLimitSta: false,
updataSpecifiedSta: false,
delateIpModal: false,
ipsetName: '',
header: '',
err_type: '',
err_tag: '',
body: '',
origenContent: '显示原始值',
urlIpsetPath: '',
urlIpsetName: '',
ipsetContent: '',
typeList: [
{
key: 'pre',
value: 'pre',
},{
key: 'proxy',
value: 'proxy',
},{
key: 'post',
value: 'post',
}
],
limitPath: '',
limitRate: null,
limitTime: null,
tageList: [],
ipsetList: [],
ipsetData: [],
ipsetCol:[
{
title: '名称',
key: 'name',
align: 'center'
},
{
title: 'ip列表',
key: 'ip_list',
align: 'center'
},
{
title: '操作',
key: 'action',
// width: 200,
align: 'center',
render: (h, params) => {
let arr = [h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.updateIpset(params.row)
}
}
}, '修改'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.delateOne(params.row)
}
}
}, '删除')]
return h('div', arr)
}
}
],
clearModal: false,
updataOrigenContent: '',
urlIpSetData: [],
urlIpSetCol: [
{
title: '路径',
key: 'path',
align: 'center'
},
{
title: '集合',
key: 'ip_set_name',
align: 'center'
},
{
title: '操作',
key: 'action',
width: 200,
align: 'center',
render: (h, params) => {
let arr = [h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.updateUrlIpset(params.row)
}
}
}, '修改'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.delateOne(params.row)
}
}
}, '删除')]
return h('div', arr)
}
}
],
limitData: [],
limitCol: [
{
title: '路径',
key: 'path',
align: 'center'
},
{
title: '单位时间(秒)',
key: 'duration',
align: 'center'
},
{
title: '速录',
key: 'rate',
align: 'center'
},
{
title: '操作',
key: 'action',
width: 200,
align: 'center',
render: (h, params) => {
let arr = [h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.updateLimit(params.row)
}
}
}, '修改'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.delateOne(params.row)
}
}
}, '删除')]
return h('div', arr)
}
}
],
specifiedData: [],
specifiedCol: [
{
title: '类型',
key: 'err_type',
align: 'center'
},
{
title: '标签',
key: 'err_tag',
align: 'center'
},
{
title: '首部',
key: 'header',
align: 'center'
},
{
title: '主体',
key: 'body',
align: 'center'
},
{
title: '操作',
key: 'action',
width: 200,
align: 'center',
render: (h, params) => {
let arr = [h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.updateSpecified(params.row)
}
}
}, '修改'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '10px'
},
on: {
click: () => {
this.delateOne(params.row)
}
}
}, '删除')]
return h('div', arr)
}
}
],
server: '',
needModilyArr: [],
delateindex: null,
modifyModal: false,
origenIpsetList: [],
newIpsetData: [],
showIpSet: false,
showUrlIpSet: false,
showLimit: false,
showTestModal: false,
isShowList: true,
alladdModal: false,
listonecolorauth: true,
......@@ -233,6 +665,7 @@ export default {
changeserverModal: false,
ContrasttestModal: false,
ContrastnodeModal: false,
netModily: '',
aftertestmostatuorigen: false,
opentest: false,
closetest: false,
......@@ -270,7 +703,7 @@ export default {
{
title: '配置',
key: 'sort',
align: 'center'
align: 'left'
},
{
title: '操作',
......@@ -323,7 +756,7 @@ export default {
key: 'Status',
align: 'center',
render: (h, params) => {
return h('div', params.row.Status == 'passing' ? 'up' : 'down')
return h('div', params.row.Status === 'passing' ? 'up' : 'down')
}
},
{
......@@ -379,41 +812,6 @@ export default {
}
},
methods: {
testmo (key) {
this.changekey = key
if (this.colorupdata === true) {
this.changedivModal = true
return
}
this.contrastlist = []
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = true
this.isShowList = false
this.colorupdatacolor = false
this.colorupdata = false
this.key = key
this.testdiv = true
this.getkeytext(key)
let data = {
key: key,
service_name: this.server
}
getconfigurelist(data).then(data => {
this.testmostatus = data.body
this.aftertestmostatuorigen = data.body
if (data.body === true) {
this.opentest = true
this.closetest = false
} else {
this.closetest = true
this.opentest = false
}
})
},
opentestradio (data) {
this.closetest = !this.closetest
this.aftertestmostatus = true
......@@ -427,120 +825,122 @@ export default {
this.testmostatus = this.aftertestmostatus
this.colorupdata = true
this.colorupdatacolor = true
this.origenselectserver = this.server
},
serviceAdministrator (key) {
this.changekey = key
if (this.colorupdata === true) {
this.changedivModal = true
return
}
this.contrastlist = []
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = true
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.colorupdata = false
this.isShowList = true
this.testdiv = false
this.key = key
this.logData = []
this.getkeytext(key)
this.getconfigurlist(key, this.server)
this.origenselectserver = this.server
},
domainnameprefixlist (key) {
authenticationlist (key,Tindex) {
this.changeIndex = Tindex;
this.changekey = key
if (this.colorupdata === true) {
this.changedivModal = true
return
}
this.contrastlist = []
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = true
this.listonecolortest = false
this.colorupdatacolor = false
this.colorupdata = false
this.isShowList = true
this.contrastlist = [];
this.origenIpsetList = [];
this.colorIndex = Tindex;
if (key === 'url_auth_list' || key === 'url_white_list' || key === 'url_black_list' || key === 'domain_prefix' || key === 'service_owner') {
this.testdiv = false
this.key = key
this.logData = []
this.getkeytext(key)
this.getconfigurlist(key, this.server)
},
internallylist (key) {
this.changekey = key
if (this.colorupdata === true) {
this.changedivModal = true
return
}
this.contrastlist = []
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = true
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.colorupdata = false
this.isShowList = true
this.testdiv = false
this.showSpecified = false;
this.showLimit = false;
this.showIpSet =false;
this.showUrlIpSet = false;
}
if (key === 'test_mode') {
this.key = key
this.logData = []
this.getkeytext(key)
this.getconfigurlist(key, this.server)
},
foreignlist (key) {
this.changekey = key
if (this.colorupdata === true) {
this.changedivModal = true
return
let data = {
key: key,
service_name: this.server
}
this.contrastlist = []
this.listonecolorauth = false
this.listonecolorfor = true
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.colorupdata = false
this.isShowList = true
this.testdiv = false
getconfigurelist(data).then(data => {
this.testmostatus = data.body
this.aftertestmostatuorigen = data.body
if (data.body === true) {
this.opentest = true
this.closetest = false
} else {
this.closetest = true
this.opentest = false
}
})
this.showTestModal = true
this.isShowList = false
this.showSpecified = false;
this.showIpSet =false;
this.showUrlIpSet = false;
this.testdiv = true
this.showLimit = false;
}
if (key === 'ip_set_v2') {
this.key = key
this.logData = []
this.getkeytext(key)
this.getconfigurlist(key, this.server)
},
authenticationlist (key) {
this.changekey = key
if (this.colorupdata === true) {
this.changedivModal = true
return
this.isShowList = false;
this.showIpSet = true;
this.showTestModal = false;
this.showUrlIpSet = false;
this.showLimit = false;
this.showSpecified = false;
this.getkeytext(key);
this.getList(key, this.server);
}
this.contrastlist = []
this.listonecolorauth = true
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.colorupdata = false
this.isShowList = true
this.testdiv = false
if (key === 'url_ip_set_v2') {
this.isShowList = false;
this.showIpSet = false;
this.showUrlIpSet = true;
this.showTestModal = false;
this.showLimit = false;
this.showLimit = false;
this.showSpecified = false;
this.key = key
this.logData = []
this.getkeytext(key)
this.getconfigurlist(key, this.server)
this.getkeytext(key);
this.getList(key, this.server);
}
if (key === 'limit') {
this.isShowList = false;
this.showIpSet = false;
this.showUrlIpSet = false;
this.showTestModal = false;
this.showLimit = true;
this.showSpecified = false;
this.showElse = false;
this.getkeytext(key);
this.key = key
this.getList(key, this.server);
}
if (key === 'specified_values') {
this.isShowList = false;
this.showIpSet = false;
this.showUrlIpSet = false;
this.showTestModal = false;
this.showLimit = false;
this.showElse = false;
this.showSpecified = true;
this.key = key
this.getkeytext(key);
this.getList(key, this.server);
}
let arr = ['specified_values', 'limit', 'url_ip_set_v2',
'ip_set_v2', 'test_mode','url_auth_list','url_white_list','url_black_list', 'domain_prefix','service_owner'];
let keys = arr.some(function(item){
return item === key;
})
if (!keys) {
this.showElse = true
this.isShowList = false;
this.showIpSet = false;
this.showUrlIpSet = false;
this.showTestModal = false;
this.showLimit = false;
this.showSpecified = false;
this.key = key
this.getkeytext(key);
this.getList(key, this.server);
}
},
oneadd () {
if (this.singlebaraddition == '') {
if (this.singlebaraddition === '') {
this.$Message.error('请先输入要添加的内容')
return
}
......@@ -555,14 +955,14 @@ export default {
this.alladdModal = true
},
alladdconfire () {
if (this.formInline.alladdcontent == '') {
if (this.formInline.alladdcontent === '') {
this.$Message.error('请先输入要添加的内容')
return
}
let str = this.formInline.alladdcontent.replace(/\[|]/g, '')
str = str.replace(/\n/g, '')
str = str.replace(/\"/g, '')
str = str.replace(/\'/g, '')
str = str.replace(/\"/g, '') // eslint-disable-line no-useless-escape
str = str.replace(/\'/g, '') // eslint-disable-line no-useless-escape
let arr = str.split(',')
this.logparamsarr = arr
arr.map(item => {
......@@ -578,13 +978,31 @@ export default {
this.formInline.alladdcontent = ''
},
clear () {
this.clearModal = true
},
confireClear () {
if (this.key === 'url_auth_list' || this.key === 'url_white_list' || this.key === 'url_black_list' || this.key === 'domain_prefix' || this.key === 'service_owner') {
this.logData = []
// this.contrastlist = []
this.singlebaraddition = ''
this.logparamsarr = []
} else {
if (this.key === 'ip_set_v2') {
this.ipsetData = []
}
if (this.key === 'url_ip_set_v2') {
this.urlIpSetData = []
}
if (this.key === 'limit') {
this.limitData = []
}
if (this.key === 'specified_values') {
this.specifiedData = []
}
}
this.colorupdatacolor = true
this.colorupdata = true
this.origenselectserver = this.server
this.clearModal = false
},
rollback () {
let data = {
......@@ -600,8 +1018,8 @@ export default {
item.listonecolorback = false
}
})
this.content = data.body.length == 0 ? '' : data.body[0].value
this.version = data.body.length == 0 ? '' : data.body[0].key
this.content = data.body.length === 0 ? '' : data.body[0].value
this.version = data.body.length === 0 ? '' : data.body[0].key
if (this.rollbacklist.length === 0) {
this.$Message.error('暂无要回滚的内容')
return false
......@@ -616,7 +1034,7 @@ export default {
this.clickIndex1 = index
},
confirerollback () {
if (this.version == '') {
if (this.version === '') {
this.$Message.error('没有要回滚的内容')
return
}
......@@ -640,10 +1058,10 @@ export default {
},
confiredelate () {
this.logData = this.logData.filter(item => {
return item.sort != this.delateconfigurecontent
return item.sort !== this.delateconfigurecontent
})
this.contrastlist.filter(item => {
return item != this.delateconfigurecontent
return item !== this.delateconfigurecontent
})
this.delateModal = false
this.colorupdata = true
......@@ -717,14 +1135,79 @@ export default {
})
})
},
getList (key, service) {
this.limitData = [];
this.ipsetData = [];
this.urlIpSetData = [];
this.specifiedData = [];
this.origenContent = '';
this.contrastlist = []
let data = {
key: key,
service_name: service
}
getconfigurelist(data).then(data => {
let arr =['limit', 'ip_set_v2','url_ip_set_v2', 'specified_values']
let keys = arr.some(function(item){
return item === key;
})
if (key === 'limit') {
this.needModilyArr = [];
this.limitData = [];
this.limitData = (data && data.body) || []
this.limitData = [...this.limitData]
this.needModilyArr = JSON.stringify((data && data.body)) || [];
}
if (key === 'ip_set_v2') {
this.needModilyArr = [];
this.ipsetData = [];
this.ipsetData = (data && data.body) || [];
this.ipsetData = [...this.ipsetData]
this.needModilyArr = JSON.stringify((data && data.body)) || [];
}
if (key === 'url_ip_set_v2') {
this.needModilyArr = [];
this.urlIpSetData = [];
this.urlIpSetData = (data && data.body) || []
this.urlIpSetData = [...this.urlIpSetData]
this.needModilyArr = JSON.stringify((data && data.body)) || [];
}
if (key === 'specified_values') {
this.needModilyArr = [];
this.specifiedData = [];
this.specifiedData = (data && data.body) || []
this.specifiedData = [...this.specifiedData]
this.needModilyArr = JSON.stringify((data && data.body)) || [];
}
if (!keys) {
this.origenContent = (data && data.body) || '';
this.netModily = (data && data.body) || '';
}
})
},
configlist () {
this.logDataorigen = []
this.logData.map(item => {
this.logDataorigen.push(item.sort)
})
if (this.testdiv === true) {
let _this = this
let arr = ['specified_values', 'limit', 'url_ip_set_v2',
'ip_set_v2', 'test_mode','url_auth_list','url_white_list','url_black_list', 'domain_prefix','service_owner'];
let keys = arr.some(function(item){
return item === _this.key;
})
if (!keys) {
this.elseConfireModal = true;
return
}
if (this.key === 'ip_set_v2' || this.key === 'url_ip_set_v2' || this.key === 'specified_values' || this.key === 'limit') {
this.contrastIpset = true
return
}
if (this.testdiv) {
this.ContrasttestModal = true
} else {
}
if (!this.testdiv) {
this.ContrastModal = true
}
},
......@@ -735,9 +1218,57 @@ export default {
}
if (this.key === 'test_mode') {
this.paramscontent = this.aftertestmostatus === true ? 'true' : 'false'
} else {
}
if (this.key === 'url_auth_list' || this.key === 'url_white_list' || this.key === 'url_black_list' || this.key === 'domain_prefix' || this.key === 'service_owner') {
this.paramscontent = this.logDataorigen
}
if (this.key === 'ip_set_v2') {
this.ipsetData.map(item => {
if (typeof(item.ip_list) === 'object') {
item.ip_list = item.ip_list
} else {
item.ip_list = JSON.parse(item.ip_list)
}
})
this.paramscontent = this.ipsetData
}
if (this.key === 'url_ip_set_v2') {
this.paramscontent = this.urlIpSetData
}
if (this.key === 'specified_values') {
if (!this.specifiedData.length) {
this.paramscontent = this.specifiedData
} else {
this.specifiedData.forEach(item => {
if (typeof(item.header) === 'object') {
item.header = item.header
} else {
item.header = JSON.parse(item.header)
}
})
this.paramscontent = this.specifiedData
}
}
if (this.key === 'limit') {
if (!this.limitData.length) {
this.paramscontent = this.limitData
} else {
this.limitData && this.limitData.forEach(item => {
item.rate = Number(item.rate)
item.duration = Number(item.duration)
})
this.paramscontent = this.limitData
}
}
let arr = ['specified_values', 'limit', 'url_ip_set_v2',
'ip_set_v2', 'test_mode','url_auth_list','url_white_list','url_black_list', 'domain_prefix','service_owner'];
let _this = this;
let keys = arr.some(function(item){
return item === _this.key;
})
if (!keys) {
this.paramscontent = this.origenContent
}
postconfigurelist(data, this.paramscontent).then(data => {
if (data.code === 200) {
this.$Message.success('发布成功')
......@@ -745,8 +1276,14 @@ export default {
this.colorupdatacolor = false
this.ContrastModal = false
this.ContrasttestModal = false
this.contrastIpset = false
this.getconfigurlist(this.key, this.server)
this.getList(this.key, this.server)
this.contrastlist = this.logDataorigen
this.updataIpsetSta = false
this.updataUrlSta = false
this.updataLimitSta = false
this.updataSpecifiedSta = false
} else {
this.$Message.error(data.body)
this.ContrastModal = false
......@@ -802,6 +1339,7 @@ export default {
this.getnodeList()
this.getkeytext(this.key)
this.getconfigurlist(this.key, this.server)
this.getList(this.key, this.server)
},
coloechangeserver () {
this.server = this.origenselectserver
......@@ -840,9 +1378,9 @@ export default {
return arr.push(item.Meta.weight)
})
let sta = arr.some(function (item, index, array) {
return item != 0
return item !== 0
})
if (sta == false) {
if (sta === false) {
this.$Message.error('权重不能全部修改为0')
this.ContrastnodeModal = false
this.getnodeList()
......@@ -875,91 +1413,15 @@ export default {
})
},
confiechangediv () {
if (this.changekey === 'url_white_list') {
this.listonecolorauth = false
this.listonecolorfor = true
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = false
this.isShowList = true
this.logData = []
this.contrastlist = []
this.testdiv = false
this.colorupdatacolor = false
this.getkeytext(this.changekey)
this.getconfigurlist(this.changekey, this.server)
}
if (this.changekey === 'url_auth_list') {
this.listonecolorauth = true
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.isShowList = true
this.testdiv = false
this.logData = []
this.contrastlist = []
this.getkeytext(this.changekeyy)
this.getconfigurlist(this.changekey, this.server)
}
if (this.changekey === 'url_black_list') {
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = true
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.isShowList = true
this.testdiv = false
this.logData = []
this.contrastlist = []
this.getkeytext(this.changekey)
this.getconfigurlist(this.changekey, this.server)
}
if (this.changekey === 'domain_prefix') {
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = true
this.listonecolortest = false
this.colorupdatacolor = false
this.isShowList = true
this.testdiv = false
this.logData = []
this.contrastlist = []
this.getkeytext(this.changekey)
this.getconfigurlist(this.changekey, this.server)
}
if (this.changekey === 'service_owner') {
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = true
this.listonecolordoma = false
this.listonecolortest = false
this.colorupdatacolor = false
this.isShowList = true
this.testdiv = false
this.logData = []
this.contrastlist = []
this.getkeytext(this.changekey)
this.getconfigurlist(this.changekey, this.server)
}
this.colorIndex = this.changeIndex
if (this.changekey === 'url_white_list' || this.changekey === 'url_auth_list' || this.changekey === 'url_black_list'
|| this.changekey === 'domain_prefix' || this.changekey === 'service_owner' || this.changekey === 'test_mode') {
if (this.changekey === 'test_mode') {
this.listonecolorauth = false
this.listonecolorfor = false
this.listonecolorint = false
this.listonecolorserv = false
this.listonecolordoma = false
this.listonecolortest = true
this.colorupdatacolor = false
this.isShowList = false
this.testdiv = true
this.showTestModal = true
this.logData = []
this.contrastlist = []
this.getkeytext(this.changekey)
......@@ -978,10 +1440,63 @@ export default {
this.opentest = false
}
})
} else {
this.listonecolorfor = true
this.isShowList = true
this.logData = []
this.contrastlist = []
this.testdiv = false
this.colorupdatacolor = false
this.getkeytext(this.changekey)
this.getconfigurlist(this.changekey, this.server)
}
this.colorupdata = false
this.colorupdatacolor = false
this.changedivModal = false
} else {
if (this.changekey === 'ip_set_v2' || this.changekey === 'url_ip_set_v2' || this.changekey === 'limit' || this.changekey === 'specified_values') {
if (this.changekey === 'ip_set_v2') {
this.showIpSet = true
this.showUrlIpSet = false
this.showLimit = false
this.showSpecified = false
this.showElse = false
}
if (this.changekey === 'url_ip_set_v2') {
this.showUrlIpSet = true
this.showIpSet = false
this.showLimit = false
this.showSpecified = false
this.showElse = false
}
if (this.changekey === 'limit') {
this.showLimit = true
this.showIpSet = false
this.showUrlIpSet = false
this.showSpecified = false
this.showElse = false
}
if (this.changekey === 'specified_values') {
this.showIpSet = false
this.showUrlIpSet = false
this.showLimit = false
this.showElse = false
this.showTestModal = false
}
this.getList(this.changekey, this.server)
this.getkeytext(this.changekey)
} else {
this.origenContent = ''
this.showElse = true
this.getList(this.changekey,this.server)
this.getkeytext(this.changekey)
}
this.isShowList = false
this.showTestModal = false
this.colorupdata = false
this.colorupdatacolor = false
this.changedivModal = false
}
},
confireupdatenode () {
if (this.updateweight < 0) {
......@@ -998,15 +1513,224 @@ export default {
this.colorupdatacolor = true
this.colorupdatacolor = true
this.origenselectserver = this.server
},
MenuList() {
getMenuList().then(res => {
this.menu = res && res.body || []
}).then(() => {
this.menu.push({Key: "t", Value: "无返回"})
})
},
addIpset() {
this.ipsetName = '';
this.ipsetContent = '';
this.addIpsetModal = true;
},
updateIpset(data) {
this.updataIpsetSta = true;
this.updateconfigindex = data._index;
this.ipsetName = data.name;
this.ipsetContent = JSON.stringify(data.ip_list);
this.addIpsetModal = true
},
updateUrlIpset(data) {
this.updataUrlSta = true;
this.updateconfigindex = data._index;
this.urlIpsetName = data.ip_set_name;
this.urlIpsetPath = data.path;
this.addUrlIpsetModal = true
let list = {
key: 'url_ip_set_v2',
service_name: this.server
}
getconfigurelist(list).then(data => {
let arr = (data && data.body) || [];
arr.map(item => {
this.ipsetList.push(item.ip_set_name)
})
this.ipsetList = this.ipsetList.filter((x, index,self)=>self.indexOf(x)===index)
})
},
updateLimit(data) {
this.updataLimitSta = true;
this.updateconfigindex = data._index;
this.limitTime = data.duration;
this.limitRate = data.rate;
this.limitPath = data.path;
this.addLimitModal = true
},
updateSpecified(data) {
this.updataSpecifiedSta = true;
this.updateconfigindex = data._index;
this.body = data.body;
this.header = JSON.stringify(data.header);
this.err_type = data.err_type;
this.err_tag = data.err_tag;
this.addSpecifiedModal = true
},
addUrlIpset() {
this.urlIpsetName = '';
this.urlIpsetPath = '';
this.addUrlIpsetModal = true;
let data = {
key: 'url_ip_set_v2',
service_name: this.server
}
getconfigurelist(data).then(data => {
let arr = (data && data.body) || [];
arr = arr.filter((x, index,self)=>self.indexOf(x)===index)
arr.map(item => {
this.ipsetList.push(item.ip_set_name)
})
this.ipsetList = this.ipsetList.filter((x, index,self) => self.indexOf(x) === index)
})
},
addLimit() {
this.limitPath = '';
this.limitTime = null;
this.limitRate = null;
this.addLimitModal = true;
},
addSpecified () {
this.header = '';
this.body = '';
this.err_tag = '';
this.err_type = '';
this.addSpecifiedModal = true;
},
confireIpset() {
if (this.updataIpsetSta) {
this.ipsetData[this.updateconfigindex].ip_list = this.ipsetContent
} else {
let str = this.ipsetContent;
this.ipsetData.push(
{
name: this.ipsetName,
ip_list: str,
}
);
}
this.addIpsetModal = false;
this.colorupdata = true;
this.colorupdatacolor = true
this.newIpsetData = [];
this.newIpsetData = this.ipsetData;
this.origenselectserver = this.server
},
confireUrlSet() {
if (this.updataUrlSta) {
this.urlIpSetData[this.updateconfigindex].path = this.urlIpsetPath
this.urlIpSetData[this.updateconfigindex].ip_set_name = this.urlIpsetName
} else {
this.urlIpSetData.push(
{
ip_set_name: this.urlIpsetName,
path:this.urlIpsetPath,
}
);
}
this.addUrlIpsetModal = false;
this.colorupdata = true;
this.colorupdatacolor = true
this.newIpsetData = [];
this.newIpsetData = this.urlIpSetData;
this.origenselectserver = this.server
},
confireLimit() {
if (this.updataLimitSta) {
this.limitData[this.updateconfigindex].path = this.limitPath
this.limitData[this.updateconfigindex].duration = this.limitTime
this.limitData[this.updateconfigindex].rate = this.limitRate
} else {
this.limitData.push(
{
path: this.limitPath,
rate: this.limitRate,
duration: this.limitTime,
}
);
}
this.addLimitModal = false;
this.colorupdata = true;
this.newIpsetData = [];
this.newIpsetData = this.limitData;
this.colorupdatacolor = true
this.origenselectserver = this.server
},
confireSpecified() {
if (this.updataSpecifiedSta) {
this.specifiedData[this.updateconfigindex].body = this.body
this.specifiedData[this.updateconfigindex].header = this.header
this.specifiedData[this.updateconfigindex].err_type = this.err_type
this.specifiedData[this.updateconfigindex].err_tag = this.err_tag
} else {
this.specifiedData.push(
{
body: this.body,
header: this.header,
err_type: this.err_type,
err_tag: this.err_tag,
}
);
}
this.addSpecifiedModal = false;
this.colorupdata = true;
this.newIpsetData = [];
this.newIpsetData = this.specifiedData;
this.colorupdatacolor = true
this.origenselectserver = this.server
},
delateOne(data) {
this.delateindex = data._index;
this.delateIpModal = true
},
confierDelateOne() {
if (this.key === 'ip_set_v2') {
this.ipsetData.splice(this.delateindex, 1);
}
if (this.key === 'url_ip_set_v2') {
this.urlIpSetData.splice(this.delateindex, 1)
}
if (this.key === 'limit') {
this.limitData.splice(this.delateindex, 1)
}
if (this.key === 'specified_values') {
this.specifiedData.splice(this.delateindex, 1)
}
this.delateIpModal = false
this.colorupdata = true;
this.colorupdatacolor = true
this.origenselectserver = this.server
},
getType() {
getTypeList().then(data => {
this.tageList = (data && data.body) || []
})
},
modify() {
this.updataOrigenContent = this.origenContent;
this.modifyModal = true;
},
conforeModify() {
this.origenContent = this.updataOrigenContent;
this.colorupdatacolor = true
this.colorupdata = true
this.origenselectserver = this.server
this.modifyModal = false;
},
reduction() {
this.origenContent = this.netModily;
},
},
created () {
},
async mounted () {
await this.getserlist()
this.MenuList()
this.getkeytext('url_auth_list')
this.getconfigurlist('url_auth_list', this.server)
this.getnodeList()
this.getType()
},
destroyed () {
}
......@@ -1068,11 +1792,11 @@ export default {
}
.list_content{
background: #f2f2f2;
height: 30px;
line-height: 30px;
margin-top:10px;
line-height: 20px;
margin:10px 0;
width: 80%;
margin-left: 10%;
padding: 10px;
border-radius: 5px;
cursor: pointer
}
......
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