From: Yasin Date: Thu, 5 Jun 2014 13:43:24 +0000 (-0500) Subject: Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab X-Git-Tag: myslice-1.1~68^2~7 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3802d2308517f6ec27c8f0ea754409c0d4f4e2d7;hp=c3c38ca2ec7e6bffb3cf70897a190729a05d16a1;p=unfold.git Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab --- diff --git a/manifoldapi/static/js/manifold.js b/manifoldapi/static/js/manifold.js index f0bbc8a6..fa5415a8 100644 --- a/manifoldapi/static/js/manifold.js +++ b/manifoldapi/static/js/manifold.js @@ -475,15 +475,18 @@ var manifold = { var key = manifold.metadata.get_key(method); if (!key) continue; - if (key.length > 1) - continue; - key = key[0]; var sq_keys = []; var subrecords = record[method]; if (!subrecords) continue $.each(subrecords, function (i, subrecord) { - sq_keys.push(subrecord[key]); + if (key.length == 1){ + key = key[0]; + sq_keys.push(subrecord[key]); + }else{ + // more than what's necessary, but should work + sq_keys.push(subrecord); + } }); update_query.params[method] = sq_keys; update_query_orig.params[method] = sq_keys.slice(); diff --git a/plugins/queryupdater/static/js/queryupdater.js b/plugins/queryupdater/static/js/queryupdater.js index 5a7f7ba0..774392b9 100644 --- a/plugins/queryupdater/static/js/queryupdater.js +++ b/plugins/queryupdater/static/js/queryupdater.js @@ -29,10 +29,13 @@ var QueryUpdater = Plugin.extend({ init: function(options, element) { - this.classname="queryupdater"; + this.classname="queryupdater"; this._super(options, element); var self = this; + + this.initial = Array(); + this.table = this.elmt('table').dataTable({ // the original querytable layout was // sDom: "<'row'<'col-xs-5'l><'col-xs-1'r><'col-xs-6'f>>t<'row'<'col-xs-5'i><'col-xs-7'p>>", @@ -70,8 +73,15 @@ do_update: function(e) { var self = e.data; + + self.spin(); + console.log("do_update"); + // XXX check that the query is not disabled manifold.raise_event(self.options.query_uuid, RUN_UPDATE); + + // how to stop the spinning after the event? + // this should be triggered by some on_updatequery_done ? }, // related buttons are also disabled in the html template @@ -122,6 +132,7 @@ set_state: function(data) { + console.log("function set_state"); var action; var msg; var button = ''; @@ -214,11 +225,15 @@ on_new_record: function(record) { + console.log("query_updater on_new_record"); + console.log(record); + // if (not and update) { // initial['resource'], initial['lease'] ? - this.initial.push(record.urn); + this.initial.push(record); + //this.set_record_state(record, RECORD_STATE_ATTACHED); // We simply add to the table // } else { // \ this.initial_resources @@ -279,7 +294,7 @@ on_query_in_progress: function() { - messages.debug("queryupdater.on_query_in_progress"); + messages.debug("queryupdater.on_query_in_progress"); this.spin(); }, @@ -295,12 +310,9 @@ this.clear(); }, - on_new_record: function(record) - { - }, - on_query_done: function() { + console.log("on_query_done"); this.unspin(); }, @@ -308,12 +320,14 @@ // NOTE: record_key could be sufficient on_added_record: function(record) { + console.log("on_added_record = ",record); this.set_record_state(record, RECORD_STATE_ADDED); // update pending number }, on_removed_record: function(record_key) { + console.log("on_removed_record = ",record_key); this.set_record_state(RECORD_STATE_REMOVED); }, @@ -329,6 +343,8 @@ on_field_state_changed: function(result) { + console.log("on_field_state_changed"); + console.log(result); messages.debug(result) /* this.set_state(result.request, result.key, result.value, result.status); */ this.set_state(result); @@ -375,7 +391,7 @@ if (!change) return; // ioi: Refubrished - var initial = this.initial_resources; + var initial = this.initial; //var r_removed = []; // /*----------------------------------------------------------------------- TODO: remove this dirty hack !!! diff --git a/portal/accountview.py b/portal/accountview.py index 67c765d9..20c2b05c 100644 --- a/portal/accountview.py +++ b/portal/accountview.py @@ -455,6 +455,29 @@ def account_process(request): else: messages.error(request, 'Account error: You need an account in myslice platform to perform this action') return HttpResponseRedirect("/portal/account/") + + # download identity for jfed + elif 'dl_identity' in request.POST: + for account_detail in account_details: + for platform_detail in platform_details: + if platform_detail['platform_id'] == account_detail['platform_id']: + if 'myslice' in platform_detail['platform']: + account_config = json.loads(account_detail['config']) + if 'user_private_key' in account_config: + private_key = account_config['user_private_key'] + user_hrn = account_config.get('user_hrn','N/A') + registry = 'http://sfa-fed4fire.pl.sophia.inria.fr:12345/' + jfed_identity = user_hrn + '\n' + registry + '\n' + private_key + response = HttpResponse(jfed_identity, content_type='text/plain') + response['Content-Disposition'] = 'attachment; filename="jfed_identity.txt"' + return response + else: + messages.error(request, 'Download error: Private key is not stored in the server') + return HttpResponseRedirect("/portal/account/") + + else: + messages.error(request, 'Account error: You need an account in myslice platform to perform this action') + return HttpResponseRedirect("/portal/account/") #clear all creds elif 'clear_cred' in request.POST: diff --git a/portal/forms.py b/portal/forms.py index 6210d9db..38293e4e 100644 --- a/portal/forms.py +++ b/portal/forms.py @@ -69,21 +69,21 @@ def is_password_unusable(pw): # cc_myself = forms.BooleanField(required=False) class ContactForm(forms.Form): - first_name = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), - regex=r'^[\w.@+-]+$', - max_length=30, - label=_("First name"), - error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) - last_name = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), - regex=r'^[\w.@+-]+$', - max_length=30, - label=_("Last name"), - error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) - authority = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), - regex=r'^[\w.@+-]+$', - max_length=30, - label=_("authority"), - error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) + # first_name = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), + # regex=r'^[\w.@+-]+$', + # max_length=30, + # label=_("First name"), + # error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) + # last_name = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), + # regex=r'^[\w.@+-]+$', + # max_length=30, + # label=_("Last name"), + # error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) + # authority = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), + # regex=r'^[\w.@+-]+$', + # max_length=30, + # label=_("authority"), + # error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) email = forms.EmailField(widget=forms.TextInput(attrs={'class':'form-control'})) subject = forms.RegexField(widget=forms.TextInput(attrs={'class':'form-control'}), regex=r'^[\w.@+-]+$', diff --git a/portal/sliceresourceview.py b/portal/sliceresourceview.py index 2034eac4..f99c7d98 100644 --- a/portal/sliceresourceview.py +++ b/portal/sliceresourceview.py @@ -19,6 +19,7 @@ from plugins.queryupdater import QueryUpdater from plugins.testbeds import TestbedsPlugin from plugins.scheduler2 import Scheduler2 from plugins.columns_editor import ColumnsEditor +from plugins.lists.simplelist import SimpleList from myslice.theme import ThemeView @@ -43,13 +44,16 @@ class SliceResourceView (LoginRequiredView, ThemeView): user_fields = ['user_hrn'] # [column['name'] for column in user_md['column']] # TODO The query to run is embedded in the URL + # Example: select slice_hrn, resource.urn, lease.resource, lease.start_time, lease.end_time from slice where slice_hrn == "ple.upmc.myslicedemo" main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename) main_query.select( 'slice_hrn', 'resource.urn', 'resource.hostname', 'resource.type', 'resource.network_hrn', - 'lease.urn', + 'lease.resource', + 'lease.start_time', + 'lease.end_time', #'user.user_hrn', #'application.measurement_point.counter' ) @@ -95,21 +99,35 @@ class SliceResourceView (LoginRequiredView, ThemeView): # RESERVED RESOURCES LIST # resources as a list using datatable plugin - list_reserved_resources = QueryTable( - page = page, - domid = 'resources-reserved-list', - title = 'List view', - query = sq_resource, - query_all = sq_resource, - init_key = "urn", - checkboxes = True, - datatables_options = { - 'iDisplayLength': 25, - 'bLengthChange' : True, - 'bAutoWidth' : True, - }, + list_reserved_resources = SimpleList( + title = None, + page = page, + key = 'urn', + query = sq_resource, ) + list_reserved_leases = SimpleList( + title = None, + page = page, + key = 'resource', + query = sq_lease, + ) + +# list_reserved_resources = QueryTable( +# page = page, +# domid = 'resources-reserved-list', +# title = 'List view', +# query = sq_resource, +# query_all = sq_resource, +# init_key = "urn", +# checkboxes = True, +# datatables_options = { +# 'iDisplayLength': 25, +# 'bLengthChange' : True, +# 'bAutoWidth' : True, +# }, +# ) + # -------------------------------------------------------------------------- # COLUMNS EDITOR # list of fields to be applied on the query @@ -203,7 +221,8 @@ class SliceResourceView (LoginRequiredView, ThemeView): template_env = {} template_env['list_resources'] = list_resources.render(self.request) -# template_env['list_reserved_resources'] = list_reserved_resources.render(self.request) + template_env['list_reserved_resources'] = list_reserved_resources.render(self.request) + template_env['list_reserved_leases'] = list_reserved_leases.render(self.request) template_env['columns_editor'] = filter_column_editor.render(self.request) diff --git a/portal/static/css/onelab.css b/portal/static/css/onelab.css index 44cdc4a5..434a089f 100644 --- a/portal/static/css/onelab.css +++ b/portal/static/css/onelab.css @@ -74,34 +74,6 @@ span.label { } -div#secondary { - -} - -div#secondary ul { - position:absolute; - top:8px; - right:0; -} - -div#secondary li { - font-size:9pt; - float:left; - list-style:none; - margin-right:30px; - color:gray; -} -div#secondary li a { - color:gray; -} -div#secondary li a:hover { - color:#270A5A; - text-decoration:none; -} -div#secondary li:last-child { - margin-right:0; -} - div#navigation { background-color:black; width:100%; @@ -153,27 +125,25 @@ div#navigation li.slices { position:relative; cursor:pointer; } -div#navigation .dropdown-menu { - color:white; +div.navigation .dropdown-menu { + color:black; padding:0 15px 15px 15px; margin-top:5px; margin-left:-16px; - background-color:black; } -div#navigation .dropdown-menu a { - color:white; +div.navigation .dropdown-menu a { + color:black; } -div#menu-slice-list{ +div.menu-slice-list { display:none; position:absolute; - background-color:black; padding:15px; left:-15px; z-index:10; } -div#navigation .dropdown-menu li:first-child { +div.navigation .dropdown-menu li:first-child { border-bottom:1px solid white; padding-bottom:5px; @@ -479,6 +449,13 @@ div.dataTables_filter label{ } /**/ +.header { + -moz-box-shadow: 0 0 1px rgba(82,82,82,0.6); + -webkit-box-shadow: 0 0 1px rgba(82,82,82,0.6); + box-shadow: 0 0 1px rgba(82,82,82,0.6); + height:61px; + background-color:white; +} div.navigation { } @@ -493,7 +470,7 @@ div.navigation ul { div.navigation li { color:#0C0047; font-family:open_sansbold, sans-serif; - font-size:10pt; + font-size:9pt; font-weight:normal; line-height:0.8em; letter-spacing:0.4pt; @@ -516,6 +493,51 @@ div.navigation li a:hover, div.navigation li a.current { div.navigation li:last-child { margin-right:0; } +div.secondary { + text-align:right; +} + +div.secondary ul { + margin:6px 0 0 0; + padding:0; +} + +div.secondary li { + font-size:9pt; + display:inline; + list-style:none; + margin:0px; + padding:0; + margin-right:15px; + color:#747474; + letter-spacing:0.4px; +} +div.secondary li:last-child { + margin-right:0; +} +div.secondary li a { + color:#747474; +} +div.secondary li a:hover { + text-decoration:none; +} +div.secondary .button { + width:300px; + margin-top:15px; +} +div.secondary .account { + margin-top:10px; + padding:0; + font-size:9pt; + color:gray; + text-align:right; +} +div.secondary .account span { + font-size:8pt; +} +div.secondary .account a { + color:black; +} div.home { font-size:11pt; line-height:1.2em; @@ -537,6 +559,17 @@ div.home h3 { color:white; line-height:1.4em; } +div.dashboard { + text-align:center; +} +div.dashboard div { + margin:25px 0; +} +div.dashboard ul { + text-align:left; + margin-left:24px; + list-style:none; +} div.registration-form { padding-top:150px; text-align:center; diff --git a/portal/templates/account-view.html b/portal/templates/account-view.html index 353a83c2..7b106d95 100644 --- a/portal/templates/account-view.html +++ b/portal/templates/account-view.html @@ -30,7 +30,7 @@ @@ -127,7 +127,7 @@ {%if 'N/A' not in user_private_key%} - {%else%} - {%endif%} - + + {%if 'N/A' not in user_private_key%} + + + {%else%} + + + {%endif%} + +
-
Platform: Myslice
+
Platforms: Myslice
Private Key ******** + ******** @@ -136,7 +136,7 @@ Private Key ******** + ******** @@ -144,7 +144,24 @@
Identity + + Identity + +

Tradeoff: Ease-of-use vs Security.
Ease-of-use: Automatic account delegation. Don't delete private key.
diff --git a/portal/templates/contact.html b/portal/templates/contact.html index 722c29df..d9d2c518 100644 --- a/portal/templates/contact.html +++ b/portal/templates/contact.html @@ -24,8 +24,7 @@

-
-
+
{% csrf_token %} {% for field in form %} @@ -34,7 +33,7 @@ {{ field.errors }} {{ field }}
{% endfor %} - +
diff --git a/portal/templates/onelab/onelab_account-view.html b/portal/templates/onelab/onelab_account-view.html new file mode 100644 index 00000000..a0806070 --- /dev/null +++ b/portal/templates/onelab/onelab_account-view.html @@ -0,0 +1,322 @@ +{% extends "layout_wide.html" %} +{% block content %} + + +{% if messages %} +
    + {% for message in messages %} + {{ message }} + {% endfor %} +
+{% endif %} + +
+
+ +
+ +
+ {% csrf_token %} + + + + + + + + + + + + + + + + + + + + + {%if 'Enabled' in user_status %} + + + + + + + + + + {%if 'N/A' not in user_private_key%} + + + {%else%} + + + {%endif%} + + + + + {%endif%} +
+
Platforms: Myslice
+
Email + {{ person.email }} + +
Password + + ******** + + + + + + + + + + + + +
Enter password:
Confirm password: + + +
+
+
Full Name + {{ fullname }} + + +
+ + + +
+ +
Authority + {{ authority }} + +
Generate Keys + +
Public Key + ******** + + +
+
+ + +
+
+ + +
Private Key ******** + + + Private Key ******** + + +
+

Tradeoff: Ease-of-use vs Security.
+ Ease-of-use: Automatic account delegation. Don't delete private key.
+ Security: Manual account delegation. Download & Delete private key. +

+
+ +
+
+ +
+
+ +

Principal Account Account used for delegating credentials

+ + + + + + + + + + {% for row in principal_acc %} + + + + + + + + + {%endfor%} +
PlatformAccount TypeAccount DelegationUser hrnUser Status
{{ row.platform_name }} {{ row.account_type }} {{ row.delegation_type }} {{ row.usr_hrn }} {{ row.user_status }}
+ +
+ + + {%if 'Enabled' in user_status %} +
+

Credentials Delegated to Principal Account

+ + + + + + + {% for row in my_users %} + + + + + {%endfor%} +
Delegated User Credential
Expiration DateDownload
{{ row.cred_exp }} + +
+

+ + + + + + + + {% for row in my_slices %} + + + + + + {%endfor%} +
Delegated Slice Credentials
Slice NameExpiration DateDownload
{{ row.slice_name }} {{ row.cred_exp }} + +
+

+ + + + + + + + {% for row in my_auths %} + + + + + + {%endfor%} +
Delegated Authority Credentials
Authority NameExpiration DateDownload
{{ row.auth_name }} {{ row.cred_exp }} + +
+

+ {%if '' not in my_users%} +

+ {%else%} +

+ {%endif%} +
+
+ +
+
+ +

Testbed Access Reference Accounts in the following testbeds

+ + + + + + + + {% for row in ref_acc %} + + + + + + + {%endfor%} +
PlatformAccount TypeReference toRemove Account
{{ row.platform_name }} {{ row.account_type }} {{ row.account_reference }} + +
+ + +

Add reference account to the following testbeds

+ + + + + + {% for platform in platform_list %} + + + + + {%endfor%} +
PlatformsAdd Account
{{ platform.platform_no_access }} + +
+
+{%endif%} +
+ +
+ + + +{% endblock %} diff --git a/portal/templates/onelab/onelab_home-view.html b/portal/templates/onelab/onelab_home-view.html index 5fb5dcf6..11fa2ee3 100644 --- a/portal/templates/onelab/onelab_home-view.html +++ b/portal/templates/onelab/onelab_home-view.html @@ -5,6 +5,64 @@ +{% if username %} +
+
+
+

+ EXPERIMENT +

+
+ +
+
+ +
+
+
Loading Slices
+
+
+
+

MANAGEMENT

+
+ +
+
+ +
+
+
+

+ SUPPORT +

+
+ +
+
+ +
+
+ +
+

+ ACCOUNT +

+
+ +
+
+ +
+
+ {% if person.last_name %} + {{person.first_name}} {{person.last_name}}
+ {% endif %} + Email: {{person.email}} +
+
+
+
+{% else %}
@@ -17,33 +75,15 @@
- {% if person %} -
- -
- {% if person.last_name %} - {{person.first_name}} {{person.last_name}}
- {% endif %} - Email: {{person.email}} -
-
- {% else %}
{% widget '_widget-login-user.html' %}
- {% endif %} - - {% if person %} - -
Loading Slices
- {% else %} - {% endif %} - -
+{% endif %} +