Skip to content

Commit

Permalink
Fix issue with view not refreshing to a newly created view #1441 [ski…
Browse files Browse the repository at this point in the history
…p-install]
  • Loading branch information
Remi749 committed Apr 18, 2024
1 parent c0f1de9 commit 3cf1404
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Sjekk ut [release notes](./releasenotes/1.9.0.md) for høydepunkter og mer detal
- Rettet et problem hvor eksportering av visninger som inneholdt felttypene 'valuta' og 'nummer' ble vist med masse desimaler [#1395](https://github.com/Puzzlepart/prosjektportalen365/issues/1395)
- Rettet et problem med visning av 'valuta' felt-verdier i redigeringspaneler for prosjektstatus og prosjektinformasjon [#1503](https://github.com/Puzzlepart/prosjektportalen365/issues/1503)
- Rettet et problem hvor visnings-id ikke la seg i URL feltet ved innlastning eller bytting av visninger i Porteføljeoversikt [#1355](https://github.com/Puzzlepart/prosjektportalen365/issues/1355)
- Rettet et problem hvor visnings-id ikke la seg i URL feltet ved opprettelse av nye visninger, samt oppdatering av visningen (Porteføljeoversikter og andre aggregerte oversikter) [#1441](https://github.com/Puzzlepart/prosjektportalen365/issues/1441)

### Forbedringer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export function useList(props: IListProps<any>) {
const onRenderItemColumn = useOnRenderItemColumn()
const onRenderDetailsHeader = useOnRenderDetailsHeader(props)
const columns = useMemo(
() => [...props.columns, addColumn].filter((col) => !col?.data?.isHidden && !props.hiddenColumns?.includes(col?.internalName)),
() =>
[...props.columns, addColumn].filter(
(col) => !col?.data?.isHidden && !props.hiddenColumns?.includes(col?.internalName)
),
[props.columns, props.hiddenColumns]
)
const layoutMode = props.isListLayoutModeJustified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ export const createPortfolioAggregationReducer = (
switch (payload.submitAction) {
case 'add':
{
const obj: IPortfolioAggregationHashState = {}
if (state.currentView) obj.viewId = payload.view.id.toString()
if (state.groupBy) obj.groupBy = state.groupBy.fieldName
setUrlHash(obj)
state.currentView = payload.view
state.views = [...state.views, payload.view]
state.viewForm = { isOpen: false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface IPortfolioAggregationConfiguration {

export interface IPortfolioAggregationProps<T = any>
extends IBaseComponentProps,
Pick<IListProps, 'isListLayoutModeJustified' | 'hiddenColumns'> {
Pick<IListProps, 'isListLayoutModeJustified' | 'hiddenColumns'> {
/**
* Configuration (columns and views etc)
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash'
import { SPPortfolioOverviewViewItem } from 'pp365-shared-library'
import { SET_VIEW_FORM_PANEL } from '../reducer'
import { PortfolioOverviewView, SPPortfolioOverviewViewItem } from 'pp365-shared-library'
import { CHANGE_VIEW, SET_VIEW_FORM_PANEL } from '../reducer'
import { usePortfolioOverviewContext } from '../usePortfolioOverviewContext'
import { useEditableView } from './useEditableView'
import { useId } from '@fluentui/react-components'
Expand Down Expand Up @@ -54,7 +54,17 @@ export function useViewFormPanel() {
GtPortfolioGroupById: currentView.groupById,
GtPortfolioColumnOrder: JSON.stringify(currentView.columnOrder)
}
await context.props.dataAdapter.portalDataService.addItemToList('PORTFOLIO_VIEWS', properties)
const view = await context.props.dataAdapter.portalDataService.addItemToList(
'PORTFOLIO_VIEWS',
properties
)

const newView = new PortfolioOverviewView({
...properties,
Id: view.Id
}).configure(currentView.columns)

context.dispatch(CHANGE_VIEW(newView))
}
context.dispatch(SET_VIEW_FORM_PANEL({ isOpen: false }))
}
Expand Down

0 comments on commit 3cf1404

Please sign in to comment.