Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #77 from synopsys-sig/pipeline-syntax-update
Browse files Browse the repository at this point in the history
Modified pipeline UI suggestions
  • Loading branch information
jahid1209 authored Sep 22, 2023
2 parents f023417 + d7bfce8 commit 8167a27
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,17 @@ public String getDisplayName() {

public ListBoxModel doFillSynopsys_security_productItems() {
ListBoxModel items = new ListBoxModel();
Map<SecurityProduct, String> customLabels = new HashMap<>();
Map<String, String> customLabels = new HashMap<>();

items.add(new Option("Select", "Select"));
customLabels.put(SecurityProduct.BLACKDUCK, "Black Duck");
customLabels.put(SecurityProduct.COVERITY, "Coverity Platform");
customLabels.put(SecurityProduct.POLARIS, "Polaris");
customLabels.put(SecurityProduct.BLACKDUCK.name().toLowerCase(), "Black Duck");
customLabels.put(SecurityProduct.COVERITY.name().toLowerCase(), "Coverity");
customLabels.put(SecurityProduct.POLARIS.name().toLowerCase(), "Polaris");

for (SecurityProduct product : SecurityProduct.values()) {
String label = customLabels.getOrDefault(product, product.name());
items.add(new Option(label, product.name()));
String value = product.name().toLowerCase();
String label = customLabels.getOrDefault(value, product.name()); // Use product.name() for label
items.add(new Option(label, value));
}
return items;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,73 @@
</div>

<div id="blackduck" style="display: none;">
<f:section title="Additional Black Duck Parameters">
<f:entry field="blackduck_scan_failure_severities" title="Black Duck Scan Failure Severities">
<f:section title="Black Duck Parameters">
<f:entry field="blackduck_scan_failure_severities" title="Black Duck Scan Failure Severities (Optional)">
<f:textbox/>
</f:entry>
<f:entry field="blackduck_download_url" title="Black Duck Download URL">
<f:entry field="blackduck_download_url" title="Black Duck Download URL (Mandatory)">
<f:textbox/>
</f:entry>
<f:entry field="blackduck_scan_full" title="Black Duck Full Scan">
<f:entry field="blackduck_scan_full" title="Black Duck Full Scan (Optional)">
<f:checkbox/>
</f:entry>
<f:entry field="blackduck_automation_prcomment" title="Black Duck Automatic Pull Request Comment">
<f:entry field="blackduck_automation_prcomment" title="Add Comments to Pull Requests (Optional)">
<f:checkbox/>
</f:entry>
<!-- <f:entry field="blackduck_automation_fixpr" title="Black Duck Automatic Fix Pull Request">-->
<!-- <f:entry field="bridge_blackduck_automation_fixpr" title="Create Fix Pull Requests">-->
<!-- <f:checkbox/>-->
<!-- </f:entry>-->
</f:section>
</div>

<div id="coverity" style="display: none;">
<f:section title="Additional Coverity Parameters">
<f:entry field="coverity_project_name" title="Coverity Project Name">
<f:section title="Coverity Parameters">
<f:entry field="coverity_project_name" title="Coverity Project Name (Optional)">
<f:textbox/>
</f:entry>
<f:entry field="coverity_stream_name" title="Coverity Stream Name">
<f:entry field="coverity_stream_name" title="Coverity Stream Name (Optional)">
<f:textbox/>
</f:entry>
<f:entry field="coverity_policy_view" title="Coverity Policy View">
<f:entry field="coverity_policy_view" title="Coverity Policy View (Optional)">
<f:textbox/>
</f:entry>
<f:entry field="coverity_version" title="Coverity Version Number">
<f:entry field="coverity_version" title="Coverity Version Number (Optional)">
<f:textbox/>
</f:entry>
<f:entry field="coverity_automation_prcomment" title="Coverity Automatic Pull Request Comment">
<f:entry field="coverity_automation_prcomment" title="Add Comments to Pull Requests (Optional)">
<f:checkbox/>
</f:entry>
<f:entry field="coverity_local" title="Coverity Local Analysis">
<f:entry field="coverity_local" title="Coverity Local Analysis (Optional)">
<f:checkbox/>
</f:entry>
</f:section>
</div>

<div id="polaris" style="display: none;">
<f:section title="Additional Polaris Parameters">
<f:entry field="polaris_application_name" title="Polaris Application Name">
<f:section title="Polaris Parameters">
<f:entry field="polaris_application_name" title="Polaris Application Name (Mandatory)">
<f:textbox/>
</f:entry>
<f:entry field="polaris_project_name" title="Polaris Project Name">
<f:entry field="polaris_project_name" title="Polaris Project Name (Mandatory)">
<f:textbox/>
</f:entry>
<f:entry field="polaris_assessment_types" title="Polaris Assessment Types">
<f:entry field="polaris_assessment_types" title="Polaris Assessment Types (Mandatory)">
<f:textbox/>
</f:entry>
<f:entry field="polaris_triage" title="Polaris Triage">
<f:entry field="polaris_triage" title="Polaris Triage (Optional)">
<f:textbox/>
</f:entry>
<f:entry field="polaris_branch_name" title="Polaris Branch Name">
<f:entry field="polaris_branch_name" title="Polaris Branch Name (Optional)">
<f:textbox/>
</f:entry>
</f:section>
</div>

<f:section title="Additional Parameter">
<f:entry field="include_diagnostics" title="Include Diagnostics">
<f:section title="Additional Options">
<f:entry field="include_diagnostics" title="Include Diagnostics (Optional)">
<f:checkbox/>
</f:entry>
<f:entry field="network_airgap" title="Network Airgap">
<f:entry field="network_airgap" title="Network Airgap (Optional)">
<f:checkbox/>
</f:entry>
</f:section>
Expand All @@ -89,6 +89,9 @@
blackduckDiv.style.display = 'none';
coverityDiv.style.display = 'none';
polarisDiv.style.display = 'none';
clearInputFields(blackduckDiv);
clearInputFields(coverityDiv);
clearInputFields(polarisDiv);
}

function showDiv(div) {
Expand All @@ -97,16 +100,33 @@
}
}

function clearInputFields(div) {
if (div) {
var inputFields = div.querySelectorAll('input[type="text"], input[type="checkbox"]');
inputFields.forEach(function (field) {
if (field.type === 'text') {
field.value = '';
} else if (field.type === 'checkbox') {
field.checked = false;
}
});
}
}

synopsysSecurityProduct.addEventListener('change', function () {
hideAllDivs(); // Hide all divs initially
// Determine the selected option value
hideAllDivs();
var selectedOption = synopsysSecurityProduct.value;
// Show the corresponding div based on the selected option
if (selectedOption == 'BLACKDUCK') {
if (selectedOption == 'blackduck') {
clearInputFields(coverityDiv);
clearInputFields(polarisDiv);
showDiv(blackduckDiv);
} else if (selectedOption == 'COVERITY') {
} else if (selectedOption == 'coverity') {
clearInputFields(blackduckDiv);
clearInputFields(polarisDiv);
showDiv(coverityDiv);
} else if (selectedOption == 'POLARIS') {
} else if (selectedOption == 'polaris') {
clearInputFields(blackduckDiv);
clearInputFields(coverityDiv);
showDiv(polarisDiv);
}else if (selectedOption == 'Select') {
hideAllDivs();
Expand Down

0 comments on commit 8167a27

Please sign in to comment.