Skip to content

Commit 7b4977a

Browse files
authored
feat: update Software Catalog items manifests doc (#2105)
* feat: update Software Catalog items manifests doc * fix link
1 parent 2ce4f9a commit 7b4977a

15 files changed

+375
-27
lines changed

docs/software-catalog/items-manifest/example.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import SchemaViewer from "../snippets/schema_viewer.mdx";
99

1010
Examples works no differently than [templates](/software-catalog/items-manifest/template.md), in the sense that they too provide an **archive** with base configurations. Unlike templates, examples should come with some features already implemented and tailored to help the user better familiarize with the development environment.
1111

12+
:::tip
13+
Any additional information presented in the [template section](/software-catalog/items-manifest/template.md) will work for example items.
14+
:::
15+
1216
To [create or edit](/software-catalog/items-management/overview.md) an example, you need to provide a [manifest](/software-catalog/items-manifest/overview.md), whose `resources` property should adhere to the following JSON schema.
1317

1418
:::tip

docs/software-catalog/items-manifest/extension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_label: Extension
77
import { catalogWellKnownItems } from "@mia-platform/console-types";
88
import SchemaViewer from "../snippets/schema_viewer.mdx";
99

10-
Extensions are **custom pages** that enhances Console capabilities by integrating it into the sidebar navigation. Since extensions have their own [dedicated section](/console/company-configuration/extensions.md), they are left out by the [Software Catalog UI][ui]. Extensions can still be managed with [miactl][miactl], and API calls.
10+
Extensions are **custom pages** that enhances Console capabilities by integrating it into the sidebar navigation.
1111

1212
To [create or edit](/software-catalog/items-management/overview.md) an extension, you need to provide a [manifest](/software-catalog/items-manifest/overview.md), whose `resources` property should adhere to the following JSON schema.
1313

Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/software-catalog/items-manifest/infrastructure-resource.md

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ title: Infrastructure resource
44
sidebar_label: Infrastructure resource
55
---
66

7+
import Tabs from '@theme/Tabs';
8+
import TabItem from '@theme/TabItem';
9+
710
import { catalogWellKnownItems } from "@mia-platform/console-types";
811
import SchemaViewer from "../snippets/schema_viewer.mdx";
912

@@ -16,3 +19,248 @@ The JSON schemas of the [infrastructure resource resources](https://raw.githubus
1619
:::
1720

1821
<SchemaViewer schema={catalogWellKnownItems['custom-resource'].resourcesSchema} />
22+
23+
## Monitor a Custom Kubernetes Resource in the Runtime area
24+
25+
If you've upgraded to Console release `v13.3.0`, you can now view the status of your Current Kubernetes Resources directly in the Runtime section. To enable this feature, [publish a new version](/software-catalog/items-management/ui.md#create-a-new-version) of your infrastructure resource that include the fields `runtime`.
26+
27+
## Generate dynamic form to customize validation
28+
29+
If you have upgraded the Console to version `v13.6.1`, you can now generate a dynamic form. This documentation serves as a guide for users to understand and effectively utilize the dynamic form fields generated from a JSON schema. By following the examples and descriptions provided, users can create forms that are both functional and user-friendly, ensuring a smooth data entry experience.
30+
31+
:::info
32+
In the next versions of the Console we want to add dynamic form generation also in the details section.
33+
:::
34+
35+
The Frontend of the Console generate the Form using the roles below:
36+
37+
### Supported JSON Schema Types
38+
39+
<Tabs groupId="types" queryString>
40+
<TabItem value="type-object" label="type Object" default>
41+
42+
#### Object field
43+
44+
Visualized as Editor
45+
46+
![type-object](./img/type-object.png)
47+
48+
```json
49+
{
50+
"jsonSchema": {
51+
"type": "object",
52+
"required": ["mirroring"],
53+
"properties" {
54+
"mirroring": { "type": "object", "description": "Mirroring defines the Mirroring service configuration" }
55+
}
56+
}
57+
}
58+
```
59+
60+
##### Validation
61+
62+
The editor generated from this type can validate with [ajv library](https://ajv.js.org/) the sub schema used to fields
63+
64+
![type-object-validation](img/type-object-validation.png)
65+
66+
```json
67+
{
68+
"jsonSchema": {
69+
"type": "object",
70+
"required": ["mirroring"],
71+
"properties" {
72+
"mirroring": {
73+
"type": "object",
74+
"additionalProperties": false,
75+
"required": ["name"],
76+
"properties": {
77+
"name": { "type": "string" }
78+
}
79+
}
80+
}
81+
}
82+
}
83+
```
84+
85+
</TabItem>
86+
<TabItem value="type-array" label="type Array">
87+
88+
#### Array field
89+
90+
Visualized as Editor
91+
92+
![type-array](img/type-array.png)
93+
94+
```json
95+
{
96+
"jsonSchema": {
97+
"type": "object",
98+
"properties": {
99+
"services": {
100+
"items": {
101+
"additionalProperties": false,
102+
"properties": {
103+
"healthCheck": {
104+
"additionalProperties": false,
105+
"properties": {
106+
"followRedirects": { "type": "boolean" },
107+
}
108+
}
109+
}
110+
}
111+
}
112+
}
113+
}
114+
}
115+
```
116+
117+
##### Validation
118+
119+
The editor generated from this type can validate with [ajv library](https://ajv.js.org/) the sub schema used to fields
120+
121+
![type-array-validation](img/type-array-validation.png)
122+
123+
```json
124+
{
125+
"jsonSchema": {
126+
"type": "object",
127+
"properties": {
128+
"services": {
129+
"items": {
130+
"type": "object",
131+
"properties": {
132+
"healthCheck": {
133+
"type": "object",
134+
"properties": {
135+
"followRedirects": { "type": "boolean" },
136+
}
137+
}
138+
}
139+
}
140+
}
141+
}
142+
}
143+
}
144+
```
145+
146+
</TabItem>
147+
148+
<TabItem value="type-string" label="type String">
149+
150+
#### String type
151+
152+
Used for textual input. It can include various validations such as minimum and maximum length.
153+
When using a string field, ensure that the input meets the specified length requirements.
154+
155+
![type-string](img/type-string.png)
156+
157+
```json
158+
{
159+
"jsonSchema": {
160+
"type": "object",
161+
"properties": {
162+
"type": "string",
163+
"minLength": 5,
164+
"maxLength": 100,
165+
"description": "Enter your full name."
166+
}
167+
}
168+
}
169+
```
170+
171+
172+
</TabItem>
173+
174+
<TabItem value="type-boolean" label="type Boolean">
175+
176+
The boolean type is used for true/false values. This is typically represented as a switch in the form.
177+
178+
![boolean](img/type-boolean.png)
179+
180+
```json
181+
{
182+
"jsonSchema": {
183+
"type": "object",
184+
"properties": {
185+
"boolean": {
186+
"type": "boolean",
187+
"description": "Do you agree to the terms and conditions?"
188+
}
189+
}
190+
}
191+
}
192+
```
193+
194+
</TabItem>
195+
196+
<TabItem value="type-integer" label="type Integer">
197+
198+
#### Integer type
199+
200+
Specifically for whole numbers. It behaves similarly to the number type but restricts input to integers.
201+
202+
![type-int-or-number](img/type-int-or-number.png)
203+
204+
```json
205+
{
206+
"jsonSchema": {
207+
"type": "object",
208+
"properties": {
209+
"integer": {
210+
"type": "integer",
211+
"minimum": 1,
212+
"maximum": 10,
213+
"description": "Enter an integer between 1 and 10."
214+
}
215+
}
216+
}
217+
}
218+
```
219+
220+
</TabItem>
221+
<TabItem value="type-number" label="type Number">
222+
223+
#### Number type
224+
225+
Used for numerical input, which can include both integers and floating-point numbers.
226+
227+
![type-int-or-number](img/type-int-or-number.png)
228+
229+
```json
230+
{
231+
"jsonSchema": {
232+
"type": "object",
233+
"properties": {
234+
"number": {
235+
"type": "number",
236+
"minimum": 0,
237+
"maximum": 100,
238+
"description": "Enter a value between 0 and 100"
239+
}
240+
}
241+
}
242+
}
243+
```
244+
245+
</TabItem>
246+
</Tabs>
247+
248+
### Unsupported JSON Schema Features
249+
250+
While our dynamic form fields support a wide range of JSON schema features, there are certain features that are not supported.
251+
Additionally, being aware of the unsupported features will help users avoid potential issues when designing their schemas.
252+
Below is a list of unsupported features:
253+
254+
- **$ref**: Reference to external schemas
255+
- **oneOf**: Validation against one of the specified schemas
256+
- **allOf**: Validation against all of the specified schemas
257+
- **anyOf**: Validation against any of the specified schemas
258+
- **not**: Validation against the negation of the specified schema
259+
- **string** format: Specific string formats such as email, date, etc
260+
- **number** exclusiveMinimum and exclusiveMaximum: Exclusive range validation for numbers
261+
- **dependencies**: Conditional validation based on the presence of other fields
262+
263+
#### Partially supported JSON Schema Features
264+
265+
- **additionalProperties**: Validation of additional properties work only for types array or object in the schema
266+
- **patternProperties**: Validation of properties matching a specific pattern

docs/software-catalog/items-manifest/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ The full JSON schema is available [on GitHub](https://raw.githubusercontent.com/
1818

1919
<SchemaViewer schema={catalogItemManifestSchema} />
2020

21+
## Categories
22+
23+
Items can be organized in categories with the field `catagoryId`. The available categories are pre-defined, and can be found [here](https://raw.githubusercontent.com/mia-platform-marketplace/public-catalog/refs/heads/main/assets/categories.json).
24+
2125
## Permissions
2226

2327
To create or edit items, users must have the [role](/development_suite/identity-and-access-management/console-levels-and-permission-management.md#identity-capabilities-inside-console) of **Company Owner** or **Project Administrator** in the Company the item belongs to.

docs/software-catalog/items-manifest/plugin.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,38 @@ The JSON schemas of the [plugin resources](https://raw.githubusercontent.com/mia
1717
:::
1818

1919
<SchemaViewer schema={catalogWellKnownItems['plugin'].resourcesSchema} />
20+
21+
## Values interpolation
22+
23+
The values of the `defaultLabels`, `defaultAnnotations`, and `defaultEnvironmentVariables` fields can contain **placeholders** that will be replaced with the actual values when a Console user creates the service.
24+
25+
Here is an exhaustive list of the placeholders that can be used:
26+
27+
- `%MICROSERVICE_NAME%`: the name of the created microservice.
28+
- `%PROJECT_ID%`: the human-readable ID of the project. It is a dash-separated string generated by the Console when a project is created, based on the project name.
29+
- `%COMPANY_ID%`: the ID of the company that owns the project.
30+
- `%TENANT_ID%`: alias for `%COMPANY_ID%`.
31+
32+
:::info
33+
Any unrecognized placeholder will be left as is in the final value.
34+
:::
35+
36+
As example, consider a plugin with the following `defaultEnvironmentVariables`:
37+
38+
```json
39+
[
40+
{
41+
"name": "SOME_ENV_VAR",
42+
"value": "ms name: %MICROSERVICE_NAME%; project id: %PROJECT_ID%; company id: %COMPANY_ID%"
43+
}
44+
]
45+
```
46+
47+
Given a Project with the id `my-project`, and a Company with the ID `my-company`, if user creates a microservice named `my-ms` from such plugin, the result will be:
48+
49+
```json
50+
{
51+
"name": "SOME_ENV_VAR",
52+
"value": "ms name: my-ms; project id: my-project; company id: my-company"
53+
}
54+
```

0 commit comments

Comments
 (0)