Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 59 additions & 2 deletions docs/creating-manifest/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -1366,14 +1366,71 @@ The *onBeforeInit* event is executed:
installation dialog in the dashboard
- on application installation


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

- `type`
- `name`
- `baseUrl`

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.

For example:

@@@
```yaml
type: install
name: Account And Quota Placeholders
settings:
fields:
- type: owner
caption: Owner
name: ownerUid
onBeforeInit: |
settings.fields.push({
type: "string",
caption: "Account",
name: "email",
value: "${account.email}"
}, {
type: "string",
caption: "Cloudlets",
name: "cloudlets",
value: "${quota.environment.maxcloudletsperrec}"
});
return settings;
```
```json
{
"type": "install",
"name": "Account And Quota Placeholders",
"settings": {
"fields": [
{
"type": "owner",
"caption": "Owner",
"name": "ownerUid"
}
],
"onBeforeInit": [
"settings.fields.push({",
" type: 'string',",
" caption: 'Account',",
" name: 'email',",
" value: '${account.email}'",
"},",
"{",
" type: 'string',",
" caption: 'Cloudlets',",
" name: 'cloudlets',",
" value: '${quota.environment.maxcloudletsperrec}'",
"});",
"return settings;"
]
}
}
```
@@!

#### onBeforeInstall
The *onBeforeInstall* event is executed before application installation but after *onBeforeInit*.
The placeholders **\${globals.}** and **\${settings.}** can be used within *onBeforeInstall*. All of the manifest parameters can be overridden, except for:
Expand Down
108 changes: 107 additions & 1 deletion docs/creating-manifest/placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ The following specific groups of placeholders are singled out:

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

- [File Path Placeholders](placeholders/#file-path-placeholders)
- [File Path Placeholders](placeholders/#file-path-placeholders)

- [Engine Placeholder](placeholders/#engine-placeholder)

- [Account Placeholders](placeholders/#account-placeholders)

- [Quota Placeholders](placeholders/#quota-placeholders)

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

Expand Down Expand Up @@ -1249,6 +1255,106 @@ onInstall:
```
@@!

## Account Placeholders

To ensure ability to process user's quotas and collaboration the following `${account.(key)}` placeholders are available:

- `${account.}`
- `${account.groupType}`
- `${account.bonus}`
- `${account.hardNodeGroups}`
- `${account.createdOn}`
- `${account.updatedGroupOn}`
- `${account.defaultHardNodeGroup}`
- `${account.uid}`
- `${account.isCommerial}`
- `${account.balance}`
- `${account.isRegistered}`
- `${account.updatedStatusOn}`
- `${account.status}`
- `${account.group}`
- `${account.email}`

Placeholders *${account.(key)}* are initialized on demand, that is, only if they are used and only at the moment they are required.
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.

## Quota Placeholders

To ensure ability to process user's quotas and collaboration the following `${quota.(key)` and `${quota.data.(key)}` placeholders are available:

- `${quota.}`
- `${quota.maxcloudletsperrec}`
- `${quota.maxcount}`
- `${quota.disk.iolimit}`
- ...

- `${quota.data.}`
- `${quota.data.environment.maxcloudletsperrec.quota.name}`
- `${quota.data.environment.maxcloudletsperrec.quota.description}`
- `${quota.data.environment.maxcloudletsperrec.quota.id}`
- `${quota.data.environment.maxcloudletsperrec.type}`
- `${quota.data.environment.maxcloudletsperrec.value}
- ...

Placeholders `${quota.(key)}` are initialized on demand, that is, only if they are used and only at the moment they are required.
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.

Placeholders `${quota.(key)}` are filled with quota values, where **key** is the name of the quota (for example: *${quota.environment.maxcloudletsperrec}*).

Placeholders `${quota.data.(key)}` allow you to get quota data (for example, *type: ${quota.data.environment.maxcloudletsperrec.type}*).

Example:

@@@
```yaml
type: install
name: Account And Quota Placeholders

settings:
fields: []

onBeforeInit: |
settings.fields.push({
type: "string",
caption: "Account",
name: "email",
value: "${account.email}"
}, {
type: "string",
caption: "Cloudlets",
name: "cloudlets",
value: "${quota.environment.maxcloudletsperrec}"
});
return settings;
```
```json
{
"type": "install",
"name": "Account And Quota Placeholders",
"settings": {
"fields": [

],
"onBeforeInit": [
"settings.fields.push({",
" type: 'string',",
" caption: 'Account',",
" name: 'email',",
" value: '${account.email}'",
"},",
"{",
" type: 'string',",
" caption: 'Cloudlets',",
" name: 'cloudlets',",
" value: '${quota.environment.maxcloudletsperrec}'",
"});",
"return settings;"
]
}
}
```
@@!


<br>
<h2> What’s next?</h2>
Expand Down
28 changes: 28 additions & 0 deletions docs/creating-manifest/visual-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,34 @@ settings:
Result:
![Tooltip-composit-field](/img/tooltip-composit-field.png)</center>

### owner

This field allows you to add the possibility of collaboration for packages with **type: install** without section nodes when installing environments in nested manifests.

@@@
```yaml
- type: owner
caption: Owner
name: ownerUid
```
```json
[
{
"type": "owner",
"caption": "Owner",
"name": "ownerUid"
}
]
```
@@!

![owner-field](/img/owner-field.png)

The field is not displayed if there are no users defined in **Shared with Me**.

![shared-with-me](/img/shared-with-me.png)

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.

## Dynamic filling of the manifest fields
Ability to dynamically determine UI in JPS manifest is accessible via [*onBeforeInit* *onBeforeInstall*](events/#onbeforeinit) events.
Expand Down
Binary file added theme/readthedocs/img/owner-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added theme/readthedocs/img/shared-with-me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.