Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-7415: [Subitems] As a User I want to see columns dependant on focus mode #1069

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/bundle/ui-dev/src/modules/sub-items/sub.items.module.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';

import { getAdminUiConfig } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import ViewColumnsTogglerComponent from './components/view-columns-toggler/view.columns.toggler';
import ViewSwitcherComponent from './components/view-switcher/view.switcher.component.js';
import SubItemsListComponent from './components/sub-items-list/sub.items.list.component.js';
@@ -97,6 +98,7 @@ export default class SubItemsModule extends Component {
this._refMainContainerWrapper = React.createRef();
this.bulkActionModalContainer = null;
this.udwContainer = null;
this.adminUiConfig = getAdminUiConfig();

const sortClauseData = this.getDefaultSortClause(props.sortClauses);

@@ -1255,7 +1257,7 @@ export default class SubItemsModule extends Component {
onSortChange={this.changeSorting}
sortClause={sortClause}
sortOrder={sortOrder}
columnsVisibility={this.filterSmartModeColumns(columnsVisibility)}
columnsVisibility={this.filterColumnsVisibility(columnsVisibility)}
languageContainerSelector={this.props.languageContainerSelector}
/>
);
@@ -1271,14 +1273,20 @@ export default class SubItemsModule extends Component {
);
}

filterSmartModeColumns(allColumns) {
// TODO: filter when smart mode implemented
const expertModeColumns = ['section', 'location-id', 'location-remote-id', 'object-id', 'object-remote-id'];
getColumnsToFilterOut() {
if (this.adminUiConfig.focusMode) {
return ['section', 'location-id', 'location-remote-id', 'object-id', 'object-remote-id'];
}

return [];
}

filterColumnsVisibility(allColumns) {
const columnsToFilterOut = this.getColumnsToFilterOut();
const filteredColumns = {};

Object.keys(allColumns).forEach((columnKey) => {
if (!expertModeColumns.includes(columnKey)) {
if (!columnsToFilterOut.includes(columnKey)) {
filteredColumns[columnKey] = allColumns[columnKey];
}
});
@@ -1357,7 +1365,7 @@ export default class SubItemsModule extends Component {
{this.renderBulkUnhideBtn(bulkUnhideBtnDisabled)}
{this.renderBulkDeleteBtn(bulkBtnDisabled)}
<ViewColumnsTogglerComponent
columnsVisibility={this.filterSmartModeColumns(columnsVisibility)}
columnsVisibility={this.filterColumnsVisibility(columnsVisibility)}
toggleColumnVisibility={this.toggleColumnVisibility}
/>
<ViewSwitcherComponent onViewChange={this.switchView} activeView={activeView} isDisabled={!totalCount} />
Loading