Skip to content

Commit 4a0104c

Browse files
committed
feat(datasource): sort
1 parent ce0ed8f commit 4a0104c

5 files changed

Lines changed: 23 additions & 22 deletions

File tree

frontend/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"type": "Data Source Type",
8585
"status": "Status",
8686
"actions": "Actions",
87+
"local_excelcsv": "Local Excel/CSV",
8788
"pieces_in_total": "Showing {ms} records",
8889
"test_connection": "Test Connection",
8990
"check": "check",

frontend/src/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
},
8787
"ds": {
8888
"title": "数据源",
89+
"local_excelcsv": "本地 Excel/CSV",
8990
"add": "添加数据源",
9091
"delete": "删除数据源",
9192
"name": "数据源名称",

frontend/src/views/ds/Datasource.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { datasourceApi } from '@/api/datasource'
1616
import { useEmitt } from '@/utils/useEmitt'
1717
import Card from './Card.vue'
1818
import DelMessageBox from './DelMessageBox.vue'
19-
import { dsTypeWithImgSort } from './js/ds-type'
19+
import { dsTypeWithImg } from './js/ds-type'
2020
import { useI18n } from 'vue-i18n'
2121
2222
interface Datasource {
@@ -41,7 +41,7 @@ const activeType = ref('')
4141
const datasourceFormRef = ref()
4242
4343
const datasourceList = shallowRef([] as Datasource[])
44-
const defaultDatasourceList = shallowRef(dsTypeWithImgSort as (Datasource & { img: string })[])
44+
const defaultDatasourceList = shallowRef(dsTypeWithImg as (Datasource & { img: string })[])
4545
4646
const currentDefaultDatasource = ref('')
4747
const datasourceListWithSearch = computed(() => {

frontend/src/views/ds/DatasourceForm.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,19 @@ defineExpose({
460460
class="model-form"
461461
:class="(!isCreate || activeStep === 2) && 'edit-form'"
462462
>
463-
<div v-if="isCreate && activeStep !== 2" class="model-name">{{ activeName }}</div>
463+
<div v-if="isCreate && activeStep !== 2" class="model-name">
464+
{{ activeName }}
465+
<span
466+
style="margin-left: 8px; color: #8f959e; font-size: 12px; margin-top: 7px"
467+
v-if="form.type !== 'excel'"
468+
>
469+
<span>{{ t('ds.form.support_version') }}:&nbsp;</span>
470+
<span v-if="form.type === 'sqlServer'">2012+</span>
471+
<span v-else-if="form.type === 'oracle'">12+</span>
472+
<span v-else-if="form.type === 'mysql'">5.6+</span>
473+
<span v-else-if="form.type === 'pg'">9.6+</span>
474+
</span>
475+
</div>
464476
<div class="form-content">
465477
<el-form
466478
v-show="activeStep === 1"
@@ -550,13 +562,6 @@ defineExpose({
550562
/>
551563
</el-select>
552564
</el-form-item>
553-
<span v-if="form.type !== 'excel'">
554-
<span>{{ t('ds.form.support_version') }}:&nbsp;</span>
555-
<span v-if="form.type === 'sqlServer'">2012+</span>
556-
<span v-else-if="form.type === 'oracle'">12+</span>
557-
<span v-else-if="form.type === 'mysql'">5.6+</span>
558-
<span v-else-if="form.type === 'pg'">9.6+</span>
559-
</span>
560565

561566
<div v-if="form.type !== 'excel'" style="margin-top: 16px">
562567
<el-form-item :label="t('ds.form.host')" prop="host">

frontend/src/views/ds/js/ds-type.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,22 @@ import excel from '@/assets/datasource/icon_excel.png'
33
import oracle from '@/assets/datasource/icon_oracle.png'
44
import pg from '@/assets/datasource/icon_PostgreSQL.png'
55
import sqlServer from '@/assets/datasource/icon_SQL_Server.png'
6+
import { i18n } from '@/i18n'
67

8+
const t = i18n.global.t
79
export const dsType = [
10+
{ label: t('ds.local_excelcsv'), value: 'excel' },
811
{ label: 'MySQL', value: 'mysql' },
9-
{ label: 'PostgreSQL', value: 'pg' },
10-
{ label: 'Microsoft SQL Server', value: 'sqlServer' },
1112
{ label: 'Oracle', value: 'oracle' },
12-
{ label: 'Excel/CSV', value: 'excel' },
13+
{ label: 'PostgreSQL', value: 'pg' },
14+
{ label: 'SQL Server', value: 'sqlServer' },
1315
]
1416

1517
export const dsTypeWithImg = [
16-
{ name: '本地 Excel/CSV', type: 'excel', img: excel },
18+
{ name: t('ds.local_excelcsv'), type: 'excel', img: excel },
1719
{ name: 'MySQL', type: 'mysql', img: mysql_ds },
18-
{ name: 'SQL Server', type: 'sqlServer', img: sqlServer },
1920
{ name: 'Oracle', type: 'oracle', img: oracle },
2021
{ name: 'PostgreSQL', type: 'pg', img: pg },
21-
]
22-
23-
export const dsTypeWithImgSort = [
24-
{ name: '本地 Excel/CSV', type: 'excel', img: excel },
25-
{ name: 'PostgreSQL', type: 'pg', img: pg },
26-
{ name: 'Oracle', type: 'oracle', img: oracle },
27-
{ name: 'MySQL', type: 'mysql', img: mysql_ds },
2822
{ name: 'SQL Server', type: 'sqlServer', img: sqlServer },
2923
]
3024

0 commit comments

Comments
 (0)