More vulnerability refactoring
@@ -176,15 +176,20 @@ mainContent.on("click", ".vulEnvProperties", function () {
});
mainContent.on("click", "#addAssetToEnvFromVuln", function () {
- if($("#theVulEnvironments").find("tbody").children().length == 0){
- alert("First you have to add an environment");
- }
- else {
- var hasAssets = [];
+ var filterList = [];
$(".removeVulnEnvAsset").next("td").each(function (index, tag) {
- hasAssets.push($(tag).text());
+ filterList.push($(tag).text());
+ });
+
+ refreshDimensionSelector($('#chooseEnvironmentSelect'),'asset',$.session.get('VulnEnvironmentName'),function(){
+ $('#chooseEnvironment').attr('data-chooseDimension','asset');
+ $('#chooseEnvironment').attr('data-applyEnvironmentSelection','addAssetToVulnerabilityEnvironment');
+ $('#chooseEnvironment').modal('show');
+ },filterList);
});
- assetsDialogBox(hasAssets, function (text) {
+
+function addAssetToVulnerabilityEnvironment() {
+ var text = $("#chooseEnvironmentSelect").val();
$("#vulnEnvAssets").find("tbody").append('<tr><td class="removeVulnEnvAsset"><i class="fa fa-minus"></i></td><td>' + text + '</td></tr>');
var theVul = JSON.parse($.session.get("Vulnerability"));
var EnvName = $.session.get("VulnEnvironmentName");
@@ -195,9 +200,8 @@ mainContent.on("click", "#addAssetToEnvFromVuln", function () {
});
debugLogger(theVul);
$.session.set("Vulnerability", JSON.stringify(theVul));
- });
- }
-});
+};
+
mainContent.on("click", ".removeVulnEnvAsset", function () {
var name = $(this).next("td").text();
