1
1
<?jelly escape-by-default =' true' ?>
2
2
<j : jelly xmlns : j =" jelly:core" xmlns : f =" /lib/form" >
3
-
4
3
<div id =" product" >
5
4
<f : entry field =" product" title =" Select Security Product" >
6
5
<f : select />
265
264
</f : entry >
266
265
</f : section >
267
266
268
- <style >
269
- .error-margin {
270
- margin-top: 4px;
271
- }
272
- </style >
273
-
274
- <script type =" text/javascript" >
275
- var selectedOption = document.querySelector('select[name="_.product"]')?.value;
276
- var polarisAssessmentModeOption = document.querySelector('select[name="_.polaris_assessment_mode"]')?.value;
277
- var sourceUploadDiv = document.getElementById('source_upload');
278
-
279
- if (selectedOption && selectedOption !== 'select') {
280
- document.getElementById(selectedOption).style.display = 'block';
281
- validateProductField();
282
- validateCoverityFields();
283
- validatePolarisFields();
284
- validateSrmFields();
285
-
286
- if (selectedOption === 'polaris' && polarisAssessmentModeOption === 'SOURCE_UPLOAD') {
287
- showParticularDiv(sourceUploadDiv);
288
- }
289
- }
290
-
291
- function hideParticularDiv(div) {
292
- if (div) {
293
- div.style.display = 'none';
294
- }
295
- }
296
-
297
- function showParticularDiv(div) {
298
- if (div) {
299
- div.style.display = 'block';
300
- }
301
- }
302
-
303
- function clearInputFields(div) {
304
- if (div) {
305
- var inputFields = div.querySelectorAll('input[type="text"], input[type="checkbox"]');
306
- inputFields.forEach(function (field) {
307
- if (field.type === 'text') {
308
- field.value = '';
309
- } else if (field.type === 'checkbox') {
310
- if (field.name !== "_.srm_waitForScan" && field.name !== "_.polaris_waitForScan" && field.name !== "_.blackduck_waitForScan" && field.name !== "_.coverity_waitForScan" && field.name !== "_.polaris_reports_sarif_groupSCAIssues" && field.name !== "_.blackduck_reports_sarif_groupSCAIssues") {
311
- field.checked = false;
312
- }
313
- }
314
- });
315
- // clears polaris assessment mode dropdown value
316
- var selectedOption = document.querySelector('select[name="_.product"]')?.value;
317
- if (selectedOption !== 'polaris') {
318
- var polarisAssessmentModeOption = document.querySelector('select[name="_.polaris_assessment_mode"]');
319
- if (polarisAssessmentModeOption) {
320
- polarisAssessmentModeOption.value = ""
321
- }
322
- }
323
- }
324
- }
325
-
326
-
327
- document.addEventListener('change', function () {
328
- var selectedOption = document.querySelector('select[name="_.product"]')?.value;
329
- var polarisAssessmentModeOption = document.querySelector('select[name="_.polaris_assessment_mode"]')?.value;
330
-
331
- var blackduckscaDiv = document.getElementById('blackducksca');
332
- var coverityDiv = document.getElementById('coverity');
333
- var polarisDiv = document.getElementById('polaris');
334
- var srmDiv = document.getElementById('srm');
335
- var sourceUploadDiv = document.getElementById('source_upload');
336
-
337
- if (polarisAssessmentModeOption === 'SOURCE_UPLOAD') {
338
- showParticularDiv(sourceUploadDiv);
339
- }
340
-
341
- if (polarisAssessmentModeOption === 'CI' || polarisAssessmentModeOption === '') {
342
- clearInputFields(sourceUploadDiv);
343
- hideParticularDiv(sourceUploadDiv);
344
- }
345
-
346
- if (selectedOption === 'blackducksca') {
347
- clearInputFields(coverityDiv);
348
- hideParticularDiv(coverityDiv);
349
- clearInputFields(polarisDiv);
350
- hideParticularDiv(polarisDiv);
351
- clearInputFields(srmDiv);
352
- hideParticularDiv(srmDiv);
353
- showParticularDiv(blackduckscaDiv);
354
- validateProductField();
355
- } else if (selectedOption === 'coverity') {
356
- clearInputFields(blackduckscaDiv);
357
- hideParticularDiv(blackduckscaDiv);
358
- clearInputFields(polarisDiv);
359
- hideParticularDiv(polarisDiv);
360
- clearInputFields(srmDiv);
361
- hideParticularDiv(srmDiv);
362
- showParticularDiv(coverityDiv);
363
- validateProductField();
364
- validateCoverityFields();
365
- } else if (selectedOption === 'polaris') {
366
- clearInputFields(blackduckscaDiv);
367
- hideParticularDiv(blackduckscaDiv);
368
- clearInputFields(coverityDiv);
369
- hideParticularDiv(coverityDiv);
370
- clearInputFields(srmDiv);
371
- hideParticularDiv(srmDiv);
372
- showParticularDiv(polarisDiv);
373
- validateProductField();
374
- validatePolarisFields();
375
- } else if (selectedOption === 'srm') {
376
- clearInputFields(blackduckscaDiv);
377
- hideParticularDiv(blackduckscaDiv);
378
- clearInputFields(coverityDiv);
379
- hideParticularDiv(coverityDiv);
380
- clearInputFields(polarisDiv);
381
- hideParticularDiv(polarisDiv);
382
- showParticularDiv(srmDiv);
383
- validateProductField();
384
- validateSrmFields();
385
- } else if (selectedOption === 'select') {
386
- clearInputFields(blackduckscaDiv);
387
- clearInputFields(coverityDiv);
388
- clearInputFields(polarisDiv);
389
- clearInputFields(srmDiv);
390
- hideParticularDiv(blackduckscaDiv);
391
- hideParticularDiv(coverityDiv);
392
- hideParticularDiv(polarisDiv);
393
- hideParticularDiv(srmDiv);
394
- validateProductField();
395
- }
396
-
397
- });
398
-
399
- function validateProductField() {
400
- var errorProductDiv = document.getElementById("error_product_name");
401
- var selectedOption = document.querySelector('select[name="_.product"]')?.value;
402
- if (selectedOption === 'select') {
403
- errorProductDiv.style.display = "block";
404
- } else {
405
- errorProductDiv.style.display = "none";
406
- }
407
- }
408
-
409
- function validateCoverityFields() {
410
- var coverityProjectName = document.querySelector('input[name="_.coverity_project_name"]')?.value;
411
- var coverityStreamName = document.querySelector('input[name="_.coverity_stream_name"]')?.value;
412
- var errorCoverityProjectNameDiv = document.getElementById("error_coverity_project_name");
413
- var errorCoverityStreamNameDiv = document.getElementById("error_coverity_stream_name");
414
-
415
- if (!coverityProjectName) {
416
- errorCoverityProjectNameDiv.style.display = "block";
417
- } else {
418
- errorCoverityProjectNameDiv.style.display = "none";
419
- }
420
-
421
- if (!coverityStreamName) {
422
- errorCoverityStreamNameDiv.style.display = "block";
423
- } else {
424
- errorCoverityStreamNameDiv.style.display = "none";
425
- }
426
- }
427
-
428
- function validatePolarisFields() {
429
- var polarisApplicationName = document.querySelector('input[name="_.polaris_application_name"]')?.value;
430
- var polarisProjectName = document.querySelector('input[name="_.polaris_project_name"]')?.value;
431
- var polarisAssessmentTypes = document.querySelector('input[name="_.polaris_assessment_types"]')?.value;
432
- var polarisBranchName = document.querySelector('input[name="_.polaris_branch_name"]')?.value;
433
- var errorPolarisApplicationNameDiv = document.getElementById("error_polaris_application_name");
434
- var errorPolarisProjectNameDiv = document.getElementById("error_polaris_project_name");
435
- var errorPolarisAssessmentTypesDiv = document.getElementById("error_polaris_assessment_types");
436
- var errorPolarisBranchNameDiv = document.getElementById("error_polaris_branch_name");
437
-
438
- if (!polarisApplicationName) {
439
- errorPolarisApplicationNameDiv.style.display = "block";
440
- } else {
441
- errorPolarisApplicationNameDiv.style.display = "none";
442
- }
443
-
444
- if (!polarisProjectName) {
445
- errorPolarisProjectNameDiv.style.display = "block";
446
- } else {
447
- errorPolarisProjectNameDiv.style.display = "none";
448
- }
449
-
450
- if (!polarisAssessmentTypes) {
451
- errorPolarisAssessmentTypesDiv.style.display = "block";
452
- } else {
453
- errorPolarisAssessmentTypesDiv.style.display = "none";
454
- }
455
-
456
- if (!polarisBranchName) {
457
- errorPolarisBranchNameDiv.style.display = "block";
458
- } else {
459
- errorPolarisBranchNameDiv.style.display = "none";
460
- }
461
-
462
- }
463
-
464
- function validateSrmFields() {
465
- var srmProjectName = document.querySelector('input[name="_.srm_project_name"]')?.value;
466
- var srmAssessmentTypes = document.querySelector('input[name="_.srm_assessment_types"]')?.value;
467
- var srmProjectId = document.querySelector('input[name="_.srm_project_id"]')?.value;
468
- var errorSrmProjectNameDiv = document.getElementById("error_srm_project_name");
469
- var errorSrmProjectIdDiv = document.getElementById("error_srm_project_id");
470
- var errorSrmAssessmentTypesDiv = document.getElementById("error_srm_assessment_types");
471
-
472
- if (!srmProjectName && !srmProjectId) {
473
- errorSrmProjectNameDiv.style.display = "block";
474
- errorSrmProjectIdDiv.style.display = "block";
475
- } else {
476
- errorSrmProjectNameDiv.style.display = "none";
477
- errorSrmProjectIdDiv.style.display = "none";
478
- }
479
-
480
- if (!srmAssessmentTypes) {
481
- errorSrmAssessmentTypesDiv.style.display = "block";
482
- } else {
483
- errorSrmAssessmentTypesDiv.style.display = "none";
484
- }
485
- }
267
+ <link rel =" stylesheet" type =" text/css" href =" ${rootURL}/plugin/blackduck-security-scan/styles/security-scan-freestyle-config.css" />
486
268
487
- </ script >
269
+ <script type = " text/javascript " src = " ${rootURL}/plugin/blackduck-security-scan/scripts/SecurityScanFreestyleConfig.js " / >
488
270
489
271
</j : jelly >
0 commit comments