Skip to content

Commit

Permalink
Always show uncategorized ProjectContentColumns for all aggregated ca…
Browse files Browse the repository at this point in the history
…tegories
  • Loading branch information
Remi749 committed Jan 24, 2024
1 parent d7e07ca commit a0505cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import _ from 'lodash'
import { useMemo } from 'react'
import { IPortfolioAggregationContext } from './context'
import { ProjectContentColumn } from 'pp365-shared-library'

/**
* Get default columns that should be included in the list view.
*
* @param context Context for the Portfolio Aggregation component
*/
export function useDefaultColumns(context: IPortfolioAggregationContext) {
const selectedColumns = useMemo(
const selectedColumns: ProjectContentColumn[] = useMemo(
() => _.filter([...context.state.columns], (c) => c.data?.isSelected || c.data?.isLocked),
[context.state.columns]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,14 @@ export class PortalDataService extends DataService<IPortalDataServiceConfigurati
)()
const filteredColumnItems = columnItems.filter(
(col) =>
col.GtDataSourceCategory === dataSourceCategory ||
col.GtDataSourceCategory === dataSourceCategory || col.GtDataSourceCategory === null ||
(!col.GtDataSourceCategory && !col.GtDataSourceLevel) ||
(!col.GtDataSourceCategory && _.contains(col.GtDataSourceLevel, level))
)

if (level === 'Prosjekt')
filteredColumnItems.filter((col) => col.GtInternalName !== 'SiteTitle')

return filteredColumnItems.map((item) => new ProjectContentColumn(item))
} catch (error) {
throw new Error(error)
Expand Down

0 comments on commit a0505cc

Please sign in to comment.