Fix: Task Serialization

Fix: Error output to show correctly
Feature: Added regex webhook validation
pull/8/head
Lee Pepper 2017-04-12 20:31:57 -06:00
rodzic fbca4187be
commit 0d49f36bc8
3 zmienionych plików z 22 dodań i 4 usunięć

Wyświetl plik

@ -48,6 +48,8 @@ module.exports = class Task{
this.output = [];
this.runningProcesses = [];
this.webhook = webhook;
async.series([
@ -477,7 +479,8 @@ module.exports = class Task{
name: this.name,
dateCreated: this.dateCreated,
status: this.status,
options: this.options
options: this.options,
webhook: this.webhook
};
}
};

Wyświetl plik

@ -51,8 +51,9 @@
</div>
<div id="zipFileInput" class="form-group hidden">
<label for="zipurl">URL to zip file with Aerial Images and GCP List (optional):</label> <input id="zipurl" name="zipurl" class="form-control" type="text">
<div id="errorBlock" class="help-block"></div>
</div>
<div id="errorBlock" class="help-block"></div>
<div class="text-right"><input type="button" class="btn btn-info" value="Switch to URL" id="btnShowImport" />
<input type="button" class="btn btn-info hidden" value="Switch to File Upload" id="btnShowUpload" />

Wyświetl plik

@ -289,8 +289,22 @@ $(function() {
$("#btnUpload").attr('disabled', true)
.val("Uploading...");
// Start upload
$("#images").fileinput('upload');
// validate webhook if exists
var webhook = $("#webhook").val();
var regex = new RegExp("^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?");
if(webhook.length > 0 && !regex.test(webhook)){
$('#errorBlock').text("Webhook url is not valid..");
$("#btnUpload").attr('disabled', false).val("Start Task");
return;
}
// Start upload
$("#images").fileinput('upload');
});
$('#resetWebhook').on('click', function(){