Skip to content

Commit

Permalink
Fixed issue where view-id wasn't added to url (PortfolioWebParts) #1355
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Apr 18, 2024
1 parent 6cfbb2e commit c0f1de9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Sjekk ut [release notes](./releasenotes/1.9.0.md) for høydepunkter og mer detal
- Rettet et problem hvor valuta ikke ble riktig sortert på porteføljeoversikt og andre aggregerte oversikter [#1369](https://github.com/Puzzlepart/prosjektportalen365/issues/1369)
- 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)

### Forbedringer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { format, MessageBarType } from '@fluentui/react'
import { createReducer } from '@reduxjs/toolkit'
import sortArray from 'array-sort'
import strings from 'PortfolioWebPartsStrings'
import { ProjectColumn } from 'pp365-shared-library'
import { ProjectColumn, setUrlHash } from 'pp365-shared-library'
import _ from 'underscore'
import { IPortfolioOverviewState } from '../types'
import { IPortfolioOverviewHashState, IPortfolioOverviewState } from '../types'
import {
CHANGE_VIEW,
COLUMN_DELETED,
Expand Down Expand Up @@ -65,6 +65,10 @@ const $createReducer = (params: IPortfolioOverviewReducerParams) =>
.addCase(DATA_FETCHED, (state, { payload }) => {
state.items = payload.items
state.currentView = payload.currentView
const obj: IPortfolioOverviewHashState = {}
if (state.currentView) obj.viewId = payload.currentView.id.toString()
if (state.groupBy) obj.groupBy = state.groupBy.fieldName
setUrlHash(obj)
state.columns = payload.currentView.columns
state.groupBy = payload.groupBy
state.managedProperties = payload.managedProperties ?? []
Expand Down Expand Up @@ -107,6 +111,10 @@ const $createReducer = (params: IPortfolioOverviewReducerParams) =>
})
.addCase(CHANGE_VIEW, (state, { payload }) => {
state.isChangingView = !!payload
const obj: IPortfolioOverviewHashState = {}
if (state.currentView) obj.viewId = payload.id.toString()
if (state.groupBy) obj.groupBy = state.groupBy.fieldName
setUrlHash(obj)
state.currentView = payload
state.columns = payload.columns
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,15 @@ export interface IPortfolioOverviewState
*/
managedProperties?: string[]
}

export interface IPortfolioOverviewHashState {
/**
* viewId found in hash (document.location.hash)
*/
viewId?: string

/**
* groupBy found in hash (document.location.hash)
*/
groupBy?: string
}

0 comments on commit c0f1de9

Please sign in to comment.