UNPKG

@atomist/sdm-pack-aspect

Version:

an Atomist SDM Extension Pack for visualizing drift across an organization

67 lines 3.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); function displayAspectPerformance(world, ap) { let belowLowWidth = Math.round(ap.minMillis * world.pixelsPerMilli); let betweenWidth = Math.round((ap.maxMillis - ap.minMillis) * world.pixelsPerMilli); if (betweenWidth < 5) { betweenWidth = 6; belowLowWidth = Math.max(0, belowLowWidth - 3); } if ((belowLowWidth + betweenWidth) > world.widthOfGraph) { belowLowWidth = world.widthOfGraph - betweenWidth; } return React.createElement("tr", null, React.createElement("td", null, ap.aspectName), React.createElement("td", null, ap.runs), React.createElement("td", null, ap.totalFingerprints), React.createElement("td", null, ap.failures), React.createElement("td", { className: "runTiming" }, ap.minMillis, "ms"), React.createElement("td", null, React.createElement("div", { className: "envisionSpeed", style: { width: world.widthOfGraph + "px" } }, React.createElement("div", { className: "belowLow", style: { width: belowLowWidth + "px" } }, ap.minMillis), React.createElement("div", { className: "betweenLowAndHigh", style: { width: betweenWidth + "px" }, title: ap.minMillis + "-" + ap.maxMillis + "ms" }, "- ", ap.maxMillis))), React.createElement("td", { className: "runTiming" }, ap.maxMillis, "ms")); } function sortAspectPerformance(a1, a2) { return a2.totalTimeTaken - a1.totalTimeTaken; } function AspectTrackingPage(props) { if (props.aspectPerformances.length === 0) { return React.createElement("div", null, "No analyses in progress. Start one at the command line:", " ", React.createElement("span", { className: "typeThisAtCommandLine" }, "atomist analyze local repositories")); } const widthOfGraph = 500; const minniestMin = Math.min(...props.aspectPerformances.map(a => a.minMillis)); const maxiestMax = Math.max(...props.aspectPerformances.map(a => a.maxMillis)); const pixelsPerMilli = widthOfGraph / (maxiestMax - minniestMin); return React.createElement("table", null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", null, "Name"), React.createElement("th", null, "Runs"), React.createElement("th", null, "FPs"), React.createElement("th", null, "Fails"), React.createElement("th", { className: "runHeader" }, "Fastest run"), React.createElement("th", null, React.createElement("div", { style: { width: widthOfGraph + "px" } }, React.createElement("span", { className: "minniestMin" }, minniestMin, " ms"), " --- Range of time taken ---", React.createElement("span", { className: "maxiestMax" }, maxiestMax, " ms"))), React.createElement("th", { className: "runHeader" }, "Slowest run"))), props.aspectPerformances.sort(sortAspectPerformance).map(ap => displayAspectPerformance({ widthOfGraph, pixelsPerMilli }, ap))); } exports.AspectTrackingPage = AspectTrackingPage; //# sourceMappingURL=aspectTrackingPage.js.map