forked from github/dataease
Merge pull request #10802 from dataease/pr@dev-v2@perf_default_login
perf(X-Pack): 默认登录方式配置过滤未开启的平台
This commit is contained in:
commit
dcadf78375
@ -230,7 +230,6 @@ onMounted(async () => {
|
||||
if (!checkPlatform()) {
|
||||
const res = await loginCategoryApi()
|
||||
if (res.data) {
|
||||
debugger
|
||||
loadingText.value = '加载中...'
|
||||
document.getElementsByClassName('ed-loading-text')?.length &&
|
||||
(document.getElementsByClassName('ed-loading-text')[0]['innerText'] = loadingText.value)
|
||||
|
@ -19,12 +19,7 @@ const pvpOptions = [
|
||||
{ value: '3', label: '三个月' },
|
||||
{ value: '4', label: '一个月' }
|
||||
]
|
||||
const loginOptions = [
|
||||
{ value: '0', label: '普通登录' },
|
||||
{ value: '1', label: 'LDAP' },
|
||||
{ value: '2', label: 'OIDC' },
|
||||
{ value: '3', label: 'CAS' }
|
||||
]
|
||||
|
||||
const state = reactive({
|
||||
form: reactive({
|
||||
dsIntervalTime: '30',
|
||||
@ -33,7 +28,13 @@ const state = reactive({
|
||||
}),
|
||||
settingList: [],
|
||||
orgOptions: [],
|
||||
roleOptions: []
|
||||
roleOptions: [],
|
||||
loginOptions: [
|
||||
{ value: '0', label: '普通登录' },
|
||||
{ value: '1', label: 'LDAP' },
|
||||
{ value: '2', label: 'OIDC' },
|
||||
{ value: '3', label: 'CAS' }
|
||||
]
|
||||
})
|
||||
|
||||
const rule = reactive<FormRules>({
|
||||
@ -117,9 +118,10 @@ const closeLoading = () => {
|
||||
loadingInstance.value?.close()
|
||||
}
|
||||
|
||||
const edit = (list, orgOptions, roleOptions) => {
|
||||
const edit = (list, orgOptions, roleOptions, loginOptions) => {
|
||||
state.orgOptions = orgOptions || []
|
||||
state.roleOptions = roleOptions || []
|
||||
state.loginOptions = loginOptions || []
|
||||
state.settingList = list.map(item => {
|
||||
const pkey = item.pkey
|
||||
if (pkey === 'basic.logLiveTime') {
|
||||
@ -331,7 +333,7 @@ defineExpose({
|
||||
</div>
|
||||
<div v-else-if="item.pkey === 'defaultLogin'">
|
||||
<el-radio-group v-model="state.form[item.pkey]">
|
||||
<el-radio v-for="item in loginOptions" :key="item.value" :label="item.value">
|
||||
<el-radio v-for="item in state.loginOptions" :key="item.value" :label="item.value">
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
|
@ -22,6 +22,7 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||
const { t } = useI18n()
|
||||
const editor = ref()
|
||||
const infoTemplate = ref()
|
||||
const showDefaultLogin = ref(false)
|
||||
const pvpOptions = [
|
||||
{ value: '0', label: '永久' },
|
||||
{ value: '1', label: '一年' },
|
||||
@ -29,12 +30,6 @@ const pvpOptions = [
|
||||
{ value: '3', label: '三个月' },
|
||||
{ value: '4', label: '一个月' }
|
||||
]
|
||||
const loginOptions = [
|
||||
{ value: '0', label: '普通登录' },
|
||||
{ value: '1', label: 'LDAP' },
|
||||
{ value: '2', label: 'OIDC' },
|
||||
{ value: '3', label: 'CAS' }
|
||||
]
|
||||
const tooltips = [
|
||||
{
|
||||
key: 'setting_basic.frontTimeOut',
|
||||
@ -65,6 +60,12 @@ const state = reactive({
|
||||
children: null,
|
||||
disabled: false
|
||||
}
|
||||
],
|
||||
loginOptions: [
|
||||
{ value: '0', label: '普通登录' },
|
||||
{ value: '1', label: 'LDAP' },
|
||||
{ value: '2', label: 'OIDC' },
|
||||
{ value: '3', label: 'CAS' }
|
||||
]
|
||||
})
|
||||
let originData = []
|
||||
@ -111,12 +112,27 @@ const search = cb => {
|
||||
selectedPvp.value = item.pval || '0'
|
||||
item.pval = pvpOptions.filter(cur => cur.value === selectedPvp.value)[0].label
|
||||
} else if (item.pkey === 'basic.defaultLogin') {
|
||||
item.pval = item.pval ? loginOptions[parseInt(item.pval)].label : loginOptions[0].label
|
||||
await queryCategoryStatus()
|
||||
if (showDefaultLogin.value) {
|
||||
if (item.pval) {
|
||||
const r = state.loginOptions.filter(cur => cur.value === item.pval)
|
||||
if (r?.length) {
|
||||
item.pval = r[0].label
|
||||
} else {
|
||||
item.pval = state.loginOptions[0].label
|
||||
resetDefaultLogin()
|
||||
}
|
||||
} else {
|
||||
item.pval = state.loginOptions[0].label
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.pval = item.pval
|
||||
}
|
||||
item.pkey = 'setting_' + item.pkey
|
||||
state.templateList.push(item)
|
||||
if (!item.pkey.includes('defaultLogin') || showDefaultLogin.value) {
|
||||
state.templateList.push(item)
|
||||
}
|
||||
}
|
||||
cb && cb()
|
||||
})
|
||||
@ -132,7 +148,8 @@ const edit = () => {
|
||||
editor?.value.edit(
|
||||
cloneDeep(originData),
|
||||
cloneDeep(state.orgOptions),
|
||||
cloneDeep(state.roleOptions)
|
||||
cloneDeep(state.roleOptions),
|
||||
cloneDeep(state.loginOptions)
|
||||
)
|
||||
}
|
||||
const loadOrgOptions = async () => {
|
||||
@ -181,4 +198,39 @@ const groupBy = list => {
|
||||
})
|
||||
return map
|
||||
}
|
||||
const queryCategoryStatus = async () => {
|
||||
const url = `/setting/authentication/status`
|
||||
const res = await request.get({ url })
|
||||
const data = res.data
|
||||
const map = data.reduce((acc, { name, enable }) => {
|
||||
acc[name] = enable
|
||||
return acc
|
||||
}, {})
|
||||
let len = state.loginOptions.length
|
||||
while (len--) {
|
||||
const item = state.loginOptions[len]
|
||||
if (item.value !== '0' && !map[item.label.toLocaleLowerCase()]) {
|
||||
state.loginOptions.splice(len, 1)
|
||||
}
|
||||
}
|
||||
showDefaultLogin.value = state.loginOptions.length > 1
|
||||
if (!showDefaultLogin.value) {
|
||||
let len = originData.length
|
||||
while (len--) {
|
||||
const item = originData[len]
|
||||
if (item.pkey === 'basic.defaultLogin') {
|
||||
originData.splice(len, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const resetDefaultLogin = () => {
|
||||
let len = originData.length
|
||||
while (len--) {
|
||||
const item = originData[len]
|
||||
if (item.pkey === 'basic.defaultLogin') {
|
||||
item.pval = '0'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 6e7664b9ff1dde971b833369f6d8fa590e0fa432
|
||||
Subproject commit d56a37a7307c202176e9cfd26c03f2cbed0cf515
|
Loading…
Reference in New Issue
Block a user