Skip to content

Commit b2f17ba

Browse files
account and quotas placeholders (#219)
* JE-53455 onBeforeInit quotas validation * JE-53455 onBeforeInit new placeholders added The ${account.(key)}, ${quota.(key)} and ${quota.data.(key)} placeholders added to Placeholders * Error fixed * JE-53455 onBeforeInit field owner added * JE-53455 onBeforeInit shared-with-me pic added * JE-53455 onBeforeInit owner pic added * JE-53455 onBeforeInit event updated * error fixed * Update docs/creating-manifest/placeholders.md --------- Co-authored-by: vlobzakov <39057925+vlobzakov@users.noreply.github.com>
1 parent 99fe77b commit b2f17ba

File tree

5 files changed

+194
-3
lines changed

5 files changed

+194
-3
lines changed

docs/creating-manifest/events.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,14 +1366,71 @@ The *onBeforeInit* event is executed:
13661366
installation dialog in the dashboard
13671367
- on application installation
13681368

1369-
1370-
Placeholders do not work inside *onBeforeInit*, since even *globals* can be defined dynamically.
13711369
You can override all the parameters of the manifest, except for:
13721370

13731371
- `type`
13741372
- `name`
13751373
- `baseUrl`
13761374

1375+
The *GetAppInfo* method has **ownerUid** parameter which allows to define a collaborator's account. Parameter is applied if the [owner](visual-settings/#owner) field is added to manifest. The [account](placeholders/#account-placeholders) and [quota](placeholders/#quota-placeholders) placeholders will be filled in depending on defined account.
1376+
1377+
For example:
1378+
1379+
@@@
1380+
```yaml
1381+
type: install
1382+
name: Account And Quota Placeholders
1383+
settings:
1384+
fields:
1385+
- type: owner
1386+
caption: Owner
1387+
name: ownerUid
1388+
onBeforeInit: |
1389+
settings.fields.push({
1390+
type: "string",
1391+
caption: "Account",
1392+
name: "email",
1393+
value: "${account.email}"
1394+
}, {
1395+
type: "string",
1396+
caption: "Cloudlets",
1397+
name: "cloudlets",
1398+
value: "${quota.environment.maxcloudletsperrec}"
1399+
});
1400+
return settings;
1401+
```
1402+
```json
1403+
{
1404+
"type": "install",
1405+
"name": "Account And Quota Placeholders",
1406+
"settings": {
1407+
"fields": [
1408+
{
1409+
"type": "owner",
1410+
"caption": "Owner",
1411+
"name": "ownerUid"
1412+
}
1413+
],
1414+
"onBeforeInit": [
1415+
"settings.fields.push({",
1416+
" type: 'string',",
1417+
" caption: 'Account',",
1418+
" name: 'email',",
1419+
" value: '${account.email}'",
1420+
"},",
1421+
"{",
1422+
" type: 'string',",
1423+
" caption: 'Cloudlets',",
1424+
" name: 'cloudlets',",
1425+
" value: '${quota.environment.maxcloudletsperrec}'",
1426+
"});",
1427+
"return settings;"
1428+
]
1429+
}
1430+
}
1431+
```
1432+
@@!
1433+
13771434
#### onBeforeInstall
13781435
The *onBeforeInstall* event is executed before application installation but after *onBeforeInit*.
13791436
The placeholders **\${globals.}** and **\${settings.}** can be used within *onBeforeInstall*. All of the manifest parameters can be overridden, except for:

docs/creating-manifest/placeholders.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ The following specific groups of placeholders are singled out:
2828

2929
- [Array Placeholders](placeholders/#array-placeholders)
3030

31-
- [File Path Placeholders](placeholders/#file-path-placeholders)
31+
- [File Path Placeholders](placeholders/#file-path-placeholders)
32+
33+
- [Engine Placeholder](placeholders/#engine-placeholder)
34+
35+
- [Account Placeholders](placeholders/#account-placeholders)
36+
37+
- [Quota Placeholders](placeholders/#quota-placeholders)
3238

3339
Placeholders like `env`, `nodes`, `targetNodes`, `response` are dynamically updated. They could be updated by their requests if they are required to be updated.
3440

@@ -1247,6 +1253,106 @@ onInstall:
12471253
```
12481254
@@!
12491255

1256+
## Account Placeholders
1257+
1258+
To ensure ability to process user's quotas and collaboration the following `${account.(key)}` placeholders are available:
1259+
1260+
- `${account.}`
1261+
- `${account.groupType}`
1262+
- `${account.bonus}`
1263+
- `${account.hardNodeGroups}`
1264+
- `${account.createdOn}`
1265+
- `${account.updatedGroupOn}`
1266+
- `${account.defaultHardNodeGroup}`
1267+
- `${account.uid}`
1268+
- `${account.isCommerial}`
1269+
- `${account.balance}`
1270+
- `${account.isRegistered}`
1271+
- `${account.updatedStatusOn}`
1272+
- `${account.status}`
1273+
- `${account.group}`
1274+
- `${account.email}`
1275+
1276+
Placeholders *${account.(key)}* are initialized on demand, that is, only if they are used and only at the moment they are required.
1277+
Placeholder values are filled in depending on which user the installation is carried out for. That is, the placeholders will be filled with values for the collaborator selected during installation.
1278+
1279+
## Quota Placeholders
1280+
1281+
To ensure ability to process user's quotas and collaboration the following `${quota.(key)` and `${quota.data.(key)}` placeholders are available:
1282+
1283+
- `${quota.}`
1284+
- `${quota.maxcloudletsperrec}`
1285+
- `${quota.maxcount}`
1286+
- `${quota.disk.iolimit}`
1287+
- ...
1288+
1289+
- `${quota.data.}`
1290+
- `${quota.data.environment.maxcloudletsperrec.quota.name}`
1291+
- `${quota.data.environment.maxcloudletsperrec.quota.description}`
1292+
- `${quota.data.environment.maxcloudletsperrec.quota.id}`
1293+
- `${quota.data.environment.maxcloudletsperrec.type}`
1294+
- `${quota.data.environment.maxcloudletsperrec.value}
1295+
- ...
1296+
1297+
Placeholders `${quota.(key)}` are initialized on demand, that is, only if they are used and only at the moment they are required.
1298+
Placeholder values are filled in depending on which user the installation is carried out for. That is, the placeholders will be filled with values for the collaborator selected during installation.
1299+
1300+
Placeholders `${quota.(key)}` are filled with quota values, where **key** is the name of the quota (for example: *${quota.environment.maxcloudletsperrec}*).
1301+
1302+
Placeholders `${quota.data.(key)}` allow you to get quota data (for example, *type: ${quota.data.environment.maxcloudletsperrec.type}*).
1303+
1304+
Example:
1305+
1306+
@@@
1307+
```yaml
1308+
type: install
1309+
name: Account And Quota Placeholders
1310+
1311+
settings:
1312+
fields: []
1313+
1314+
onBeforeInit: |
1315+
settings.fields.push({
1316+
type: "string",
1317+
caption: "Account",
1318+
name: "email",
1319+
value: "${account.email}"
1320+
}, {
1321+
type: "string",
1322+
caption: "Cloudlets",
1323+
name: "cloudlets",
1324+
value: "${quota.environment.maxcloudletsperrec}"
1325+
});
1326+
return settings;
1327+
```
1328+
```json
1329+
{
1330+
"type": "install",
1331+
"name": "Account And Quota Placeholders",
1332+
"settings": {
1333+
"fields": [
1334+
1335+
],
1336+
"onBeforeInit": [
1337+
"settings.fields.push({",
1338+
" type: 'string',",
1339+
" caption: 'Account',",
1340+
" name: 'email',",
1341+
" value: '${account.email}'",
1342+
"},",
1343+
"{",
1344+
" type: 'string',",
1345+
" caption: 'Cloudlets',",
1346+
" name: 'cloudlets',",
1347+
" value: '${quota.environment.maxcloudletsperrec}'",
1348+
"});",
1349+
"return settings;"
1350+
]
1351+
}
1352+
}
1353+
```
1354+
@@!
1355+
12501356

12511357
<br>
12521358
<h2> What’s next?</h2>

docs/creating-manifest/visual-settings.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,34 @@ settings:
21362136
Result:
21372137
![Tooltip-composit-field](/img/tooltip-composit-field.png)</center>
21382138

2139+
### owner
2140+
2141+
This field allows you to add the possibility of collaboration for packages with **type: install** without section nodes when installing environments in nested manifests.
2142+
2143+
@@@
2144+
```yaml
2145+
- type: owner
2146+
caption: Owner
2147+
name: ownerUid
2148+
```
2149+
```json
2150+
[
2151+
{
2152+
"type": "owner",
2153+
"caption": "Owner",
2154+
"name": "ownerUid"
2155+
}
2156+
]
2157+
```
2158+
@@!
2159+
2160+
![owner-field](/img/owner-field.png)
2161+
2162+
The field is not displayed if there are no users defined in **Shared with Me**.
2163+
2164+
![shared-with-me](/img/shared-with-me.png)
2165+
2166+
Changing the *Owner* field value results in the data will be re-rerquested with *GetAppInfo* method and form re-rendered in case there is [onBeforeInit](events/#onbeforeinit) in the mainifest. Re-rendering will be performed according to the account and quotas of collaborator.
21392167

21402168
## Dynamic filling of the manifest fields
21412169
Ability to dynamically determine UI in JPS manifest is accessible via [*onBeforeInit* *onBeforeInstall*](events/#onbeforeinit) events.
5.85 KB
Loading
48.8 KB
Loading

0 commit comments

Comments
 (0)