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

Download button for embulk script.

parent 126dc380
......@@ -14,9 +14,9 @@
</head>
<body>
DOWNLOAD ACCESS GADGET
<div data-gadget-scope="download_access"
data-gadget-sandbox="public">
</div>
<form name='download'>
<input type="submit" value="Download" download='FileName' />
<span style="margin-left:30px" > RUN COMMAND: <b style="margin-left:10px" > pull <span id="dataset_reference"/> </b> </span>
</form>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, URI */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
(function (window, document, RSVP, rJS,
XMLHttpRequest, location, console) {
"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)
//.declareAcquiredMethod("updateHeader", "updateHeader")
.declareMethod("render", function () {
var gadget = this;
console.log("Render method of download access gadget");
return new RSVP.Queue()
/*.push(function () {
return gadget.getDeclaredGadget("gadget_fif_page_list_dataset");
})
.push(function (my_gadget) {
return my_gadget.render();
})
.push(function () {
return gadget.updateHeader({
page_title: 'TELECOM WENDELIN PROJECT'
});
})*/
.push(undefined, function (error) {
throw error;
});
.allowPublicAcquisition('setFillStyle', function () {
return {
height: '100%',
width: '100%'
};
})
.declareJob('download', function (evt) {
return download(this, evt);
})
.declareMethod("render", function (reference) {
return this.changeState({"dataset_reference" : reference});
})
/*.onStateChange(function (modification_dict) {
console.log("STATUS CHANGED !!");
})*/
.declareService(function () {
document.getElementById("dataset_reference").innerHTML = this.state.dataset_reference;
})
/*.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));
\ No newline at end of file
}(window, document, RSVP, rJS,
XMLHttpRequest, location, console));
\ No newline at end of file
......@@ -18,7 +18,7 @@
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</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-sandbox="public">
</div>
......
......@@ -100,6 +100,12 @@
})
.push(function (my_gadget) {
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