@backstage/plugin-config-schema 0.1.63-next.2 → 0.1.64-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/components/SchemaView/SchemaView.esm.js +228 -5
- package/dist/components/SchemaView/SchemaView.esm.js.map +1 -1
- package/package.json +7 -7
- package/dist/components/SchemaView/ArrayView.esm.js +0 -31
- package/dist/components/SchemaView/ArrayView.esm.js.map +0 -1
- package/dist/components/SchemaView/ChildView.esm.js +0 -87
- package/dist/components/SchemaView/ChildView.esm.js.map +0 -1
- package/dist/components/SchemaView/MatchView.esm.js +0 -24
- package/dist/components/SchemaView/MatchView.esm.js.map +0 -1
- package/dist/components/SchemaView/MetadataView.esm.js +0 -68
- package/dist/components/SchemaView/MetadataView.esm.js.map +0 -1
- package/dist/components/SchemaView/ObjectView.esm.js +0 -51
- package/dist/components/SchemaView/ObjectView.esm.js.map +0 -1
- package/dist/components/SchemaView/ScalarView.esm.js +0 -11
- package/dist/components/SchemaView/ScalarView.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @backstage/plugin-config-schema
|
|
2
2
|
|
|
3
|
+
## 0.1.64-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/core-plugin-api@1.10.3-next.0
|
|
9
|
+
- @backstage/types@1.2.1-next.0
|
|
10
|
+
- @backstage/core-components@0.16.3-next.0
|
|
11
|
+
- @backstage/errors@1.2.7-next.0
|
|
12
|
+
|
|
13
|
+
## 0.1.63
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- c36bd35: Internal refactor to break potential circular imports
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/core-components@0.16.2
|
|
20
|
+
- @backstage/errors@1.2.6
|
|
21
|
+
- @backstage/core-plugin-api@1.10.2
|
|
22
|
+
- @backstage/types@1.2.0
|
|
23
|
+
|
|
3
24
|
## 0.1.63-next.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import Box from '@material-ui/core/Box';
|
|
2
|
+
import Chip from '@material-ui/core/Chip';
|
|
3
|
+
import Divider from '@material-ui/core/Divider';
|
|
4
|
+
import Paper from '@material-ui/core/Paper';
|
|
5
|
+
import Table from '@material-ui/core/Table';
|
|
6
|
+
import TableBody from '@material-ui/core/TableBody';
|
|
7
|
+
import TableCell from '@material-ui/core/TableCell';
|
|
8
|
+
import TableRow from '@material-ui/core/TableRow';
|
|
9
|
+
import Typography from '@material-ui/core/Typography';
|
|
10
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
11
|
+
import React, { useRef, useEffect } from 'react';
|
|
12
|
+
import { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext.esm.js';
|
|
6
13
|
|
|
7
14
|
function SchemaView(props) {
|
|
8
15
|
const { schema } = props;
|
|
@@ -46,6 +53,222 @@ function SchemaView(props) {
|
|
|
46
53
|
return /* @__PURE__ */ React.createElement(ScalarView, { ...props });
|
|
47
54
|
}
|
|
48
55
|
}
|
|
56
|
+
function ArrayView({ path, depth, schema }) {
|
|
57
|
+
const itemDepth = depth + 1;
|
|
58
|
+
const itemPath = path ? `${path}[]` : "[]";
|
|
59
|
+
const itemSchema = schema.items;
|
|
60
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema })), /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Items"), /* @__PURE__ */ React.createElement(
|
|
61
|
+
ChildView,
|
|
62
|
+
{
|
|
63
|
+
lastChild: true,
|
|
64
|
+
path: itemPath,
|
|
65
|
+
depth: itemDepth,
|
|
66
|
+
schema: itemSchema
|
|
67
|
+
}
|
|
68
|
+
), schema.additionalItems && schema.additionalItems !== true && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Additional Items"), /* @__PURE__ */ React.createElement(
|
|
69
|
+
ChildView,
|
|
70
|
+
{
|
|
71
|
+
path: itemPath,
|
|
72
|
+
depth: itemDepth,
|
|
73
|
+
schema: schema.additionalItems,
|
|
74
|
+
lastChild: true
|
|
75
|
+
}
|
|
76
|
+
)));
|
|
77
|
+
}
|
|
78
|
+
function isRequired(name, required) {
|
|
79
|
+
if (required === true) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(required)) {
|
|
83
|
+
return required.includes(name);
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
function ObjectView({ path, depth, schema }) {
|
|
88
|
+
const properties = Object.entries(schema.properties ?? {});
|
|
89
|
+
const patternProperties = Object.entries(schema.patternProperties ?? {});
|
|
90
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema })), properties.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Properties"), properties.map(([name, propSchema], index) => /* @__PURE__ */ React.createElement(
|
|
91
|
+
ChildView,
|
|
92
|
+
{
|
|
93
|
+
key: name,
|
|
94
|
+
path: path ? `${path}.${name}` : name,
|
|
95
|
+
depth: depth + 1,
|
|
96
|
+
schema: propSchema,
|
|
97
|
+
lastChild: index === properties.length - 1,
|
|
98
|
+
required: isRequired(name, schema.required)
|
|
99
|
+
}
|
|
100
|
+
))), patternProperties.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Pattern Properties"), patternProperties.map(([name, propSchema], index) => /* @__PURE__ */ React.createElement(
|
|
101
|
+
ChildView,
|
|
102
|
+
{
|
|
103
|
+
key: name,
|
|
104
|
+
path: path ? `${path}.<${name}>` : name,
|
|
105
|
+
depth: depth + 1,
|
|
106
|
+
schema: propSchema,
|
|
107
|
+
lastChild: index === patternProperties.length - 1,
|
|
108
|
+
required: isRequired(name, schema.required)
|
|
109
|
+
}
|
|
110
|
+
))), schema.additionalProperties && schema.additionalProperties !== true && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Additional Properties"), /* @__PURE__ */ React.createElement(
|
|
111
|
+
ChildView,
|
|
112
|
+
{
|
|
113
|
+
path: `${path}.*`,
|
|
114
|
+
depth: depth + 1,
|
|
115
|
+
schema: schema.additionalProperties,
|
|
116
|
+
lastChild: true
|
|
117
|
+
}
|
|
118
|
+
)));
|
|
119
|
+
}
|
|
120
|
+
function titleVariant(depth) {
|
|
121
|
+
if (depth <= 1) {
|
|
122
|
+
return "h2";
|
|
123
|
+
} else if (depth === 2) {
|
|
124
|
+
return "h3";
|
|
125
|
+
} else if (depth === 3) {
|
|
126
|
+
return "h4";
|
|
127
|
+
} else if (depth === 4) {
|
|
128
|
+
return "h5";
|
|
129
|
+
}
|
|
130
|
+
return "h6";
|
|
131
|
+
}
|
|
132
|
+
const useChildViewStyles = makeStyles((theme) => ({
|
|
133
|
+
title: {
|
|
134
|
+
marginBottom: 0
|
|
135
|
+
},
|
|
136
|
+
chip: {
|
|
137
|
+
marginLeft: theme.spacing(1),
|
|
138
|
+
marginRight: 0,
|
|
139
|
+
marginBottom: 0
|
|
140
|
+
}
|
|
141
|
+
}));
|
|
142
|
+
function ChildView({
|
|
143
|
+
path,
|
|
144
|
+
depth,
|
|
145
|
+
schema,
|
|
146
|
+
required,
|
|
147
|
+
lastChild
|
|
148
|
+
}) {
|
|
149
|
+
const classes = useChildViewStyles();
|
|
150
|
+
const titleRef = useRef(null);
|
|
151
|
+
const scroll = useScrollTargets();
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
return scroll?.setScrollListener(path, () => {
|
|
154
|
+
titleRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
155
|
+
});
|
|
156
|
+
}, [scroll, path]);
|
|
157
|
+
const chips = new Array();
|
|
158
|
+
const chipProps = { size: "small", classes: { root: classes.chip } };
|
|
159
|
+
if (required) {
|
|
160
|
+
chips.push(
|
|
161
|
+
/* @__PURE__ */ React.createElement(Chip, { label: "required", color: "default", key: "required", ...chipProps })
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
const visibility = schema?.visibility;
|
|
165
|
+
if (visibility === "frontend") {
|
|
166
|
+
chips.push(
|
|
167
|
+
/* @__PURE__ */ React.createElement(Chip, { label: "frontend", color: "primary", key: "visibility", ...chipProps })
|
|
168
|
+
);
|
|
169
|
+
} else if (visibility === "secret") {
|
|
170
|
+
chips.push(
|
|
171
|
+
/* @__PURE__ */ React.createElement(Chip, { label: "secret", color: "secondary", key: "visibility", ...chipProps })
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
return /* @__PURE__ */ React.createElement(Box, { paddingBottom: lastChild ? 4 : 8, display: "flex", flexDirection: "row" }, /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", flexItem: true }), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2, flex: 1 }, /* @__PURE__ */ React.createElement(
|
|
175
|
+
Box,
|
|
176
|
+
{
|
|
177
|
+
display: "flex",
|
|
178
|
+
flexDirection: "row",
|
|
179
|
+
marginBottom: 2,
|
|
180
|
+
alignItems: "center"
|
|
181
|
+
},
|
|
182
|
+
/* @__PURE__ */ React.createElement(
|
|
183
|
+
Typography,
|
|
184
|
+
{
|
|
185
|
+
ref: titleRef,
|
|
186
|
+
variant: titleVariant(depth),
|
|
187
|
+
classes: { root: classes.title }
|
|
188
|
+
},
|
|
189
|
+
path
|
|
190
|
+
),
|
|
191
|
+
chips.length > 0 && /* @__PURE__ */ React.createElement(Box, { marginLeft: 1 }),
|
|
192
|
+
chips
|
|
193
|
+
), schema && /* @__PURE__ */ React.createElement(SchemaView, { path, depth, schema })));
|
|
194
|
+
}
|
|
195
|
+
function MatchView({
|
|
196
|
+
path,
|
|
197
|
+
depth,
|
|
198
|
+
schema,
|
|
199
|
+
label
|
|
200
|
+
}) {
|
|
201
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, label), schema.map((optionSchema, index) => /* @__PURE__ */ React.createElement(
|
|
202
|
+
ChildView,
|
|
203
|
+
{
|
|
204
|
+
key: index,
|
|
205
|
+
path: `${path}/${index + 1}`,
|
|
206
|
+
depth: depth + 1,
|
|
207
|
+
schema: optionSchema,
|
|
208
|
+
lastChild: index === schema.length - 1
|
|
209
|
+
}
|
|
210
|
+
)));
|
|
211
|
+
}
|
|
212
|
+
function ScalarView({ schema }) {
|
|
213
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema }));
|
|
214
|
+
}
|
|
215
|
+
function MetadataViewRow({ label, text, data }) {
|
|
216
|
+
if (text === void 0 && data === void 0) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, { style: { width: 160 } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", noWrap: true, style: { fontWeight: 900 } }, label)), /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, data ? JSON.stringify(data) : text)));
|
|
220
|
+
}
|
|
221
|
+
function MetadataView({ schema }) {
|
|
222
|
+
return /* @__PURE__ */ React.createElement(Paper, { variant: "outlined", square: true, style: { width: "100%" } }, /* @__PURE__ */ React.createElement(Table, { size: "small" }, /* @__PURE__ */ React.createElement(TableBody, null, /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Type", data: schema.type }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Allowed values", data: schema.enum }), schema.additionalProperties === true && /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Additional Properties", text: "true" }), schema.additionalItems === true && /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Additional Items", text: "true" }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Format", text: schema.format }), /* @__PURE__ */ React.createElement(
|
|
223
|
+
MetadataViewRow,
|
|
224
|
+
{
|
|
225
|
+
label: "Pattern",
|
|
226
|
+
text: schema.pattern && String(schema.pattern)
|
|
227
|
+
}
|
|
228
|
+
), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Minimum", data: schema.minimum }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Maximum", data: schema.maximum }), /* @__PURE__ */ React.createElement(
|
|
229
|
+
MetadataViewRow,
|
|
230
|
+
{
|
|
231
|
+
label: "Exclusive minimum",
|
|
232
|
+
data: schema.exclusiveMinimum
|
|
233
|
+
}
|
|
234
|
+
), /* @__PURE__ */ React.createElement(
|
|
235
|
+
MetadataViewRow,
|
|
236
|
+
{
|
|
237
|
+
label: "Exclusive maximum",
|
|
238
|
+
data: schema.exclusiveMaximum
|
|
239
|
+
}
|
|
240
|
+
), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Multiple of", data: schema.multipleOf }), /* @__PURE__ */ React.createElement(
|
|
241
|
+
MetadataViewRow,
|
|
242
|
+
{
|
|
243
|
+
label: "Maximum number of items",
|
|
244
|
+
data: schema.maxItems
|
|
245
|
+
}
|
|
246
|
+
), /* @__PURE__ */ React.createElement(
|
|
247
|
+
MetadataViewRow,
|
|
248
|
+
{
|
|
249
|
+
label: "Minimum number of items",
|
|
250
|
+
data: schema.minItems
|
|
251
|
+
}
|
|
252
|
+
), /* @__PURE__ */ React.createElement(
|
|
253
|
+
MetadataViewRow,
|
|
254
|
+
{
|
|
255
|
+
label: "Maximum number of properties",
|
|
256
|
+
data: schema.maxProperties
|
|
257
|
+
}
|
|
258
|
+
), /* @__PURE__ */ React.createElement(
|
|
259
|
+
MetadataViewRow,
|
|
260
|
+
{
|
|
261
|
+
label: "Minimum number of properties",
|
|
262
|
+
data: schema.minProperties
|
|
263
|
+
}
|
|
264
|
+
), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Maximum Length", data: schema.maxLength }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Minimum Length", data: schema.minLength }), /* @__PURE__ */ React.createElement(
|
|
265
|
+
MetadataViewRow,
|
|
266
|
+
{
|
|
267
|
+
label: "Items must be unique",
|
|
268
|
+
data: schema.uniqueItems
|
|
269
|
+
}
|
|
270
|
+
))));
|
|
271
|
+
}
|
|
49
272
|
|
|
50
273
|
export { SchemaView };
|
|
51
274
|
//# sourceMappingURL=SchemaView.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaView.esm.js","sources":["../../../src/components/SchemaView/SchemaView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { ArrayView } from './ArrayView';\nimport { MatchView } from './MatchView';\nimport { ObjectView } from './ObjectView';\nimport { ScalarView } from './ScalarView';\nimport { SchemaViewProps } from './types';\n\nexport function SchemaView(props: SchemaViewProps) {\n const { schema } = props;\n if (schema.anyOf) {\n return (\n <MatchView\n {...props}\n schema={schema.anyOf}\n label=\"Any of the following\"\n />\n );\n }\n if (schema.oneOf) {\n return (\n <MatchView\n {...props}\n schema={schema.oneOf}\n label=\"One of the following\"\n />\n );\n }\n if (schema.allOf) {\n return (\n <MatchView\n {...props}\n schema={schema.allOf}\n label=\"All of the following\"\n />\n );\n }\n switch (schema.type) {\n case 'array':\n return <ArrayView {...props} />;\n case 'object':\n case undefined:\n return <ObjectView {...props} />;\n default:\n return <ScalarView {...props} />;\n }\n}\n"],"names":[],"mappings":";;;;;;AAuBO,SAAS,WAAW,KAAwB,EAAA;AACjD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,QAAQ,OAAO,IAAM;AAAA,IACnB,KAAK,OAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAW,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,IAC/B,KAAK,QAAA;AAAA,IACL,KAAK,KAAA,CAAA;AACH,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAY,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,IAChC;AACE,MAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAY,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA;AAEpC;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaView.esm.js","sources":["../../../src/components/SchemaView/SchemaView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Schema } from 'jsonschema';\nimport React, { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaViewProps } from './types';\n\nexport function SchemaView(props: SchemaViewProps) {\n const { schema } = props;\n if (schema.anyOf) {\n return (\n <MatchView\n {...props}\n schema={schema.anyOf}\n label=\"Any of the following\"\n />\n );\n }\n if (schema.oneOf) {\n return (\n <MatchView\n {...props}\n schema={schema.oneOf}\n label=\"One of the following\"\n />\n );\n }\n if (schema.allOf) {\n return (\n <MatchView\n {...props}\n schema={schema.allOf}\n label=\"All of the following\"\n />\n );\n }\n switch (schema.type) {\n case 'array':\n return <ArrayView {...props} />;\n case 'object':\n case undefined:\n return <ObjectView {...props} />;\n default:\n return <ScalarView {...props} />;\n }\n}\n\nfunction ArrayView({ path, depth, schema }: SchemaViewProps) {\n const itemDepth = depth + 1;\n const itemPath = path ? `${path}[]` : '[]';\n const itemSchema = schema.items;\n\n return (\n <>\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n <Typography variant=\"overline\">Items</Typography>\n <ChildView\n lastChild\n path={itemPath}\n depth={itemDepth}\n schema={itemSchema as Schema | undefined}\n />\n {schema.additionalItems && schema.additionalItems !== true && (\n <>\n <Typography variant=\"overline\">Additional Items</Typography>\n <ChildView\n path={itemPath}\n depth={itemDepth}\n schema={schema.additionalItems}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\nfunction isRequired(name: string, required?: boolean | string[]) {\n if (required === true) {\n return true;\n }\n if (Array.isArray(required)) {\n return required.includes(name);\n }\n return false;\n}\n\nfunction ObjectView({ path, depth, schema }: SchemaViewProps) {\n const properties = Object.entries(schema.properties ?? {});\n const patternProperties = Object.entries(schema.patternProperties ?? {});\n\n return (\n <>\n {depth > 0 && (\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n )}\n {properties.length > 0 && (\n <>\n {depth > 0 && <Typography variant=\"overline\">Properties</Typography>}\n {properties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.${name}` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === properties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {patternProperties.length > 0 && (\n <>\n {depth > 0 && (\n <Typography variant=\"overline\">Pattern Properties</Typography>\n )}\n {patternProperties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.<${name}>` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === patternProperties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {schema.additionalProperties && schema.additionalProperties !== true && (\n <>\n <Typography variant=\"overline\">Additional Properties</Typography>\n <ChildView\n path={`${path}.*`}\n depth={depth + 1}\n schema={schema.additionalProperties}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction titleVariant(depth: number) {\n if (depth <= 1) {\n return 'h2';\n } else if (depth === 2) {\n return 'h3';\n } else if (depth === 3) {\n return 'h4';\n } else if (depth === 4) {\n return 'h5';\n }\n return 'h6';\n}\n\nconst useChildViewStyles = makeStyles(theme => ({\n title: {\n marginBottom: 0,\n },\n chip: {\n marginLeft: theme.spacing(1),\n marginRight: 0,\n marginBottom: 0,\n },\n}));\n\nfunction ChildView({\n path,\n depth,\n schema,\n required,\n lastChild,\n}: {\n path: string;\n depth: number;\n schema?: Schema;\n required?: boolean;\n lastChild?: boolean;\n}) {\n const classes = useChildViewStyles();\n const titleRef = useRef<HTMLElement>(null);\n const scroll = useScrollTargets();\n\n useEffect(() => {\n return scroll?.setScrollListener(path, () => {\n titleRef.current?.scrollIntoView({ behavior: 'smooth' });\n });\n }, [scroll, path]);\n\n const chips = new Array<JSX.Element>();\n const chipProps = { size: 'small' as const, classes: { root: classes.chip } };\n\n if (required) {\n chips.push(\n <Chip label=\"required\" color=\"default\" key=\"required\" {...chipProps} />,\n );\n }\n\n const visibility = (schema as { visibility?: string })?.visibility;\n if (visibility === 'frontend') {\n chips.push(\n <Chip label=\"frontend\" color=\"primary\" key=\"visibility\" {...chipProps} />,\n );\n } else if (visibility === 'secret') {\n chips.push(\n <Chip label=\"secret\" color=\"secondary\" key=\"visibility\" {...chipProps} />,\n );\n }\n\n return (\n <Box paddingBottom={lastChild ? 4 : 8} display=\"flex\" flexDirection=\"row\">\n <Divider orientation=\"vertical\" flexItem />\n <Box paddingLeft={2} flex={1}>\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n marginBottom={2}\n alignItems=\"center\"\n >\n <Typography\n ref={titleRef}\n variant={titleVariant(depth)}\n classes={{ root: classes.title }}\n >\n {path}\n </Typography>\n {chips.length > 0 && <Box marginLeft={1} />}\n {chips}\n </Box>\n {schema && (\n <SchemaView path={path} depth={depth} schema={schema as Schema} />\n )}\n </Box>\n </Box>\n );\n}\n\nfunction MatchView({\n path,\n depth,\n schema,\n label,\n}: {\n path: string;\n depth: number;\n schema: Schema[];\n label: string;\n}) {\n return (\n <>\n <Typography variant=\"overline\">{label}</Typography>\n {schema.map((optionSchema, index) => (\n <ChildView\n key={index}\n path={`${path}/${index + 1}`}\n depth={depth + 1}\n schema={optionSchema}\n lastChild={index === schema.length - 1}\n />\n ))}\n </>\n );\n}\n\nfunction ScalarView({ schema }: SchemaViewProps) {\n return (\n <>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction MetadataViewRow({ label, text, data }: MetadataViewRowProps) {\n if (text === undefined && data === undefined) {\n return null;\n }\n return (\n <TableRow>\n <TableCell style={{ width: 160 }}>\n <Typography variant=\"body1\" noWrap style={{ fontWeight: 900 }}>\n {label}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body1\">\n {data ? JSON.stringify(data) : text}\n </Typography>\n </TableCell>\n </TableRow>\n );\n}\n\nfunction MetadataView({ schema }: { schema: Schema }) {\n return (\n <Paper variant=\"outlined\" square style={{ width: '100%' }}>\n <Table size=\"small\">\n <TableBody>\n <MetadataViewRow label=\"Type\" data={schema.type} />\n <MetadataViewRow label=\"Allowed values\" data={schema.enum} />\n {schema.additionalProperties === true && (\n <MetadataViewRow label=\"Additional Properties\" text=\"true\" />\n )}\n {schema.additionalItems === true && (\n <MetadataViewRow label=\"Additional Items\" text=\"true\" />\n )}\n <MetadataViewRow label=\"Format\" text={schema.format} />\n <MetadataViewRow\n label=\"Pattern\"\n text={schema.pattern && String(schema.pattern)}\n />\n <MetadataViewRow label=\"Minimum\" data={schema.minimum} />\n <MetadataViewRow label=\"Maximum\" data={schema.maximum} />\n <MetadataViewRow\n label=\"Exclusive minimum\"\n data={schema.exclusiveMinimum}\n />\n <MetadataViewRow\n label=\"Exclusive maximum\"\n data={schema.exclusiveMaximum}\n />\n <MetadataViewRow label=\"Multiple of\" data={schema.multipleOf} />\n <MetadataViewRow\n label=\"Maximum number of items\"\n data={schema.maxItems}\n />\n <MetadataViewRow\n label=\"Minimum number of items\"\n data={schema.minItems}\n />\n <MetadataViewRow\n label=\"Maximum number of properties\"\n data={schema.maxProperties}\n />\n <MetadataViewRow\n label=\"Minimum number of properties\"\n data={schema.minProperties}\n />\n <MetadataViewRow label=\"Maximum Length\" data={schema.maxLength} />\n <MetadataViewRow label=\"Minimum Length\" data={schema.minLength} />\n <MetadataViewRow\n label=\"Items must be unique\"\n data={schema.uniqueItems}\n />\n </TableBody>\n </Table>\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCO,SAAS,WAAW,KAAwB,EAAA;AACjD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAA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AAA;AAAA,MACC,KAAM,EAAA,yBAAA;AAAA,MACN,MAAM,MAAO,CAAA;AAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,yBAAA;AAAA,MACN,MAAM,MAAO,CAAA;AAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,8BAAA;AAAA,MACN,MAAM,MAAO,CAAA;AAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,8BAAA;AAAA,MACN,MAAM,MAAO,CAAA;AAAA;AAAA,qBAEd,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,EAAgB,KAAM,EAAA,gBAAA,EAAiB,MAAM,MAAO,CAAA,SAAA,EAAW,CAChE,kBAAA,KAAA,CAAA,aAAA,CAAC,mBAAgB,KAAM,EAAA,gBAAA,EAAiB,IAAM,EAAA,MAAA,CAAO,WAAW,CAChE,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,sBAAA;AAAA,MACN,MAAM,MAAO,CAAA;AAAA;AAAA,GAEjB,CACF,CACF,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-config-schema",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.64-next.0",
|
|
4
4
|
"description": "A Backstage plugin that lets you browse the configuration schema of your app",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/core-components": "0.16.
|
|
41
|
-
"@backstage/core-plugin-api": "1.10.
|
|
42
|
-
"@backstage/errors": "1.2.
|
|
43
|
-
"@backstage/types": "1.2.0",
|
|
40
|
+
"@backstage/core-components": "0.16.3-next.0",
|
|
41
|
+
"@backstage/core-plugin-api": "1.10.3-next.0",
|
|
42
|
+
"@backstage/errors": "1.2.7-next.0",
|
|
43
|
+
"@backstage/types": "1.2.1-next.0",
|
|
44
44
|
"@material-ui/core": "^4.12.2",
|
|
45
45
|
"@material-ui/icons": "^4.9.1",
|
|
46
46
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"zen-observable": "^0.10.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@backstage/cli": "0.29.
|
|
53
|
-
"@backstage/dev-utils": "1.1.
|
|
52
|
+
"@backstage/cli": "0.29.5-next.1",
|
|
53
|
+
"@backstage/dev-utils": "1.1.6-next.1",
|
|
54
54
|
"@testing-library/dom": "^10.0.0",
|
|
55
55
|
"@testing-library/jest-dom": "^6.0.0",
|
|
56
56
|
"@testing-library/react": "^16.0.0",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import Box from '@material-ui/core/Box';
|
|
2
|
-
import Typography from '@material-ui/core/Typography';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { ChildView } from './ChildView.esm.js';
|
|
5
|
-
import { MetadataView } from './MetadataView.esm.js';
|
|
6
|
-
|
|
7
|
-
function ArrayView({ path, depth, schema }) {
|
|
8
|
-
const itemDepth = depth + 1;
|
|
9
|
-
const itemPath = path ? `${path}[]` : "[]";
|
|
10
|
-
const itemSchema = schema.items;
|
|
11
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema })), /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Items"), /* @__PURE__ */ React.createElement(
|
|
12
|
-
ChildView,
|
|
13
|
-
{
|
|
14
|
-
lastChild: true,
|
|
15
|
-
path: itemPath,
|
|
16
|
-
depth: itemDepth,
|
|
17
|
-
schema: itemSchema
|
|
18
|
-
}
|
|
19
|
-
), schema.additionalItems && schema.additionalItems !== true && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Additional Items"), /* @__PURE__ */ React.createElement(
|
|
20
|
-
ChildView,
|
|
21
|
-
{
|
|
22
|
-
path: itemPath,
|
|
23
|
-
depth: itemDepth,
|
|
24
|
-
schema: schema.additionalItems,
|
|
25
|
-
lastChild: true
|
|
26
|
-
}
|
|
27
|
-
)));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { ArrayView };
|
|
31
|
-
//# sourceMappingURL=ArrayView.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayView.esm.js","sources":["../../../src/components/SchemaView/ArrayView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { ChildView } from './ChildView';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nexport function ArrayView({ path, depth, schema }: SchemaViewProps) {\n const itemDepth = depth + 1;\n const itemPath = path ? `${path}[]` : '[]';\n const itemSchema = schema.items;\n\n return (\n <>\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n <Typography variant=\"overline\">Items</Typography>\n <ChildView\n lastChild\n path={itemPath}\n depth={itemDepth}\n schema={itemSchema as Schema | undefined}\n />\n {schema.additionalItems && schema.additionalItems !== true && (\n <>\n <Typography variant=\"overline\">Additional Items</Typography>\n <ChildView\n path={itemPath}\n depth={itemDepth}\n schema={schema.additionalItems}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;AAwBO,SAAS,SAAU,CAAA,EAAE,IAAM,EAAA,KAAA,EAAO,QAA2B,EAAA;AAClE,EAAA,MAAM,YAAY,KAAQ,GAAA,CAAA;AAC1B,EAAA,MAAM,QAAW,GAAA,IAAA,GAAO,CAAG,EAAA,IAAI,CAAO,EAAA,CAAA,GAAA,IAAA;AACtC,EAAA,MAAM,aAAa,MAAO,CAAA,KAAA;AAE1B,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,YAAA,EAAc,CAChB,EAAA,EAAA,MAAA,CAAO,WACN,oBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,YAAA,EAAc,CACjB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAS,EAAA,EAAA,MAAA,CAAO,WAAY,CAClD,CAEF,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,MAAA,EAAgB,CAChC,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,UAAA,EAAA,EAAW,OAAK,CACpC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,IAAM,EAAA,QAAA;AAAA,MACN,KAAO,EAAA,SAAA;AAAA,MACP,MAAQ,EAAA;AAAA;AAAA,GAET,EAAA,MAAA,CAAO,eAAmB,IAAA,MAAA,CAAO,eAAoB,KAAA,IAAA,oBAElD,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,UAAW,EAAA,EAAA,kBAAgB,CAC/C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,IAAM,EAAA,QAAA;AAAA,MACN,KAAO,EAAA,SAAA;AAAA,MACP,QAAQ,MAAO,CAAA,eAAA;AAAA,MACf,SAAS,EAAA;AAAA;AAAA,GAEb,CAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import Box from '@material-ui/core/Box';
|
|
2
|
-
import Chip from '@material-ui/core/Chip';
|
|
3
|
-
import Divider from '@material-ui/core/Divider';
|
|
4
|
-
import Typography from '@material-ui/core/Typography';
|
|
5
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
6
|
-
import React, { useRef, useEffect } from 'react';
|
|
7
|
-
import { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext.esm.js';
|
|
8
|
-
import { SchemaView } from './SchemaView.esm.js';
|
|
9
|
-
|
|
10
|
-
function titleVariant(depth) {
|
|
11
|
-
if (depth <= 1) {
|
|
12
|
-
return "h2";
|
|
13
|
-
} else if (depth === 2) {
|
|
14
|
-
return "h3";
|
|
15
|
-
} else if (depth === 3) {
|
|
16
|
-
return "h4";
|
|
17
|
-
} else if (depth === 4) {
|
|
18
|
-
return "h5";
|
|
19
|
-
}
|
|
20
|
-
return "h6";
|
|
21
|
-
}
|
|
22
|
-
const useChildViewStyles = makeStyles((theme) => ({
|
|
23
|
-
title: {
|
|
24
|
-
marginBottom: 0
|
|
25
|
-
},
|
|
26
|
-
chip: {
|
|
27
|
-
marginLeft: theme.spacing(1),
|
|
28
|
-
marginRight: 0,
|
|
29
|
-
marginBottom: 0
|
|
30
|
-
}
|
|
31
|
-
}));
|
|
32
|
-
function ChildView({
|
|
33
|
-
path,
|
|
34
|
-
depth,
|
|
35
|
-
schema,
|
|
36
|
-
required,
|
|
37
|
-
lastChild
|
|
38
|
-
}) {
|
|
39
|
-
const classes = useChildViewStyles();
|
|
40
|
-
const titleRef = useRef(null);
|
|
41
|
-
const scroll = useScrollTargets();
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
return scroll?.setScrollListener(path, () => {
|
|
44
|
-
titleRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
45
|
-
});
|
|
46
|
-
}, [scroll, path]);
|
|
47
|
-
const chips = new Array();
|
|
48
|
-
const chipProps = { size: "small", classes: { root: classes.chip } };
|
|
49
|
-
if (required) {
|
|
50
|
-
chips.push(
|
|
51
|
-
/* @__PURE__ */ React.createElement(Chip, { label: "required", color: "default", key: "required", ...chipProps })
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
const visibility = schema?.visibility;
|
|
55
|
-
if (visibility === "frontend") {
|
|
56
|
-
chips.push(
|
|
57
|
-
/* @__PURE__ */ React.createElement(Chip, { label: "frontend", color: "primary", key: "visibility", ...chipProps })
|
|
58
|
-
);
|
|
59
|
-
} else if (visibility === "secret") {
|
|
60
|
-
chips.push(
|
|
61
|
-
/* @__PURE__ */ React.createElement(Chip, { label: "secret", color: "secondary", key: "visibility", ...chipProps })
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
return /* @__PURE__ */ React.createElement(Box, { paddingBottom: lastChild ? 4 : 8, display: "flex", flexDirection: "row" }, /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", flexItem: true }), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2, flex: 1 }, /* @__PURE__ */ React.createElement(
|
|
65
|
-
Box,
|
|
66
|
-
{
|
|
67
|
-
display: "flex",
|
|
68
|
-
flexDirection: "row",
|
|
69
|
-
marginBottom: 2,
|
|
70
|
-
alignItems: "center"
|
|
71
|
-
},
|
|
72
|
-
/* @__PURE__ */ React.createElement(
|
|
73
|
-
Typography,
|
|
74
|
-
{
|
|
75
|
-
ref: titleRef,
|
|
76
|
-
variant: titleVariant(depth),
|
|
77
|
-
classes: { root: classes.title }
|
|
78
|
-
},
|
|
79
|
-
path
|
|
80
|
-
),
|
|
81
|
-
chips.length > 0 && /* @__PURE__ */ React.createElement(Box, { marginLeft: 1 }),
|
|
82
|
-
chips
|
|
83
|
-
), schema && /* @__PURE__ */ React.createElement(SchemaView, { path, depth, schema })));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { ChildView };
|
|
87
|
-
//# sourceMappingURL=ChildView.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChildView.esm.js","sources":["../../../src/components/SchemaView/ChildView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Schema } from 'jsonschema';\nimport React, { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaView } from './SchemaView';\n\nexport interface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction titleVariant(depth: number) {\n if (depth <= 1) {\n return 'h2';\n } else if (depth === 2) {\n return 'h3';\n } else if (depth === 3) {\n return 'h4';\n } else if (depth === 4) {\n return 'h5';\n }\n return 'h6';\n}\n\nconst useChildViewStyles = makeStyles(theme => ({\n title: {\n marginBottom: 0,\n },\n chip: {\n marginLeft: theme.spacing(1),\n marginRight: 0,\n marginBottom: 0,\n },\n}));\n\nexport function ChildView({\n path,\n depth,\n schema,\n required,\n lastChild,\n}: {\n path: string;\n depth: number;\n schema?: Schema;\n required?: boolean;\n lastChild?: boolean;\n}) {\n const classes = useChildViewStyles();\n const titleRef = useRef<HTMLElement>(null);\n const scroll = useScrollTargets();\n\n useEffect(() => {\n return scroll?.setScrollListener(path, () => {\n titleRef.current?.scrollIntoView({ behavior: 'smooth' });\n });\n }, [scroll, path]);\n\n const chips = new Array<JSX.Element>();\n const chipProps = { size: 'small' as const, classes: { root: classes.chip } };\n\n if (required) {\n chips.push(\n <Chip label=\"required\" color=\"default\" key=\"required\" {...chipProps} />,\n );\n }\n\n const visibility = (schema as { visibility?: string })?.visibility;\n if (visibility === 'frontend') {\n chips.push(\n <Chip label=\"frontend\" color=\"primary\" key=\"visibility\" {...chipProps} />,\n );\n } else if (visibility === 'secret') {\n chips.push(\n <Chip label=\"secret\" color=\"secondary\" key=\"visibility\" {...chipProps} />,\n );\n }\n\n return (\n <Box paddingBottom={lastChild ? 4 : 8} display=\"flex\" flexDirection=\"row\">\n <Divider orientation=\"vertical\" flexItem />\n <Box paddingLeft={2} flex={1}>\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n marginBottom={2}\n alignItems=\"center\"\n >\n <Typography\n ref={titleRef}\n variant={titleVariant(depth)}\n classes={{ root: classes.title }}\n >\n {path}\n </Typography>\n {chips.length > 0 && <Box marginLeft={1} />}\n {chips}\n </Box>\n {schema && (\n <SchemaView path={path} depth={depth} schema={schema as Schema} />\n )}\n </Box>\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAiCA,SAAS,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QACC,GAAK,EAAA,QAAA;AAAA,QACL,OAAA,EAAS,aAAa,KAAK,CAAA;AAAA,QAC3B,OAAS,EAAA,EAAE,IAAM,EAAA,OAAA,CAAQ,KAAM;AAAA,OAAA;AAAA,MAE9B;AAAA,KACH;AAAA,IACC,MAAM,MAAS,GAAA,CAAA,oBAAM,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,YAAY,CAAG,EAAA,CAAA;AAAA,IACxC;AAAA,GACH,EACC,0BACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,MAAY,KAAc,EAAA,MAAA,EAA0B,CAEpE,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Typography from '@material-ui/core/Typography';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ChildView } from './ChildView.esm.js';
|
|
4
|
-
|
|
5
|
-
function MatchView({
|
|
6
|
-
path,
|
|
7
|
-
depth,
|
|
8
|
-
schema,
|
|
9
|
-
label
|
|
10
|
-
}) {
|
|
11
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, label), schema.map((optionSchema, index) => /* @__PURE__ */ React.createElement(
|
|
12
|
-
ChildView,
|
|
13
|
-
{
|
|
14
|
-
key: index,
|
|
15
|
-
path: `${path}/${index + 1}`,
|
|
16
|
-
depth: depth + 1,
|
|
17
|
-
schema: optionSchema,
|
|
18
|
-
lastChild: index === schema.length - 1
|
|
19
|
-
}
|
|
20
|
-
)));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { MatchView };
|
|
24
|
-
//# sourceMappingURL=MatchView.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MatchView.esm.js","sources":["../../../src/components/SchemaView/MatchView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Typography from '@material-ui/core/Typography';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { ChildView } from './ChildView';\n\nexport function MatchView({\n path,\n depth,\n schema,\n label,\n}: {\n path: string;\n depth: number;\n schema: Schema[];\n label: string;\n}) {\n return (\n <>\n <Typography variant=\"overline\">{label}</Typography>\n {schema.map((optionSchema, index) => (\n <ChildView\n key={index}\n path={`${path}/${index + 1}`}\n depth={depth + 1}\n schema={optionSchema}\n lastChild={index === schema.length - 1}\n />\n ))}\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAoBO,SAAS,SAAU,CAAA;AAAA,EACxB,IAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAKG,EAAA;AACD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,UAAA,EAAA,EAAY,KAAM,CAAA,EACrC,MAAO,CAAA,GAAA,CAAI,CAAC,YAAA,EAAc,KACzB,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,KAAA;AAAA,MACL,IAAM,EAAA,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,QAAQ,CAAC,CAAA,CAAA;AAAA,MAC1B,OAAO,KAAQ,GAAA,CAAA;AAAA,MACf,MAAQ,EAAA,YAAA;AAAA,MACR,SAAA,EAAW,KAAU,KAAA,MAAA,CAAO,MAAS,GAAA;AAAA;AAAA,GAExC,CACH,CAAA;AAEJ;;;;"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import Paper from '@material-ui/core/Paper';
|
|
2
|
-
import Table from '@material-ui/core/Table';
|
|
3
|
-
import TableBody from '@material-ui/core/TableBody';
|
|
4
|
-
import TableCell from '@material-ui/core/TableCell';
|
|
5
|
-
import TableRow from '@material-ui/core/TableRow';
|
|
6
|
-
import Typography from '@material-ui/core/Typography';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
function MetadataViewRow({ label, text, data }) {
|
|
10
|
-
if (text === void 0 && data === void 0) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, { style: { width: 160 } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", noWrap: true, style: { fontWeight: 900 } }, label)), /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, data ? JSON.stringify(data) : text)));
|
|
14
|
-
}
|
|
15
|
-
function MetadataView({ schema }) {
|
|
16
|
-
return /* @__PURE__ */ React.createElement(Paper, { variant: "outlined", square: true, style: { width: "100%" } }, /* @__PURE__ */ React.createElement(Table, { size: "small" }, /* @__PURE__ */ React.createElement(TableBody, null, /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Type", data: schema.type }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Allowed values", data: schema.enum }), schema.additionalProperties === true && /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Additional Properties", text: "true" }), schema.additionalItems === true && /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Additional Items", text: "true" }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Format", text: schema.format }), /* @__PURE__ */ React.createElement(
|
|
17
|
-
MetadataViewRow,
|
|
18
|
-
{
|
|
19
|
-
label: "Pattern",
|
|
20
|
-
text: schema.pattern && String(schema.pattern)
|
|
21
|
-
}
|
|
22
|
-
), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Minimum", data: schema.minimum }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Maximum", data: schema.maximum }), /* @__PURE__ */ React.createElement(
|
|
23
|
-
MetadataViewRow,
|
|
24
|
-
{
|
|
25
|
-
label: "Exclusive minimum",
|
|
26
|
-
data: schema.exclusiveMinimum
|
|
27
|
-
}
|
|
28
|
-
), /* @__PURE__ */ React.createElement(
|
|
29
|
-
MetadataViewRow,
|
|
30
|
-
{
|
|
31
|
-
label: "Exclusive maximum",
|
|
32
|
-
data: schema.exclusiveMaximum
|
|
33
|
-
}
|
|
34
|
-
), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Multiple of", data: schema.multipleOf }), /* @__PURE__ */ React.createElement(
|
|
35
|
-
MetadataViewRow,
|
|
36
|
-
{
|
|
37
|
-
label: "Maximum number of items",
|
|
38
|
-
data: schema.maxItems
|
|
39
|
-
}
|
|
40
|
-
), /* @__PURE__ */ React.createElement(
|
|
41
|
-
MetadataViewRow,
|
|
42
|
-
{
|
|
43
|
-
label: "Minimum number of items",
|
|
44
|
-
data: schema.minItems
|
|
45
|
-
}
|
|
46
|
-
), /* @__PURE__ */ React.createElement(
|
|
47
|
-
MetadataViewRow,
|
|
48
|
-
{
|
|
49
|
-
label: "Maximum number of properties",
|
|
50
|
-
data: schema.maxProperties
|
|
51
|
-
}
|
|
52
|
-
), /* @__PURE__ */ React.createElement(
|
|
53
|
-
MetadataViewRow,
|
|
54
|
-
{
|
|
55
|
-
label: "Minimum number of properties",
|
|
56
|
-
data: schema.minProperties
|
|
57
|
-
}
|
|
58
|
-
), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Maximum Length", data: schema.maxLength }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Minimum Length", data: schema.minLength }), /* @__PURE__ */ React.createElement(
|
|
59
|
-
MetadataViewRow,
|
|
60
|
-
{
|
|
61
|
-
label: "Items must be unique",
|
|
62
|
-
data: schema.uniqueItems
|
|
63
|
-
}
|
|
64
|
-
))));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { MetadataView, MetadataViewRow };
|
|
68
|
-
//# sourceMappingURL=MetadataView.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetadataView.esm.js","sources":["../../../src/components/SchemaView/MetadataView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\n\nexport interface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nexport function MetadataViewRow({ label, text, data }: MetadataViewRowProps) {\n if (text === undefined && data === undefined) {\n return null;\n }\n return (\n <TableRow>\n <TableCell style={{ width: 160 }}>\n <Typography variant=\"body1\" noWrap style={{ fontWeight: 900 }}>\n {label}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body1\">\n {data ? JSON.stringify(data) : text}\n </Typography>\n </TableCell>\n </TableRow>\n );\n}\n\nexport function MetadataView({ schema }: { schema: Schema }) {\n return (\n <Paper variant=\"outlined\" square style={{ width: '100%' }}>\n <Table size=\"small\">\n <TableBody>\n <MetadataViewRow label=\"Type\" data={schema.type} />\n <MetadataViewRow label=\"Allowed values\" data={schema.enum} />\n {schema.additionalProperties === true && (\n <MetadataViewRow label=\"Additional Properties\" text=\"true\" />\n )}\n {schema.additionalItems === true && (\n <MetadataViewRow label=\"Additional Items\" text=\"true\" />\n )}\n <MetadataViewRow label=\"Format\" text={schema.format} />\n <MetadataViewRow\n label=\"Pattern\"\n text={schema.pattern && String(schema.pattern)}\n />\n <MetadataViewRow label=\"Minimum\" data={schema.minimum} />\n <MetadataViewRow label=\"Maximum\" data={schema.maximum} />\n <MetadataViewRow\n label=\"Exclusive minimum\"\n data={schema.exclusiveMinimum}\n />\n <MetadataViewRow\n label=\"Exclusive maximum\"\n data={schema.exclusiveMaximum}\n />\n <MetadataViewRow label=\"Multiple of\" data={schema.multipleOf} />\n <MetadataViewRow\n label=\"Maximum number of items\"\n data={schema.maxItems}\n />\n <MetadataViewRow\n label=\"Minimum number of items\"\n data={schema.minItems}\n />\n <MetadataViewRow\n label=\"Maximum number of properties\"\n data={schema.maxProperties}\n />\n <MetadataViewRow\n label=\"Minimum number of properties\"\n data={schema.minProperties}\n />\n <MetadataViewRow label=\"Maximum Length\" data={schema.maxLength} />\n <MetadataViewRow label=\"Minimum Length\" data={schema.minLength} />\n <MetadataViewRow\n label=\"Items must be unique\"\n data={schema.uniqueItems}\n />\n </TableBody>\n </Table>\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAgCO,SAAS,eAAgB,CAAA,EAAE,KAAO,EAAA,IAAA,EAAM,MAA8B,EAAA;AAC3E,EAAI,IAAA,IAAA,KAAS,KAAa,CAAA,IAAA,IAAA,KAAS,KAAW,CAAA,EAAA;AAC5C,IAAO,OAAA,IAAA;AAAA;AAET,EAAA,2CACG,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,KAAA,EAAO,EAAE,KAAO,EAAA,GAAA,EACzB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAQ,MAAM,EAAA,IAAA,EAAC,OAAO,EAAE,UAAA,EAAY,GAAI,EAAA,EAAA,EACzD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,EAAgB,KAAM,EAAA,gBAAA,EAAiB,MAAM,MAAO,CAAA,SAAA,EAAW,CAChE,kBAAA,KAAA,CAAA,aAAA,CAAC,mBAAgB,KAAM,EAAA,gBAAA,EAAiB,IAAM,EAAA,MAAA,CAAO,WAAW,CAChE,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,sBAAA;AAAA,MACN,MAAM,MAAO,CAAA;AAAA;AAAA,GAEjB,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import Box from '@material-ui/core/Box';
|
|
2
|
-
import Typography from '@material-ui/core/Typography';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { ChildView } from './ChildView.esm.js';
|
|
5
|
-
import { MetadataView } from './MetadataView.esm.js';
|
|
6
|
-
|
|
7
|
-
function isRequired(name, required) {
|
|
8
|
-
if (required === true) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (Array.isArray(required)) {
|
|
12
|
-
return required.includes(name);
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
function ObjectView({ path, depth, schema }) {
|
|
17
|
-
const properties = Object.entries(schema.properties ?? {});
|
|
18
|
-
const patternProperties = Object.entries(schema.patternProperties ?? {});
|
|
19
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema })), properties.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Properties"), properties.map(([name, propSchema], index) => /* @__PURE__ */ React.createElement(
|
|
20
|
-
ChildView,
|
|
21
|
-
{
|
|
22
|
-
key: name,
|
|
23
|
-
path: path ? `${path}.${name}` : name,
|
|
24
|
-
depth: depth + 1,
|
|
25
|
-
schema: propSchema,
|
|
26
|
-
lastChild: index === properties.length - 1,
|
|
27
|
-
required: isRequired(name, schema.required)
|
|
28
|
-
}
|
|
29
|
-
))), patternProperties.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Pattern Properties"), patternProperties.map(([name, propSchema], index) => /* @__PURE__ */ React.createElement(
|
|
30
|
-
ChildView,
|
|
31
|
-
{
|
|
32
|
-
key: name,
|
|
33
|
-
path: path ? `${path}.<${name}>` : name,
|
|
34
|
-
depth: depth + 1,
|
|
35
|
-
schema: propSchema,
|
|
36
|
-
lastChild: index === patternProperties.length - 1,
|
|
37
|
-
required: isRequired(name, schema.required)
|
|
38
|
-
}
|
|
39
|
-
))), schema.additionalProperties && schema.additionalProperties !== true && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Additional Properties"), /* @__PURE__ */ React.createElement(
|
|
40
|
-
ChildView,
|
|
41
|
-
{
|
|
42
|
-
path: `${path}.*`,
|
|
43
|
-
depth: depth + 1,
|
|
44
|
-
schema: schema.additionalProperties,
|
|
45
|
-
lastChild: true
|
|
46
|
-
}
|
|
47
|
-
)));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { ObjectView };
|
|
51
|
-
//# sourceMappingURL=ObjectView.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectView.esm.js","sources":["../../../src/components/SchemaView/ObjectView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { ChildView } from './ChildView';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nfunction isRequired(name: string, required?: boolean | string[]) {\n if (required === true) {\n return true;\n }\n if (Array.isArray(required)) {\n return required.includes(name);\n }\n return false;\n}\n\nexport function ObjectView({ path, depth, schema }: SchemaViewProps) {\n const properties = Object.entries(schema.properties ?? {});\n const patternProperties = Object.entries(schema.patternProperties ?? {});\n\n return (\n <>\n {depth > 0 && (\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n )}\n {properties.length > 0 && (\n <>\n {depth > 0 && <Typography variant=\"overline\">Properties</Typography>}\n {properties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.${name}` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === properties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {patternProperties.length > 0 && (\n <>\n {depth > 0 && (\n <Typography variant=\"overline\">Pattern Properties</Typography>\n )}\n {patternProperties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.<${name}>` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === patternProperties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {schema.additionalProperties && schema.additionalProperties !== true && (\n <>\n <Typography variant=\"overline\">Additional Properties</Typography>\n <ChildView\n path={`${path}.*`}\n depth={depth + 1}\n schema={schema.additionalProperties}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;AAuBA,SAAS,UAAA,CAAW,MAAc,QAA+B,EAAA;AAC/D,EAAA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,IAAA,EAAM,GAAG,IAAI,CAAA,EAAA,CAAA;AAAA,MACb,OAAO,KAAQ,GAAA,CAAA;AAAA,MACf,QAAQ,MAAO,CAAA,oBAAA;AAAA,MACf,SAAS,EAAA;AAAA;AAAA,GAEb,CAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Box from '@material-ui/core/Box';
|
|
2
|
-
import Typography from '@material-ui/core/Typography';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { MetadataView } from './MetadataView.esm.js';
|
|
5
|
-
|
|
6
|
-
function ScalarView({ schema }) {
|
|
7
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema }));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { ScalarView };
|
|
11
|
-
//# sourceMappingURL=ScalarView.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarView.esm.js","sources":["../../../src/components/SchemaView/ScalarView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nexport function ScalarView({ schema }: SchemaViewProps) {\n return (\n <>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </>\n );\n}\n"],"names":[],"mappings":";;;;;AAsBgB,SAAA,UAAA,CAAW,EAAE,MAAA,EAA2B,EAAA;AACtD,EAAA,iEAEK,MAAO,CAAA,WAAA,wCACL,GAAI,EAAA,EAAA,YAAA,EAAc,qBAChB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAS,OAAO,WAAY,CAClD,mBAED,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,QAAgB,CAChC,CAAA;AAEJ;;;;"}
|