UNPKG

@atomist/sdm-pack-aspect

Version:

an Atomist SDM Extension Pack for visualizing drift across an organization

162 lines 8.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const customReporters_1 = require("../lib/customize/customReporters"); const utils_1 = require("./utils"); function idealDisplay(af) { let result = React.createElement("span", null); if (af.ideal) { const idealQueryLink = `./fingerprint/${af.type}/${af.name}?byOrg=true&progress=true`; result = React.createElement("span", null, "-", React.createElement("a", { href: idealQueryLink }, " Progress toward ideal ", " ", React.createElement("b", null, af.ideal.displayValue))); } return result; } function displayAspect(f, i) { const key = "collapsible" + i; const expandByDefault = f.fingerprints.length === 1; const allLink = trim => `./fingerprint/${f.aspect.name}/*?byOrg=true&trim=${trim}`; const about = !f.aspect.documentationUrl ? "" : React.createElement("a", { href: f.aspect.documentationUrl }, "About"); const graphAll = f.fingerprints.length <= 1 ? "" : React.createElement("a", { href: allLink(true) }, "All fingerprints"); const graphAllExpanded = f.fingerprints.length <= 1 ? "" : React.createElement("a", { href: allLink(false) }, "Expanded"); const summaryListItem = about || graphAll || graphAllExpanded ? React.createElement("li", { key: "all" + i }, about, " ", graphAll, " ", graphAllExpanded) : ""; return React.createElement("div", { className: "wrap-collapsible feature-collapsible" }, React.createElement("input", { id: key, className: "sneaky toggle", type: "checkbox", defaultChecked: expandByDefault }), React.createElement("label", { htmlFor: key, className: "lbl-toggle fp-list" }, f.aspect.displayName, " (", f.fingerprints.length, ")"), React.createElement("div", { className: "collapsible-content" }, React.createElement("div", { className: "content-inner" }, React.createElement("ul", null, summaryListItem, f.fingerprints.map(fingerprintListItem))))); } function displayUnfoundAspects(unfoundAspects) { if (unfoundAspects.length === 0) { return React.createElement("div", null); } return React.createElement("div", null, React.createElement("h2", null, "Unseen Aspects (", unfoundAspects.length, ")"), "These aspects are understood by this ", React.createElement("i", null, "org-visualizer"), " instance but were not found in any project:", React.createElement("ul", null, unfoundAspects.map(displayUnfoundAspect))); } function displayUnfoundAspect(unfoundAspectForDisplay, i) { const link = !!unfoundAspectForDisplay.documentationUrl ? React.createElement("a", { href: unfoundAspectForDisplay.documentationUrl }, unfoundAspectForDisplay.displayName) : unfoundAspectForDisplay.displayName; return React.createElement("li", { className: "unfound" }, link); } function fingerprintListItem(f) { const displayName = f.displayName || f.name; const variantsQueryLink = `./fingerprint/${encodeURIComponent(f.type)}/${encodeURIComponent(f.name)}?byOrg=true`; const existsLink = `./fingerprint/${f.type}/${f.name}?byOrg=true&otherLabel=None`; const ent = f.entropy ? React.createElement("span", null, `entropy=${f.entropy.toFixed(2)}`) : ""; return React.createElement("li", { key: displayName }, React.createElement("i", null, displayName), ": ", f.count, " projects, ", " ", React.createElement("a", { href: variantsQueryLink }, f.variants, " variants"), " ", ent, " ", React.createElement("a", { href: existsLink }, "Presence"), " ", " ", idealDisplay(f)); } function displayAspects(props) { return React.createElement("div", null, React.createElement("h2", null, "Aspects (", props.foundAspects.length, ")"), React.createElement("div", { className: "importantAspects" }, React.createElement("ul", null, props.foundAspects.map(displayAspect))), displayUnfoundAspects(props.unfoundAspects)); } exports.displayAspects = displayAspects; function displayDashboards(props) { return React.createElement("div", null, React.createElement("h2", null, "Dashboards"), React.createElement("ul", null, utils_1.collapsible("explore", "Explore", React.createElement("ul", null, React.createElement("li", null, "Drift Report"), React.createElement("ul", null, React.createElement("li", { key: "code-1" }, React.createElement("a", { href: "./drift?percentile=98" }, "Aspects with the greatest entropy")), React.createElement("li", { key: "code-1" }, React.createElement("a", { href: "./drift" }, "Entropy for all aspects"))), React.createElement("li", null, React.createElement("a", { href: "./explore" }, "Interactive explorer"), " - Explore your ", props.repos.length, " repositories by tag")), true), utils_1.collapsible("repo-nav", "Repository List", React.createElement("ul", null, React.createElement("li", { key: "repo-nav-by-org" }, React.createElement("a", { href: "./repositories?byOrg=true" }, "By organization")), React.createElement("li", { key: "repo-nav-not-by-org" }, React.createElement("a", { href: "./repositories?byOrg=false" }, "Ranked"))), true), utils_1.collapsible("custom-reports", "Custom Reports", displayCustomReports(), true))); } function displayCustomReports() { return React.createElement("ul", null, Object.getOwnPropertyNames(customReporters_1.CustomReporters).map(name => { const reporter = customReporters_1.CustomReporters[name]; return React.createElement("li", { key: `report-${name}` }, React.createElement("a", { href: `./report/${name}?byOrg=true` }, reporter.summary), " - ", reporter.description); })); } // tslint:disable:max-line-length function Overview(props) { if (props.projectsAnalyzed === 0) { return React.createElement("div", null, React.createElement("h2", null, "No projects analyzed"), "Use the `atomist analyze ...` command to analyze some projects. See ", React.createElement("a", { href: "https://github.com/atomist-blogs/org-visualizer/blob/master/README.md#analyze-your-repositories" }, "the README"), " for details.", displayDeveloperResources()); } return React.createElement("div", null, displayDashboards(props), displayAspects(props), displayDeveloperResources()); } exports.Overview = Overview; function displayDeveloperResources() { return React.createElement("div", null, React.createElement("h2", null, "Developer"), React.createElement("ul", null, React.createElement("li", null, React.createElement("a", { href: "https://github.com/atomist-blogs/org-visualizer/blob/master/docs/developer.md" }, "Developer Guide"), " - Developer documentation on ", React.createElement("a", { href: "https://github.com/atomist-blogs" }, "GitHub")), React.createElement("li", null, React.createElement("a", { href: "./api-docs" }, "Swagger documentation"), " - Interactive documentation for API endpoints running on this server"), React.createElement("li", null, React.createElement("a", { href: "./api/v1/*/fingerprint/npm-project-deps/tslint?byOrg=true" }, "Example of backing JSON data"), " - Example tree structured data return"))); } //# sourceMappingURL=overview.js.map