jathanasiou commented on a change in pull request #249:
URL: https://github.com/apache/brooklyn-ui/pull/249#discussion_r672136763



##########
File path: ui-modules/utils/logbook/logbook.js
##########
@@ -210,36 +285,30 @@ export function logbook() {
         }
 
         /**
-         * Converts log entries to string.
+         * Extracts timestamp from the log entry.
          *
-         * @param {Array.<Object>} logEntries The log entries to convert.
-         * @returns {String} log entries converted to string.
+         * @param logEntry The log entry.
+         * @returns {number} The extracted date-time.
          */
-        function covertLogEntriesToString(logEntries) {
-            let output = [];
-            const fieldsToShow = getCheckedBoxes($scope.logFields);
-            logEntries.forEach(entry => {
-                let outputLine = [];
-                if (fieldsToShow.includes('datetime') && entry.timestamp)
-                    outputLine.push(entry.timestamp);
-                if (fieldsToShow.includes('taskId') && entry.taskId)
-                    outputLine.push(entry.taskId);
-                if (fieldsToShow.includes('entityIds') && entry.entityIds)
-                    outputLine.push(entry.entityIds);
-                if (fieldsToShow.includes('level') && entry.level)
-                    outputLine.push(entry.level);
-                if (fieldsToShow.includes('bundleId') && entry.bundleId)
-                    outputLine.push(entry.bundleId);
-                if (fieldsToShow.includes('class') && entry.class)
-                    outputLine.push(entry.class);
-                if (fieldsToShow.includes('threadName') && entry.threadName)
-                    outputLine.push(entry.threadName);
-                if (fieldsToShow.includes('message') && entry.message)
-                    outputLine.push(entry.message);
-
-                output.push(outputLine.join(' '));
-            })
-            return output.length > 0 ? output.join('\n') : 'No results';
+        function getLogEntryTimestamp(logEntry) {
+            return Date.parse(logEntry.timestamp.replace(',', '.'))
+        }
+
+        /**
+         * Extracts UTC timestamp from the date.
+         *
+         * @param {Date|number} date The date to get UTC timestamp of.
+         * @returns {number|undefined} The UTC timestamp.
+         */
+        function getUtcTimestamp(date) {
+            const timezoneOffsetMs = new Date().getTimezoneOffset() * 60 * 
1000;
+            if (date instanceof Date) {
+                return date.valueOf() - timezoneOffsetMs;
+            } else if (typeof date === 'number') {
+                return date - timezoneOffsetMs;
+            } else {
+                return undefined;

Review comment:
       Return undefined is a needless statement for JS functions.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to