Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit ce778d8

Browse files
committed
fix teamkatalogen info
1 parent 8546f34 commit ce778d8

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

components/search/resultList.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ type ResultListInterface = {
2222
name: string
2323
keywords: string[]
2424
slug: string
25-
owner: { __typename?: 'Owner' | undefined; group: string }
25+
owner: {
26+
__typename?: 'Owner' | undefined;
27+
group: string;
28+
teamkatalogenURL?: string;}
2629
}[]
2730
stories?: {
2831
__typename?: 'Story'
@@ -67,17 +70,17 @@ const ResultList = ({
6770

6871
const isDataProduct = (item: any) => !!item.datasets
6972

70-
const getTeamKatalogenInfo = (item: any) => {
73+
const getTeamKatalogenInfo = (teamkatalogenURL: any) => {
7174
const getTeamID = (url: string) => {
7275
var urlComponents = url?.split("/")
7376
return urlComponents?.[urlComponents.length - 1]
7477
}
75-
const tk = teamkatalogen?.find((it) => getTeamID(it.url) == getTeamID(item?.owner?.teamkatalogenURL))
78+
const tk = teamkatalogen?.find((it) => getTeamID(it.url) == getTeamID(teamkatalogenURL))
7679
const po = productAreas?.find((it) => it.id == tk?.productAreaID)
7780

7881
return {
7982
productArea: po?.name,
80-
teamkatalogenTeam: tk?.name || item.group?.group
83+
teamkatalogenTeam: tk?.name
8184
}
8285
}
8386

@@ -129,7 +132,7 @@ const ResultList = ({
129132
group: it.result.group,
130133
teamkatalogenURL: it.result.teamkatalogenURL,
131134
}}
132-
{...getTeamKatalogenInfo(it.result)}
135+
{...getTeamKatalogenInfo(it.result.teamkatalogenURL)}
133136
/>
134137
)
135138
)
@@ -148,7 +151,7 @@ const ResultList = ({
148151
description={d.result.description}
149152
link={`/dataproduct/${d.result.id}/${d.result.slug}`}
150153
datasets={d.result.datasets}
151-
{...getTeamKatalogenInfo(d.result)}
154+
{...getTeamKatalogenInfo(d.result.group.teamkatalogenURL)}
152155
/>
153156
)
154157
)}
@@ -168,7 +171,7 @@ const ResultList = ({
168171
name={d.name}
169172
keywords={d.keywords}
170173
link={`/dataproduct/${d.id}/${d.slug}`}
171-
{...getTeamKatalogenInfo(d)}
174+
{...getTeamKatalogenInfo(d.owner.teamkatalogenURL)}
172175
/>
173176
))}
174177
</Results>
@@ -190,7 +193,7 @@ const ResultList = ({
190193
name={s.name}
191194
resourceType={"datafortelling"}
192195
link={`/story/${s.id}`}
193-
{...getTeamKatalogenInfo(s)}
196+
{...getTeamKatalogenInfo(s.teamkatalogenURL)}
194197
keywords={s.keywords}
195198
editable={true}
196199
description={s.description}
@@ -217,7 +220,7 @@ const ResultList = ({
217220
id={p.id}
218221
name={p.name}
219222
link={p.link}
220-
{...getTeamKatalogenInfo(p)}
223+
{...getTeamKatalogenInfo(p.teamkatalogenURL)}
221224
description={p.description}
222225
innsiktsproduktType={p.type}
223226
editable={!!userInfo?.googleGroups?.find((it: any) => it.email == p.group)}

0 commit comments

Comments
 (0)