diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js index e0f1acc9..ffbfeba5 100644 --- a/src/js/yunohost/controllers/tools.js +++ b/src/js/yunohost/controllers/tools.js @@ -91,38 +91,20 @@ // Display journals list app.get('#/tools/logs', function (c) { - c.api('GET', "/logs?limit=25&with_details", {}, function(categories) { - data = []; - category_icons = { - 'operation': 'wrench', - 'history': 'history', - 'package': 'puzzle-piece', - 'system': 'cogs', - 'access': 'ban', - 'service': 'cog', - 'app': 'cubes' - } + c.api('GET', "/logs?limit=40&with_details", {}, function(operations) { + operations = operations["operation"]; success_icons = { true: 'check text-success', false: 'close text-danger', '?': 'question text-warning' } - for (var category in categories) { - for (var log in categories[category]) - { - categories[category][log].success_icon = success_icons[categories[category][log].success] - } - if (categories.hasOwnProperty(category)) { - data.push({ - key:category, - icon:(category in category_icons)?category_icons[category]:'info-circle', - value:categories[category] - }); - } + for (var log in operations) + { + operations[log].success_icon = success_icons[operations[log].success] } c.view('tools/tools_logs', { - "data": data, + "operations": operations, "locale": y18n.locale }); }); @@ -131,16 +113,10 @@ // One journal app.get(/\#\/tools\/logs\/(.*)(\?number=(\d+))?/, function (c) { var params = "?path=" + c.params["splat"][0]; - var number = (c.params["number"])?c.params["number"]:50; - params += "&filter_irrelevant&number=" + number; + var number = (c.params["number"])?c.params["number"]:25; + params += "&filter_irrelevant&with_suboperations&number=" + number; c.api('GET', "/logs/display" + params, {}, function(log) { - if ('metadata' in log) { - if (!'env' in log.metadata && 'args' in log.metadata) { - log.metadata.env = log.metadata.args - } - } - c.view('tools/tools_log', { "log": log, "next_number": log.logs.length == number ? number * 10:false, diff --git a/src/locales/en.json b/src/locales/en.json index a55f6b9d..9f0dbe86 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -212,6 +212,7 @@ "passwords_too_short": "Password is too short", "path": "Path", "logs": "Logs", + "log_suboperations": "Sub-operations", "logs_operation": "Operations made on system with YunoHost", "logs_history": "History of command run on system", "logs_package": "Debian packages management history", diff --git a/src/views/tools/tools_log.ms b/src/views/tools/tools_log.ms index 0d292f9d..8c0a42ed 100644 --- a/src/views/tools/tools_log.ms +++ b/src/views/tools/tools_log.ms @@ -23,6 +23,14 @@ {{#if log.metadata.started_at}}
{{t 'logs_started_at'}}
{{formatTime log.metadata.started_at day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}
{{/if}}{{#if log.metadata.ended_at}}
{{t 'logs_ended_at'}}
{{formatTime log.metadata.ended_at day="numeric" month="long" year="numeric" hour="numeric" minute="numeric"}}
{{/if}} {{#if log.metadata.error}}
{{t 'logs_error'}}
{{log.metadata.error}}
{{/if}} + {{#if log.metadata.suboperations}} +
{{t 'log_suboperations'}}
+ {{#log.metadata.suboperations}} +
{{#unless success }}{{/unless}} + {{ description }}
+ {{/log.metadata.suboperations}} + {{/if}} + @@ -33,28 +41,6 @@ {{/unless}} - - {{/if}}
diff --git a/src/views/tools/tools_logs.ms b/src/views/tools/tools_logs.ms index 2b719534..f7358206 100644 --- a/src/views/tools/tools_logs.ms +++ b/src/views/tools/tools_logs.ms @@ -7,29 +7,17 @@
{{#intl locales=locale}} -{{#if data}} -
-{{#data}} -{{#if value}} -
- -
- -
+
+
+

+ {{t 'logs_operation'}} +

+
+
+ {{#operations}} + {{formatRelative started_at}} + {{ description }} + {{/operations}}
-{{/if}} -{{/data}}
-{{/if}} {{/intl}}