Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions src/www/ui/scripts/change-license-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,36 @@ function scheduledDeciderError (responseobject, resultEntity) {
resultEntity.show();
}

function isUserError(bulkActions, refText) {
var errorText = "";
if(bulkActions.length < 1) {
errorText += "No licenses to bulk scan selected\n";
}

if(refText.trim().split(" ").length < 2) {
errorText += "Reference text needs to be at least 2 words long"
}

//show errors to user
if(errorText.length > 0) {
alert("Bulk scan not scheduled: \n\n"+errorText);
return true;
}
return false;
}

function scheduleBulkScanCommon(resultEntity, callbackSuccess) {
var bulkActions = getBulkFormTableContent();
var refText = $('#bulkRefText').val();

//checks for user errors
if(isUserError(bulkActions, refText)) {
return;
}

var post_data = {
"bulkAction": getBulkFormTableContent(),
"refText": $('#bulkRefText').val(),
"bulkAction": bulkActions,
"refText": refText,
"bulkScope": $('#bulkScope').val(),
"uploadTreeId": $('#uploadTreeId').val(),
"forceDecision": $('#forceDecision').is(':checked')?1:0
Expand Down Expand Up @@ -198,4 +224,4 @@ function removeMainLicense(uploadId,licenseId) {
})
.fail(failed);
}
}
}