Skip to content

Commit 6cd2d99

Browse files
committed
feat(datasource): datasource manage
1 parent 16bf2dc commit 6cd2d99

File tree

9 files changed

+63
-47
lines changed

9 files changed

+63
-47
lines changed
Lines changed: 3 additions & 3 deletions
Loading

frontend/src/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@
306306
"add_successfully": "Add successfully",
307307
"member_management": "Member management",
308308
"permission_configuration": "Permission configuration",
309-
"set": "Set"
309+
"set": "Set",
310+
"operate_with_caution": "After deletion, the users under the workspace will be removed and all resources will be deleted. Please operate with caution."
310311
},
311312
"permission": {
312313
"search_rule_group": "Search rule group",

frontend/src/i18n/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@
327327
"add_successfully": "添加成功",
328328
"member_management": "成员管理",
329329
"permission_configuration": "权限配置",
330-
"set": "设置"
330+
"set": "设置",
331+
"operate_with_caution": "删除后,该工作空间下的用户将被移除,所有资源也将被删除,请谨慎操作。"
331332
},
332333
"permission": {
333334
"search_rule_group": "搜索规则组",

frontend/src/views/ds/DataTable.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ const refresh = () => {
140140
if (!nameArr.includes(currentTable.value.table_name)) {
141141
currentTable.value = {}
142142
}
143+
emits('refresh')
143144
})
144145
}
145146
@@ -173,7 +174,7 @@ const changeStatus = (row: any) => {
173174
})
174175
}
175176
176-
const emits = defineEmits(['back'])
177+
const emits = defineEmits(['back', 'refresh'])
177178
const back = () => {
178179
emits('back')
179180
}

frontend/src/views/ds/Datasource.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ const refresh = () => {
115115
search()
116116
}
117117
118+
const refreshData = () => {
119+
console.log(123)
120+
search()
121+
}
122+
118123
const panelClick = () => {
119124
console.log('panelClick')
120125
}
@@ -329,11 +334,17 @@ const back = () => {
329334
:active-name="activeName"
330335
:active-type="activeType"
331336
@refresh="refresh"
337+
@close="beforeClose"
332338
@change-active-step="(val: number) => (activeStep = val)"
333339
></DatasourceForm>
334340
</el-drawer>
335341
</div>
336-
<DataTable v-if="currentDataTable" :info="currentDataTable" @back="back"></DataTable>
342+
<DataTable
343+
v-if="currentDataTable"
344+
:info="currentDataTable"
345+
@refresh="refreshData"
346+
@back="back"
347+
></DataTable>
337348
</template>
338349

339350
<style lang="less" scoped>

frontend/src/views/ds/DatasourceForm.vue

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import icon_form_outlined from '@/assets/svg/icon_form_outlined.svg'
1111
import FixedSizeList from 'element-plus-secondary/es/components/virtual-list/src/components/fixed-size-list.mjs'
1212
import { Plus } from '@element-plus/icons-vue'
1313
import { useCache } from '@/utils/useCache'
14-
import { dsType, haveSchema } from '@/views/ds/js/ds-type'
14+
import { haveSchema } from '@/views/ds/js/ds-type'
1515
import { setSize } from '@/utils/utils'
1616
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
1717
import icon_fileExcel_colorful from '@/assets/datasource/icon_excel.png'
@@ -34,7 +34,7 @@ const props = withDefaults(
3434
3535
const { wsCache } = useCache()
3636
const dsFormRef = ref<FormInstance>()
37-
const emit = defineEmits(['refresh', 'changeActiveStep'])
37+
const emit = defineEmits(['refresh', 'changeActiveStep', 'close'])
3838
const isCreate = ref(true)
3939
const isEditTable = ref(false)
4040
const checkList = ref<any>([])
@@ -125,6 +125,7 @@ const close = () => {
125125
dialogVisible.value = false
126126
isCreate.value = true
127127
emit('changeActiveStep', 0)
128+
emit('close')
128129
isEditTable.value = false
129130
checkList.value = []
130131
tableList.value = []
@@ -548,21 +549,6 @@ defineExpose({
548549
type="textarea"
549550
/>
550551
</el-form-item>
551-
<el-form-item :label="t('ds.type')" prop="type">
552-
<el-select
553-
v-model="form.type"
554-
:placeholder="$t('datasource.Please_select') + $t('common.empty') + t('ds.type')"
555-
:disabled="!isCreate"
556-
>
557-
<el-option
558-
v-for="item in dsType"
559-
:key="item.value"
560-
:label="item.label"
561-
:value="item.value"
562-
/>
563-
</el-select>
564-
</el-form-item>
565-
566552
<div v-if="form.type !== 'excel'" style="margin-top: 16px">
567553
<el-form-item :label="t('ds.form.host')" prop="host">
568554
<el-input

frontend/src/views/system/model/ModelListSide.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const handleModelClick = (item: any) => {
4646
:class="activeName === ele.name && 'isActive'"
4747
@click="handleModelClick(ele)"
4848
>
49-
<img width="32px" height="32px" :src="ele.icon" />
49+
<img width="18px" height="18px" :src="ele.icon" />
5050
<span class="name">{{ ele.name }}</span>
5151
</div>
5252
<EmptyBackground

frontend/src/views/system/user/User.vue

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
<el-table-column prop="create_time" width="180" sortable :label="$t('user.creation_time')">
7676
<template #default="scope">
77-
<span>{{ formatTimestamp(scope.row.create_time) }}</span>
77+
<span>{{ formatTimestamp(scope.row.create_time, 'YYYY-MM-DD HH:mm:ss') }}</span>
7878
</template>
7979
</el-table-column>
8080
<el-table-column fixed="right" width="150" :label="$t('ds.actions')">
@@ -342,21 +342,23 @@ const filterOption = ref<any[]>([
342342
property: { placeholder: t('common.empty') + t('user.workspace') },
343343
},
344344
])
345+
346+
const defaultForm = {
347+
id: '',
348+
name: '',
349+
account: '',
350+
oid: 0,
351+
email: '',
352+
status: '',
353+
phoneNumber: '',
354+
oid_list: [],
355+
}
345356
const options = ref<any[]>([])
346357
const state = reactive<any>({
347358
tableData: [],
348359
filterTexts: [],
349360
conditions: [],
350-
form: {
351-
id: '',
352-
name: '',
353-
account: '',
354-
oid: 0,
355-
email: '',
356-
status: '',
357-
phoneNumber: '',
358-
oid_list: [],
359-
},
361+
form: { ...defaultForm },
360362
pageInfo: {
361363
currentPage: 1,
362364
pageSize: 20,
@@ -615,14 +617,19 @@ const search = () => {
615617
})
616618
}
617619
const addTerm = () => {
618-
userApi.add(state.form).then(() => {
619-
dialogFormVisible.value = false
620-
search()
621-
ElMessage({
622-
type: 'success',
623-
message: t('common.save_success'),
620+
userApi
621+
.add(state.form)
622+
.then(() => {
623+
dialogFormVisible.value = false
624+
search()
625+
ElMessage({
626+
type: 'success',
627+
message: t('common.save_success'),
628+
})
629+
})
630+
.finally(() => {
631+
state.form = { ...defaultForm }
624632
})
625-
})
626633
}
627634
const editTerm = () => {
628635
userApi.edit(state.form).then(() => {
@@ -720,7 +727,8 @@ onMounted(() => {
720727
.sqlbot-table {
721728
border-radius: 6px;
722729
width: 100%;
723-
max-height: calc(100vh - 200px);
730+
max-height: calc(100vh - 100px);
731+
overflow-y: auto;
724732
725733
&.is-filter {
726734
max-height: calc(100vh - 256px);

frontend/src/views/system/workspace/index.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ const currentTable = ref<any>({})
8787
const init = () => {
8888
workspaceList().then((res) => {
8989
tableList.value = res
90+
if (currentTable.value.id) {
91+
tableList.value.forEach((ele: any) => {
92+
if (ele.id === currentTable.value.id) {
93+
currentTable.value.name = ele.name
94+
}
95+
})
96+
}
9097
})
9198
}
9299
onMounted(() => {
@@ -119,7 +126,7 @@ const deleteBatchUser = () => {
119126
t('workspace.selected_2_members', { msg: multipleSelectionAll.value.length }),
120127
{
121128
confirmButtonType: 'danger',
122-
confirmButtonText: t('dashboard.delete'),
129+
confirmButtonText: t('workspace.remove'),
123130
cancelButtonText: t('common.cancel'),
124131
customClass: 'confirm-no_icon',
125132
autofocus: false,
@@ -141,7 +148,7 @@ const deleteBatchUser = () => {
141148
const deleteHandler = (row: any) => {
142149
ElMessageBox.confirm(t('workspace.member_feng_yibudao', { msg: row.name }), {
143150
confirmButtonType: 'danger',
144-
confirmButtonText: t('dashboard.delete'),
151+
confirmButtonText: t('workspace.remove'),
145152
cancelButtonText: t('common.cancel'),
146153
customClass: 'confirm-no_icon',
147154
autofocus: false,
@@ -231,6 +238,7 @@ const saveField = () => {
231238
const delWorkspace = (row: any) => {
232239
ElMessageBox.confirm(t('workspace.workspace_de_workspace', { msg: row.name }), {
233240
confirmButtonType: 'danger',
241+
tip: t('workspace.operate_with_caution'),
234242
confirmButtonText: t('dashboard.delete'),
235243
cancelButtonText: t('common.cancel'),
236244
customClass: 'confirm-no_icon',
@@ -533,7 +541,7 @@ const handleCurrentChange = (val: number) => {
533541
</el-form>
534542

535543
<div style="display: flex; justify-content: flex-end; margin-top: 20px">
536-
<el-button @click="closeField">{{ t('common.cancel') }}</el-button>
544+
<el-button secondary @click="closeField">{{ t('common.cancel') }}</el-button>
537545
<el-button type="primary" @click="saveField">{{
538546
t(workspaceForm.id ? 'common.save' : 'model.add')
539547
}}</el-button>

0 commit comments

Comments
 (0)