mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #216 from YunoHost/enh-human-readable-date
[enh] Display date in timezone of browser
This commit is contained in:
commit
ee446b4c4a
11 changed files with 31 additions and 22 deletions
|
@ -234,10 +234,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);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
|
|
||||||
c.view('tools/tools_logs', {
|
c.view('tools/tools_logs', {
|
||||||
"data": data,
|
"data": data,
|
||||||
"locale": y18n.locale
|
"locale": y18n.locale
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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}}
|
||||||
|
|
Loading…
Reference in a new issue