Skip to content

Commit

Permalink
Merge pull request #111 from RationAI/development
Browse files Browse the repository at this point in the history
fix: return awaiting promise with login procedure, update docs on plu…
  • Loading branch information
Aiosa authored Dec 18, 2024
2 parents 5eaf40f + 60a88a5 commit 6c4721d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 25 deletions.
13 changes: 8 additions & 5 deletions modules/oidc-client-ts/oidc-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,15 @@ oidc.xOpatUser = class extends XOpatModuleSingleton {
Dialogs.show(`${message} <a onclick="oidc.xOpatUser.instance().signIn(); Dialogs.hide();">${retryMessage}</a>`,
this.retryTimeout, Dialogs.MSG_WARN, {onHide: resolved});
await dialogWait;
if (this._manualCoroutine) await this._manualCoroutine;
if (!preventRecurse) {
return await this._trySignIn(false, this._connectionRetries >= this.maxRetryCount);

if (!this._manualCoroutine) {
if (!preventRecurse) {
return await this._trySignIn(false, this._connectionRetries >= this.maxRetryCount);
}
console.error("OIDC: No longer attempting to log in: user action needed.");
} else {
return this._manualCoroutine;
}
console.error("OIDC: MAX retry exceeded");
return false;
}

async _promptLogin() {
Expand Down
1 change: 1 addition & 0 deletions modules/webgl/advancedControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ uniform float ${this.webGLVariableName}_mask[ADVANCED_SLIDER_LEN+1];`;
}

sample(value=undefined, valueGlType='void') {
// TODO: throwing & managing exception would be better, now we don't know what happened when this gets baked to GLSL
if (!value || valueGlType !== 'float') {
return `ERROR Incompatible control. Advanced slider cannot be used with ${this.name} (sampling type '${valueGlType}')`;
}
Expand Down
3 changes: 3 additions & 0 deletions modules/webgl/visualizationLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,9 @@ WebGLModule.UIControls.IControl = class {
/**
* Sample the parameter using ratio as interpolation, must be one-liner expression so that GLSL code can write
* `vec3 mySampledValue = ${this.color.sample("0.2")};`
* TODO: if a control throws with the usage (type of the value does not fit), it is not properly reflected in the
* documentation!
*
* NOTE: you can define your own global-scope functions to keep one-lined sampling,
* see this.context.includeGlobalCode(...)
* @param {(string|undefined)} value openGL value/variable, used in a way that depends on the UI control currently active
Expand Down
52 changes: 32 additions & 20 deletions plugins/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Plugins

It is easy to create and plug-in a plugin. Each plugin must be in its own folder placed here (`./plugins/`).
Inside, one file must exist (otherwise the plugin won't load):
Recommeded way of creating a new plugin is a command ``grunt generate:plugin``.

## Plugin Directory Structure

#### `include.json`
A `JSON` file is required that defines the plugin and it's inclusion:
Inside a plugin, at least this file must exist (otherwise the directory is not treated as a plugin directory):

````json
{
Expand All @@ -20,31 +22,41 @@ A `JSON` file is required that defines the plugin and it's inclusion:
}
````

Note that this is meant mainly for a viewer maintainer to set-up the plugin default, static configuration.
Moreover, it is advised to use ENV setup (see `/env/README.md`) to override necessary configurations.
- `id` is a required value that defines plugin's ID as well as it's variable name (everything is set-up automatically)
- `name` is the plugin name
- `description` is a text displayed to the user to let them know what the plugin does: it should be short and concise
- `author` is the plugin author
- `icon` is the plugin icon
- `version` is the plugin version
- `includes` is a list of JavaScript files relative to the plugin folder to include
- `modules` array of id's of required modules (libraries)
- note that in case a new library you need is probably not useful to the whole system, include it internally via the plugin's `"includes"` list
instead of creating a module for it
- `permaLoad` is an option to include the plugin permanently without asking; such plugin is not shown in Plugins Menu and is always present
- `enabled` is an option to allow or disallow the plugin in the system, default `true`
- `hidden` is an option to hide plugin from the user-available selection

### Must do's
##### Built-in keys

- `id` is a required value that defines plugin's ID as well as it's variable name (everything is set-up automatically)
- `name` is the plugin name
- `description` is a text displayed to the user to let them know what the plugin does: it should be short and concise
- `author` is the plugin author
- `icon` is the plugin icon
- `version` is the plugin version
- `includes` is a list of JavaScript files relative to the plugin folder to include
- `modules` array of id's of required modules (libraries)
- note that in case a new library you need is probably not useful to the whole system, include it internally via the plugin's `"includes"` list
instead of creating a module for it
- `permaLoad` is an option to include the plugin permanently without asking; such plugin is not shown in Plugins Menu and is always present
- `enabled` is an option to allow or disallow the plugin in the system, default `true`
- `hidden` is an option to hide plugin from the user-available selection

##### Custom keys
A developer can provide custom parameters to `include.json` and retrieve them later in the code.
A deployment maintainer then uses ENV setup (see `/env/README.md`) to override necessary values.
These are called **Static Configurations**.


## Must do's
- A plugin must register itself using the name of its parent class. For more information see below.
- if the plugin is based on `MyAwesomePlugin` object/class, then call `addPlugin('myPluginId', MyAwesomePlugin);` on a global level
- `'myPluginId'` must be the same as `id` from `includes.json`
- Any attached HTML to the DOM must be attached by the provided API (see `USER_INTERFACE` global variable)
- A plugin must inherit from ``XOpatPlugin`` class
- the constructor is given ``id`` and ``params`` arguments, call `super(id)` and use params at your will
- your plugin constructor is given ``id`` and ``params`` arguments, call `super(id)` and use params (from the **Dynamic session**) at your will
- Get familiar with both global and ``XOpatPlugin`` API - use it where possible
- especially, do not add HTML to DOM directly (unless you operate a new window instance), use ``window.USER_INTERFACE`` API instead
- cache meaningful values
- interact with static & dynamic configuration values
- provide built-in IO logics
- ...

> **IMPORTANT.** Please respect the viewer API and behavior. Specifically,
> respect the ``APPLICATION_CONTEXT.secure`` parameter
Expand Down

0 comments on commit 6c4721d

Please sign in to comment.