mirror of
https://github.com/myvesta/vesta
synced 2025-07-11 07:36:47 -07:00
Initial parameters handling (total users / total blocked). Frontend part. TODO: backend part
This commit is contained in:
parent
d1cf8bdd97
commit
d9c7dba5f1
7 changed files with 46 additions and 31 deletions
|
@ -53,7 +53,6 @@
|
||||||
<h1 class="logo"><a href="#">Vesta panel <span> </span></a></h1>
|
<h1 class="logo"><a href="#">Vesta panel <span> </span></a></h1>
|
||||||
</div>
|
</div>
|
||||||
<ul class="settings">
|
<ul class="settings">
|
||||||
|
|
||||||
<li><a href="#">settings</a></li>
|
<li><a href="#">settings</a></li>
|
||||||
<li><a href="#">exit</a></li>
|
<li><a href="#">exit</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -68,8 +67,8 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def">0 users</span>
|
<span class="def"><span class="num-total">0</span> users</span>
|
||||||
<span class="def">0 blocked</span>
|
<span class="def"><span class="num-blocked">0</span> blocked</span>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -84,9 +83,8 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def">0 users</span>
|
<span class="def"><span class="num-total">0</span> web domains</span>
|
||||||
<span class="def">0 blocked</span>
|
<span class="def"><span class="num-blocked">0</span> blocked</span>
|
||||||
<span class="def">3 waiting</span>
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -99,9 +97,7 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def">0 users</span>
|
<span class="def"><span class="num-total">0</span> mails</span>
|
||||||
<span class="def">0 blocked</span>
|
|
||||||
<span class="def">3 waiting</span>
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -114,9 +110,8 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def">0 users</span>
|
<span class="def"><span class="num-total">0</span> databases</span>
|
||||||
<span class="def">0 blocked</span>
|
<span class="def"><span class="num-blocked">0</span> blocked</span>
|
||||||
<span class="def">3 waiting</span>
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -142,9 +137,8 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def">0 users</span>
|
<span class="def"><span class="num-total">0</span> ip entries</span>
|
||||||
<span class="def">0 blocked</span>
|
<span class="def"><span class="num-blocked">0</span> blocked</span>
|
||||||
<span class="def">3 waiting</span>
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
@ -157,9 +151,8 @@
|
||||||
<i class="add-entry do_action_new_entry"> </i>
|
<i class="add-entry do_action_new_entry"> </i>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="section-contains">
|
<dd class="section-contains">
|
||||||
<span class="def">0 users</span>
|
<span class="def"><span class="num-total">0</span> cron records</span>
|
||||||
<span class="def">0 blocked</span>
|
<span class="def"><span class="num-blocked">0</span> blocked</span>
|
||||||
<span class="def">3 waiting</span>
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -70,13 +70,21 @@ App.Helpers.getFirstKey = function(obj)
|
||||||
App.Helpers.updateInitial = function()
|
App.Helpers.updateInitial = function()
|
||||||
{
|
{
|
||||||
// TODO: need api method
|
// TODO: need api method
|
||||||
$.each(App.Env.initialParams, function(key) {
|
$.each(App.Env.initialParams.totals, function(key) {
|
||||||
var item = App.Env.initialParams[key];
|
var item = App.Env.initialParams.totals[key];
|
||||||
$.each(item, function (i, o) {
|
var expr_id = '#'+key;
|
||||||
if (i.indexOf('total_') != -1) {
|
if ('undefined' != typeof item.total) {
|
||||||
App.View.updateInitialInfo(i, o);
|
var ref = $(expr_id).find('.num-total');
|
||||||
|
if (ref.length > 0) {
|
||||||
|
$(ref).html(item.total);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
if ('undefined' != typeof item.blocked) {
|
||||||
|
var ref = $(expr_id).find('.num-blocked');
|
||||||
|
if (ref.length > 0) {
|
||||||
|
$(ref).html(item.blocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ App.HTML.Build.cron_form = function(options, id)
|
||||||
}
|
}
|
||||||
var tpl = App.Templates.get('FORM', 'cron');
|
var tpl = App.Templates.get('FORM', 'cron');
|
||||||
tpl.set(':source', options);
|
tpl.set(':source', options);
|
||||||
|
tpl.set(':id', id || '');
|
||||||
options = App.Helpers.evalJSON(options) || {};
|
options = App.Helpers.evalJSON(options) || {};
|
||||||
if (App.Helpers.isEmpty(options)) {
|
if (App.Helpers.isEmpty(options)) {
|
||||||
tpl.set(':title', 'New cron entry');
|
tpl.set(':title', 'New cron entry');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
App.Pages.init = function(){
|
App.Pages.init = function(){
|
||||||
App.Ajax.request('MAIN.getInitial', {}, function(reply){
|
App.Ajax.request('MAIN.getInitial', {}, function(reply){
|
||||||
App.Env.initialParams = reply.data;
|
App.Env.initialParams = reply.data;
|
||||||
//App.Helpers.updateInitial();
|
App.Helpers.updateInitial();
|
||||||
});
|
});
|
||||||
|
|
||||||
App.Pages.prepareHTML();
|
App.Pages.prepareHTML();
|
||||||
|
|
|
@ -763,7 +763,7 @@ App.Templates.html = {
|
||||||
</div>']
|
</div>']
|
||||||
},
|
},
|
||||||
cron: {
|
cron: {
|
||||||
FORM: ['<div class="b-new-entry b-new-entry_cron">\
|
FORM: ['<div class="b-new-entry b-new-entry_cron" id="~!:id~!" >\
|
||||||
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
<input type="hidden" name="source" class="source" value=\'~!:source~!\'>\
|
||||||
<input type="hidden" name="target" class="target" value=\'\'>\
|
<input type="hidden" name="target" class="target" value=\'\'>\
|
||||||
<div class="entry-header">~!:title~!</div>\
|
<div class="entry-header">~!:title~!</div>\
|
||||||
|
@ -810,10 +810,10 @@ App.Templates.html = {
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row cc">\
|
<div class="form-row cc">\
|
||||||
<label for="#" class="field-label">report to: <span class="remark">(devide by comma ",")</span></label>\
|
<label for="#" class="field-label">report to: <span class="remark">(devide by comma ",")</span></label>\
|
||||||
<textarea class="textarea"></textarea>\
|
<textarea class="textarea" name="REPORT_TO"></textarea>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="form-row buttons-row cc">\
|
<div class="form-row buttons-row cc">\
|
||||||
<input type="submit" value="~!:save_button~!" class="add-entry-btn">\
|
<input type="submit" value="~!:save_button~!" class="add-entry-btn do_action_save_form">\
|
||||||
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
|
<span class="cancel-btn do_action_cancel_form">Cancel</span>\
|
||||||
<a target="_blank" href="http://vestacp.com/docs/cron/" class="help-btn">Help</a>\
|
<a target="_blank" href="http://vestacp.com/docs/cron/" class="help-btn">Help</a>\
|
||||||
</div>\
|
</div>\
|
||||||
|
|
|
@ -26,7 +26,7 @@ App.Validate.form = function(world, elm)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if ($(field).val().trim() == '') {
|
if ($(field).val().trim() == '' || $(field).val().trim() == '-') {
|
||||||
App.Env.FormError.push($(field).attr('name') + ' is required');
|
App.Env.FormError.push($(field).attr('name') + ' is required');
|
||||||
form_valid = false;
|
form_valid = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,8 @@ class MAIN extends AjaxHandler
|
||||||
'IP' => $this->getIpParams($data_ip),
|
'IP' => $this->getIpParams($data_ip),
|
||||||
'DNS' => $this->getDnsParams(),
|
'DNS' => $this->getDnsParams(),
|
||||||
'DB' => $this->getDbParams($data_db),
|
'DB' => $this->getDbParams($data_db),
|
||||||
'USERS' => $this->getUsersParams($data_users)
|
'USERS' => $this->getUsersParams($data_users),
|
||||||
|
'totals' => $this->getTotals()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->reply(true, $reply);
|
return $this->reply(true, $reply);
|
||||||
|
@ -81,6 +82,19 @@ class MAIN extends AjaxHandler
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
public function getTotals($data = array())
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'USER' => array('total' => 7, 'blocked' => 0),
|
||||||
|
'WEB_DOMAIN' => array('total' => 4, 'blocked' => 0),
|
||||||
|
'MAIL' => array('total' => 0),
|
||||||
|
'DB' => array('total' => 4, 'blocked' => 0),
|
||||||
|
'DNS' => array('total' => 4, 'blocked' => 0),
|
||||||
|
'IP' => array('total' => 2, 'blocked' => 0),
|
||||||
|
'CRON' => array('total' => 5, 'blocked' => 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WEB DOMAIN initial params
|
* WEB DOMAIN initial params
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue