diff --git a/docs/planning/advanced-extensions.mdx b/docs/planning/advanced-extensions.mdx index 992db0f..f1f87a4 100644 --- a/docs/planning/advanced-extensions.mdx +++ b/docs/planning/advanced-extensions.mdx @@ -1,6 +1,8 @@ +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. @@ -8,57 +10,29 @@ Extensions are external tools that can be invoked directly from inside of Aerie. - `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 - } -} -``` +
+ Aerie Planning Navbar - Extensions +
Figure 1: Aerie Planning Navbar - Extensions
+
-THe `$extensionRole` query variable has the following type definition: -```ts -type ExtensionRole = { - extension_id: number; - id: number; - role: string; -}; -``` diff --git a/docs/planning/assets/extensions-navbar.png b/docs/planning/assets/extensions-navbar.png new file mode 100644 index 0000000..7608521 --- /dev/null +++ b/docs/planning/assets/extensions-navbar.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:000571f90fbe70cfa5382aa0ef876176363db7e27f8f2797541078d59fc7af5e +size 74767