Skip to content

Commit bc8d5f2

Browse files
authored
feat: Make rollup group behaviour a setting in the global settings menu (#2183)
Closes #2128
1 parent dcc95f6 commit bc8d5f2

13 files changed

Lines changed: 380 additions & 193 deletions

File tree

packages/app-utils/src/storage/LocalWorkspaceStorage.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class LocalWorkspaceStorage implements WorkspaceStorage {
5656
truncateNumbersWithPound: false,
5757
showEmptyStrings: true,
5858
showNullStrings: true,
59+
showExtraGroupColumn: true,
5960
defaultNotebookSettings: {
6061
isMinimapEnabled: false,
6162
},
@@ -103,6 +104,10 @@ export class LocalWorkspaceStorage implements WorkspaceStorage {
103104
serverConfigValues,
104105
'showNullStrings'
105106
),
107+
showExtraGroupColumn: LocalWorkspaceStorage.getBooleanServerConfig(
108+
serverConfigValues,
109+
'showExtraGroupColumn'
110+
),
106111
defaultNotebookSettings:
107112
serverConfigValues?.get('isMinimapEnabled') !== undefined
108113
? {

packages/code-studio/src/settings/FormattingSectionContent.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
getTruncateNumbersWithPound,
2929
getShowEmptyStrings,
3030
getShowNullStrings,
31+
getShowExtraGroupColumn,
3132
updateSettings as updateSettingsAction,
3233
RootState,
3334
WorkspaceSettings,
@@ -56,6 +57,7 @@ interface FormattingSectionContentProps {
5657
truncateNumbersWithPound: boolean;
5758
showEmptyStrings: boolean;
5859
showNullStrings: boolean;
60+
showExtraGroupColumn: boolean;
5961
updateSettings: (settings: Partial<WorkspaceSettings>) => void;
6062
defaultDecimalFormatOptions: FormatOption;
6163
defaultIntegerFormatOptions: FormatOption;
@@ -72,6 +74,7 @@ interface FormattingSectionContentState {
7274
truncateNumbersWithPound: boolean;
7375
showEmptyStrings: boolean;
7476
showNullStrings: boolean;
77+
showExtraGroupColumn: boolean;
7578
timestampAtMenuOpen: Date;
7679
}
7780

@@ -113,6 +116,8 @@ export class FormattingSectionContent extends PureComponent<
113116
this.handleShowEmptyStringsChange.bind(this);
114117
this.handleShowNullStringsChange =
115118
this.handleShowNullStringsChange.bind(this);
119+
this.handleShowExtraGroupColumnChange =
120+
this.handleShowExtraGroupColumnChange.bind(this);
116121

117122
const {
118123
defaultDateTimeFormat,
@@ -124,6 +129,7 @@ export class FormattingSectionContent extends PureComponent<
124129
truncateNumbersWithPound,
125130
showEmptyStrings,
126131
showNullStrings,
132+
showExtraGroupColumn,
127133
} = props;
128134

129135
this.containerRef = React.createRef();
@@ -139,6 +145,7 @@ export class FormattingSectionContent extends PureComponent<
139145
truncateNumbersWithPound,
140146
showEmptyStrings,
141147
showNullStrings,
148+
showExtraGroupColumn,
142149
timestampAtMenuOpen: new Date(),
143150
};
144151
}
@@ -330,6 +337,15 @@ export class FormattingSectionContent extends PureComponent<
330337
this.queueUpdate(update);
331338
}
332339

340+
handleShowExtraGroupColumnChange(): void {
341+
const { showExtraGroupColumn } = this.state;
342+
const update = {
343+
showExtraGroupColumn: !showExtraGroupColumn,
344+
};
345+
this.setState(update);
346+
this.queueUpdate(update);
347+
}
348+
333349
commitChanges(): void {
334350
const { updateSettings } = this.props;
335351
const updates = this.pendingUpdates.reduce(
@@ -356,6 +372,7 @@ export class FormattingSectionContent extends PureComponent<
356372
truncateNumbersWithPound,
357373
showEmptyStrings,
358374
showNullStrings,
375+
showExtraGroupColumn,
359376
} = this.state;
360377

361378
const {
@@ -596,6 +613,23 @@ export class FormattingSectionContent extends PureComponent<
596613
</Checkbox>
597614
</div>
598615
</div>
616+
617+
<div className="form-row mb-3" id="show_extra_group_column_div">
618+
<label
619+
className="col-form-label col-3"
620+
htmlFor="default-show-extra-group-column"
621+
>
622+
Rollup
623+
</label>
624+
<div className="col pr-0 pt-2" id="default-show-extra-group-column">
625+
<Checkbox
626+
checked={showExtraGroupColumn}
627+
onChange={this.handleShowExtraGroupColumnChange}
628+
>
629+
Show extra &quot;group&quot; column
630+
</Checkbox>
631+
</div>
632+
</div>
599633
</div>
600634
</div>
601635
);
@@ -614,6 +648,7 @@ const mapStateToProps = (
614648
truncateNumbersWithPound: getTruncateNumbersWithPound(state),
615649
showEmptyStrings: getShowEmptyStrings(state),
616650
showNullStrings: getShowNullStrings(state),
651+
showExtraGroupColumn: getShowExtraGroupColumn(state),
617652
timeZone: getTimeZone(state),
618653
defaults: getDefaultSettings(state),
619654
});

packages/eslint-config/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ module.exports = {
2020
'react/jsx-uses-react': 'error',
2121
'react/jsx-uses-vars': 'error',
2222
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
23+
'react-hooks/exhaustive-deps': [
24+
'warn',
25+
{
26+
additionalHooks: '(useOnChange)',
27+
},
28+
],
2329
'react/react-in-jsx-scope': 'off',
2430
'react/sort-comp': [
2531
2,

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
523523
truncateNumbersWithPound: false,
524524
showEmptyStrings: true,
525525
showNullStrings: true,
526+
showExtraGroupColumn: true,
526527
formatter: EMPTY_ARRAY,
527528
decimalFormatOptions: PropTypes.shape({
528529
defaultFormatString: PropTypes.string,
@@ -637,6 +638,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
637638
this.truncateNumbersWithPound = false;
638639
this.showEmptyStrings = true;
639640
this.showNullStrings = true;
641+
this.showExtraGroupColumn = true;
640642

641643
// When the loading scrim started/when it should extend to the end of the screen.
642644
this.tableSaver = null;
@@ -1023,6 +1025,8 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
10231025

10241026
showNullStrings: boolean;
10251027

1028+
showExtraGroupColumn: boolean;
1029+
10261030
// When the loading scrim started/when it should extend to the end of the screen.
10271031
loadingScrimStartTime?: number;
10281032

@@ -1870,6 +1874,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
18701874

18711875
const showEmptyStrings = settings?.showEmptyStrings ?? true;
18721876
const showNullStrings = settings?.showNullStrings ?? true;
1877+
const showExtraGroupColumn = settings?.showExtraGroupColumn ?? true;
18731878

18741879
const isColumnFormatChanged = !deepEqual(
18751880
this.globalColumnFormats,
@@ -1892,6 +1897,8 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
18921897
const isShowEmptyStringsChanged =
18931898
this.showEmptyStrings !== showEmptyStrings;
18941899
const isShowNullStringsChanged = this.showNullStrings !== showNullStrings;
1900+
const isShowExtraGroupColumnChanged =
1901+
this.showExtraGroupColumn !== showExtraGroupColumn;
18951902

18961903
if (
18971904
isColumnFormatChanged ||
@@ -1900,7 +1907,8 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
19001907
isIntegerFormattingChanged ||
19011908
isTruncateNumbersChanged ||
19021909
isShowEmptyStringsChanged ||
1903-
isShowNullStringsChanged
1910+
isShowNullStringsChanged ||
1911+
isShowExtraGroupColumnChanged
19041912
) {
19051913
this.globalColumnFormats = globalColumnFormats;
19061914
this.dateTimeFormatterOptions = dateTimeFormatterOptions;
@@ -1909,6 +1917,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
19091917
this.truncateNumbersWithPound = truncateNumbersWithPound;
19101918
this.showEmptyStrings = showEmptyStrings;
19111919
this.showNullStrings = showNullStrings;
1920+
this.showExtraGroupColumn = showExtraGroupColumn;
19121921
this.updateFormatter({}, forceUpdate);
19131922

19141923
if (isDateFormattingChanged && forceUpdate) {
@@ -4810,7 +4819,6 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
48104819
{isVisible && (
48114820
<IrisGridModelUpdater
48124821
model={model}
4813-
modelColumns={model.columns}
48144822
top={top}
48154823
bottom={bottom}
48164824
left={left}
@@ -4857,6 +4865,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
48574865
frozenColumns={frozenColumns}
48584866
columnHeaderGroups={columnHeaderGroups}
48594867
partitionConfig={partitionConfig}
4868+
showExtraGroupColumn={this.showExtraGroupColumn}
48604869
/>
48614870
)}
48624871
{!isMenuShown && (

0 commit comments

Comments
 (0)