DE 

//Cloudogu EcoSystem Docs

Pinned Dashboard

A "Pinned Dashboard" can be created in the configuration of the Cockpit Dogu (see configuration documentation). This dashboard can only be changed via the dogu config and cannot be edited via the web interface.

For larger adjustments to this dashboard, however, editing the dashboard JSON directly is quite complex. To simplify this, the "Pinned Dashboard" can be copied and then edited via the web interface. To do this, the following steps must be carried out.

Copy pinned dashboard

To create a copy of the "Pinned Dashboard", the JSON data of the dashboard must first be retrieved. This can be done, for example, in the Chrome browser with the included developer tools:

  1. Open the "Pinned Dashboard" of the cockpit in the browser
  2. Open the developer tools (F12)
  3. Switch to the network tab
  4. Set the filter to Fetch/XHR
  5. Select the request for the URL .../cockpit/api/v1/userDashboardRelations/0
  6. Select the preview tab and navigate to dashborad.content in the JSON structure
  7. Right-click on content and select Copy string contents
  8. Store the JSON data from the clipboard for further editing

Next, the copy of the dashboard must be stored in the database. This requires the username of the cockpit dogu in the PostgreSQL database.

# Get the PostgreSQL user name
kubectl get secret -n ecosystem cockpit-config -o jsonpath='{.data.config\.yaml}' | base64 -d

You must then switch to the PostgreSQL container in order to interact with the database.

# Switch to the PostgreSQL container
kubectl exec -it -n ecosystem "$(kubectl get pod -n ecosystem -l 'dogu.name=postgresql' -o jsonpath='{.items[0].metadata.name}')" -- bash

# Start PSQL (use the db user name from above)
# For example
# psql -U cockpit_vhgppz -d cockpit_vhgppz
psql -U <db-username> -d <db-username>

Now create a new dashboard in the database with the JSON data copied earlier.

INSERT INTO dashboards (content) VALUES ('<JSON-DATA>');

-- For example
-- INSERT INTO dashboards (content) VALUES ('{"title":"Welcome","structure":"4-8","rows":[...]}');

The last step is to add the newly created dashboard to the userDashboardRelations table. This requires the USER-ID of the selected user and the DASHBOARD-ID of the dashboard just created.

-- Query USER-ID
select * from users;

-- Query DASHBOARD-ID (usually the last entry in the database)
select _id from dashboards;

The entry in the userDashboardRelations table is created as follows:

INSERT INTO "userDashboardRelations" ("type", "order", "userId", "dashboardId") VALUES ('creator', 1, <USER-ID>, <DASHBOARD-ID>)

-- For example
-- INSERT INTO "userDashboardRelations" ("type", "order", "userId", "dashboardId") VALUES ('creator', 1, 1, 3);

When the cockpit is reloaded in the web interface, the copied dashboard should now be displayed and can be edited as required.