GoodData.CN: Saving Layouts to Git

  • 19 April 2021
  • 0 replies
  • 31 views

Userlevel 1

With GoodData.CN, users can export a JSON Layout file with metadata on configurations for the LDM, measures, KPIs, Insights, and Dashboards. 

JSON Layout Example: layout.txt

hp63ldNpD1uEEif6LaOLMzWrlOUyq3OM-E1d7PJ0UClyxn2H2k9vmVLkbzWdtjPxLNn2P7Cz9yLS5d2wbz3wMry08c_EiStDx0_FCpzp1CpJ2ejeEKjo6jM5zWJzmDIihCRUbPcF

 

You can update your workspace using the variety of built-in editing tools on GoodData.CN. But to commit such changes to a source control tool like Git, you will need to export the Layout file via API using the following command:

curl http://localhost:3000/api/layout/workspaces/<workspace_id> \

  -H "Content-Type: application/json" \

  -H "Accept: application/json" \

  -H "Authorization: Bearer <token>" \

  -X GET -o layout.json

* Substitute <workspace_id> and <token> with your specific parameters

 

This will create a file “layout.json” in your local directory, which can then be submitted to Git. These layout files can serve as backups for restoring workspace to their previous state. 

 

It is to your discretion on how often this layout.json file should be exported, but we recommend that exporting at least once a day for those with clients with editing permissions on their workspaces. For those with a smaller editor pool, we recommend exporting consistently either before or after making updates, as needed. 

 

For those who prefer creating updates directly through the layout file, users can update the layout file and post it via API call:

curl http://localhost:3000/api/layout/workspaces/<workspace_id> \

  -H "Content-Type: application/json" \

  -H "Accept: application/json" \

  -H "Authorization: Bearer <token>" \

  -X PUT   -d @layout.json

These edited files can then be pushed through source control as needed.


 

Example: Update the Customers Trend Insight

UUarbtM8bxi11hWzpDbNQ_el6XqlYjUnhRn6Uy2upa4thCWc3u3beDN3TQ9RJGbe6i3FJqoI5bo3w0o5Cqc7G48xkxRRTkBVakdu48v5WZITSv-fw345AQ7ULHcj4preI93wOCKq

Changes: Trend by Quarter instead of month, different the color palette selection for both measures, moved the legend from the bottom to the top, and switched the Revenue per Customer insight from a Line to Column (bar) chart.

 

Git Diff on layout.json file:

Zj5tSGHNU0GI64PuufE8yXQpuJGWbNSWL1Jo2HDfW_VUD7YB844cabP4Nj4Fm-OtgYgfoN5vWgtg1v1XJvNTK80uXFdLszUE2Q0z1Lj67qRVUZUFzDTMaq_QYLb8xBIyBhSeSwrR

 

Git is a helpful tool for tracking changes and maintaining your parent workspace layouts, and any other configuration files for their child workspaces (info on hierarchical workspaces). Implementing version control through Git branches will allow you to maintain backups of your configurations. Older versions of your configurations can be quickly reapplied to your GoodData.CN workspaces to revert changes.


0 replies

Be the first to reply!

Reply