mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-18 08:12:33 +00:00
perf: ldap import user error msg (#4333)
* perf: ldap import user error msg * fix: Duplication on new code --------- Co-authored-by: wangruidong <940853815@qq.com>
This commit is contained in:
@@ -44,8 +44,9 @@
|
||||
import DataTable from '@/components/Table/DataTable/index.vue'
|
||||
import { getUpdateObjURL } from '@/utils/common'
|
||||
import { sleep } from '@/utils/time'
|
||||
import { EditableInputFormatter, StatusFormatter } from '@/components/Table/TableFormatters'
|
||||
import { EditableInputFormatter } from '@/components/Table/TableFormatters'
|
||||
import { encryptPassword } from '@/utils/crypto'
|
||||
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
|
||||
|
||||
export default {
|
||||
name: 'ImportTable',
|
||||
@@ -223,38 +224,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
generateTableColumns(tableTitles, tableData) {
|
||||
const vm = this
|
||||
const columns = [{
|
||||
prop: '@status',
|
||||
label: vm.$t('Status'),
|
||||
width: '80px',
|
||||
align: 'center',
|
||||
formatter: StatusFormatter,
|
||||
formatterArgs: {
|
||||
faChoices: {
|
||||
ok: 'fa-check text-primary',
|
||||
error: 'fa-times text-danger',
|
||||
pending: 'fa-clock-o'
|
||||
},
|
||||
getChoicesKey(val) {
|
||||
if (val === 'ok' || val === 'pending') {
|
||||
return val
|
||||
}
|
||||
return 'error'
|
||||
},
|
||||
getTip(val) {
|
||||
if (val === 'ok') {
|
||||
return vm.$t('Success')
|
||||
} else if (val === 'pending') {
|
||||
return vm.$t('Pending')
|
||||
} else if (val && val.name === 'error') {
|
||||
return val.error
|
||||
}
|
||||
return ''
|
||||
},
|
||||
hasTips: true
|
||||
}
|
||||
}]
|
||||
const columns = [{ ...getStatusColumnMeta.bind(this)().status }]
|
||||
for (const item of tableTitles) {
|
||||
const dataItemLens = tableData.map(d => {
|
||||
if (!d) {
|
||||
|
40
src/components/Table/ListTable/TableAction/const.js
Normal file
40
src/components/Table/ListTable/TableAction/const.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { StatusFormatter } from '@/components/Table/TableFormatters'
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
export const getStatusColumnMeta = (prop = '@status') => {
|
||||
return {
|
||||
status: {
|
||||
prop: prop,
|
||||
label: i18n.t('Status'),
|
||||
width: '80px',
|
||||
align: 'center',
|
||||
formatter: StatusFormatter,
|
||||
formatterArgs: {
|
||||
faChoices: {
|
||||
ok: 'fa-check text-primary',
|
||||
error: 'fa-times text-danger',
|
||||
pending: 'fa-clock-o'
|
||||
},
|
||||
getChoicesKey: (val) => {
|
||||
if (val === 'ok' || val === 'pending') {
|
||||
return val
|
||||
}
|
||||
return 'error'
|
||||
},
|
||||
getTip: (val) => {
|
||||
if (val === 'ok') {
|
||||
return i18n.t('Success')
|
||||
} else if (val === 'pending') {
|
||||
return i18n.t('Pending')
|
||||
} else if ((val && val.name === 'error') || val.error !== undefined) {
|
||||
return val.error
|
||||
}
|
||||
return ''
|
||||
},
|
||||
hasTips: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default getStatusColumnMeta
|
@@ -49,6 +49,7 @@ import { DEFAULT_ORG_ID, SYSTEM_ORG_ID } from '@/utils/org'
|
||||
import ListTable from '@/components/Table/ListTable/index.vue'
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import Select2 from '@/components/Form/FormFields/Select2.vue'
|
||||
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
|
||||
|
||||
export default {
|
||||
name: 'ImportDialog',
|
||||
@@ -76,8 +77,9 @@ export default {
|
||||
},
|
||||
tableConfig: {
|
||||
url: '/api/v1/settings/ldap/users/',
|
||||
columns: ['username', 'name', 'email', 'groups', 'existing'],
|
||||
columns: ['status', 'username', 'name', 'email', 'groups', 'existing'],
|
||||
columnsMeta: {
|
||||
...getStatusColumnMeta.bind(this)('status'),
|
||||
username: {
|
||||
label: this.$t('Username'),
|
||||
width: '180px'
|
||||
|
Reference in New Issue
Block a user