Commit c99ecc59 authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Rationalized computing views and templates

parent 737d21ee
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -23,6 +23,15 @@
          <td><b>Name</b></td>
          <td><input type="text" name="name" value="" size="30" required /></td>
        </tr>
        <tr>
          <td><b>Owner</b></td>
          <td>
            <select name="user_id" style="width: 220px;">
              <option value="{{ data.user.id }}">{{ data.user.email }}</option>
              {% if data.user.is_staff %}<option value="">Platform</option>{% endif %}
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Description</b></td>
          <td><textarea name="description" rows="3" cols="30"></textarea></td>
@@ -98,9 +107,7 @@
      </table>
      <table style="width:500px; border:0; background:#ffffff; margin-top:20px">
        <tr><td align="center">
          <a href="/computing" class="btn btn-primary" style="margin-left:10px">Back</a>
          &nbsp;
          <input type="submit" value="Add" class="btn btn-primary">
          <input type="submit" value="Create" class="btn btn-primary">
        </td></tr>
      </table>
      </form>
+0 −185
Original line number Diff line number Diff line

      {% if data.computing %}

      <div style="float:left; width:500px; margin:10px; margin-bottom:20px">
      <table class="dashboard" style="width:100%">

       <!-- <tr>
        <td colspan="2" style="background:{{ data.computing.color }}; height:25px">
        </td>
       </tr> -->

       <tr>
        <td><b>Name</b></td>
        <td>{{ data.computing.name }}</td>
       </tr>

       <tr>
        <td><b>Description</b></td>
        <td>{{ data.computing.description }}</td>
       </tr>

       <tr>
        <td><b>Group</b></td>
        <td>{{ data.computing.group }}</td>
       </tr>

       <tr>
        <td><b>Type</b></td>
        <td>{{ data.computing.type }}</td>
       </tr>

       <tr>
        <td><b>Access mode</b></td>
        <td>{{ data.computing.access_mode }}</td>
       </tr>

       <tr>
        <td><b>Auth mode</b></td>
        <td>{{ data.computing.auth_mode }}</td>
       </tr>

       <tr>
        <td><b>WMS</b></td>
        <td>{{ data.computing.wms }}</td>
       </tr>

       <tr>
        <td><b>Arch</b></td>
        <td>{{ data.computing.arch }}</td>
       </tr>

       <tr>
        <td><b>Container engines</b></td>
        <td>{{ data.computing.container_engines_json }}</td>
       </tr>

       <tr>
        <td><b>Emulated archs</b></td>
        <td>{{ data.computing.emulated_archs_json }}</td>
       </tr>

       <tr>
        <td><b>Storages</b></td>
        <td>
        {% if not computing.storages.all %}
        none
        {% else %}
        {% for storage in computing.storages.all %}
        {% if storage.bind_path %}
        {{  storage.name }} @ <code>{{  storage.bind_path }}</code><br/>
        {% endif %}
        {% endfor %}
        {% endif %}
        </td>
       </tr>

       {% if request.user.is_staff %}
       <tr>
        <td><b>Actions</b></td>
        <td>
        <a href="/edit_computing/?uuid={{ data.computing.uuid }}">Edit</a>
        &nbsp;|&nbsp;
        <a href="/computing/?action=delete&uuid={{ data.computing.uuid }}" onclick="return confirm('Are you sure you want to delete this computing resource?');">Delete</a>
        &nbsp;|&nbsp;
        <a href="/computing/?action=duplicate&uuid={{ data.computing.uuid }}" onclick="return confirm('Duplicate this computing resource?');">Duplicate</a>
        </td>
       </tr>
       {% endif %}




      </table>
      </div>

      {% else %}


      {% load computing_helpers %}
      {% is_computing_configured computing request.user as computing_configured %}

      <!-- Insert an "if false" here to let the computing show up even when creating the task but to not allow to be chosen (greyed out button) -->
      {% if container and not computing_configured %}
      {% else%}

      <div style="width:300px; float:left; border: #e0e0e0 solid 1px; margin:10px; background:#f8f8f8; margin-bottom:15px;">
        <!-- <div style="background:{{computing.color}}; height:24px"></div> -->

        <div style="padding:10px; margin-top:5px; text-align:center; border-bottom: #e0e0e0 solid 1px; ">
        <a href="/computing/?uuid={{ computing.uuid }}&details=True">{{ computing.name }}</a>
        </div>


        {% if not computing_configured %}
        <div style="width:298px; float:left; margin:0; margin-bottom:5px; padding:2px; background: gary; color:black; text-align:center; border-bottom: #e0e0e0 solid 1px;">
        <i class="fa fa-info-circle"></i> Not configured <!-- style="color:#337ab7" -->
        </div>
        {% endif %}



        {% if not computing_configured %}
        <!--  <div style="padding:10px; -webkit-filter: blur(5px); -moz-filter: blur(5px); -o-filter: blur(5px); -ms-filter: blur(5px); filter: blur(5px);"> -->
        <div style="padding:10px;">
        {% else %}
        <div style="padding:10px;">
        {% endif %}

        {% if computing.description %}
        <div class="description-box" title="{{ computing.description }}">
        {{ computing.description }}
        </div>
        {% else %}
        <br/>
        {% endif %}
        <div class="image-version-box">
        <b>Type:</b> {{ computing.type }} <font style="font-size:0.9em">({{ computing.arch }})</font>
        <!-- <br/><b>Arch:</b> {{ computing.arch }} -->
        <br/>
        <b>Storages:</b>
        {% if not computing.storages.all %}
        none
        {% else %}
        <br/>
        {% for storage in computing.storages.all %}
        {% if storage.bind_path %}
        &nbsp; {{  storage.name }} @ <code>{{  storage.bind_path }}</code><br/>
        {% endif %}
        {% endfor %}
        {% endif %}
        </div>
        <!-- ><b>Access:</b> {{ computing.access_mode }}<br/> --
        <!-- <b>Owner:</b> {% if computing.user %}{{ computing.user }}{% else %}Platform{% endif %}<br/> -->
        <!--  <b>Engines:</b> {{ computing.container_engines }} -->

        <!-- {% if 'docker' in computing.container_engines %}<img src="/static/img/docker-logo.svg" style="height:18px; width:18px; margin-bottom:2px" />{% endif %}
        {% if 'singularity' in computing.container_engines %}<img src="/static/img/singularity-logo.svg" style="height:18px; width:18px; margin-bottom:2px" />{% endif %}-->
        {% if container %}
        <div style="margin:0px; margin-top:2px; text-align:center; padding:5px">
        {% if computing_configured %}
        <form action="/new_task/" method="POST">
        {% 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>
        {% else %}
        <input type="submit" value="Choose" class="btn btn-connect" disabled>
        {% endif %}
        </div>
        {% endif %}

        </div>

      </div>
      {% endif %}



      {% endif %}


+118 −0
Original line number Diff line number Diff line

{% if details %}
{% if data.created %}
<div class="alert alert-success" style="width:500px;">Computing resource created successfully.</div>
{% endif %}

<div style="float:left; width:500px; margin:10px; margin-bottom:20px">
  <table class="dashboard" style="width:100%">
    <tr>
      <td><b>Name</b></td>
      <td>{{ computing.name }}</td>
    </tr>
    <tr>
      <td><b>Description</b></td>
      <td>{{ computing.description }}</td>
    </tr>
    <tr>
      <td><b>Owner</b></td>
      <td>{% if computing.user %}{{ computing.user }}{% else %}Platform{% endif %}</td>
    </tr>
    <tr>
      <td><b>Group</b></td>
      <td>{{ computing.group }}</td>
    </tr>
    <tr>
      <td><b>Type</b></td>
      <td>{{ computing.type }}</td>
    </tr>
    <tr>
      <td><b>Access mode</b></td>
      <td>{{ computing.access_mode }}</td>
    </tr>
    <tr>
      <td><b>Auth mode</b></td>
      <td>{{ computing.auth_mode }}</td>
    </tr>
    <tr>
      <td><b>WMS</b></td>
      <td>{{ computing.wms }}</td>
    </tr>
    <tr>
      <td><b>Arch</b></td>
      <td>{{ computing.arch }}</td>
    </tr>
    <tr>
      <td><b>Container engines</b></td>
      <td>{{ computing.container_engines_json }}</td>
    </tr>
    <tr>
      <td><b>Supported archs</b></td>
      <td>{{ computing.supported_archs_json }}</td>
    </tr>
    <tr>
      <td><b>Emulated archs</b></td>
      <td>{{ computing.emulated_archs_json }}</td>
    </tr>
    <tr>
      <td><b>Storages</b></td>
      <td>
        {% if not computing.storages.all %}
          none
        {% else %}
          {% for storage in computing.storages.all %}
            {% if storage.bind_path %}
              {{ storage.name }} @ <code>{{ storage.bind_path }}</code><br/>
            {% endif %}
          {% endfor %}
        {% endif %}
      </td>
    </tr>
    <tr>
      <td><b>Conf</b></td>
      <td><pre style="font-size:0.9em">{{ computing.conf_json }}</pre></td>
    </tr>
    {% if computing.user == data.user or data.user.is_staff %}
    <tr>
      <td><b>Actions</b></td>
      <td>
        <a href="/edit_computing/?uuid={{ computing.uuid }}">Edit</a>
        &nbsp;|&nbsp;
        <a href="/computing/?action=delete&uuid={{ computing.uuid }}" onclick="return confirm('Are you sure you want to delete this computing resource?');">Delete</a>
        &nbsp;|&nbsp;
        <a href="/computing/?action=duplicate&uuid={{ computing.uuid }}" onclick="return confirm('Duplicate this computing resource?');">Duplicate</a>
      </td>
    </tr>
    {% endif %}
  </table>
</div>
{% else %}
<div style="width:300px; float:left; border: #e0e0e0 solid 1px; margin:10px; background:#f8f8f8; margin-bottom:15px;">
  <div style="padding:10px; margin-top:5px; text-align:center; border-bottom: #e0e0e0 solid 1px; ">
    <a href="/computing/?uuid={{ computing.uuid }}">{{ computing.name }}</a>
  </div>
  <div style="padding:10px;">
    {% if computing.description %}
      <div class="description-box" title="{{ computing.description }}">
        {{ computing.description }}
      </div>
    {% else %}
      <br/>
    {% endif %}
    <div class="image-version-box">
      <b>Type:</b> {{ computing.type }} {% if computing.arch %}({{ computing.arch }}) {% endif %}<br/>
      <b>Storages:</b>
      {% if not computing.storages.all %}
        None
      {% else %}
        <br/>
        {% for storage in computing.storages.all %}
          {% if storage.bind_path %}
            &nbsp; {{ storage.name }} @ <code>{{ storage.bind_path }}</code><br/>
          {% endif %}
        {% endfor %}
      {% endif %}
    </div>
  </div>
</div>
{% endif %}
+22 −40
Original line number Diff line number Diff line
@@ -12,58 +12,40 @@
      {% else %}
      <h1>Computing resources</h1>
      {% endif %}
      <hr/>
      <br/>

      {% if data.computing %}

        {% include "components/computing_component.html" with computing=data.computing details=True %}

      {% if request.user.is_staff %}
      {% if not data.computing %}
      {% else %}
      <div class="form-filter" style="margin-bottom:20px">
        <form action="" method="POST">
          <input type="text" class="form-control" id="search_text" name="search_text" placeholder="Search..." style="width:200px; margin:0; display:inline" value="{{data.search_text}}" autofocus>
          <select class="form-control" id="search_owner" name="search_owner" style="width:120px; margin:0; display:inline">
            {% if data.search_owner == 'All' %}
            <option selected>All</option>
            {% else %}
            <option>All</option>
            {% endif %}
            {% if data.search_owner == 'Platform' %}
            <option selected>Platform</option>
            {% else %}
            <option>Platform</option>
            {% endif %}
            {% if data.search_owner == 'User' %}
            <option selected>User</option>
            {% else %}
            <option>User</option>
            {% endif %}
          <input type="text" class="form-control" id="filter_text" name="filter_text" placeholder="Search..." style="width:200px; margin:0; display:inline" value="{{data.filter_text}}" autofocus>
          <select class="form-control" id="filter_owner" name="filter_owner" style="width:120px; margin:0; display:inline">
            <option value="all" {% if data.filter_owner == 'all' %}selected{% endif %}>All</option>
            <option value="platform" {% if data.filter_owner == 'platform' %}selected{% endif %}>Platform</option>
            <option value="user" {% if data.filter_owner == 'user' %}selected{% endif %}>Personal</option>
            {% for group in user.groups.all %}
              {% with "group:"|add:group.name as group_identifier %}
              <option value="group:{{ group.name }}" {% if data.filter_owner == group_identifier %}selected{% endif %}>{{ group.name }}</option>
              {% endwith %}
            {% endfor %}
          </select>
          {% csrf_token %}
          <button type="submit" class="btn btn-secondary">Go</button>
          &nbsp; &nbsp; <font size=4.0em>|</font> &nbsp; <a href="/add_computing">Add new...</a>
        </form>
      </div>
      {% endif %}
      {% endif %}

      <div class="row" style="padding:5px">
      {% if data.computing %}
      {% include "components/computing.html" with computing=data.computing details=True %}
      {% else %}
        {% for computing in data.computings %}
      {% include "components/computing.html" with computing=computing %}
          {% include "components/computing_component.html" with computing=computing %}
        {% empty %}
          <p>No computing resources found.</p>
        {% endfor %}
      {% endif %}
      </div>

      <!-- <div class="row" style="padding:10px; padding-left:15px">
      <a href="/add_container">Add new...</a>
      </div> -->

      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      {% endif %}

    </div>
  </div>
+20 −6
Original line number Diff line number Diff line
@@ -10,10 +10,13 @@
      <hr>

      {% if data.error %}
        <div class="alert alert-danger">{{ data.error }}</div>
        <div class="alert alert-danger" style="width:500px;">{{ data.error }}</div>
      {% endif %}
      {% if data.edited %}
        <div class="alert alert-success">Resource updated successfully.</div>
      {% if data.saved %}
        <div class="alert alert-success" style="width:500px;">Computing updated successfully.</div>
      {% endif %}
      {% if data.created %}
        <div class="alert alert-success" style="width:500px;">Computing created successfully.</div>
      {% endif %}

      <form action="#" method="POST">
@@ -23,6 +26,19 @@
          <td><b>Name</b></td>
          <td><input type="text" name="name" value="{{ data.computing.name }}" size="30" required /></td>
        </tr>
        <tr>
          <td><b>Owner</b></td>
          <td>
            <select name="user_id" style="width: 220px;">
              {% if data.computing.user %}
                <option value="{{ data.computing.user.id }}">{{ data.computing.user.email }}</option>
                {% if data.user.is_staff %}<option value="">Platform</option>{% endif %}
              {% else %}
                <option value="">Platform</option>
              {% endif %}
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Description</b></td>
          <td><textarea name="description" rows="3" cols="30">{{ data.computing.description }}</textarea></td>
@@ -98,9 +114,7 @@
      </table>
      <table style="width:500px; border:0; background:#ffffff; margin-top:20px">
        <tr><td align="center">
          <a href="/computing/?uuid={{ data.computing.uuid }}" class="btn btn-primary" style="margin-left:10px">Back</a>
          &nbsp;
          <input type="submit" value="Save changes" class="btn btn-primary">
          <input type="submit" value="Save" class="btn btn-primary">
        </td></tr>
      </table>
      </form>
Loading