Skip to content

Commit

Permalink
Fiks for feil ved utlisting av alle prosjekter i et program (#1173)
Browse files Browse the repository at this point in the history
* Fiks for #1150

* Changelog

---------

Co-authored-by: Remi Blom-Ohlsen <[email protected]>
  • Loading branch information
olemp and Remi749 authored Jun 20, 2023
1 parent 8a7f925 commit 4ab3e16
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 171 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Sjekk ut [release notes](./releasenotes/1.8.0.md) for høydepunkter og mer detal
- Fikset et problem hvor 'Hooks' ikke ble kjørt på slutten av provisjoneringen av et prosjekt [#1127](https://github.com/Puzzlepart/prosjektportalen365/issues/1127)
- Fikset et problem hvor prosjekttidslinje på prosjektnivå ikke returnerte tidslinje-elementer for prosjektet [#1172](https://github.com/Puzzlepart/prosjektportalen365/pull/1172)
- Rettet en feil hvor Excel eksporten gir feilmelding når datofelt mangler data. [#1180](https://github.com/Puzzlepart/prosjektportalen365/issues/1180)
- Fikset et program hvor prosjekter ble vist selvom det ikke var tilknyttet prosjekter til et program [#1150](https://github.com/Puzzlepart/prosjektportalen365/pull/1150)

---

## 1.8.2 - TBA
## 1.8.2 - 08.06.23

### Ny funksjonalitet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import * as strings from 'ProgramWebPartsStrings'
import React, { FC, useContext } from 'react'
import { columns } from '../columns'
import { ProgramAdministrationContext } from '../context'
import { addChildProjects } from '../data'
import { ListHeaderSearch } from '../ListHeaderSearch'
import { ADD_CHILD_PROJECTS, TOGGLE_ADD_PROJECT_DIALOG } from '../reducer'
import styles from './AddProjectDialog.module.scss'
Expand Down Expand Up @@ -62,7 +61,7 @@ export const AddProjectDialog: FC = () => {
text={strings.Add}
disabled={_.isEmpty(context.state.selectedProjectsToAdd)}
onClick={async () => {
await addChildProjects(context.props.dataAdapter, context.state.selectedProjectsToAdd)
await context.props.dataAdapter.addChildProjects(context.state.selectedProjectsToAdd)
context.dispatch(ADD_CHILD_PROJECTS())
}}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useContext, useEffect } from 'react'
import { ProgramAdministrationContext } from '../context'
import { getHubSiteProjects } from '../data'
import { DATA_LOADED, SET_SELECTED_TO_ADD } from '../reducer'
import { useRowRenderer } from '../useRowRenderer'
import { useSelectionList } from '../useSelectionList'
Expand All @@ -14,7 +13,7 @@ export const useAddProjectDialog = () => {
})

useEffect(() => {
getHubSiteProjects()
context.props.dataAdapter.getHubSiteProjects()
.then((availableProjects) =>
context.dispatch(DATA_LOADED({ data: { availableProjects }, scope: 'AddProjectDialog' }))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { isEmpty } from '@microsoft/sp-lodash-subset'
import * as strings from 'ProgramWebPartsStrings'
import React, { FC, useContext } from 'react'
import { ProgramAdministrationContext } from '../context'
import { removeChildProjects } from '../data'
import { CHILD_PROJECTS_REMOVED, TOGGLE_ADD_PROJECT_DIALOG } from '../reducer'

export const Commands: FC = () => {
Expand All @@ -25,7 +24,7 @@ export const Commands: FC = () => {
disabled:
isEmpty(context.state.selectedProjectsToDelete) || !context.state.userHasManagePermission,
onClick: () => {
removeChildProjects(context.props.dataAdapter, context.state.selectedProjectsToDelete).then(
context.props.dataAdapter.removeChildProjects(context.state.selectedProjectsToDelete).then(
(childProjects) => {
context.dispatch(CHILD_PROJECTS_REMOVED({ childProjects }))
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { sp } from '@pnp/sp'
import { ProjectAdminPermission } from 'pp365-shared/lib/data/SPDataAdapterBase/ProjectAdminPermission'
import { useReducer, useEffect } from 'react'
import { fetchChildProjects } from './data'
import reducer, { initialState, DATA_LOADED, SET_SELECTED_TO_DELETE } from './reducer'
import { IProgramAdministrationProps } from './types'
import { useRowRenderer } from './useRowRenderer'
Expand All @@ -22,14 +21,14 @@ export const useProgramAdministration = (props: IProgramAdministrationProps) =>
useEffect(() => {
props.dataAdapter.project.getPropertiesData().then((properties) => {
Promise.all([
fetchChildProjects(props.dataAdapter),
props.dataAdapter.fetchChildProjects(),
props.dataAdapter.checkProjectAdminPermissions(
ProjectAdminPermission.ChildProjectsAdmin,
properties.fieldValues
)
]).then(([childProjects, userHasManagePermission]) =>
]).then(([childProjects, userHasManagePermission]) => {
dispatch(DATA_LOADED({ data: { childProjects, userHasManagePermission }, scope: 'root' }))
)
})
})
}, [])

Expand Down
Loading

0 comments on commit 4ab3e16

Please sign in to comment.