From f7ec1274bf359dda47676f249a5b4f3b1bfdd623 Mon Sep 17 00:00:00 2001 From: ljf Date: Mon, 4 Jun 2018 02:50:24 +0200 Subject: [PATCH] [enh] Icon and i18n for logs categories --- src/js/yunohost/controllers/tools.js | 10 ++++++++++ src/js/yunohost/main.js | 11 ++++++++++- src/locales/en.json | 11 ++++++++++- src/views/tools/tools_logs.ms | 12 +++++++++--- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js index 6acb2051..cb9789ef 100644 --- a/src/js/yunohost/controllers/tools.js +++ b/src/js/yunohost/controllers/tools.js @@ -99,10 +99,20 @@ app.get('#/tools/logs', function (c) { c.api("/logs", function(categories) { data = []; + icons = { + 'operation': 'wrench', + 'history': 'history', + 'package': 'puzzle-piece', + 'system': 'cogs', + 'access': 'ban', + 'service': 'cog', + 'app': 'cubes' + } for (var category in categories) { if (categories.hasOwnProperty(category)) { data.push({ key:category, + icon:(category in icons)?icons[category]:'info-circle', value:categories[category] }); } diff --git a/src/js/yunohost/main.js b/src/js/yunohost/main.js index bcf70f48..501ec52e 100644 --- a/src/js/yunohost/main.js +++ b/src/js/yunohost/main.js @@ -38,7 +38,16 @@ var result = y18n.t(y18n_key, Array.prototype.slice.call(arguments, 1)); return new Handlebars.SafeString(result); }); - + + Handlebars.registerHelper('concat', function() { + var outStr = ''; + for(var arg in arguments){ + if(typeof arguments[arg]!='object'){ + outStr += arguments[arg]; + } + } + return outStr; + }); // Look for supported type of storage to use /** diff --git a/src/locales/en.json b/src/locales/en.json index f3dcb64c..f6c7ed98 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -307,5 +307,14 @@ "diagnosis" : "Diagnosis", "diagnosis_with_private" : "Diagnosis with private data", "diagnosis_view_private" : "Show diagnosis with private data", - "diagnosis_hide_private" : "Show diagnosis without private data" + "diagnosis_hide_private" : "Show diagnosis without private data", + "logs": "Logs", + "logs_operation": "Operations made on system with YunoHost", + "logs_history": "History of command run on system", + "logs_package": "Debian packages management history", + "logs_system": "Kernel logs and others low level events", + "logs_access": "List of access and bans", + "logs_service": "Services logs", + "logs_app": "Apps logs", + "logs_no_logs_registered": "No log registered for this category" } diff --git a/src/views/tools/tools_logs.ms b/src/views/tools/tools_logs.ms index ca3ca26f..6dbe1c97 100644 --- a/src/views/tools/tools_logs.ms +++ b/src/views/tools/tools_logs.ms @@ -13,15 +13,21 @@
-
{{#value}} +
+ {{#if value}} + {{#value}} {{ started_at }} {{ description }} - {{/value}}
+ {{/value}} + {{else}} +
{{t 'logs_no_logs_registered'}}
+ {{/if}}
+
{{/data}}