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 major adjustments to this dashboard, however, it is very complex to edit the JSON data of the dashboard. 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 obtained. 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. click on content with the right mouse button and select Copy string contents
  8. cache the JSON data from the clipboard for further processing

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 Postgres user name
docker exec -it cockpit doguctl config -e sa-postgresql/username

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

# Switch to the PostgreSQL container
docker exec -it postgresql bash

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

Now a new dashboard must be created with the previously copied JSON data in the database

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

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

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

-- Query USER-ID
select * from users;

-- Query DASHBOARD-ID (Normally this is 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.