Skip to content

Commit 9674bb4

Browse files
Merge pull request #1725 from johnduprey/dev
Switch to BPA Report schema for builder
2 parents a61a460 + c2efca5 commit 9674bb4

File tree

6 files changed

+407
-62
lines changed

6 files changed

+407
-62
lines changed

src/_nav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ const _nav = [
173173
},
174174
{
175175
component: CNavItem,
176-
name: 'BPA Field Builder',
177-
to: '/tenant/tools/bpa-field-builder',
176+
name: 'BPA Report Builder',
177+
to: '/tenant/tools/bpa-report-builder',
178178
},
179179
],
180180
},

src/data/BPAReport.schema.v1.json

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
{
2+
"title": "BPA Report Builder",
3+
"type": "object",
4+
"required": ["name", "style", "Fields"],
5+
"properties": {
6+
"name": {
7+
"type": "string",
8+
"title": "Report Name",
9+
"description": "The title or name of the report."
10+
},
11+
"style": {
12+
"type": "string",
13+
"title": "Report Style",
14+
"default": "Table",
15+
"enum": ["Table", "Tenant"],
16+
"description": "Specifies the layout or presentation style of the report."
17+
},
18+
"Fields": {
19+
"title": "Report Fields",
20+
"type": "array",
21+
"minItems": 1,
22+
"items": {
23+
"required": ["name"],
24+
"properties": {
25+
"name": {
26+
"type": "string",
27+
"title": "Field Name",
28+
"description": "Identifier for each set or category of data."
29+
},
30+
"UseExistingInfo": {
31+
"type": "boolean",
32+
"title": "Use Existing Info?",
33+
"default": false
34+
},
35+
"FrontendFields": {
36+
"type": "array",
37+
"title": "Frontend Fields",
38+
"description": "Describes how each data attribute will be displayed in the report.",
39+
"items": {
40+
"type": "object",
41+
"properties": {
42+
"name": {
43+
"title": "Name",
44+
"description": "Label for the data in the report.",
45+
"type": "string"
46+
},
47+
"value": {
48+
"title": "Value",
49+
"description": "Reference to the data's location or attribute.",
50+
"type": "string"
51+
},
52+
"formatter": {
53+
"title": "Formatter",
54+
"description": "Specifies how the data will be formatted for display.",
55+
"type": "string",
56+
"anyOf": [
57+
{
58+
"const": "string",
59+
"title": "Display as plain text"
60+
},
61+
{
62+
"const": "bool",
63+
"title": "True/False"
64+
},
65+
{
66+
"const": "warnBool",
67+
"title": "True/False values with potential visual warnings"
68+
},
69+
{
70+
"const": "reverseBool",
71+
"title": "Inverts the True/False value for display"
72+
},
73+
{
74+
"const": "table",
75+
"title": "Represents the data in a table format"
76+
},
77+
{
78+
"const": "number",
79+
"title": "Displays as a numerical value"
80+
}
81+
]
82+
}
83+
}
84+
},
85+
"minItems": 1,
86+
"required": ["name", "value", "formatter"]
87+
},
88+
"desc": {
89+
"title": "Field Description",
90+
"description": "A description field shown on the end of the card on the tenant overview page",
91+
"type": "string"
92+
}
93+
},
94+
"allOf": [
95+
{
96+
"if": {
97+
"properties": {
98+
"UseExistingInfo": {
99+
"enum": [false]
100+
}
101+
}
102+
},
103+
"then": {
104+
"required": ["API", "StoreAs", "ExtractFields"],
105+
"properties": {
106+
"where": {
107+
"title": "Where",
108+
"description": "A conditional filter to determine which data gets displayed or processed. Use PowerShell's Where-Object Filterscript format.",
109+
"type": "string"
110+
},
111+
"StoreAs": {
112+
"type": "string",
113+
"title": "Store As",
114+
"description": "The format in which to store the fetched data.",
115+
"anyOf": [
116+
{
117+
"const": "string",
118+
"title": "String - For plain text"
119+
},
120+
{
121+
"const": "JSON",
122+
"title": "JSON - For structured data"
123+
},
124+
{
125+
"const": "bool",
126+
"title": "Boolean - True/False values"
127+
}
128+
]
129+
},
130+
"API": {
131+
"type": "string",
132+
"title": "API",
133+
"anyOf": [
134+
{
135+
"const": "Graph",
136+
"title": "Graph"
137+
},
138+
{
139+
"const": "Exchange",
140+
"title": "Exchange"
141+
},
142+
{
143+
"const": "CIPPFunction",
144+
"title": "CIPP Function"
145+
}
146+
],
147+
"default": "Graph",
148+
"description": "Defines the source or type of API to fetch the data."
149+
},
150+
"ExtractFields": {
151+
"title": "Extract Fields",
152+
"description": "Lists the attributes or fields to extract from the returned data.",
153+
"type": "array",
154+
"items": {
155+
"type": "string"
156+
},
157+
"minItems": 1
158+
}
159+
},
160+
"allOf": [
161+
{
162+
"if": {
163+
"properties": {
164+
"API": {
165+
"enum": ["CIPPFunction"]
166+
}
167+
}
168+
},
169+
"then": {
170+
"properties": {
171+
"Command": {
172+
"type": "string",
173+
"pattern": "^Get-CIPP",
174+
"description": "Command for CIPP Function (Get-CIPP)"
175+
}
176+
},
177+
"required": ["Command"]
178+
}
179+
},
180+
{
181+
"if": {
182+
"properties": {
183+
"API": {
184+
"enum": ["Exchange"]
185+
}
186+
}
187+
},
188+
"then": {
189+
"properties": {
190+
"Command": {
191+
"type": "string",
192+
"title": "Command",
193+
"pattern": "^Get-",
194+
"description": "Command for Exchange (Get only)"
195+
}
196+
},
197+
"required": ["Command"]
198+
}
199+
},
200+
{
201+
"if": {
202+
"properties": {
203+
"API": {
204+
"enum": ["Graph"]
205+
}
206+
}
207+
},
208+
"then": {
209+
"properties": {
210+
"parameters": {
211+
"type": "object",
212+
"title": "Parameters",
213+
"description": "Additional settings or parameters required for the API call.",
214+
"properties": {
215+
"asApp": {
216+
"title": "Use Application Permissions",
217+
"type": "boolean"
218+
}
219+
},
220+
"additionalProperties": true
221+
},
222+
"URL": {
223+
"type": "string",
224+
"pattern": "^https://graph.microsoft.com/",
225+
"description": "The endpoint for Graph"
226+
}
227+
},
228+
"required": ["URL"]
229+
}
230+
},
231+
{
232+
"if": {
233+
"properties": {
234+
"API": {
235+
"enum": ["Exchange", "CIPPFunction"]
236+
}
237+
}
238+
},
239+
"then": {
240+
"properties": {
241+
"parameters": {
242+
"type": "object",
243+
"title": "Parameters",
244+
"description": "Additional settings or parameters required for the API call.",
245+
"additionalProperties": true
246+
}
247+
}
248+
}
249+
}
250+
]
251+
}
252+
}
253+
]
254+
}
255+
}
256+
}
257+
}

src/data/BPAReport.uischema.v1.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"ui:disabled": false,
3+
"ui:readonly": false,
4+
"ui:order": ["name", "style", "*"],
5+
"Fields": {
6+
"items": {
7+
"ui:order": [
8+
"name",
9+
"desc",
10+
"UseExistingInfo",
11+
"StoreAs",
12+
"API",
13+
"URL",
14+
"Command",
15+
"parameters",
16+
"where",
17+
"ExtractFields",
18+
"FrontendFields",
19+
"*"
20+
],
21+
"FrontendFields": {
22+
"ui:classNames": "card card-title p-4 my-4"
23+
},
24+
"ui:classNames": "card card-title p-4 my-4"
25+
}
26+
},
27+
"ui:submitButtonOptions": {
28+
"norender": true
29+
}
30+
}

src/routes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const DeviceComplianceReport = React.lazy(() =>
7171
const BestPracticeAnalyzer = React.lazy(() =>
7272
import('src/views/tenant/standards/BestPracticeAnalyser'),
7373
)
74-
const BPAFieldBuilder = React.lazy(() => import('src/views/tenant/standards/BPAFieldBuilder'))
74+
const BPAReportBuilder = React.lazy(() => import('src/views/tenant/standards/BPAReportBuilder'))
7575
const DomainsAnalyser = React.lazy(() => import('src/views/tenant/standards/DomainsAnalyser'))
7676
const OffboardingWizard = React.lazy(() =>
7777
import('src/views/identity/administration/OffboardingWizard'),
@@ -387,9 +387,9 @@ const routes = [
387387
component: GeoIPLookup,
388388
},
389389
{
390-
path: '/tenant/tools/bpa-field-builder',
391-
name: 'BPA Field Builder',
392-
component: BPAFieldBuilder,
390+
path: '/tenant/tools/bpa-report-builder',
391+
name: 'BPA Report Builder',
392+
component: BPAReportBuilder,
393393
},
394394
{ path: '/tenant/standards/alert-list', name: 'Alert List (Alpha)', component: ListAlerts },
395395
{ path: '/endpoint', name: 'Endpoint' },

src/views/tenant/standards/BPAFieldBuilder.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)