Skip to content

Commit 4688b4d

Browse files
committed
Update, fe
1 parent bb34316 commit 4688b4d

4 files changed

Lines changed: 43 additions & 37 deletions

File tree

cmd/fe/assets/css/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
body {
22
min-height: 20000px;
3+
min-width: 1600px;
34
}
45

56
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {

cmd/fe/assets/dashboard-fe.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ function renderSlotsCharts(slots_array) {
166166
}
167167
},
168168
xAxis: {
169-
categories: ['Pending', 'Default']
169+
categories: ['Migration', 'Default'],
170+
min: 0,
171+
max: 1,
170172
},
171173
yAxis: {
172174
min: 0,
@@ -375,7 +377,7 @@ dashboard.controller('MainCodisCtrl', ['$scope', '$http', '$uibModal', '$timeout
375377
});
376378
$scope.chart_ops = newChatsOpsConfig();
377379

378-
$scope.refresh_interval = 3;
380+
$scope.refresh_interval = 2;
379381

380382
$scope.resetOverview = function () {
381383
$scope.codis_name = "NA";
@@ -455,7 +457,8 @@ dashboard.controller('MainCodisCtrl', ['$scope', '$http', '$uibModal', '$timeout
455457

456458
$scope.refreshStats = function () {
457459
var codis_name = $scope.codis_name;
458-
if (isValidInput(codis_name)) {
460+
var codis_addr = $scope.codis_addr;
461+
if (isValidInput(codis_name) && isValidInput(codis_addr)) {
459462
var xauth = genXAuth(codis_name);
460463
var url = concatUrl("/api/topom/stats/" + xauth, codis_name);
461464
$http.get(url).then(function (resp) {

cmd/fe/assets/index.html

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<div class="row">
4444
<div class="col-md-4">
4545
<h4 style="padding-left:20px;"><b>Overview</b></h4>
46-
<table class="table table-bordered" style="font-weight:bold;">
46+
<table class="table table-bordered" style="font-weight: bold;">
4747
<col width="35%">
4848
<col width="65%">
4949
<tbody>
@@ -96,10 +96,7 @@ <h4 style="padding-left:20px;"><b>Overview</b></h4>
9696
</div>
9797
<div class="col-md-8">
9898
<h4 style="padding-left:70px; padding-bottom: 16px;"><b>QPS</b></h4>
99-
100-
<div class="content">
101-
<highchart config="chart_ops" style="height:285px"></highchart>
102-
</div>
99+
<highchart config="chart_ops" style="height:290px"></highchart>
103100
</div>
104101
</div>
105102

@@ -108,10 +105,10 @@ <h4 style="padding-left:70px; padding-bottom: 16px;"><b>QPS</b></h4>
108105
style="margin-bottom: 14px; padding-bottom: 10px; border-bottom: solid 1px lightgray;">
109106
<form class="form-inline">
110107
<h4 style="padding-left:20px; padding-right:20px; display: inline;">Proxy</h4>
111-
<span ng-if="codis_addr != 'NA'">
108+
<span ng-if="codis_addr != 'NA'" style="float: right;">
112109
<input style="width: 250px; " type="text" class="form-control" placeholder="Proxy Admin Address"
113110
ng-model="new_proxy">
114-
<button class="btn btn-success" style="width: 120px;"
111+
<button class="btn btn-warning" style="width: 120px;"
115112
ng-click="createProxy(new_proxy)"
116113
ng-disabled="!new_proxy">Add Proxy
117114
</button>
@@ -122,17 +119,17 @@ <h4 style="padding-left:20px; padding-right:20px; display: inline;">Proxy</h4>
122119
<table class="table table-bordered table-striped table-hover table-condensed">
123120
<thead>
124121
<tr>
125-
<th>ID</th>
126-
<th>Token</th>
122+
<th style="width: 1px;">ID</th>
123+
<th style="width: 1px; padding-right: 20px;">Token</th>
127124
<th>Proxy</th>
128125
<th>Admin</th>
129-
<th>Status</th>
126+
<th style="width: 350px;">Status</th>
130127
<th style="width: 35px;"></th>
131128
</tr>
132129
</thead>
133130
<tr ng-repeat="proxy in proxy_array">
134-
<td style="width: 1px;" class="text-center">[[proxy.id]]</td>
135-
<td style="width: 1px; padding-right: 20px; font-family: Courier, monospace; font-size: small; vertical-align: middle;">
131+
<td class="text-center">[[proxy.id]]</td>
132+
<td style="font-family: Courier, monospace; font-size: small; vertical-align: middle;">
136133
[[proxy.token]]
137134
</td>
138135
<td>[[proxy.proxy_addr]]</td>
@@ -173,13 +170,13 @@ <h4 style="padding-left:20px; padding-right:20px; display: inline;">Slots</h4>
173170
</button>
174171
</span>
175172
<span ng-if="codis_addr != 'NA'" style="float: right;">
176-
<input style="width: 140px; margin-left: 100px; " type="text"
173+
<input style="width: 80px; margin-left: 100px; " type="text"
177174
class="form-control" placeholder="Begin"
178175
ng-model="migrate_slot_id_beg">
179-
<input style="width: 140px; " type="text"
176+
<input style="width: 80px; " type="text"
180177
class="form-control" placeholder="End"
181178
ng-model="migrate_slot_id_end">
182-
<input style="width: 140px; "
179+
<input style="width: 120px; "
183180
pattern="^(?:[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])$"
184181
class="form-control" placeholder="Target Group"
185182
ng-model="migrate_range_to_group_id">
@@ -260,24 +257,26 @@ <h4 style="padding-left:20px; padding-right:20px; display: inline;">Slots</h4>
260257
<table class="table table-bordered table-striped table-hover table-condensed">
261258
<thead>
262259
<tr>
263-
<th>Slot</th>
264-
<th>Group</th>
265-
<th>Target</th>
260+
<th style="width: 1px;">Slot</th>
261+
<th style="width: 1px">Group</th>
262+
<th style="width: 1px">Target</th>
263+
<th style="width: 1px">Index</th>
266264
<th>Status</th>
267265
<th style="width: 35px;"></th>
268266
</tr>
269267
</thead>
270268
<tr ng-repeat="slot in slots_actions">
271-
<td style="width: 1px;" class="text-center">[[slot.id]]</td>
269+
<td class="text-center">[[slot.id]]</td>
272270
<td>[[slot.group_id]]</td>
273271
<td>[[slot.action.target_id]]</td>
272+
<td>[[slot.action.index]]</td>
274273
<td ng-switch="slot.action.state">
275-
<span ng-switch-when="pending">
276-
state=[[slot.action.state]],index=[[slot.action.index]]
277-
</span>
278-
<span ng-switch-default class="status_label_warning">
279-
state=[[slot.action.state]],index=[[slot.action.index]]
280-
</span>
274+
<span ng-switch-when="pending">
275+
state=[[slot.action.state]]
276+
</span>
277+
<span ng-switch-default style="color: red; font-weight: bold;">
278+
state=[[slot.action.state]]
279+
</span>
281280
</td>
282281
<td class="button_tight_column" ng-switch="slot.action.state">
283282
<span ng-switch-when="pending">
@@ -344,9 +343,9 @@ <h4 style="padding-left:20px; padding-right:20px; display: inline;">Group</h4>
344343
</button>
345344
</span>
346345
</th>
347-
<th/>
348-
<th>Memory</th>
349-
<th>Keys</th>
346+
<th style="width: 140px;"/>
347+
<th style="width: 220px;">Memory</th>
348+
<th style="width: 320px;">Keys</th>
350349
<th style="width: 35px;" ng-switch="group.canremove">
351350
<span ng-switch-when="true">
352351
<button class="btn btn-primary btn-xs"
@@ -366,8 +365,8 @@ <h4 style="padding-left:20px; padding-right:20px; display: inline;">Group</h4>
366365
</button>
367366
</span>
368367
</td>
369-
<td style="width: 24%;">[[server.server]]</td>
370-
<td style="width: 24%;" ng-switch="server.master_status">
368+
<td>[[server.server]]</td>
369+
<td ng-switch="server.master_status">
371370
<span ng-switch-when="false" class="status_label_error">[[server.master]]</span>
372371
<span ng-switch-default>[[server.master]]</span>
373372
</td>
@@ -385,9 +384,9 @@ <h4 style="padding-left:20px; padding-right:20px; display: inline;">Group</h4>
385384
</button>
386385
</span>
387386
</td>
388-
<td style="width: 140px;">[[server.actionstate]]</td>
389-
<td style="width: 220px;">[[server.memory]] / [[server.maxmem]]</td>
390-
<td style="width: 220px;" ng-switch="server.status">
387+
<td>[[server.actionstate]]</td>
388+
<td>[[server.memory]] / [[server.maxmem]]</td>
389+
<td ng-switch="server.status">
391390
<span ng-switch-when="ERROR" class="status_label_error">[[server.status]]</span>
392391
<span ng-switch-when="TIMEOUT" class="status_label_warning">[[server.status]]</span>
393392
<span ng-switch-when="PENDING" class="status_label_pending">[[server.status]]</span>

cmd/fe/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"os"
1212
"path/filepath"
1313
"runtime"
14+
"sort"
1415
"sync"
1516
"time"
1617

@@ -136,7 +137,9 @@ Options:
136137

137138
r := martini.NewRouter()
138139
r.Get("/list", func() (int, string) {
139-
return rpc.ApiResponseJson(router.Names())
140+
names := router.Names()
141+
sort.Sort(sort.StringSlice(names))
142+
return rpc.ApiResponseJson(names)
140143
})
141144

142145
r.Any("/**", func(w http.ResponseWriter, req *http.Request) {

0 commit comments

Comments
 (0)