SolusVMController3.2
这是一款通过SolusVM 监控vps的程序.
我研究一晚上了,实在不懂js,求哪位大哥把硬盘,网络,内存等信息直接修改成列表里显示.
谢谢.
下载地址:https://github.com/svn2github/solusvmcontroller
- function refreshStatus(){
- $("#result").html("");
- $("#vm-list .icon").each(function(i, img){
- var m = $(img).parent().parent().parent();
- var p = $(img).parent();
- var n = p.next();
- var id = m.attr("data-field");
- p.hide();
- n.show();
- $.post("?q=status.json", {id: id}, function(data){
- p.show();
- n.hide();
- $("#result").html(data.message);
- }, "json");
- });
- }
复制代码
例子这里代码 data.ips 在上面可以调用ip. 可是在 下面代码就调不到ip了.
- function listVM(keyword, sort){
- sort = sort || "label";
- $("#vm-list").html("");
- $(".progress").show();
- $.post("?q=list-vm.json", {keyword: keyword, sort: sort }, function(data){
- $(".progress").hide();
- if(!data.length){
- $("#vm-list").html(\'<p class="red">’ . THERE_ARE_NO_RESULTS_FOUND . ‘</p>\’);
- return;
- }
- $.each(data, function(i,item){
- function(data){
- 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);
- };
- $("#vm-list").append(li);
- li.find(".icon").click(function(){
- var img = $(this);
- var p = img.parent();
- var n = p.next();
- p.hide();
- n.show();
- $.post("?q=status.json", {id: item.id}, function(data){
- $(img).attr("src", "images/icons/" + data.status + ".png");
- p.show();
- n.hide();
- }, "json");
- });
- li.find(".boot,.reboot,.shutdown").each(function(i, btn){
- var c = $(btn).attr("class");
- var p = $(btn).parent();
- var n = p.next();
- $(btn).click(function(){
- var img = $(this).parent().parent().find(".icon");
- var label = img.parent().next().next().next().html();
- p.hide();
- n.show();
- $.post("?q=control.json", {id: item.id, action: c}, function(data){
- p.show();
- n.hide();
- $("#result").html(data.message);
- }, "json");
- });
- });
- });
- }, "json");
- }
复制代码
广西网友:没看懂你的意思