Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hardog
committed
Oct 7, 2016
1 parent
03a3d05
commit d893afe
Showing
6 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
//app.js | ||
App({ | ||
globalData: { | ||
plist: [] | ||
}, | ||
onLaunch: function () { | ||
console.log('app Launching ...'); | ||
} | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var app = getApp(); | ||
Page({ | ||
onLoad: function(opts){ | ||
console.log('detail:', app.globalData.plist[opts.index]); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<scroll-view scroll-y="true" style="height:600px" class="container"> | ||
<view class="m-name"> | ||
machine name & uptime | ||
</view> | ||
<view class="m-cpu"> | ||
cpu data | ||
</view> | ||
<view class="m-mem"> | ||
mem data | ||
</view> | ||
<view class="m-load"> | ||
loads | ||
</view> | ||
<view class="m-cores"> | ||
cores from cpu | ||
</view> | ||
<view class="m-plist"> | ||
process - list | ||
</view> | ||
</scroll-view> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
//index.js | ||
//获取应用实例 | ||
var app = getApp(); | ||
Page({ | ||
data:{ | ||
plist: [] | ||
}, | ||
onLaunch: function(){ | ||
console.log('index Launching ...'); | ||
}, | ||
onShow: function(){ | ||
var that = this; | ||
|
||
setInterval(function(){ | ||
that.intervalMonit(); | ||
}, 1000); | ||
}, | ||
go: function(e){ | ||
wx.navigateTo({ | ||
url: '../detail/detail?index=' + e.currentTarget.id | ||
}); | ||
}, | ||
intervalMonit: function(){ | ||
var that = this; | ||
|
||
wx.request({ | ||
url: 'http://localhost:8080', | ||
header: { | ||
'Content-Type': 'application/json' | ||
}, | ||
success: function(r){ | ||
app.globalData.plist = r.data; | ||
that.setData({ | ||
plist: r.data | ||
}); | ||
} | ||
}); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
<!--index.wxml--> | ||
<scroll-view scroll-y="true" class="container"> | ||
|
||
<view class="m" wx:for="{{plist}}" bindtap="go" id="{{index}}"> | ||
<text class="m-name">{{item.sys.hostname}}</text> | ||
<view class="m-data"> | ||
<view class="m-data-left"> | ||
<text class="m-data-top">{{item.sys.cpus.percent}}</text> | ||
<text class="m-data-top">{{item.sys.mem.percent}}</text> | ||
</view> | ||
<view class="m-data-right"> | ||
<text class="m-data-top">{{item.sys.load[0]}}, {{item.sys.load[1]}}, {{item.sys.load[2]}}</text> | ||
<text class="m-data-top">进程数: {{item.procs.length}}</text> | ||
</view> | ||
</view> | ||
</view> | ||
</scroll-view> |