Last active
January 30, 2018 14:20
-
-
Save GordonSmith/18788951ea29ce77851a2481fed3b7da to your computer and use it in GitHub Desktop.
@hpcc-js/comms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding:0px; | |
margin:0px; | |
font-family: "Lucida Console", Monaco, monospace; | |
font-size: 12px; | |
} | |
#placeholder { | |
width:100%; | |
height:100vh; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>LogicalFile Fetch</title> | |
<link rel="stylesheet" href="./index.css"> | |
<script src="http://unpkg.com/@hpcc-js/[email protected]"></script> | |
<script src="http://unpkg.com/@hpcc-js/[email protected]"></script> | |
<script> | |
var hpccComms = window["@hpcc-js/comms"]; | |
</script> | |
</head> | |
<body> | |
<div id="placeholder"> | |
</div> | |
<script src="./index.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var textArr = []; | |
var placeholder = document.getElementById("placeholder"); | |
var info = []; | |
// Logical File --- | |
var lf = new hpccComms.Result({ baseUrl: "http://52.51.90.23:8010" }, "hpccvisualization::databreach"); | |
lf.set({ NodeGroup: "hthor" }); // https://github.com/hpcc-systems/Visualization/issues/2362 | |
fetchStuff("LF", lf); | |
// WU Result | |
var wur = new hpccComms.Result({ baseUrl: "http://52.51.90.23:8010" }, "W20160601-120631", "ie_population"); | |
fetchStuff("WU", wur); | |
// WU Query --- | |
hpccComms.Workunit.query({ baseUrl: "http://52.51.90.23:8010" }, { Owner: "gosmith", State: "completed" }).then(wus => { | |
return wus[0].fetchResults(); | |
}).then(results => { | |
fetchStuff("Q", results[0]); | |
}); | |
// Generic ESP Connection | |
var connection = new hpccComms.ESPConnection({ baseUrl: "http://52.51.90.23:8010" }, "WsDFU", "1.35"); | |
connection.send("DFUQuery", { LogicalName: "hpccv*" }).then(response => { | |
response.DFULogicalFiles.DFULogicalFile.forEach(lfInfo => { | |
log("DFU: " + lfInfo.NodeGroup + "->" + lfInfo.Name); | |
}); | |
}); | |
// Generic Connection | |
var connection = new hpccComms.Connection({ baseUrl: "https://maps.googleapis.com", type: "get" }); | |
connection.send("maps/api/geocode/json", { | |
address: "1600 Amphitheatre Parkway, Mountain View, CA", | |
key: "AIzaSyDwGn2i1i_pMZvnqYJN1BksD_tjYaCOWKg" | |
}).then(response => { | |
log("Google: " + JSON.stringify(response)); | |
}); | |
function fetchStuff(prefix, result) { | |
prefix += ": "; | |
result.fetchXMLSchema().then(schema => { | |
log(prefix + JSON.stringify(schema)); | |
}); | |
result.fetchRows(0, 10).then(response => { | |
log(prefix + "Fetched " + response.length + " rows of " + result.Total); | |
}); | |
result.fetchRows(11, 10).then(response => { | |
log(prefix + "Fetched " + response.length + " rows of " + result.Total); | |
}); | |
} | |
function log(msg) { | |
textArr.push(msg); | |
placeholder.innerHTML = textArr.join("<br>"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment