Commit 933f4800 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas Committed by Jose Vargas

Update documentation and specs

This updates the documentation to reflect the instance
template repository functionality for the metrics
dashboard custom templates
parent 7953e9df
---
title: Add custom metrics dashboard templates supports
merge_request: 37523
author:
type: added
...@@ -10,33 +10,23 @@ GitLab provides a template to make it easier for you to create templates for ...@@ -10,33 +10,23 @@ GitLab provides a template to make it easier for you to create templates for
[custom dashboards](index.md). Templates provide helpful guidance and [custom dashboards](index.md). Templates provide helpful guidance and
commented-out examples you can use. commented-out examples you can use.
## Create a new dashboard template ## Applying dashboard template
To create a new dashboard template to speed the development of more dashboards: Navigate to the browser-based editor of your choice:
1. Navigate to the browser-based editor of your choice: ### *Repository view*
1. Navigate to **{doc-text}** **Repository > Files**.
- *To use the repository view,* navigate to **{doc-text}** **Repository > Files**. 1. Click **{plus}** **Add to tree** and select **New file**,
- *To use the [Web IDE](../../../user/project/web_ide/index.md),* click
**Web IDE** when viewing your repository.
1. Create a template file that meets your needs, using the [custom dashboard syntax](yaml.md).
1. Save the template file in the `lib/gitlab/metrics/templates` directory,
with a name matching the pattern `*.metrics-dashboard.yml`.
1. Reload the editor you used to create the new template and ensure the template
is now available for use:
- *In the repository view,* click **{plus}** **Add to tree** and select **New file**,
then click **Select a template type** to see a list of available templates: then click **Select a template type** to see a list of available templates:
![Metrics dashboard template selection](img/metrics_dashboard_template_selection_v13_3.png) ![Metrics dashboard template selection](img/metrics_dashboard_template_selection_v13_3.png)
- *In the Web IDE,* click **Web IDE** when viewing your repository, click
**{doc-new}** **New file**, then click **Choose a template** to see a list of ### *[Web IDE](../../../user/project/web_ide/index.md)*
available templates: 1. Click **Web IDE** when viewing your repository.
1. Click **{doc-new}** **New file**, then click **Choose a template** to see a list of available templates:
![Metrics dashboard template selection WebIDE](img/metrics_dashboard_template_selection_web_ide_v13_3.png) ![Metrics dashboard template selection WebIDE](img/metrics_dashboard_template_selection_web_ide_v13_3.png)
## Template location and naming ## Custom dashboard template **(PREMIUM ONLY)**
For templates to be valid and available for use, they must: To enable and use a custom dashboard templates on your GitLab instance please follow
[general guide](../../../user/admin_area/settings/instance_template_repository.md) on custom file templates
1. Reside in the `lib/gitlab/metrics/templates` directory.
1. Be named with the `*.metrics-dashboard.yml` suffix.
1. Follow the [custom dashboard syntax](yaml.md).
...@@ -39,6 +39,7 @@ are supported: ...@@ -39,6 +39,7 @@ are supported:
| `.gitignore` | `gitignore` | `.gitignore` | | `.gitignore` | `gitignore` | `.gitignore` |
| `.gitlab-ci.yml` | `gitlab-ci` | `.yml` | | `.gitlab-ci.yml` | `gitlab-ci` | `.yml` |
| `LICENSE` | `LICENSE` | `.txt` | | `LICENSE` | `LICENSE` | `.txt` |
| `metrics-dashboard.yml` | `metrics-dashboards` | `.yml` |
Each template must go in its respective subdirectory, have the correct Each template must go in its respective subdirectory, have the correct
extension and not be empty. So, the hierarchy should look like this: extension and not be empty. So, the hierarchy should look like this:
...@@ -57,6 +58,9 @@ extension and not be empty. So, the hierarchy should look like this: ...@@ -57,6 +58,9 @@ extension and not be empty. So, the hierarchy should look like this:
|-- LICENSE |-- LICENSE
|-- custom_license.txt |-- custom_license.txt
|-- another_license.txt |-- another_license.txt
|-- LICENSE
|-- custom_metrics-dashboard.yml
|-- another_metrics-dashboard.yml
``` ```
Once this is established, the list of custom templates will be included when Once this is established, the list of custom templates will be included when
......
...@@ -36,7 +36,8 @@ RSpec.describe "Custom file template classes" do ...@@ -36,7 +36,8 @@ RSpec.describe "Custom file template classes" do
::Gitlab::Template::CustomDockerfileTemplate, ::Gitlab::Template::CustomDockerfileTemplate,
::Gitlab::Template::CustomGitignoreTemplate, ::Gitlab::Template::CustomGitignoreTemplate,
::Gitlab::Template::CustomGitlabCiYmlTemplate, ::Gitlab::Template::CustomGitlabCiYmlTemplate,
::Gitlab::Template::CustomLicenseTemplate ::Gitlab::Template::CustomLicenseTemplate,
::Gitlab::Template::CustomMetricsDashboardYmlTemplate
].each do |template_class| ].each do |template_class|
describe template_class do describe template_class do
let(:name) { template_class.name.demodulize } let(:name) { template_class.name.demodulize }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment