Commit 88a9550f authored by Roque's avatar Roque

erp5_wendelin_data_lake_ui: cleanup and fixes

- remove hardcoded relative urls
- use renderJS API to properly get the links urls
- fix html titles
- fix headers
- JSLint cleanup
parent 8616423e
......@@ -10,8 +10,7 @@
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script
<script src="gadget_global.js" type="text/javascript"></script> -->
<!-- custom script -->
<script src="gadget_erp5_download_access.js" type="text/javascript"></script>
</head>
......@@ -19,15 +18,14 @@
<div class="download-access">
<form name='download-tool'>
<p class="bottom"><a href="#/?page=download">Download ebulk</a></p>
<p class="bottom"><a id="download_link">Download ebulk</a></p>
<p class="bottom"><b><a href="#/?page=register">Register</a></b> to get a fully functional user!</p>
<p class="bottom"><b><a id="register_link">Register</a></b> to get a fully functional user!</p>
<p class="bottom"> and run command: <b class="ident"> ebulk <span id="dataset_reference"/>push <i>my-data-set</i></b></p>
</form>
</div>
</body>
</html>
\ No newline at end of file
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.1424.28928.61559</string> </value>
<value> <string>985.7487.30380.53572</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1562919500.08</float>
<float>1594222417.38</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,22 +3,15 @@
(function (window, document, RSVP, rJS,
XMLHttpRequest, location, console) {
"use strict";
function download_tool(context, evt) {
var link = document.createElement('a');
link.href = window.location.origin + "/erp5/web_site_module/fif_data_runner/#/?page=download";
link.click();
}
rJS(window)
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.allowPublicAcquisition('setFillStyle', function () {
return {
height: '100%',
width: '100%'
};
})
.declareJob('download_tool', function (evt) {
return download_tool(this, evt);
})
.declareMethod("render", function (reference) {
var html = "pull <i>" + reference + "</i>";
if (reference === undefined)
......@@ -26,14 +19,25 @@
return this.changeState({"dataset_reference" : html});
})
.declareService(function () {
var gadget = this,
url_parameter_list = [];
document.getElementById("dataset_reference").innerHTML = this.state.dataset_reference;
url_parameter_list.push({
command: 'display_stored_state',
options: {page: 'download'}
});
url_parameter_list.push({
command: 'display_stored_state',
options: {page: 'register'}
});
return gadget.getUrlForList(url_parameter_list)
.push(function (url_list) {
document.querySelector("#download_link").href = url_list[0];
document.querySelector("#register_link").href = url_list[1];
})
.onEvent('submit', function (evt) {
if (evt.target.name === 'download-tool') {
return this.download_tool(evt);
} else {
throw new Error('Unknown form');
}
.push(undefined, function (error) {
throw error;
});
});
}(window, document, RSVP, rJS,
XMLHttpRequest, location, console));
\ No newline at end of file
......@@ -71,7 +71,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -240,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.10968.63773.24814</string> </value>
<value> <string>985.7487.14593.50210</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1536571801.32</float>
<float>1594222385.74</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -25,10 +25,10 @@
.allowPublicAcquisition('updateHeader', function (argument_list) {
var header_dict = {
page_title: "Data Set : " + this.state.document_title,
selection_url: argument_list[0].selection_url,
selection_url: argument_list[0].selection_url
//next_url: argument_list[0].next_url,
//previous_url: argument_list[0].previous_url,
actions_url: argument_list[0].actions_url
//actions_url: argument_list[0].actions_url
};
return this.updateHeader(header_dict);
})
......
......@@ -71,7 +71,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -244,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>969.16316.40169.55057</string> </value>
<value> <string>983.63603.62266.8260</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1532962171.47</float>
<float>1594223527.37</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -18,7 +18,7 @@
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('getUrlFor', function (argument_list) {
if (argument_list[0].command === 'change') {
if (argument_list[0].options.page == "action") {
if (argument_list[0].options.page === "action") {
return this.getUrlFor({command: 'change', options: {page: "fif_action"}});
}
}
......@@ -27,15 +27,24 @@
.allowPublicAcquisition('updateHeader', function (argument_list) {
var header_dict = {
page_title: "File : " + this.state.document_title,
selection_url: argument_list[0].selection_url,
selection_url: argument_list[0].selection_url
//next_url: argument_list[0].next_url,
//previous_url: argument_list[0].previous_url,
actions_url: argument_list[0].actions_url
//actions_url: argument_list[0].actions_url
};
return this.updateHeader(header_dict);
})
.onStateChange(function () {
var gadget = this;
var gadget = this,
akey,
table,
array,
i,
j,
newRow,
cell,
nkey,
side;
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
var view_dict = {},
......@@ -54,30 +63,28 @@
};
group_list.push(["right", [["my_reference"]]]);
if (metadata !== undefined) {
if (Object.keys(metadata).length == 1) {
var akey = Object.keys(metadata)[0];
if (akey == "csv") {
var table = document.getElementById("csv_table"),
if (Object.keys(metadata).length === 1) {
akey = Object.keys(metadata)[0];
if (akey === "csv") {
table = document.getElementById("csv_table");
array = metadata[akey];
document.getElementById("text_content_title").innerHTML = "CSV file content sample:";
for (var i = 0; i < array.length; i++) {
var newRow = table.insertRow(table.length);
for (var j = 0; j < array[i].length; j++) {
var cell = newRow.insertCell(j);
for (i = 0; i < array.length; i++) {
newRow = table.insertRow(table.length);
for (j = 0; j < array[i].length; j++) {
cell = newRow.insertCell(j);
cell.innerHTML = array[i][j];
}
}
}
else {
} else {
document.getElementById("text_content_title").innerHTML = akey;
document.getElementById("text_content").innerHTML = metadata[akey];
}
}
else {
var nkey = 0;
} else {
nkey = 0;
for (var key in metadata) {
if (metadata.hasOwnProperty(key)) {
var side = (nkey % 2 === 0) ? "left" : "right";
side = (nkey % 2 === 0) ? "left" : "right";
view_dict[key] = {
"title": key,
"default": metadata[key],
......@@ -90,12 +97,12 @@
}
}
else {
view_dict["my_metadata"] = {
view_dict.my_metadata = {
"title": "Metadata",
"default": "Could not find metadata for this file",
"key": "field_my_metadata"
};
group_list.push(["left",[["my_metadata"]]])
group_list.push(["left", [["my_metadata"]]]);
}
return form_gadget.render({
erp5_document: {"_embedded": {"_view": view_dict},
......@@ -119,16 +126,17 @@
xmlHttp.send(null);
return xmlHttp.responseText;
}
catch(err) {
console.log("URL error: " + err)
catch (err) {
console.log("URL error: " + err);
return "";
}
})
.declareMethod("render", function (options) {
var gadget = this;
var gadget = this,
file_info;
return gadget.jio_get(options.jio_key)
.push(function (result) {
var file_info = result;
file_info = result;
return gadget.getDescriptorContent(file_info.reference)
.push(function (htmlContent) {
return gadget.changeState({"document_title" : file_info.title,
......@@ -139,13 +147,13 @@
})
.declareService(function () {
try {
var json_dict = JSON.parse(this.state.textcontent)
var json_dict = JSON.parse(this.state.textcontent);
return this.changeState({"metadata" : json_dict });
}
catch(err) {
console.log("Error reading Data Descriptor JSON: " + err)
return
catch (err) {
console.log("Error reading Data Descriptor JSON: " + err);
return;
}
return this.changeState({"metadata" : json_dict });
});
}(window, rJS, document, RSVP, calculatePageTitle, jIO));
......
......@@ -71,7 +71,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -238,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>984.982.33861.30037</string> </value>
<value> <string>985.7595.39398.9506</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1589986197.54</float>
<float>1594228616.34</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>BIG DATA SHARING PLATFORM</title>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WENDELIN DATA LAKE SHARING PLATFORM - HOME</title>
<!-- styles -->
<link rel="stylesheet" href="fif_gadget_erp5.css">
<link rel="stylesheet" type="text/css" href="fif_gadget_erp5.css">
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_home.js" type="text/javascript"></script>
<script src="gadget_erp5_page_home.js"></script>
</head>
</head>
<body>
<body>
<div class="homepage">
<div class="header">
<a href="#/?page=home">
<a id="home_link">
<img src="telecom-nexedi-logos?display=svg" alt="BigData Home">
</a>
<p>Wendelin Data Lake Sharing Platform</p>
......@@ -41,19 +39,19 @@
</div>
<h1>Data lake</h1>
<p>Dozens of public and private big data sets are available in the platform, terabytes of data of any kind, including binaries like medical images, ndarrays and more. Do you want to download data sets or share your data? <a href="#/?page=download">Download</a> our Ebulk tool to transfer big data! </p>
<p>Dozens of public and private big data sets are available in the platform, terabytes of data of any kind, including binaries like medical images, ndarrays and more. Do you want to download data sets or share your data? <a id="download_link">Download</a> our Ebulk tool to transfer big data! </p>
<div class="half vertical-child">
<p>See our full data set list!</p>
<a href="#/?page=fifdata">
<p><a id="dataset_link">See our full data set list!</a></p>
<a id="dataset_link_img">
<img src="dataset-icon?display=svg" alt="dataset icon">
</a>
<p><a href="#/?page=register">Register to get full functionality.</a></p>
<p><a id="register_link">Register to get full functionality.</a></p>
<p><span class="contact-link"></span></p>
</div>
<h1>Ebulk tool</h1>
<p>Ebulk tool is a wrapper for <a target="_blank" href="http://www.embulk.org/docs/">Embulk</a>, an open-source bulk data loader that helps data transfer between various databases, storages, file formats, and cloud services. It supports any kind of input file formats, parallel and distributed execution to deal with big data sets, transaction control to guarantee All-or-Nothing file transfer, and operation resuming. Ebulk is as easy as git to use, allowing the big data transfering to be done by using very few commands. Please, <a href="#/?page=download">download</a> Ebulk and check the <a href="#/?page=ebulk_doc">documentation</a>.</p>
<p>Ebulk tool is a wrapper for <a target="_blank" href="http://www.embulk.org/docs/">Embulk</a>, an open-source bulk data loader that helps data transfer between various databases, storages, file formats, and cloud services. It supports any kind of input file formats, parallel and distributed execution to deal with big data sets, transaction control to guarantee All-or-Nothing file transfer, and operation resuming. Ebulk is as easy as git to use, allowing the big data transfering to be done by using very few commands. Please, <a id="download_ebulk_link">download</a> Ebulk and check the <a id="documentation_link">documentation</a>.</p>
<h1>Wendelin</h1>
<p><a target="_blank" href="https://wendelin.nexedi.com/">Wendelin</a> is a big data framework designed for industrial applications based on python, NumPy, Scipy and other NumPy based libraries. It uses at its core the NEO distributed transactional NoSQL database to store petabytes of binary data. Wendelin combines the performance of scikit-learn machine learning with NEO distributed storage in order to provide out-of-core processing of large data sets. Its goal is to bring the best open source, big data engine based on Numpy python technologies and gather a wide community of contributors of new data analytics algorithms.</p>
......@@ -68,5 +66,5 @@
</ul>
</div>
</body>
</body>
</html>
\ No newline at end of file
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.26217.31457.36573</string> </value>
<value> <string>985.7476.59155.53896</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1564407041.42</float>
<float>1594221622.21</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, URI */
/*global window, rJS, URI, document */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, document) {
(function (window, rJS, document) {
"use strict";
function data_lake(context, evt) {
var link = document.createElement('a');
link.href = window.location.origin + "/erp5/web_site_module/fif_data_runner/#/?page=fifdata";
link.click();
}
rJS(window)
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareJob('data_lake', function (evt) {
return data_lake(this, evt);
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareMethod("render", function (options) {
return this.changeState(options);
})
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.updateHeader({
.onStateChange(function () {
return this.updateHeader({
page_title: 'Wendelin Data Lake Sharing Platform'
});
})
.declareService(function () {
var gadget = this,
url_parameter_list = [];
url_parameter_list.push({
command: 'display'
});
url_parameter_list.push({
command: 'display_stored_state',
options: {page: 'download'}
});
url_parameter_list.push({
command: 'display_stored_state',
options: {page: 'fifdata'}
});
url_parameter_list.push({
command: 'display_stored_state',
options: {page: 'register'}
});
url_parameter_list.push({
command: 'display_stored_state',
options: {page: 'ebulk_doc'}
});
return gadget.getUrlForList(url_parameter_list)
.push(function (url_list) {
document.querySelector("#home_link").href = url_list[0];
document.querySelector("#download_link").href = url_list[1];
document.querySelector("#download_ebulk_link").href = url_list[1];
document.querySelector("#dataset_link").href = url_list[2];
document.querySelector("#dataset_link_img").href = url_list[2];
document.querySelector("#register_link").href = url_list[3];
document.querySelector("#documentation_link").href = url_list[4];
})
.push(undefined, function (error) {
throw error;
});
})
.onEvent('submit', function (evt) {
if (evt.target.name === 'data-lake') {
return this.data_lake(evt);
} else {
throw new Error('Unknown form');
}
});
}(window, rJS, RSVP, document));
\ No newline at end of file
});
}(window, rJS, document));
\ No newline at end of file
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.34131.824.20292</string> </value>
<value> <string>985.7597.28546.5683</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1561465018.46</float>
<float>1594228670.03</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>TELECOM NEXEDI WENDELIN IA PROJECT</title>
<title>WENDELIN DATA LAKE SHARING PLATFORM - DATASET LIST</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.52031.55611.27340</string> </value>
<value> <string>985.7478.10187.22835</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1542881345.5</float>
<float>1594221604.04</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,14 +9,6 @@
.declareMethod("render", function () {
var gadget = this;
return new RSVP.Queue()
/*.push(function () {
return gadget.jio_allDocs({
query: 'portal_type:"Data Array"' +
' AND validation_state:"validated"',
select_list: ["title", "reference"],
limit: [0, 1000000]
});
})*/
.push(function () {
return gadget.getDeclaredGadget("gadget_fif_page_list_dataset");
})
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.41250.17185.10854</string> </value>
<value> <string>983.63603.62266.8260</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1561463216.84</float>
<float>1594221507.22</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Register</title>
<title>WENDELIN DATA LAKE SHARING PLATFORM - REGISTER</title>
<!-- styles -->
<link rel="stylesheet" href="fif_gadget_erp5.css">
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.10261.58373.1809</string> </value>
<value> <string>985.7500.2038.6246</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1563449676.86</float>
<float>1594222815.79</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -21,9 +21,14 @@
// declared methods
/////////////////////////////////////////////////////////////////
//.declareMethod("render", function (options) {
//})
.declareMethod("render", function (options) {
return this.changeState(options);
})
.onStateChange(function () {
return this.updateHeader({
page_title: 'Register'
});
})
.onEvent('submit', function (evt) {
var gadget = this,
first_name = document.getElementById("first_name").value,
......@@ -34,7 +39,7 @@
confirm_password = document.getElementById("confirm_password").value;
if ((validateEmail(email)) && (first_name) && (last_name) && (reference) && (password) && (confirm_password) && (password === confirm_password) ) {
if ((validateEmail(email)) && (first_name) && (last_name) && (reference) && (password) && (confirm_password) && (password === confirm_password)) {
/* send to server */
var url = "ERP5Site_newCredentialRequest?batch_mode=1&reference=" + reference + "&default_email_text=" + email + "&first_name=" + first_name + "&last_name=" + last_name + "&password=" + password;
......@@ -66,7 +71,7 @@
page: "home"
}
});
})
});
} else {
return gadget.notifySubmitted({message: 'Misformatted email and / or passwords not matching. Please note that all fields are required!', status: 'error'});
}
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.10298.62565.9932</string> </value>
<value> <string>985.7506.43884.63931</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1563451951.09</float>
<float>1594223341.64</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Fif Page List Data Set</title>
<title>WENDELIN DATA LAKE SHARING PLATFORM - DATASET LIST</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.5384.26701.42410</string> </value>
<value> <string>983.63603.62266.8260</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1543928481.09</float>
<float>1594221691.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>984.959.26850.28842</string> </value>
<value> <string>984.52806.51617.21333</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1593095447.25</float>
<float>1594229222.71</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -41,7 +41,7 @@
})
.declareMethod("render", function (options) {
var gadget = this,
dataset = (options) ? options.reference : "",
dataset = options ? options.reference : "",
header_dict = {
page_title: 'Files',
filter_action: true
......
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