Skip to content

Commit

Permalink
Merge pull request #51 from daniel-beck/WEBSITE-328
Browse files Browse the repository at this point in the history
[WEBSITE-328] Distinguish between implied and required dependencies
  • Loading branch information
daniel-beck committed Mar 6, 2018
2 parents d6445e5 + be73eb6 commit f463c5f
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions app/components/PluginDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class PluginDetail extends React.PureComponent {
name: PropTypes.string,
title: PropTypes.string,
optional: PropTypes.bool,
implied: PropTypes.bool,
version: PropTypes.string
})),
excerpt: PropTypes.string,
Expand Down Expand Up @@ -111,11 +112,18 @@ class PluginDetail extends React.PureComponent {
return (<div className="empty">No dependencies found</div>);
}

return dependencies.sort((a, b) => a.optional === b.optional ? 0 : (a.optional ? 1 : -1)).map((dependency) => {
const required = !dependency.optional ? 'required' : 'optional';
return dependencies.sort((a, b) => a.implied === b.implied ? (a.optional === b.optional ? 0 : a.optional ? 1 : -1 ) : (a.implied ? 1 : -1)).map((dependency) => {
const kind = !dependency.optional ? (dependency.implied ? 'implied' : 'required') : 'optional';
if (kind === 'implied') {
return (
<div key={dependency.name} className={kind}>
<Link to={`/${dependency.name}`}>{dependency.title} v.{dependency.version} <span className="req">({kind})</span></Link> <a href="#" onClick={this.showImplied}><span className="req">(what&apos;s this?)</span></a>
</div>
);
}
return (
<div key={dependency.name} className={required}>
<Link to={`/${dependency.name}`}>{dependency.title} v.{dependency.version} <span className="req">({required})</span></Link>
<div key={dependency.name} className={kind}>
<Link to={`/${dependency.name}`}>{dependency.title} v.{dependency.version} <span className="req">({kind})</span></Link>
</div>
);
});
Expand Down Expand Up @@ -170,6 +178,38 @@ class PluginDetail extends React.PureComponent {
this.warningsModal.show();
}

showImplied = () => {
this.impliedModal.show();
}

getImpliedModal() {
return (
<div className="badge-box">
<ModalView hideOnOverlayClicked ignoreEscapeKey ref={(modal) => { this.impliedModal = modal; }}>
<Header>
<div>About Implied Plugin Dependencies</div>
</Header>
<Body>
<div>
<p>
Features are sometimes detached (or split off) from Jenkins core and moved into a plugin.
Many plugins, like Subversion or JUnit, started as features of Jenkins core.
</p>
<p>
Plugins that depend on a Jenkins core version before such a plugin was detached from core may or may not actually use any of its features.
To ensure that plugins don't break whenever functionality they depend on is detached from Jenkins core, it is considered to have a dependency on the detached plugin if it declares a dependency on a version of Jenkins core before the split.
Since that dependency to the detached plugin is not explicitly specified, it is <em>implied</em>.
</p>
<p>
Plugins that don't regularly update which Jenkins core version they depend on will accumulate implied dependencies over time.
</p>
</div>
</Body>
</ModalView>
</div>
);
}

getActiveWarnings(securityWarnings) {
if (!securityWarnings) {
return null;
Expand Down Expand Up @@ -284,6 +324,7 @@ class PluginDetail extends React.PureComponent {
<h1 className="title">
{cleanTitle(plugin.title)}
{this.getActiveWarnings(plugin.securityWarnings)}
{this.getImpliedModal()}
<span className="v">{plugin.version}</span>
<span className="sub">Minimum Jenkins requirement: {plugin.requiredCore}</span>
<span className="sub">ID: {plugin.name}</span>
Expand Down

0 comments on commit f463c5f

Please sign in to comment.