Several modifications in fed4fire UI + Slice creation is restricted under projects...
authorYasin Rahman <mohammed-yasin.rahman@lip6.fr>
Fri, 10 Apr 2015 15:17:37 +0000 (17:17 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 16 Apr 2015 08:53:25 +0000 (10:53 +0200)
portal/projectrequestview.py
portal/slicerequestview.py
portal/static/js/my_account.edit_profile.js
portal/templates/fed4fire/fed4fire_account-view.html
portal/templates/fed4fire/fed4fire_home-view.html
portal/templates/fed4fire/fed4fire_projectrequest_view.html
portal/templates/fed4fire/fed4fire_slicerequest_view.html

index 6b1bc7c..451469d 100644 (file)
@@ -119,6 +119,11 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
             # What kind of project name is valid?
             if (post['project_name'] is None or post['project_name'] == ''):
                 errors.append('Project name is mandatory')
+
+            # max project_name length is 10
+            if (len(post['project_name']) >10):
+                errors.append('Project name can be maximum 10 characters long')
+
             
             if not errors:
                 print "is_pi on auth_hrn = ", user_authority
index a880d39..0a8f998 100644 (file)
@@ -17,6 +17,7 @@ from myslice.theme import ThemeView
 import json, time, re
 
 import activity.user
+theme = ThemeView()
 
 class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
     template_name = 'slicerequest_view.html'
@@ -148,9 +149,17 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             if (re.search(r'^[A-Za-z0-9_]*$', slice_name) == None):
                 errors.append('Slice name may contain only letters, numbers, and underscore.')
             
-            organization = slice_request['organization']    
-            if (organization is None or organization == ''):
-                errors.append('Organization is mandatory')
+            organization = slice_request['organization']
+            if theme.theme == 'fed4fire':
+                if (organization is None or organization == ''):
+                    errors.append('Selecting project is mandatory')
+            else:
+                if (organization is None or organization == ''):
+                    errors.append('Organization is mandatory')
+
+            slice_length= len(slice_request['slice_name'])
+            if slice_length >19:
+                errors.append('Slice name can be maximum 19 characters long')
 
 
     
index f98427e..026321f 100644 (file)
@@ -136,7 +136,7 @@ jQuery(document).ready(function(){
                       jQuery("#upload_file").click(function(){
 
                               jQuery("#span_upload").show();
-                              jQuery("#dl_file").hide();
+                              jQuery("#dl_pubkey").hide();
                               jQuery("#upload_file").hide();
                               jQuery("#keyval").hide();
                               // enforcing when one edit is clicked the rest will not work at same time
@@ -157,7 +157,7 @@ jQuery(document).ready(function(){
 
                               jQuery("#span_upload").hide();
                               jQuery("#keyval").show();
-                              jQuery("#dl_file").show();
+                              jQuery("#dl_pubkey").show();
                               jQuery("#upload_file").show();
                       });
                   });
index 985974f..b71f3da 100644 (file)
@@ -33,7 +33,6 @@
                <ul class="nav nav-tabs nav-section">
                        <li class="active"><a href="#profile">User Profile</a></li>
                        <li><a href="#account">Account</a></li>
-                       <li><a href="#access">Testbed Access</a></li>
                </ul>
     </div>
 </div>
                        {%endif%}
                </div>
        </div>
-
-
-       <div class="tab-pane row" id="access">
-               <div class="col-md-12">
-       
-               <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
-        <table class="mytable table table-bordered table-hover"> 
-            <tr class="odd"> 
-                <th>Platform</th> 
-                <th>Account Type</th>
-                               <th>Reference to</th>
-                               <th>Remove Account</th>
-            </tr>   
-            {% for row in ref_acc %}         
-            <tr class="border_bottom">
-                <td class="odd"> {{ row.platform_name }} </td>
-                <td class="odd"> {{ row.account_type }} </td>
-                               <td class="odd"> {{ row.account_reference }} </td>
-                               <td class="odd">
-                               <button class="btn btn-danger" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform" onclick="javascript:document.getElementById('button_value').value='delete_{{row.platform_name}}';">
-                                               <span class="glyphicon glyphicon-minus"></span>
-                                       </button>
-                               </td>
-            </tr> 
-            {%endfor%}               
-        </table>               
-               
-               
-               <h3>Add reference account to the following testbeds</h3>
-        <table class="mytable table table-bordered table-hover"> 
-            <tr class="odd"> 
-                <th>Platforms</th> 
-                <th>Add Account</th>
-            </tr>   
-            {% for platform in platform_list %}         
-            <tr class="border_bottom">
-                <td class="odd"> {{ platform.platform_no_access }} </td>
-                <td class="odd">
-                                       <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform" onclick="javascript:document.getElementById('button_value').value='add_{{platform.platform_no_access}}';">
-                                               <span class="glyphicon glyphicon-plus"></span>
-                                       </button>
-                               </td>
-            </tr> 
-            {%endfor%}               
-        </table>
-       </div>
 {%endif%} 
 </div>
-</div>
 
 </form>
 <script>
index 5d632b6..53f353c 100644 (file)
@@ -6,6 +6,12 @@
 {% widget '_widget-news.html' %}
 </div> -->
 {% if username %}
+{% block head %} 
+<script type="text/javascript" src="https://java.com/js/dtjava.js"/>
+<script type="text/javascript">
+</script>
+{% endblock head %}
+
 {% widget "_widget-no_credentials.html" %}
 <div class="container dashboard">
        <div class="row">
                                EXPERIMENT
                        </h3>
                        <div>
-                               <a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a>
+                               <a href="/portal/slice_request"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a>
                        </div>
                        <div>
-                               <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Slice</button>
+                               <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
                        </div>
                        <div>
                                <p><strong>Your slices </strong>
                                <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
                        </div>
                        <h3 title="Some tools do their own slice creation and management.">Experiment now</h3>
-                       <a class="btn btn-primary" style="width: 150px;" 
-                    href='http://jfed.iminds.be/releases/5.4-dev/r2289/webstart/experimenter/jfed-experimenter.jnlp'
-                                       title="Click here to start your experiment with jFed" 
-                                       onclick="return  launchApplication('http://jfed.iminds.be/releases/5.4-dev/r2289/webstart/experimenter/jfed-experimenter.jnlp');">
+                       <a class="btn btn-primary" id="webstart-button" style="width: 150px;" 
+                    href='http://jfed.iminds.be/releases/5.4-dev/r2314/webstart/experimenter/jfed-experimenter.jnlp'
+                                       title="Click here to start your experiment with jFed">
                     <span class="glyphicon glyphicon-cloud"></span> jFed</a>
                </div>
                <div class="col-md-3">
@@ -52,7 +57,7 @@
                                <a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a>
                        </div>
                        <div>
-                               <button id="projectrequestbtn" type="button" class="btn btn-default" style="width:165px;"><span class="glyphicon glyphicon-plus"></span> Join Project</button>
+                               <button id="projectrequestbtn" type="button" class="btn btn-default" style="width:165px;"><span class="glyphicon glyphicon-plus"></span> Create/Join project</button>
                        </div>
                        <div>
                                <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
 
 <script type="text/javascript">
        $(document).ready(function() {
+        $('#webstart-button').click(function(){
+            var platform8 = new dtjava.Platform({javafx: '8+', jvm: '1.8+'});
+            var config = {
+                java8_jnlp: 'http://jfed.iminds.be/releases/5.4-dev/r2314/webstart/experimenter/jfed-experimenter.jnlp',
+                java7_jnlp: 'http://jfed.iminds.be/releases/r2269/webstart/experimenter/jfed-experimenter.jnlp'
+            };
+            var certkey = "{{jfed_identity}}";
+
+            dtjava.launch({url: config.java8_jnlp, params: {'login-certificate-string' : certkey } } , platform8, {});
+            //launchjFed();
+        });
            {%if 'no_creds' in user_cred or 'creds_expired' in user_cred %}
         localStorage.clear();
         $.post("/cache/clear/", function( data ) {
 });
 </script>
 
-<!--for jfed tool-->
+<!--
+for jfed tool
 <script type="text/javascript" src="{{STATIC_URL}}js/fed4fire_dtjava_orig.js"></script>
 <script>
        function launchApplication(jnlpfile) {
         return false;
      }
 </script>
+-->
 {# widget "_widget-monitor.html" #}
 {# widget "_widget-stats-top-slices.html" #}
 
index d002152..be59750 100644 (file)
@@ -10,8 +10,8 @@
 <div class="row">
     <div class="col-md-12">
         <ul class="nav nav-tabs nav-section">
-            <li class="active"><a href="#existing">Join existing Project</a></li>
-            <li><a href="#new">Create new Project</a></li>
+            <li class="active"><a href="#new">Create new Project</a></li>
+            <li><a href="#existing">Join existing Project</a></li>
             
         </ul>
     </div>
 {% endif %}
 
 <div class="container tab-content">
-    
-       <div class="tab-pane active" id="existing"> 
-        <div class="row">
-            <div class="col-md-6">
-                 <h3>Join an existing Project</h3>
-            </div>
-            <div class="col-md-6">
-                 <h3>List of projects you are part of</h3>
-            </div>
-        </div>
-        <div class="row">
-            <div class="col-md-6">
-                <form role="form" method="post" action="/portal/project_request">
-                {% csrf_token %}
-                <div id="project_loading" style="display:inline;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div> 
-                <select id="projects" name="project_name" style="display:none;"></select> <div style="display:none;" id="projects_button"><input type="submit" id="join" name="join" value="Join" class="btn"/></div>
-                </form>
-            </div>
-            <div class="col-md-6">
-                <table class="table project-list">
-                    {% for pending in pending_projects %}
-                    <tr><td>(PENDING) {{ pending.project_name }}</td><td>{{ pending.authority_hrn }}</td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
-                    {% endfor %}
-                    {% for pending in pending_join_projects %}
-                    <tr><td>(PENDING JOIN) {{ pending.project_name }}</td><td>&nbsp;</td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
-                    {% endfor %}
 
-                </table>
-            </div>
-        </div>
-    </div>
-    
-    <div class="tab-pane" id="new"> 
+    <div class="tab-pane active" id="new"> 
         <div class="row">
             <div class="col-md-12">
                  <h3>Create a new Project</h3>
         </div>
     </div>
     
+       <div class="tab-pane" id="existing"> 
+        <div class="row">
+            <div class="col-md-6">
+                 <h3>Join an existing Project</h3>
+            </div>
+            <div class="col-md-6">
+                 <h3>List of projects you are part of</h3>
+            </div>
+        </div>
+        <div class="row">
+            <div class="col-md-6">
+                <form role="form" method="post" action="/portal/project_request">
+                {% csrf_token %}
+                <div id="project_loading" style="display:inline;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div> 
+                <select id="projects" name="project_name" style="display:none;"></select> <div style="display:none;" id="projects_button"><input type="submit" id="join" name="join" value="Join" class="btn"/></div>
+                </form>
+            </div>
+            <div class="col-md-6">
+                <table class="table project-list">
+                    {% for pending in pending_projects %}
+                    <tr><td>(PENDING) {{ pending.project_name }}</td><td>{{ pending.authority_hrn }}</td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
+                    {% endfor %}
+                    {% for pending in pending_join_projects %}
+                    <tr><td>(PENDING JOIN) {{ pending.project_name }}</td><td>&nbsp;</td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
+                    {% endfor %}
+
+                </table>
+            </div>
+        </div>
+    </div>
 </div>
                
 <script>
index 7bcd56d..063a9f8 100644 (file)
                                title="Please enter a name for your slice"required="required">
                          </div>
                          <div class="form-group">
-                               {% if pi %}
-                               <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="hidden" 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>
-                <span style="float:left;">Authority: &nbsp;</span>
-                <div id="authority_display">
-                <img src="{{ STATIC_URL }}img/loading.gif" alt="Loading authority" />
-                </div>
-                               {% endif %}
+                               <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Project" 
+                               title="Select a project under which you want to create your slice" required="required">
                          </div>
                          <div class="form-group">
-                Project: <div id="project_loading" style="display:inline;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div> 
-                <select id="project" name="project" style="display:none;">
-                </select>
-              </div>
-                         <div class="form-group">
                            <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>
                
 <script>
 jQuery(document).ready(function(){
-       
-       $("#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']);
-           {% if pi %}
-        draw_projects(jsonData[0]['parent_authority']);
-        {% else %}
-        $('#authority_display').html(jsonData[0]['parent_authority']);
-        draw_projects('');
-        {% endif %}
-    });
-
-       {% if pi %}
-       $("#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;
-       }); 
+    var myprojects = JSON.parse(localStorage.getItem('projects'));
     $( "#authority_hrn" ).autocomplete({
-      source: availableTags,
-      minLength: 0,
-      select: function( event, ui ) {
-        $("#project").hide();
-        $("#project_loading").css('display', 'inline-block');
-        draw_projects(jQuery('.ui-state-focus').html());
-      },
+        source: myprojects,
+        change: function (event, ui) {
+                if(!ui.item){
+                    //http://api.jqueryui.com/autocomplete/#event-change -
+                    // The item selected from the menu, if any. Otherwise the property is null
+                    //so clear the item for force selection
+                    $("#authority_hrn").val("");
+                }
+        }
     });
-    {% endif %}
 });
 
-function draw_projects(authority_hrn){
+/*function draw_projects(authority_hrn){
 
     var projects = [];
     project_row = "<option value=''> - </option>";
@@ -152,7 +101,7 @@ function draw_projects(authority_hrn){
     }
     $("#project").show();
     $("#project_loading").hide();
-}
+}*/
 </script>
 {% endblock %}