Skip to content

Instantly share code, notes, and snippets.

@bitmorse
Created February 4, 2016 14:12
Show Gist options
  • Save bitmorse/919304e847a3eae6d44c to your computer and use it in GitHub Desktop.
Save bitmorse/919304e847a3eae6d44c to your computer and use it in GitHub Desktop.
{"version":"2.38.1-0","grid":{"layers":{"View All":{"name":"View All"},"Default layer":{"name":"Default layer"}},"xWidth":10,"yHeight":10},"modules":[{"url":"modules/types/server_interaction/webservice_search/","configuration":{"sections":{"postvariables":[{"sections":{},"groups":{"postvariables":[[{"destination":"data","filter":"none"}]]}}]},"groups":{"group":[{"url":["https://crossorigin.me/http://ttnstatus.org/gateways"],"method":["GET"],"dataType":["form"],"withCredentials":[[]],"showStatus":[[]],"button":[["button"]],"buttonlabel":["Refresh Gateways"],"buttonlabel_exec":["Refreshing Gateways..."],"onloadsearch":[["button"]],"debounce":[0],"resultfilter":["return data;"],"askConfirm":[[]],"confirmText":["Are you sure?"]}],"headers":[[{}]],"searchparams":[[{"destination":"url","fieldtype":"text"}]]}},"layers":{"View All":{"position":{"left":121,"top":0},"size":{"width":16,"height":8},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"},"Default layer":{"position":{"left":83,"top":0},"size":{"width":16,"height":8},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"}},"id":1,"vars_in":[{}],"actions_in":[{}],"title":"","vars_out":[{"event":"onSearchReturn","rel":"results","jpath":[],"name":"gateways"}],"actions_out":[{"event":"onSearchReturn","rel":"results","jpath":[],"name":"gatewaysAction"}]},{"url":"modules/types/client_interaction/code_executor/","configuration":{"sections":{},"groups":{"group":[{"display":[["editor","buttons"]],"execOnLoad":[[]],"script":["var gws = this.get('gateways');\n\n\nvar featurecollection = { \n value: {\n type: \"FeatureCollection\",\n features: []\n },\n type: \"geojson\"\n};\n \n\ngws.forEach(function(gwraw){\n \n try{\n var lat = parseFloat(gwraw.location.split(\",\")[0]);\n var lon = parseFloat(gwraw.location.split(\",\")[1]);\n \n if(lat){\n var gatewayfeature = {\n type: \"Feature\",\n geometry: {\n type: \"Point\",\n coordinates: []\n },\n properties: {\n eui: \"\",\n remarks: \"\",\n last_seen: \"\"\n }\n }\n\n gatewayfeature.geometry.coordinates.push(lon);\n gatewayfeature.geometry.coordinates.push(lat);\n gatewayfeature.properties.eui = gwraw.eui;\n gatewayfeature.properties.remarks = gwraw.remarks;\n gatewayfeature.properties.last_seen = gwraw.last_seen;\n gatewayfeature.properties.status = gwraw.status;\n featurecollection.value.features.push(gatewayfeature);\n }\n\n }catch(err){\n console.log(\"ttnmap: couldn't split lat/lon\")\n }\n \n});\n\n\nthis.set('gatewaysGeoJSON', (featurecollection));\n\n\n"]}],"libs":[[{}]],"buttons":[[{"name":"button1","label":"Execute"}]]}},"layers":{"View All":{"position":{"left":83,"top":16},"size":{"width":65,"height":65},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"},"Default layer":{"position":{"left":83,"top":16},"size":{"width":65,"height":65},"zIndex":0,"display":false,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"}},"id":2,"vars_in":[{"rel":"inputValue","name":"gateways"}],"actions_in":[{"rel":"execute","name":"gatewaysAction"}],"title":"","vars_out":[{"event":"onScriptEnded","rel":"outputValue","jpath":["gatewaysGeoJSON"],"name":"gatewaysGeoJSON"}],"actions_out":[]},{"url":"modules/types/chart/maps/leaflet/","configuration":{"sections":{},"groups":{"group":[{"maptiles":["osm"],"mapcenter":["48,8"],"mapzoom":[5],"autofit":["nofit"]}],"markers":[{"markerjpath":["element"],"markerkind":["circle"],"markercolor":[[20,37,231,1]],"markersize":["10"]}]}},"layers":{"View All":{"position":{"left":2,"top":0},"size":{"width":79,"height":81},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"},"Default layer":{"position":{"left":2,"top":0},"size":{"width":79,"height":81},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"}},"id":3,"vars_in":[{"rel":"geojson","name":"gatewaysGeoJSON"}],"actions_in":[{}],"title":"","vars_out":[{"event":"onHoverElement","rel":"item","jpath":[],"name":"mapItem"}],"actions_out":[{"jpath":[]}]},{"url":"modules/types/display/template-twig/","configuration":{"sections":{},"groups":{"group":[{"template":["<ul style=\"font-size:14pt\">\n <li>EUI: {{mapItem.eui}}</li>\n <li>Status: {{mapItem.status}}</li>\n <li>Remarks: {{mapItem.remarks}}</li>\n <li>Last seen: {{mapItem.last_seen}}</li>\n</ul>\n"]}]}},"layers":{"View All":{"position":{"left":83,"top":0},"size":{"width":36,"height":15},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"},"Default layer":{"position":{"left":83,"top":9},"size":{"width":36,"height":15},"zIndex":0,"display":true,"title":"","bgColor":[255,255,255,0],"wrapper":true,"created":true,"name":"Default layer"}},"id":4,"vars_in":[{"rel":"value","name":"mapItem"}],"actions_in":[{}],"title":"","vars_out":[],"actions_out":[]}],"variables":[{"varname":"gateways","jpath":["gateways"]},{"varname":"gatewaysGeoJSON","jpath":["gatewaysGeoJSON"]}],"aliases":[],"pouchvariables":[],"configuration":{"title":"No title"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment