[Web] Templates are not supported for adding data sources

This commit is contained in:
qianmoQ 2023-01-11 10:06:49 +08:00
parent 4c022a0bec
commit 10e82ab571
5 changed files with 69 additions and 10 deletions

View File

@ -0,0 +1,55 @@
<template>
<div>
<Result type="error">
<template #desc>
{{ $t('alert.currentSourceNotSupportOperator') }}
</template>
<template #extra>
<div>{{ $t('alert.currentSourceFixedTooltip') }}:</div>
<div>
<Icon type="md-bulb" color="blue"/>
{{ $t('alert.currentSourceFixedTooltipStep1') }}
<a class="ivu-ml-16" target="_blank" href="https://github.com/EdurtIO/incubator-datacap/issues/new/choose">
Go
<Icon type="ios-arrow-forward"/>
</a>
</div>
<div>
<Icon type="md-bulb" color="blue"/>
{{ $t('alert.currentSourceFixedTooltipStep2') }}
<a class="ivu-ml-16">
<router-link to="/admin/template/sql">
Go
<Icon type="ios-arrow-forward"/>
</router-link>
</a>
</div>
<div>
<Icon type="md-bulb" color="blue"/>
{{ $t('alert.currentTemplateName') }}
<a class="ivu-ml-16">
<router-link to="/admin/template/sql">
Go
<Icon type="ios-arrow-forward"/>
</router-link>
</a>
<p v-for="name in templateName" v-bind:key="name" style="margin-left: 20px;">{{ name }}</p>
</div>
</template>
</Result>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
export default defineComponent({
name: "SourceNotSupported",
props: {
templateName: {
type: Array,
default: () => []
}
}
});
</script>

View File

@ -5,5 +5,6 @@ export default {
currentSourceFixedTooltip: 'You can solve it by',
currentSourceFixedTooltipStep1: 'Contact the developer to support this feature',
currentSourceFixedTooltipStep2: 'Add template SQL suitable for the data source according to the current data source',
managerRequiredTreeData: 'Please select the corresponding database table on the left'
managerRequiredTreeData: 'Please select the corresponding database table on the left',
currentTemplateName: 'Current template name'
}

View File

@ -5,5 +5,6 @@ export default {
currentSourceFixedTooltip: '您可以通过以下方式来解决',
currentSourceFixedTooltipStep1: '联系开发者支持该功能',
currentSourceFixedTooltipStep2: '根据当前数据源添加适合该数据源的模版SQL',
managerRequiredTreeData: '请在左侧选择对应数据库表'
managerRequiredTreeData: '请在左侧选择对应数据库表',
currentTemplateName: '当前模版名称'
}

View File

@ -1,6 +1,6 @@
<template>
<div>
<Affix :offset-bottom="20">
<Affix :offset-bottom="20" style="width: 200px; float: right;">
<Dropdown class="datacap-affix">
<Button type="primary" shape="circle" icon="ios-apps"></Button>
<template #list>

View File

@ -1,10 +1,6 @@
<template>
<div>
<Result v-if="!isSupported" type="error" style="margin-top: 50px;">
<template #desc>
{{ $t('alert.currentSourceNotSupportOperator') }}
</template>
</Result>
<SourceNotSupported v-if="!isSupported" :templateName="templateArray" style="margin-top: 50px;"></SourceNotSupported>
<div v-else>
<Layout :style="{padding: '0', 'min-height': '500px'}">
<Sider hide-trigger :style="{background: '#fff'}">
@ -42,12 +38,12 @@
<Icon type="md-apps"></Icon>
{{ currentTable }}
</template>
<Table ref="selection" :loading="dataLoading" :columns="headers" :data="columns"></Table>
<Table ref="selection" :loading="dataLoading" size="small" :columns="headers" :data="columns"></Table>
<div v-if="!dataLoading" style="text-align: center; margin: 5px 0;">
<Space>
<Button :disabled="page === 0" size="small" icon="md-arrow-back" @click="handlerChangePage(false)"/>
<InputNumber v-model="currentPage" size="small"/>
<Button size="small" icon="md-arrow-forward" @click="handlerChangePage(true)"/>
<Button :disabled="columns.length < size" size="small" icon="md-arrow-forward" @click="handlerChangePage(true)"/>
</Space>
</div>
</Card>
@ -65,12 +61,15 @@ import {SourceService} from "@/services/SourceService";
import {toNumber} from "lodash";
import {SourceModel} from "@/model/SourceModel";
import MangerService from "@/services/source/MangerService";
import SourceNotSupported from "@/components/common/SourceNotSupported.vue";
export default defineComponent({
name: "SourceManager",
components: {SourceNotSupported},
data()
{
return {
templateArray: ['getAllDatabase', 'getAllTablesFromDatabase', 'getAllColumnsFromDatabaseAndTable', 'getDataFromDatabaseAndTableLimited'],
sourceId: 0,
loading: false,
tableLoading: false,
@ -122,6 +121,9 @@ export default defineComponent({
this.databaseArray.push(column[header]);
});
}
else {
this.isSupported = false;
}
});
},
handlerChangeDatabase()