Commit 8a5b8e6f authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added support for software container families and architectures.

parent f04869f0
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -175,6 +175,37 @@ to provide help, news and informations on your deployment. Or you can just ignor
                                     supports_interface_auth = True,
                                     interface_auth_user = None)

            # Official Jupyter Lab
            Container.objects.create(user     = None,
                                     name     = 'Jupyter Lab',
                                     description = 'The official Jupyter Lab. The Scipy variant, which includes popular packages from the scientific Python ecosystem.',
                                     registry = 'docker.io',
                                     image    = 'jupyter/scipy-notebook',
                                     tag      = 'lab-3.2.2',
                                     arch = 'amd64,arm64',
                                     os = 'linux',
                                     interface_port     = '8888',
                                     interface_protocol = 'http',
                                     interface_transport = 'tcp/ip',
                                     supports_custom_interface_port = True,
                                     supports_interface_auth = True)

            Container.objects.create(user     = None,
                                     name     = 'Jupyter Lab',
                                     description = 'The official Jupyter Lab. Includes popular packages from the scientific Python ecosystem.',
                                     registry = 'docker.io',
                                     image    = 'jupyter/scipy-notebook',
                                     tag      = 'lab-3.1.17',
                                     arch = 'amd64,arm64',
                                     os = 'linux',
                                     interface_port     = '8888',
                                     interface_protocol = 'http',
                                     interface_transport = 'tcp/ip',
                                     supports_custom_interface_port = True,
                                     supports_interface_auth = True)



            # SSH server
            Container.objects.create(user     = None,
                                     name     = 'SSH server',
+1 −2
Original line number Diff line number Diff line
@@ -144,10 +144,9 @@ class Container(models.Model):
        user_str = self.user.email if self.user else None
        return str('Container "{}" of user "{}" with image "{}" and tag "{}" on registry "{}" '.format(self.name, user_str, self.image, self.tag, self.registry))


    @ property
    def color(self):
        string_int_hash = hash_string_to_int(self.image + self.tag + self.registry)
        string_int_hash = hash_string_to_int(self.name + self.registry + self.image)
        color_map_index = string_int_hash % len(color_map)
        return color_map[color_map_index]

+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@
        {% csrf_token %}
        <input type="hidden" name="step" value="{{ data.next_step }}" />
        <input type="hidden" name="task_container_uuid" value="{{container.uuid}}">
        <input type="hidden" name="task_container_arch" value="{{container_arch}}">
        <input type="hidden" name="task_computing_uuid" value="{{computing.uuid}}">
        <input type="submit" value="Choose" class="btn btn-connect">
        </form>
+3 −3
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@

        
        <div style="padding:10px; margin-top:5px; text-align:center; border-bottom: {{container.color}} solid 10px; ">
        <a href="/software/?uuid={{ container.uuid }}">{{ container.name }}</a>&nbsp; 
        <a href="/software/container_?uuid={{ container.uuid }}">{{ container.name }}</a>&nbsp; 
        </div>
        
        <div style="padding:10px; height: 110px; vertical-align: middle; ">
@@ -125,7 +125,7 @@
        <div class="image-version-box">
        <!-- <font style="font-family:monospace; font-size:1.2em"></font> -->
        <b>Image:</b> <code>{{ container.image }}</code><br/>
        <b>Tag:</b> &nbsp;{{ container.tag }}
        <b>Tag:</b> &nbsp;{{ container.tag }} &nbsp;<b>Arch:</b> {{container_arch}}
        </div> 
       
        </div>
+78 −0
Original line number Diff line number Diff line

      {% if data.details %}
      {% for container in container_family.members %}
      {% include "components/container.html" with container=container details=data.details %}
      {% endfor %}
      
      {% else %}    

      <div style="width:300px; float:left; border: #e0e0e0 solid 1px; margin:10px; background:#f8f8f8; margin-bottom:15px">
        <form action="/new_task" method=GET>
        <input type="hidden" name="step" value="two">
        
        
        <div style="padding:10px; margin-top:5px; text-align:center; border-bottom: {{container_family.color}} solid 10px; ">
        <a href="/software/?container_family_id={{ container_family_id }}&details=True">{{ container_family.name }}</a>&nbsp; 
        </div>
        
        <div style="padding:10px; height: 125px; ">
        <!-- <div style="position: relative; top: 50%; transform: translateY(-50%);"> -->
        
        {% if container_family.description %} 
        <div class="description-box" title="{{ container_family.description }}">
        {{ container_family.description }}
        </div>
        {% else %}
        <br/>  
        {% endif %}
        
        <div class="image-version-box">
        <b>Image:</b> <code>{{ container_family.image }}</code><br/>
        <div style="margin-top:2px">
        
        <span style="vertical-align:top;"><b>Tag:</b>&nbsp;</span>
        <select name="task_container_uuid" style="font-size:0.8em">
        {% for container in container_family.members %}
        <option value="{{ container.uuid }}">{{ container.tag }}</option>
        {% endfor %}
        </select>

        <span style="vertical-align:top; margin-left:5px"><b>Arch:</b>&nbsp;</span>
        <select name="task_container_arch" style="font-size:0.8em">
        <option value="auto" selected>auto</option>

        {% for arch in container_family.all_archs %}
        <option value="{{ arch }}">{{ arch }}</option>
        {% endfor %}
        </select>

            
        </div>
        </div>
        <!-- </div> -->
        </div>
        
        <div style="margin-bottom:8px; margin-top: 3px; text-align:center">
        {% if not disable_play_button %}
        
               
        <button type="submit" onclick="myFunction()" class="btn-link btn btn-light" style="border: #c0c0c0 1px solid">
        &nbsp;<i class="fa fa-play" style="color:green"></i>
        </button>
        
        {% endif %}
        </form>
        </div>    
      
      
      
      </div>
      
      {% endif %}






      
 No newline at end of file
Loading