Skip to content

Commit

Permalink
Søk i aggregerte oversikter søker nå også på prosjektnavn (#1124) [sk…
Browse files Browse the repository at this point in the history
…ip-ci]
  • Loading branch information
olemp committed Jun 15, 2023
1 parent 917f8b7 commit 16a40df
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 59 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Sjekk ut [release notes](./releasenotes/1.8.0.md) for høydepunkter og mer detal
## 1.8.3 - TBA

### Forbedringer

- Søk i aggregerte oversikter søker nå også på prosjektnavn [#1123](https://github.com/Puzzlepart/prosjektportalen365/issues/1123)
- Porteføljeoversikten støtter nå visning av URL-kolonner
- Støtte for manuelle konfigurasjoner (JSON-format) i risikomatrise [#1120](https://github.com/Puzzlepart/prosjektportalen365/issues/1120)
- Porteføljeoversikten støtter nå visning av URL-kolonner [#1130](https://github.com/Puzzlepart/prosjektportalen365/pull/1130)
Expand All @@ -16,6 +16,7 @@ Sjekk ut [release notes](./releasenotes/1.8.0.md) for høydepunkter og mer detal

- Rettet et problem hvor låst mal hindret mulighet for å gjøre et prosjekt om til overordnet område [#1134](https://github.com/Puzzlepart/prosjektportalen365/issues/1134)


## 1.8.2 - TBA

### Ny funksjonalitet
Expand Down
48 changes: 0 additions & 48 deletions SharePointFramework/PortfolioWebParts/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,6 @@
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"latest-projects-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/latestProjects/index.js",
"manifest": "./src/webparts/latestProjects/manifest.json"
}
]
},
"portfolio-insights-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/portfolioInsights/index.js",
"manifest": "./src/webparts/portfolioInsights/manifest.json"
}
]
},
"portfolio-overview-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/portfolioOverview/index.js",
"manifest": "./src/webparts/portfolioOverview/manifest.json"
}
]
},
"project-list-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/projectList/index.js",
"manifest": "./src/webparts/projectList/manifest.json"
}
]
},
"resource-allocation-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/resourceAllocation/index.js",
"manifest": "./src/webparts/resourceAllocation/manifest.json"
}
]
},
"project-timeline-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/projectTimeline/index.js",
"manifest": "./src/webparts/projectTimeline/manifest.json"
}
]
},
"portfolio-aggregation-web-part": {
"components": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,16 @@ export const renderItemColumn = (item: any, index: number, column: IColumn) => {
}

/**
* Get default columns
* Get default columns that should be included if the property `lockedColumns` is not
* set to `true` in the web part properties.
*
* @param props Props
*/
export const getDefaultColumns = (props: IPortfolioAggregationProps) => {
if (props.lockedColumns) return []
export const getDefaultColumns = ({
lockedColumns,
webPartContext
}: IPortfolioAggregationProps) => {
if (lockedColumns) return []
return [
{
key: 'SiteTitle',
Expand All @@ -138,7 +142,7 @@ export const getDefaultColumns = (props: IPortfolioAggregationProps) => {
webUrl={item.Path}
page='Portfolio'
hideAllActions={true}
webPartContext={props.webPartContext}
webPartContext={webPartContext}
onRenderToggleElement={(onToggle) => (
<Icon
iconName='Info'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@ import { IColumn } from '@fluentui/react/lib/DetailsList'
import { getObjectValue as get } from 'pp365-shared/lib/helpers'

/**
* Search item
* Search item by search term. Search term is matched against all columns,
* aswell as the SiteTitle property (name of the project). Uses `JSON.stringify`
* to create a string representation of the item, which is then matched against
* the search term.
*
* @param item Item
* @param searchTerm Search term
* @param columns Columns
*/
export const searchItem = (item: any, searchTerm: string, columns: IColumn[]) => {
searchTerm = searchTerm.toLowerCase()
const searchObj = columns.reduce((obj, col) => {
return { ...obj, [col.fieldName]: get(item, col.fieldName, null) }
}, {})
return JSON.stringify(searchObj).toLowerCase().indexOf(searchTerm) !== -1
try {
const searchObj = columns.reduce(
(obj, col, index) => {
return { ...obj, [index]: get(item, col.fieldName, null) }
},
{
[columns.length]: item['SiteTitle']
} as Record<string, any>
)
return JSON.stringify(searchObj).toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1
} catch (error) {
return false
}
}

0 comments on commit 16a40df

Please sign in to comment.