Skip to content

Extend service instance Dashboard

Subhankar Chattopadhyay edited this page Apr 22, 2019 · 5 revisions

How to provide custom dashboard

If a service has its own custom dashboard, it can send the url to that dashboard as well. To do so, it can leverage custom dashboard url template for their plans. Under SFPlans or the plan metadata, one needs to add the following metadata.

  manager:
    settings:
      dashboard_url_template: aHR0cHM6Ly8ke2luc3RhbmNlX2lkfS5teWRvbWFpbi5jb20vdWk=

In this, the value of dashboard_url_template is a base64 encoded string of the url template. For example, if the URL is of the form https://${instance_id}.mydomain.com/ui, then you have to base64 encode it and set it as the value. the expression ${instance_id} will be automatically evaluated in the runtime. You can use more variables like plan_id service_id which are part of body or parameters of standard OSBAPI request.

How to extend service instance dashboard

Service Fabrik provides a default dashboard for service instances, the link to the same can be found in service instance description.

cf service blueprint-instance

Service instance: blueprint-instance
Service: blueprint
Bound apps:
Tags:
Plan: v1.0-small
Description: Blueprint service for internal development, testing, and documentation purposes of the Service Fabrik
Documentation url: https://sap.com/
Dashboard: https://service-fabrik-broker.bosh-lite.com/manage/instances/24731fb8-7b84-4f57-914f-c3d55d793dd4/bc158c9a-7934-401e-94ab-057082a5073e/5e41a60a-c9ea-4523-8416-d545fc4dbfc5

Service information section of dashboard looks like following by default

Missing

This section of service instance dashboard can be configured to have extra rows in each panel. Let's add Additional information in each panel. To do that, we will have to write a dashboard template and specify added fields inside template. Let's write a template example.

<%
const plan_manager = plan.manager.name;
const instance_create_time = instance.metadata.created_at;
%>

service:
  Additional: 'This is template example'

plan:
  Manager: <%= plan_manager %>
  URL: 'protocol://example.com'

service_instance:
  Creation Time: <%= instance_create_time %>

Above template will add 'Additional' row in service panel, 'Manager' and 'URL' in plan panel, 'Creation Time' in service_instance panel.

Save this template file as /config/templates/blueprint-dashboard.yml.ejs Apart from this we will also have to add dashboard_template node in service plan in config/settings.yml

plan:
  manager:
    settings:
      dashboard_template: <%= base64_template('blueprint-dashboard') %>

Now, added fields can be seen in updated dashboard

Missing

In custom dashboard, introduced fields can be seen in highlights.