map

return new Promise((resolve, reject) => {
    Promise.all([Me.getConfigData({
        "groupType": "source",
        "groupName": "PublicWIFI",
        "configName": "digitalInteractivePanel",
        "tenantId": "ndmc.com"
    })]).then(gresponse => {
        var data2 = gresponse[0].result;
        var output = [];
    var active=0;
     
    var data3= Object.values(data2);
     
       
        data3.forEach((kitem, i) => {
       
               output.push({
                "geometry": {
                    "coordinates": {
                        "lat": parseFloat(kitem.latitude),
                        "lon": parseFloat(kitem.longitude)
                    },
                    "type": "Point"
                },
                "type": "Feature",
                "properties": {
                    "name": "Smart Light Details",
                    "name": {
                        "val": kitem.name,
                        "rawVal": kitem.name,
                        "label": "Name",
                        "type": "string",
                        "required": true,
                        "order": 1
                    }
,
                    "location": {
                        "val": kitem.location,
                        "rawVal": kitem.location,
                        "label": "Location",
                        "type": "string",
                        "required": true,
                        "order": 2
                    },
                      "active_users": {
                        "val": kitem.details_by_ssid['Signpost-FREE-Wifi']['active_users'],
                        "rawVal": kitem.details_by_ssid['Signpost-FREE-Wifi']['active_users'],
                        "label": "Active Users",
                        "type": "string",
                        "required": true,
                        "order": 3
                    }
                }
            })
        });
        resolve({
            "result": {
                "data": output,
                "metaInfo": Me.props.metaInfo
            }
        });
    }).catch(error => {
        resolve({
            "result": {
                "data": [],
                "metaInfo": Me.props.metaInfo
            }
        });
    });
});

Comments

Popular posts from this blog

config aggregate and map

convert to ISO format