diff options
author | 2021-08-27 16:11:39 -0400 | |
---|---|---|
committer | 2021-08-27 17:28:40 -0400 | |
commit | db784313b8ba29f5d4396c1cc96bb5f3c853677f (patch) | |
tree | f26c260919b39751747ad64e87b1a7932c222046 /gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js | |
parent | bcca60b3c9e50e93a0f309905049ddbbf45768ef (diff) |
Fix sonar issues in policy/gui
Issue-ID: POLICY-3077
Change-Id: Idcd08427cbff2cfdd8ba99db7cf32a0f5c978415
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js')
-rw-r--r-- | gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js index 7ae7747..5503064 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +32,8 @@ function editTaskForm_createTask(formParent) { var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; var dt = { "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -45,8 +46,8 @@ function editTaskForm_createTask(formParent) { requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var contextAlbums = new Array(); ajax_get(requestURL, function(data3) { - for (var y = 0; y < data3.messages.message.length; y++) { - var contextAlbum = JSON.parse(data3.messages.message[y]).apexContextAlbum; + for (let value of data3.messages.message) { + var contextAlbum = JSON.parse(value).apexContextAlbum; var ca = { "name" : contextAlbum.key.name, "version" : contextAlbum.key.version, @@ -87,8 +88,8 @@ function editTaskForm_editTask_inner(formParent, name, version, viewOrEdit) { requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { - for (var i = 0; i < data2.messages.message.length; i++) { - var contextSchema = JSON.parse(data2.messages.message[i]).apexContextSchema; + for (let value of data2.messages.message) { + var contextSchema = JSON.parse(value).apexContextSchema; contextSchemas.push({ "name" : contextSchema.key.name, "version" : contextSchema.key.version, @@ -100,8 +101,8 @@ function editTaskForm_editTask_inner(formParent, name, version, viewOrEdit) { requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var contextAlbums = new Array(); ajax_get(requestURL, function(data3) { - for (var y = 0; y < data3.messages.message.length; y++) { - var contextAlbum = JSON.parse(data3.messages.message[y]).apexContextAlbum; + for (let value of data3.messages.message) { + var contextAlbum = JSON.parse(value).apexContextAlbum; var ca = { "name" : contextAlbum.key.name, "version" : contextAlbum.key.version, @@ -296,8 +297,7 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA inputfieldstable.appendChild(inputfieldstable_body); // Add the inputfields if (task && task.inputFields && task.inputFields.entry) { - for (var p = 0; p < task.inputFields.entry.length; p++) { - var inputfieldEntry = task.inputFields.entry[p]; + for (let inputfieldEntry of task.inputFields.entry) { var contextSchema = inputfieldEntry.value.fieldSchemaKey; contextSchema["displaytext"] = contextSchema.name + ":" + contextSchema.version; editTaskForm_addTaskInputField(inputfieldstable_body, (createEditOrView == "VIEW"), inputfieldEntry.key, @@ -355,8 +355,7 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA outputfieldstable.appendChild(outputfieldstable_body); // Add the outputfields if (task && task.outputFields && task.outputFields.entry) { - for (var y = 0; y < task.outputFields.entry.length; y++) { - var outputfieldEntry = task.outputFields.entry[y]; + for (let outputfieldEntry of task.outputFields.entry) { contextSchema = outputfieldEntry.value.fieldSchemaKey; contextSchema["displaytext"] = contextSchema.name + ":" + contextSchema.version; editTaskForm_addTaskOutputField(outputfieldstable_body, (createEditOrView == "VIEW"), outputfieldEntry.key, @@ -447,8 +446,7 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA paramstable.appendChild(paramstable_body); // Add the params if (task && task.taskParameters && task.taskParameters.entry) { - for (var k = 0; k < task.taskParameters.entry.length; k++) { - var paramEntry = task.taskParameters.entry[k]; + for (let paramEntry of task.taskParameters.entry) { var paramName = paramEntry.key; var paramValue = paramEntry.value.defaultValue; editTaskForm_addTaskParameter(paramstable_body, (createEditOrView == "VIEW"), paramName, paramValue); @@ -497,8 +495,7 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA contextstable.appendChild(contextstable_body); // Add the contexts if (task && task.contextAlbumReference && $.isArray(task.contextAlbumReference)) { - for (var l = 0; l < task.contextAlbumReference.length; l++) { - var contextEntry = task.contextAlbumReference[l]; + for (let contextEntry of task.contextAlbumReference) { var contextName = contextEntry.name + ":" + contextEntry.version; var ce = { "name" : contextEntry.name, @@ -643,7 +640,7 @@ function editTaskForm_addTaskInputField(parentTBody, disabled, name, optional, c if (name == null && contextSchema == null && !disabled) { inputOptional.setAttribute("class", "field-eventparam-optional.new"); } - if (optional == true) { + if (optional) { inputOptional.checked = true; } else { inputOptional.checked = false; @@ -712,7 +709,7 @@ function editTaskForm_addTaskOutputField(parentTBody, disabled, name, optional, if (name == null && contextSchema == null && !disabled) { outputOptional.setAttribute("class", "field-eventparam-optional.new"); } - if (optional == true) { + if (optional) { outputOptional.checked = true; } else { outputOptional.checked = false; @@ -960,9 +957,9 @@ function editTaskForm_submitPressed() { return false; } var contextalbumname = contextalbumvalue.displaytext; - for (var j = 0; j < taskbean_context.length; j++) { - if (taskbean_context[j] != null && taskbean_context[j].name == contextalbumvalue.name - && taskbean_context[j].version == contextalbumvalue.version) { + for (let value of taskbean_context) { + if (value != null && value.name == contextalbumvalue.name + && value.version == contextalbumvalue.version) { alert("Task \"" + name + "\" references Context Album \"" + contextalbumname + "\" more than once"); return false; |