@atomist/org-visualizer
Version:
Organization Visualizer using Atomist project scanning
123 lines • 6.14 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const projectList_1 = require("./projectList");
function idealDisplay(af) {
let result = React.createElement("span", null);
if (af.ideal) {
const idealQueryLink = `./query?type=${af.type}&name=${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 displayImportantAspect(f, i) {
const key = "collapsible" + i;
const expandByDefault = f.fingerprints.length === 1;
const allLink = trim => `./query?type=${f.aspect.name}&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(mfs) {
if (mfs.length === 0) {
return React.createElement("div", null);
}
return React.createElement("div", null,
React.createElement("h2", null, "Unseen Aspects"),
"These aspects were not found in any project:",
React.createElement("ul", null, mfs.map(displayUnfoundAspect)));
}
function displayUnfoundAspect(mf, i) {
const link = !!mf.documentationUrl ?
React.createElement("a", { href: mf.documentationUrl }, mf.displayName) : mf.displayName;
return React.createElement("li", { className: "unfound" }, link);
}
function fingerprintListItem(f) {
const displayName = f.displayName || f.name;
const variantsQueryLink = `./query?type=${f.type}&name=${f.name}&byOrg=true`;
const existsLink = `./query?type=${f.type}&name=${f.name}&byOrg=true&presence=true&otherLabel=true`;
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) {
if (props.projectsAnalyzed === 0) {
return React.createElement("div", null,
React.createElement("h2", null, "No projects analyzed"),
"Use the ",
React.createElement("pre", null, "spider"),
" command to investigate 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.");
}
const projectSummary = React.createElement(projectList_1.ProjectList, { projects: props.projects });
return React.createElement("div", null,
projectSummary,
React.createElement("h2", null, "Aspects"),
React.createElement("div", { className: "importantFeatures" },
React.createElement("ul", null, props.importantAspects.map(displayImportantAspect))),
displayUnfoundAspects(props.unfoundAspects));
}
exports.displayAspects = displayAspects;
// tslint:disable:max-line-length
function OrgExplorer(props) {
return React.createElement("div", null,
displayAspects(props),
React.createElement("h2", null, "Common queries"),
React.createElement("h3", null, "Code"),
React.createElement("ul", null,
React.createElement("li", { key: "code-1" },
React.createElement("a", { href: "./query?skew=true&byOrg=true" }, "Entropy explorer")),
React.createElement("li", { key: "code-2" },
React.createElement("a", { href: "./query?filter=true&name=aspectCount&byOrg=true" }, "Aspect count by project")),
React.createElement("li", { key: "code-5" },
React.createElement("a", { href: "./query?filter=true&name=langs&byOrg=true" }, "Language breakdown for all projects")),
React.createElement("li", { key: "code-6" },
React.createElement("a", { href: "./query?filter=true&name=loc&byOrg=true" }, "Repo sizes"))),
React.createElement("h2", null, "Data"),
React.createElement("ul", null,
React.createElement("li", null,
React.createElement("a", { href: "./api-docs" }, "Swagger documentation")),
React.createElement("li", null,
React.createElement("a", { href: "./api/v1/*/fingerprint/npm-project-deps/tslint?type=npm-project-deps&name=tslint&byOrg=true" }, "Example of backing JSON data"))));
}
exports.OrgExplorer = OrgExplorer;
//# sourceMappingURL=org.js.map