-
Notifications
You must be signed in to change notification settings - Fork 0
/
frisk.config.ts
99 lines (88 loc) · 2.29 KB
/
frisk.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import type { HTMLInputTypeAttribute } from "react";
import { getMyMicrosoftTeams, getTeam } from "@/services/backend";
export const config: FriskConfig = {
metadata: [
{
key: "team",
type: "select",
label: "Ansvarlig team for denne funksjonen?",
getOptions: async () => {
const teams = await getMyMicrosoftTeams();
return teams.map((team) => ({
name: team.displayName,
value: team.id,
}));
},
getDisplayValue: async (input) => {
const team = await getTeam(input.value);
return team.displayName;
},
selectMode: "single",
showOn: "createAndUpdate",
isRequired: true,
placeholder: "Velg team",
inheritFromParent: true,
},
{
key: "backstage-url",
type: "url",
label: "Lenke til utviklerportalen",
showOn: "createAndUpdate",
isRequired: false,
placeholder: "Sett inn lenke",
inheritFromParent: false,
getDisplayValue: async () => {
return "Utviklerportalen";
},
},
],
logo: {
imageSource: "/logo.svg",
},
title: "Funksjonsregisteret",
description:
"Smell opp noen bra funksjoner og få den oversikten du fortjener",
rootNodeName: "Kartverket",
columnName: "Funksjon",
addButtonName: "Legg til funksjon",
};
type FriskConfig = {
metadata: Metadata[];
logo: Logo;
title: string;
description: string;
rootNodeName: string;
columnName: string;
addButtonName: string;
};
type GeneralMetadataContent = {
key: string;
label: string;
inheritFromParent: boolean;
getDisplayValue?: (input: { key: string; value: string }) => Promise<string>;
};
type GeneralRequiredMetadata = GeneralMetadataContent & {
isRequired: true;
showOn: "createAndUpdate";
};
type GeneralOptionalMetadata = GeneralMetadataContent & {
isRequired: false;
showOn: "update" | "createAndUpdate";
};
type GeneralMetadata = GeneralRequiredMetadata | GeneralOptionalMetadata;
export type SelectMetadata = GeneralMetadata & {
getOptions: () => Promise<SelectOption[]>;
selectMode: "single" | "multi";
type: "select";
placeholder: string;
};
export type InputMetadata = GeneralMetadata & {
type: Extract<HTMLInputTypeAttribute, "number" | "text" | "url">;
placeholder: string;
};
type Metadata = SelectMetadata | InputMetadata;
export type SelectOption = { value: string; name: string };
type Logo = {
imageSource: string;
logoLink?: string;
};