mirror of
https://github.com/jumpserver/lina.git
synced 2025-11-19 23:29:07 +00:00
Compare commits
1 Commits
dev
...
pr@dev@k8s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c85e0c683 |
@@ -107,10 +107,6 @@ export default {
|
|||||||
this.$emit('add', true)
|
this.$emit('add', true)
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error?.response?.data?.code === 'no_valid_assets') {
|
|
||||||
this.$message.error(error?.response?.data?.detail)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.iVisible = true
|
this.iVisible = true
|
||||||
this.handleResult(null, error)
|
this.handleResult(null, error)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -223,21 +223,9 @@ export default {
|
|||||||
const mapped = {}
|
const mapped = {}
|
||||||
Object.entries(errors || {}).forEach(([k, v]) => {
|
Object.entries(errors || {}).forEach(([k, v]) => {
|
||||||
let msg = v
|
let msg = v
|
||||||
console.log(k, v)
|
|
||||||
// v是数组并且数组都是字符串,则拼接为字符串
|
// v是数组并且数组都是字符串,则拼接为字符串
|
||||||
if (Array.isArray(v) && v.every(item => typeof item === 'string')) msg = v.join('; ')
|
if (Array.isArray(v) && v.every(item => typeof item === 'string')) msg = v.join('; ')
|
||||||
// 处理 [{"port":["请确保该值小于或者等于 65535。"]},{},{}] 这种情况
|
else if (typeof v === 'object' && v !== null) msg = JSON.stringify(v)
|
||||||
else if (Array.isArray(v) && v.every(item => _.isPlainObject(item))) {
|
|
||||||
const subMsg = []
|
|
||||||
v.forEach((subItem) => {
|
|
||||||
Object.values(subItem).forEach((subMsgArr) => {
|
|
||||||
if (Array.isArray(subMsgArr)) {
|
|
||||||
subMsg.push(...subMsgArr)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
msg = subMsg.join(' ')
|
|
||||||
} else if (typeof v === 'object' && v !== null) msg = JSON.stringify(v)
|
|
||||||
mapped[k] = String(msg || '')
|
mapped[k] = String(msg || '')
|
||||||
})
|
})
|
||||||
this.serverErrors = mapped
|
this.serverErrors = mapped
|
||||||
|
|||||||
@@ -65,17 +65,6 @@ export default {
|
|||||||
'usingOrgs',
|
'usingOrgs',
|
||||||
'currentViewRoute'
|
'currentViewRoute'
|
||||||
]),
|
]),
|
||||||
currentOrgDisplayName() {
|
|
||||||
const currentOrgId = this.currentOrg?.id
|
|
||||||
if (!currentOrgId) {
|
|
||||||
return this.$tc('Select')
|
|
||||||
}
|
|
||||||
const matchedOrg = this.usingOrgs.find(item => item.id === currentOrgId)
|
|
||||||
if (matchedOrg?.name) {
|
|
||||||
return matchedOrg.name
|
|
||||||
}
|
|
||||||
return this.currentOrg.name || this.$tc('Select')
|
|
||||||
},
|
|
||||||
orgActionsGroup() {
|
orgActionsGroup() {
|
||||||
const orgActions = {
|
const orgActions = {
|
||||||
label: this.$t('OrganizationList'),
|
label: this.$t('OrganizationList'),
|
||||||
@@ -121,8 +110,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentOrgDisplayName() {
|
currentOrg: {
|
||||||
this.updateWidth()
|
handler() {
|
||||||
|
this.updateWidth()
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -141,9 +133,8 @@ export default {
|
|||||||
tempSpan.style.fontWeight = 'normal'
|
tempSpan.style.fontWeight = 'normal'
|
||||||
tempSpan.style.letterSpacing = 'normal'
|
tempSpan.style.letterSpacing = 'normal'
|
||||||
|
|
||||||
// 获取当前组织显示名称
|
// 获取当前组织名称
|
||||||
const orgName = this.currentOrgDisplayName
|
const orgName = this.currentOrg.name || this.$tc('Select')
|
||||||
|
|
||||||
tempSpan.textContent = orgName
|
tempSpan.textContent = orgName
|
||||||
document.body.appendChild(tempSpan)
|
document.body.appendChild(tempSpan)
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,8 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang='scss' scoped>
|
||||||
|
|
||||||
.page.no-title {
|
.page.no-title {
|
||||||
::v-deep {
|
::v-deep {
|
||||||
.page-submenu .el-tabs__header {
|
.page-submenu .el-tabs__header {
|
||||||
@@ -198,14 +199,6 @@ export default {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.is-disabled {
|
|
||||||
cursor: not-allowed;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #c0c4cc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tabs__nav-next {
|
.el-tabs__nav-next {
|
||||||
|
|||||||
@@ -149,11 +149,6 @@ export function getErrorResponseMsg(error) {
|
|||||||
.join('; ')
|
.join('; ')
|
||||||
} else if (typeof data === 'string') {
|
} else if (typeof data === 'string') {
|
||||||
return data
|
return data
|
||||||
} else if (_.isPlainObject(data)) {
|
|
||||||
return Object.values(data)
|
|
||||||
.map(item => getErrorResponseMsg(item))
|
|
||||||
.filter(i => i)
|
|
||||||
.join('; ')
|
|
||||||
} else {
|
} else {
|
||||||
msg = error.toString()
|
msg = error.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,11 @@ export default {
|
|||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (!this.$store.getters.hasValidLicense) {
|
||||||
|
delete this.fields[3]
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleAfterGetRemoteMeta(meta) {
|
handleAfterGetRemoteMeta(meta) {
|
||||||
const needSetOptionFields = [
|
const needSetOptionFields = [
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ export default {
|
|||||||
id: 'check',
|
id: 'check',
|
||||||
name: this.$t('Check'),
|
name: this.$t('Check'),
|
||||||
icon: 'scan',
|
icon: 'scan',
|
||||||
has: (node) => node?.meta?.type === 'asset',
|
|
||||||
callback: (node) => {
|
callback: (node) => {
|
||||||
vm.detectDialog.asset = node.id
|
vm.detectDialog.asset = node.id
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
class="risk-review-drawer"
|
class="risk-review-drawer"
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
direction="rtl"
|
direction="rtl"
|
||||||
|
style="z-index: 999"
|
||||||
>
|
>
|
||||||
<div class="drawer-container">
|
<div class="drawer-container">
|
||||||
<div class="drawer-body">
|
<div class="drawer-body">
|
||||||
|
|||||||
@@ -10,7 +10,33 @@ export default {
|
|||||||
components: { BaseAssetCreateUpdate },
|
components: { BaseAssetCreateUpdate },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: '/api/v1/assets/clouds/'
|
url: '/api/v1/assets/clouds/',
|
||||||
|
addFields: this.getAddFields(),
|
||||||
|
addFieldsMeta: this.getAddFieldsMeta()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getAddFields() {
|
||||||
|
const platform = this.$route.query.type
|
||||||
|
const baseFields = []
|
||||||
|
|
||||||
|
if (platform === 'k8s') {
|
||||||
|
baseFields.push([this.$t('Basic'), ['namespace'], 1])
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseFields
|
||||||
|
},
|
||||||
|
getAddFieldsMeta() {
|
||||||
|
const platform = this.$route.query.type
|
||||||
|
const fieldsMeta = {}
|
||||||
|
|
||||||
|
if (platform === 'k8s') {
|
||||||
|
fieldsMeta['namespace'] = {
|
||||||
|
label: this.$t('DefaultNamespace')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fieldsMeta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -515,8 +515,6 @@ export default {
|
|||||||
this.setBtn()
|
this.setBtn()
|
||||||
this.selectAssets = assets
|
this.selectAssets = assets
|
||||||
this.selectNodes = nodes
|
this.selectNodes = nodes
|
||||||
}).catch(() => {
|
|
||||||
this.lastRequestPayload = null
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
viewConfirmRunAssets() {
|
viewConfirmRunAssets() {
|
||||||
@@ -527,8 +525,8 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.xterm.write(
|
this.xterm.write(
|
||||||
'\x1b[31m' +
|
'\x1b[31m' +
|
||||||
this.$tc('StopLogOutput').replace('currentTaskId', this.currentTaskId) +
|
this.$tc('StopLogOutput').replace('currentTaskId', this.currentTaskId) +
|
||||||
'\x1b[0m'
|
'\x1b[0m'
|
||||||
)
|
)
|
||||||
this.xterm.write(this.wrapperError(''))
|
this.xterm.write(this.wrapperError(''))
|
||||||
this.getTaskStatus()
|
this.getTaskStatus()
|
||||||
|
|||||||
@@ -408,6 +408,7 @@ export default {
|
|||||||
createJob(data).then(res => {
|
createJob(data).then(res => {
|
||||||
this.progressLength = 0
|
this.progressLength = 0
|
||||||
this.executionInfo.timeCost = 0
|
this.executionInfo.timeCost = 0
|
||||||
|
this.showProgress = true
|
||||||
this.speedText = ''
|
this.speedText = ''
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
const start = Date.now()
|
const start = Date.now()
|
||||||
@@ -435,13 +436,13 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.showProgress = true
|
|
||||||
this.executionInfo.status = 'running'
|
this.executionInfo.status = 'running'
|
||||||
this.currentTaskId = res.task_id
|
this.currentTaskId = res.task_id
|
||||||
this.xtermConfig = { taskId: this.currentTaskId, type: 'shortcut_cmd' }
|
this.xtermConfig = { taskId: this.currentTaskId, type: 'shortcut_cmd' }
|
||||||
this.setCostTimeInterval()
|
this.setCostTimeInterval()
|
||||||
this.writeExecutionOutput()
|
this.writeExecutionOutput()
|
||||||
}).catch(() => {
|
}).catch((error) => {
|
||||||
|
this.$message.error(this.$tc('Error'), error)
|
||||||
this.execute_stop()
|
this.execute_stop()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -224,12 +224,11 @@ export default {
|
|||||||
title: this.$t('ExecuteAfterSaving'),
|
title: this.$t('ExecuteAfterSaving'),
|
||||||
callback: (value, form, btn) => {
|
callback: (value, form, btn) => {
|
||||||
form.value.run_after_save = true
|
form.value.run_after_save = true
|
||||||
if (form.value?.variable) {
|
const parameters = form.value.variable.reduce((acc, item) => {
|
||||||
form.value['parameters'] = form.value.variable.reduce((acc, item) => {
|
acc[item.var_name] = item.default_value || ''
|
||||||
acc[item.var_name] = item.default_value || ''
|
return acc
|
||||||
return acc
|
}, {})
|
||||||
}, {})
|
form.value['parameters'] = parameters
|
||||||
}
|
|
||||||
this.submitForm(form, btn)
|
this.submitForm(form, btn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,22 +32,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
passwordMenuDisabled() {
|
|
||||||
return this.$store.state.users.profile.source.value !== 'local'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
passwordMenuDisabled: {
|
|
||||||
immediate: true,
|
|
||||||
handler(disabled) {
|
|
||||||
this.config.submenu = this.getSubmenu()
|
|
||||||
if (disabled && this.config.activeMenu === 'Password') {
|
|
||||||
this.config.activeMenu = 'SSHKeyList'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
getSubmenu() {
|
getSubmenu() {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ module.exports = {
|
|||||||
target: process.env.VUE_APP_CORE_HOST || 'http://127.0.0.1:8080',
|
target: process.env.VUE_APP_CORE_HOST || 'http://127.0.0.1:8080',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
after: require('./mock/mock-server.js')
|
||||||
},
|
},
|
||||||
css: {},
|
css: {},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
|
|||||||
Reference in New Issue
Block a user