diff --git a/frontend/src/api/system/datasource.js b/frontend/src/api/system/datasource.js index a8deddbff8..ab1d5632d7 100644 --- a/frontend/src/api/system/datasource.js +++ b/frontend/src/api/system/datasource.js @@ -8,7 +8,13 @@ export function dsGrid(pageIndex, pageSize, data) { data }) } - +export function listDatasource() { + return request({ + url: '/datasource/list', + loading: true, + method: 'get' + }) +} export function addDs(data) { return request({ url: 'datasource/add/', @@ -40,4 +46,4 @@ export function validateDs(data) { }) } -export default { dsGrid, addDs, editDs, delDs, validateDs } +export default { dsGrid, addDs, editDs, delDs, validateDs, listDatasource } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 1349a155ad..906dbb0188 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -846,6 +846,8 @@ export default { }, datasource: { datasource: 'Data Source', + please_select_left: 'Please select the data source from the left', + show_info: 'Data Source Info', create: 'Create Data Source', type: 'Type', please_choose_type: 'Please select data source type', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index ba0583b0d1..cf95db7d2d 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -846,6 +846,8 @@ export default { }, datasource: { datasource: '數據源', + please_select_left: '請從左側選擇數據源', + show_info: '數據源信息', create: '新建數據源', type: '類型', please_choose_type: '請選擇數據源類型', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 11b1923e91..8e7ee2d1dd 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -846,6 +846,8 @@ export default { }, datasource: { datasource: '数据源', + please_select_left: '请从左侧选择数据源', + show_info: '数据源信息', create: '新建数据源', type: '类型', please_choose_type: '请选择数据源类型', diff --git a/frontend/src/views/system/datasource/DataHome.vue b/frontend/src/views/system/datasource/DataHome.vue new file mode 100644 index 0000000000..a24fb7af49 --- /dev/null +++ b/frontend/src/views/system/datasource/DataHome.vue @@ -0,0 +1,25 @@ + + + + {{ $t('datasource.please_select_left') }} + + + + + + + diff --git a/frontend/src/views/system/datasource/DsMain.vue b/frontend/src/views/system/datasource/DsMain.vue new file mode 100644 index 0000000000..bf6f188c75 --- /dev/null +++ b/frontend/src/views/system/datasource/DsMain.vue @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + diff --git a/frontend/src/views/system/datasource/DsTree.vue b/frontend/src/views/system/datasource/DsTree.vue new file mode 100644 index 0000000000..085cacbca5 --- /dev/null +++ b/frontend/src/views/system/datasource/DsTree.vue @@ -0,0 +1,207 @@ + + + + + + {{ $t('commons.datasource') }} + + + + + + + + + + + + + + + {{ data.name }} + + + + + + + + + + + + + + + + {{ $t('panel.edit') }} + + + + {{ $t('panel.delete') }} + + + + + + + + + + + + + + diff --git a/frontend/src/views/system/datasource/form.vue b/frontend/src/views/system/datasource/form.vue index b1319ba5d4..ad8cb70cb0 100644 --- a/frontend/src/views/system/datasource/form.vue +++ b/frontend/src/views/system/datasource/form.vue @@ -1,6 +1,10 @@ - - + + + + {{ params && params.id && params.showModel && params.showModel === 'show' ? $t('datasource.show_info') : formType=='add' ? $t('datasource.create') : $t('datasource.modify') }} + + @@ -35,7 +39,7 @@ - + {{ $t('commons.validate') }} {{ $t('commons.save') }} @@ -48,8 +52,14 @@ import LayoutContent from '@/components/business/LayoutContent' import { addDs, editDs, validateDs } from '@/api/system/datasource' export default { - + name: 'DsForm', components: { LayoutContent }, + props: { + params: { + type: Object, + default: null + } + }, data() { return { form: { configuration: {}}, @@ -71,13 +81,27 @@ export default { }, created() { - if (this.$router.currentRoute.params && this.$router.currentRoute.params.id) { - const row = this.$router.currentRoute.params + // if (this.$router.currentRoute.params && this.$router.currentRoute.params.id) { + // const row = this.$router.currentRoute.params + // this.edit(row) + // } else { + // this.create() + // } + if (this.params && this.params.id) { + const row = this.params this.edit(row) } else { this.create() } }, + mounted() { + // if (this.params && this.params.type) { + // this.form.type = this.params.type + // this.$nextTick(() => { + // this.changeType() + // }) + // } + }, methods: { create() { this.formType = 'add' @@ -100,6 +124,7 @@ export default { form.configuration = JSON.stringify(form.configuration) method(form).then(res => { this.$success(this.$t('commons.save_success')) + this.refreshTree() this.backToList() }) } else { @@ -129,8 +154,26 @@ export default { } }, backToList() { - this.$router.push({ name: 'datasource' }) + this.$emit('switch-component', { }) + // this.$router.push({ name: 'datasource' }) + }, + refreshTree() { + this.$emit('refresh-left-tree') } } } + diff --git a/frontend/src/views/system/datasource/index.vue b/frontend/src/views/system/datasource/index.vue index 35aad5728d..8dce7dc8d3 100644 --- a/frontend/src/views/system/datasource/index.vue +++ b/frontend/src/views/system/datasource/index.vue @@ -1,286 +1,46 @@ - - - - - - {{ $t('datasource.create') }} - - - - - - - - MySQL - SQL Server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/frontend/src/views/system/datasource/index2.vue b/frontend/src/views/system/datasource/index2.vue new file mode 100644 index 0000000000..35aad5728d --- /dev/null +++ b/frontend/src/views/system/datasource/index2.vue @@ -0,0 +1,286 @@ + + + + + + + {{ $t('datasource.create') }} + + + + + + + + MySQL + SQL Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +