mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-25 22:44:13 +00:00
Merge pull request #3251 from jumpserver/pr@dev@vault
feat: vault 添加系统配置
This commit is contained in:
@@ -29,7 +29,7 @@ export default {
|
||||
tableConfig: {
|
||||
id: 'history_date',
|
||||
url: `/api/v1/accounts/account-secrets/${this.account.id}/histories/`,
|
||||
columns: ['secret', 'secret_type', 'version', 'history_date'],
|
||||
columns: ['secret', 'version', 'history_date'],
|
||||
columnsMeta: {
|
||||
secret: {
|
||||
label: this.$t('assets.Password'),
|
||||
|
||||
@@ -1494,6 +1494,7 @@
|
||||
"PublishStatus": "发布状态"
|
||||
},
|
||||
"setting": {
|
||||
"Vault": "密钥匣子",
|
||||
"ServerTime": "服务器时间",
|
||||
"Custom": "自定义",
|
||||
"CleanHelpText": "定期清理任务会在 每天凌晨 2 点执行, 清理后的数据将无法恢复",
|
||||
@@ -1708,6 +1709,7 @@
|
||||
"testPort": "端口",
|
||||
"testParam": "参数",
|
||||
"testTools": "测试",
|
||||
"sync": "同步",
|
||||
"testHelpText": "请输入目的地址进行测试"
|
||||
},
|
||||
"tickets": {
|
||||
|
||||
@@ -49,6 +49,16 @@ export default {
|
||||
permissions: ['settings.change_auth']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/settings/vault',
|
||||
name: 'Vault',
|
||||
component: () => import('@/views/settings/Vault'),
|
||||
meta: {
|
||||
title: i18n.t('setting.Vault'),
|
||||
icon: 'security',
|
||||
permissions: ['settings.change_vault']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/settings/message',
|
||||
name: 'SysMessageSub',
|
||||
|
||||
47
src/views/settings/Vault/Base.vue
Normal file
47
src/views/settings/Vault/Base.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<IBox>
|
||||
<GenericCreateUpdateForm v-bind="iConfig" @submitSuccess="submitSuccess" />
|
||||
</IBox>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import IBox from '@/components/IBox'
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
export default {
|
||||
name: 'Base',
|
||||
components: {
|
||||
IBox,
|
||||
GenericCreateUpdateForm
|
||||
},
|
||||
props: {
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
enableField: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iConfig() {
|
||||
return this.config
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitSuccess(res) {
|
||||
this.$emit('input', !!res[this.enableField])
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
92
src/views/settings/Vault/Vault.vue
Normal file
92
src/views/settings/Vault/Vault.vue
Normal file
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<IBox>
|
||||
<GenericCreateUpdateForm v-bind="$data" />
|
||||
</IBox>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
import IBox from '@/components/IBox'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
IBox,
|
||||
GenericCreateUpdateForm
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: '/api/v1/settings/setting/?category=vault',
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.testTools'),
|
||||
loading: false,
|
||||
callback: function(value, form, btn) {
|
||||
btn.loading = true
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/vault/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
vm.$log.error('err occur')
|
||||
}).finally(() => { btn.loading = false })
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('setting.sync'),
|
||||
loading: false,
|
||||
callback: function(value, form, btn) {
|
||||
btn.loading = true
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/vault/sync/',
|
||||
value
|
||||
).then(res => {
|
||||
openTaskPage(res['task'])
|
||||
}).catch(() => {
|
||||
vm.$log.error('err occur')
|
||||
}).finally(() => { btn.loading = false })
|
||||
}
|
||||
}
|
||||
],
|
||||
encryptedFields: ['VAULT_HCP_TOKEN'],
|
||||
fields: [
|
||||
[
|
||||
this.$t('setting.Vault'),
|
||||
[
|
||||
'VAULT_TYPE',
|
||||
'VAULT_HCP_HOST',
|
||||
'VAULT_HCP_TOKEN',
|
||||
'VAULT_HCP_MOUNT_POINT'
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
VAULT_HCP_HOST: {
|
||||
hidden: (formValue) => {
|
||||
return formValue.VAULT_TYPE === 'local'
|
||||
}
|
||||
},
|
||||
VAULT_HCP_TOKEN: {
|
||||
hidden: (formValue) => {
|
||||
return formValue.VAULT_TYPE === 'local'
|
||||
}
|
||||
},
|
||||
VAULT_HCP_MOUNT_POINT: {
|
||||
hidden: (formValue) => {
|
||||
return formValue.VAULT_TYPE === 'local'
|
||||
}
|
||||
}
|
||||
},
|
||||
submitMethod() {
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
45
src/views/settings/Vault/index.vue
Normal file
45
src/views/settings/Vault/index.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<TabPage :active-menu.sync="activeMenu" :submenu="submenu">
|
||||
<keep-alive>
|
||||
<component :is="activeMenu" />
|
||||
</keep-alive>
|
||||
</TabPage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TabPage from '@/layout/components/TabPage'
|
||||
import Base from './Base'
|
||||
import Vault from './Vault'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TabPage,
|
||||
Base,
|
||||
Vault
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
activeMenu: 'Vault',
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('setting.Vault'),
|
||||
name: 'Vault'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
componentData() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user