mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-01 15:07:43 +00:00
feat: 个人设置
This commit is contained in:
@@ -1887,6 +1887,8 @@
|
||||
"UpdateNodeAssetHardwareInfo": "Update node asset hardware information"
|
||||
},
|
||||
"users": {
|
||||
"LunaSettingUpdate": "Luna setting",
|
||||
"UserSetting": "User setting",
|
||||
"AllMembers": "All members",
|
||||
"UnbindHelpText": "Local users cannot be unbound because they are authenticated as source users",
|
||||
"SetStatus": "Set status",
|
||||
|
@@ -1879,6 +1879,8 @@
|
||||
"UpdateNodeAssetHardwareInfo": "ノード資産ハードウェア情報の更新"
|
||||
},
|
||||
"users": {
|
||||
"LunaSettingUpdate": "Luna 設定更新",
|
||||
"UserSetting": "個人設定",
|
||||
"AllMembers": "すべてのメンバー",
|
||||
"UnbindHelpText": "ローカルユーザはソースユーザを認証します",
|
||||
"SetStatus": "ステータスの設定",
|
||||
|
@@ -271,7 +271,6 @@
|
||||
"UpdateAccount": "更新账号",
|
||||
"Account": "账号",
|
||||
"Defaults": "默认值",
|
||||
|
||||
"Privileged": "特权账号",
|
||||
"SelectPlatforms": "选择平台",
|
||||
"AppList": "应用列表",
|
||||
@@ -1856,6 +1855,8 @@
|
||||
"UpdateNodeAssetHardwareInfo": "更新节点资产硬件信息"
|
||||
},
|
||||
"users": {
|
||||
"LunaSettingUpdate": "Luna 配置设置",
|
||||
"UserSetting": "个人设置",
|
||||
"AllMembers": "全部成员",
|
||||
"UnbindHelpText": "本地用户为此认证来源用户,无法解绑",
|
||||
"SetStatus": "设置状态",
|
||||
|
@@ -75,6 +75,16 @@ export default {
|
||||
icon: 'token',
|
||||
permissions: ['authentication.view_connectiontoken']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/profile/user/setting',
|
||||
name: 'UserSetting',
|
||||
component: () => import('@/views/profile/UserSettingUpdate/index'),
|
||||
meta: {
|
||||
title: i18n.t('users.UserSetting'),
|
||||
icon: 'setting',
|
||||
permissions: []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -1,79 +0,0 @@
|
||||
<template>
|
||||
<IBox>
|
||||
<GenericCreateUpdateForm
|
||||
ref="GenericCreateUpdateForm"
|
||||
:fields="fields"
|
||||
:fields-meta="fieldsMeta"
|
||||
:initial="object"
|
||||
:on-perform-success="onPerformSuccess"
|
||||
:submit-method="submitMethod"
|
||||
:url="url"
|
||||
/>
|
||||
</IBox>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
import { IBox } from '@/components'
|
||||
import BoolTextReadonly from '@/components/Form/FormFields/BoolTextReadonly.vue'
|
||||
|
||||
export default {
|
||||
name: 'SecretKeyUpdate',
|
||||
components: {
|
||||
GenericCreateUpdateForm,
|
||||
IBox
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
url: '/api/v1/users/profile/secret-key/',
|
||||
fields: ['has_secret_key', 'new_secret_key', 'new_secret_key_again'],
|
||||
fieldsMeta: {
|
||||
has_secret_key: {
|
||||
label: this.$t('users.SetStatus'),
|
||||
component: BoolTextReadonly,
|
||||
el: {
|
||||
trueText: this.$t('users.Set'),
|
||||
falseText: this.$t('users.NotSet')
|
||||
},
|
||||
disabled: true
|
||||
},
|
||||
new_secret_key: {
|
||||
label: this.$t('users.NewPassword'),
|
||||
el: {
|
||||
type: 'password'
|
||||
}
|
||||
},
|
||||
new_secret_key_again: {
|
||||
label: this.$t('users.ConfirmPassword'),
|
||||
el: {
|
||||
type: 'password'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitMethod() {
|
||||
return 'put'
|
||||
},
|
||||
onPerformSuccess() {
|
||||
this.$refs.GenericCreateUpdateForm.$refs.form.$refs.dataForm.resetForm('form')
|
||||
this.$message.success(this.$tc('common.updateSuccessMsg'))
|
||||
this.$store.commit('common/reload')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.password-update >>> .el-input {
|
||||
width: 600px;
|
||||
max-width: 600px;
|
||||
}
|
||||
</style>
|
@@ -11,7 +11,6 @@ import { GenericDetailPage } from '@/layout/components'
|
||||
import ProfileInfo from '../ProfileInfo'
|
||||
import ProfileUpdate from './ProfileUpdate'
|
||||
import PasswordUpdate from './PasswordUpdate'
|
||||
import SecretKeyUpdate from './SecretKeyUpdate'
|
||||
import SSHUpdate from './SSHUpdate'
|
||||
|
||||
export default {
|
||||
@@ -20,7 +19,6 @@ export default {
|
||||
ProfileInfo,
|
||||
ProfileUpdate,
|
||||
PasswordUpdate,
|
||||
SecretKeyUpdate,
|
||||
SSHUpdate
|
||||
},
|
||||
data() {
|
||||
@@ -53,10 +51,6 @@ export default {
|
||||
title: this.$t('users.SSHKeySetting'),
|
||||
name: 'SSHUpdate',
|
||||
disabled: !this.$store.state.users.profile.can_public_key_auth
|
||||
},
|
||||
{
|
||||
title: this.$t('users.FileEncryptionPassword'),
|
||||
name: 'SecretKeyUpdate'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
82
src/views/profile/UserSettingUpdate/AllPreferenceUpdate.vue
Normal file
82
src/views/profile/UserSettingUpdate/AllPreferenceUpdate.vue
Normal file
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<IBox>
|
||||
<GenericCreateUpdateForm
|
||||
v-if="!loading"
|
||||
:fields="fields"
|
||||
:fields-meta="fieldsMeta"
|
||||
:initial="object"
|
||||
:submit-method="submitMethod"
|
||||
:url="url"
|
||||
class="password-update"
|
||||
/>
|
||||
</IBox>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
import { IBox } from '@/components'
|
||||
|
||||
export default {
|
||||
name: 'AllPreferenceUpdate',
|
||||
components: {
|
||||
GenericCreateUpdateForm,
|
||||
IBox
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
category: {
|
||||
type: String,
|
||||
default: 'luna'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fields: [],
|
||||
fieldsMeta: {},
|
||||
loading: true,
|
||||
url: `/api/v1/users/preference/?category=${this.category}`
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
try {
|
||||
this.loading = true
|
||||
await this.getUrlMeta()
|
||||
await this.setFormConfig()
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getUrlMeta() {
|
||||
const data = await this.$store.dispatch('common/getUrlMeta', { url: this.url })
|
||||
this.remoteMeta = data.actions['PATCH'] || {}
|
||||
},
|
||||
async setFormConfig() {
|
||||
const fields = []
|
||||
const fieldsMeta = {}
|
||||
for (const k in this.remoteMeta) {
|
||||
if (this.remoteMeta.hasOwnProperty(k)) {
|
||||
fields.push([this.remoteMeta[k].label, [k]])
|
||||
fieldsMeta[k] = { 'fields': Object.keys(this.remoteMeta[k].children) }
|
||||
}
|
||||
}
|
||||
|
||||
this.fields = fields
|
||||
this.fieldsMeta = fieldsMeta
|
||||
},
|
||||
submitMethod() {
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.password-update > > > .el-input {
|
||||
width: 600px;
|
||||
max-width: 600px;
|
||||
}
|
||||
</style>
|
23
src/views/profile/UserSettingUpdate/KokoUpdate.vue
Normal file
23
src/views/profile/UserSettingUpdate/KokoUpdate.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<AllPreferenceUpdate :category="category" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import AllPreferenceUpdate from '@/views/profile/UserSettingUpdate/AllPreferenceUpdate'
|
||||
|
||||
export default {
|
||||
name: 'KokoUpdate',
|
||||
components: {
|
||||
AllPreferenceUpdate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
category: 'koko'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
23
src/views/profile/UserSettingUpdate/LinaUpdate.vue
Normal file
23
src/views/profile/UserSettingUpdate/LinaUpdate.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<AllPreferenceUpdate :category="category" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import AllPreferenceUpdate from '@/views/profile/UserSettingUpdate/AllPreferenceUpdate'
|
||||
|
||||
export default {
|
||||
name: 'LinaUpdate',
|
||||
components: {
|
||||
AllPreferenceUpdate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
category: 'lina'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
23
src/views/profile/UserSettingUpdate/LunaUpdate.vue
Normal file
23
src/views/profile/UserSettingUpdate/LunaUpdate.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<AllPreferenceUpdate :category="category" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import AllPreferenceUpdate from '@/views/profile/UserSettingUpdate/AllPreferenceUpdate'
|
||||
|
||||
export default {
|
||||
name: 'LunaUpdate',
|
||||
components: {
|
||||
AllPreferenceUpdate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
category: 'luna'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
61
src/views/profile/UserSettingUpdate/index.vue
Normal file
61
src/views/profile/UserSettingUpdate/index.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<GenericDetailPage :object.sync="user" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="user" @update:activeMenu="handleUpdate" />
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import LunaUpdate from './LunaUpdate'
|
||||
import KokoUpdate from './KokoUpdate'
|
||||
import LinaUpdate from './LinaUpdate'
|
||||
export default {
|
||||
components: {
|
||||
GenericDetailPage,
|
||||
LunaUpdate,
|
||||
KokoUpdate,
|
||||
LinaUpdate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
user: this.$store.state.users.profile,
|
||||
config: {
|
||||
title: this.$t('common.Basic'),
|
||||
activeMenu: 'LinaUpdate',
|
||||
submenu: this.getSubmenu(),
|
||||
hasRightSide: false,
|
||||
hasActivity: false,
|
||||
actions: {
|
||||
detailApiUrl: '/api/v1/users/preference/?category=luna'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getSubmenu() {
|
||||
return [
|
||||
{
|
||||
title: this.$t('common.Basic'),
|
||||
name: 'LinaUpdate'
|
||||
},
|
||||
{
|
||||
title: this.$t('users.LunaSettingUpdate'),
|
||||
name: 'LunaUpdate'
|
||||
},
|
||||
{
|
||||
title: this.$t('users.KokoSettingUpdate'),
|
||||
name: 'KokoUpdate'
|
||||
}
|
||||
]
|
||||
},
|
||||
handleUpdate(value) {
|
||||
this.config.activeMenu = value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
@@ -43,12 +43,6 @@ export default {
|
||||
[
|
||||
'TERMINAL_MAGNUS_ENABLED'
|
||||
]
|
||||
],
|
||||
[
|
||||
`Web ${comp}(Luna)`,
|
||||
[
|
||||
'TERMINAL_GRAPHICAL_RESOLUTION'
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
|
Reference in New Issue
Block a user