Piero Toffanin 2019-06-05 11:46:04 -04:00
commit eddf5c8f39
7 zmienionych plików z 44 dodań i 6 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ REST API to access ODM
=== Version information
[%hardbreaks]
_Version_ : 1.5.1
_Version_ : 1.5.2
=== Contact information
@ -295,6 +295,8 @@ Creates a new task and places it at the end of the processing queue. For uploadi
_optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*dateCreated* +
_optional_|An optional timestamp overriding the default creation date of the task.|integer|
|*FormData*|*images* +
_optional_|Images to process, plus an optional GCP file (*.txt) and/or an optional seed file (seed.zip). If included, the GCP file should have .txt extension. If included, the seed archive pre-polulates the task directory with its contents.|file|
|*FormData*|*name* +
@ -402,6 +404,8 @@ Initialize the upload of a new task. If successful, a user can start uploading f
_optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*dateCreated* +
_optional_|An optional timestamp overriding the default creation date of the task.|integer|
|*FormData*|*name* +
_optional_|An optional name to be associated with the task|string|
|*FormData*|*options* +

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -87,6 +87,12 @@ let server;
* required: false
* type: string
* -
* name: dateCreated
* in: formData
* description: 'An optional timestamp overriding the default creation date of the task.'
* required: false
* type: integer
* -
* name: token
* in: query
* description: 'Token required for authentication (when authentication is required).'
@ -239,6 +245,12 @@ app.post('/task/new/commit/:uuid', authCheck, taskNew.getUUID, taskNew.handleCom
* required: false
* type: string
* -
* name: dateCreated
* in: formData
* description: 'An optional timestamp overriding the default creation date of the task.'
* required: false
* type: integer
* -
* name: token
* in: query
* description: 'Token required for authentication (when authentication is required).'

Wyświetl plik

@ -38,13 +38,13 @@ const utils = require('./utils');
const statusCodes = require('./statusCodes');
module.exports = class Task{
constructor(uuid, name, options = [], webhook = null, skipPostProcessing = false, outputs = [], done = () => {}){
constructor(uuid, name, options = [], webhook = null, skipPostProcessing = false, outputs = [], dateCreated = new Date().getTime(), done = () => {}){
assert(uuid !== undefined, "uuid must be set");
assert(done !== undefined, "ready must be set");
this.uuid = uuid;
this.name = name !== "" ? name : "Task of " + (new Date()).toISOString();
this.dateCreated = new Date().getTime();
this.dateCreated = isNaN(parseInt(dateCreated)) ? new Date().getTime() : parseInt(dateCreated);
this.processingTime = -1;
this.setStatus(statusCodes.QUEUED);
this.options = options;
@ -96,6 +96,7 @@ module.exports = class Task{
taskJson.webhook,
taskJson.skipPostProcessing,
taskJson.outputs,
taskJson.dateCreated,
(err, task) => {
if (err) done(err);
else{

Wyświetl plik

@ -353,6 +353,7 @@ module.exports = {
req.body.webhook,
req.body.skipPostProcessing === 'true',
req.body.outputs,
req.body.dateCreated,
(err, task) => {
if (err) cb(err);
else {

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "node-opendronemap",
"version": "1.5.1",
"name": "NodeODM",
"version": "1.5.2",
"description": "REST API to access ODM",
"main": "index.js",
"scripts": {

Wyświetl plik

@ -314,6 +314,7 @@ $(function() {
}
if (json.status && json.status.code && [codes.COMPLETED, codes.FAILED, codes.CANCELED].indexOf(json.status.code) !== -1){
self.stopRefreshingInfo();
self.copyOutput();
}
self.info(json);
@ -333,12 +334,26 @@ $(function() {
Task.prototype.openInfo = function(){
location.href='/task/' + this.uuid + '/info?token=' + token;
};
Task.prototype.copyOutput = function(){
var self = this;
var url = "/task/" + self.uuid + "/output";
$.get(url, { token: token })
.done(function(output) {
localStorage.setItem(self.uuid + '_output', JSON.stringify(output));
})
.fail(function() {
console.warn("Cannot copy output for " + self.uuid);
});
};
Task.prototype.downloadOutput = function(){
var self = this;
var url = "/task/" + self.uuid + "/output";
$.get(url, { token: token })
.done(function(output) {
var wnd = window.open("about:blank", "", "_blank");
if (output.length === 0){
output = JSON.parse(localStorage.getItem(self.uuid + '_output') || []);
}
wnd.document.write(output.join("<br/>"));
})
.fail(function() {
@ -352,6 +367,9 @@ $(function() {
var url = "/task/" + self.uuid + "/output";
$.get(url, { line: -9, token: token })
.done(function(output) {
if (output.length === 0){
output = JSON.parse(localStorage.getItem(self.uuid + '_output') || []);
}
self.output(output);
})
.fail(function() {
@ -386,6 +404,8 @@ $(function() {
var url = "/task/remove?token=" + token;
function doRemove() {
localStorage.removeItem(self.uuid + '_output');
$.post(url, {
uuid: self.uuid
})