Merge branch 'dev-v2' into pr@dev-v2_dzz

This commit is contained in:
dataeaseShu 2023-10-30 16:06:35 +08:00
commit 51da8f8cf5
7 changed files with 89 additions and 72 deletions

View File

@ -319,7 +319,7 @@ public class ApiUtils {
}
}
for (JsonNode node : jsonArray) {
handleStr(apiDefinition, node.toString(), childrenField, rootPath + "." + fieldName + "[*]");
handleStr(apiDefinition, node.toString(), childrenField, rootPath + "." + String.format(path, fieldName) + "[*]");
}
o.put("children", childrenField);
o.put("childrenDataType", "LIST");

View File

@ -47,7 +47,6 @@ import java.util.stream.Collectors;
@Component("calciteProvider")
public class CalciteProvider {
//TODO mongo impala es hive
@Resource
protected CoreDatasourceMapper coreDatasourceMapper;
@Resource
@ -93,7 +92,7 @@ public class CalciteProvider {
schemas.add(resultSet.getString(1));
}
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return schemas;
}
@ -107,7 +106,7 @@ public class CalciteProvider {
tables.add(getTableDesc(datasourceRequest, resultSet));
}
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
}
return tables;
@ -145,15 +144,11 @@ public class CalciteProvider {
String querySql = getTablesSql(datasourceRequest).get(0);
try (Connection con = getConnection(datasourceRequest.getDatasource()); Statement statement = getStatement(con, 30); ResultSet resultSet = statement.executeQuery(querySql)) {
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return "Success";
}
public List<TableField> getTableFields(DatasourceRequest datasourceRequest) throws Exception {
return null;
}
public Map<String, Object> fetchResultField(DatasourceRequest datasourceRequest) throws DEException {
List<TableField> datasetTableFields = new ArrayList<>();
List<String[]> list = new LinkedList<>();
@ -242,7 +237,7 @@ public class CalciteProvider {
Class.forName("org.apache.calcite.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:calcite:", info);
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return connection;
}
@ -433,7 +428,7 @@ public class CalciteProvider {
list.add(row);
}
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return list;
}
@ -573,7 +568,7 @@ public class CalciteProvider {
Driver driverClass = (Driver) jdbcClassLoader.loadClass(driverClassName).newInstance();
conn = driverClass.connect(configuration.getJdbc(), props);
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return conn;
}
@ -587,7 +582,7 @@ public class CalciteProvider {
stat = connection.createStatement();
stat.setQueryTimeout(queryTimeout);
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return stat;
}
@ -640,7 +635,7 @@ public class CalciteProvider {
customJdbcClassLoaders.put(coreDriver.getId(), customJdbcClassLoader);
return customJdbcClassLoader;
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
return null;
}
@ -691,7 +686,7 @@ public class CalciteProvider {
SchemaPlus rootSchema = buildSchema(datasourceRequest, calciteConnection);
addCustomFunctions(rootSchema);
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
}
@ -709,7 +704,7 @@ public class CalciteProvider {
rootSchema.removeSubSchema(datasourceSchemaDTO.getSchemaAlias());
}
} catch (Exception e) {
DEException.throwException(e);
DEException.throwException(e.getMessage());
}
}

View File

@ -125,10 +125,12 @@ public class DatasourceServer implements DatasourceApi {
if (Objects.equals(dataSourceDTO.getId(), dataSourceDTO.getPid())) {
DEException.throwException(Translator.get("i18n_pid_not_eq_id"));
}
List<Long> ids = new ArrayList<>();
getParents(dataSourceDTO.getPid(), ids);
if (ids.contains(dataSourceDTO.getId())) {
DEException.throwException(Translator.get("i18n_pid_not_eq_id"));
if (dataSourceDTO.getPid() != 0) {
List<Long> ids = new ArrayList<>();
getParents(dataSourceDTO.getPid(), ids);
if (ids.contains(dataSourceDTO.getId())) {
DEException.throwException(Translator.get("i18n_pid_not_eq_id"));
}
}
dataSourceManage.move(dataSourceDTO);
}

View File

@ -1,6 +1,7 @@
package io.dataease.datasource.type;
import io.dataease.api.ds.vo.DatasourceConfiguration;
import io.dataease.exception.DEException;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@ -25,7 +26,7 @@ public class Mysql extends DatasourceConfiguration {
} else {
for (String illegalParameter : illegalParameters) {
if (getExtraParams().toLowerCase().contains(illegalParameter.toLowerCase())) {
throw new RuntimeException("Illegal parameter: " + illegalParameter);
DEException.throwException("Illegal parameter: " + illegalParameter);
}
}

View File

@ -75,13 +75,17 @@ const closeEditCanvasName = () => {
}
const undo = () => {
snapshotStore.undo()
eventBus.emit('matrix-canvasInit', false)
if (snapshotIndex.value > 0) {
snapshotStore.undo()
eventBus.emit('matrix-canvasInit', false)
}
}
const redo = () => {
snapshotStore.redo()
eventBus.emit('matrix-canvasInit', false)
if (snapshotIndex.value !== snapshotStore.snapshotData.length - 1) {
snapshotStore.redo()
eventBus.emit('matrix-canvasInit', false)
}
}
const previewInner = () => {
@ -333,6 +337,7 @@ onMounted(() => {
<el-icon
class="toolbar-hover-icon"
:class="{ 'toolbar-icon-disabled': snapshotIndex < 1 }"
:disabled="snapshotIndex < 1"
@click="undo()"
>
<Icon name="icon_undo_outlined"></Icon>

View File

@ -83,34 +83,40 @@ export const copyStore = defineStore('copy', {
return
}
const dataArray = this.copyData.data
dataArray.forEach(data => {
if (dvInfo.value.type === 'dataV') {
if (isMouse) {
data.style.top = menuTop
data.style.left = menuLeft
} else {
data.style.top += 10
data.style.left += 10
}
let i = 0
const copyDataTemp = this.copyData
const moveTime = dataArray.length > 1 ? 300 : 10
const timeId = setInterval(function () {
if (i >= dataArray.length) {
clearInterval(timeId)
} else {
// 向下移动一个高度矩阵单位
data.y = data.y + data.sizeY
}
// 旧-新ID映射关系
const idMap = {}
const newComponent = deepCopyHelper(data, idMap)
dvMainStore.addCopyComponent(newComponent, idMap, this.copyData.copyCanvasViewInfo)
if (dvInfo.value.type === 'dashboard') {
if (dvMainStore.multiplexingStyleAdapt && this.copyData.copyFrom === 'multiplexing') {
adaptCurThemeCommonStyle(newComponent)
const data = dataArray[i]
if (dvInfo.value.type === 'dataV') {
if (isMouse) {
data.style.top = menuTop
data.style.left = menuLeft
} else {
data.style.top += 10
data.style.left += 10
}
} else {
// 向下移动一个高度矩阵单位
data.y = data.y + data.sizeY
}
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
// 旧-新ID映射关系
const idMap = {}
const newComponent = deepCopyHelper(data, idMap)
dvMainStore.addCopyComponent(newComponent, idMap, copyDataTemp.copyCanvasViewInfo)
if (dvInfo.value.type === 'dashboard') {
if (dvMainStore.multiplexingStyleAdapt && copyDataTemp.copyFrom === 'multiplexing') {
adaptCurThemeCommonStyle(newComponent)
}
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
}
i++
}
})
if (dvInfo.value.type === 'dashboard') {
//占位优化 整合定位
eventBus.emit('doCanvasInit-canvas-main')
}
}, moveTime)
snapshotStore.recordSnapshotCache()
},
cut() {

View File

@ -78,13 +78,14 @@ public class HttpClientUtil {
* @return 响应结果字符串
*/
public static String get(String url, HttpClientConfig config) {
CloseableHttpClient httpClient = buildHttpClient(url);
HttpGet httpGet = new HttpGet(url);
if (config == null) {
config = new HttpClientConfig();
}
CloseableHttpClient httpClient = null;
try {
httpClient = buildHttpClient(url);
HttpGet httpGet = new HttpGet(url);
if (config == null) {
config = new HttpClientConfig();
}
httpGet.setConfig(config.buildRequestConfig());
Map<String, String> header = config.getHeader();
@ -98,7 +99,9 @@ public class HttpClientUtil {
throw new DEException(SYSTEM_INNER_ERROR.code(), "HttpClient查询失败: " + e.getMessage());
} finally {
try {
httpClient.close();
if(httpClient != null){
httpClient.close();
}
} catch (Exception e) {
logger.error("HttpClient关闭连接失败", e);
}
@ -143,14 +146,14 @@ public class HttpClientUtil {
* @return 响应结果字符串
*/
public static String post(String url, String json, HttpClientConfig config) {
CloseableHttpClient httpClient = buildHttpClient(url);
HttpPost httpPost = new HttpPost(url);
if (config == null) {
config = new HttpClientConfig();
}
CloseableHttpClient httpClient = null;
try {
buildHttpClient(url);
HttpPost httpPost = new HttpPost(url);
if (config == null) {
config = new HttpClientConfig();
}
httpPost.setConfig(config.buildRequestConfig());
Map<String, String> header = config.getHeader();
for (String key : header.keySet()) {
httpPost.addHeader(key, header.get(key));
@ -168,7 +171,9 @@ public class HttpClientUtil {
throw new DEException(SYSTEM_INNER_ERROR.code(), "HttpClient查询失败: " + e.getMessage());
} finally {
try {
httpClient.close();
if(httpClient != null){
httpClient.close();
}
} catch (Exception e) {
logger.error("HttpClient关闭连接失败", e);
}
@ -195,14 +200,15 @@ public class HttpClientUtil {
* @return 响应结果字符串
*/
public static String post(String url, Map<String, String> body, HttpClientConfig config) {
CloseableHttpClient httpClient = buildHttpClient(url);
HttpPost httpPost = new HttpPost(url);
if (config == null) {
config = new HttpClientConfig();
}
try {
httpPost.setConfig(config.buildRequestConfig());
CloseableHttpClient httpClient = null;
try {
buildHttpClient(url);
HttpPost httpPost = new HttpPost(url);
if (config == null) {
config = new HttpClientConfig();
}
httpPost.setConfig(config.buildRequestConfig());
Map<String, String> header = config.getHeader();
for (String key : header.keySet()) {
httpPost.addHeader(key, header.get(key));
@ -227,7 +233,9 @@ public class HttpClientUtil {
throw new DEException(SYSTEM_INNER_ERROR.code(), "HttpClient查询失败: " + e.getMessage());
} finally {
try {
httpClient.close();
if(httpClient != null){
httpClient.close();
}
} catch (Exception e) {
logger.error("HttpClient关闭连接失败", e);
}