Skip to content

Commit d9c7dba

Browse files
committed
Initial parameters handling (total users / total blocked). Frontend part. TODO: backend part
1 parent d1cf8bd commit d9c7dba

File tree

7 files changed

+46
-31
lines changed

7 files changed

+46
-31
lines changed

web/index.html

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
5454
</div>
5555
<ul class="settings">
56-
5756
<li><a href="#">settings</a></li>
5857
<li><a href="#">exit</a></li>
5958
</ul>
@@ -68,8 +67,8 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
6867
<i class="add-entry do_action_new_entry">&nbsp;</i>
6968
</dt>
7069
<dd class="section-contains">
71-
<span class="def">0 users</span>
72-
<span class="def">0 blocked</span>
70+
<span class="def"><span class="num-total">0</span> users</span>
71+
<span class="def"><span class="num-blocked">0</span> blocked</span>
7372
</dd>
7473
</dl>
7574
</div>
@@ -84,9 +83,8 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
8483
<i class="add-entry do_action_new_entry">&nbsp;</i>
8584
</dt>
8685
<dd class="section-contains">
87-
<span class="def">0 users</span>
88-
<span class="def">0 blocked</span>
89-
<span class="def">3 waiting</span>
86+
<span class="def"><span class="num-total">0</span> web domains</span>
87+
<span class="def"><span class="num-blocked">0</span> blocked</span>
9088
</dd>
9189
</dl>
9290
</div>
@@ -99,9 +97,7 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
9997
<i class="add-entry do_action_new_entry">&nbsp;</i>
10098
</dt>
10199
<dd class="section-contains">
102-
<span class="def">0 users</span>
103-
<span class="def">0 blocked</span>
104-
<span class="def">3 waiting</span>
100+
<span class="def"><span class="num-total">0</span> mails</span>
105101
</dd>
106102
</dl>
107103
</div>
@@ -114,9 +110,8 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
114110
<i class="add-entry do_action_new_entry">&nbsp;</i>
115111
</dt>
116112
<dd class="section-contains">
117-
<span class="def">0 users</span>
118-
<span class="def">0 blocked</span>
119-
<span class="def">3 waiting</span>
113+
<span class="def"><span class="num-total">0</span> databases</span>
114+
<span class="def"><span class="num-blocked">0</span> blocked</span>
120115
</dd>
121116
</dl>
122117
</div>
@@ -142,9 +137,8 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
142137
<i class="add-entry do_action_new_entry">&nbsp;</i>
143138
</dt>
144139
<dd class="section-contains">
145-
<span class="def">0 users</span>
146-
<span class="def">0 blocked</span>
147-
<span class="def">3 waiting</span>
140+
<span class="def"><span class="num-total">0</span> ip entries</span>
141+
<span class="def"><span class="num-blocked">0</span> blocked</span>
148142
</dd>
149143
</dl>
150144
</div>
@@ -157,9 +151,8 @@ <h1 class="logo"><a href="#">Vesta panel <span>&nbsp;</span></a></h1>
157151
<i class="add-entry do_action_new_entry">&nbsp;</i>
158152
</dt>
159153
<dd class="section-contains">
160-
<span class="def">0 users</span>
161-
<span class="def">0 blocked</span>
162-
<span class="def">3 waiting</span>
154+
<span class="def"><span class="num-total">0</span> cron records</span>
155+
<span class="def"><span class="num-blocked">0</span> blocked</span>
163156
</dd>
164157
</dl>
165158
</div>

web/js/helpers.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,21 @@ App.Helpers.getFirstKey = function(obj)
7070
App.Helpers.updateInitial = function()
7171
{
7272
// TODO: need api method
73-
$.each(App.Env.initialParams, function(key) {
74-
var item = App.Env.initialParams[key];
75-
$.each(item, function (i, o) {
76-
if (i.indexOf('total_') != -1) {
77-
App.View.updateInitialInfo(i, o);
73+
$.each(App.Env.initialParams.totals, function(key) {
74+
var item = App.Env.initialParams.totals[key];
75+
var expr_id = '#'+key;
76+
if ('undefined' != typeof item.total) {
77+
var ref = $(expr_id).find('.num-total');
78+
if (ref.length > 0) {
79+
$(ref).html(item.total);
7880
}
79-
});
81+
}
82+
if ('undefined' != typeof item.blocked) {
83+
var ref = $(expr_id).find('.num-blocked');
84+
if (ref.length > 0) {
85+
$(ref).html(item.blocked);
86+
}
87+
}
8088
});
8189
}
8290

web/js/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ App.HTML.Build.cron_form = function(options, id)
366366
}
367367
var tpl = App.Templates.get('FORM', 'cron');
368368
tpl.set(':source', options);
369-
369+
tpl.set(':id', id || '');
370370
options = App.Helpers.evalJSON(options) || {};
371371
if (App.Helpers.isEmpty(options)) {
372372
tpl.set(':title', 'New cron entry');

web/js/pages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
App.Pages.init = function(){
22
App.Ajax.request('MAIN.getInitial', {}, function(reply){
33
App.Env.initialParams = reply.data;
4-
//App.Helpers.updateInitial();
4+
App.Helpers.updateInitial();
55
});
66

77
App.Pages.prepareHTML();

web/js/templates.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ App.Templates.html = {
763763
</div>']
764764
},
765765
cron: {
766-
FORM: ['<div class="b-new-entry b-new-entry_cron">\
766+
FORM: ['<div class="b-new-entry b-new-entry_cron" id="~!:id~!" >\
767767
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
768768
<input type="hidden" name="target" class="target" value=\'\'>\
769769
<div class="entry-header">~!:title~!</div>\
@@ -810,10 +810,10 @@ App.Templates.html = {
810810
</div>\
811811
<div class="form-row cc">\
812812
<label for="#" class="field-label">report to: <span class="remark">(devide by comma ",")</span></label>\
813-
<textarea class="textarea"></textarea>\
813+
<textarea class="textarea" name="REPORT_TO"></textarea>\
814814
</div>\
815815
<div class="form-row buttons-row cc">\
816-
<input type="submit" value="~!:save_button~!" class="add-entry-btn">\
816+
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form">\
817817
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
818818
<a target="_blank" href="http://vestacp.com/docs/cron/" class="help-btn">Help</a>\
819819
</div>\

web/js/validators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ App.Validate.form = function(world, elm)
2626
}
2727
else {
2828

29-
if ($(field).val().trim() == '') {
29+
if ($(field).val().trim() == '' || $(field).val().trim() == '-') {
3030
App.Env.FormError.push($(field).attr('name') + ' is required');
3131
form_valid = false;
3232
}

web/vesta/api/MAIN.class.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public function getInitialExecute($request)
7171
'IP' => $this->getIpParams($data_ip),
7272
'DNS' => $this->getDnsParams(),
7373
'DB' => $this->getDbParams($data_db),
74-
'USERS' => $this->getUsersParams($data_users)
74+
'USERS' => $this->getUsersParams($data_users),
75+
'totals' => $this->getTotals()
7576
);
7677

7778
return $this->reply(true, $reply);
@@ -81,6 +82,19 @@ public function getInitialExecute($request)
8182
//
8283
//
8384

85+
public function getTotals($data = array())
86+
{
87+
return array(
88+
'USER' => array('total' => 7, 'blocked' => 0),
89+
'WEB_DOMAIN' => array('total' => 4, 'blocked' => 0),
90+
'MAIL' => array('total' => 0),
91+
'DB' => array('total' => 4, 'blocked' => 0),
92+
'DNS' => array('total' => 4, 'blocked' => 0),
93+
'IP' => array('total' => 2, 'blocked' => 0),
94+
'CRON' => array('total' => 5, 'blocked' => 0)
95+
);
96+
}
97+
8498
/**
8599
* WEB DOMAIN initial params
86100
*

0 commit comments

Comments
 (0)