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
[custom dashboards](index.md). Templates provide helpful guidance and
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**.
1. Click **{plus}** **Add to tree** and select **New file**,
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)
### *[Web IDE](../../../user/project/web_ide/index.md)*
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)
- *To use the repository view,* navigate to **{doc-text}** **Repository > Files**.
- *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:
## Custom dashboard template **(PREMIUM ONLY)**
- *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:
![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
available templates:
![Metrics dashboard template selection WebIDE](img/metrics_dashboard_template_selection_web_ide_v13_3.png)
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
## Template location and naming
For templates to be valid and available for use, they must:
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).
......@@ -33,12 +33,13 @@ Templates must be added to a specific subdirectory in the repository,
corresponding to the kind of template. The following types of custom templates
are supported:
| Type | Directory | Extension |
| :---------------: | :-----------: | :-----------: |
| `Dockerfile` | `Dockerfile` | `.dockerfile` |
| `.gitignore` | `gitignore` | `.gitignore` |
| `.gitlab-ci.yml` | `gitlab-ci` | `.yml` |
| `LICENSE` | `LICENSE` | `.txt` |
| Type | Directory | Extension |
| :---------------: | :-----------: | :-----------: |
| `Dockerfile` | `Dockerfile` | `.dockerfile` |
| `.gitignore` | `gitignore` | `.gitignore` |
| `.gitlab-ci.yml` | `gitlab-ci` | `.yml` |
| `LICENSE` | `LICENSE` | `.txt` |
| `metrics-dashboard.yml` | `metrics-dashboards` | `.yml` |
Each template must go in its respective subdirectory, have the correct
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
|-- custom_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
......
......@@ -36,7 +36,8 @@ RSpec.describe "Custom file template classes" do
::Gitlab::Template::CustomDockerfileTemplate,
::Gitlab::Template::CustomGitignoreTemplate,
::Gitlab::Template::CustomGitlabCiYmlTemplate,
::Gitlab::Template::CustomLicenseTemplate
::Gitlab::Template::CustomLicenseTemplate,
::Gitlab::Template::CustomMetricsDashboardYmlTemplate
].each do |template_class|
describe template_class do
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