diff --git a/controlpanel/api/models/tool.py b/controlpanel/api/models/tool.py index aea233002..32243f1e1 100644 --- a/controlpanel/api/models/tool.py +++ b/controlpanel/api/models/tool.py @@ -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) diff --git a/controlpanel/frontend/forms.py b/controlpanel/frontend/forms.py index be8a27dd4..07d3de7cf 100644 --- a/controlpanel/frontend/forms.py +++ b/controlpanel/frontend/forms.py @@ -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 @@ -492,6 +493,7 @@ def clean_tool_domain(self): "airflow-sqlite", "jupyter-lab", "rstudio", + "vscode" ] value = self.cleaned_data.get("tool_domain") if value and value not in valid_names: diff --git a/controlpanel/frontend/jinja2/release-create.html b/controlpanel/frontend/jinja2/release-create.html index 33d4cbc72..927da3d7d 100644 --- a/controlpanel/frontend/jinja2/release-create.html +++ b/controlpanel/frontend/jinja2/release-create.html @@ -45,7 +45,7 @@

{{ page_title }}

}, "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": { @@ -95,7 +95,7 @@

{{ page_title }}

}, "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 vscode.' }, "name": "tool_domain", "attributes": { diff --git a/controlpanel/frontend/jinja2/release-detail.html b/controlpanel/frontend/jinja2/release-detail.html index 9cd9a58b0..c2ecfd061 100644 --- a/controlpanel/frontend/jinja2/release-detail.html +++ b/controlpanel/frontend/jinja2/release-detail.html @@ -48,7 +48,7 @@

{{ page_title }}

}, "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": { @@ -98,7 +98,7 @@

{{ page_title }}

}, "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 vscode.' }, "name": "tool_domain", "attributes": { @@ -153,7 +153,7 @@

{{ page_title }}

{{ csrf_input }} diff --git a/requirements.txt b/requirements.txt index 93b5a9a9c..a6e47acd2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,7 +32,7 @@ python-dotenv==1.0.1 python-jose==3.3.0 pyyaml==6.0.1 rules==3.3 -sentry-sdk==1.40.4 +sentry-sdk==1.40.5 slackclient==2.9.4 urllib3==2.0.7 uvicorn[standard]==0.27.1 diff --git a/tests/frontend/test_forms.py b/tests/frontend/test_forms.py index 94fdb928e..cd8310237 100644 --- a/tests/frontend/test_forms.py +++ b/tests/frontend/test_forms.py @@ -54,6 +54,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", @@ -90,6 +99,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": "vscode", + } + f = forms.ToolReleaseForm(data) + assert f.is_valid() data = { "name": "Test Release", "chart_name": "jupyter-lab-all-spark",