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的代码解析
前言 前面三篇文章对大家来说应该很简单吧?不过轻松了这么久,今天再来看点刺激的.关于判断接受准则的代码.其实,判断接受准则有很多种,效果也因代码而异.今天介绍的是模拟退火的判断接受准则.那么,相关的原 ...
随机推荐
- Linux 环境下制作 deb 软件包
一.简介 前面的笔记中已经展示过了,怎么移植的一个工具境到 ARM 环境中,对于使用 buildroot 和 yocto 的朋友来说,此笔记就没有作用了,因为管理工具包会帮我们把这个工作处理了,就算需 ...
- [WC/CTS2024] 线段树 题解
Link 纪念一下场切题. 题意:给定一棵(分点不一定为中点)的线段树,给定若干个询问区间,问有多少个线段树上结点的集合,知道了这些结点对应的区间和就可以知道任何一个询问区间的和. 从询问区间开始考虑 ...
- spring-boot集成Quartz-job存储方式一JDBC
1.项目jar包依赖引入 <dependency> <groupId>org.springframework.boot</groupId> <artifact ...
- Mac远程控制工具有哪些
适用于Mac的远程控制工具有很多,这里我们给大家列举五个常用软件. 1.Apple Remote Desktop 苹果自带远程桌面正如其名称所承诺的那样.作为 Apple 出品的应用程序,您可以想象它 ...
- 【HarmonyOS NEXT】获取卸载APP后不变的设备ID
1. 背景 在HarmonyOS NEXT中,想要获取设备ID,有3种方式 UDID:deviceinfo.udid,仅限系统应用使用 AAID: aaid.getAAID(),然而卸载APP/恢复设 ...
- openstack 错误(报错)集合
1. 执行nova命令报错: ERROR (CommandError): You must provide a username or user ID via --os-username, --os- ...
- 前端使用 Konva 实现可视化设计器(11)- 对齐效果
这一章补充一个效果,在多选的情况下,对目标进行对齐.基于多选整体区域对齐的基础上,还支持基于其中一个节点进行对齐. 请大家动动小手,给我一个免费的 Star 吧~ 大家如果发现了 Bug,欢迎来提 I ...
- 环境声音分类的深度 CNN 模型
具体的软硬件实现点击 http://mcu-ai.com/ MCU-AI技术网页_MCU-AI 声音事件的分类精度与特征提取有很强的关系.本文将深度特征用于环境声音分类(ESC)问题.深层特征是通过使 ...
- C# Bitmap 在winform里编辑了,再次重新编辑,报gdi+错误解决办法
经过排查,var bitmap=new Bitmap()这个局部对象,没有Dispose所致.虽然是局部的对象,但还是需要Dispose:
- C# Log4net 组件无法写日志 IsDebuged、IsInfoEnabled、IsErrorEnabled 全部为false
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)] 如果 ...