mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Dirty hack to be able to compute size for backup system parts in groupHooks...
This commit is contained in:
parent
97091cba2b
commit
f5d189526c
3 changed files with 12 additions and 5 deletions
|
@ -134,8 +134,8 @@
|
||||||
};
|
};
|
||||||
data.other_storages = [];
|
data.other_storages = [];
|
||||||
data.name = c.params['archive'];
|
data.name = c.params['archive'];
|
||||||
data.system_parts = c.groupHooks(Object.keys(data['system']));
|
data.system_parts = c.groupHooks(Object.keys(data['system']),data['system']);
|
||||||
data.items = (data['hooks']!={} || data['apps']!=[]);
|
data.items = (data['system']!={} || data['apps']!=[]);
|
||||||
data.locale = y18n.locale
|
data.locale = y18n.locale
|
||||||
c.view('backup/backup_info', data, c.selectAllOrNone);
|
c.view('backup/backup_info', data, c.selectAllOrNone);
|
||||||
});
|
});
|
||||||
|
|
|
@ -363,7 +363,7 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
groupHooks: function(hooks) {
|
groupHooks: function(hooks, raw_infos){
|
||||||
var data = {};
|
var data = {};
|
||||||
var rules = [
|
var rules = [
|
||||||
{
|
{
|
||||||
|
@ -376,6 +376,7 @@
|
||||||
|
|
||||||
$.each(hooks, function(i, hook) {
|
$.each(hooks, function(i, hook) {
|
||||||
var group_id=hook;
|
var group_id=hook;
|
||||||
|
var hook_size=(raw_infos && raw_infos[hook] && raw_infos[hook].size)?raw_infos[hook].size:0;
|
||||||
$.each(rules, function(i, rule) {
|
$.each(rules, function(i, rule) {
|
||||||
if (rule.isIn(hook)) {
|
if (rule.isIn(hook)) {
|
||||||
group_id = 'adminjs_group_'+rule.id;
|
group_id = 'adminjs_group_'+rule.id;
|
||||||
|
@ -387,14 +388,16 @@
|
||||||
data[group_id] = {
|
data[group_id] = {
|
||||||
name:y18n.t('hook_'+group_id),
|
name:y18n.t('hook_'+group_id),
|
||||||
value:data[group_id].value+','+hook,
|
value:data[group_id].value+','+hook,
|
||||||
description:data[group_id].description+', '+y18n.t('hook_'+hook)
|
description:data[group_id].description+', '+y18n.t('hook_'+hook),
|
||||||
|
size:data[group_id].size + hook_size
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data[group_id] = {
|
data[group_id] = {
|
||||||
name:y18n.t('hook_'+group_id),
|
name:y18n.t('hook_'+group_id),
|
||||||
value:hook,
|
value:hook,
|
||||||
description:(group_id==hook)?y18n.t('hook_'+hook+'_desc'):y18n.t('hook_'+hook)
|
description:(group_id==hook)?y18n.t('hook_'+hook+'_desc'):y18n.t('hook_'+hook),
|
||||||
|
size:hook_size
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,7 +40,11 @@
|
||||||
<div class="list-group-item">
|
<div class="list-group-item">
|
||||||
<input type="checkbox" id="{{@key}}" name="system_parts" value="{{value}}" checked class="nice-checkbox">
|
<input type="checkbox" id="{{@key}}" name="system_parts" value="{{value}}" checked class="nice-checkbox">
|
||||||
<label for="{{@key}}" class="pull-right"><span class="sr-only">{{t 'check'}}</span></label>
|
<label for="{{@key}}" class="pull-right"><span class="sr-only">{{t 'check'}}</span></label>
|
||||||
|
{{#if size}}
|
||||||
|
<h2 class="list-group-item-heading">{{name}} <small>({{ humanSize size }})</small></h2>
|
||||||
|
{{else}}
|
||||||
<h2 class="list-group-item-heading">{{name}}</h2>
|
<h2 class="list-group-item-heading">{{name}}</h2>
|
||||||
|
{{/if}}
|
||||||
<p class="list-group-item-text">{{description}}</p>
|
<p class="list-group-item-text">{{description}}</p>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue