-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1361 from yogeshojha/1357-feat-make-startscan-ui-…
…consistent-all-types-of-scan-such-as-schedule-scan-organization-scan-multiple-scans-etc feat: Consistent start scan ui across schedule scan, multiple scans. Now supports import, out of scope subdomains, starting path, excluded path for all types of scan #1357
- Loading branch information
Showing
11 changed files
with
463 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
function schedulerChanged(selectObject) { | ||
selectedValue = selectObject.value; | ||
if (selectedValue == "periodic") { | ||
var clockedDiv = document.getElementById("clocked-div"); | ||
clockedDiv.classList.remove("show"); | ||
clockedDiv.classList.remove("active"); | ||
var periodicDiv = document.getElementById("periodic-div"); | ||
periodicDiv.classList.add("show"); | ||
periodicDiv.classList.add("active"); | ||
} else if (selectedValue == "clocked") { | ||
var periodicDiv = document.getElementById("periodic-div"); | ||
periodicDiv.classList.remove("show"); | ||
periodicDiv.classList.remove("active"); | ||
var clockedDiv = document.getElementById("clocked-div"); | ||
clockedDiv.classList.add("show"); | ||
clockedDiv.classList.add("active"); | ||
} | ||
} | ||
|
||
var buttonEnabled = true; | ||
var globalTimeout = 0; | ||
|
||
function disableNext() { | ||
var nextButton = $(".actions ul li:nth-child(2) a"); | ||
nextButton.attr("href", "#"); | ||
buttonEnabled = $(".actions ul li:nth-child(2)") | ||
.addClass("disabled") | ||
.attr("aria-disabled", "true"); | ||
} | ||
|
||
function enableNext() { | ||
var nextButton = $(".actions ul li:nth-child(2) a"); | ||
nextButton.attr("href", "#next"); | ||
buttonEnabled = $(".actions ul li:nth-child(2)") | ||
.removeClass("disabled") | ||
.attr("aria-disabled", "false"); | ||
} | ||
|
||
function updateButton() { | ||
var text = $("input[type=radio][name=scan_mode]").val(); | ||
if (text === "") { | ||
disableNext(); | ||
return false; | ||
} else { | ||
enableNext(); | ||
return true; | ||
} | ||
} | ||
|
||
function initTimer() { | ||
if (globalTimeout) clearTimeout(globalTimeout); | ||
globalTimeout = setTimeout(updateButton, 400); | ||
} | ||
|
||
$("#schedule_scan_steps").steps({ | ||
headerTag: "h3", | ||
bodyTag: "div", | ||
transitionEffect: "slide", | ||
cssClass: "pill wizard", | ||
enableKeyNavigation: false, | ||
onStepChanging: updateButton, | ||
labels: { finish: "Schedule Scan" }, | ||
onInit: function (event, current) { | ||
$('a[role="menuitem"]').addClass("text-white"); | ||
$(".actions ul li:nth-child(3) a").attr( | ||
"onclick", | ||
`$(this).closest('form').submit()` | ||
); | ||
flatpickr(document.getElementById("clockedTime"), { | ||
enableTime: true, | ||
dateFormat: "Y-m-d H:i", | ||
}); | ||
// $(".basic").select2({ | ||
// minimumResultsForSearch: -1 | ||
// }); | ||
}, | ||
onStepChanged: function (event, currentIndex, priorIndex) { | ||
if (currentIndex == 1) { | ||
$("input[type=radio][name=scan_mode]").change(initTimer).keyup(initTimer); | ||
disableNext(); | ||
} | ||
}, | ||
}); | ||
|
||
$("#excludedPaths").selectize({ | ||
persist: false, | ||
createOnBlur: true, | ||
create: true, | ||
}); |
59 changes: 59 additions & 0 deletions
59
web/startScan/static/startScan/js/start-scan-wizard-init.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
var buttonEnabled = true; | ||
var globalTimeout = 0; | ||
|
||
$("#select_engine").steps({ | ||
headerTag: "h4", | ||
bodyTag: "div", | ||
transitionEffect: "slide", | ||
cssClass: "pill wizard", | ||
enableKeyNavigation: false, | ||
onStepChanging: updateButton, | ||
labels: { finish: "Start Scan" }, | ||
onInit: function (event, current) { | ||
$(".actions ul li:nth-child(3) a").attr( | ||
"onclick", | ||
`$(this).closest('form').submit()` | ||
); | ||
}, | ||
}); | ||
$("input[type=radio][name=scan_mode]").change(initTimer).keyup(initTimer); | ||
disableNext(); | ||
$('a[role="menuitem"]').addClass("text-white"); | ||
|
||
function initTimer() { | ||
if (globalTimeout) clearTimeout(globalTimeout); | ||
globalTimeout = setTimeout(updateButton, 400); | ||
} | ||
function disableNext() { | ||
var nextButton = $(".actions ul li:nth-child(2) a"); | ||
nextButton.attr("href", "#"); | ||
buttonEnabled = $(".actions ul li:nth-child(2)") | ||
.addClass("disabled") | ||
.attr("aria-disabled", "true"); | ||
} | ||
|
||
function enableNext() { | ||
var nextButton = $(".actions ul li:nth-child(2) a"); | ||
nextButton.attr("href", "#next"); | ||
buttonEnabled = $(".actions ul li:nth-child(2)") | ||
.removeClass("disabled") | ||
.attr("aria-disabled", "false"); | ||
} | ||
|
||
function updateButton() { | ||
$('a[role="menuitem"]').addClass("btn btn-primary waves-effect waves-light"); | ||
var text = $("input[type=radio][name=scan_mode]").val(); | ||
if (text === "") { | ||
disableNext(); | ||
return false; | ||
} else { | ||
enableNext(); | ||
return true; | ||
} | ||
} | ||
|
||
$("#excludedPaths").selectize({ | ||
persist: false, | ||
createOnBlur: true, | ||
create: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.