Merge branch 'main' of github.com:dataease/dataease into main

This commit is contained in:
taojinlong 2021-04-14 14:18:26 +08:00
commit 7c98665ddc
5 changed files with 37 additions and 9 deletions

View File

@ -45,14 +45,14 @@ public class AppStartReadHBaseListener implements ApplicationListener<Applicatio
datasetTableExample.createCriteria().andModeEqualTo(1); datasetTableExample.createCriteria().andModeEqualTo(1);
List<DatasetTable> datasetTables = datasetTableMapper.selectByExampleWithBLOBs(datasetTableExample); List<DatasetTable> datasetTables = datasetTableMapper.selectByExampleWithBLOBs(datasetTableExample);
for (DatasetTable table : datasetTables) { for (DatasetTable table : datasetTables) {
commonThreadPool.addTask(() -> { // commonThreadPool.addTask(() -> {
try { try {
List<DatasetTableField> fields = dataSetTableFieldsService.getFieldsByTableId(table.getId()); List<DatasetTableField> fields = dataSetTableFieldsService.getFieldsByTableId(table.getId());
sparkCalc.getHBaseDataAndCache(table.getId(), fields); sparkCalc.getHBaseDataAndCache(table.getId(), fields);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}); // });
} }
} }
} }

View File

@ -22,6 +22,7 @@ import org.apache.spark.sql.*;
import org.apache.spark.sql.types.DataTypes; import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.StructField; import org.apache.spark.sql.types.StructField;
import org.apache.spark.sql.types.StructType; import org.apache.spark.sql.types.StructType;
import org.apache.spark.storage.StorageLevel;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import scala.Tuple2; import scala.Tuple2;
@ -144,7 +145,7 @@ public class SparkCalc {
}); });
StructType structType = DataTypes.createStructType(structFields); StructType structType = DataTypes.createStructType(structFields);
Dataset<Row> dataFrame = sqlContext.createDataFrame(rdd, structType).persist(); Dataset<Row> dataFrame = sqlContext.createDataFrame(rdd, structType).persist(StorageLevel.MEMORY_AND_DISK_SER());
CacheUtil.getInstance().addCacheData(hTable, dataFrame); CacheUtil.getInstance().addCacheData(hTable, dataFrame);
dataFrame.count(); dataFrame.count();
return dataFrame; return dataFrame;

View File

@ -697,7 +697,9 @@ export default {
rose_type: '玫瑰图模式', rose_type: '玫瑰图模式',
radius_mode: '半径', radius_mode: '半径',
area_mode: '面积', area_mode: '面积',
rose_radius: '圆角' rose_radius: '圆角',
view_name: '视图名称',
name_can_not_empty: '名称不能为空'
}, },
dataset: { dataset: {
datalist: '数据集', datalist: '数据集',

View File

@ -199,10 +199,17 @@
width="70%" width="70%"
class="dialog-css" class="dialog-css"
> >
<el-row style="width: 400px;">
<el-form ref="form" :model="table" label-width="80px" size="mini" class="form-item">
<el-form-item :label="$t('chart.view_name')">
<el-input v-model="table.name" size="mini" />
</el-form-item>
</el-form>
</el-row>
<table-selector @getTable="getTable" /> <table-selector @getTable="getTable" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button size="mini" @click="selectTableFlag = false">{{ $t('chart.cancel') }}</el-button> <el-button size="mini" @click="closeCreateChart">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="createChart">{{ $t('chart.confirm') }}</el-button> <el-button type="primary" size="mini" :disabled="!table.id" @click="createChart">{{ $t('chart.confirm') }}</el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -518,10 +525,24 @@ export default {
this.selectTableFlag = true this.selectTableFlag = true
}, },
closeCreateChart() {
this.selectTableFlag = false
this.table = {}
},
createChart() { createChart() {
console.log(this.table) console.log(this.table)
if (!this.table.name) {
this.$message({
message: this.$t('chart.name_can_not_empty'),
type: 'error',
showClose: true
})
return
}
const view = {} const view = {}
view.name = this.table.name view.name = this.table.name
view.title = this.table.name
view.sceneId = this.currGroup.id view.sceneId = this.currGroup.id
view.tableId = this.table.id view.tableId = this.table.id
view.type = 'bar' view.type = 'bar'
@ -540,7 +561,7 @@ export default {
}) })
view.customFilter = JSON.stringify([]) view.customFilter = JSON.stringify([])
post('/chart/view/save', view).then(response => { post('/chart/view/save', view).then(response => {
this.selectTableFlag = false this.closeCreateChart()
this.$store.dispatch('chart/setTableId', null) this.$store.dispatch('chart/setTableId', null)
this.$store.dispatch('chart/setTableId', this.table.id) this.$store.dispatch('chart/setTableId', this.table.id)
// this.$router.push('/chart/chart-edit') // this.$router.push('/chart/chart-edit')
@ -551,7 +572,7 @@ export default {
}, },
getTable(table) { getTable(table) {
this.table = table this.table = JSON.parse(JSON.stringify(table))
}, },
refresh() { refresh() {
@ -630,4 +651,8 @@ export default {
.dialog-css >>> .el-dialog__body { .dialog-css >>> .el-dialog__body {
padding: 10px 20px 20px; padding: 10px 20px 20px;
} }
.form-item>>>.el-form-item__label{
font-size: 12px;
}
</style> </style>

View File

@ -132,7 +132,7 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
<div style="overflow:auto;border-top: 1px solid #e6e6e6" class="padding-lr filter-class"> <div v-if="false" style="overflow:auto;border-top: 1px solid #e6e6e6" class="padding-lr filter-class">
<span>{{ $t('chart.result_filter') }}</span> <span>{{ $t('chart.result_filter') }}</span>
<div style="margin: 8px" class="filter-inner-class"> <div style="margin: 8px" class="filter-inner-class">
<draggable <draggable