Skip to content

Commit

Permalink
CB-3972 safe way to get action check for the document (#2261)
Browse files Browse the repository at this point in the history
  • Loading branch information
devnaumov authored Jan 3, 2024
1 parent 1330b95 commit d719008
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,25 @@ export class DVResultSetGroupingPluginBootstrap extends Bootstrap {
if (!model.source.hasResult(resultIndex)) {
return true;
}
const selectionAction = model.source.getAction(resultIndex, ResultSetSelectAction);
const dataAction = model.source.getAction(resultIndex, ResultSetDataAction);

return !grouping.getColumns().some(name => {
const key = dataAction.findColumnKey(column => column.name === name);
const format = model.source.getResult(resultIndex)?.dataFormat;

if (!key) {
return false;
}
if (format === ResultDataFormat.Resultset) {
const selectionAction = model.source.getAction(resultIndex, ResultSetSelectAction);
const dataAction = model.source.getAction(resultIndex, ResultSetDataAction);

return selectionAction.isElementSelected({ column: key });
});
return !grouping.getColumns().some(name => {
const key = dataAction.findColumnKey(column => column.name === name);

if (!key) {
return false;
}

return selectionAction.isElementSelected({ column: key });
});
}

return true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ import { createDataContext } from '@cloudbeaver/core-data-context';
import type { IDatabaseDataModel } from '../IDatabaseDataModel';
import type { IDatabaseDataOptions } from '../IDatabaseDataOptions';

export const DATA_CONTEXT_DV_DDM = createDataContext<IDatabaseDataModel<IDatabaseDataOptions, any>>('data-viewer-database-data-model');
export const DATA_CONTEXT_DV_DDM = createDataContext<IDatabaseDataModel<IDatabaseDataOptions>>('data-viewer-database-data-model');

0 comments on commit d719008

Please sign in to comment.