diff --git a/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java b/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java index 87a7361254..97b9343ee9 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java +++ b/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java @@ -115,7 +115,9 @@ public class ChartDataManage { if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot") || StringUtils.containsIgnoreCase(view.getType(), "group") || ("antv".equalsIgnoreCase(view.getRender()) && "line".equalsIgnoreCase(view.getType())) - || StringUtils.equalsIgnoreCase(view.getType(), "flow-map")) { + || StringUtils.equalsIgnoreCase(view.getType(), "flow-map") + || StringUtils.equalsIgnoreCase(view.getType(), "sankey") + ) { xAxis.addAll(xAxisExt); } List yAxis = new ArrayList<>(view.getYAxis()); diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/ApiUtils.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/ApiUtils.java index 381b53db65..d6317d83cc 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/ApiUtils.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/ApiUtils.java @@ -59,7 +59,7 @@ public class ApiUtils { if (apiDefinition == null) { DEException.throwException("未找到"); } - String response = execHttpRequest(apiDefinition, 10); + String response = execHttpRequest(apiDefinition, apiDefinition.getApiQueryTimeout() == null || apiDefinition.getApiQueryTimeout() <= 0 ? 10 : apiDefinition.getApiQueryTimeout()); fieldList = getTableFields(apiDefinition); result.put("fieldList", fieldList); dataList = fetchResult(response, apiDefinition); @@ -116,7 +116,7 @@ public class ApiUtils { if (apiDefinition == null) { DEException.throwException("未找到"); } - String response = execHttpRequest(apiDefinition, 10); + String response = execHttpRequest(apiDefinition, apiDefinition.getApiQueryTimeout() == null || apiDefinition.getApiQueryTimeout() <= 0 ? 10 : apiDefinition.getApiQueryTimeout()); return fetchResult(response, apiDefinition); } @@ -194,6 +194,26 @@ public class ApiUtils { return response; } + private static void previewNum(List> field){ + for (Map stringObjectMap : field) { + JSONArray newArray = new JSONArray(); + if (stringObjectMap.get("value") != null) { + try { + TypeReference listTypeReference = new TypeReference() { + }; + JSONArray array = objectMapper.readValue(stringObjectMap.get("value").toString(), listTypeReference); + if(array.size() > 100){ + for (int i = 0; i < Math.min(100, array.size()); i++) { + newArray.add(array.get(i)); + } + stringObjectMap.put("value", newArray); + } + } catch (Exception e) { + + } + } + } + } public static ApiDefinition checkApiDefinition(ApiDefinition apiDefinition, String response) throws DEException { if (StringUtils.isEmpty(response)) { @@ -217,6 +237,7 @@ public class ApiUtils { rootPath = "$"; handleStr(apiDefinition, response, fields, rootPath); } + previewNum(fields); apiDefinition.setJsonFields(fields); return apiDefinition; } else { diff --git a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java index 3dad5cc9bd..0964609d9e 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/provider/CalciteProvider.java @@ -117,7 +117,11 @@ public class CalciteProvider { tableDesc.setDatasourceId(datasourceRequest.getDatasource().getId()); tableDesc.setType("db"); tableDesc.setTableName(resultSet.getString(1)); - tableDesc.setName(resultSet.getString(1)); + if(resultSet.getMetaData().getColumnCount() > 1){ + tableDesc.setName(resultSet.getString(2)); + }else { + tableDesc.setName(resultSet.getString(1)); + } return tableDesc; } @@ -315,6 +319,7 @@ public class CalciteProvider { private String getTableFiledSql(DatasourceRequest datasourceRequest) { String sql = ""; DatasourceConfiguration configuration = null; + String database=""; DatasourceType datasourceType = DatasourceType.valueOf(datasourceRequest.getDatasource().getType()); switch (datasourceType) { case mysql: @@ -324,7 +329,16 @@ public class CalciteProvider { case StarRocks: case doris: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Mysql.class); - sql = String.format("SELECT COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", configuration.getDataBase(), datasourceRequest.getTable()); + if (StringUtils.isEmpty(configuration.getUrlType()) || configuration.getUrlType().equalsIgnoreCase("hostName")) { + database = configuration.getDataBase(); + } else { + Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:mysql://(.*):(\\d+)/(.*)"); + Matcher matcher = WITH_SQL_FRAGMENT.matcher(configuration.getJdbcUrl()); + matcher.find(); + String[] databasePrams = matcher.group(3).split("\\?"); + database = databasePrams[0]; + } + sql = String.format("SELECT COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", database, datasourceRequest.getTable()); break; case oracle: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Oracle.class); @@ -396,6 +410,16 @@ public class CalciteProvider { break; case ck: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), CK.class); + + if (StringUtils.isEmpty(configuration.getUrlType()) || configuration.getUrlType().equalsIgnoreCase("hostName")) { + database = configuration.getDataBase(); + } else { + Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:clickhouse://(.*):(\\d+)/(.*)"); + Matcher matcher = WITH_SQL_FRAGMENT.matcher(configuration.getJdbcUrl()); + matcher.find(); + String[] databasePrams = matcher.group(3).split("\\?"); + database = databasePrams[0]; + } sql = String.format(" SELECT\n" + " name,\n" + " type,\n" + @@ -404,7 +428,7 @@ public class CalciteProvider { " system.columns\n" + "WHERE\n" + " database = '%s' \n" + - " AND table = '%s' ", configuration.getDataBase(), datasourceRequest.getTable()); + " AND table = '%s' ", database, datasourceRequest.getTable()); break; case impala: sql = String.format("DESCRIBE `%s`", datasourceRequest.getTable()); @@ -742,7 +766,7 @@ public class CalciteProvider { case StarRocks: case doris: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Mysql.class); - if (configuration.getUrlType().equalsIgnoreCase("")) { + if (StringUtils.isEmpty(configuration.getUrlType()) || configuration.getUrlType().equalsIgnoreCase("hostName")) { database = configuration.getDataBase(); } else { Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:mysql://(.*):(\\d+)/(.*)"); @@ -758,42 +782,76 @@ public class CalciteProvider { if (StringUtils.isEmpty(configuration.getSchema())) { DEException.throwException(Translator.get("i18n_schema_is_empty")); } - tableSqls.add("select table_name, owner, comments from all_tab_comments where owner='" + configuration.getSchema() + "' AND table_type = 'TABLE'"); - tableSqls.add("select table_name, owner, comments from all_tab_comments where owner='" + configuration.getSchema() + "' AND table_type = 'VIEW'"); + tableSqls.add("select table_name, comments, owner from all_tab_comments where owner='" + configuration.getSchema() + "' AND table_type = 'TABLE'"); + tableSqls.add("select table_name, comments, owner from all_tab_comments where owner='" + configuration.getSchema() + "' AND table_type = 'VIEW'"); break; case db2: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Db2.class); if (StringUtils.isEmpty(configuration.getSchema())) { DEException.throwException(Translator.get("i18n_schema_is_empty")); } - tableSqls.add("select TABNAME from syscat.tables WHERE TABSCHEMA ='DE_SCHEMA' AND \"TYPE\" = 'T'".replace("DE_SCHEMA", configuration.getSchema())); + tableSqls.add("select TABNAME, REMARKS from syscat.tables WHERE TABSCHEMA ='DE_SCHEMA' AND \"TYPE\" = 'T'".replace("DE_SCHEMA", configuration.getSchema())); break; case sqlServer: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Sqlserver.class); if (StringUtils.isEmpty(configuration.getSchema())) { DEException.throwException(Translator.get("i18n_schema_is_empty")); } - tableSqls.add("SELECT TABLE_NAME FROM \"DATABASE\".INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'DS_SCHEMA' ;" - .replace("DATABASE", configuration.getDataBase()) - .replace("DS_SCHEMA", configuration.getSchema())); - tableSqls.add("SELECT TABLE_NAME FROM \"DATABASE\".INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'DS_SCHEMA' ;" - .replace("DATABASE", configuration.getDataBase()) + tableSqls.add("SELECT \n" + + " t.name AS TableName, \n" + + " ep.value AS TableDescription \n" + + "FROM \n" + + " sys.tables t \n" + + "LEFT OUTER JOIN sys.schemas sc ON sc.schema_id =t.schema_id \n" + + "LEFT OUTER JOIN \n" + + " sys.extended_properties ep ON t.object_id = ep.major_id \n" + + " AND ep.minor_id = 0 \n" + + " AND ep.class = 1 \n" + + " AND ep.name = 'MS_Description'\n" + + "where sc.name ='DS_SCHEMA'" .replace("DS_SCHEMA", configuration.getSchema())); + tableSqls.add("SELECT \n" + + " t.name AS TableName, \n" + + " ep.value AS TableDescription \n" + + "FROM \n" + + " sys.views t \n" + + "LEFT OUTER JOIN sys.schemas sc ON sc.schema_id =t.schema_id \n" + + "LEFT OUTER JOIN \n" + + " sys.extended_properties ep ON t.object_id = ep.major_id \n" + + " AND ep.minor_id = 0 \n" + + " AND ep.class = 1 \n" + + " AND ep.name = 'MS_Description'\n" + + "where sc.name ='DS_SCHEMA'" + .replace("DS_SCHEMA", configuration.getSchema())); break; case pg: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Pg.class); if (StringUtils.isEmpty(configuration.getSchema())) { DEException.throwException(Translator.get("i18n_schema_is_empty")); } - tableSqls.add("SELECT tablename FROM pg_tables WHERE schemaname='SCHEMA' ;".replace("SCHEMA", configuration.getSchema())); + tableSqls.add("SELECT \n" + + " relname AS TableName, \n" + + " obj_description(relfilenode::regclass, 'pg_class') AS TableDescription \n" + + "FROM \n" + + " pg_class \n" + + "WHERE \n" + + " relkind = 'r' \n" + + " AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'SCHEMA') ".replace("SCHEMA", configuration.getSchema())); break; case redshift: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), CK.class); - tableSqls.add("SELECT tablename FROM pg_tables WHERE schemaname='SCHEMA' ;".replace("SCHEMA", configuration.getSchema())); + tableSqls.add("SELECT \n" + + " relname AS TableName, \n" + + " obj_description(relfilenode::regclass, 'pg_class') AS TableDescription \n" + + "FROM \n" + + " pg_class \n" + + "WHERE \n" + + " relkind = 'r' \n" + + " AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'SCHEMA') ".replace("SCHEMA", configuration.getSchema())); break; case ck: configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), CK.class); - if (configuration.getUrlType().equalsIgnoreCase("")) { + if (StringUtils.isEmpty(configuration.getUrlType()) || configuration.getUrlType().equalsIgnoreCase("hostName")) { database = configuration.getDataBase(); } else { Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:clickhouse://(.*):(\\d+)/(.*)"); @@ -802,7 +860,7 @@ public class CalciteProvider { String[] databasePrams = matcher.group(3).split("\\?"); database = databasePrams[0]; } - tableSqls.add("SELECT name FROM system.tables where database='DATABASE';".replace("DATABASE", database)); + tableSqls.add("SELECT name, comment FROM system.tables where database='DATABASE';".replace("DATABASE", database)); break; default: diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index eb7b13104c..bd37f22672 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -493,6 +493,9 @@ public class DatasourceServer implements DatasourceApi { public DatasourceDTO get(Long datasourceId) throws DEException { DatasourceDTO datasourceDTO = new DatasourceDTO(); CoreDatasource datasource = datasourceMapper.selectById(datasourceId); + if(datasource == null){ + DEException.throwException("不存在的数据源!"); + } BeanUtils.copyBean(datasourceDTO, datasource); TypeReference> listTypeReference = new TypeReference>() { }; @@ -834,10 +837,11 @@ public class DatasourceServer implements DatasourceApi { public ApiDefinition checkApiDatasource(Map request) throws DEException { ApiDefinition apiDefinition = JsonUtil.parseObject(new String(java.util.Base64.getDecoder().decode(request.get("data"))), ApiDefinition.class); - String response = ApiUtils.execHttpRequest(apiDefinition, 10); + String response = ApiUtils.execHttpRequest(apiDefinition, apiDefinition.getApiQueryTimeout() == null || apiDefinition.getApiQueryTimeout() <= 0 ? 10 : apiDefinition.getApiQueryTimeout()); if (request.keySet().contains("type") && request.get("type").equals("apiStructure")) { apiDefinition.setShowApiStructure(true); } + ApiUtils.checkApiDefinition(apiDefinition, response); if (apiDefinition.getRequest().getAuthManager() != null && StringUtils.isNotBlank(apiDefinition.getRequest().getAuthManager().getUsername()) && StringUtils.isNotBlank(apiDefinition.getRequest().getAuthManager().getPassword()) && apiDefinition.getRequest().getAuthManager().getVerification().equals("Basic Auth")) { apiDefinition.getRequest().getAuthManager().setUsername(new String(Base64.getEncoder().encode(apiDefinition.getRequest().getAuthManager().getUsername().getBytes()))); diff --git a/core/core-frontend/src/assets/svg/sankey.svg b/core/core-frontend/src/assets/svg/sankey.svg new file mode 100644 index 0000000000..5645f5ded6 --- /dev/null +++ b/core/core-frontend/src/assets/svg/sankey.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/core/core-frontend/src/components/dashboard/DbCanvasAttr.vue b/core/core-frontend/src/components/dashboard/DbCanvasAttr.vue index 99eb836e99..426e707421 100644 --- a/core/core-frontend/src/components/dashboard/DbCanvasAttr.vue +++ b/core/core-frontend/src/components/dashboard/DbCanvasAttr.vue @@ -146,13 +146,6 @@ const saveSelfSubject = () => { > - - - + + + + + @@ -174,7 +189,10 @@ import eventBus from '@/utils/eventBus' import { storeToRefs } from 'pinia' import CustomColorStyleSelect from '@/views/chart/components/editor/editor-style/components/CustomColorStyleSelect.vue' import elementResizeDetectorMaker from 'element-resize-detector' +import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' const { t } = useI18n() +const snapshotStore = snapshotStoreWithOut() + const props = defineProps({ themes: { type: String as PropType, @@ -191,6 +209,9 @@ const colorFormRef = ref(null) const colorForm = computed( () => canvasStyleData.value.component.chartColor as DeepPartial ) + +const seniorForm = computed(() => canvasStyleData.value.component.seniorStyleSetting) + const predefineColors = COLOR_PANEL const state = reactive({ @@ -215,6 +236,10 @@ const changeColorOption = (modifyName = 'value') => { changeColorCase(modifyName) } +const changePagerColorChange = () => { + snapshotStore.recordSnapshotCache() +} + const changeColorCase = modifyName => { colorForm.value['modifyName'] = modifyName emits('onColorChange', colorForm.value) diff --git a/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/SeniorStyleSetting.vue b/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/SeniorStyleSetting.vue index 58c51044c6..30ffe42673 100644 --- a/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/SeniorStyleSetting.vue +++ b/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/SeniorStyleSetting.vue @@ -2,25 +2,37 @@
- - + + - - + + @@ -35,17 +47,21 @@ import { COLOR_PANEL } from '@/views/chart/components/editor/util/chart' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { useI18n } from '@/hooks/web/useI18n' import { cloneDeep } from 'lodash-es' -import { adaptCurThemeFilterStyleAll } from '@/utils/canvasStyle' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import eventBus from '@/utils/eventBus' -import { ElIcon } from 'element-plus-secondary' const { t } = useI18n() const dvMainStore = dvMainStoreWithOut() const snapshotStore = snapshotStoreWithOut() -const filterStyle = computed(() => { - return dvMainStore.canvasStyleData.component.filterStyle +const seniorStyleSetting = computed(() => { + return dvMainStore.canvasStyleData.component.seniorStyleSetting }) +const props = defineProps({ + themes: { + type: String, + default: 'light' + } +}) const state = reactive({ fontSize: [], isSetting: false, @@ -55,15 +71,9 @@ const state = reactive({ const initForm = () => { // do } -const themeChange = styleKey => { - dvMainStore.canvasStyleData.component.filterStyle = cloneDeep(filterStyle.value) - adaptCurThemeFilterStyleAll(styleKey) - snapshotStore.recordSnapshotCache('filterStyleSimpleSelector-themeChange') -} - -const handleHorizontalChange = (type, horizontal = 'titleLayout') => { - filterStyle.value[horizontal] = type - themeChange(horizontal) +const themeChange = () => { + dvMainStore.canvasStyleData.component.seniorStyleSetting = cloneDeep(seniorStyleSetting.value) + snapshotStore.recordSnapshotCache('seniorStyleSettingSimpleSelector-themeChange') } onMounted(() => { @@ -106,4 +116,12 @@ onMounted(() => { line-height: 20px; } } +.form-item-dark { + :deep(.ed-form-item__label) { + color: #6a6a6a; + font-size: 12px; + font-weight: 400; + line-height: 20px; + } +} diff --git a/core/core-frontend/src/components/data-visualization/CanvasAttr.vue b/core/core-frontend/src/components/data-visualization/CanvasAttr.vue index f321fddf5b..fb0c2c3cfd 100644 --- a/core/core-frontend/src/components/data-visualization/CanvasAttr.vue +++ b/core/core-frontend/src/components/data-visualization/CanvasAttr.vue @@ -10,6 +10,7 @@ import { useEmitt } from '@/hooks/web/useEmitt' import ComponentColorSelector from '@/components/dashboard/subject-setting/dashboard-style/ComponentColorSelector.vue' import OverallSetting from '@/components/dashboard/subject-setting/dashboard-style/OverallSetting.vue' import CanvasBackground from '@/components/visualization/component-background/CanvasBackground.vue' +import SeniorStyleSetting from '@/components/dashboard/subject-setting/dashboard-style/SeniorStyleSetting.vue' const dvMainStore = dvMainStoreWithOut() const snapshotStore = snapshotStoreWithOut() const { canvasStyleData, canvasViewInfo } = storeToRefs(dvMainStore) @@ -102,6 +103,14 @@ onMounted(() => { + + +
diff --git a/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue b/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue index 67dc784914..d9deec239b 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/DePreview.vue @@ -236,6 +236,23 @@ const initWatermark = (waterDomId = 'preview-canvas-main') => { } } +// 目标校验: 需要校验targetSourceId 是否是当前可视化资源ID +const winMsgHandle = event => { + console.info('PostMessage Params Received') + const msgInfo = event.data + // 校验targetSourceId + if ( + msgInfo && + msgInfo.type === 'attachParams' && + msgInfo.targetSourceId === dvInfo.value.id + '' + ) { + const attachParam = msgInfo.params + if (attachParam) { + dvMainStore.addOuterParamsFilter(attachParam, componentData.value, 'outer') + } + } +} + onMounted(() => { initRefreshTimer() resetLayout() @@ -245,10 +262,12 @@ onMounted(() => { restore() initWatermark() }) + window.addEventListener('message', winMsgHandle) }) onBeforeUnmount(() => { clearInterval(refreshTimer.value) + window.removeEventListener('message', winMsgHandle) }) const userViewEnlargeOpen = (opt, item) => { diff --git a/core/core-frontend/src/custom-component/de-frame/ComponentFrame.vue b/core/core-frontend/src/custom-component/de-frame/ComponentFrame.vue index 8b464bee89..65980cbeb7 100644 --- a/core/core-frontend/src/custom-component/de-frame/ComponentFrame.vue +++ b/core/core-frontend/src/custom-component/de-frame/ComponentFrame.vue @@ -3,7 +3,7 @@