Skip to content

Commit ea1a801

Browse files
authored
Merge pull request #73 from running-elephant/dev
Dev
2 parents c69fc37 + c7fe3a9 commit ea1a801

File tree

46 files changed

+1343
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1343
-138
lines changed

config/logback.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<configuration scan="true" scanPeriod="60 seconds" debug="false">
22

33
<property name="LOG_HOME" value="./logs"/>
4+
<property name ="SQL_LEVEL" value="DEBUG"/>
45

56
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
67
<encoder>
@@ -22,13 +23,27 @@
2223
</encoder>
2324
</appender>
2425

26+
<appender name="sql" class="ch.qos.logback.core.rolling.RollingFileAppender">
27+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
28+
<FileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}-sql.log</FileNamePattern>
29+
<MaxHistory>30</MaxHistory>
30+
</rollingPolicy>
31+
<encoder>
32+
<charset>UTF-8</charset>
33+
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} : %msg%n</pattern>
34+
</encoder>
35+
</appender>
36+
2537
<root level="INFO">
2638
<appender-ref ref="console"/>
2739
<appender-ref ref="root" />
2840
</root>
2941

30-
<logger name="access" additivity="false" level="INFO">
31-
<appender-ref ref="error_db_appender"/>
42+
<logger name="datart.data.provider.jdbc.adapters" level="${SQL_LEVEL}">
43+
<appender-ref ref="sql"/>
44+
</logger>
45+
<logger name="datart.data.provider.local.LocalDB" level="${SQL_LEVEL}">
46+
<appender-ref ref="sql"/>
3247
</logger>
3348

3449
</configuration>

data-providers/src/main/java/datart/data/provider/local/LocalDB.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,12 @@
4343
import java.util.concurrent.ConcurrentHashMap;
4444

4545
@Slf4j
46-
public class
47-
LocalDB {
46+
public class LocalDB {
4847

4948
private static final String MEM_URL = "jdbc:h2:mem:/";
5049

5150
private static final String H2_PARAM = ";LOG=0;DATABASE_TO_UPPER=false;MODE=MySQL;CASE_INSENSITIVE_IDENTIFIERS=TRUE;CACHE_SIZE=65536;LOCK_MODE=0;UNDO_LOG=0";
5251

53-
private static String fileUrl;
54-
55-
private static final String TABLE_CREATE_SQL_TEMPLATE = "CREATE TABLE `%s` ( %s )";
5652

5753
public static final SqlDialect SQL_DIALECT = new H2Dialect();
5854

@@ -283,6 +279,8 @@ private static Dataframe execute(Connection connection, QueryScript queryScript,
283279

284280
String sql = render.render(true, false, false);
285281

282+
log.debug(sql);
283+
286284
ResultSet resultSet = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).executeQuery(sql);
287285
PageInfo pageInfo = executeParam.getPageInfo();
288286
resultSet.last();
@@ -312,7 +310,7 @@ private static String getDatabaseUrl(String database) {
312310
} else {
313311
database = toDatabase(database);
314312
}
315-
return fileUrl = String.format("jdbc:h2:file:%s/%s" + H2_PARAM, getDbFileBasePath(), database);
313+
return String.format("jdbc:h2:file:%s/%s" + H2_PARAM, getDbFileBasePath(), database);
316314
}
317315

318316
private static String getDbFileBasePath() {

frontend/craco.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ module.exports = {
115115
setupFiles: ['jest-canvas-mock'],
116116
});
117117
},
118+
modulePaths: ['../'],
118119
},
119120

120121
devServer: {

frontend/src/app/components/ChartEditor.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import {
4242
SaveFormContext,
4343
useSaveFormContext,
4444
} from 'app/pages/MainPage/pages/VizPage/SaveFormContext';
45-
import { useMainSlice } from 'app/pages/MainPage/slice';
4645
import { IChart } from 'app/types/Chart';
4746
import { ChartDTO } from 'app/types/ChartDTO';
4847
import { makeDownloadDataTask } from 'app/utils/fetch';
@@ -103,7 +102,6 @@ export const ChartEditor: React.FC<ChartEditorProps> = ({
103102
}) => {
104103
const saveFormContextValue = useSaveFormContext();
105104
const { actions } = useWorkbenchSlice();
106-
const { actions: mainActions } = useMainSlice();
107105
const dispatch = useDispatch();
108106
const dataset = useSelector(datasetsSelector);
109107
const dataview = useSelector(currentDataViewSelector);
@@ -477,7 +475,7 @@ export const ChartEditor: React.FC<ChartEditorProps> = ({
477475
],
478476
fileName: backendChart?.name || 'chart',
479477
resolve: () => {
480-
dispatch(mainActions.setDownloadPolling(true));
478+
dispatch(actions.setChartEditorDownloadPolling(true));
481479
},
482480
}),
483481
);
@@ -489,7 +487,7 @@ export const ChartEditor: React.FC<ChartEditorProps> = ({
489487
dataChartId,
490488
dataview,
491489
dispatch,
492-
mainActions,
490+
actions,
493491
widgetId,
494492
]);
495493

frontend/src/app/components/ChartGraph/BasicBarChart/BasicBarChart.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import {
2727
getReference2,
2828
getSeriesTooltips4Rectangular2,
2929
getStyles,
30+
hadAxisLabelOverflowConfig,
31+
setOptionsByAxisLabelOverflow,
3032
toFormattedValue,
3133
transformToDataSet,
3234
} from 'app/utils/chartHelper';
@@ -90,6 +92,8 @@ class BasicBarChart extends Chart {
9092

9193
onResize(opt: any, context): void {
9294
this.chart?.resize({ width: context?.width, height: context?.height });
95+
hadAxisLabelOverflowConfig(this.chart?.getOption()) &&
96+
this.onUpdated(opt, context);
9397
}
9498

9599
getOptions(dataset: ChartDataSetDTO, config: ChartConfig) {
@@ -152,6 +156,17 @@ class BasicBarChart extends Chart {
152156
this.makeTransposeAxis(axisInfo);
153157
}
154158

159+
// @TM 溢出自动根据bar长度设置标尺
160+
const option = setOptionsByAxisLabelOverflow({
161+
chart: this.chart,
162+
xAxis: axisInfo.xAxis,
163+
yAxis: axisInfo.yAxis,
164+
grid: getGridStyle(styleConfigs),
165+
yAxisNames,
166+
series,
167+
horizon: this.isHorizonDisplay,
168+
});
169+
155170
return {
156171
tooltip: {
157172
trigger: 'item',
@@ -164,10 +179,7 @@ class BasicBarChart extends Chart {
164179
),
165180
},
166181
legend: this.getLegendStyle(styleConfigs, series),
167-
grid: getGridStyle(styleConfigs),
168-
xAxis: axisInfo.xAxis,
169-
yAxis: axisInfo.yAxis,
170-
series,
182+
...option,
171183
};
172184
}
173185

@@ -428,6 +440,7 @@ class BasicBarChart extends Chart {
428440
rotate,
429441
showInterval,
430442
interval,
443+
overflow,
431444
] = getStyles(
432445
styles,
433446
['xAxis'],
@@ -440,6 +453,7 @@ class BasicBarChart extends Chart {
440453
'rotate',
441454
'showInterval',
442455
'interval',
456+
'overflow',
443457
],
444458
);
445459
const [showVerticalLine, verticalLineStyle] = getStyles(
@@ -455,6 +469,7 @@ class BasicBarChart extends Chart {
455469
show: showLabel,
456470
rotate,
457471
interval: showInterval ? interval : 'auto',
472+
overflow,
458473
...font,
459474
},
460475
axisLine: {
@@ -474,10 +489,10 @@ class BasicBarChart extends Chart {
474489

475490
private getLegendStyle(styles, series) {
476491
const seriesNames = (series || []).map((col: any) => col?.name);
477-
const [show, type, font, legendPos, selectAll] = getStyles(
492+
const [show, type, font, legendPos, selectAll, height] = getStyles(
478493
styles,
479494
['legend'],
480-
['showLegend', 'type', 'font', 'position', 'selectAll'],
495+
['showLegend', 'type', 'font', 'position', 'selectAll', 'height'],
481496
);
482497
let positions = {};
483498
let orient = {};
@@ -512,6 +527,7 @@ class BasicBarChart extends Chart {
512527
...positions,
513528
show,
514529
type,
530+
height: height || null,
515531
orient,
516532
selected,
517533
data: seriesNames,

frontend/src/app/components/ChartGraph/BasicBarChart/config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,16 @@ const config: ChartConfig = {
246246
],
247247
},
248248
},
249+
{
250+
label: 'legend.height',
251+
key: 'height',
252+
default: 0,
253+
comType: 'inputNumber',
254+
options: {
255+
step: 40,
256+
min: 0,
257+
},
258+
},
249259
{
250260
label: 'viz.palette.style.font',
251261
key: 'font',
@@ -553,6 +563,7 @@ const config: ChartConfig = {
553563
position: '位置',
554564
showInterval: '显示刻度',
555565
interval: '刻度间隔',
566+
overflow: '溢出',
556567
showTitleAndUnit: '显示标题和刻度',
557568
nameLocation: '标题位置',
558569
nameRotate: '标题旋转',
@@ -571,6 +582,7 @@ const config: ChartConfig = {
571582
type: '图例类型',
572583
selectAll: '图例全选',
573584
position: '图例位置',
585+
height: '图例高度',
574586
},
575587
data: {
576588
color: '颜色',
@@ -624,6 +636,7 @@ const config: ChartConfig = {
624636
position: 'Position',
625637
showInterval: 'Show Interval',
626638
interval: 'Interval',
639+
overflow: 'Overflow',
627640
showTitleAndUnit: 'Show Title and Unit',
628641
nameLocation: 'Name Location',
629642
nameRotate: 'Name Rotate',
@@ -635,13 +648,15 @@ const config: ChartConfig = {
635648
title: 'Label',
636649
showLabel: 'Show Label',
637650
position: 'Position',
651+
height: 'Height',
638652
},
639653
legend: {
640654
title: 'Legend',
641655
showLegend: 'Show Legend',
642656
type: 'Type',
643657
selectAll: 'Select All',
644658
position: 'Position',
659+
height: 'Height',
645660
},
646661
data: {
647662
color: 'Color',

0 commit comments

Comments
 (0)