Skip to content

Commit

Permalink
Show null duration as '-'.
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr committed Jul 31, 2018
1 parent b86715c commit 494f43b
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions client/app/filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { capitalize as _capitalize, isEmpty } from 'lodash';
export function durationHumanize(duration) {
let humanized = '';

if (duration === undefined) {
if (duration === undefined || duration === null) {
humanized = '-';
} else if (duration < 60) {
const seconds = Math.round(duration);
Expand All @@ -31,7 +31,8 @@ export function scheduleHumanize(schedule) {
return 'Never';
} else if (schedule.match(/\d\d:\d\d/) !== null) {
const parts = schedule.split(':');
const localTime = moment.utc()
const localTime = moment
.utc()
.hour(parts[0])
.minute(parts[1])
.local()
Expand All @@ -44,8 +45,7 @@ export function scheduleHumanize(schedule) {
}

export function toHuman(text) {
return text.replace(/_/g, ' ').replace(/(?:^|\s)\S/g, a =>
a.toUpperCase());
return text.replace(/_/g, ' ').replace(/(?:^|\s)\S/g, a => a.toUpperCase());
}

export function colWidth(widgetWidth) {
Expand Down Expand Up @@ -103,14 +103,7 @@ export function showError(field) {
return field.$touched && field.$invalid;
}

const units = [
'bytes',
'KB',
'MB',
'GB',
'TB',
'PB',
];
const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];

export function prettySize(bytes) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) {
Expand Down

0 comments on commit 494f43b

Please sign in to comment.