Commit 7beae64a authored by Roque's avatar Roque

erp5_wendelin_data_lake*: show logged in user

- server script and ui changes
parent 88a9550f
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getUserName</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -45,6 +45,11 @@
<h1 class="ui-title"></h1>
<div id="logged_in_div" class="ui-screen-hidden" style="padding-left: 24pt;">
<span>Logged In as :</span>
<span id="logged_in_user"/>
</div>
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">
<div class="ui-controlgroup-controls">
</div>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.3959.36662.38195</string> </value>
<value> <string>985.18880.54279.1672</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1543842714.3</float>
<float>1594905686.52</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, Handlebars, document, RSVP */
/*global window, rJS, Handlebars, document, RSVP, jIO, URL */
(function (window, rJS, Handlebars, document, RSVP) {
"use strict";
......@@ -139,11 +139,7 @@
title_button_name: options.action
});
})
/*
.declareMethod('notifyUpdate', function () {
return this.render(this.stats.options);
})
*/
.declareMethod('render', function render(options) {
var state = {
error: false,
......@@ -161,6 +157,7 @@
right_button_icon: undefined,
right_button_name: undefined
},
gadget = this,
klass,
sub_header_list = [],
i;
......@@ -232,7 +229,17 @@
}
state.sub_header_list = sub_header_list;
return this.changeState(state);
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
url: new URL('./ERP5Site_getUserName', window.location.href)
});
})
.push(function (result) {
state.user = result.target.response;
return gadget.changeState(state);
});
})
.onStateChange(function onStateChange(modification_dict) {
......@@ -353,6 +360,12 @@
} else {
promise_list.push(null);
}
if (gadget.state.user) {
var logged_in_div = document.querySelector("#logged_in_div"),
logged_in_user = document.querySelector("#logged_in_user");
logged_in_div.classList.remove("ui-screen-hidden");
logged_in_user.innerHTML = gadget.state.user;
}
return new RSVP.Queue()
.push(function () {
......@@ -385,4 +398,4 @@
throw new Error("Unsupported button " + name);
});
}(window, rJS, Handlebars, document, RSVP));
\ No newline at end of file
}(window, rJS, Handlebars, document, RSVP, jIO, URL));
\ No newline at end of file
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>969.59527.36796.52394</string> </value>
<value> <string>985.18881.59706.59153</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1536569733.07</float>
<float>1594905727.52</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment