Wiki source code of Community App Developer Guide

Version 29.1 by mmorgan on 2020/06/19 16:22

Hide last authors
allan 4.3 1 Developers can extend the Collaboratory capabilities by providing applications to its community of users.
allan 1.1 2
allan 4.3 3 This guide describes the steps to make this possible.
allan 1.1 4
5 == Becoming a contributor ==
6
allan 9.1 7 The first step is for you to **get the developer accreditation**. Contributors can register and manage applications within the Community Apps Catalogue.
allan 1.1 8
allan 26.1 9 Send an email to [[support@ebrains.eu>>mailto:support@ebrains.eu]] with a short summary of your intentions.
allan 1.1 10
fabricegaillard 20.1 11 The support team will apply the permissions to your user: your account will be [[upgraded with developers privileges>>doc:Collabs.collab-devs.collaboratory-v2.keycloak.user administration.WebHome]] the next time you will login.
allan 1.1 12
13 (% class="box infomessage" %)
14 (((
allan 9.1 15 Only SGA2 accredited users will be automatically granted the developer accreditation.
allan 1.1 16 )))
17
allan 10.1 18 == Making your app available to users ==
allan 1.1 19
allan 21.1 20 In order for you application to be installable by users, it needs to be registered within the [[Community Apps Catalogue>>doc:Apps.WebHome]].
allan 2.1 21
allan 10.1 22 Once this simple step is complete, users will be able to install your app within their collabs.
23
mmorgan 29.1 24 If you are dealing with private data, or your users need to be authenticated, see [[authentication and authorisation in the Collaboratory.>>doc:Collabs.the-collaboratory.Technical documentation.Architecture.Permissions.Authentication & Authorisation using OIDC.WebHome]]
villemai 28.1 25
allan 10.1 26 === Registering an application in the Catalogue ===
27
allan 21.1 28 Navigate to the catalogue and click on **+Create App** in the top right corner. Enter a name for your app and click on **Create**.
allan 2.1 29
allan 21.1 30 Fill the form with the following information:
allan 9.1 31
allan 21.1 32 * **main URL**: the URL of the homepage of your app. This is where user will be directed when then open your app in a collab.
33 * **settings URL**: the URL of the your settings management page if you have one.
34 * **description**: a description of what your app does to help users select it.
35 * **under development?**: should be checked if you don't want your app to be available by default by other users.
36 * **category**: a category to help structuring the applications.
37 * **maintainers**: a list of users who maintain the app. The users need to have logged in the wiki at least once to be found. Maintainers are granted the right to modify an app registration.
38 * **documentation URL**: if your app has online user documentation, a link will be provided to users when they use your app.
39 * **repository**: a URL to a public repository so users can check the sources of your app.
allan 9.1 40
allan 21.1 41 Click on **Save**. Your app is now registered and waiting for users to install it!
allan 9.1 42
allan 21.1 43 === Installing your app in a collab ===
allan 10.1 44
allan 21.1 45 1. In order to install your app, you need to navigate to a collab where you have either the **editor** or **administrator** role.
46 1. Click on **Create**. Enter a title for this instance of your app and select **Community App** in the right selector.
47 1. Click on **Create**. You will be presented with the Community App Catalogue. The app you will see are the public apps and the ones your a maintainer of.
48 1. Select your app and click on **Save and View**.
allan 10.1 49
allan 21.1 50 You should now see how your app looks like within a collab.
allan 10.1 51
allan 11.1 52 == Getting your app instance context ==
53
54 Instances of your applications will be installed by collab authors in many different collabs. In order to let you customise the user experience based on its context, the Collaboratory will automatically pass query parameters to your app:
55
allan 22.1 56 * **##clb-collab-id##**: the unique, human-readable identifier of the collab.
57 * ##**clb-doc-path**##: the path of your app instance within the collab. If your app is at the root of a collab, this value will be empty.
58 * ##**clb-doc-name**##: the name of the document where your app instance is installed.
59 * ##**clb-drive-id**##: the unique identifier of the drive of the collab. This id is required if you want to fetch or store documents within the drive of the collab.
allan 11.1 60
allan 22.1 61 == App settings ==
allan 14.1 62
allan 22.1 63 The app settings are the values the collab author can modify to change the behaviour of your application within her collab.
allan 14.1 64
65 === Writing settings ===
66
allan 22.1 67 The Collaboratory comes with a mechanism to let your app store these settings directly in the Collaboratory.
allan 14.1 68
allan 22.1 69 In order to do that, your app needs to use the [[postMessage javascript API>>https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage]] to send the settings to store to the Collaboratory:
allan 14.1 70
71 {{code language="javascript"}}
72 window.parent.postMessage({
73 topic: '/clb/community-app/settings',
74 data: {
75 setting1: 'setting 1 value',
76 setting2: 'setting 2 value',
bougault 17.1 77 // ...
bougault 18.1 78 // reload: false // avoid page reload on settings change
allan 26.1 79 }}, 'https://wiki.ebrains.eu');
allan 14.1 80 {{/code}}
81
82 === Fetching settings ===
83
84 The Collaboratory will get the settings from its key/value store and pass them to your app through query parameters.
85
allan 2.1 86 == Creating your OpenID Connect client ==
87
villemai 27.1 88 See the instructions [[here>>doc:.Registering an OIDC client.WebHome]].