Loading services/webapp/code/rosetta/core_app/migrations/0002_container_protocol.py 0 → 100644 +18 −0 Original line number Diff line number Diff line # Generated by Django 2.2.1 on 2021-01-11 20:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core_app', '0001_initial'), ] operations = [ migrations.AddField( model_name='container', name='protocol', field=models.CharField(blank=True, default='http', max_length=36, null=True, verbose_name='Container protocol'), ), ] services/webapp/code/rosetta/core_app/models.py +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ class Container(models.Model): type = models.CharField('Container type', max_length=36, blank=False, null=False) registry = models.CharField('Container registry', max_length=255, blank=False, null=False) ports = models.CharField('Container ports', max_length=36, blank=True, null=True) protocol = models.CharField('Container protocol', max_length=36, blank=True, null=True, default='http') # Capabilities supports_dynamic_ports = models.BooleanField(default=False) Loading services/webapp/code/rosetta/core_app/templates/add_container.html +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,16 @@ </td> </tr> <tr> <td><b>Protocol</b></td> <td> <select name="container_protocol" id="cars"> <option value="http" selected>http</option> <option value="https">https</option> </select> </td> </tr> <tr> <td colspan=2><b>Default port(s)</b> <input type="text" name="container_ports" value="" placeholder="" size="5" /> Loading services/webapp/code/rosetta/core_app/templates/components/container.html +5 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ <td>{{ container.registry }}</td> </tr> <tr> <td><b>Protocol</b></td> <td>{{ container.protocol }}</td> </tr> <tr> <td colspan=2><b>Default port(s)</b> {{ container.ports }}</td> Loading services/webapp/code/rosetta/core_app/views.py +5 −3 Original line number Diff line number Diff line Loading @@ -363,7 +363,7 @@ def tasks(request): # Then, redirect to the task through the tunnel tunnel_host = get_tunnel_host() return redirect('http://{}:{}'.format(tunnel_host,task.tunnel_port)) return redirect('{}://{}:{}'.format(task.container.protocol, tunnel_host, task.tunnel_port)) except Exception as e: data['error'] = 'Error in getting the task or performing the required action' Loading Loading @@ -700,6 +700,9 @@ def add_container(request): # Container name container_name = request.POST.get('container_name', None) # Container protocol container_protocol = request.POST.get('container_protocol') # Container service ports. TODO: support multiple ports? container_ports = request.POST.get('container_ports', None) Loading @@ -709,8 +712,6 @@ def add_container(request): int(container_service_port) except: raise ErrorMessage('Invalid container port(s) in "{}"'.format(container_ports)) # Capabilities container_supports_dynamic_ports = request.POST.get('container_supports_dynamic_ports', None) if container_supports_dynamic_ports and container_supports_dynamic_ports == 'True': Loading Loading @@ -739,6 +740,7 @@ def add_container(request): name = container_name, type = container_type, registry = container_registry, protocol = container_protocol, ports = container_ports, supports_dynamic_ports = container_supports_dynamic_ports, supports_user_auth = container_supports_user_auth, Loading Loading
services/webapp/code/rosetta/core_app/migrations/0002_container_protocol.py 0 → 100644 +18 −0 Original line number Diff line number Diff line # Generated by Django 2.2.1 on 2021-01-11 20:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core_app', '0001_initial'), ] operations = [ migrations.AddField( model_name='container', name='protocol', field=models.CharField(blank=True, default='http', max_length=36, null=True, verbose_name='Container protocol'), ), ]
services/webapp/code/rosetta/core_app/models.py +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ class Container(models.Model): type = models.CharField('Container type', max_length=36, blank=False, null=False) registry = models.CharField('Container registry', max_length=255, blank=False, null=False) ports = models.CharField('Container ports', max_length=36, blank=True, null=True) protocol = models.CharField('Container protocol', max_length=36, blank=True, null=True, default='http') # Capabilities supports_dynamic_ports = models.BooleanField(default=False) Loading
services/webapp/code/rosetta/core_app/templates/add_container.html +10 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,16 @@ </td> </tr> <tr> <td><b>Protocol</b></td> <td> <select name="container_protocol" id="cars"> <option value="http" selected>http</option> <option value="https">https</option> </select> </td> </tr> <tr> <td colspan=2><b>Default port(s)</b> <input type="text" name="container_ports" value="" placeholder="" size="5" /> Loading
services/webapp/code/rosetta/core_app/templates/components/container.html +5 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ <td>{{ container.registry }}</td> </tr> <tr> <td><b>Protocol</b></td> <td>{{ container.protocol }}</td> </tr> <tr> <td colspan=2><b>Default port(s)</b> {{ container.ports }}</td> Loading
services/webapp/code/rosetta/core_app/views.py +5 −3 Original line number Diff line number Diff line Loading @@ -363,7 +363,7 @@ def tasks(request): # Then, redirect to the task through the tunnel tunnel_host = get_tunnel_host() return redirect('http://{}:{}'.format(tunnel_host,task.tunnel_port)) return redirect('{}://{}:{}'.format(task.container.protocol, tunnel_host, task.tunnel_port)) except Exception as e: data['error'] = 'Error in getting the task or performing the required action' Loading Loading @@ -700,6 +700,9 @@ def add_container(request): # Container name container_name = request.POST.get('container_name', None) # Container protocol container_protocol = request.POST.get('container_protocol') # Container service ports. TODO: support multiple ports? container_ports = request.POST.get('container_ports', None) Loading @@ -709,8 +712,6 @@ def add_container(request): int(container_service_port) except: raise ErrorMessage('Invalid container port(s) in "{}"'.format(container_ports)) # Capabilities container_supports_dynamic_ports = request.POST.get('container_supports_dynamic_ports', None) if container_supports_dynamic_ports and container_supports_dynamic_ports == 'True': Loading Loading @@ -739,6 +740,7 @@ def add_container(request): name = container_name, type = container_type, registry = container_registry, protocol = container_protocol, ports = container_ports, supports_dynamic_ports = container_supports_dynamic_ports, supports_user_auth = container_supports_user_auth, Loading