Isolution
<template>
<div style="float:left;width: 100%; margin-left: 0">
<el-row >
<el-col :span=4>
<el-input placeholder="请输入服务名" v-model='form.app' clearable size="medium" @change="query"></el-input>
</el-col>
<el-col :span=4 :offset=1>
<el-input placeholder="请输入实例名" v-model='form.instanceId' clearable size="medium" @change="query"></el-input>
</el-col>
<el-col :span=4 :offset=1>
<el-select v-model="form.status" placeholder="请选择实例状态">
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
<el-col :span="2">
<el-button ref="query" type="primary" icon="el-icon-check" @click="query" size="medium">查询</el-button>
</el-col>
</el-row>
<div style="margin-top:20px">
<el-table
:data="tableData"
height="700"
stripe
style="width: 100%">
<el-table-column label="服务名" prop="app" sortable width="100"></el-table-column>
<el-table-column label="实例名" prop="instanceId" sortable width="100"></el-table-column>
<el-table-column label="实例状态" prop="status" sortable width="180"></el-table-column>
<el-table-column label="运行状态" prop="status" sortable width="180"></el-table-column>
<!-- <el-table-column label="修改原因" prop="reason" width="250"></el-table-column>-->
<el-table-column align="right" width="200">
<template #header>
<el-input v-model="search" size="mini" placeholder="API"></el-input>
</template>
<template #default="scope">
<el-button size="mini" @click="isolution(scope.$index, scope.row)" icon="el-icon-delete" type="primary" :disabled="!$root.writeFlag"
>隔离</el-button>
<el-button size="mini" @click="recover(scope.$index, scope.row)" icon="el-icon-plus" type="primary" :disabled="!$root.writeFlag"
>恢复</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[30, 50, 100, 200, 500, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageTogal">
</el-pagination>
</div>
</div>
</template>
<script>import { post } from '../../api/request'
import Cookies from 'js-cookies/src/cookies'
export default {
name: 'IsolutionInstance',
data () {
return {
pageTogal: 0,
currentPage: 1,
pageSize: 50,
disabled: true,
tableData: [],
tableDataCache: [],
filterData: ['total', 'currentPage', 'pageSize'],
form: {
app: '',
instanceId: '',
status: '',
userName: '',
reason: ''
},
statusOptions: [
{
value: '',
label: 'ALL'
},
{
value: 'UP',
label: 'UP'
},
{
value: 'OUT_OF_SERVICE',
label: 'OUT_OF_SERVICE'
}
]
}
},
created () {
this.disabled = !(this.$root.envFlag && this.$root.writeFlag)
post('/api/instance/apps', this.form).then((result) => {
console.log(result)
if (result.list != null) {
this.pageTogal = result.list.length
this.tableDataCache = result.list
this.tableData = this.tableDataCache.slice(0, this.pageSize)
this.currentPage = 1
}
})
},
methods: {
handleSizeChange (val) {
this.pageSize = val
this.tableData = this.tableDataCache.slice(0, this.pageSize)
this.currentPage = 1
console.log(`每页 ${val} 条`)
},
handleCurrentChange (val) {
window.scrollTo(0, 0)
this.tableData = this.tableDataCache.slice((val - 1) * this.pageSize, val * this.pageSize)
console.log(`当前页: ${val}`)
},
recordFormat (item) {
for (let i = 0; i < this.filterData.length; i++) {
if (item.indexOf(this.filterData[i]) !== -1) {
return
}
}
var htmlStr = ''
if (item.includes('^')) {
htmlStr = '<font color="red">' + item.replaceAll('^', '') + '</font>' + '<br>'
} else {
htmlStr = item + '<br>'
}
return htmlStr
},
query () {
// this.$refs.query.icon = 'el-icon-loading'
post('/api/instance/apps', this.form).then((result) => {
console.log(result)
try {
if (result.list != null) {
this.pageTogal = result.list.length
this.tableDataCache = result.list
this.tableData = this.tableDataCache.slice(0, this.pageSize)
this.currentPage = 1
// this.$refs.query.icon = 'el-icon-check'
}
} catch (e) {
// this.$refs.query.icon = 'el-icon-close'
}
})
},
isolution (index, row) {
this.rowToForm(row)
this.$confirm('操作将导致实例下线,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
post('/api/instance/isolution', this.form).then((result) => {
console.log(result)
if (result.code === '200') {
this.$message({ type: 'info', message: '隔离成功' })
this.query()
} else {
this.$message({ type: 'error', message: '隔离失败' })
}
})
}).catch(() => {
this.$message({ type: 'info', message: '操作已取消' })
Cookies.removeItem('reason')
})
},
recover (index, row) {
this.rowToForm(row)
this.$confirm('操作将导致实例下线,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
post('/api/instance/recover', this.form).then((result) => {
console.log(result)
if (result.code === '200') {
this.$message({ type: 'info', message: '恢复成功' })
this.query()
} else {
this.$message({ type: 'error', message: '恢复失败' })
}
})
}).catch(() => {
this.$message({ type: 'info', message: '操作已取消' })
Cookies.removeItem('reason')
})
},
rowToForm (row) {
this.form.status = row.status
this.form.app = row.app
this.form.instanceId = row.instanceId
}
}
}
</script>
<style scoped>
</style>
Isolution的更多相关文章
- spring独立事务分析
最近在ssm框架的项目中需要用到独立事务的实现,找了半天,搜集了以下理论知识为实现做准备.事务管理器为datasource (1)Spring在transactiondefinition接口中规定了7 ...
- 代码 | 自适应大邻域搜索系列之(3) - Destroy和Repair方法代码实现解析
前言 上一篇文章中我们具体解剖了ALNS类的具体代码实现过程,不过也留下了很多大坑.接下来的文章基本都是"填坑"了,把各个模块一一展现解析给大家.不过碍于文章篇幅等原因呢,也不会每 ...
- 代码 | 自适应大邻域搜索系列之(4) - Solution定义和管理的代码实现解析
前言 上一篇讲解了destroy和repair方法的具体实现代码,好多读者都在喊酸爽和得劲儿--今天这篇就讲点简单的,关于solution的定义和管理的代码实现,让大家回回神吧--哈哈. 01 总体概 ...
- 代码 | 自适应大邻域搜索系列之(2) - ALNS算法主逻辑结构解析
00 前言 在上一篇推文中,教大家利用了ALNS的lib库求解了一个TSP问题作为实例.不知道你萌把代码跑起来了没有.那么,今天咱们再接再厉.跑完代码以后,小编再给大家深入讲解具体的代码内容.大家快去 ...
- 代码 | 用ALNS框架求解一个TSP问题 - 代码详解
写在前面 前面好多篇文章,我们总算是把整个ALNS的代码框架给大家说明白了.不知道大家对整个框架了解了没有.不过打铁要趁热,心急了要吃热豆腐.今天就来实战一下,教大家怎么用ALNS的代码框架,求解一个 ...
- 代码 | 自适应大邻域搜索系列之(7) - 局部搜索LocalSearch的代码解析
前言 好了小伙伴们我们又见面了,咳咳没错还是我.不知道你萌接连被这么多篇代码文章刷屏是什么感受,不过,酸爽归酸爽.今天咱们依然讲代码哈~不过今天讲的依然很简单,关于局部搜索LocalSearch的代码 ...
- 代码 | 自适应大邻域搜索系列之(6) - 判断接受准则SimulatedAnnealing的代码解析
前言 前面三篇文章对大家来说应该很简单吧?不过轻松了这么久,今天再来看点刺激的.关于判断接受准则的代码.其实,判断接受准则有很多种,效果也因代码而异.今天介绍的是模拟退火的判断接受准则.那么,相关的原 ...
随机推荐
- [PHP] 业务逻辑大内存占用的优化思路, yield 和 chunk
示例: header("content-type:text/html;charset=utf-8"); function readTxt() { $handle = fopen ...
- [FAQ] WebStorm/PHPStorm:设置 HTML/JavaScript/PHP 注释缩进行为,代码片段
[注释行为] Preferences -> Code Style 选择语言后,找到 Wrapping and Braces, 取消 Comment at first column. 如果是HTM ...
- [Go] flag package 指南: 命令行参数标记的解析
flag 是 Golang 的官方包. 支持用法有三种,不同之处是二三两种用法是 Var() 函数可以绑定 flag 到一个变量上. 直接调用指定类型的函数有多种,如 flag.String(), B ...
- 探索 DTD 在 XML 中的作用及解析:深入理解文档类型定义
DTD 是文档类型定义(Document Type Definition)的缩写.DTD 定义了 XML 文档的结构以及合法的元素和属性. 为什么使用 DTD 通过使用 DTD,独立的团体可以就数据交 ...
- 小程序中使用 lottie 动画 | 踩坑经验分享
最近被拉去支援紧急需求(赶在五一节假日前上线的,双休需要加班),参与到项目中才知道,开发的项目是微信小程序技术栈的.由于是临时支援,笔者也很久没开发过微信小程序了,所以挑选了相对独立,业务属性相对轻薄 ...
- docker-compose 安装 etcd
目录 docker-compose.yaml docker-compose.yaml version: "3" services: etcd: hostname: etcd ima ...
- Go语言—值类型和引用类型
一.值类型 定义 变量直接存储的值,内存通常在栈中分配: var i = 5 -> i-->5 应用 int.float.bool.string.数组.struct 二.引用类型 1. 定 ...
- python教程8-页面爬虫
python爬虫常用requests和beautifulSoup这2个第三方模块.需要先进行手动安装. requests负责下载页面数据,beautifulSoup负责解析页面标签. 关于beauti ...
- GROK 一个强大的调试工具
GROK 在线工具 在线英文版地址 http://grokconstructor.appspot.com/ 中文翻译版 GitHub https://github.com/systemmin/Grok ...
- NET9 AspnetCore将整合OpenAPI的文档生成功能而无需三方库
OpenAPI 规范是用于描述 HTTP API 的标准.该标准允许开发人员定义 API 的形状,这些 API 可以插入到客户端生成器.服务器生成器.测试工具.文档等中.尽管该标准具有普遍性和普遍性, ...