Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
fit2cloud-chenyw 2021-05-12 16:59:00 +08:00
commit b637b77812
3 changed files with 47 additions and 28 deletions

View File

@ -112,7 +112,7 @@ public class DataSetTableService {
return datasetTable;
}
public void delete(String id) throws Exception{
public void delete(String id) throws Exception {
datasetTableMapper.deleteByPrimaryKey(id);
dataSetTableFieldsService.deleteByTableId(id);
// 删除同步任务
@ -120,10 +120,11 @@ public class DataSetTableService {
deleteDorisTable(id);
}
private void deleteDorisTable(String datasetId) throws Exception{
private void deleteDorisTable(String datasetId) throws Exception {
String dorisTableName = DorisTableUtils.dorisName(datasetId);
Datasource dorisDatasource = (Datasource)CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);;
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
;
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery("drop table if exists " + dorisTableName);
@ -548,7 +549,10 @@ public class DataSetTableService {
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery("CREATE VIEW " + dorisTableName + " AS (" + customSql + ")");
// 先删除表
datasourceRequest.setQuery("DROP VIEW IF EXISTS " + dorisTableName);
jdbcProvider.exec(datasourceRequest);
datasourceRequest.setQuery("CREATE VIEW IF NOT EXISTS" + dorisTableName + " AS (" + customSql + ")");
jdbcProvider.exec(datasourceRequest);
}

View File

@ -5,6 +5,8 @@
<el-table
size="mini"
:data="unionData"
:height="height"
border
style="width: 100%;margin-top: 10px;"
>
<el-table-column
@ -28,8 +30,8 @@
:label="$t('dataset.target_field')"
/>
<el-table-column
fixed="right"
width="100"
align="left"
:label="$t('dataset.operate')"
>
<template slot-scope="scope">
<el-button type="text" size="mini" @click="edit(scope.row)">{{ $t('dataset.edit') }}</el-button>
@ -143,6 +145,7 @@ export default {
},
data() {
return {
height: 500,
union: {
id: null,
sourceTableId: this.table.id,
@ -165,9 +168,17 @@ export default {
}
},
mounted() {
this.calHeight()
this.initUnion()
},
methods: {
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 55 - 38 - 28 - 10
}, 10)
},
initUnion() {
if (this.table.id) {
post('dataset/union/listByTableId/' + this.table.id, {}).then(response => {

View File

@ -13,6 +13,7 @@
size="mini"
:data="taskLogData"
border
:height="height"
style="width: 100%"
>
<el-table-column
@ -32,18 +33,18 @@
:label="$t('dataset.end_time')"
>
<template slot-scope="scope">
<span>{{scope.row.endTime | timestampFormatDate }}</span>
<span>{{ scope.row.endTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('dataset.status')" >
<el-table-column prop="status" :label="$t('dataset.status')">
<template slot-scope="scope">
<span v-if="scope.row.status === 'Completed'" style="color: green">{{ $t('dataset.completed') }}</span>
<span v-if="scope.row.status === 'Underway'" style="color: blue">
<i class="el-icon-loading"></i>
<i class="el-icon-loading" />
{{ $t('dataset.underway') }}
</span>
<span v-if="scope.row.status === 'Error'" style="color: red" >
<span v-if="scope.row.status === 'Error'" style="color: red">
<el-link type="danger" style="font-size: 12px" @click="showErrorMassage(scope.row.info)">{{ $t('dataset.error') }}</el-link>
</span>
</template>
@ -67,8 +68,9 @@
:visible="show_error_massage"
:show-close="false"
width="50%"
class="dialog-css">
<span>{{error_massage}}</span>
class="dialog-css"
>
<span>{{ error_massage }}</span>
<span slot="footer" class="dialog-footer">
<el-button size="mini" @click="show_error_massage = false">{{ $t('dataset.close') }}</el-button>
</span>
@ -161,7 +163,7 @@
<el-button type="primary" size="mini" @click="saveTask(taskForm)">{{ $t('dataset.confirm') }}</el-button>
</div>
</el-dialog>
<el-row >
<el-row>
<el-button icon="el-icon-plus" size="mini" @click="addTask(undefined)">
{{ $t('dataset.add_task') }}
</el-button>
@ -295,6 +297,7 @@ export default {
},
data() {
return {
height: 500,
update_setting: false,
update_task: false,
show_error_massage: false,
@ -355,8 +358,7 @@ export default {
},
watch: {
table: {
handler()
{
handler() {
this.listTask()
this.listTaskLog()
},
@ -364,21 +366,23 @@ export default {
}
},
mounted() {
window.onresize = () => {
return (() => {
this.height = window.innerHeight / 2
})()
}
this.height = window.innerHeight / 2
this.calHeight()
},
methods: {
cellStyle ({row, column}) {
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 55 - 38 - 28 - 10
}, 10)
},
cellStyle({ row, column }) {
//
if (row.status === 'Underway' && column === 'status') {
return 'color: blue'
} else if (row.status === 'Completed' && column === 'status') {
return 'color: green'
}else if (row.status === 'Error' && column === 'status') {
} else if (row.status === 'Error' && column === 'status') {
return 'color: red'
}
},
@ -414,10 +418,10 @@ export default {
this.listTask()
this.getIncrementalConfig()
},
refreshLog(){
refreshLog() {
this.listTaskLog()
},
showErrorMassage(massage){
showErrorMassage(massage) {
this.show_error_massage = true
this.error_massage = massage
},