mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +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 DataTable from '@/components/Table/DataTable/index.vue'
|
||||||
import { getUpdateObjURL } from '@/utils/common'
|
import { getUpdateObjURL } from '@/utils/common'
|
||||||
import { sleep } from '@/utils/time'
|
import { sleep } from '@/utils/time'
|
||||||
import { EditableInputFormatter, StatusFormatter } from '@/components/Table/TableFormatters'
|
import { EditableInputFormatter } from '@/components/Table/TableFormatters'
|
||||||
import { encryptPassword } from '@/utils/crypto'
|
import { encryptPassword } from '@/utils/crypto'
|
||||||
|
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ImportTable',
|
name: 'ImportTable',
|
||||||
@@ -223,38 +224,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
generateTableColumns(tableTitles, tableData) {
|
generateTableColumns(tableTitles, tableData) {
|
||||||
const vm = this
|
const columns = [{ ...getStatusColumnMeta.bind(this)().status }]
|
||||||
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
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
for (const item of tableTitles) {
|
for (const item of tableTitles) {
|
||||||
const dataItemLens = tableData.map(d => {
|
const dataItemLens = tableData.map(d => {
|
||||||
if (!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 ListTable from '@/components/Table/ListTable/index.vue'
|
||||||
import Dialog from '@/components/Dialog/index.vue'
|
import Dialog from '@/components/Dialog/index.vue'
|
||||||
import Select2 from '@/components/Form/FormFields/Select2.vue'
|
import Select2 from '@/components/Form/FormFields/Select2.vue'
|
||||||
|
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ImportDialog',
|
name: 'ImportDialog',
|
||||||
@@ -76,8 +77,9 @@ export default {
|
|||||||
},
|
},
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/settings/ldap/users/',
|
url: '/api/v1/settings/ldap/users/',
|
||||||
columns: ['username', 'name', 'email', 'groups', 'existing'],
|
columns: ['status', 'username', 'name', 'email', 'groups', 'existing'],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
|
...getStatusColumnMeta.bind(this)('status'),
|
||||||
username: {
|
username: {
|
||||||
label: this.$t('Username'),
|
label: this.$t('Username'),
|
||||||
width: '180px'
|
width: '180px'
|
||||||
|
Reference in New Issue
Block a user