Added buttons to download and copy to clipboard task outputs;Added copyTaskoutput function;

pull/539/head
aaj013 2018-10-18 18:14:07 +05:30
rodzic b1aad7cdc4
commit 5be01ae88d
2 zmienionych plików z 57 dodań i 36 usunięć

Wyświetl plik

@ -86,6 +86,16 @@ class Console extends React.Component {
saveAs("data:application/octet-stream," + encodeURIComponent(this.state.lines.join("\r\n")), filename);
}
copyTxt(){
const el = document.createElement('textarea');
el.value = this.state.lines.join("\r\n");
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
console.log("Task output copied to clipboard");
}
tearDownDynamicSource(){
if (this.sourceTimeout) clearTimeout(this.sourceTimeout);
if (this.sourceRequest) this.sourceRequest.abort();

Wyświetl plik

@ -45,6 +45,7 @@ class TaskListItem extends React.Component {
this.startEditing = this.startEditing.bind(this);
this.checkForCommonErrors = this.checkForCommonErrors.bind(this);
this.downloadTaskOutput = this.downloadTaskOutput.bind(this);
this.copyTaskOutput = this.copyTaskOutput.bind(this);
this.handleEditTaskSave = this.handleEditTaskSave.bind(this);
}
@ -205,6 +206,10 @@ class TaskListItem extends React.Component {
this.console.downloadTxt("task_output.txt");
}
copyTaskOutput(){
this.console.copyTxt();
}
optionsToList(options){
if (!Array.isArray(options)) return "";
else if (options.length === 0) return "Default";
@ -497,7 +502,13 @@ class TaskListItem extends React.Component {
ref={domNode => this.console = domNode}
onAddLines={this.checkForCommonErrors}
/>
<a href="javascript:void(0);" onClick={this.downloadTaskOutput} class="btn btn-sm btn-primary pull-right" title="Download task output">
<i class="fa fa-download"></i>
</a>
<a href="javascript:void(0);" onClick={this.copyTaskOutput} class="btn btn-sm btn-primary pull-right" title="Copy task output">
<i class="fa fa-clipboard"></i>
</a>
<div class="clearfix"></div>
{showMemoryErrorWarning ?
<div className="task-warning"><i className="fa fa-support"></i> <span>It looks like your processing node ran out of memory. If you are using docker, make sure that your docker environment has <a href={memoryErrorLink} target="_blank">enough RAM allocated</a>. Alternatively, make sure you have enough physical RAM, reduce the number of images, make your images smaller, or reduce the max-concurrency parameter from the task's <a href="javascript:void(0);" onClick={this.startEditing}>options</a>.</span></div> : ""}