gandetails.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <div class="standardContainer">
  2. <button onclick="exitToGanList();" class="ui large circular black icon button"><i class="angle left icon"></i></button>
  3. <div style="max-width: 300px; margin-top: 1em;">
  4. <button onclick='$("#gannetDetailEdit").slideToggle("fast");' class="ui mini basic right floated circular icon button" style="display: inline-block; margin-top: 2.5em;"><i class="ui edit icon"></i></button>
  5. <h1 class="ui header">
  6. <span class="ganetID"></span>
  7. <div class="sub header ganetName"></div>
  8. </h1>
  9. <div class="ui divider"></div>
  10. <p><span class="ganetDesc"></span></p>
  11. </div>
  12. <div id="gannetDetailEdit" class="ui form" style="margin-top: 1em; display:none;">
  13. <div class="ui divider"></div>
  14. <p>You can change the network name and description below. <br>The name and description is only for easy management purpose and will not effect the network operation.</p>
  15. <div class="field">
  16. <label>Network Name</label>
  17. <input type="text" id="gaNetNameInput" placeholder="">
  18. </div>
  19. <div class="field">
  20. <label>Network Description</label>
  21. <textarea id="gaNetDescInput" style="resize: none;"></textarea>
  22. <button onclick="saveNameAndDesc(this);" class="ui basic right floated button" style="margin-top: 0.6em;"><i class="ui save icon"></i> Save</button>
  23. <button onclick='$("#gannetDetailEdit").slideUp("fast");' class="ui basic right floated button" style="margin-top: 0.6em;"><i class="ui red remove icon"></i> Cancel</button>
  24. </div>
  25. <br><br>
  26. </div>
  27. <div class="ui divider"></div>
  28. <h2>Settings</h2>
  29. <div class="" style="overflow-x: auto;">
  30. <table class="ui basic celled unstackable table" style="min-width: 560px;">
  31. <thead>
  32. <tr>
  33. <th colspan="4">IPv4 Auto-Assign</th>
  34. </tr>
  35. </thead>
  36. <tbody id="ganetRangeTable">
  37. </tbody>
  38. </table>
  39. </div>
  40. <br>
  41. <div class="ui form">
  42. <h3>Custom IP Range</h3>
  43. <p>Manual IP Range Configuration. The IP range must be within the selected CIDR range.
  44. <br>Use <code>Utilities > IP to CIDR tool</code> if you are not too familiar with CIDR notations.</p>
  45. <div class="two fields">
  46. <div class="field">
  47. <label>IP Start</label>
  48. <input type="text" class="ganIpStart" placeholder="">
  49. </div>
  50. <div class="field">
  51. <label>IP End</label>
  52. <input type="text" class="ganIpEnd" placeholder="">
  53. </div>
  54. </div>
  55. </div>
  56. <button onclick="setNetworkRange();" class="ui basic button"><i class="ui blue save icon"></i> Save Settings</button>
  57. <div class="ui divider"></div>
  58. <h2>Members</h2>
  59. <p>To join this network using command line, type <code>sudo zerotier-cli join <span class="ganetID"></span></code> on your device terminal</p>
  60. <div class="ui checkbox" style="margin-bottom: 1em;">
  61. <input id="showUnauthorizedMembers" type="checkbox" onchange="changeUnauthorizedVisibility(this.checked);" checked>
  62. <label>Show Unauthorized Members</label>
  63. </div>
  64. <div class="" style="overflow-x: auto;">
  65. <table class="ui celled unstackable table">
  66. <thead>
  67. <tr>
  68. <th>Auth</th>
  69. <th>Address</th>
  70. <th>Name</th>
  71. <th>Managed IP</th>
  72. <th>Authorized Since</th>
  73. <th>Version</th>
  74. <th>Remove</th>
  75. </tr>
  76. </thead>
  77. <tbody id="networkMemeberTable">
  78. <tr>
  79. </tr>
  80. </tbody>
  81. </table>
  82. </div>
  83. <div class="ui divider"></div>
  84. <h4>Add Controller as Member</h4>
  85. <p>Optionally you can add the network controller (ZeroTier running on the Zoraxy node) as member for cross GAN reverse proxy to bypass NAT limitations.</p>
  86. <button class="ui basic small button addControllerToNetworkBtn" onclick="ganAddControllerToNetwork(this);"><i class="green add icon"></i> Add Controller as Member</button>
  87. <button class="ui basic small button removeControllerFromNetworkBtn" onclick="ganRemoveControllerFromNetwork(this);"><i class="red sign-out icon"></i> Remove Controller from Member</button>
  88. <br><br>
  89. </div>
  90. <script>
  91. $(".checkbox").checkbox();
  92. var currentGANetID = "";
  93. var currentGANNetMemeberListener = undefined;
  94. var currentGaNetDetails = {};
  95. var currentGANMemberList = [];
  96. var netRanges = {
  97. "10.147.17.*": "10.147.17.0/24",
  98. "10.147.18.*": "10.147.18.0/24",
  99. "10.147.19.*": "10.147.19.0/24",
  100. "10.147.20.*": "10.147.20.0/24",
  101. "10.144.*.*": "10.144.0.0/16",
  102. "10.241.*.*": "10.241.0.0/16",
  103. "10.242.*.*": "10.242.0.0/16",
  104. "10.243.*.*": "10.243.0.0/16",
  105. "10.244.*.*": "10.244.0.0/16",
  106. "172.22.*.*": "172.22.0.0/15",
  107. "172.23.*.*": "172.23.0.0/16",
  108. "172.24.*.*": "172.24.0.0/14",
  109. "172.25.*.*": "172.25.0.0/16",
  110. "172.26.*.*": "172.26.0.0/15",
  111. "172.27.*.*": "172.27.0.0/16",
  112. "172.28.*.*": "172.28.0.0/15",
  113. "172.29.*.*": "172.29.0.0/16",
  114. "172.30.*.*": "172.30.0.0/15",
  115. "192.168.191.*": "192.168.191.0/24",
  116. "192.168.192.*": "192.168.192.0/24",
  117. "192.168.193.*": "192.168.193.0/24",
  118. "192.168.194.*": "192.168.194.0/24",
  119. "192.168.195.*": "192.168.195.0/24",
  120. "192.168.196.*": "192.168.196.0/24"
  121. }
  122. function generateIPRangeTable(netRanges) {
  123. $("#ganetRangeTable").empty();
  124. const tableBody = document.getElementById('ganetRangeTable');
  125. const cidrs = Object.values(netRanges);
  126. // Set the number of rows and columns to display in the table
  127. const numRows = 6;
  128. const numCols = 4;
  129. let row = document.createElement('tr');
  130. let col = 0;
  131. for (let i = 0; i < cidrs.length; i++) {
  132. if (col >= numCols) {
  133. tableBody.appendChild(row);
  134. row = document.createElement('tr');
  135. col = 0;
  136. }
  137. const td = document.createElement('td');
  138. td.setAttribute('class', `clickable iprange`);
  139. td.setAttribute('CIDR', cidrs[i]);
  140. td.innerHTML = cidrs[i];
  141. let thisCidr = cidrs[i];
  142. td.onclick = function(){
  143. selectNetworkRange(thisCidr, td);
  144. };
  145. row.appendChild(td);
  146. col++;
  147. }
  148. // Add any remaining cells to the table
  149. if (col > 0) {
  150. for (let i = col; i < numCols; i++) {
  151. row.appendChild(document.createElement('td'));
  152. }
  153. tableBody.appendChild(row);
  154. }
  155. }
  156. function highlightCurrentGANetCIDR(){
  157. var currentCIDR = currentGaNetDetails.routes[0].target;
  158. $(".iprange").each(function(){
  159. if ($(this).attr("CIDR") == currentCIDR){
  160. $(this).addClass("active");
  161. populateStartEndIpByCidr(currentCIDR);
  162. }
  163. })
  164. }
  165. function populateStartEndIpByCidr(cidr){
  166. function cidrToRange(cidr) {
  167. var range = [2];
  168. cidr = cidr.split('/');
  169. var start = ip2long(cidr[0]);
  170. range[0] = long2ip(start);
  171. range[1] = long2ip(Math.pow(2, 32 - cidr[1]) + start - 1);
  172. return range;
  173. }
  174. var cidrRange = cidrToRange(cidr);
  175. $(".ganIpStart").val(cidrRange[0]);
  176. $(".ganIpEnd").val(cidrRange[1]);
  177. }
  178. function selectNetworkRange(cidr, object){
  179. populateStartEndIpByCidr(cidr);
  180. $(".iprange.active").removeClass("active");
  181. $(object).addClass("active");
  182. }
  183. function setNetworkRange(){
  184. var ipstart = $(".ganIpStart").val().trim();
  185. var ipend = $(".ganIpEnd").val().trim();
  186. if (ipstart == ""){
  187. $(".ganIpStart").parent().addClass("error");
  188. }else{
  189. $(".ganIpStart").parent().removeClass("error");
  190. }
  191. if (ipend == ""){
  192. $(".ganIpEnd").parent().addClass("error");
  193. }else{
  194. $(".ganIpEnd").parent().removeClass("error");
  195. }
  196. //Get CIDR from selected range group
  197. var cidr = $(".iprange.active").attr("cidr");
  198. $.cjax({
  199. url: "/api/gan/network/setRange",
  200. metohd: "POST",
  201. data:{
  202. netid: currentGANetID,
  203. cidr: cidr,
  204. ipstart: ipstart,
  205. ipend: ipend
  206. },
  207. success: function(data){
  208. if (data.error != undefined){
  209. msgbox(data.error, false, 5000)
  210. }else{
  211. msgbox("Network Range Updated")
  212. }
  213. }
  214. })
  215. }
  216. function saveNameAndDesc(object=undefined){
  217. var name = $("#gaNetNameInput").val();
  218. var desc = $("#gaNetDescInput").val();
  219. if (object != undefined){
  220. $(object).addClass("loading");
  221. }
  222. $.cjax({
  223. url: "/api/gan/network/name",
  224. method: "POST",
  225. data: {
  226. netid: currentGANetID,
  227. name: name,
  228. desc: desc,
  229. },
  230. success: function(data){
  231. initNetNameAndDesc();
  232. if (object != undefined){
  233. $(object).removeClass("loading");
  234. msgbox("Network Metadata Updated");
  235. }
  236. $("#gannetDetailEdit").slideUp("fast");
  237. }
  238. });
  239. }
  240. function initNetNameAndDesc(){
  241. //Get the details of the net
  242. $.get("/api/gan/network/name?netid=" + currentGANetID, function(data){
  243. if (data.error !== undefined){
  244. msgbox(data.error, false, 6000);
  245. }else{
  246. $("#gaNetNameInput").val(data[0]);
  247. $(".ganetName").html(data[0]);
  248. $("#gaNetDescInput").val(data[1]);
  249. $(".ganetDesc").text(data[1]);
  250. }
  251. });
  252. }
  253. function initNetDetails(){
  254. //Get the details of the net
  255. $.get("/api/gan/network/list?netid=" + currentGANetID, function(data){
  256. if (data.error !== undefined){
  257. msgbox(data.error, false, 6000);
  258. }else{
  259. currentGaNetDetails = data;
  260. highlightCurrentGANetCIDR();
  261. }
  262. });
  263. }
  264. //Handle delete IP from memeber
  265. function deleteIpFromMemeber(memberid, ip){
  266. $.cjax({
  267. url: "/api/gan/members/ip",
  268. metohd: "POST",
  269. data: {
  270. netid: currentGANetID,
  271. memid: memberid,
  272. opr: "del",
  273. ip: ip,
  274. },
  275. success: function(data){
  276. if (data.error != undefined){
  277. msgbox(data.error, false, 5000);
  278. }else{
  279. msgbox("IP removed from member " + memberid)
  280. }
  281. renderMemeberTable();
  282. }
  283. });
  284. }
  285. function addIpToMemeberFromInput(memberid, newip){
  286. function isValidIPv4Address(address) {
  287. // Split the address into its 4 components
  288. const parts = address.split('.');
  289. // Check that there are 4 components
  290. if (parts.length !== 4) {
  291. return false;
  292. }
  293. // Check that each component is a number between 0 and 255
  294. for (let i = 0; i < 4; i++) {
  295. const part = parseInt(parts[i], 10);
  296. if (isNaN(part) || part < 0 || part > 255) {
  297. return false;
  298. }
  299. }
  300. // The address is valid
  301. return true;
  302. }
  303. if (!isValidIPv4Address(newip)){
  304. msgbox(newip + " is not a valid IPv4 address", false, 5000)
  305. return
  306. }
  307. $.cjax({
  308. url: "/api/gan/members/ip",
  309. metohd: "POST",
  310. data: {
  311. netid: currentGANetID,
  312. memid: memberid,
  313. opr: "add",
  314. ip: newip,
  315. },
  316. success: function(data){
  317. if (data.error != undefined){
  318. msgbox(data.error, false, 5000);
  319. }else{
  320. msgbox("IP added to member " + memberid)
  321. }
  322. renderMemeberTable();
  323. }
  324. })
  325. }
  326. //Member table populate
  327. function renderMemeberTable(forceUpdate = false) {
  328. $.ajax({
  329. url: '/api/gan/members/list?netid=' + currentGANetID + '&detail=true',
  330. type: 'GET',
  331. success: function(data) {
  332. let tableBody = $('#networkMemeberTable');
  333. if (tableBody.length == 0){
  334. return;
  335. }
  336. data.sort((a, b) => a.address.localeCompare(b.address));
  337. //Check if the new object equal to the old one
  338. if (objectEqual(currentGANMemberList, data) && !forceUpdate){
  339. //Do not need to update it
  340. return;
  341. }
  342. tableBody.empty();
  343. currentGANMemberList = data;
  344. var authroziedCount = 0;
  345. data.forEach((member) => {
  346. let lastAuthTime = new Date(member.lastAuthorizedTime).toLocaleString();
  347. if (member.lastAuthorizedTime == 0){
  348. lastAuthTime = "Never";
  349. }
  350. let version = `${member.vMajor}.${member.vMinor}.${member.vProto}.${member.vRev}`;
  351. if (member.vMajor == -1){
  352. version = "Unknown";
  353. }
  354. let authorizedCheckbox = `<div class="ui fitted checkbox">
  355. <input type="checkbox" addr="${member.address}" name="isAuthrozied" onchange="handleMemberAuth(this);">
  356. <label></label>
  357. </div>`;
  358. if (member.authorized){
  359. authorizedCheckbox = `<div class="ui fitted checkbox">
  360. <input type="checkbox" addr="${member.address}" name="isAuthrozied" onchange="handleMemberAuth(this);" checked="">
  361. <label></label>
  362. </div>`
  363. }
  364. let rowClass = "authorized";
  365. let unauthorizedStyle = "";
  366. if (!$("#showUnauthorizedMembers")[0].checked && !member.authorized){
  367. unauthorizedStyle = "display:none;";
  368. }
  369. if (!member.authorized){
  370. rowClass = "unauthorized";
  371. }else{
  372. authroziedCount++;
  373. }
  374. let assignedIp = "";
  375. if (member.ipAssignments.length == 0){
  376. assignedIp = "Not assigned"
  377. }else{
  378. assignedIp = `<div class="ui list">`
  379. member.ipAssignments.forEach(function(thisIp){
  380. assignedIp += `<div class="item" style="width: 100%;">${thisIp} <a style="cursor:pointer; float: right;" title="Remove IP" onclick="deleteIpFromMemeber('${member.address}','${thisIp}');"><i class="red remove icon"></i></a></div>`;
  381. })
  382. assignedIp += `</div>`
  383. }
  384. const row = $(`<tr class="GANetMemberEntity ${rowClass}" style="${unauthorizedStyle}">`);
  385. row.append($(`<td class="GANetMember ${rowClass}" style="text-align: center;">`).html(authorizedCheckbox));
  386. row.append($('<td>').text(member.address));
  387. row.append($('<td>').html(`<span class="memberName" addr="${member.address}"></span> <a style="cursor:pointer; float: right;" title="Edit Memeber Name" onclick="renameMember('${member.address}');"><i class="grey edit icon"></i></a>`));
  388. row.append($('<td>').html(`${assignedIp}
  389. <div class="ui action mini fluid input" style="min-width: 200px;">
  390. <input type="text" placeholder="IPv4" onchange="$(this).val($(this).val().trim());">
  391. <button onclick="addIpToMemeberFromInput('${member.address}',$(this).parent().find('input').val());" class="ui basic icon button">
  392. <i class="add icon"></i>
  393. </button>
  394. </div>`));
  395. row.append($('<td>').text(lastAuthTime));
  396. row.append($('<td>').text(version));
  397. row.append($(`<td title="Deauthorize & Delete Memeber" style="text-align: center;" onclick="handleMemberDelete('${member.address}');">`).html(`<button class="ui basic mini icon button"><i class="red remove icon"></i></button>`));
  398. tableBody.append(row);
  399. });
  400. if (data.length == 0){
  401. tableBody.append(`<tr>
  402. <td colspan="7"><i class="green check circle icon"></i> No member has joined this network yet.</td>
  403. </tr>`);
  404. }
  405. if (data.length > 0 && authroziedCount == 0 && !$("#showUnauthorizedMembers")[0].checked){
  406. //All nodes are unauthorized. Show tips to enable unauthorize display
  407. tableBody.append(`<tr>
  408. <td colspan="7"><i class="yellow exclamation circle icon"></i> Unauthorized nodes detected. Enable "Show Unauthorized Member" to change member access permission.</td>
  409. </tr>`);
  410. }
  411. initNameForMembers();
  412. },
  413. error: function(xhr, status, error) {
  414. console.log('Error:', error);
  415. }
  416. });
  417. }
  418. function initNameForMembers(){
  419. $(".memberName").each(function(){
  420. let addr = $(this).attr("addr");
  421. let targetDOM = $(this);
  422. $.cjax({
  423. url: "/api/gan/members/name",
  424. method: "POST",
  425. data: {
  426. netid: currentGANetID,
  427. memid: addr,
  428. },
  429. success: function(data){
  430. if (data.error != undefined){
  431. $(targetDOM).text("N/A");
  432. }else{
  433. $(targetDOM).text(data.Name);
  434. }
  435. }
  436. });
  437. })
  438. }
  439. function renameMember(targetMemberAddr){
  440. if (targetMemberAddr == ""){
  441. msgbox("Member address cannot be empty", false, 5000)
  442. return
  443. }
  444. let newname = prompt("Enter a easy manageable name for " + targetMemberAddr, "");
  445. if (newname != null && newname.trim() != "") {
  446. $.cjax({
  447. url: "/api/gan/members/name",
  448. method: "POST",
  449. data: {
  450. netid: currentGANetID,
  451. memid: targetMemberAddr,
  452. name: newname
  453. },
  454. success: function(data){
  455. if (data.error != undefined){
  456. msgbox(data.error, false, 6000);
  457. }else{
  458. msgbox("Member Name Updated");
  459. }
  460. renderMemeberTable(true);
  461. }
  462. })
  463. }
  464. }
  465. //Helper function to check if two objects are equal recursively
  466. function objectEqual(obj1, obj2) {
  467. // compare types
  468. if (typeof obj1 !== typeof obj2) {
  469. return false;
  470. }
  471. // compare values
  472. if (typeof obj1 !== 'object' || obj1 === null) {
  473. return obj1 === obj2;
  474. }
  475. const keys1 = Object.keys(obj1);
  476. const keys2 = Object.keys(obj2);
  477. // compare keys
  478. if (keys1.length !== keys2.length) {
  479. return false;
  480. }
  481. for (const key of keys1) {
  482. if (!keys2.includes(key)) {
  483. return false;
  484. }
  485. // recursively compare values
  486. if (!objectEqual(obj1[key], obj2[key])) {
  487. return false;
  488. }
  489. }
  490. return true;
  491. }
  492. function changeUnauthorizedVisibility(visable){
  493. if(visable){
  494. $(".GANetMemberEntity.unauthorized").show();
  495. }else{
  496. $(".GANetMemberEntity.unauthorized").hide();
  497. }
  498. }
  499. function handleMemberAuth(object){
  500. let targetMemberAddr = $(object).attr("addr");
  501. let isAuthed = object.checked;
  502. $.cjax({
  503. url: "/api/gan/members/authorize",
  504. method: "POST",
  505. data: {
  506. netid:currentGANetID,
  507. memid: targetMemberAddr,
  508. auth: isAuthed
  509. },
  510. success: function(data){
  511. if (data.error != undefined){
  512. msgbox(data.error, false, 6000);
  513. }else{
  514. if (isAuthed){
  515. msgbox("Member Authorized");
  516. }else{
  517. msgbox("Member Deauthorized");
  518. }
  519. }
  520. renderMemeberTable(true);
  521. }
  522. })
  523. }
  524. function handleMemberDelete(addr){
  525. if (confirm("Confirm delete member " + addr + " ?")){
  526. $.cjax({
  527. url: "/api/gan/members/delete",
  528. method: "POST",
  529. data: {
  530. netid:currentGANetID,
  531. memid: addr,
  532. },
  533. success: function(data){
  534. if (data.error != undefined){
  535. msgbox(data.error, false, 6000);
  536. }else{
  537. msgbox("Member Deleted");
  538. }
  539. renderMemeberTable(true);
  540. }
  541. });
  542. }
  543. }
  544. //Add and remove this controller node to network as member
  545. function ganAddControllerToNetwork(){
  546. $(".addControllerToNetworkBtn").addClass("disabled");
  547. $(".addControllerToNetworkBtn").addClass("loading");
  548. $.cjax({
  549. url: "/api/gan/network/join",
  550. method: "POST",
  551. data: {
  552. netid:currentGANetID,
  553. },
  554. success: function(data){
  555. $(".addControllerToNetworkBtn").removeClass("disabled");
  556. $(".addControllerToNetworkBtn").removeClass("loading");
  557. if (data.error != undefined){
  558. msgbox(data.error, false, 6000);
  559. }else{
  560. msgbox("Controller joint " + currentGANetID);
  561. }
  562. setTimeout(function(){
  563. renderMemeberTable(true);
  564. }, 3000)
  565. }
  566. });
  567. }
  568. function ganRemoveControllerFromNetwork(){
  569. $(".removeControllerFromNetworkBtn").addClass("disabled");
  570. $(".removeControllerFromNetworkBtn").addClass("loading");
  571. $.cjax({
  572. url: "/api/gan/network/leave",
  573. method: "POST",
  574. data: {
  575. netid:currentGANetID,
  576. },
  577. success: function(data){
  578. if (data.error != undefined){
  579. msgbox(data.error, false, 6000);
  580. }else{
  581. msgbox("Controller left " + currentGANetID);
  582. }
  583. renderMemeberTable(true);
  584. $(".removeControllerFromNetworkBtn").removeClass("disabled");
  585. $(".removeControllerFromNetworkBtn").removeClass("loading");
  586. }
  587. });
  588. }
  589. //Entry points
  590. function initGanetDetails(ganetId){
  591. currentGANetID = ganetId;
  592. $(".ganetID").text(ganetId);
  593. initNetNameAndDesc(ganetId);
  594. generateIPRangeTable(netRanges);
  595. initNetDetails();
  596. renderMemeberTable(true);
  597. //Setup a listener to listen for member list change
  598. if (currentGANNetMemeberListener == undefined){
  599. currentGANNetMemeberListener = setInterval(function(){
  600. if ($('#networkMemeberTable').length > 0 && currentGANetID){
  601. renderMemeberTable();
  602. }
  603. }, 3000);
  604. }
  605. }
  606. //Switch from other tabs back to this, exit to GAN list
  607. tabSwitchEventBind["gan"] = function(){
  608. exitToGanList();
  609. }
  610. //Exit point
  611. function exitToGanList(){
  612. $("#gan").load("./components/gan.html", function(){
  613. if (tabSwitchEventBind["gan"]){
  614. tabSwitchEventBind["gan"]();
  615. }
  616. });
  617. }
  618. </script>