Add ping2
This commit is contained in:
@@ -76,9 +76,7 @@
|
||||
contentReq(page, parm) {
|
||||
console.log("contentReq", page);
|
||||
|
||||
if(page == "trmShow") {
|
||||
this.trmShow();
|
||||
}
|
||||
(this[page])();
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +274,204 @@
|
||||
// console.log(window.location)
|
||||
}
|
||||
|
||||
//==========================
|
||||
|
||||
ping2AddrSet(w, addr) {
|
||||
this.blobPing2Wind[w].nodeAddr.innerHTML = addr;
|
||||
this.blobPing2Wind[w].nodeAddrList.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
ping2Addr(w) {
|
||||
if(!this.blobPing2Wind[w].nodeAddrList) {
|
||||
this.blobPing2Wind[w].nodeAddrList = dcrt({
|
||||
tag : "div",
|
||||
style: "display:block; visibility:hidden; position:absolute; top:32px; left:110px; background-color:#222; overflow:auto; border:1px solid grey; padding:15px;",
|
||||
parn : this.blobPing2Wind[w].nodeRoot
|
||||
});
|
||||
|
||||
for(var i = 0; i < this.listPing2Addr.length; i++) {
|
||||
dcrt({
|
||||
tag : "div",
|
||||
parn : this.blobPing2Wind[w].nodeAddrList,
|
||||
click: this.ping2AddrSet.bind(this, w, this.listPing2Addr[i]),
|
||||
html : this.listPing2Addr[i]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(this.blobPing2Wind[w].nodeAddrList.style.visibility == "hidden") {
|
||||
this.blobPing2Wind[w].nodeAddrList.style.visibility = "visible";
|
||||
}
|
||||
else {
|
||||
this.blobPing2Wind[w].nodeAddrList.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
ping2Snip(w, cmd) {
|
||||
if(!cmd) {
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = {
|
||||
win : w + "",
|
||||
cmd : cmd,
|
||||
addr : this.blobPing2Wind[w].nodeAddr.innerHTML
|
||||
};
|
||||
|
||||
return this.reqSnip("ping2Exec", obj);
|
||||
}
|
||||
|
||||
ping2Blob(w, sty) {
|
||||
this.blobPing2Wind[w] = {
|
||||
list : []
|
||||
};
|
||||
|
||||
this.blobPing2Wind[w].nodeRoot = dcrt({
|
||||
tag : "div",
|
||||
style: sty,
|
||||
parn : this.nodePing2Body
|
||||
});
|
||||
|
||||
this.blobPing2Wind[w].nodeAddr = dcrt({
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:-2px; left:125px;",
|
||||
click: this.ping2Addr.bind(this, w),
|
||||
html : "8.8.8.8"
|
||||
});
|
||||
|
||||
this.blobPing2Wind[w].nodeHead = dcrt({
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:1px; height:32px; left:1px; right:1px; overflow:auto; border:0px solid red; padding:0;",
|
||||
parn : this.blobPing2Wind[w].nodeRoot,
|
||||
child: [
|
||||
{
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:0px; left:1px;",
|
||||
click: this.ping2Snip.bind(this, w, "start"),
|
||||
html : '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M320-200v-560l440 280-440 280Zm80-280Zm0 134 210-134-210-134v268Z"/></svg>'
|
||||
},
|
||||
{
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:0px; left:25px;",
|
||||
click: this.ping2Snip.bind(this, w, "stat"),
|
||||
html : '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M660-240v-480h80v480h-80Zm-440 0v-480l360 240-360 240Zm80-240Zm0 90 136-90-136-90v180Z"/></svg>'
|
||||
},
|
||||
{
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:0px; left:50px;",
|
||||
click: this.ping2Snip.bind(this, w, "stop"),
|
||||
html : '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M320-640v320-320Zm-80 400v-480h480v480H240Zm80-80h320v-320H320v320Z"/></svg>'
|
||||
},
|
||||
{
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:0px; left:100px;",
|
||||
click: this.ping2Addr.bind(this, w),
|
||||
html : '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M240-160q-33 0-56.5-23.5T160-240q0-33 23.5-56.5T240-320q33 0 56.5 23.5T320-240q0 33-23.5 56.5T240-160Zm240 0q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm240 0q-33 0-56.5-23.5T640-240q0-33 23.5-56.5T720-320q33 0 56.5 23.5T800-240q0 33-23.5 56.5T720-160ZM240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400ZM240-640q-33 0-56.5-23.5T160-720q0-33 23.5-56.5T240-800q33 0 56.5 23.5T320-720q0 33-23.5 56.5T240-640Zm240 0q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Zm240 0q-33 0-56.5-23.5T640-720q0-33 23.5-56.5T720-800q33 0 56.5 23.5T800-720q0 33-23.5 56.5T720-640Z"/></svg>'
|
||||
},
|
||||
this.blobPing2Wind[w].nodeAddr
|
||||
]
|
||||
});
|
||||
|
||||
this.blobPing2Wind[w].nodeBody = dcrt({
|
||||
tag : "div",
|
||||
style: "display:block; position:absolute; top:26px; bottom:1px; left:1px; right:1px; overflow:auto; border:1px solid grey;",
|
||||
parn : this.blobPing2Wind[w].nodeRoot
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ping2StartReq() {
|
||||
this.nodeDataHeadRoot.innerHTML = "";
|
||||
this.nodeDataBodyRoot.innerHTML = "";
|
||||
|
||||
if(!this.nodePing2Head) {
|
||||
this.listPing2Addr = [
|
||||
"1.1.1.1",
|
||||
"8.8.8.8",
|
||||
"8.8.4.4",
|
||||
"9.9.9.9"
|
||||
];
|
||||
|
||||
this.blobPing2Wind = [];
|
||||
|
||||
this.nodePing2Head = dcrt({
|
||||
tag : "h4",
|
||||
parn : this.nodeDataHeadRoot,
|
||||
style: "margin:4px;",
|
||||
html : "Ping2 Start request"
|
||||
});
|
||||
|
||||
this.nodePing2Body = dcrt({
|
||||
tag : "div",
|
||||
style: "display:block; position:relative; width:100%; height:100%; overflow:auto;",
|
||||
parn : this.nodeDataBodyRoot
|
||||
});
|
||||
|
||||
this.ping2Blob(0, "display:block; position:absolute; top:1px; bottom:1px; left:1px; right:calc(50% - 2px); overflow:auto; border:1px solid grey;");
|
||||
|
||||
this.ping2Blob(1, "display:block; position:absolute; top:1px; bottom:calc(50% - 2px); left:calc(50% + 3px); right:0; overflow:auto; border:1px solid grey;");
|
||||
|
||||
this.ping2Blob(2, "display:block; position:absolute; top:calc(50% - 1px); bottom:1px; left:calc(50% + 3px); right:0; overflow:auto; border:1px solid grey;");
|
||||
|
||||
this.nodePing2BodyList = [];
|
||||
}
|
||||
|
||||
this.nodeDataHeadRoot.appendChild(this.nodePing2Head);
|
||||
this.nodeDataBodyRoot.appendChild(this.nodePing2Body);
|
||||
|
||||
this.reqSnip("ping2Exec", {win: 0, cmd: "start", addr: "1.1.1.1"});
|
||||
this.reqSnip("ping2Exec", {win: 1, cmd: "start", addr: "8.8.8.8"});
|
||||
this.reqSnip("ping2Exec", {win: 2, cmd: "start", addr: "9.9.9.9"});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ping2StartRcv(obj) {
|
||||
// console.log(obj);
|
||||
this.nodePing2Head.innerHTML = "Ping2 starting";
|
||||
}
|
||||
|
||||
|
||||
ping2StopReq() {
|
||||
return this.reqSnip("ping2Stop");
|
||||
}
|
||||
|
||||
ping2StopRcv(obj) {
|
||||
// console.log(obj);
|
||||
}
|
||||
|
||||
ping2StatReq() {
|
||||
return this.reqSnip("ping2Stat");
|
||||
}
|
||||
|
||||
ping2StatRcv(obj) {
|
||||
// console.log(obj);
|
||||
}
|
||||
|
||||
ping2DataRcv(obj) {
|
||||
if(obj.data == "procid") {
|
||||
this.nodePing2Head.innerHTML = "Ping2 started " + obj.procid;
|
||||
return;
|
||||
}
|
||||
|
||||
var w = 0;
|
||||
|
||||
this.blobPing2Wind[w].list.push(dcrt({
|
||||
tag : "pre",
|
||||
style: "margin:0;",
|
||||
parn : this.blobPing2Wind[w].nodeBody,
|
||||
html : obj.string
|
||||
}));
|
||||
|
||||
this.blobPing2Wind[w].nodeBody.scrollTop = this.blobPing2Wind[w].nodeBody.scrollTopMax;
|
||||
|
||||
if(this.blobPing2Wind[w].list.length > 100) {
|
||||
var node = this.blobPing2Wind[w].list.shift();
|
||||
if(node)
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// END class
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user