1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-06-30 22:50:11 +02:00

validate button color

This commit is contained in:
Anthony Stirling 2023-12-27 13:22:28 +00:00
parent f5c285a70f
commit 84aebe3851

View File

@ -32,6 +32,7 @@ function validatePipeline() {
console.log(`Intersection: ${intersection}`);
if (intersection.length === 0) {
updateValidateButton(false);
isValid = false;
console.log(`Incompatible operations: The output of operation '${currentOperation}' (${currentOperationOutput}) is not compatible with the input of the following operation '${nextOperation}' (${nextOperationInput}).`);
alert(`Incompatible operations: The output of operation '${currentOperation}' (${currentOperationOutput}) is not compatible with the input of the following operation '${nextOperation}' (${nextOperationInput}).`);
@ -40,6 +41,7 @@ function validatePipeline() {
}
}
if (containsAddPassword && pipelineListItems[pipelineListItems.length - 1].querySelector('.operationName').textContent !== '/add-password') {
updateValidateButton(false);
alert('The "add-password" operation should be at the end of the operations sequence. Please adjust the operations order.');
return false;
}
@ -50,10 +52,20 @@ function validatePipeline() {
console.error('Pipeline is not valid');
// Stop operation, maybe display an error to the user
}
updateValidateButton(isValid);
return isValid;
}
function updateValidateButton(isValid) {
var validateButton = document.getElementById('validateButton');
if (isValid) {
validateButton.classList.remove('btn-danger');
validateButton.classList.add('btn-success');
} else {
validateButton.classList.remove('btn-success');
validateButton.classList.add('btn-danger');
}
}