1 {% extends "layout.html" %}
6 <div class="col-md-12">
7 <div class="breadcrumbs" style="line-height: 3;">
8 Experiment > Request a new Slice
15 <div class="col-md-12">
17 {% for error in errors %}
26 <div class="col-md-8 el">
27 <form role="form" method="post">
29 <div class="form-group" style="display:none">
30 <input type="email" class="form-control" id="email" style="width:300px" value="{{ email }}" readonly="readonly">
32 <div class="form-group">
33 <input type="text" class="form-control" name="slice_name" id="slice_name" style="width:300px" placeholder="Slice name" value="{{slice_name}}"
34 title="Please enter a name for your slice"required="required">
36 <div class="form-group">
38 <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Organization"
39 title="An authority responsible for vetting your slice" required="required">
41 <input type="hidden" class="form-control" id="authority_hrn" name="org_name" placeholder="Organization" style="width:300px;"
42 title="An authority responsible for vetting your slice" required="required" readonly>
43 <span style="float:left;">Authority: </span>
44 <div id="authority_display">
45 <img src="{{ STATIC_URL }}img/loading.gif" alt="Loading authority" />
49 <div class="form-group">
50 Project: <div id="project_loading" style="display:inline;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div>
51 <select id="project" name="project" style="display:none;">
54 <div class="form-group">
55 <input type="text" class="form-control" name="url" id="url" style="width:300px" placeholder="Experiment URL (if one exists)"
56 title="Please provide the url of your experiment if you have one." value="{{url}}">
58 <div class="form-group">
59 <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment purpose" style="width:300px"
60 title="Purpose of your experiment (informative)" required="required">{{ purpose }}</textarea>
63 <button type="submit" id=submit_pi class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
65 <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
73 jQuery(document).ready(function(){
75 $("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
76 var jsonData = JSON.parse(data);
77 $(this).attr("value", jsonData[0]['parent_authority']);
79 draw_projects(jsonData[0]['parent_authority']);
81 $('#authority_display').html(jsonData[0]['parent_authority']);
87 $("#authority_hrn").val("{{authority_name}}");
90 {% for authority in authorities %}
91 {% if authority.name %}
92 {value:"{{ authority.name }}",label:"{{authority.name}}"},
93 // to show only full name
95 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
99 {value:"",label:"No authority found !!!"}
103 availableTags.sort(function(a,b){
104 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
113 $( "#authority_hrn" ).autocomplete({
114 source: availableTags,
116 select: function( event, ui ) {
117 $("#project").hide();
118 $("#project_loading").css('display', 'inline-block');
119 draw_projects(jQuery('.ui-state-focus').html());
125 function draw_projects(authority_hrn){
128 project_row = "<option value=''> - </option>";
129 projects.push(project_row);
131 if(authority_hrn.length > 0){
132 // Not for root authority
133 if(authority_hrn.split('.').length > 1){
134 $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS'+authority_hrn}}, function( data ) {
136 $.each( data, function( key, val ) {
137 project_row = "<option value='"+val.authority_hrn+"'>"+val.authority_hrn+"</option>";
138 projects.push(project_row);
140 $("#project").html(projects.join( "" ));
143 $("#project").html(projects.join( "" ));
146 my_projects = JSON.parse(localStorage.getItem('projects'));
147 $.each( my_projects, function( i, val ) {
148 project_row = "<option value='"+val+"'>"+val+"</option>";
149 projects.push(project_row);
151 $("#project").html(projects.join( "" ));
153 $("#project").show();
154 $("#project_loading").hide();