Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vscode tool add #1256

Merged
merged 5 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion controlpanel/api/models/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Tool(TimeStampedModel):
# Defines how a matching chart name is put into a named tool bucket.
# E.g. jupyter-* charts all end up in the jupyter-lab bucket.
# chart name match: tool bucket
TOOL_BOX_CHART_LOOKUP = {"jupyter": "jupyter-lab", "rstudio": "rstudio"}
TOOL_BOX_CHART_LOOKUP = {"jupyter": "jupyter-lab",
"rstudio": "rstudio",
"visual-studio-code": "visual-studio-code"}

description = models.TextField(blank=True)
chart_name = models.CharField(max_length=100, blank=False)
Expand Down
2 changes: 2 additions & 0 deletions controlpanel/frontend/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def clean_chart_name(self):
"airflow-sqlite",
"jupyter-",
"rstudio",
"visual-studio-code"
]
value = self.cleaned_data["chart_name"]
is_valid = False
Expand All @@ -492,6 +493,7 @@ def clean_tool_domain(self):
"airflow-sqlite",
"jupyter-lab",
"rstudio",
"visual-studio-code"
]
value = self.cleaned_data.get("tool_domain")
if value and value not in valid_names:
Expand Down
4 changes: 2 additions & 2 deletions controlpanel/frontend/jinja2/release-create.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h1 class="govuk-heading-xl">{{ page_title }}</h1>
},
"classes": "govuk-!-width-two-thirds",
"hint": {
"text": 'Helm chart name. Use only variations of: airflow-sqlite, jupyter-* or rstudio'
"text": 'Helm chart name. Use only variations of: airflow-sqlite, jupyter-*, rstudio or visual-studio-code'
},
"name": "chart_name",
"attributes": {
Expand Down Expand Up @@ -95,7 +95,7 @@ <h1 class="govuk-heading-xl">{{ page_title }}</h1>
},
"classes": "govuk-!-width-two-thirds",
"hint": {
"text": 'If the chart name is non-standard, use this value in the domain name for the tool. Use only one of: airflow-sqlite, jupyter-lab or rstudio.'
"text": 'If the chart name is non-standard, use this value in the domain name for the tool. Use only one of: airflow-sqlite, jupyter-lab, rstudio or visual-studio-code.'
},
"name": "tool_domain",
"attributes": {
Expand Down
6 changes: 3 additions & 3 deletions controlpanel/frontend/jinja2/release-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h1 class="govuk-heading-xl">{{ page_title }}</h1>
},
"classes": "govuk-!-width-two-thirds",
"hint": {
"text": 'Helm chart name. Use only variations of: airflow-sqlite, jupyter-* or rstudio'
"text": 'Helm chart name. Use only variations of: airflow-sqlite, jupyter-*, rstudio or visual-studio-code'
},
"name": "chart_name",
"attributes": {
Expand Down Expand Up @@ -98,7 +98,7 @@ <h1 class="govuk-heading-xl">{{ page_title }}</h1>
},
"classes": "govuk-!-width-two-thirds",
"hint": {
"text": 'If the chart name is non-standard, use this value in the domain name for the tool. Use only one of: airflow-sqlite, jupyter-lab or rstudio.'
"text": 'If the chart name is non-standard, use this value in the domain name for the tool. Use only one of: airflow-sqlite, jupyter-lab, rstudio or visual-studio-code.'
},
"name": "tool_domain",
"attributes": {
Expand Down Expand Up @@ -153,7 +153,7 @@ <h1 class="govuk-heading-xl">{{ page_title }}</h1>
{{ csrf_input }}
<button class="govuk-button cpanel-button--destructive js-confirm"
data-confirm-message="Are you sure you want to delete this release?">
Delete release
Delete release
</button>
</form>
</section>
Expand Down
19 changes: 19 additions & 0 deletions tests/frontend/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def test_tool_release_form_check_release_name():
}
f = forms.ToolReleaseForm(data)
assert f.is_valid()
data = {
"name": "Test Release",
"chart_name": "visual-studio-code",
"version": "1.2.3",
"values": {"foo": "bar"},
"is_restricted": False,
}
f = forms.ToolReleaseForm(data)
assert f.is_valid()
data = {
"name": "Test Release",
"chart_name": "invalid-chartname",
Expand Down Expand Up @@ -91,6 +100,16 @@ def test_tool_release_form_check_tool_domain():
}
f = forms.ToolReleaseForm(data)
assert f.is_valid()
data = {
"name": "Test Release",
"chart_name": "visual-studio-code",
"version": "1.2.3",
"values": {"foo": "bar"},
"is_restricted": False,
"tool_domain": "visual-studio-code",
}
f = forms.ToolReleaseForm(data)
assert f.is_valid()
data = {
"name": "Test Release",
"chart_name": "jupyter-lab-all-spark",
Expand Down
Loading