mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
feat(datasource): datasource manage
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.25 9.75H6.75C4.67893 9.75 2.25 11.1986 2.25 13.8V15.825C2.25 16.1978 2.58579 16.5 3 16.5H15C15.4142 16.5 15.75 16.1978 15.75 15.825V13.8C15.75 11.1964 13.3211 9.75 11.25 9.75Z" fill="#1CBA90"/>
|
||||
<path d="M5.25 5.25C5.25 7.32107 6.92893 9 9 9C11.0711 9 12.75 7.32107 12.75 5.25C12.75 3.17893 11.0711 1.5 9 1.5C6.92893 1.5 5.25 3.17893 5.25 5.25Z" fill="#1CBA90"/>
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.25 9.75H6.75C4.67893 9.75 2.25 11.1986 2.25 13.8V15.825C2.25 16.1978 2.58579 16.5 3 16.5H15C15.4142 16.5 15.75 16.1978 15.75 15.825V13.8C15.75 11.1964 13.3211 9.75 11.25 9.75Z" />
|
||||
<path d="M5.25 5.25C5.25 7.32107 6.92893 9 9 9C11.0711 9 12.75 7.32107 12.75 5.25C12.75 3.17893 11.0711 1.5 9 1.5C6.92893 1.5 5.25 3.17893 5.25 5.25Z" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 438 B |
@@ -306,7 +306,8 @@
|
||||
"add_successfully": "Add successfully",
|
||||
"member_management": "Member management",
|
||||
"permission_configuration": "Permission configuration",
|
||||
"set": "Set"
|
||||
"set": "Set",
|
||||
"operate_with_caution": "After deletion, the users under the workspace will be removed and all resources will be deleted. Please operate with caution."
|
||||
},
|
||||
"permission": {
|
||||
"search_rule_group": "Search rule group",
|
||||
|
||||
@@ -327,7 +327,8 @@
|
||||
"add_successfully": "添加成功",
|
||||
"member_management": "成员管理",
|
||||
"permission_configuration": "权限配置",
|
||||
"set": "设置"
|
||||
"set": "设置",
|
||||
"operate_with_caution": "删除后,该工作空间下的用户将被移除,所有资源也将被删除,请谨慎操作。"
|
||||
},
|
||||
"permission": {
|
||||
"search_rule_group": "搜索规则组",
|
||||
|
||||
@@ -140,6 +140,7 @@ const refresh = () => {
|
||||
if (!nameArr.includes(currentTable.value.table_name)) {
|
||||
currentTable.value = {}
|
||||
}
|
||||
emits('refresh')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -173,7 +174,7 @@ const changeStatus = (row: any) => {
|
||||
})
|
||||
}
|
||||
|
||||
const emits = defineEmits(['back'])
|
||||
const emits = defineEmits(['back', 'refresh'])
|
||||
const back = () => {
|
||||
emits('back')
|
||||
}
|
||||
|
||||
@@ -115,6 +115,11 @@ const refresh = () => {
|
||||
search()
|
||||
}
|
||||
|
||||
const refreshData = () => {
|
||||
console.log(123)
|
||||
search()
|
||||
}
|
||||
|
||||
const panelClick = () => {
|
||||
console.log('panelClick')
|
||||
}
|
||||
@@ -329,11 +334,17 @@ const back = () => {
|
||||
:active-name="activeName"
|
||||
:active-type="activeType"
|
||||
@refresh="refresh"
|
||||
@close="beforeClose"
|
||||
@change-active-step="(val: number) => (activeStep = val)"
|
||||
></DatasourceForm>
|
||||
</el-drawer>
|
||||
</div>
|
||||
<DataTable v-if="currentDataTable" :info="currentDataTable" @back="back"></DataTable>
|
||||
<DataTable
|
||||
v-if="currentDataTable"
|
||||
:info="currentDataTable"
|
||||
@refresh="refreshData"
|
||||
@back="back"
|
||||
></DataTable>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -11,7 +11,7 @@ import icon_form_outlined from '@/assets/svg/icon_form_outlined.svg'
|
||||
import FixedSizeList from 'element-plus-secondary/es/components/virtual-list/src/components/fixed-size-list.mjs'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { useCache } from '@/utils/useCache'
|
||||
import { dsType, haveSchema } from '@/views/ds/js/ds-type'
|
||||
import { haveSchema } from '@/views/ds/js/ds-type'
|
||||
import { setSize } from '@/utils/utils'
|
||||
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
|
||||
import icon_fileExcel_colorful from '@/assets/datasource/icon_excel.png'
|
||||
@@ -34,7 +34,7 @@ const props = withDefaults(
|
||||
|
||||
const { wsCache } = useCache()
|
||||
const dsFormRef = ref<FormInstance>()
|
||||
const emit = defineEmits(['refresh', 'changeActiveStep'])
|
||||
const emit = defineEmits(['refresh', 'changeActiveStep', 'close'])
|
||||
const isCreate = ref(true)
|
||||
const isEditTable = ref(false)
|
||||
const checkList = ref<any>([])
|
||||
@@ -125,6 +125,7 @@ const close = () => {
|
||||
dialogVisible.value = false
|
||||
isCreate.value = true
|
||||
emit('changeActiveStep', 0)
|
||||
emit('close')
|
||||
isEditTable.value = false
|
||||
checkList.value = []
|
||||
tableList.value = []
|
||||
@@ -548,21 +549,6 @@ defineExpose({
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('ds.type')" prop="type">
|
||||
<el-select
|
||||
v-model="form.type"
|
||||
:placeholder="$t('datasource.Please_select') + $t('common.empty') + t('ds.type')"
|
||||
:disabled="!isCreate"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dsType"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="form.type !== 'excel'" style="margin-top: 16px">
|
||||
<el-form-item :label="t('ds.form.host')" prop="host">
|
||||
<el-input
|
||||
|
||||
@@ -46,7 +46,7 @@ const handleModelClick = (item: any) => {
|
||||
:class="activeName === ele.name && 'isActive'"
|
||||
@click="handleModelClick(ele)"
|
||||
>
|
||||
<img width="32px" height="32px" :src="ele.icon" />
|
||||
<img width="18px" height="18px" :src="ele.icon" />
|
||||
<span class="name">{{ ele.name }}</span>
|
||||
</div>
|
||||
<EmptyBackground
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
<el-table-column prop="create_time" width="180" sortable :label="$t('user.creation_time')">
|
||||
<template #default="scope">
|
||||
<span>{{ formatTimestamp(scope.row.create_time) }}</span>
|
||||
<span>{{ formatTimestamp(scope.row.create_time, 'YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" width="150" :label="$t('ds.actions')">
|
||||
@@ -342,21 +342,23 @@ const filterOption = ref<any[]>([
|
||||
property: { placeholder: t('common.empty') + t('user.workspace') },
|
||||
},
|
||||
])
|
||||
|
||||
const defaultForm = {
|
||||
id: '',
|
||||
name: '',
|
||||
account: '',
|
||||
oid: 0,
|
||||
email: '',
|
||||
status: '',
|
||||
phoneNumber: '',
|
||||
oid_list: [],
|
||||
}
|
||||
const options = ref<any[]>([])
|
||||
const state = reactive<any>({
|
||||
tableData: [],
|
||||
filterTexts: [],
|
||||
conditions: [],
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
account: '',
|
||||
oid: 0,
|
||||
email: '',
|
||||
status: '',
|
||||
phoneNumber: '',
|
||||
oid_list: [],
|
||||
},
|
||||
form: { ...defaultForm },
|
||||
pageInfo: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
@@ -615,14 +617,19 @@ const search = () => {
|
||||
})
|
||||
}
|
||||
const addTerm = () => {
|
||||
userApi.add(state.form).then(() => {
|
||||
dialogFormVisible.value = false
|
||||
search()
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: t('common.save_success'),
|
||||
userApi
|
||||
.add(state.form)
|
||||
.then(() => {
|
||||
dialogFormVisible.value = false
|
||||
search()
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: t('common.save_success'),
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
state.form = { ...defaultForm }
|
||||
})
|
||||
})
|
||||
}
|
||||
const editTerm = () => {
|
||||
userApi.edit(state.form).then(() => {
|
||||
@@ -720,7 +727,8 @@ onMounted(() => {
|
||||
.sqlbot-table {
|
||||
border-radius: 6px;
|
||||
width: 100%;
|
||||
max-height: calc(100vh - 200px);
|
||||
max-height: calc(100vh - 100px);
|
||||
overflow-y: auto;
|
||||
|
||||
&.is-filter {
|
||||
max-height: calc(100vh - 256px);
|
||||
|
||||
@@ -87,6 +87,13 @@ const currentTable = ref<any>({})
|
||||
const init = () => {
|
||||
workspaceList().then((res) => {
|
||||
tableList.value = res
|
||||
if (currentTable.value.id) {
|
||||
tableList.value.forEach((ele: any) => {
|
||||
if (ele.id === currentTable.value.id) {
|
||||
currentTable.value.name = ele.name
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
@@ -119,7 +126,7 @@ const deleteBatchUser = () => {
|
||||
t('workspace.selected_2_members', { msg: multipleSelectionAll.value.length }),
|
||||
{
|
||||
confirmButtonType: 'danger',
|
||||
confirmButtonText: t('dashboard.delete'),
|
||||
confirmButtonText: t('workspace.remove'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
customClass: 'confirm-no_icon',
|
||||
autofocus: false,
|
||||
@@ -141,7 +148,7 @@ const deleteBatchUser = () => {
|
||||
const deleteHandler = (row: any) => {
|
||||
ElMessageBox.confirm(t('workspace.member_feng_yibudao', { msg: row.name }), {
|
||||
confirmButtonType: 'danger',
|
||||
confirmButtonText: t('dashboard.delete'),
|
||||
confirmButtonText: t('workspace.remove'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
customClass: 'confirm-no_icon',
|
||||
autofocus: false,
|
||||
@@ -231,6 +238,7 @@ const saveField = () => {
|
||||
const delWorkspace = (row: any) => {
|
||||
ElMessageBox.confirm(t('workspace.workspace_de_workspace', { msg: row.name }), {
|
||||
confirmButtonType: 'danger',
|
||||
tip: t('workspace.operate_with_caution'),
|
||||
confirmButtonText: t('dashboard.delete'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
customClass: 'confirm-no_icon',
|
||||
@@ -533,7 +541,7 @@ const handleCurrentChange = (val: number) => {
|
||||
</el-form>
|
||||
|
||||
<div style="display: flex; justify-content: flex-end; margin-top: 20px">
|
||||
<el-button @click="closeField">{{ t('common.cancel') }}</el-button>
|
||||
<el-button secondary @click="closeField">{{ t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="saveField">{{
|
||||
t(workspaceForm.id ? 'common.save' : 'model.add')
|
||||
}}</el-button>
|
||||
|
||||
Reference in New Issue
Block a user