Compare commits

..

13 Commits

19 changed files with 180 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
FROM jumpserver/lina-base:20251105_092554 AS stage-build
FROM jumpserver/lina-base:20251201_095403 AS stage-build
ARG VERSION
ENV VERSION=$VERSION

View File

@@ -140,5 +140,6 @@
"src/**/*.{js,vue}": [
"eslint --fix"
]
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

View File

@@ -107,6 +107,10 @@ export default {
this.$emit('add', true)
}
}).catch(error => {
if (error?.response?.data?.code === 'no_valid_assets') {
this.$message.error(error?.response?.data?.detail)
return
}
this.iVisible = true
this.handleResult(null, error)
})

View File

@@ -223,9 +223,21 @@ export default {
const mapped = {}
Object.entries(errors || {}).forEach(([k, v]) => {
let msg = v
console.log(k, v)
// v是数组并且数组都是字符串则拼接为字符串
if (Array.isArray(v) && v.every(item => typeof item === 'string')) msg = v.join('; ')
else if (typeof v === 'object' && v !== null) msg = JSON.stringify(v)
// 处理 [{"port":["请确保该值小于或者等于 65535。"]},{},{}] 这种情况
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 || '')
})
this.serverErrors = mapped

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free v5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 176.001C512 273.203 433.202 352 336 352c-11.22 0-22.19-1.062-32.827-3.069l-24.012 27.014A23.999 23.999 0 0 1 261.223 384H224v40c0 13.255-10.745 24-24 24h-40v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24v-78.059c0-6.365 2.529-12.47 7.029-16.971l161.802-161.802C163.108 213.814 160 195.271 160 176 160 78.798 238.797.001 335.999 0 433.488-.001 512 78.511 512 176.001zM336 128c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z"/></svg>

After

Width:  |  Height:  |  Size: 691 B

View File

@@ -65,6 +65,17 @@ export default {
'usingOrgs',
'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() {
const orgActions = {
label: this.$t('OrganizationList'),
@@ -110,11 +121,8 @@ export default {
}
},
watch: {
currentOrg: {
handler() {
this.updateWidth()
},
deep: true
currentOrgDisplayName() {
this.updateWidth()
}
},
mounted() {
@@ -133,8 +141,9 @@ export default {
tempSpan.style.fontWeight = 'normal'
tempSpan.style.letterSpacing = 'normal'
// 获取当前组织名称
const orgName = this.currentOrg.name || this.$tc('Select')
// 获取当前组织显示名称
const orgName = this.currentOrgDisplayName
tempSpan.textContent = orgName
document.body.appendChild(tempSpan)

View File

@@ -167,8 +167,7 @@ export default {
}
</script>
<style lang='scss' scoped>
<style lang="scss" scoped>
.page.no-title {
::v-deep {
.page-submenu .el-tabs__header {
@@ -199,6 +198,14 @@ export default {
opacity: 1;
}
}
&.is-disabled {
cursor: not-allowed;
&:hover {
color: #c0c4cc;
}
}
}
.el-tabs__nav-next {

View File

@@ -123,6 +123,16 @@ export default {
permissions: ['authentication.view_connectiontoken']
}
},
{
path: '/profile/access-token',
component: () => import('@/views/profile/AccessToken'),
name: 'AccessToken',
meta: {
title: i18n.t('AccessToken'),
icon: 'access-token',
permissions: ['oauth2_provider.view_accesstoken']
}
},
{
path: '/profile/preferences',
name: 'Preferences',

View File

@@ -149,6 +149,11 @@ export function getErrorResponseMsg(error) {
.join('; ')
} else if (typeof data === 'string') {
return data
} else if (_.isPlainObject(data)) {
return Object.values(data)
.map(item => getErrorResponseMsg(item))
.filter(i => i)
.join('; ')
} else {
msg = error.toString()
}

View File

@@ -43,7 +43,9 @@ export default {
asset: ''
},
treeSetting: {
showMenu: true,
showMenu: (node) => {
return node?.meta?.type === 'asset'
},
showRefresh: true,
showSearch: true,
showAssets: true,
@@ -55,9 +57,8 @@ export default {
menu: [
{
id: 'check',
name: this.$t('Check'),
name: this.$t('RiskDetection'),
icon: 'scan',
has: (node) => node?.meta?.type === 'asset',
callback: (node) => {
vm.detectDialog.asset = node.id
setTimeout(() => {

View File

@@ -6,7 +6,6 @@
class="risk-review-drawer"
destroy-on-close
direction="rtl"
style="z-index: 999"
>
<div class="drawer-container">
<div class="drawer-body">

View File

@@ -77,7 +77,7 @@ export default {
[this.$tc('Platform'), 'platform'],
[this.$tc('Node'), 'node'],
[this.$tc('Protocol'), 'protocols'],
[this.$tc('Region'), 'region_id']
[this.$tc('Region'), 'region_name']
],
data: []
},
@@ -124,7 +124,7 @@ export default {
this.ws.onmessage = e => {
const data = JSON.parse(e.data)
if (data.action === 'sync_region') {
this.addRegion(data.region_id)
this.addRegion(data.id, data.name)
} else if (data.action === 'import') {
data['@status'] = 'pending'
this.$refs.importTable.addTableItem(data)
@@ -140,10 +140,10 @@ export default {
}
}
},
addRegion(region) {
if (!this.alreadySync.includes(region)) {
this.alreadySync.push(region)
this.tip = `${this.$t('SyncRegion')}: ${this.alreadySync.at(-1)}`
addRegion(regionId, regionName) {
if (!this.alreadySync.includes(regionId)) {
this.alreadySync.push(regionId)
this.tip = `${this.$t('SyncRegion')}: ${regionName}`
}
},
showResult() {

View File

@@ -17,6 +17,8 @@ export const ucloud = 'ucloud'
export const volcengine = 'volcengine'
export const ctyun = 'ctyun'
export const qingcloud_private = 'qingcloud_private'
export const huaweicloud_private = 'huaweicloud_private'
export const ctyun_private = 'ctyun_private'
@@ -46,7 +48,8 @@ export const publicHostProviders = [
gcp,
ucloud,
volcengine,
smartx
smartx,
ctyun
]
export const publicDBProviders = [aliyun]
@@ -141,6 +144,12 @@ export const ACCOUNT_PROVIDER_ATTRS_MAP = {
attrs: ['access_key_id', 'access_key_secret'],
image: require('@/assets/img/cloud/volcengine.svg')
},
[ctyun]: {
name: ctyun,
title: i18n.t('CTYun'),
attrs: ['access_key_id', 'access_key_secret', 'project_id'],
image: require('@/assets/img/cloud/state.svg')
},
[vmware]: {
name: vmware,
title: 'VMware',

View File

@@ -408,7 +408,6 @@ export default {
createJob(data).then(res => {
this.progressLength = 0
this.executionInfo.timeCost = 0
this.showProgress = true
this.speedText = ''
const form = new FormData()
const start = Date.now()
@@ -436,6 +435,7 @@ export default {
}
}
}).then(res => {
this.showProgress = true
this.executionInfo.status = 'running'
this.currentTaskId = res.task_id
this.xtermConfig = { taskId: this.currentTaskId, type: 'shortcut_cmd' }

View File

@@ -0,0 +1,77 @@
<template>
<GenericListPage
ref="GenericListTable"
:header-actions="headerActions"
:help-tip="helpMessage"
:table-config="tableConfig"
/>
</template>
<script>
import { GenericListPage } from '@/layout/components'
export default {
components: {
GenericListPage
},
data() {
const ajaxUrl = '/api/v1/authentication/access-tokens/'
return {
helpMessage: this.$t('AccessTokenTip'),
tableConfig: {
hasSelection: false,
url: ajaxUrl,
columns: [
'token_preview', 'scope', 'is_valid', 'expires', 'updated', 'created', 'actions'
],
columnsMeta: {
actions: {
prop: '',
formatterArgs: {
hasUpdate: false,
hasClone: false,
hasDelete: false,
extraActions: [
{
name: 'Revoke',
title: this.$t('Revoke'),
can: ({ row }) => this.$hasPerm('oauth2_provider.delete_accesstoken'),
type: 'info',
callback: function({ row }) {
this.$axios.delete(`${ajaxUrl}${row.id}/revoke/`,
).then(res => {
this.reloadTable()
this.$message.success(this.$tc('UpdateSuccessMsg'))
}).catch(error => {
this.$message.error(this.$tc('UpdateErrorMsg' + ' ' + error))
})
}.bind(this)
}
]
}
}
}
},
headerActions: {
hasLeftActions: false,
hasSearch: false,
hasRightActions: true,
hasRefresh: true,
hasExport: false,
hasImport: false,
hasBulkDelete: false,
hasCreate: false,
extraActions: []
}
}
},
methods: {
reloadTable() {
this.$refs.GenericListTable.reloadTable()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -32,6 +32,22 @@ 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: {
getSubmenu() {
return [

View File

@@ -147,7 +147,7 @@ export default {
this.loading = true
const url = `/api/v1/tickets/comments/?ticket_id=${this.object.id}`
this.$axios.get(url).then(res => {
this.comments = res.results
this.comments = res
}).catch(err => {
this.$message.error(err)
}).finally(() => {

View File

@@ -161,8 +161,7 @@ module.exports = {
target: process.env.VUE_APP_CORE_HOST || 'http://127.0.0.1:8080',
changeOrigin: true
}
},
after: require('./mock/mock-server.js')
}
},
css: {},
configureWebpack: {

View File

@@ -8570,9 +8570,9 @@ js-tokens@^3.0.2:
integrity sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg==
js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.14.0, js-yaml@^3.7.0, js-yaml@^3.9.1:
version "3.14.2"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.2.tgz#77485ce1dd7f33c061fd1b16ecea23b55fcb04b0"
integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==
version "3.14.1"
resolved "https://registry.npmmirror.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"