mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 14:25:23 +00:00
perf: 优化更新auth (#1018)
* perf: 优化更新auth * perf: 优化提交 Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -11,19 +11,20 @@
|
||||
:show-confirm="false"
|
||||
width="70%"
|
||||
v-on="$listeners"
|
||||
@confirm="onConfirm()"
|
||||
>
|
||||
<slot />
|
||||
<GenericCreateUpdateForm v-bind="iConfig" @submitSuccess="submitSuccess" />
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog'
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
export default {
|
||||
name: 'Base',
|
||||
components: {
|
||||
Dialog
|
||||
Dialog,
|
||||
GenericCreateUpdateForm
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
@@ -33,6 +34,14 @@ export default {
|
||||
value: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
enableField: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -40,8 +49,15 @@ export default {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iConfig() {
|
||||
return this.config
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onConfirm() {
|
||||
submitSuccess(res) {
|
||||
this.$emit('input', !!res[this.enableField])
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,19 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" :title="$t('setting.CASSetting')">
|
||||
<GenericCreateUpdateForm v-bind="settings" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
:title="$t('setting.CASSetting')"
|
||||
enable-field="AUTH_CAS"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
export default {
|
||||
name: 'Cas',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -21,7 +23,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=cas',
|
||||
fields: [
|
||||
|
@@ -1,18 +1,20 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" :title="$t('setting.DingTalk')">
|
||||
<GenericCreateUpdateForm v-bind="$data" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
:title="$t('setting.DingTalk')"
|
||||
enable-field="AUTH_DINGTALK"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
|
||||
export default {
|
||||
name: 'DingTalk',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -23,43 +25,45 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: '/api/v1/settings/setting/?category=dingtalk',
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.dingTalkTest'),
|
||||
callback: function(value, form) {
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/dingtalk/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
this.$log.error('err occur')
|
||||
})
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=dingtalk',
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.dingTalkTest'),
|
||||
callback: function(value, form) {
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/dingtalk/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
this.$log.error('err occur')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
fields: [
|
||||
[
|
||||
this.$t('common.BasicInfo'),
|
||||
],
|
||||
fields: [
|
||||
[
|
||||
'AUTH_DINGTALK', 'DINGTALK_AGENTID',
|
||||
'DINGTALK_APPKEY', 'DINGTALK_APPSECRET'
|
||||
this.$t('common.BasicInfo'),
|
||||
[
|
||||
'AUTH_DINGTALK', 'DINGTALK_AGENTID',
|
||||
'DINGTALK_APPKEY', 'DINGTALK_APPSECRET'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
hasDetailInMsg: false,
|
||||
submitMethod() {
|
||||
return 'put'
|
||||
},
|
||||
// 不清理的话,编辑secret,在删除提交会报错
|
||||
cleanFormValue(data) {
|
||||
if (!data['DINGTALK_APPSECRET']) {
|
||||
delete data['DINGTALK_APPSECRET']
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
hasDetailInMsg: false,
|
||||
submitMethod() {
|
||||
return 'put'
|
||||
},
|
||||
// 不清理的话,编辑secret,在删除提交会报错
|
||||
cleanFormValue(data) {
|
||||
if (!data['DINGTALK_APPSECRET']) {
|
||||
delete data['DINGTALK_APPSECRET']
|
||||
}
|
||||
return data
|
||||
}
|
||||
return data
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -1,18 +1,20 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" :title="$t('setting.FeiShu')">
|
||||
<GenericCreateUpdateForm v-bind="$data" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
:title="$t('setting.FeiShu')"
|
||||
enable-field="AUTH_FIESHU"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
|
||||
export default {
|
||||
name: 'Wecom',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -23,42 +25,44 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: '/api/v1/settings/setting/?category=feishu',
|
||||
hasDetailInMsg: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.feiShuTest'),
|
||||
callback: function(value, form) {
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/feishu/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
this.$log.error('err occur')
|
||||
})
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=feishu',
|
||||
hasDetailInMsg: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.feiShuTest'),
|
||||
callback: function(value, form) {
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/feishu/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
this.$log.error('err occur')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
fields: [
|
||||
[
|
||||
this.$t('common.BasicInfo'),
|
||||
],
|
||||
fields: [
|
||||
[
|
||||
'AUTH_FEISHU', 'FEISHU_APP_ID', 'FEISHU_APP_SECRET'
|
||||
this.$t('common.BasicInfo'),
|
||||
[
|
||||
'AUTH_FEISHU', 'FEISHU_APP_ID', 'FEISHU_APP_SECRET'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
// 不清理的话,编辑secret,在删除提交会报错
|
||||
cleanFormValue(data) {
|
||||
if (!data['FEISHU_APP_SECRET']) {
|
||||
delete data['FEISHU_APP_SECRET']
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
// 不清理的话,编辑secret,在删除提交会报错
|
||||
cleanFormValue(data) {
|
||||
if (!data['FEISHU_APP_SECRET']) {
|
||||
delete data['FEISHU_APP_SECRET']
|
||||
}
|
||||
return data
|
||||
},
|
||||
submitMethod() {
|
||||
return 'put'
|
||||
}
|
||||
return data
|
||||
},
|
||||
submitMethod() {
|
||||
return 'put'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -1,18 +1,20 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" title="OIDC">
|
||||
<GenericCreateUpdateForm v-bind="settings" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
title="OIDC"
|
||||
enable-field="AUTH_OPENID"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
|
||||
export default {
|
||||
name: 'OIDC',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -22,7 +24,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=oidc',
|
||||
fields: [
|
||||
|
@@ -1,17 +1,19 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" :title="$t('setting.Radius')">
|
||||
<GenericCreateUpdateForm v-bind="settings" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
:title="$t('setting.Radius')"
|
||||
enable-field="AUTH_RADIUS"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
export default {
|
||||
name: 'Cas',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -21,7 +23,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=radius',
|
||||
fields: [
|
||||
|
@@ -1,17 +1,19 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" :title="$t('setting.SSO')">
|
||||
<GenericCreateUpdateForm v-bind="settings" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
:title="$t('setting.SSO')"
|
||||
enable-field="AUTH_SSO"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
export default {
|
||||
name: 'SSO',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -21,7 +23,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=sso',
|
||||
fields: [
|
||||
|
@@ -1,18 +1,20 @@
|
||||
<template>
|
||||
<BaseAuth v-model="value" :title="$t('setting.WeCom')">
|
||||
<GenericCreateUpdateForm v-bind="$data" />
|
||||
</BaseAuth>
|
||||
<BaseAuth
|
||||
:value="value"
|
||||
:config="settings"
|
||||
:title="$t('setting.WeCom')"
|
||||
enable-field="AUTH_WECOM"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseAuth from './Base'
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
|
||||
export default {
|
||||
name: 'Wecom',
|
||||
name: 'WeCom',
|
||||
components: {
|
||||
BaseAuth,
|
||||
GenericCreateUpdateForm
|
||||
BaseAuth
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -23,43 +25,44 @@ export default {
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: '/api/v1/settings/setting/?category=wecom',
|
||||
hasDetailInMsg: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.weComTest'),
|
||||
callback: function(value, form) {
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/wecom/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
this.$log.error('err occur')
|
||||
})
|
||||
settings: {
|
||||
url: '/api/v1/settings/setting/?category=wecom',
|
||||
hasDetailInMsg: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('setting.weComTest'),
|
||||
callback: function(value, form) {
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/wecom/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
this.$log.error('err occur')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
fields: [
|
||||
[
|
||||
this.$t('common.BasicInfo'),
|
||||
],
|
||||
fields: [
|
||||
[
|
||||
'AUTH_WECOM', 'WECOM_CORPID', 'WECOM_AGENTID',
|
||||
'WECOM_SECRET'
|
||||
this.$t('common.BasicInfo'),
|
||||
[
|
||||
'AUTH_WECOM', 'WECOM_CORPID', 'WECOM_AGENTID', 'WECOM_SECRET'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
// 不清理的话,编辑secret,在删除提交会报错
|
||||
cleanFormValue(data) {
|
||||
if (!data['WECOM_SECRET']) {
|
||||
delete data['WECOM_SECRET']
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
// 不清理的话,编辑secret,在删除提交会报错
|
||||
cleanFormValue(data) {
|
||||
if (!data['WECOM_SECRET']) {
|
||||
delete data['WECOM_SECRET']
|
||||
}
|
||||
return data
|
||||
},
|
||||
submitMethod() {
|
||||
return 'patch'
|
||||
}
|
||||
return data
|
||||
},
|
||||
submitMethod() {
|
||||
return 'put'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user