mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
load more infos on card
This commit is contained in:
parent
74712cc30b
commit
26765973a8
2 changed files with 42 additions and 18 deletions
|
@ -17,29 +17,49 @@
|
|||
});
|
||||
});
|
||||
|
||||
function levelToColor(level){
|
||||
if (level > 6){
|
||||
return 'success'
|
||||
function levelToColor(level) {
|
||||
if (level > 6) {
|
||||
return 'success';
|
||||
}
|
||||
else if (level > 2){
|
||||
return 'warning'
|
||||
else if (level > 2) {
|
||||
return 'warning';
|
||||
}
|
||||
else {
|
||||
return 'danger'
|
||||
return 'danger';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function timeConverter(UNIX_timestamp) {
|
||||
var a = new Date(UNIX_timestamp*1000);
|
||||
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
|
||||
var year = a.getFullYear();
|
||||
var month = months[a.getMonth()];
|
||||
var date = a.getDate();
|
||||
var hour = a.getHours();
|
||||
var min = a.getMinutes();
|
||||
if (hour < 10) { hour = '0' + hour; }
|
||||
if (min < 10) { min = '0' + min; }
|
||||
var time = date+' '+month+' '+year;//+' at '+hour+':'+min
|
||||
return time;
|
||||
}
|
||||
|
||||
|
||||
// List available apps
|
||||
app.get('#/apps/install', function (c) {
|
||||
c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/apps?raw', function(dataraw) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
var apps = [];
|
||||
c.api('/apps', function (data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/apps?raw', function (dataraw) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
var apps = []
|
||||
$.each(data['apps'], function(k, v) {
|
||||
// Keep only uninstalled apps, or multi-instance apps
|
||||
if ((!v['installed'] || dataraw[v['id']].manifest.multi_instance) && !v['id'].match(/__[0-9]{1,5}$/)) {
|
||||
// Check app source
|
||||
dataraw[v['id']]['official'] = (dataraw[v['id']]['repository'] == 'yunohost');
|
||||
dataraw[v['id']]['color'] = levelToColor(dataraw[v['id']]['level'])
|
||||
dataraw[v['id']]['official'] = (dataraw[v['id']]['repository'] === 'yunohost');
|
||||
dataraw[v['id']]['color'] = levelToColor(dataraw[v['id']]['level']);
|
||||
dataraw[v['id']]['displayLicense'] = (dataraw[v['id']]['manifest']['license'] !== undefined
|
||||
&& dataraw[v['id']]['manifest']['license'] !== 'free');
|
||||
dataraw[v['id']]['updateDate'] = timeConverter(dataraw[v['id']]['lastUpdate']);
|
||||
|
||||
|
||||
jQuery.extend(dataraw[v['id']], v);
|
||||
apps.push(dataraw[v['id']]);
|
||||
|
|
|
@ -20,20 +20,24 @@
|
|||
<div class="app-card panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>{{name}}</h3>
|
||||
<div class="category"> <span class="label label-{{color}} label-as-badge">{{level}}</span>
|
||||
<span class="label label-success label-as-badge app-validated">validated</span>
|
||||
<span class="label label-default">AGPL-3.0</span></div>
|
||||
<div class="category">
|
||||
<span class="label label-{{color}} label-as-badge">{{level}}</span>
|
||||
{{^official}}<span class="label label-info label-as-badge app-validated">{{t 'community'}}</span>{{/official}}
|
||||
{{#official}}<span class="label label-success label-as-badge app-validated">{{t 'official'}}</span>{{/official}}
|
||||
{{#displayLicense}}<span class="label label-default">{{license}}</span>{{/displayLicense}}
|
||||
</div>
|
||||
<div class="app-card-desc">{{description}}</div>
|
||||
</div>
|
||||
<div class="app-card-date-maintainer">
|
||||
<i class="fas fa-sync"></i> 10 April 2018 -
|
||||
<span title="Current maintainer of this package" class="maintained"></span><i class="fa-user"></i> aymhce</span>
|
||||
<i class="fas fa-sync"></i> {{updateDate}} -
|
||||
{{#maintained}}<span title="Current maintainer of this package" class="maintained"></span><i class="fa-user"></i> {{manifest.maintainer.name}}</span>{{/maintained}}
|
||||
{{^maintained}}<i class="fas fa-warning"></i> {{t 'Unmaintained'}}{{/maintained}}
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<a href="github.com" target="_BLANK" type="button" class="btn btn-default col-sm-4">
|
||||
<a href="{{git.url}}" target="_BLANK" type="button" class="btn btn-default col-sm-4">
|
||||
<i class="fa-globe"></i> Code
|
||||
</a>
|
||||
<a href="#/app_ampache_en" target="_BLANK" type="button" class="btn btn-default col-sm-4">
|
||||
<a href="{{git.url}}/blob/master/README.md" target="_BLANK" type="button" class="btn btn-default col-sm-4">
|
||||
<i class="fa-book"></i> Doc
|
||||
</a>
|
||||
<a href="#/apps/install/{{id}}" type="button" class="btn btn-{{color}} col-sm-4 active">
|
||||
|
|
Loading…
Reference in a new issue