Repository: incubator-nifi Updated Branches: refs/heads/nifi-27 eb880757b -> fef807136
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/fef80713/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js index f570082..178207e 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js @@ -60,13 +60,6 @@ nf.StatusHistory = (function () { }; /** - * version 3.4+ of D3 provides a mechanism for specifying - * a number of custom formatters. this achieves similar function - * until we're able to upgrade. - */ - var timeFormats = null; - - /** * The time offset of the server. */ var serverTimeOffset = null; @@ -373,26 +366,21 @@ nf.StatusHistory = (function () { visible: instances[instance.id] === true }); }); - + // -------------------------- // custom time axis formatter // -------------------------- - // create the formatting function - var customTimeFormat = function (d) { - var formatter; - - // identify the most appropriate formatter for this date - $.each(timeFormats, function (_, timeFormat) { - if (timeFormat[1](d)) { - formatter = timeFormat; - return false; - } - }); - - // return the formatter date - return formatter[0](d); - }; + var customTimeFormat = d3.time.format.multi([ + [':%S.%L', function (d) { return d.getMilliseconds(); }], + [':%S', function (d) { return d.getSeconds(); }], + ['%H:%M', function (d) { return d.getMinutes(); }], + ['%H:%M', function (d) { return d.getHours(); }], + ['%a %d', function (d) { return d.getDay() && d.getDate() !== 1; }], + ['%b %d', function (d) { return d.getDate() !== 1; }], + ['%B', function (d) { return d.getMonth(); }], + ['%Y', function () { return true; }] + ]); // ---------- // main chart @@ -1136,34 +1124,6 @@ nf.StatusHistory = (function () { init: function (timeOffset) { serverTimeOffset = timeOffset; - // initialize the time formats - timeFormats = [ - [d3.time.format(':%S.%L'), function (d) { - return d.getMilliseconds(); - }], - [d3.time.format(':%S'), function (d) { - return d.getSeconds(); - }], - [d3.time.format('%H:%M'), function (d) { - return d.getMinutes(); - }], - [d3.time.format('%H:%M'), function (d) { - return d.getHours(); - }], - [d3.time.format('%a %d'), function (d) { - return d.getDay() && d.getDate() !== 1; - }], - [d3.time.format('%b %d'), function (d) { - return d.getDate() !== 1; - }], - [d3.time.format('%B'), function (d) { - return d.getMonth(); - }], - [d3.time.format('%Y'), function () { - return true; - }] - ]; - nf.Common.addHoverEffect('#status-history-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () { var statusHistory = $('#status-history-dialog').data('status-history'); if (statusHistory !== null) {