Commit cb9e41d5 authored by Matevz Golob's avatar Matevz Golob

uncomment unneccessary steps

parent 0343780d
...@@ -229,6 +229,7 @@ ...@@ -229,6 +229,7 @@
<td></td> <td></td>
</tr> </tr>
<!-- (2.2) Create Web Page Gadgets --> <!-- (2.2) Create Web Page Gadgets -->
<!-- (2.2.1) html gadget -->
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/</td> <td>${base_url}/</td>
...@@ -324,7 +325,6 @@ ...@@ -324,7 +325,6 @@
<td>Published Alive</td> <td>Published Alive</td>
<td></td> <td></td>
</tr> </tr>
<!-- Add Text for html gadget -->
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>//div[@class="actions"]/ul/li[2]/a</td> <td>//div[@class="actions"]/ul/li[2]/a</td>
...@@ -338,17 +338,29 @@ ...@@ -338,17 +338,29 @@
<tr> <tr>
<td>type</td> <td>type</td>
<td>//*[@data-gadget-editable="field_my_text_content"]</td> <td>//*[@data-gadget-editable="field_my_text_content"]</td>
<td tal:content="python: '%s' % ('''&lt;html&gt; <td tal:content="python: '%s' % ('''&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt; &lt;head&gt;
&lt;meta http-equiv='Content-type' content='text/html; charset=utf-8' /&gt; &lt;meta http-equiv='Content-type' content='text/html; charset=utf-8' /&gt;
&lt;meta name='viewport' content='width=device-width, user-scalable=no' /&gt; &lt;meta name='viewport' content='width=device-width, user-scalable=no' /&gt;
&lt;title&gt;PyData Graph&lt;/title&gt; &lt;title&gt;PyData Graph&lt;/title&gt;
<!-- renderjs -->
&lt;script src='rsvp.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='rsvp.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;script src='renderjs.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='renderjs.js' type='text/javascript'&gt;&lt;/script&gt;
<!-- custom script -->
&lt;script src='dygraph.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;script src='gadget_global.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='gadget_global.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;script src='gadget_erp5_page_pydata.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='gadget_erp5_page_pydata.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;/head&gt; &lt;/head&gt;
&lt;body&gt; &lt;body&gt;
&lt;div class='custom-grid-wrap'&gt;
&lt;div class='custom-grid ui-corner-all ui-body-inherit ui-shadow ui-corner-all'&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div data-gadget-url='gadget_ndarray.html'
data-gadget-scope='ndarray'
data-gadget-sandbox='public'&gt;
&lt;/div&gt;
&lt;/body&gt; &lt;/body&gt;
&lt;/html&gt;''')"> </td> &lt;/html&gt;''')"> </td>
</tr> </tr>
...@@ -362,7 +374,7 @@ ...@@ -362,7 +374,7 @@
<td>Data updated.</td> <td>Data updated.</td>
<td></td> <td></td>
</tr> </tr>
<!-- end --> <!-- (2.2.2) javascript gadget -->
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}</td> <td>${base_url}</td>
...@@ -453,7 +465,6 @@ ...@@ -453,7 +465,6 @@
<td>Published Alive</td> <td>Published Alive</td>
<td></td> <td></td>
</tr> </tr>
<!-- Add text for js gadget -->
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>//*[@id="master"]/div/div[1]/ul/li[2]/a</td> <td>//*[@id="master"]/div/div[1]/ul/li[2]/a</td>
...@@ -466,34 +477,155 @@ ...@@ -466,34 +477,155 @@
</tr> </tr>
<tr> <tr>
<td>type</td> <td>type</td>
<td>//*[@id="master"]/div/div[2]/fieldset[2]/div/div/div/textarea</td> <td>//*[@data-gadget-editable="field_my_text_content"]</td>
<td>/*global window, rJS, RSVP, URI */ <td>/*global window, rJS, console, RSVP, Dygraph */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, URI) { (function (rJS) {
"use strict"; "use strict";
var ARRAY_VALUE_LENGTH = 8,
OPTION_DICT = {
start_date: 0,
time_factor: 1000,
resolution: 1,
xlabel: 'x',
ylabel: 'y',
key_list: ["Channel 1", "Date"],
label_list: ["Date", "Channel 1"],
series_dict: {
"Channel 1": {
axis : "y",
color: "#00884B",
pointSize: 1,
visible : true,
connectSeparatedPoints: true
}
},
axis_dict: {
y: {
position : "left",
axisLabelColor: "grey",
axisLabelWidth : 40,
pixelsPerLabel : 30
},
x: {
drawAxis : true,
axisLabelWidth : 60,
axisLabelColor: "grey",
pixelsPerLabel : 30
}
},
connectSeparatedPoints: true
};
function generateInitialGraphData(label_list) {
var i,
data = [[]];
for (i = 0; i &lt; label_list.length; i += 1) {
data[0].push(0);
}
return data;
}
function convertDateColToDate(gadget, array) {
var label_list = gadget.property_dict.option_dict.label_list,
time_factor = gadget.property_dict.option_dict.time_factor,
time_offset = gadget.property_dict.option_dict.time_offset || 0,
i,
k;
for (k = 0; k &lt; label_list.length; k += 1) {
if (label_list[k] === "Date") {
for (i = 0; i &lt; array.length; i += 1) {
array[i] = [i, array[i]];
}
}
}
return array;
}
rJS(window) rJS(window)
// Init local properties
.ready(function (g) { .ready(function (gadget) {
g.props = {}; gadget.property_dict = {};
}) return gadget.getElement()
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) { .push(function (element) {
g.props.element = element; gadget.property_dict.element = element;
gadget.property_dict.option_dict = OPTION_DICT;
}); });
}) })
// Acquired methods
.declareAcquiredMethod("updateHeader", "updateHeader")
// declared methods .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareMethod("render", function () {
var gadget = this; // render gadget
return gadget.updateHeader({ .declareMethod('render', function () {
page_title: 'PyData' var gadget = this,
interaction_model = Dygraph.Interaction.defaultModel,
option_dict = {},
url;
url = "${base_url}/web_site_module/pydata_runner/hateoas/data_array_module/12";
return new RSVP.Queue()
.push(function () {
return gadget.jio_getAttachment("erp5", url, {
start : 0,
format : "array_buffer"
});
})
.push(function (buffer) {
var array_length,
length,
array,
array_width = 1;
array_length = Math.floor(
buffer.byteLength / array_width / ARRAY_VALUE_LENGTH
);
length = buffer.byteLength - (buffer.byteLength % ARRAY_VALUE_LENGTH);
if (length === buffer.byteLength) {
array = new Float64Array(buffer);
} else {
array = new Float64Array(buffer, 0, length);
}
return nj.ndarray(array, [array_length, array_width]);
}) })
.push(function (result) {
var i,
data = [],
ndarray = result,
label_list = gadget.property_dict.option_dict.label_list,
key_list = gadget.property_dict.option_dict.key_list;
for (i = 1; i &lt; label_list.length; i += 1) {
data = data.concat(
nj.unpack(
ndarray.pick(
null,
key_list.indexOf(label_list[i])
)
)
);
}
data = convertDateColToDate(gadget, data);
gadget.property_dict.data = data;
return gadget
}); });
}(window, rJS, RSVP, URI));</td> })
.declareService(function () {
var gadget = this;
return gadget.property_dict.graph = new Dygraph(
gadget.property_dict.element,
gadget.property_dict.data,
gadget.property_dict.option_dict
);
});
}(rJS));</td>
</tr> </tr>
<tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
...@@ -505,8 +637,7 @@ ...@@ -505,8 +637,7 @@
<td>Data updated.</td> <td>Data updated.</td>
<td></td> <td></td>
</tr> </tr>
<!-- end --> <!-- <tr>
<tr>
<td>open</td> <td>open</td>
<td>${base_url}</td> <td>${base_url}</td>
<td></td> <td></td>
...@@ -536,7 +667,7 @@ ...@@ -536,7 +667,7 @@
<td>//*[@name="form_id" and @value="WebPage_view"]</td> <td>//*[@name="form_id" and @value="WebPage_view"]</td>
<td></td> <td></td>
</tr> </tr>
<!-- <tr> <tr>
<td>clickAndWait</td> <td>clickAndWait</td>
<td>//*[@id="master"]/div/div[1]/ul/li[2]/a</td> <td>//*[@id="master"]/div/div[1]/ul/li[2]/a</td>
<td></td> <td></td>
...@@ -572,8 +703,8 @@ ...@@ -572,8 +703,8 @@
<td>verifyTextPresent</td> <td>verifyTextPresent</td>
<td>Data updated.</td> <td>Data updated.</td>
<td></td> <td></td>
</tr> --> </tr>
<!-- <tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}</td> <td>${base_url}</td>
<td></td> <td></td>
...@@ -669,7 +800,7 @@ ...@@ -669,7 +800,7 @@
<td>PyData</td> <td>PyData</td>
<td></td> <td></td>
</tr> </tr>
<tr> <!-- <tr>
<td>open</td> <td>open</td>
<td>${base_url}</td> <td>${base_url}</td>
<td></td> <td></td>
...@@ -719,10 +850,10 @@ ...@@ -719,10 +850,10 @@
&lt;meta name='viewport' content='width=device-width, user-scalable=no' /&gt; &lt;meta name='viewport' content='width=device-width, user-scalable=no' /&gt;
&lt;title&gt;PyData Graph&lt;/title&gt; &lt;title&gt;PyData Graph&lt;/title&gt;
<!-- renderjs -->
&lt;script src='rsvp.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='rsvp.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;script src='renderjs.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='renderjs.js' type='text/javascript'&gt;&lt;/script&gt;
<!-- custom script -->
&lt;script src='dygraph.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='dygraph.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;script src='gadget_global.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='gadget_global.js' type='text/javascript'&gt;&lt;/script&gt;
&lt;script src='gadget_erp5_page_pydata.js' type='text/javascript'&gt;&lt;/script&gt; &lt;script src='gadget_erp5_page_pydata.js' type='text/javascript'&gt;&lt;/script&gt;
...@@ -959,7 +1090,7 @@ ...@@ -959,7 +1090,7 @@
<td>pause</td> <td>pause</td>
<td>15000</td> <td>15000</td>
<td></td> <td></td>
</tr> </tr> -->
</tbody> </tbody>
</table> </table>
......
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