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.name = c.params['archive'];
|
||||
data.system_parts = c.groupHooks(Object.keys(data['system']));
|
||||
data.items = (data['hooks']!={} || data['apps']!=[]);
|
||||
data.system_parts = c.groupHooks(Object.keys(data['system']),data['system']);
|
||||
data.items = (data['system']!={} || data['apps']!=[]);
|
||||
data.locale = y18n.locale
|
||||
c.view('backup/backup_info', data, c.selectAllOrNone);
|
||||
});
|
||||
|
|
|
@ -363,7 +363,7 @@
|
|||
});
|
||||
},
|
||||
|
||||
groupHooks: function(hooks) {
|
||||
groupHooks: function(hooks, raw_infos){
|
||||
var data = {};
|
||||
var rules = [
|
||||
{
|
||||
|
@ -376,6 +376,7 @@
|
|||
|
||||
$.each(hooks, function(i, 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) {
|
||||
if (rule.isIn(hook)) {
|
||||
group_id = 'adminjs_group_'+rule.id;
|
||||
|
@ -387,14 +388,16 @@
|
|||
data[group_id] = {
|
||||
name:y18n.t('hook_'+group_id),
|
||||
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 {
|
||||
data[group_id] = {
|
||||
name:y18n.t('hook_'+group_id),
|
||||
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">
|
||||
<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>
|
||||
{{#if size}}
|
||||
<h2 class="list-group-item-heading">{{name}} <small>({{ humanSize size }})</small></h2>
|
||||
{{else}}
|
||||
<h2 class="list-group-item-heading">{{name}}</h2>
|
||||
{{/if}}
|
||||
<p class="list-group-item-text">{{description}}</p>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
|
Loading…
Add table
Reference in a new issue