Commit 809e1671 authored by Roque Porchetto's avatar Roque Porchetto

Download button for embulk script.

parent 126dc380
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
</head> </head>
<body> <body>
DOWNLOAD ACCESS GADGET <form name='download'>
<div data-gadget-scope="download_access" <input type="submit" value="Download" download='FileName' />
data-gadget-sandbox="public"> <span style="margin-left:30px" > RUN COMMAND: <b style="margin-left:10px" > pull <span id="dataset_reference"/> </b> </span>
</div> </form>
</body> </body>
</html> </html>
\ No newline at end of file
/*global window, rJS, RSVP, URI */ /*global window, rJS, RSVP, URI */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) { (function (window, document, RSVP, rJS,
XMLHttpRequest, location, console) {
"use strict"; "use strict";
function download(context, evt) {
var link = document.createElement('a');
link.download = "download_script.zip";
link.href = "https://softinst75195.host.vifib.net/erp5/data_stream_module/embulk_download_script/getData";
link.click();
//var url = "https://softinst75195.host.vifib.net/erp5/data_stream_module/embulk_download_script/getData";
//window.location.replace(url);
}
rJS(window) rJS(window)
//.declareAcquiredMethod("updateHeader", "updateHeader") .allowPublicAcquisition('setFillStyle', function () {
.declareMethod("render", function () { return {
var gadget = this; height: '100%',
console.log("Render method of download access gadget"); width: '100%'
return new RSVP.Queue() };
/*.push(function () { })
return gadget.getDeclaredGadget("gadget_fif_page_list_dataset"); .declareJob('download', function (evt) {
}) return download(this, evt);
.push(function (my_gadget) { })
return my_gadget.render(); .declareMethod("render", function (reference) {
}) return this.changeState({"dataset_reference" : reference});
.push(function () { })
return gadget.updateHeader({ /*.onStateChange(function (modification_dict) {
page_title: 'TELECOM WENDELIN PROJECT' console.log("STATUS CHANGED !!");
}); })*/
})*/ .declareService(function () {
.push(undefined, function (error) { document.getElementById("dataset_reference").innerHTML = this.state.dataset_reference;
throw error; })
}); /*.ready(function () {
console.log("DOM LOADED!");
})*/
.onEvent('submit', function (evt) {
if (evt.target.name === 'download') {
return this.download(evt);
} else {
throw new Error('Unknown form');
}
}); });
}(window, rJS, RSVP)); }(window, document, RSVP, rJS,
\ No newline at end of file XMLHttpRequest, location, console));
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
data-gadget-scope="form_view" data-gadget-scope="form_view"
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
<div data-gadget-url="gadget_erp5_download_access.html" <div style="margin-top:20px" data-gadget-url="gadget_erp5_download_access.html"
data-gadget-scope="download_access" data-gadget-scope="download_access"
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
......
...@@ -100,6 +100,12 @@ ...@@ -100,6 +100,12 @@
}) })
.push(function (my_gadget) { .push(function (my_gadget) {
return my_gadget.render(result); return my_gadget.render(result);
})
.push(function () {
return gadget.getDeclaredGadget("download_access");
})
.push(function (my_gadget) {
return my_gadget.render(gadget.state.reference);
}); });
}); });
}); });
......
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