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