Correct code so fetch.euCellsv2(node) would also receive FilterEUtranCells from user…
- User
Correct code so fetch.euCellsv2(node) would also receive FilterEUtranCells from user input like euCells(data)
// euCellsv2 fetches eUtranCells data according to new naming policy for Elastic Ran export const euCellsv2 = (data => { const json = { Name: data }; json.FilterEUtranCells = ["Kcell"] return apiData(
http://${consts.host}/api/fetchEUCells, json) })export const euCells = (data => { const json = Object.fromEntries(data.entries()); json.FilterEUtranCells = data.getAll('FilterEUtranCells') return apiData(
http://${consts.host}/api/fetchEUCells, json) })import * as fetch from '../../fetchAPI.js' import * as draw from '../../draw.js' import * as validate from '../../validations.js' import { createToolPage } from '../../elementsHTML.js' import { disableForm, enableForm } from '../../utils.js' import * as consts from './const.js' import * as global from '../../const.js'
// fetchIntegrData fetches node integration data using set of API requests const fetchEranData = (data => {
return new Promise((resolve, reject) => {
//init scenario that holds all API's and user's data const integrData = {}
//fetch ENode and EUtranCells data Promise.all([ fetch.eNodeBv2(data), fetch.eranConnection() ])
//save ENodeB, EUtranCells and Cosite eNodeBs data .then(data => {
//error for (let object of data) { if (object instanceof Error) { reject(object) return } }
//save ENodeB data integrData.parenteNodeB = data[0] // // save EranConnection data integrData.eranConnection = data[1]
// // save Nodes data integrData.nodes = {}
//return data for future promises return { Nodes: integrData.parenteNodeB.Nodes, }
}
//fetch cosite eNodes and EUtranCell data ).then(data => { let nodes = data["Nodes"] || []; let funcs = []; nodes.forEach((node, i) => { funcs.push( Promise.all([ fetch.eNodeBv3(node), fetch.euCellsv2(node), ]).then(data => { integrData.nodes[node] = { eNodeB: data[0], EUtranCellData: data[1], }; }) ); }); return Promise.all(funcs);
- Assistant
).then(data => { resolve(integrData); }) .catch(error => reject(error)); })
- User
Correct code so euCellsv2(node) would also receive FilterEUtranCells from user input like euCells(data)
// euCellsv2 fetches eUtranCells data according to new naming policy for Elastic Ran export const euCellsv2 = (data => { const json = { Name: data }; json.FilterEUtranCells = ["Kcell"] return apiData(
http://${consts.host}/api/fetchEUCells, json) })export const euCells = (data => { const json = Object.fromEntries(data.entries()); json.FilterEUtranCells = data.getAll('FilterEUtranCells') return apiData(
http://${consts.host}/api/fetchEUCells, json) })// fetchIntegrData fetches node integration data using set of API requests const fetchEranData = (data => {
return new Promise((resolve, reject) => {
//init scenario that holds all API's and user's data const integrData = {}
//fetch ENode and EUtranCells data Promise.all([ fetch.eNodeBv2(data), fetch.eranConnection() ])
//save ENodeB, EUtranCells and Cosite eNodeBs data .then(data => {
//error for (let object of data) { if (object instanceof Error) { reject(object) return } }
- Assistant
}).then(data => { let nodes = data["Nodes"] || []; let funcs = []; nodes.forEach((node, i) => { funcs.push( Promise.all([ fetch.eNodeBv3(node), fetch.euCells(node) ]).then(data => { integrData.nodes[node] = { eNodeB: data[0], EUtranCellData: data[1], }; }) ); }); return Promise.all(funcs); }) .then(() => { resolve(integrData); }) .catch(error => reject(error)); })
- User
explain code export const euCells = (data => { const json = Object.fromEntries(data.entries()); json.FilterEUtranCells = data.getAll('FilterEUtranCells') return apiData(
http://${consts.host}/api/fetchEUCells, json) }) - Assistant
The code defines a function
euCellsthat takes in a parameterdata. Within the function, it creates a new objectjsonby callingObject.fromEntries(data.entries()). This method takes the entries (key-value pairs) fromdataand creates a new object where the keys and values are derived from the entries.Next, the code sets the
FilterEUtranCellsproperty of thejsonobject by calling the.getAll('FilterEUtranCells')method ondata. This method retrieves all the values associated with the key'FilterEUtranCells'fromdataand assigns them to theFilterEUtranCellsproperty injson.Finally, the code calls the
apiDatafunction with a URL (http://${consts.host}/api/fetchEUCells) and thejsonobject as parameters. It appears that theapiDatafunction is responsible for making an API call and returning the response.In summary, the
euCellsfunction takes in some data, creates a JSON object, sets a specific property based on the data, and then calls an API with the JSON object.