diff options
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; |