Creating a community app
Community apps in collabs
Community apps are services developed by the EBRAINS community of users.The services run are deployed by their respective developers on a server online. Community apps differ from other services in that they can be added to the navigation of any collab with easier integration. For this, the app needs to be registered in a space called the "Community Apps Catalogue". Once the app is registered, instantiating such an app in the Wiki navigation of a collab is as simple as creating a new Wiki page in the collab.
Becoming a contributor
The first step for an EBRAINS user to creating a community app is to get the service developer accreditation. Contributors can register and manage apps within the Community Apps Catalogue.
Users can request service developer accreditation by performing both of the following 2 steps:
- opening an EBRAINS support ticket at https://ebrains.eu/support with a short motivation for the request, and
- navigating to the app-collaboratory-iam--service-providers Group and clicking the big green "request to join" button.
The support team will apply the permissions to your user.
Making your app available to users
In order for users to install your app, it needs to be registered in the Community Apps Catalogue.
If the users of your app need to be authenticated, see managing authorisation in the Collaboratory or OIDC clients explained and its sub-pages for a more detailed overview of authenticating EBRAINS users and creating an OIDC client.
Register your app in the Community Apps Catalogue
To register an app in the catalogue, navigate to the catalogue https://wiki.ebrains.eu/bin/view/Apps/ and click the "Create App" button. If the button does not appear, you are either not logged in or you do not yet have the service developer accreditation (see above).
Then, create a new space in the Community Apps Catalogue for your app using the "Community App" type.
Fill the form with the following information:
- main URL: the URL of the homepage of your app. This is where the users will be directed when they open your app in a collab.
- settings URL: the URL of your app's settings management page, if there is one.
- description: a description of what your app does. This helps users choose the apps they install.
- under development?: if checked, your app will not be available to other users.
- category: a category to help structure the list of apps.
- maintainers: a list of EBRAINS users who maintain the app. The users need to have logged in to the Wiki service at least once to appear in the list. Maintainers are granted the right to modify the app's registration.
- documentation URL: if your app has online user documentation, a link to this URL will be provided to users when they use your app.
- repository: a URL to a public repository so users can access the source code of your app.
Note that only users registered in the "maintainers" field will be able to edit this form. Do not forget to add yourself as a maintainer. When done, click on the "Save & View" button; it displays a summary of information you have just filled. Your app is now available to be used in the Wiki.
Add a logo (optional)
Some of users like to add a logo to their app. The logo is only visible when browsing the catalogue. To do so, the user has to add a PNG file attachment with the filename "logo.png" in the attachment tab at the bottom of the summary page displayed after the "Save & View" action above.
Add an app to your collab
Adding an app to a collab is as simple as creating a new wiki page. As an admin or editor of a collab, a user can add a community app by clicking the "+ Create" button at the top of any wiki page, and selecting the "Community App" type.
Then click the Create button and the app will be added in the collab's navigation menu.
Getting instance context information in your app
Instances of your apps will be installed by collab owners in their respective collabs. In order to let the app developer customise the user experience based on context, the Collaboratory will automatically pass the following query string parameters to your app:
- clb-collab-id: the id of the collab, also know as the collab's name or slug, e.g. my-collab-name.
- clb-doc-path: the (relative) path to your app instance within the collab. If your app is at the root of a collab, this value will be empty. E.g. for this page the path is "Documentation Wiki/FAQ"
- clb-doc-name: the name of the document where your app instance is installed. E.g. the name for this wiki page is "Creating a community app".
- clb-drive-id: the unique identifier of the Drive of the collab. This uuid is made up of hex digits and dashes. This id is used to fetch or store documents within the Drive of the collab.
Additional query string parameters can also be passed from the community app manager with constant fields.
Storing app settings in the Collaboratory
The app settings are the values the collab owners can modify to change the behaviour of your app within their collabs. The Collaboratory comes with a mechanism to let your app store its settings directly in the Collaboratory.
Writing settings
In order for your app to store settings in the Collaboratory, your app needs to use the postMessage javascript API to send the settings to be stored to the Collaboratory. The settings are key/value pairs as in the example below. To update any setting, you need to rewrite all the settings fields.
topic: '/clb/community-app/settings',
data: {
setting1: 'setting 1 value',
setting2: 'setting 2 value',
// ...
},
// reload: false // avoid page reload on settings change
}, 'https://wiki.ebrains.eu');
Reading settings
The Collaboratory will get the settings from its key/value store and pass them to your app through query string parameters.
Your app with hash-based URL
The app you are developing might be a single page app that needs to handle some routing between views. This is typically done with a hash-based URL using the fragment at the end of the URL to track the view in the page.
URI = scheme:[//authority]path[?queryStringParams][#fragment]
The Community Apps environment gives you the ability to update the parent frame fragment.
It uses the postMessage() javascript API to communicate from your app's iframe to the wiki (parent) frame.
topic: '/clb/community-app/hashchange',
data: 'the_fragment_value'
}, 'https://wiki.ebrains.eu');
If a fragment is present in the parent frame URL at parent page load time, this fragment is transmitted to your app's iframe.