-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathInitiativeUiSchemaAssociations.ts
101 lines (100 loc) · 3.83 KB
/
InitiativeUiSchemaAssociations.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
100
101
import { checkPermission } from "../../permissions/checkPermission";
import { IArcGISContext } from "../../ArcGISContext";
import { IUiSchema } from "../../core/schemas/types";
import { IHubInitiative } from "../../core/types";
/**
* @private
* constructs the minimal association group settings uiSchema for Hub Initiatives.
* This defines how the schema properties should be rendered
* in the initiative creation experience
*/
export const buildUiSchema = async (
i18nScope: string,
options: Partial<IHubInitiative>,
context: IArcGISContext
): Promise<IUiSchema> => {
return {
type: "Layout",
elements: [
{
type: "Section",
elements: [
{
labelKey: `${i18nScope}.fields.groupAccess.label`,
scope: "/properties/_associations/properties/groupAccess",
type: "Control",
options: {
control: "hub-field-input-tile-select",
layout: "horizontal",
helperText: {
labelKey: `${i18nScope}.fields.groupAccess.helperText`,
},
labels: [
`{{${i18nScope}.fields.groupAccess.private.label:translate}}`,
`{{${i18nScope}.fields.groupAccess.org.label:translate}}`,
`{{${i18nScope}.fields.groupAccess.public.label:translate}}`,
],
descriptions: [
`{{${i18nScope}.fields.groupAccess.private.description:translate}}`,
`{{${i18nScope}.fields.groupAccess.org.description:translate}}`,
`{{${i18nScope}.fields.groupAccess.public.description:translate}}`,
],
icons: ["users", "organization", "globe"],
styles: { "max-width": "45rem" },
},
},
{
labelKey: `${i18nScope}.fields.membershipAccess.label`,
scope: "/properties/_associations/properties/membershipAccess",
type: "Control",
options: {
control: "hub-field-input-tile-select",
labels: [
`{{${i18nScope}.fields.membershipAccess.org:translate}}`,
`{{${i18nScope}.fields.membershipAccess.collab:translate}}`,
`{{${i18nScope}.fields.membershipAccess.any:translate}}`,
],
disabled: [
false,
!checkPermission(
"platform:portal:user:addExternalMembersToGroup",
context
).access,
!checkPermission(
"platform:portal:user:addExternalMembersToGroup",
context
).access,
],
},
},
{
labelKey: `${i18nScope}.fields.associationRequestDiscoverability.label`,
scope:
"/properties/_associations/properties/associationRequestDiscoverability",
type: "Control",
options: {
control: "hub-field-input-tile-select",
labels: [
`{{${i18nScope}.fields.associationRequestDiscoverability.unlisted:translate}}`,
`{{${i18nScope}.fields.associationRequestDiscoverability.org:translate}}`,
`{{${i18nScope}.fields.associationRequestDiscoverability.community:translate}}`,
`{{${i18nScope}.fields.associationRequestDiscoverability.public:translate}}`,
],
// disabled: [
// false,
// !checkPermission(
// "platform:portal:user:addExternalMembersToGroup",
// context
// ).access,
// !checkPermission(
// "platform:portal:user:addExternalMembersToGroup",
// context
// ).access,
// ],
},
},
],
},
],
};
};