Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WiP] First class data types / extra extension points / extensible router #362

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7a4cc9c
Add component type filter for extensionPoints
kzantow Jun 30, 2016
8d3c0e0
Merge remote-tracking branch 'primary/master' into JENKINS-35860-exte…
kzantow Jun 30, 2016
f41a636
Bump js-extensions beta version
kzantow Jun 30, 2016
4ebf1cf
Merge remote-tracking branch 'primary/master' into JENKINS-35860-exte…
kzantow Jul 5, 2016
c24dfaf
Address @tfennelly's comments:
kzantow Jul 5, 2016
7e21eda
Merge remote-tracking branch 'primary/master' into JENKINS-35860-exte…
kzantow Jul 7, 2016
d09af3e
Merge remote-tracking branch 'primary/master' into JENKINS-35860-exte…
kzantow Jul 11, 2016
8983233
Split ClassMetadataStore, modify extension filtering to a common method
kzantow Jul 11, 2016
a91b41e
Update js-extensions version
kzantow Jul 11, 2016
3397771
Burned through some npm versions to get this published with a tag, d'oh
kzantow Jul 11, 2016
fdbe5a6
Separate componentType to its own file
kzantow Jul 15, 2016
479bc8e
Merge remote-tracking branch 'primary/master' into JENKINS-35860-exte…
kzantow Jul 15, 2016
2a808b2
Merge remote-tracking branch 'primary/master' into JENKINS-35860-exte…
kzantow Jul 17, 2016
b566f3d
Dynamic page elements based on top-level types PoC
kzantow Jul 18, 2016
e063944
Try dynamic routes
kzantow Jul 18, 2016
d90eb68
Update JDL
kzantow Jul 18, 2016
56d0816
Migrate react router to obejcts
kzantow Jul 18, 2016
20e5fd3
Almost route working
kzantow Jul 18, 2016
a856e6b
Dynamic routes working!
kzantow Jul 18, 2016
dc9139a
Add extension point for run details
kzantow Jul 18, 2016
7459fc3
fix: get /pipelines to render
Jul 18, 2016
cc5a1a0
fix: get top-level route and org/orgName route to redirect to 'pipeli…
Jul 18, 2016
250da96
fix: default route for run detail redirects to 'pipeline'
Jul 18, 2016
37d4ba3
add TODO
Jul 18, 2016
afd9abd
Fix the data reference for RunDetailsPipeline
kzantow Jul 18, 2016
13c91c7
Move individual run tabs to extension point
kzantow Jul 18, 2016
a2fadf1
Run details tabs extensible
kzantow Jul 18, 2016
15d0254
Merge branch 'san-jose-hackfest' into first-class-project-types-proto…
kzantow Jul 18, 2016
e7ba99f
Merge remote-tracking branch 'primary/master' into first-class-projec…
kzantow Jul 19, 2016
944ad55
Merge remote-tracking branch 'primary/master' into first-class-projec…
kzantow Jul 20, 2016
4083806
Merge branch 'first-class-project-types-prototype' into extensibility…
kzantow Jul 20, 2016
7725409
Tweak
kzantow Jul 21, 2016
183c83a
Merge remote-tracking branch 'primary/master' into first-class-projec…
kzantow Jul 25, 2016
4264c72
Fix lint issues
kzantow Jul 25, 2016
7f9cf64
Update pom
kzantow Jul 25, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blueocean-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"dependencies": {
"@jenkins-cd/design-language": "0.0.64",
"@jenkins-cd/js-extensions": "0.0.19",
"@jenkins-cd/js-extensions": "0.0.20-beta-1",
"@jenkins-cd/js-modules": "0.0.5",
"@jenkins-cd/sse-gateway": "0.0.6",
"immutable": "3.8.1",
Expand Down
78 changes: 52 additions & 26 deletions blueocean-dashboard/src/main/js/PipelineRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route, Redirect, IndexRoute, IndexRedirect } from 'react-router';

import React from 'react';
import Dashboard from './Dashboard';
import OrganizationPipelines from './OrganizationPipelines';
Expand All @@ -14,34 +14,60 @@ import {
RunDetailsArtifacts,
RunDetailsTests,
} from './components';
import Extensions from '@jenkins-cd/js-extensions';

const DynamicRoutes = {
path: ':pipeline/(.*)',

getChildRoutes(partialNextState, callback) {
Extensions.store.getExtensions('pipeline.routes', routes => {
callback(null, routes); // routes is array
});
},
};

export default (
<Route path="/" component={Dashboard}>
<Route path="organizations/:organization" component={OrganizationPipelines}>
<IndexRedirect to="pipelines" />
<Route path="pipelines" component={Pipelines} />
{ path: '', component: Dashboard, indexRoute: {
onEnter: ({ params }, replace) => replace('pipelines'),
},
childRoutes: [
{ path: 'organizations/:organization', component: OrganizationPipelines,
indexRoute: { onEnter: ({ params }, replace) => replace(`/organizations/${params.organization}/pipelines`) },
childRoutes: [
{ path: 'pipelines', component: Pipelines },

<Route component={PipelinePage}>
<Route path=":pipeline/branches" component={MultiBranch} />
<Route path=":pipeline/activity" component={Activity} />
<Route path=":pipeline/pr" component={PullRequests} />
{ component: PipelinePage, childRoutes: [
{ path: ':pipeline/branches', component: MultiBranch },
{ path: ':pipeline/activity', component: Activity },
{ path: ':pipeline/pr', component: PullRequests },

<Route path=":pipeline/detail/:branch/:runId" component={RunDetails}>
<IndexRedirect to="pipeline" />
<Route path="pipeline" component={RunDetailsPipeline} >
<Route path=":node" component={RunDetailsPipeline} />
</Route>
<Route path="changes" component={RunDetailsChanges} />
<Route path="tests" component={RunDetailsTests} />
<Route path="artifacts" component={RunDetailsArtifacts} />
</Route>
{ path: ':pipeline/detail/:branch/:runId', component: RunDetails,
indexRoute: {
onEnter: ({ params }, replace) => replace(
`/organizations/${params.organization}/${encodeURIComponent(params.pipeline)}/` +
`detail/${params.branch}/${params.runId}/pipeline`
),
},
childRoutes: [
{ path: 'pipeline', component: RunDetailsPipeline, childRoutes: [
{ path: ':node', component: RunDetailsPipeline },
] },
{ path: 'changes', component: RunDetailsChanges },
{ path: 'tests', component: RunDetailsTests },
{ path: 'artifacts', component: RunDetailsArtifacts },
],
},

<Redirect from=":pipeline(/*)" to=":pipeline/activity" />
</Route>
</Route>
<Route path="/pipelines" component={OrganizationPipelines}>
<IndexRoute component={Pipelines} />
</Route>
<IndexRedirect to="pipelines" />
</Route>
DynamicRoutes,
// TODO: need to convert this to onEnter - somehow?
//<Redirect from=":pipeline(/*)" to=":pipeline/activity" />
],
},
],
},
{ path: '/pipelines', component: OrganizationPipelines, indexRoute: {
component: Pipelines,
} },
],
}
);
6 changes: 2 additions & 4 deletions blueocean-dashboard/src/main/js/components/PipelinePage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import Extensions, { dataType } from '@jenkins-cd/js-extensions';
import { Link } from 'react-router';
import { isFailure, isPending } from '../util/FetchStatus';
import NotFound from './NotFound';
Expand All @@ -7,7 +8,6 @@ import {
PageHeader,
Title,
PageTabs,
TabLink,
WeatherIcon,
Favorite,
} from '@jenkins-cd/design-language';
Expand Down Expand Up @@ -47,9 +47,7 @@ export default class PipelinePage extends Component {
<Favorite className="dark-yellow" />
</Title>
<PageTabs base={baseUrl}>
<TabLink to="/activity">Activity</TabLink>
<TabLink to="/branches">Branches</TabLink>
<TabLink to="/pr">Pull Requests</TabLink>
<Extensions.Renderer extensionPoint="pipeline.main.navigation" filter={dataType(pipeline._jobClass)} pipeline={pipeline} baseLink={baseUrl} />
</PageTabs>
</PageHeader>
{React.cloneElement(this.props.children, { pipeline })}
Expand Down
7 changes: 2 additions & 5 deletions blueocean-dashboard/src/main/js/components/RunDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
ModalHeader,
PipelineResult,
PageTabs,
TabLink,
} from '@jenkins-cd/design-language';
import Extensions, { dataType } from '@jenkins-cd/js-extensions';

import {
actions,
Expand Down Expand Up @@ -119,10 +119,7 @@ class RunDetails extends Component {
onAuthorsClick={() => this.navigateToChanges()}
/>
<PageTabs base={baseUrl}>
<TabLink to="/pipeline">Pipeline</TabLink>
<TabLink to="/changes">Changes</TabLink>
<TabLink to="/tests">Tests</TabLink>
<TabLink to="/artifacts">Artifacts</TabLink>
<Extensions.Renderer extensionPoint="rundetails.main.navigation" filter={dataType(currentRun)} currentRun={currentRun} baseLink={baseUrl} />
</PageTabs>
</div>
</ModalHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ export class RunDetailsPipeline extends Component {
const noSteps = !log && currentSteps && currentSteps.model && currentSteps.model.length === 0;
const shouldShowLogHeader = log !== null || !noSteps;
return (
<div>
<Extensions.Renderer
extensionPoint="jenkins.pipeline.run.details"
currentRun={this.props.result}
/>
<div ref="scrollArea">
{ nodes && nodes[nodeKey] && <Extensions.Renderer
extensionPoint="jenkins.pipeline.run.result"
Expand Down Expand Up @@ -300,6 +305,7 @@ export class RunDetailsPipeline extends Component {

{ log && <LogConsole key={logGeneral.url} logArray={log.logArray} scrollToBottom={scrollToBottom} /> }
</div>
</div>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component, PropTypes } from 'react';
import { EmptyStateView } from '@jenkins-cd/design-language';
import { actions as selectorActions, testResults as testResultsSelector,
connect, createSelector } from '../redux';
import Extensions, { dataType } from '@jenkins-cd/js-extensions';
import Extensions, { mostSpecificDataType } from '@jenkins-cd/js-extensions';

const EmptyState = () => (
<EmptyStateView tightSpacing>
Expand Down Expand Up @@ -58,7 +58,7 @@ export class RunDetailsTests extends Component {
<div className="test-result-duration">Duration {testResults.duration}</div>
</div>

<Extensions.Renderer extensionPoint="jenkins.test.result" filter={dataType(testResults)} testResults={testResults} />
<Extensions.Renderer extensionPoint="jenkins.test.result" filter={mostSpecificDataType(testResults)} testResults={testResults} />
</div>);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { TabLink } from '@jenkins-cd/design-language';

export default class RunDetailsArtifactsTab extends React.Component {
render() {
return (
<TabLink to={`${this.props.baseLink}/artifacts`}>Artifacts</TabLink>
);
}
}

RunDetailsArtifactsTab.propTypes = {
pipeline: React.PropTypes.any,
baseLink: React.PropTypes.string,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { TabLink } from '@jenkins-cd/design-language';

export default class RunDetailsTabs extends React.Component {
render() {
return (
<span>
<TabLink to={`${this.props.baseLink}/pipeline`}>Pipeline</TabLink>
<TabLink to={`${this.props.baseLink}/changes`}>Changes</TabLink>
<TabLink to={`${this.props.baseLink}/tests`}>Tests</TabLink>
</span>
);
}
}

RunDetailsTabs.propTypes = {
pipeline: React.PropTypes.any,
baseLink: React.PropTypes.string,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { TabLink } from '@jenkins-cd/design-language';

export default class PipelineActivityTab extends React.Component {
render() {
return <TabLink to={`${this.props.baseLink}/activity`}>Activity</TabLink>;
}
}

PipelineActivityTab.propTypes = {
pipeline: React.PropTypes.any,
baseLink: React.PropTypes.string,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { TabLink } from '@jenkins-cd/design-language';

export default class PipelineBranchesTab extends React.Component {
render() {
return <TabLink to={`${this.props.baseLink}/branches`}>Branches</TabLink>;
}
}

PipelineBranchesTab.propTypes = {
pipeline: React.PropTypes.any,
baseLink: React.PropTypes.string,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { TabLink } from '@jenkins-cd/design-language';

export default class PipelinePullRequestsTab extends React.Component {
render() {
return <TabLink to={`${this.props.baseLink}/pr`}>Pull Requests</TabLink>;
}
}

PipelinePullRequestsTab.propTypes = {
pipeline: React.PropTypes.any,
baseLink: React.PropTypes.string,
};
18 changes: 18 additions & 0 deletions blueocean-dashboard/src/main/js/jenkins-js-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ extensions:
extensionPoint: jenkins.main.stores
- component: components/PipelineRunGraph
extensionPoint: jenkins.pipeline.run.result
- component: components/tabs/PipelineActivityTab
extensionPoint: pipeline.main.navigation
dataType: hudson.model.Job
- component: components/tabs/PipelineBranchesTab
extensionPoint: pipeline.main.navigation
dataType: org.jenkinsci.plugins.workflow.job.WorkflowJob
- component: components/tabs/PipelinePullRequestsTab
extensionPoint: pipeline.main.navigation
dataType: org.jenkinsci.plugins.workflow.job.WorkflowJob
- component: components/tabs/PipelineActivityTab
extensionPoint: pipeline.main.navigation
dataType: jenkins.branch.MultiBranchProject
- component: components/tabs/PipelineBranchesTab
extensionPoint: pipeline.main.navigation
dataType: jenkins.branch.MultiBranchProject
- component: components/tabs/PipelinePullRequestsTab
extensionPoint: pipeline.main.navigation
dataType: jenkins.branch.MultiBranchProject
- component: components/testing/TestResults
extensionPoint: jenkins.test.result
dataType: hudson.tasks.test.TestResult
1 change: 1 addition & 0 deletions blueocean-dashboard/src/main/less/extensions.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "variables";

@import "core";
@import "page-tabs";
@import "testing";
@import "run-pipeline";
5 changes: 5 additions & 0 deletions blueocean-dashboard/src/main/less/page-tabs.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.page-tabs {
> div, > div > div {
display: inline-block;
}
}
3 changes: 3 additions & 0 deletions blueocean-freestyle/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "stage-0", "react"]
}
10 changes: 10 additions & 0 deletions blueocean-freestyle/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 160
8 changes: 8 additions & 0 deletions blueocean-freestyle/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@jenkins-cd/jenkins/react",
"rules": {
"react/jsx-no-bind": 0,
"no-unused-vars": [2, {"varsIgnorePattern": "^React$"}],
"max-len": [1, 160, 4]
}
}
7 changes: 7 additions & 0 deletions blueocean-freestyle/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { configure } from '@kadira/storybook';

function loadStories() {
require('../src/main/js/stories/index');
}

configure(loadStories, module);
16 changes: 16 additions & 0 deletions blueocean-freestyle/.storybook/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Reset -->
<link href="/css/normalize.css" rel="stylesheet">

<!-- Icons -->
<link href="/css/latofonts.css" rel="stylesheet">
<link href="/octicons/octicons.css" rel="stylesheet">

<!-- Jenkins theme -->
<link href="/css/jenkins-design-language.css" rel="stylesheet">

<!-- styles -->
<link href="/extensions.css" rel="stylesheet">
11 changes: 11 additions & 0 deletions blueocean-freestyle/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');

module.exports = {
module: {},
resolve: {
extensions: [
'.js', // required by storybook
'', '.jsx' // for blueocean files
],
}
};
21 changes: 21 additions & 0 deletions blueocean-freestyle/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2016 CloudBees Inc and a number of other of contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Empty file added blueocean-freestyle/README.md
Empty file.
Loading