ℹ️ OpenFin Workspace: OpenFin Workspace is a commercial product and this repo is for evaluation purposes (See LICENSE.MD). Use of the OpenFin Container and OpenFin Workspace components is only granted pursuant to a license from OpenFin (see manifest). Please contact us if you would like to request a developer evaluation key or to discuss a production license.
By default you get the ability to save, rename and delete pages in Workspace Browser.
When you save a Page it captures the layout (which views are present and how they are laid out) within the page. If your views have created customData this will be included in the layout data of the page (which is what we call the JSON representation of all of this data).
This lets you easily layout arrangements and the applications you work with an assign it a name.
By default this json data is saved to IndexedDB. This lets you get up and running without any server requirement for the storage of this data.
A workspace platform lets you override the platform implementation so you can come up with your own function implementations for the saving and fetching of pages. This is called a platform override and the workspace platform starter implementation exists here: platform-override.ts.
Instead of modifying this file directly we allow you to specify the destination and source of pages through config and the definition of endpoints.
Endpoints support an action and request/response function (see How To Defined Endpoints). Workspace platform starter checks to see if you have specified the following endpoints:
- page-list
- page-get
- page-set
- page-remove
If you provide endpoints with these ids then workspace platform starter will use them instead of the default indexedDB implementation.
This frees you up to fetch and save your pages from/to anywhere in any way that works for you.
Endpoints have a default fetch implementation where you can just point to rest endpoints but you could also have a custom module (see How To Add A Module that implements your own logic.
You can enable a development endpoint on the local server to emulate these endpoints by adding the following endpoint entries, this code should not be used in production. The server stores everything in memory, so it will be wiped if you restart it.
"endpointProvider": {
"endpoints": [
{
"id": "page-list",
"type": "fetch",
"options": {
"method": "GET",
"url": "http://localhost:8080/api/storage/page"
}
},
{
"id": "page-get",
"type": "fetch",
"options": {
"method": "GET",
"url": "http://localhost:8080/api/storage/page/[id]"
}
},
{
"id": "page-set",
"type": "fetch",
"options": {
"method": "POST",
"url": "http://localhost:8080/api/storage/page"
}
},
{
"id": "page-remove",
"type": "fetch",
"options": {
"method": "DELETE",
"url": "http://localhost:8080/api/storage/page/[id]"
}
}
]
}
Our default example manifest (manifest.fin.json) doesn't override the default behavior. Our second manifest (second.manifest.fin.json) loads configuration through a rest endpoint (see settings.json) and that defines the endpoints listed above in the endpointProvider definition.
"endpointProvider": {
"modules": [
{
"enabled": true,
"id": "local-storage",
"url": "http://localhost:8080/js/modules/endpoint/local-storage.bundle.js"
}
],
"endpoints": [
{
"id": "page-list",
"type": "module",
"typeId": "local-storage",
"options": {
"method": "GET",
"dataType": "page"
}
},
{
"id": "page-get",
"type": "module",
"typeId": "local-storage",
"options": {
"method": "GET",
"dataType": "page"
}
},
{
"id": "page-set",
"type": "module",
"typeId": "local-storage",
"options": {
"method": "SET",
"dataType": "page"
}
},
{
"id": "page-remove",
"type": "module",
"typeId": "local-storage",
"options": {
"method": "REMOVE",
"dataType": "page"
}
}
]
},
As you can see from the configuration above:
- A custom endpoint module is defined that saves/gets data and uses localstorage as the source.
- Each endpoint definition references that module using type and typeId and passes options specific to the particular endpoint.
If you use the live launch section on the Main Page and launch the second example and save a page you will be able to use dev tools to see that it is saved to localstorage instead of indexedDB. You can then create your own endpoints with custom logic or use our fetch builtin implementation to save and fetch your pages.
The endpoint storage maps the page data to simplify it, you can disable this mapping by setting disableStorageMapping
in platform storage.
"customSettings": {
"platformProvider": {
"disableStorageMapping": true
}
}
We include support for doing page management from home in workspace platform starter. It is enabled by default as an integration provider.
We provide an example of a module that extends the browser main menu with additional menu options for showing saved pages or deleting them:
"menusProvider": {
"modules": [
{
"id": "pages",
"icon": "http://localhost:8080/favicon.ico",
"title": "Pages",
"description": "Provides additional menu options for pages.",
"enabled": true,
"url": "http://localhost:8080/js/modules/composite/pages.bundle.js",
"data": {}
}
]
}
Actions Provider lets you include actions that should respond to the menu entries returned by the menusProvider
"actionsProvider": {
"modules": [
{
"enabled": true,
"id": "page-actions",
"url": "http://localhost:8080/js/modules/composite/pages.bundle.js"
}
]
},
Please see How To Workspace Platform Starter And Browser Page Sharing.