Slice request: handles url as an onelab-data field
[unfold.git] / portal / templates / onelab / onelab_slicerequest_view.html
index ef0ca28..aadcda9 100644 (file)
@@ -13,7 +13,7 @@
        {% if errors %}
        <div class="row">
                <div class="col-md-12">
-               <ul>
+               <ul class="error">
                  {% for error in errors %}
                  <li>{{ error }}</li>
                  {% endfor %}
                            <input type="email" class="form-control" id="email" style="width:300px" value="{{ email }}" readonly="readonly">
                          </div>
                          <div class="form-group">
-                           <input type="text" class="form-control" name="slice_name" id="slice_name" style="width:300px" placeholder="Slice Name
+                           <input type="text" class="form-control" name="slice_name" id="slice_name" style="width:300px" placeholder="Slice name" value="{{slice_name}}
                                title="Please enter a name for your slice"required="required">
                          </div>
                          <div class="form-group">
                                {%if 'is_pi'  in pi %}
-                               <input type="text" class="form-control" id="authority_hrn" name="authority_hrn" style="width:300px" placeholder="Authority
+                               <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Organization
                                title="An authority responsible for vetting your slice" required="required">
                                {%else%}
-                           <input type="text" class="form-control" id="authority_hrn" name="authority_hrn" placeholder="Authority" style="width:300px; display:none;" 
-                               title="An authority responsible for vetting your slice" required="required" readonly="readonly">
+                           <input type="text" class="form-control" id="authority_hrn" name="org_name" placeholder="Organization" style="width:300px;" 
+                               title="An authority responsible for vetting your slice" required="required" readonly>
                                {%endif%}
                          </div>
                          <div class="form-group">
-                           <input type="number" class="form-control" name="number_of_nodes" id="number_of_nodes" style="width:300px" placeholder="Number of Nodes"
-                               title="Number of nodes you expect to request (informative)">
+                           <input type="text" class="form-control" name="url" id="url" style="width:300px" placeholder="Experiment URL (if one exists)"
+                               title="Please provide the url of your experiment if you have one." value="{{url}}">
                          </div>
                          <div class="form-group">
-                               <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment Purpose" style="width:300px" 
+                               <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment purpose" style="width:300px" 
                                title="Purpose of your experiment (informative)" required="required">{{ purpose }}</textarea>
                          </div>
                          <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>
 <script>
 jQuery(document).ready(function(){
        
-       $("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
+       /*$("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
                var jsonData = JSON.parse(data);
         $(this).attr("value", jsonData[0]['parent_authority']);
-    });
-    var availableTags = [
-     {% if authorities %}
-         {% for authority in authorities %}
-             {% if authority.name %}
-                 {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
-             {% else %}
-                 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
-             {% endif %}
-         {% endfor %}    
-     {% else %}
-         {value:"",label:"No authority found !!!"}
-     {% endif %}
+    });*/
+       $("#authority_hrn").val("{{authority_name}}");
+       var availableTags = [
+    {% if authorities %}
+        {% for authority in authorities %}
+            {% if authority.name %}
+                {value:"{{ authority.name }}",label:"{{authority.name}}"},
+                       // to show only full name
+           // {% else %}
+           //     {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
+            {% endif %}
+        {% endfor %}    
+    {% else %}
+        {value:"",label:"No authority found !!!"}
+    {% endif %}
     ];
+       // sorting the list
+       availableTags.sort(function(a,b){
+               var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
+               if (nameA < nameB) {
+               return -1;
+               }
+               if (nameA > nameB) {
+               return 1;
+               }
+       return 0;
+       }); 
     $( "#authority_hrn" ).autocomplete({
       source: availableTags,
       minLength: 0,