求人修改SolusVMController3.2 批量监控vps的程序.

搬瓦工机场JMS

SolusVMController3.2
这是一款通过SolusVM 监控vps的程序.
我研究一晚上了,实在不懂js,求哪位大哥把硬盘,网络,内存等信息直接修改成列表里显示.
谢谢.
下载地址:https://github.com/svn2github/solusvmcontroller

  1. function refreshStatus(){
  2.                 $("#result").html("");
  3.                 $("#vm-list .icon").each(function(i, img){
  4.                         var m = $(img).parent().parent().parent();
  5.                         var p = $(img).parent();
  6.                         var n = p.next();
  7.                         var id = m.attr("data-field");
  8.                         p.hide();
  9.                         n.show();
  10.                         $.post("?q=status.json", {id: id}, function(data){
  11.                                 p.show();
  12.                                 n.hide();
  13.                                 $("#result").html(data.message);
  14.                         }, "json");
  15.                 });
  16.         }

复制代码

例子这里代码 data.ips 在上面可以调用ip. 可是在 下面代码就调不到ip了.

  1. function listVM(keyword, sort){
  2.                 sort = sort || "label";
  3.                 $("#vm-list").html("");
  4.                 $(".progress").show();
  5.                 $.post("?q=list-vm.json", {keyword: keyword, sort: sort }, function(data){
  6.                         $(".progress").hide();
  7.                         if(!data.length){
  8.                                 $("#vm-list").html(\'<p class="red">’ . THERE_ARE_NO_RESULTS_FOUND . ‘</p>\’);
  9.                                 return;
  10.                         }
  11.                         $.each(data, function(i,item){
  12.             function(data){
  13.                                 var li = $("<li />").html(\'<span></span><ul><li style="width:18px;display:none;"><div class="loading" style="margin:10px 0 0 0;"></div><li><li style="width:295px;" onclick="window.location.href=\\\’?q=view-vm&id=\’ + item.id + \’&ref=’ . rawurlencode(getPageURL()) . ‘\\\’;">\’ + item.label + \'</li><li style="width:18px;"><img src="images/icons/\’ + data.status + \’.png" class="icon" /></li><li></li><li style="width:40px;"><span class="\’ + item.vz + \’">\’ + item.vz + \'</span></li><li><button class="boot"></button> <button class="reboot"></button> <button class="shutdown"></button></li><li style="display:none;"><div class="loading" style="margin:10px 0 0 100px;"></div><li></ul><div style="clear:both;"></div>\’).attr("data-field", item.id);
  14. };
  15.                                 $("#vm-list").append(li);
  16.                                 li.find(".icon").click(function(){
  17.                                         var img = $(this);
  18.                                         var p = img.parent();
  19.                                         var n = p.next();
  20.                                         p.hide();
  21.                                         n.show();
  22.                                         $.post("?q=status.json", {id: item.id}, function(data){
  23.                                                 $(img).attr("src", "images/icons/" + data.status + ".png");
  24.                                                 p.show();
  25.                                                 n.hide();
  26.                                         }, "json");
  27.                                 });
  28.                                 li.find(".boot,.reboot,.shutdown").each(function(i, btn){
  29.                                         var c = $(btn).attr("class");
  30.                                         var p = $(btn).parent();
  31.                                         var n = p.next();
  32.                                         $(btn).click(function(){
  33.                                                 var img = $(this).parent().parent().find(".icon");
  34.                                                 var label = img.parent().next().next().next().html();
  35.                                                 p.hide();
  36.                                                 n.show();
  37.                                                 $.post("?q=control.json", {id: item.id, action: c}, function(data){
  38.                                                         p.show();
  39.                                                         n.hide();
  40.                                                         $("#result").html(data.message);
  41.                                                 }, "json");
  42.                                         });
  43.                                 });
  44.                         });
  45.                 }, "json");
  46.         }

复制代码

广西网友:没看懂你的意思

未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » 求人修改SolusVMController3.2 批量监控vps的程序.

赞 (0) 打赏

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏