Unverified Commit 150ea3e9 authored by hito's avatar hito Committed by GitHub
Browse files

optimization: 北极星兼容status字段为空情况 & code不为200时附上request_id & 申请主机提示优化 (#1323)

* optimization: 北极星兼容status字段为空情况 & code不为200时附上request_id & 申请主机提示优化

* minor: 主机失败提示颜色更换
parent 6dc19e68
Showing with 14 additions and 13 deletions
+14 -13
......@@ -163,7 +163,7 @@ function handleResponse ({ config, response, resolve, reject }) {
} else {
const code = response.code
if (code !== 0 && config.globalError) {
reject({ message: response.message, code: code, data: response.data })
reject({ message: response.message, code: code, data: response.data, request_id: response.request_id })
} else {
resolve(config.originalResponse ? response : response.data, config)
}
......@@ -242,7 +242,7 @@ function handleReject (error, config) {
error.message = message
// eslint-disable-next-line camelcase
!CUSTOM_HANDLE_CODE.includes(code) && messageError(error?.request_id ? `${message}(${error?.request_id})` : message)
!CUSTOM_HANDLE_CODE.includes(code) && messageError(error?.request_id ? `${message}( ${error?.request_id} )` : message)
return Promise.reject(error)
}
messageError(error.message)
......
......@@ -1938,7 +1938,8 @@ export default {
'容器ID': ['Container ID'],
'确认重置当前编辑状态': ['Confirm to reset the editing state'],
'重置后,你修改的内容将丢失': ['After resetting, your modified content will be lost'],
'缩小': ['Zoom out']
'缩小': ['Zoom out'],
'项目下存在主机申请失败的单据,请联系申请者【{name}】或': ['There is a receipt for host application failure under the item, please contact the applicant {name} or']
// 变量的使用 $t('test', { vari1: 1, vari2: 2 })
// // 变量的使用 $t('test', { vari1: 1, vari2: 2 })
// 'test': ['{vari1} ---english--- {vari2}'],
......
......@@ -14,10 +14,6 @@
<bk-button v-else
:theme="theme"
:disabled="applyHostButton.disabled"
v-bk-tooltips="{
content: applyHostButton.tips,
disabled: !applyHostButton.tips
}"
@click="handleOpenApplyHost">
{{$t('申请服务器')}}
</bk-button>
......@@ -31,6 +27,9 @@
render-directive="if"
header-position="left"
ext-cls="apply-host-dialog">
<bk-alert type="info" class="mb20" v-if="applyHostButton.tips">
<template #title><div v-html="applyHostButton.tips"></div></template>
</bk-alert>
<bk-form ext-cls="apply-form"
ref="applyForm"
:label-width="100"
......@@ -578,7 +577,8 @@
const tipsContentMap = {
RUNNING: this.$t('主机申请中')
}
this.applyHostButton.tips = `${tipsContentMap[status] || this.$t('主机申请失败')},<a href="${data.scr_url}" target="_blank" style="color: #3a84ff;">${this.$t('查看详情')}</a>`
this.applyHostButton.tips = `${tipsContentMap[status] || this.$t('项目下存在主机申请失败的单据,请联系申请者【{name}】或', { name: data.operator })}
<a href="${data.scr_url}" target="_blank" style="color: #3a84ff;">${this.$t('查看详情')}</a>`
} else {
this.applyHostButton.tips = ''
}
......
......@@ -98,7 +98,7 @@
</bk-table-column>
<bk-table-column label="ip: port weight" min-width="180" :show-overflow-tooltip="true">
<template slot-scope="{ row }">
<div v-if="row.status.syncStatus && row.status.syncStatus.lastRemoteInstances">
<div v-if="row.status && row.status.syncStatus && row.status.syncStatus.lastRemoteInstances">
<div v-for="(remote, remoteIndex) in row.status.syncStatus.lastRemoteInstances" :key="remoteIndex" style="padding: 5px 0;">
<p class="polaris-cell-item">{{ remote.ip || '--' }}: {{ remote.port || '--' }} {{ remote.weight || '--' }}</p>
</div>
......@@ -108,7 +108,7 @@
</bk-table-column>
<bk-table-column :label="$t('状态')" width="270">
<template slot-scope="{ row }">
<div v-if="row.status.syncStatus" style="padding: 5px 0;">
<div v-if="row.status && row.status.syncStatus" style="padding: 5px 0;">
<p class="polaris-cell-item" style="padding-bottom: 5px;" :title="row.status.syncStatus.state">{{ $t('同步状态') }}{{ row.status.syncStatus.state || '--' }}</p>
<p class="polaris-cell-item" style="padding-bottom: 5px;" :title="row.status.syncStatus.lastSyncLatencyomitempty">{{ $t('同步耗时') }}{{ row.status.syncStatus.lastSyncLatencyomitempty || '--' }}</p>
<p class="polaris-cell-item" :title="row.status.syncStatus.lastSyncTime">{{ $t('最后同步时间') }}{{ row.status.syncStatus.lastSyncTime || '--' }}</p>
......
......@@ -51,9 +51,9 @@ export default function useDetail (ctx: SetupContext, options: IDetailOptions) {
// 界面权限
const pagePerms = computed(() => {
return {
create: webAnnotations.value.perms?.page?.create_btn || {},
delete: webAnnotations.value.perms?.page?.delete_btn || {},
update: webAnnotations.value.perms?.page?.update_btn || {}
create: webAnnotations.value?.perms?.page?.create_btn || {},
delete: webAnnotations.value?.perms?.page?.delete_btn || {},
update: webAnnotations.value?.perms?.page?.update_btn || {}
}
})
......
Supports Markdown
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