-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added information about how Auth is passed to the application - Added image showing Extensions in the Navbar - Deferred to the API docs rather for extension managing rather than duplicating information
- Loading branch information
1 parent
3b0e428
commit ebd7b50
Showing
2 changed files
with
22 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,38 @@ | ||
import extensions from './assets/extensions-navbar.png'; | ||
|
||
# Advanced - Extensions | ||
|
||
Extensions are external tools that can be invoked directly from inside of Aerie. If there are not any extensions defined the button to view them will be hidden. When an Extension is called, the following values are passed along in the request body: | ||
Extensions are external tools that can be invoked directly from inside of Aerie. When an Extension is called, the following values are passed along in the request body: | ||
|
||
- `gateway` - The URL for the current instance's Gateway server. | ||
- `hasura` - The URL for the current instance's Hasura server. | ||
- `planId` - The id of the plan the user is looking at. | ||
- `selectedActivityDirectiveId` - The id of the selected activity directive (if applicable). | ||
- `simulationDatasetId` - The id of the last run simulation (if applicable). | ||
|
||
After the Extension is ran, it is expecting the following response: | ||
Additionally, the user's current session information will be passed to the Extension via the `Authorization` and `x-hasura-role` headers. | ||
|
||
```json | ||
{ | ||
"message": "", | ||
"success": true, | ||
"url": "" | ||
} | ||
``` | ||
Extensions **must** return a response of the following form: | ||
|
||
The message will be displayed as a Toast inside of Aerie. `success` can be true or false to indicate if the Extension ran successfully or not. The `url` is optional and can be a link to a file or another webpage that will be opened in a new tab if provided. | ||
- `message`: the message to be displayed as a notification inside of Aerie | ||
- `success`: a boolean indicating whether the Extension ran successfully | ||
- `url`: an optional link to a file or website. if provided, it will be opened in a new tab | ||
|
||
There isn't currently a way to insert an extension through the UI, but we can use Hasura to create them with an API call. | ||
## Managing Extensions | ||
|
||
```graphql | ||
mutation InsertExtension($extension: extensions_insert_input!) { | ||
insert_extension_one(object: $extension) { | ||
id | ||
} | ||
} | ||
``` | ||
Extensions may only be managed via the [GraphQL API](/api/examples/extensions). | ||
|
||
The `$extentsion` query variable has the following type definition: | ||
## Using Extensions | ||
|
||
```ts | ||
type Extension = { | ||
description: string; | ||
extension_roles: ExtensionRole[]; | ||
id: number; | ||
label: string; | ||
updated_at: string; | ||
url: string; | ||
}; | ||
``` | ||
When looking at a plan in Aerie, all registered Extensions can be found under the Navbar entry between Scheduling and View. | ||
If there are no any extensions registered, this entry will be hidden. | ||
|
||
After creating an Extension, you need to define the roles that are allowed to access it through the following Hasura mutation: | ||
Hovering over extensions will bring up the list of registered Extensions. | ||
To run an extension, click on its entry in the list. | ||
|
||
```graphql | ||
mutation InsertExtensionRole($extensionRole: extension_roles_insert_input!) { | ||
insert_extension_roles_one(object: $extensionRole) { | ||
id | ||
} | ||
} | ||
``` | ||
<figure align="center"> | ||
<img alt="Aerie Planning Navbar - Extensions" src={extensions} /> | ||
<figcaption>Figure 1: Aerie Planning Navbar - Extensions</figcaption> | ||
</figure> | ||
|
||
THe `$extensionRole` query variable has the following type definition: | ||
|
||
```ts | ||
type ExtensionRole = { | ||
extension_id: number; | ||
id: number; | ||
role: string; | ||
}; | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.