Template Management
Walrus provides the following two levels of templates:
- Project Template: Applied to a specific project, project templates can be used within the current project.
- Global Template: A template that can be applied to all projects, global templates can be used across all projects.
View Template List
- The template list includes all templates from catalogs as well as independently added templates.
- Navigate to the template list page.
- Project Template: Click on the
Applications
menu in the left navigation bar and go to a project's view, then click theTemplates
tab. - Global Template: Click on the
Operations
menu in the navigation bar and go to theTemplates
tab.
- Project Template: Click on the
Add Template
Navigate to the template list page.
- Project Template: Click on the
Applications
menu in the left navigation bar and go to a project's view, then click theTemplates
tab. - Global Template: Click on the
Operations
menu in the navigation bar and click to theTemplates
tab.
- Project Template: Click on the
Click the
New Template
button.Enter the template's name, description, and source. The template source is an address compatible with Terraform git module source, for details please refer to the documentation. Here are some examples:
- https://github.com/walrus-catalog/webservice?ref=v0.0.1
- https://github.com/walrus-catalog/webservice?ref=main
- https://github.com/seal-io/walrus-template-template//modules/submodule?ref=main
Hints: You can specify a version using the
ref
parameter, and the specified version must be a tag or branch that exists in the git repository. You can import templates from subdirectories by appending a subdirectory path after the repository URL.Click the
Confirm
button.
Edit Template
- Enter the
Templates
tab.- Project Template: Click on
Applications
in the navigation bar and go to a project's view, then click on theTemplates
tab. - Global Template: Click on
Operations
in the navigation bar and enter theTemplates
tab.
- Project Template: Click on
- Find the template you need to edit.
- Click the more operations button indicated by the thumbnail and select
edit
. - Modify the corresponding attribute values as per your need.
- Click the
Save
button.
Note: You can only edit a template that is not imported from a catalog.
Deleting Template
- Enter the
Templates
tab.- Project Template: Click on
Applications
in the navigation bar and go to a project's view, then click theTemplates
tab. - Global Template: Click on
Operations
in the navigation bar and enter theTemplates
tab.
- Project Template: Click on
- Select the template you need to delete.
- Click the "Delete" button.
- In the delete confirmation prompt, click the
Delete
button.
Edit Template UI Schema
- Navigate to the template list page.
- Project Template: Click on the
Applications
menu in the left navigation bar and go to a project's view, then click theTemplates
tab. - Global Template: Click on the
Operations
menu in the navigation bar and go to theTemplates
tab.
- Project Template: Click on the
- Find the template for which you want to edit the UI schema.
- Click on the template name to enter the details page. In the details page, select
UI Schema
. - Click the
Edit
button, and modify the corresponding UI schema as needed. ClickPreview
to see the effects. - Click the
Save
button.
AI-assisted Template Creation
Walrus can use OpenAI's GPT large language model capabilities to assist you in writing and submitting templates.
Note: Before using this feature, you first need to:
- Obtain OpenAI's API token and configure it in Walrus's system settings.
- Create a version control connector.
Generating Templates Based on Natural Language Descriptions
- Click on
Operations
in the navigation bar and enter theTemplates
tab. - Click the `AI Write Template`` button.
- In the text box, use natural language to describe the functionality of the template you need. You can select an example from the instance list in the top right corner.
- Click the
Generate
button.
Explaining the Functionality of Template Code
- Click on
Operations
in the navigation bar and enter theTemplates
tab. - Click the
AI Write Template
button. - After generating/writing the template code in the text box via AI, click the "Explain" button.
- Click the
OK
button to close the template explanation popup.
Correcting Template Code
- Click on
Operations
in the navigation bar and enter theTemplates
tab. - Click the
AI Write Template
button. - After generating/writing the template code in the text box via AI, click the
Correct
button. - Review the repair instructions and consider the suggested repairs.
- Click
Accept Repair
in the top left corner to apply the repair suggestion, or "Abort Repair" to discard the repair suggestion.
Submitting Written Template Code to Git Repository
- Click on
Operations
in the navigation bar and enter theTemplates
tab. - After generating/writing the template code in the text box via AI, click the
Create PR
button. - Select an available version control connector.
- Select a code repository.
- Select the target branch.
- Enter the submission path, that is, the folder path in the code repository where this template is stored.
- Click the
Save
button.