Unverified 提交 dec22613 authored 作者: 王嘉豪's avatar 王嘉豪 提交者: GitHub

Merge pull request #2197 from dataease/dev

Dev
......@@ -68,7 +68,7 @@ curl -sSL https://github.com/dataease/dataease/releases/latest/download/quick_st
```
- [在线文档](https://dataease.io/docs/)
- [演示视频](https://www.bilibili.com/video/BV1UB4y1K7jA)
- [演示视频](https://www.bilibili.com/video/BV1i34y1v7hq/)
## 微信群
......
......@@ -5,10 +5,7 @@ import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissionProxy;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.controller.request.chart.ChartCalRequest;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartViewCacheRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.request.chart.*;
import io.dataease.controller.response.ChartDetail;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.plugins.common.base.domain.ChartViewCacheWithBLOBs;
......@@ -23,6 +20,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @Author gin
......@@ -112,6 +110,13 @@ public class ChartViewController {
return chartViewService.chartCopy(id, panelId);
}
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE, paramIndex = 1)
@ApiOperation("批量复制")
@PostMapping("chartBatchCopy/{panelId}")
public Map<String,String> chartBatchCopy(@RequestBody ChartCopyBatchRequest request, @PathVariable String panelId) {
return chartViewService.chartBatchCopy(request,panelId);
}
@ApiIgnore
@GetMapping("searchAdviceSceneId/{panelId}")
public String searchAdviceSceneId(@PathVariable String panelId) {
......
package io.dataease.controller.request.chart;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
/**
* Author: wangjiahao
* Date: 2022/4/26
* Description:
*/
@Data
public class ChartCopyBatchRequest {
private String panelId;
private Map<String,String> sourceAndTargetIds;
}
package io.dataease.service.chart;
import cn.hutool.core.lang.Assert;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.dataease.auth.entity.SysUserEntity;
......@@ -1024,13 +1025,35 @@ public class ChartViewService {
return chartViewMapper.selectByPrimaryKey(id);
}
public String chartCopy(String id, String panelId) {
public String chartCopy(String sourceViewId,String newViewId, String panelId) {
extChartViewMapper.chartCopy(newViewId, sourceViewId, panelId);
extChartViewMapper.copyCache(sourceViewId, newViewId);
extPanelGroupExtendDataMapper.copyExtendData(sourceViewId, newViewId, panelId);
chartViewCacheService.refreshCache(newViewId);
return newViewId;
}
public String chartCopy(String sourceViewId, String panelId) {
String newChartId = UUID.randomUUID().toString();
extChartViewMapper.chartCopy(newChartId, id, panelId);
extChartViewMapper.copyCache(id, newChartId);
extPanelGroupExtendDataMapper.copyExtendData(id, newChartId, panelId);
chartViewCacheService.refreshCache(newChartId);
return newChartId;
return chartCopy(sourceViewId,newChartId,panelId);
}
/**
* @Description Copy a set of views with a given source ID and target ID
* @param request
* @param panelId
* @return
*/
public Map<String,String> chartBatchCopy(ChartCopyBatchRequest request,String panelId){
Assert.notNull(panelId,"panelId should not be null");
Map<String,String> sourceAndTargetIds = request.getSourceAndTargetIds();
if(sourceAndTargetIds != null && !sourceAndTargetIds.isEmpty()){
for(Map.Entry<String,String> entry:sourceAndTargetIds.entrySet()){
chartCopy(entry.getKey(),entry.getValue(),panelId);
}
}
return request.getSourceAndTargetIds();
}
public String searchAdviceSceneId(String panelId) {
......
......@@ -120,6 +120,19 @@ public class ExtractDataService {
" exit 1\n" +
"fi\n";
private static final String shellScriptForDeleteFile = "result=`curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load`\n" +
"rm -rf %s \n" +
"if [ $? -eq 0 ] ; then\n" +
" failstatus=$(echo $result | grep '\"Status\": \"Fail\"')\n" +
" if [ \"x${failstatus}\" != \"x\" ];then" +
" echo $result\n" +
" exit 1\n" +
" fi\n" +
"else\n" +
" echo $result\n" +
" exit 1\n" +
"fi\n";
public synchronized boolean existSyncTask(DatasetTable datasetTable, DatasetTableTask datasetTableTask, Long startTime) {
datasetTable.setSyncStatus(JobStatus.Underway.name());
DatasetTableExample example = new DatasetTableExample();
......@@ -445,14 +458,20 @@ public class ExtractDataService {
String dataFile = null;
String script = null;
String streamLoadScript = "";
if(kettleFilesKeep){
streamLoadScript = shellScript;
}else {
streamLoadScript = shellScriptForDeleteFile;
}
switch (extractType) {
case "all_scope":
dataFile = root_path + TableUtils.tmpName(TableUtils.tableName(datasetTable.getId())) + "." + extention;
script = String.format(shellScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", dataFile, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tmpName(TableUtils.tableName(datasetTable.getId())));
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", dataFile, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tmpName(TableUtils.tableName(datasetTable.getId())));
break;
default:
dataFile = root_path + TableUtils.addName(TableUtils.tableName(datasetTable.getId())) + "." + extention;
script = String.format(shellScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", dataFile, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()));
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", dataFile, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()));
break;
}
......@@ -744,7 +763,6 @@ public class ExtractDataService {
DataEaseException.throwException(transStatus.getLoggingString());
return;
}
executing = true;
String lastCarteObjectId = Job.sendToSlaveServer(jobMeta, jobExecutionConfiguration, repository, null);
SlaveServerJobStatus jobStatus = null;
......@@ -759,7 +777,7 @@ public class ExtractDataService {
if (jobStatus.getStatusDescription().equals("Finished")) {
return;
} else {
DataEaseException.throwException((jobStatus.getLoggingString()));
DataEaseException.throwException(jobStatus.getLoggingString());
}
}
......@@ -773,20 +791,26 @@ public class ExtractDataService {
Datasource dorisDatasource = engineService.getDeEngine();
DorisConfiguration dorisConfiguration = new Gson().fromJson(dorisDatasource.getConfiguration(), DorisConfiguration.class);
String columns = columnFields + ",dataease_uuid";
String streamLoadScript = "";
if(kettleFilesKeep){
streamLoadScript = shellScript;
}else {
streamLoadScript = shellScriptForDeleteFile;
}
switch (extractType) {
case "all_scope":
outFile = TableUtils.tmpName(TableUtils.tableName(datasetTable.getId()));
jobName = "job_" + TableUtils.tableName(datasetTable.getId());
script = String.format(shellScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", root_path + outFile + "." + extention, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tmpName(TableUtils.tableName(datasetTable.getId())), root_path + outFile + "." + extention);
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), datasetTable.getId() + System.currentTimeMillis(), separator, columns, "APPEND", root_path + outFile + "." + extention, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tmpName(TableUtils.tableName(datasetTable.getId())), root_path + outFile + "." + extention);
break;
case "incremental_add":
outFile = TableUtils.addName(datasetTable.getId());
jobName = "job_add_" + TableUtils.tableName(datasetTable.getId());
script = String.format(shellScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "APPEND", root_path + outFile + "." + extention, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()), root_path + outFile + "." + extention);
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), datasetTable.getId() + System.currentTimeMillis(), separator, columns, "APPEND", root_path + outFile + "." + extention, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()), root_path + outFile + "." + extention);
break;
case "incremental_delete":
outFile = TableUtils.deleteName(TableUtils.tableName(datasetTable.getId()));
script = String.format(shellScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), System.currentTimeMillis(), separator, columns, "DELETE", root_path + outFile + "." + extention, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()), root_path + outFile + "." + extention);
script = String.format(streamLoadScript, dorisConfiguration.getUsername(), dorisConfiguration.getPassword(), datasetTable.getId() + System.currentTimeMillis(), separator, columns, "DELETE", root_path + outFile + "." + extention, dorisConfiguration.getHost(), dorisConfiguration.getHttpPort(), dorisConfiguration.getDataBase(), TableUtils.tableName(datasetTable.getId()), root_path + outFile + "." + extention);
jobName = "job_delete_" + TableUtils.tableName(datasetTable.getId());
break;
default:
......
......@@ -115,6 +115,9 @@ public class DatasourceService {
datasourceDTO.setCalculationMode(dataSourceType.getCalculationMode());
}
});
if(datasourceDTO.getType().equalsIgnoreCase(DatasourceTypes.mysql.toString())){
datasourceDTO.setConfiguration(JSONObject.toJSONString(new Gson().fromJson(datasourceDTO.getConfiguration(), MysqlConfiguration.class)) );
}
if(datasourceDTO.getType().equalsIgnoreCase(DatasourceTypes.api.toString())){
JSONArray apiDefinitionList = JSONObject.parseArray(datasourceDTO.getConfiguration());
JSONArray apiDefinitionListWithStatus = new JSONArray();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,6 +27,14 @@ export function chartCopy(id, panelId) {
loading: false
})
}
export function chartBatchCopy(params, panelId) {
return request({
url: '/chart/view/chartBatchCopy/' + panelId,
method: 'post',
data: params,
loading: false
})
}
export function chartGroupTree(data) {
return request({
url: '/chart/group/tree',
......
......@@ -2,7 +2,7 @@ import store from '@/store/index'
import toast from '@/components/canvas/utils/toast'
import generateID from '@/components/canvas/utils/generateID'
import { deepCopy } from '@/components/canvas/utils/utils'
import { chartCopy } from '@/api/chart/chart'
import { chartBatchCopy, chartCopy } from '@/api/chart/chart'
import { uuid } from 'vue-uuid'
export default {
......@@ -53,6 +53,19 @@ export default {
newView.propValue.viewId = res.data
store.commit('addComponent', { component: newView })
})
} if (data.type === 'de-tabs') {
const sourceAndTargetIds = {}
const newCop = deepCopy(data)
newCop.options.tabList.forEach((item) => {
if (item.content && item.content.type === 'view') {
const newViewId = uuid.v1()
sourceAndTargetIds[item.content.propValue.viewId] = newViewId
item.content.propValue.viewId = newViewId
}
})
chartBatchCopy({ 'sourceAndTargetIds': sourceAndTargetIds }, state.panel.panelInfo.id).then((rsp) => {
store.commit('addComponent', { component: newCop })
})
} else {
const newCop = deepCopy(data)
newCop.id = uuid.v1()
......
......@@ -227,7 +227,8 @@ export default {
this.onFocus = true
// 下拉框弹出时,设置弹框的宽度
this.$nextTick(() => {
this.selectOptionWidth = event.srcElement.offsetWidth + 'px'
// this.selectOptionWidth = event.srcElement.offsetWidth + 'px'
this.selectOptionWidth = event.srcElement.parentElement.parentElement.offsetWidth + 'px'
})
}
......
......@@ -110,6 +110,7 @@ import { mapState } from 'vuex'
import { deepCopy } from '@/components/canvas/utils/utils'
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import { uploadFileResult } from '@/api/staticResource/staticResource'
import { COMMON_BACKGROUND_NONE } from '@/components/canvas/custom-component/component-list'
export default {
name: 'Background',
......@@ -144,7 +145,7 @@ export default {
if (this.curComponent && this.curComponent.commonBackground && this.curComponent.commonBackground.outerImage && typeof (this.curComponent.commonBackground.outerImage) === 'string') {
this.fileList.push({ url: this.curComponent.commonBackground.outerImage })
}
this.backgroundOrigin = deepCopy(this.curComponent.commonBackground)
this.backgroundOrigin = deepCopy(this.curComponent.commonBackground ? this.curComponent.commonBackground : COMMON_BACKGROUND_NONE)
this.queryBackground()
},
queryBackground() {
......
......@@ -674,8 +674,7 @@ export const BASE_CHART_STRING = {
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE,
background: DEFAULT_BACKGROUND_COLOR
yAxisExt: DEFAULT_YAXIS_EXT_STYLE
}),
customFilter: '[]'
}
......@@ -698,8 +697,7 @@ export const BASE_CHART = {
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE,
background: DEFAULT_BACKGROUND_COLOR
yAxisExt: DEFAULT_YAXIS_EXT_STYLE
},
customFilter: []
}
......
......@@ -215,7 +215,7 @@ export default {
} else if (chart.type === 'radar') {
chart_option = baseRadarOption(JSON.parse(JSON.stringify(BASE_RADAR)), chart)
} else if (chart.type === 'gauge') {
chart_option = baseGaugeOption(JSON.parse(JSON.stringify(BASE_GAUGE)), chart, this.scale)
chart_option = baseGaugeOption(JSON.parse(JSON.stringify(BASE_GAUGE)), chart, this.terminalType === 'pc' ? this.scale : '0.7')
} else if (chart.type === 'scatter') {
chart_option = baseScatterOption(JSON.parse(JSON.stringify(BASE_SCATTER)), chart, this.terminalType)
} else if (chart.type === 'treemap') {
......
export function getItemType(dimensionData, quotaData, item) {
// Check whether the current view is in template status
// ( dimensionData and quotaData have no data). If yes, return 'success' directly
if (dimensionData.length === 0 && quotaData.length === 0) {
return 'success'
}
// 将item的字段在数据集维度、指标字段中查询一遍,如果遇到id不存在、字段类型不一致、维度指标不一致,则提示
const status = item.groupType
let checked = false
......
......@@ -1178,7 +1178,6 @@ import bus from '@/utils/bus'
import DatasetChartDetail from '../../dataset/common/DatasetChartDetail'
// shape attr,component style
import {
DEFAULT_BACKGROUND_COLOR,
DEFAULT_COLOR_CASE,
DEFAULT_FUNCTION_CFG,
DEFAULT_LABEL,
......@@ -1333,7 +1332,6 @@ export default {
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE,
background: DEFAULT_BACKGROUND_COLOR,
split: DEFAULT_SPLIT
},
senior: {
......@@ -1472,7 +1470,8 @@ export default {
})
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
},
emptyTableData() {
emptyTableData(id) {
console.log('emptyTableData:' + id)
this.table = {}
this.dimension = []
this.quota = []
......@@ -1500,8 +1499,11 @@ export default {
initTableData(id, optType) {
if (id != null) {
post('/dataset/table/getWithPermission/' + id, null).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (this.view.tableId === id) {
this.table = response.data
this.initTableField(id, optType)
}
}).catch(err => {
this.table = null
this.resetDatasetField()
......@@ -1514,6 +1516,8 @@ export default {
initTableField(id, optType) {
if (this.table) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (this.view.tableId === id) {
this.dimension = response.data.dimension
this.quota = response.data.quota
this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
......@@ -1526,6 +1530,7 @@ export default {
this.calcData()
})
}
}
}).catch(err => {
console.log(err)
this.resetView()
......@@ -1911,8 +1916,10 @@ export default {
getChart(id, queryFrom = 'panel_edit') {
if (id) {
getChartDetails(id, this.panelInfo.id, { queryFrom: queryFrom }).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (response.data.id === this.param.id) {
if (response.data.dataFrom === 'template') {
this.emptyTableData()
this.emptyTableData(response.data.id)
} else {
this.initTableData(response.data.tableId)
}
......@@ -1932,6 +1939,7 @@ export default {
// 将视图传入echart组件
this.chart = response.data
this.data = response.data.data
}
}).catch(err => {
this.httpRequest.status = err.response.data.success
this.httpRequest.msg = err.response.data.message
......
......@@ -23,16 +23,16 @@
<panel-view-result class="attr-selector" />
</el-row>
</el-collapse-item>
<el-collapse-item :title="$t('chart.module_style')" name="component">
<el-row class="selector-div">
<panel-background-color-selector
v-if="chart"
class="attr-selector"
:chart="chart"
@onChangeBackgroundForm="onChangeBackgroundForm"
/>
</el-row>
</el-collapse-item>
<!-- <el-collapse-item :title="$t('chart.module_style')" name="component">-->
<!-- <el-row class="selector-div">-->
<!-- <panel-background-color-selector-->
<!-- v-if="chart"-->
<!-- class="attr-selector"-->
<!-- :chart="chart"-->
<!-- @onChangeBackgroundForm="onChangeBackgroundForm"-->
<!-- />-->
<!-- </el-row>-->
<!-- </el-collapse-item>-->
<el-collapse-item :title="$t('chart.shape_attr')" name="graphical">
<el-row class="selector-div">
<panel-color-selector
......
......@@ -949,6 +949,7 @@ export default {
hyperlinks: HYPERLINKS,
mobileStyle: BASE_MOBILE_STYLE,
propValue: fileResult,
commonBackground: deepCopy(COMMON_BACKGROUND),
style: {
...commonStyle
}
......
......@@ -277,6 +277,7 @@ export default {
this.form = JSON.parse(JSON.stringify(row))
this.originConfiguration = this.form.configuration
if (row.type === 'api') {
} else {
this.form.configuration = JSON.parse(this.form.configuration)
}
......@@ -320,6 +321,7 @@ export default {
case 'ck':
case 'mongo':
case 'mariadb':
case 'impala':
if (configuration.host == this.form.configuration.host && configuration.dataBase == this.form.configuration.dataBase && configuration.port == this.form.configuration.port) {
repeat = true
repeatDsName.push(child.name)
......@@ -493,7 +495,9 @@ export default {
changeType() {
for (let i = 0; i < this.dsTypes.length; i++) {
if (this.dsTypes[i].type === this.form.type) {
if(row.type !== 'api'){
this.form.configuration.extraParams = this.dsTypes[i].extraParams
}
this.datasourceType = this.dsTypes[i]
}
}
......
......@@ -2,7 +2,7 @@
<el-row class="demo_main">
<div class="demo_title" />
<div class="demo_content">
<a href="https://www.bilibili.com/video/BV1UB4y1K7jA" target="_blank">{{ $t('wizard.demo_video_hint') }}</a>
<a href="https://www.bilibili.com/video/BV1i34y1v7hq/" target="_blank">{{ $t('wizard.demo_video_hint') }}</a>
</div>
</el-row>
</template>
......
......@@ -43,7 +43,7 @@ export default {
head: this.$t('wizard.quick_start'),
content: this.$t('wizard.demo_video_hint'),
bottom: '',
href: 'https://www.bilibili.com/video/BV1UB4y1K7jA',
href: 'https://www.bilibili.com/video/BV1i34y1v7hq/',
component: 'CardDetail'
},
{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论