diff --git a/docs/creating-manifest/events.md b/docs/creating-manifest/events.md index d3edb498..675b1a95 100644 --- a/docs/creating-manifest/events.md +++ b/docs/creating-manifest/events.md @@ -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: diff --git a/docs/creating-manifest/placeholders.md b/docs/creating-manifest/placeholders.md index 32fa89da..ef830049 100644 --- a/docs/creating-manifest/placeholders.md +++ b/docs/creating-manifest/placeholders.md @@ -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. @@ -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;" + ] + } +} +``` +@@! +

What’s next?

diff --git a/docs/creating-manifest/visual-settings.md b/docs/creating-manifest/visual-settings.md index 5a688f9f..96a54197 100644 --- a/docs/creating-manifest/visual-settings.md +++ b/docs/creating-manifest/visual-settings.md @@ -2139,6 +2139,34 @@ settings: Result: ![Tooltip-composit-field](/img/tooltip-composit-field.png) +### 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. diff --git a/theme/readthedocs/img/owner-field.png b/theme/readthedocs/img/owner-field.png new file mode 100644 index 00000000..a64b067e Binary files /dev/null and b/theme/readthedocs/img/owner-field.png differ diff --git a/theme/readthedocs/img/shared-with-me.png b/theme/readthedocs/img/shared-with-me.png new file mode 100644 index 00000000..becba28b Binary files /dev/null and b/theme/readthedocs/img/shared-with-me.png differ