mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
last improvements l10n+roles+filtering
This commit is contained in:
parent
6c6800e83a
commit
440f18dea3
3 changed files with 34 additions and 25 deletions
|
@ -77,20 +77,23 @@
|
||||||
c.api('/apps?raw', function (dataraw) { // 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 = []
|
var apps = []
|
||||||
$.each(data['apps'], function(k, v) {
|
$.each(data['apps'], function(k, v) {
|
||||||
|
var state = dataraw[v['id']]['state'];
|
||||||
|
var isWorking = (state === 'working' || state === 'validated');
|
||||||
// Keep only the first instance of each app and remove community not working apps
|
// Keep only the first instance of each app and remove community not working apps
|
||||||
if (!v['id'].match(/__[0-9]{1,5}$/) && (dataraw[v['id']]['repository'] === 'yunohost' || dataraw[v['id']]['state'] !== 'notworking')) {
|
if (!v['id'].match(/__[0-9]{1,5}$/) && (dataraw[v['id']]['repository'] === 'yunohost' || state !== 'notworking')) {
|
||||||
// Check app source
|
|
||||||
dataraw[v['id']]['installable'] = (!v['installed'] || dataraw[v['id']].manifest.multi_instance)
|
dataraw[v['id']]['installable'] = (!v['installed'] || dataraw[v['id']].manifest.multi_instance)
|
||||||
dataraw[v['id']]['status'] = (dataraw[v['id']]['repository'] === 'yunohost') ? 'official' : 'community';
|
dataraw[v['id']]['status'] = (dataraw[v['id']]['repository'] === 'yunohost') ? 'official' : 'community';
|
||||||
levelFormatted = parseInt(dataraw[v['id']]['level']);
|
levelFormatted = parseInt(dataraw[v['id']]['level']);
|
||||||
dataraw[v['id']]['levelFormatted'] = isNaN(levelFormatted) ? '?' : levelFormatted;
|
dataraw[v['id']]['levelFormatted'] = isNaN(levelFormatted) ? '?' : levelFormatted;
|
||||||
dataraw[v['id']]['levelColor'] = levelToColor(levelFormatted);
|
dataraw[v['id']]['levelColor'] = levelToColor(levelFormatted);
|
||||||
dataraw[v['id']]['stateColor'] = stateToColor(dataraw[v['id']]['state']);
|
dataraw[v['id']]['stateColor'] = stateToColor(state);
|
||||||
dataraw[v['id']]['installColor'] = combineColors(dataraw[v['id']]['stateColor'], dataraw[v['id']]['levelColor']);
|
dataraw[v['id']]['installColor'] = combineColors(dataraw[v['id']]['stateColor'], dataraw[v['id']]['levelColor']);
|
||||||
dataraw[v['id']]['displayLicense'] = (dataraw[v['id']]['manifest']['license'] !== undefined
|
dataraw[v['id']]['displayLicense'] = (dataraw[v['id']]['manifest']['license'] !== undefined
|
||||||
&& dataraw[v['id']]['manifest']['license'] !== 'free');
|
&& dataraw[v['id']]['manifest']['license'] !== 'free');
|
||||||
dataraw[v['id']]['updateDate'] = timeConverter(dataraw[v['id']]['lastUpdate']);
|
dataraw[v['id']]['updateDate'] = timeConverter(dataraw[v['id']]['lastUpdate']);
|
||||||
dataraw[v['id']]['isSafe'] = (dataraw[v['id']]['installColor'] === 'danger');
|
dataraw[v['id']]['isSafe'] = (dataraw[v['id']]['installColor'] !== 'danger');
|
||||||
|
dataraw[v['id']]['isWorking'] = isWorking ? "isworking" : "notFullyWorking";
|
||||||
|
|
||||||
jQuery.extend(dataraw[v['id']], v);
|
jQuery.extend(dataraw[v['id']], v);
|
||||||
apps.push(dataraw[v['id']]);
|
apps.push(dataraw[v['id']]);
|
||||||
|
@ -100,7 +103,6 @@
|
||||||
// Sort app list
|
// Sort app list
|
||||||
c.arraySortById(apps);
|
c.arraySortById(apps);
|
||||||
|
|
||||||
|
|
||||||
// setup filtering of apps once the view is loaded
|
// setup filtering of apps once the view is loaded
|
||||||
function setupFilterEvents () {
|
function setupFilterEvents () {
|
||||||
// Uses plugin isotope to filter apps (we could had ordering to)
|
// Uses plugin isotope to filter apps (we could had ordering to)
|
||||||
|
@ -112,14 +114,14 @@
|
||||||
|
|
||||||
filterByClassAndName = function () {
|
filterByClassAndName = function () {
|
||||||
var input = jQuery("#filter-app-cards").val().toLowerCase();
|
var input = jQuery("#filter-app-cards").val().toLowerCase();
|
||||||
var stringMatch = (jQuery(this).find('.app-title').text().toLowerCase().indexOf(input) > -1);
|
var inputMatch = (jQuery(this).find('.app-title').text().toLowerCase().indexOf(input) > -1);
|
||||||
|
|
||||||
var filterClass = jQuery("#dropdownFilter").attr("data-filter");
|
var filterClass = jQuery("#dropdownFilter").attr("data-filter");
|
||||||
var classMatch = (filterClass === '*') ? true : jQuery(this).hasClass(filterClass);
|
var classMatch = (filterClass === '*') ? true : jQuery(this).hasClass(filterClass);
|
||||||
return stringMatch && classMatch;
|
return inputMatch && classMatch;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Keep only official apps at render
|
// Keep only official apps at first render
|
||||||
cardGrid.isotope({ filter: '.official' });
|
cardGrid.isotope({ filter: '.official' });
|
||||||
|
|
||||||
jQuery('.dropdownFilter').on('click', function() {
|
jQuery('.dropdownFilter').on('click', function() {
|
||||||
|
@ -127,7 +129,7 @@
|
||||||
jQuery('#app-cards-list-filter-text').text(jQuery(this).find('.menu-item').text());
|
jQuery('#app-cards-list-filter-text').text(jQuery(this).find('.menu-item').text());
|
||||||
// change filter attribute
|
// change filter attribute
|
||||||
jQuery('#dropdownFilter').attr("data-filter", jQuery(this).attr("data-filter"));
|
jQuery('#dropdownFilter').attr("data-filter", jQuery(this).attr("data-filter"));
|
||||||
|
// filter !
|
||||||
cardGrid.isotope({ filter: filterByClassAndName });
|
cardGrid.isotope({ filter: filterByClassAndName });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -136,7 +138,6 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// render
|
// render
|
||||||
c.view('app/app_list_install', {apps: apps}, setupFilterEvents);
|
c.view('app/app_list_install', {apps: apps}, setupFilterEvents);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
"administration_password": "Administration password",
|
"administration_password": "Administration password",
|
||||||
"allowed_users": "Allowed users",
|
"allowed_users": "Allowed users",
|
||||||
|
"all_apps": "All apps",
|
||||||
"api_not_responding": "API is not responding",
|
"api_not_responding": "API is not responding",
|
||||||
"app_access": "Access",
|
"app_access": "Access",
|
||||||
"app_access_addall_btn": "Enable access to all",
|
"app_access_addall_btn": "Enable access to all",
|
||||||
|
@ -28,6 +29,8 @@
|
||||||
"app_install_cancel": "Installation cancelled.",
|
"app_install_cancel": "Installation cancelled.",
|
||||||
"app_install_custom_no_manifest": "No manifest.json file",
|
"app_install_custom_no_manifest": "No manifest.json file",
|
||||||
"app_list": "App list",
|
"app_list": "App list",
|
||||||
|
"app_license": "License of the app",
|
||||||
|
"app_level": "App level",
|
||||||
"app_make_default": "Make default",
|
"app_make_default": "Make default",
|
||||||
"app_no_actions": "This application doesn't have any actions",
|
"app_no_actions": "This application doesn't have any actions",
|
||||||
"app_repository": "Application origin: ",
|
"app_repository": "Application origin: ",
|
||||||
|
@ -95,6 +98,7 @@
|
||||||
"cpu_load": "CPU Load",
|
"cpu_load": "CPU Load",
|
||||||
"created_at": "Created at",
|
"created_at": "Created at",
|
||||||
"cumulative_usage": "Cumulative usage",
|
"cumulative_usage": "Cumulative usage",
|
||||||
|
"current_maintainer_title": "Current maintainer of this package",
|
||||||
"custom_app_install": "Install custom app",
|
"custom_app_install": "Install custom app",
|
||||||
"custom_app_url_only_github": "Currently only from GitHub",
|
"custom_app_url_only_github": "Currently only from GitHub",
|
||||||
"default": "Default",
|
"default": "Default",
|
||||||
|
@ -215,6 +219,8 @@
|
||||||
"no_user_to_add": "No more users to add.",
|
"no_user_to_add": "No more users to add.",
|
||||||
"non_compatible_api": "Non-compatible API",
|
"non_compatible_api": "Non-compatible API",
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
|
"only_official_apps": "Only official apps",
|
||||||
|
"only_working_apps": "Only working apps",
|
||||||
"open": "Open",
|
"open": "Open",
|
||||||
"operations": "Operations",
|
"operations": "Operations",
|
||||||
"os": "OS",
|
"os": "OS",
|
||||||
|
@ -270,6 +276,7 @@
|
||||||
"run": "Run",
|
"run": "Run",
|
||||||
"running": "Running",
|
"running": "Running",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
|
"search_for_apps": "Search for apps...",
|
||||||
"select_user": "Select user",
|
"select_user": "Select user",
|
||||||
"service_description": "Description:",
|
"service_description": "Description:",
|
||||||
"service_log": "%s log",
|
"service_log": "%s log",
|
||||||
|
@ -330,6 +337,7 @@
|
||||||
"uninstall": "Uninstall",
|
"uninstall": "Uninstall",
|
||||||
"unknown_action": "Unknown action %s",
|
"unknown_action": "Unknown action %s",
|
||||||
"unknown_argument": "Unknown argument : %s",
|
"unknown_argument": "Unknown argument : %s",
|
||||||
|
"unmaintained": "Unmaintained",
|
||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
"upload_archive": "Archive upload",
|
"upload_archive": "Archive upload",
|
||||||
"upnp": "UPnP",
|
"upnp": "UPnP",
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
|
|
||||||
<div class="input-group" id="app-filter-input">
|
<div class="input-group" id="app-filter-input">
|
||||||
<span class="input-group-addon"><i class="fas fa-search"></i></span>
|
<span class="input-group-addon"><i class="fas fa-search"></i></span>
|
||||||
<input type="text" id="filter-app-cards" class="form-control" placeholder="Search for apps..." aria-describedby="basic-addon0"/>
|
<input type="text" id="filter-app-cards" class="form-control" role="textbox" placeholder="{{t 'search_for_apps'}}" aria-describedby="basic-addon0"/>
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<span id="app-cards-list-filter-text">Only official apps</span> <span class="caret"></span>
|
<span id="app-cards-list-filter-text">{{t 'only_official_apps'}}</span> <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul id="dropdownFilter" class="dropdown-menu" data-filter="official" role="menu">
|
<ul id="dropdownFilter" class="dropdown-menu" data-filter="official" role="menu">
|
||||||
<li class="button dropdownFilter" data-filter="official"><a class="menu-item" role="menu-item" tabindex="-1">Only official apps</a></li>
|
<li class="button dropdownFilter" data-filter="official"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'only_official_apps'}}</a></li>
|
||||||
<li role="presentation" class="button dropdownFilter" data-filter="working"><a class="menu-item" role="menu-item" tabindex="-1">Only working apps</a></li>
|
<li role="presentation" class="button dropdownFilter" data-filter="isworking"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'only_working_apps'}}</a></li>
|
||||||
<li role="presentation" class="button dropdownFilter" data-filter="*"><a class="menu-item" role="menu-item" tabindex="-1">All apps</a></li>
|
<li role="presentation" class="button dropdownFilter" data-filter="*"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'all_apps'}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,36 +34,36 @@
|
||||||
|
|
||||||
<div class="list-group grid">
|
<div class="list-group grid">
|
||||||
{{#apps}}
|
{{#apps}}
|
||||||
<div class="app-card panel panel-default {{status}} {{state}} {{level}}-level">
|
<div class="app-card panel panel-default {{status}} {{state}} {{isWorking}} {{level}}-level">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h2 class="app-title">{{name}}</h2>
|
<h2 class="app-title">{{name}}</h2>
|
||||||
<div class="category">
|
<div class="category">
|
||||||
<a href="https://yunohost.org/#/packaging_apps_levels_fr"><span class="label label-{{levelColor}} label-as-badge app-level" title="{{t 'app_level'}}">{{levelFormatted}}</span></a>
|
<a href="https://yunohost.org/#/packaging_apps_levels_fr"><span class="label label-{{levelColor}} label-as-badge app-level" title="{{t 'app_level'}}">{{levelFormatted}}</span></a>
|
||||||
<span class="label label-info label-as-badge app-status">{{t status}}</span>
|
<span class="label label-info label-as-badge app-status">{{t status}}</span>
|
||||||
<span class="label label-{{stateColor}} label-as-badge app-state">{{t state}}</span>
|
<span class="label label-{{stateColor}} label-as-badge app-state">{{t state}}</span>
|
||||||
{{#displayLicense}}<span class="label label-default app-license">{{license}}</span>{{/displayLicense}}
|
{{#displayLicense}}<span class="label label-default app-license" title="{{t 'app_license'}}">{{license}}</span>{{/displayLicense}}
|
||||||
</div>
|
</div>
|
||||||
<div class="app-card-desc">{{description}}</div>
|
<div class="app-card-desc">{{description}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="app-card-date-maintainer">
|
<div class="app-card-date-maintainer">
|
||||||
<i class="fas fa-sync"></i> {{updateDate}} -
|
<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}}<span title="{{t 'current_maintainer_title'}}" class="maintained"></span><i class="fa-user"></i> {{manifest.maintainer.name}}</span>{{/maintained}}
|
||||||
{{^maintained}}<i class="fas fa-warning"></i> {{t 'Unmaintained'}}{{/maintained}}
|
{{^maintained}}<i class="fas fa-warning"></i> {{t 'unmaintained'}}{{/maintained}}
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<a href="{{git.url}}" target="_BLANK" type="button" class="btn btn-default col-sm-4">
|
<a href="{{git.url}}" target="_BLANK" type="button" role="button" class="btn btn-default col-sm-4">
|
||||||
<i class="fa-globe"></i> Code
|
<i class="fa-globe"></i> Code
|
||||||
</a>
|
</a>
|
||||||
<a href="{{git.url}}/blob/master/README.md" target="_BLANK" type="button" class="btn btn-default col-sm-4">
|
<a href="{{git.url}}/blob/master/README.md" target="_BLANK" type="button" role="button" class="btn btn-default col-sm-4">
|
||||||
<i class="fa-book"></i> Readme
|
<i class="fa-book"></i> Readme
|
||||||
</a>
|
</a>
|
||||||
{{#installable}}
|
{{#installable}}
|
||||||
<a href="#/apps/install/{{id}}" type="button" class="btn btn-{{installColor}} col-sm-4 active">
|
<a href="#/apps/install/{{id}}" type="button" role="button" class="btn btn-{{installColor}} col-sm-4 active">
|
||||||
<i class="fa-plus"></i> Install {{#isSafe}}<i class="fa-warning"></i>{{/isSafe}}
|
<i class="fa-plus"></i> {{t 'install'}}{{^isSafe}} <i class="fa-warning"></i>{{/isSafe}}
|
||||||
</a>
|
</a>
|
||||||
{{/installable}}
|
{{/installable}}
|
||||||
{{^installable}}
|
{{^installable}}
|
||||||
<span href="#/apps/install/{{id}}" type="button" class="btn btn-default col-sm-4 active disabled"> Installed </span>
|
<span href="#/apps/install/{{id}}" type="button" class="btn btn-default col-sm-4 active disabled"> {{t 'installed'}}</span>
|
||||||
{{/installable}}
|
{{/installable}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue