Git - how to copy site objects between spaces
To copy site objects such as charts, dashboards, views, and SQL snippets between spaces using Git integration, the following conditions should be met and steps followed.
Pre-requisites:
- Git integration is enabled on a site.
- Separate repositories are connected to each space.
- Git integration is running without errors.
Copying a chart
- Open a repository where the needed chart is stored. Make sure you search under the “periscope/master” branch.
- Navigate to the “dashboards” directory and find the folder of a dashboard where your chart is located.
- Copy the entire chart folder.
- Open the target repository, go to the “dashboards” directory, and locate the folder dedicated to the dashboard you want the chart copied to. Paste the chart’s folder into it.
- Rename the folder to remove the UUID token (32-character alphanumeric value) from its name.
- Commit and push the change to the “periscope/master” branch.
At this point, if there were no validation errors, the system would create the chart on the target dashboard. In the process, the pasted folder is removed and replaced by the system with a folder named after the chart and a newly assigned UUID token.
NOTE: If a user doesn’t remove the UUID of the original chart from the copied folder under step 5 of the above-provided guide, the system will preserve it as is.
While it is possible to have two charts with the same token across two different spaces, such a scenario may lead to data corruption and further issues if the charts clash in the future.
Copying a view or a snippet
The steps to copy a view or a snippet are similar to copying a chart. The only difference is that you need to locate a desired entity in the “views” or “snippets” folder, respectively, and carry it over to the same folder in the target repository while remembering to rename the pasted folder.
Copying a dashboard
The process of copying a dashboard is a bit trickier since it involves renaming not only the dashboard’s folder, but all charts associated with it as well.
NOTE: Sisense for CDT Git integration does not support version control for filters. Therefore, all underlying filters for a dashboard should be manually re-created on the site using the same names as the originals.
- Open a repository. Make sure you work under the “periscope/master” branch.
- Navigate to the “dashboards “directory, identify the folder of your dashboard.
- Copy the entire folder.
- Open the target repository and paste the dashboard folder into the “dashboards” directory.
- Rename the folder by removing the UUID token from its name.
- Open the pasted folder and proceed to rename each individual chart.
- Commit and push the change to the periscope/master branch.
Common issues
If the pasted folder was not recreated with a new UUID token, there is most likely a validation issue, and the object was not processed properly by the platform.
Review Git logs or the Version Control section of the Settings on the target space to find the cause of the error.
Common issues are:
- A dashboard cannot be created because a related filter does not exist on the target space.
- Error: “dashboards/dashboard_name.a123bc4de5678f9a012bcde3456f78/dashboard_name.yaml references default filter filter_name which does not exist in this space.”
- Solution: Re-create the filter from the source space on the target space.
A chart is not created due to missing required fields.
- Error: “dashboards/dashboard_name.a123bc4de5678f9a012bcde3456f78/chart_name/chart_name.yaml is missing required fields 'height', 'width', 'top', and 'left'.
- Solution: Make sure that all required fields exist.