Skip to content

Commit

Permalink
Merge branch '4.9.1' into bug/6985-vulnerability-dashboard-error-load…
Browse files Browse the repository at this point in the history
…ing-for-read-only-user
  • Loading branch information
asteriscos authored Sep 13, 2024
2 parents d628b43 + d7ee5e8 commit 4d78894
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Change the text of the query limit tooltip [#6981](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6981)
- Upgraded the `axios` dependency to `1.7.4` [#6919](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6919)
- Improved MITRE ATT&CK intelligence flyout details readability [#6954](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6954)
- Upgraded Event-tab column selector showing first the picked columns [#6984](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6984)
- Changed vulnerabilities.reference to links in Vulnerability Detection > Inventory columns [#6960](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6960)
- Upgraded the `follow-redirects` dependency to `1.15.6` [#6982](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6982)

Expand Down
32 changes: 30 additions & 2 deletions plugins/main/public/components/common/data-grid/use-data-grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,39 @@ export const useDataGrid = (props: tDataGridProps): EuiDataGridProps => {
];
}, [results]);

const filterColumns = () => {
const allColumns = parseColumns(indexPattern?.fields || [], defaultColumns);
const columnMatch = [];
const columnNonMatch = [];

for (const item of allColumns) {
if (columnVisibility.includes(item.name)) {
columnMatch.push(item);
} else {
columnNonMatch.push(item);
}
}

return [...columnMatch, ...columnNonMatch];
};

const defaultColumnsPosition = (columnsVisibility, defaultColumns) => {
const defaults = defaultColumns
.map(item => item.id)
.filter(id => columnsVisibility.includes(id));

const nonDefaults = columnsVisibility.filter(
item => !defaultColumns.map(item => item.id).includes(item),
);

return [...defaults, ...nonDefaults];
};

return {
'aria-labelledby': props.ariaLabelledBy,
columns: parseColumns(indexPattern?.fields || [], defaultColumns),
columns: filterColumns(),
columnVisibility: {
visibleColumns: columnVisibility,
visibleColumns: defaultColumnsPosition(columnVisibility, defaultColumns),
setVisibleColumns: setVisibility,
},
renderCellValue: renderCellValue,
Expand Down

0 comments on commit 4d78894

Please sign in to comment.