Merge branch 'stretch-unstable' of github.com:eauchat/yunohost-admin into stretch-unstable

This commit is contained in:
chateau 2018-12-16 22:32:43 +01:00
commit 4df9852a50
12 changed files with 70 additions and 33 deletions

View file

@ -18,10 +18,10 @@
}); });
function levelToColor(level) { function levelToColor(level) {
if (level > 6) { if (level >= 3) {
return 'success'; return 'success';
} }
else if (level >= 2) { else if (level >= 1) {
return 'warning'; return 'warning';
} }
else if (isNaN(level)) { else if (isNaN(level)) {
@ -41,13 +41,14 @@
} }
function combineColors(stateColor, levelColor, installable) { function combineColors(stateColor, levelColor, installable) {
if (stateColor === "dangers" || levelColor === "danger") { if (stateColor === "danger" || levelColor === "danger") {
return 'danger'; return 'danger';
} }
if (stateColor === "warnings" || levelColor === "warnings" || levelColor === "default") { else if (stateColor === "warning" || levelColor === "warning" || levelColor === "default") {
return 'warning'; return 'warning';
} }
else { else
{
return 'success'; return 'success';
} }
} }
@ -234,10 +235,7 @@
// Multi Instance settings // Multi Instance settings
data.manifest.multi_instance = data.manifest.multi_instance ? y18n.t('yes') : y18n.t('no'); data.manifest.multi_instance = data.manifest.multi_instance ? y18n.t('yes') : y18n.t('no');
data.install_time = new Date(data.settings.install_time * 1000);
// Installation date
var d = new Date(data.settings.install_time * 1000);
data.install_time = d.getDate() + '/' + (d.getMonth()+1) + '/' + d.getFullYear();
c.view('app/app_info', data); c.view('app/app_info', data);
}); });
@ -491,11 +489,36 @@
// App installation form // App installation form
app.get('#/apps/install/:app', function (c) { app.get('#/apps/install/:app', function (c) {
c.api('/apps?raw', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8 c.api('/apps?raw', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
var state_color = stateToColor(data[c.params['app']]['state']);
var level_color = levelToColor(parseInt(data[c.params['app']]['level']));
var is_safe_for_install_color = combineColors(state_color, level_color);
if ((is_safe_for_install_color === "warning") || (is_safe_for_install_color === "danger"))
{
c.confirm(
y18n.t("applications"),
y18n.t("confirm_install_app_"+is_safe_for_install_color),
function(){
c.appInstallForm( c.appInstallForm(
c.params['app'], c.params['app'],
data[c.params['app']].manifest, data[c.params['app']].manifest,
c.params c.params
); );
},
function(){
$('div.loader').remove();
c.redirect('#/apps/install');
}
);
}
else
{
c.appInstallForm(
c.params['app'],
data[c.params['app']].manifest,
c.params
);
}
}); });
}); });

View file

@ -136,6 +136,7 @@
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.items = (data['hooks']!={} || data['apps']!=[]); data.items = (data['hooks']!={} || data['apps']!=[]);
data.locale = y18n.locale
c.view('backup/backup_info', data); c.view('backup/backup_info', data);
}); });
}); });
@ -153,6 +154,7 @@
data.archives2.unshift(info) data.archives2.unshift(info)
}); });
data.archives = data.archives2; data.archives = data.archives2;
data.locale = y18n.locale
c.view('backup/backup_list', data); c.view('backup/backup_list', data);
}); });
}); });

View file

@ -22,6 +22,10 @@
// Translate status and loaded state // Translate status and loaded state
v.status = y18n.t(v.status); v.status = y18n.t(v.status);
v.loaded = y18n.t(v.loaded); v.loaded = y18n.t(v.loaded);
if (v.active_at == 'unknown')
{
delete v.active_at;
}
data2.services.push(v); data2.services.push(v);
}); });
@ -52,6 +56,10 @@
// Translate status and loaded state // Translate status and loaded state
data2.service.active = y18n.t(data.active); data2.service.active = y18n.t(data.active);
data2.service.loaded = y18n.t(data.loaded); data2.service.loaded = y18n.t(data.loaded);
if (data.active_at != 'unknown')
{
data2.service.active_at = data.active_at;
}
store.clear('slide'); store.clear('slide');
c.view('service/service_info', data2); c.view('service/service_info', data2);
}, 'GET'); }, 'GET');

View file

@ -134,12 +134,6 @@
c.api("/logs/display" + params, function(log) { c.api("/logs/display" + params, function(log) {
if ('metadata' in log) { if ('metadata' in log) {
if ('started_at' in log.metadata) {
log.metadata.started_at = Date.parse(log.metadata.started_at)
}
if ('ended_at' in log.metadata) {
log.metadata.ended_at = Date.parse(log.metadata.ended_at)
}
if (!'env' in log.metadata && 'args' in log.metadata) { if (!'env' in log.metadata && 'args' in log.metadata) {
log.metadata.env = log.metadata.args log.metadata.env = log.metadata.args
} }

View file

@ -26,10 +26,6 @@
Handlebars.registerHelper('humanTime', function(time) { Handlebars.registerHelper('humanTime', function(time) {
return Math.round(time) + 's'; return Math.round(time) + 's';
}); });
Handlebars.registerHelper('timestampToDate', function(timestamp) {
var date = new Date(timestamp * 1000);
return date.toLocaleString();
});
Handlebars.registerHelper('bitRate', function(bytes, time) { Handlebars.registerHelper('bitRate', function(bytes, time) {
var sizes = ['b', 'Kb', 'Mb', 'Gb', 'Tb']; var sizes = ['b', 'Kb', 'Mb', 'Gb', 'Tb'];
if (time === 0) return 'n/a'; if (time === 0) return 'n/a';

View file

@ -75,8 +75,10 @@
"confirm_delete": "Are you sure you want to delete %s ?", "confirm_delete": "Are you sure you want to delete %s ?",
"confirm_firewall_open": "Are you sure you want to open port %s? (protocol: %s, connection: %s)", "confirm_firewall_open": "Are you sure you want to open port %s? (protocol: %s, connection: %s)",
"confirm_firewall_close": "Are you sure you want to close port %s? (protocol: %s, connection: %s)", "confirm_firewall_close": "Are you sure you want to close port %s? (protocol: %s, connection: %s)",
"confirm_install_custom_app": "Installing 3rd party applications may compromise the security of your system. Use at your own risk.", "confirm_install_custom_app": "WARNING ! Installing 3rd party applications may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. Are you willing to take that risk ?",
"confirm_install_domain_root": "You will not be able to install any other app on %s. Continue ?", "confirm_install_domain_root": "You will not be able to install any other app on %s. Continue ?",
"confirm_install_app_warning": "Warning : this application may work but is not well-integrated in YunoHost. Some features such as single sign-on and backup/restore might not be available.",
"confirm_install_app_danger": "WARNING ! This application is still experimental (if not explicitly not working) and it is likely to break your system ! You should probably NOT install it unless you know what you are doing. Are you willing to take that risk ?",
"confirm_migrations_skip": "Skipping migrations is not recommended. Are you sure you want to do that?", "confirm_migrations_skip": "Skipping migrations is not recommended. Are you sure you want to do that?",
"confirm_postinstall": "You are about to launch the post-installation process on the domain %s. It may take a few minutes, *do not interrupt the operation*.", "confirm_postinstall": "You are about to launch the post-installation process on the domain %s. It may take a few minutes, *do not interrupt the operation*.",
"confirm_restore": "Are you sure you want to restore %s ?", "confirm_restore": "Are you sure you want to restore %s ?",

View file

@ -18,7 +18,7 @@
<dt>{{t 'url'}}</dt> <dt>{{t 'url'}}</dt>
<dd>{{appslist.url}}</dd> <dd>{{appslist.url}}</dd>
<dt>{{t 'appslists_last_update'}}</dt> <dt>{{t 'appslists_last_update'}}</dt>
<dd>{{timestampToDate appslist.lastUpdate}}</dd> <dd>{{formatTime appslist.lastUpdate day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}</dd>
</dl> </dl>
</div> </div>
</div> </div>

View file

@ -22,7 +22,7 @@
<dt>{{t 'multi_instance'}}</dt> <dt>{{t 'multi_instance'}}</dt>
<dd>{{manifest.multi_instance}}</dd> <dd>{{manifest.multi_instance}}</dd>
<dt>{{t 'install_time'}}</dt> <dt>{{t 'install_time'}}</dt>
<dd>{{install_time}}</dd> <dd>{{formatTime install_time day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}</dd>
<dt>{{t 'url'}}</dt> <dt>{{t 'url'}}</dt>
<dd><a href="https://{{settings.domain}}{{settings.path}}" target="_blank">https://{{settings.domain}}{{settings.path}}</a></dd> <dd><a href="https://{{settings.domain}}{{settings.path}}" target="_blank">https://{{settings.domain}}{{settings.path}}</a></dd>
</dl> </dl>

View file

@ -14,7 +14,7 @@
<div class="panel-body"> <div class="panel-body">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>{{t 'id'}}</dt><dd>{{ name }}</dd> <dt>{{t 'id'}}</dt><dd>{{ name }}</dd>
<dt>{{t 'created_at'}}</dt><dd>{{ created_at }}</dd> <dt>{{t 'created_at'}}</dt><dd>{{formatTime created_at day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}</dd>
<dt>{{t 'size'}}</dt><dd>{{ humanSize size}}</dd> <dt>{{t 'size'}}</dt><dd>{{ humanSize size}}</dd>
<dt>{{t 'path'}}</dt><dd>{{ path }}</dd> <dt>{{t 'path'}}</dt><dd>{{ path }}</dd>
</dl> </dl>

View file

@ -12,11 +12,12 @@
<div class="separator"></div> <div class="separator"></div>
{{#intl locales=locale}}
<div class="list-group"> <div class="list-group">
{{#each archives}} {{#each archives}}
<a href="#/backup/{{../storage.id}}/{{name}}" class="list-group-item slide clearfix"> <a href="#/backup/{{../storage.id}}/{{name}}" class="list-group-item slide clearfix" title='{{formatTime created_at day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}'>
<span class="pull-right fa-chevron-right"></span> <span class="pull-right fa-chevron-right"></span>
<h2 class="list-group-item-heading">{{created_at}} <small>{{name}} ({{humanSize size}})</small></h2> <h2 class="list-group-item-heading">{{formatRelative created_at}} <small>{{name}} ({{humanSize size}})</small></h2>
<p class="list-group-item-text">{{path}}</p> <p class="list-group-item-text">{{path}}</p>
</a> </a>
{{/each}} {{/each}}
@ -28,6 +29,7 @@
{{/archives}} {{/archives}}
</div> </div>
{{/intl}}
<!--<div class="panel panel-default"> <!--<div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">

View file

@ -43,7 +43,12 @@
</span> </span>
<br> <br>
{{t 'started_at'}} {{t 'started_at'}}
{{active_at.human}} {{#active_at}}
{{formatTime . day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}
{{/active_at}}
{{^active_at}}
{{t 'unknown'}}
{{/active_at}}
</div> </div>
<div class="pull-right"> <div class="pull-right">

View file

@ -17,7 +17,12 @@
</span> </span>
<br> <br>
{{t 'started_at'}} {{t 'started_at'}}
{{active_at.human}} {{#active_at}}
{{formatTime . day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}
{{/active_at}}
{{^active_at}}
{{t 'unknown'}}
{{/active_at}}
</div> </div>
</a> </a>
{{/services}} {{/services}}