4d844f3b09b37ce4165179e183f168bfe66a5c22
[myslice.git] / portal / templates / fed4fire / fed4fire_home-view.html
1 {% extends "layout_base.html" %}
2 {% load portal_filters %}
3
4 {% block content %}
5 <!-- <div class="row">
6 {% widget '_widget-news.html' %}
7 </div> -->
8 {% if username %}
9 <!-- Modal- No credentials -->
10 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
11             <div class="modal-dialog">
12                 <div class="modal-content">
13                     <div class="modal-header">
14                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
15                             <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
16                     </div>
17                     <div class="modal-body" style="text-align:justify;">
18                                         <p>You are getting this message for any of the following reasons:</p>
19                                         <ul>
20                                                 <li>If your account is still pending for validation</li>
21                                                 <li>If you press the "Clear Credentials" button</li>
22                                                 <li>If you "Generate a new key pair"</li>
23                                                 <li>If a new slice is added to your account</li>
24                                         </ul>
25                                         <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
26                                                 The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
27                                                 then please logout and login back into to the portal.
28                                         </p>
29                                         <h3>Manual delegation of credentials</h3>
30                                                 <p>
31                                                         You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
32                                                         the portal can no longer generate your credentials automatically. In order to have your credentials 
33                                                         delegated to the portal, please follow these instructions:
34                                                 </p>
35                                                 <ul>
36                                                         <li>Your account must first be validated by the manager of your organization.</li>
37                                                         <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
38                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
39                                                 </ul>
40                                         </p>
41                                         <h3>Contact support</h3>
42                                         <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
43                     </div>
44                     <div class="modal-footer">
45                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
46                     </div>
47                 </div>
48             </div>
49 </div>
50 <div class="container dashboard">
51            {%if 'no_creds'  in user_cred %}
52       <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
53   {%endif%}
54          {%if 'creds_expired'  in user_cred %}
55     <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
56     {%endif%}
57
58         <div class="row">
59                 {%if 'is_pi'  in pi %}
60                 <div class="col-md-3">
61                         <h3>
62                                 EXPERIMENT
63                         </h3>
64                         <div>
65                                 <a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a>
66                         </div>
67                         <div>
68                                 <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Slice</button>
69                         </div>
70                         <div>
71                                 <p><strong>Your slices </strong>
72                                         <span title="A slice is a set of testbed resources on which you can conduct an experiment. 
73                                         Either ask your colleagues to give you access to an existing slice or request a new slice by clicking 'Request Slice'. 
74                                         However, on the OneLab portal, you will only see slices that you have created through OneLab. If you have created slices elsewhere, 
75                                         such as on the PlanetLab Europe portal, those slices will not appear here."
76                                         class="glyphicon glyphicon-info-sign">
77                                 </span>
78
79                                 </p>
80                         </div>
81                         <div>   
82                                 <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
83                         </div>
84                 </div>
85                 <div class="col-md-3">
86                         <h3>MANAGEMENT</h3>
87                         <div>
88                                 <a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a>
89                         </div>
90                         <div>
91                                 <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
92                         </div>
93                 </div>
94                 <div class="col-md-3">
95                         <h3>
96                                 SUPPORT
97                         </h3>
98                         <div>
99                                 <a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a>
100                         </div>
101                         <div>
102                                 <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-envelope"></span> Contact</button>
103                         </div>
104                         <p></p>
105                         <div>
106                         <button id="statbtn" type="button" style="width: 150px;" class="btn btn-default"><span class="glyphicon glyphicon-stats"></span>Testbeds' status</button>
107                         </div>
108                 </div>
109                 
110                 <div class="col-md-3">
111                         <h3>
112                                 ACCOUNT
113                         </h3>
114                         <div>
115                                 <a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a>
116                         </div>
117                         <div>
118                                 <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
119                         </div>
120                         <div>
121                                 {% if person.last_name %}
122                                         {{person.first_name}} {{person.last_name}}<br />
123                                 {% endif %}
124                         <span class="label">Username:</span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
125                 </div>
126                 </div>
127         </div>
128         {%else%}
129         <div class="row">
130                 <div class="col-md-4">
131                         <h3>
132                                 EXPERIMENT
133                         </h3>
134                         <div>
135                                 <a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a>
136                         </div>
137                         <div>
138                                 <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>
139                         </div>
140                         <div>
141                                 <p><strong>Your slices </strong>
142                                 <span title="A slice is a set of testbed resources on which you can conduct an experiment. 
143                                         Either ask your colleagues to give you access to an existing slice or request a new slice by clicking 'Request Slice'. 
144                                         However, on the OneLab portal, you will only see slices that you have created through OneLab. If you have created slices elsewhere, 
145                                         such as on the PlanetLab Europe portal, those slices will not appear here."
146                                         class="glyphicon glyphicon-info-sign">
147                                 </span>
148                                 </p>
149                         </div>
150                         <div>   
151                                 <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
152                         </div>
153                         {% if pending_slices %}
154                         <p><strong>Pending slices</strong>
155                         <span title="Slices that you have requested and are pending for validation by the contact person of your organization."
156                                 class="glyphicon glyphicon-info-sign">
157                         <ul>
158                         {% for slices in pending_slices %}
159                         <li>{{slices}}</li>
160                         {% endfor %}
161                         </ul>
162                         </span>
163                         </p>
164                         {%endif%}       
165                 </div>
166                 <div class="col-md-4">
167                         <h3>
168                                 SUPPORT
169                         </h3>
170                         <div>
171                                 <a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a>
172                         </div>
173                         <div>
174                                 <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-envelope"></span> Contact</button>
175                         </div>
176                         <p></p>
177                         <div>
178                         <button id="statbtn" type="button" style="width: 150px;" class="btn btn-default"><span class="glyphicon glyphicon-stats"></span>Testbeds' status</button>
179                         </div>
180                 </div>
181                 
182                 <div class="col-md-4">
183                         <h3>
184                                 ACCOUNT
185                         </h3>
186                         <div>
187                                 <a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a>
188                         </div>
189                         <div>
190                                 <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
191                         </div>
192                         <div>
193                                 {% if person.last_name %}
194                                         {{person.first_name}} {{person.last_name}}<br />
195                                 {% endif %}
196                         <span class="label">Username:</span> <a href='/portal/account/' title="Click here to see and edit your account details.">{{person.email}}</a>
197                 </div>
198                 </div>
199         </div>
200         {%endif%}
201
202 </div>
203 {% else %}
204 <div class="container-fluid home">
205         <div class="">
206                 <div class="col-sm-2"></div>
207                 <div class="col-sm-4 slogan">
208                         <h2>
209                                 Fed4FIRE Portal
210                         </h2>
211                         <h3>
212                                 Your easy access to Future Internet Research and Experimentation testbeds belonging to the Fed4FIRE federation.
213                         </h3>
214                         <h3>
215                                  <a href='http://doc.fed4fire.eu'>Want to learn more?</a>
216                         </h3>
217                 </div>
218                 <div class="col-sm-4 col-sm-offset-1" style="width:400px; top:16px; float:left;">
219                         <div class="row">
220                                 {% widget '_widget-login-user.html' %}
221                         </div>
222                 </div>
223                 <div class="col-sm-1"></div>
224         </div>
225 </div>
226 {% endif %}
227
228
229 <script type="text/javascript">
230         $(document).ready(function() {
231                 $('a.home-tab').click(function() {
232                         $('ul.nav-tabs li').removeClass('active');
233                         $(this).parent().addClass('active');
234                         $('div.home-panel').hide();
235                         $('div#'+$(this).data('panel')).show();
236                 });
237                 $('button#validaterequestbtn').click(function() {
238                         window.location="/portal/institution#requests";
239                 });
240                 $('button#ticketbtn').click(function() {
241                         window.location="/portal/contact/";
242                 });
243                 $('button#statbtn').click(function() {
244                 window.location="https://flsmonitor.fed4fire.eu";
245                 });
246                 $('button#signupbtn').click(function() {
247                         window.location="/portal/register/";
248                 });
249                 $('button#slicerequestbtn').click(function() {
250                         window.location="/portal/slice_request/";
251                 });
252
253         /*
254             Launch queries to get the resources and leases in Manifold Cache
255         */
256             
257         $.post("/rest/resource/", function( data ) {
258         });
259         $.post("/rest/lease/", function( data ) {
260         });
261         
262         /*-------
263         List of slices has been moved in 
264         portal/templates/base.html
265         This is now in localStorage 
266         --------*/
267         // myslice.user is in LocalStorage
268         if(myslice.user.slices.length>0){
269             $.each( myslice.user.slices, function(i, val) {
270                 /*
271                 Launch a Query for each slice to get resources and leases in Manifold Cache
272                 */
273                 $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) {
274                 });
275             });
276         }
277 });
278 </script>
279 {# widget "_widget-monitor.html" #}
280 {# widget "_widget-stats-top-slices.html" #}
281
282 {% endblock %}