fix and merge

This commit is contained in:
ann 2021-10-15 16:20:04 +08:00
parent 54f6554fd9
commit a9d9ac69c0
5 changed files with 15 additions and 15 deletions

2
.gitignore vendored
View File

@ -3,7 +3,7 @@ node_modules
/dist
*.zip
/public
/src/prometheusMonitorNew
/src/views/prometheusMonitorNew
# local env files
.env.local

View File

@ -245,7 +245,7 @@ export function virtualMachineACtion(name, action) {
})
}
export function hostACtion(name, action) {
export function hostAction(name, action) {
return request({
url: '/virtual/v1/nodes/' + name + '?action=' + action,
method: 'post',

View File

@ -3,6 +3,7 @@ import { Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import Cookies from 'js-cookie'
import router from '../router'
// create an axios instance
const service = axios.create({
@ -54,7 +55,6 @@ service.interceptors.request.use(
},
error => {
// do something with request error
console.log(error) // for debug
return Promise.reject(error)
}
)
@ -73,7 +73,6 @@ service.interceptors.response.use(
*/
response => {
const res = response.data
// console.log(res)
// if the custom code is not 20000, it is judged as an error.
if (response.status !== 200 && (response.status !== 201) && (response.status !== 204)) {
@ -96,18 +95,20 @@ service.interceptors.response.use(
// })
// })
// }
return Promise.reject(new Error(res.message || 'Error'))
return Promise.reject(new Error(res || 'Error'))
} else {
return res
}
},
error => {
console.log('err' + error) // for debug
Message({
message: error.message,
message: error.response.data.message,
type: 'error',
duration: 10 * 1000
})
if (error.response.status === 401) {
router.push('/login')
}
return Promise.reject(error)
}
)

View File

@ -32,7 +32,7 @@
<script>
import List from '@/components/list'
import { getHostYaml, hostACtion } from '@/api/one-class-page/virtualMachine'
import { getHostYaml, hostAction } from '@/api/one-class-page/virtualMachine'
export default {
components: { List },
@ -49,7 +49,7 @@ export default {
},
columns: [
{ prop: 'state', label: '状态', formatter: (row) => { return <el-tag type='success'>{row.state}</el-tag> } },
{ prop: 'customName', label: '名称', formatter: (row) => { return <a onClick={() => this.viewDetail(row)}>{row.customName}</a> } },
{ prop: 'name', label: '名称', formatter: (row) => { return <a onClick={() => this.viewDetail(row)}>{row.name}</a> } },
{ prop: 'hostIP', label: '主机IP' },
{ prop: 'cpu', label: 'CPU', formatter: (row) => { return <div>已使用{row.cpuAll}C中的{row.cpuUsed}<el-progress percentage={row.cpuUsePercentage} ></el-progress></div> } },
{ prop: 'memory', label: '内存', formatter: (row) => { return <div>已使用{row.memoryAll}GiB中的{row.memoryUsed}<el-progress percentage={row.memoryUsePercentage} ></el-progress></div> } },
@ -94,18 +94,17 @@ export default {
},
methods: {
viewDetail(row) {
console.log(row)
this.$router.push({ path: `host/detail`, query: row })
},
maintainEnable() {
this.maintainDialogVisible = false
hostACtion(this.maintainName, 'enableMaintenanceMode').then(res => {
hostAction(this.maintainName, 'enableMaintenanceMode').then(res => {
alert('成功')
location.reload()
})
},
maintainDisable() {
hostACtion(this.maintainName, 'disableMaintenanceMode').then(res => {
hostAction(this.maintainName, 'disableMaintenanceMode').then(res => {
alert('成功')
location.reload()
})

View File

@ -72,7 +72,7 @@ module.exports = {
ws: false,
target: 'https://106.53.150.192/',
changeOrigin: true,
secure: false,
secure: false
},
'^/api/': {
ws: false,
@ -88,11 +88,11 @@ module.exports = {
ws: false,
target: 'https://106.53.150.192/',
changeOrigin: true,
secure: false,
secure: false
},
'^/function': {
ws: false,
target: 'https://jointcloud.net/api/',
target: 'https://jointcloud.net/api/'
// changeOrigin: true,
},
'/kapis/terminal.kubesphere.io': {