Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into task/JENKINS-41397
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivek Pandey authored and Vivek Pandey committed Mar 7, 2017
2 parents 718b731 + 21dbcaf commit e852705
Show file tree
Hide file tree
Showing 194 changed files with 6,551 additions and 1,752 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ node
node_modules
work
app.properties
npm-debug.log
npm-debug.log*
**/.settings/
**/.project
**/.classpath
Expand Down
1 change: 0 additions & 1 deletion PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ See [JENKINS-XXXXX](https://issues.jenkins-ci.org/browse/JENKINS-XXXXX).
- [ ] Reviewed the code
- [ ] Verified that the appropriate tests have been written or valid explanation given

@reviewbybees
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,53 @@ You can chat to folks on #jenkins-ux on freenode (IRC). You can also email the j
Advanced front end development with react, redux and stuff by @scherler: https://docs.google.com/presentation/d/1dbaYTIGjGT9xX1JnWnaqjMumq94M9nGwljfMQaVtUFc/edit?usp=sharing

Watch @i386 and @jenkinsci on Twitter for frequent updates and news.

## Upgrading dependencies

If you wish to upgrade dependencies or test an upgrade to something like pipeline (as an example), `pom.xml` in the root of the project should have all the versions specified, a pull request to validate the changes is appreciated.

If you wanted to see if a new version of a library works with blue ocean:

* If it isn't published yet, release a beta to the experimental update center
* Open a pull request with the changes to the `pom.xml` in the root of this project (beta dependencies are fine)
* Mark the pull request as "needs-review"
* Make sure to "@mention" people - @i386, @vivek are some good ones to start with in a pull request description
* IF the dependency being upgraded is only released to the experimental update center (ie a beta) please also mark the PR as 'DO NOT MERGE' (once it has been released to the main update center, this can be removed)
* Check back later for build success (ie unit tests)
* The Acceptance Test Harness will normally be automatically triggered after a successful PR build, however, it ie best to check it has run: (https://ci.blueocean.io/job/ATH-Jenkinsfile/job/master/) - consult a blue ocean contributor (see below) and they will ensure it has run. This is required for a dependency change.
* Contact a contributor (see below) to let them know of your proposed change so they can review it and do extra testing
* Ensure any dependencies are released to the non beta UC, before merging to master when approved.

Once the PR is accepted, it will be in use on "dogfood" on ci.blueocean.io/blue - and thus it will be in day to day use almost immediately. If it does bad things, expect to hear about it.


Contacting contributors:

Gitter is the day to day chat venue used, you can log in with your github identity.

* look for @michaelneale, @kzantow, @vivek or @i386 on gitter https://gitter.im/jenkinsci/blueocean-plugin or #jenkins-ux on freenode
* Post to the mailing list: https://groups.google.com/forum/#!forum/jenkinsci-ux


The Acceptance test suite is located here: https://github.com/jenkinsci/blueocean-acceptance-test


## Releasing

When the ATH passes and there is a consensus that a release can be performed:

* Ensure that the person doing the release has permissions for all the blueocean modules here: https://github.com/jenkins-infra/repository-permissions-updater/tree/master/permissions (or it will fail)
* Switch to the branch to release from (usually master)
* Run a `mvn clean -DcleanNode install -DskipTests` once to clear the decks if you are working on other branches
* Perform the release:

```
$ mvn release:prepare -DautoVersionSubmodules=true
$ mvn release:perform
```

This will take a while to build and upload.

* Update release notes on the wiki page

It will take a few hours to propagate to UC.
2 changes: 1 addition & 1 deletion blueocean-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.jenkins.blueocean</groupId>
<artifactId>blueocean-parent</artifactId>
<version>1.0.0-b24-SNAPSHOT</version>
<version>1.0.0-b26-SNAPSHOT</version>
</parent>

<artifactId>blueocean-commons</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,24 @@ public MethodNotAllowedException(ErrorMessage errorMessage, Throwable throwable
super(METHOD_NOT_ALLOWED, errorMessage, throwable);
}
}

public static class PreconditionRequired extends ServiceException{

public PreconditionRequired(String message) {
super(PRECONDITION_REQUIRED, message);
}

public PreconditionRequired(String message, Throwable throwable ) {
super(PRECONDITION_REQUIRED, message, throwable);
}

public PreconditionRequired(ErrorMessage errorMessage) {
super(PRECONDITION_REQUIRED, errorMessage, null);
}
public PreconditionRequired(ErrorMessage errorMessage, Throwable throwable ) {
super(PRECONDITION_REQUIRED, errorMessage, throwable);
}
}
public static final int BAD_REQUEST = 400;
public static final int UNAUTHORIZED = 401;
public static final int FORBIDDEN = 403;
Expand All @@ -260,6 +278,7 @@ public MethodNotAllowedException(ErrorMessage errorMessage, Throwable throwable
public static final int UNSUPPORTED_MEDIA_TYPE = 415;
public static final int CONFLICT = 409;
public static final int UNPROCESSABLE_ENTITY = 422;
public static final int PRECONDITION_REQUIRED = 428;
public static final int TOO_MANY_REQUESTS = 429;
public static final int INTERNAL_SERVER_ERROR = 500;
public static final int NOT_IMPLEMENTED = 501;
Expand Down
2 changes: 1 addition & 1 deletion blueocean-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.jenkins.blueocean</groupId>
<artifactId>blueocean-parent</artifactId>
<version>1.0.0-b24-SNAPSHOT</version>
<version>1.0.0-b26-SNAPSHOT</version>
</parent>

<artifactId>blueocean-config</artifactId>
Expand Down
46 changes: 39 additions & 7 deletions blueocean-core-js/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions blueocean-core-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jenkins-cd/blueocean-core-js",
"version": "0.0.67",
"version": "0.0.86",
"description": "Shared JavaScript libraries for use with Jenkins Blue Ocean",
"main": "dist/js/index.js",
"scripts": {
Expand Down Expand Up @@ -29,12 +29,12 @@
"url": "https://github.com/jenkinsci/blueocean-plugin.git"
},
"dependencies": {
"@jenkins-cd/design-language": "0.0.112",
"@jenkins-cd/design-language": "0.0.122",
"@jenkins-cd/js-extensions": "0.0.33",
"@jenkins-cd/js-modules": "0.0.8",
"@jenkins-cd/logging": "0.0.6",
"@jenkins-cd/react-material-icons": "1.0.0",
"@jenkins-cd/sse-gateway": "0.0.18",
"@jenkins-cd/sse-gateway": "0.0.19",
"@jenkins-cd/storage": "0.0.6",
"es6-promise": "4.0.5",
"i18next": "3.5.2",
Expand All @@ -46,6 +46,7 @@
"mobx-utils": "1.1.2",
"moment": "2.15.1",
"pem-jwk": "1.5.1",
"react-remarkable": "1.1.1",
"react-router": "2.3.0"
},
"peerDependencies": {
Expand Down
101 changes: 95 additions & 6 deletions blueocean-core-js/src/js/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,91 @@

import { blueocean } from './scopes';

export class User {
class PipelinePermissions {
constructor(blueUser = {}) {
if (blueUser.permission && blueUser.permission.pipeline) {
this._permissions = blueUser.permission.pipeline;
} else {
this._permissions = {};
}
}

create() {
return !!this._permissions.create;
}

read() {
return !!this._permissions.read;
}

start() {
return !!this._permissions.start;
}

stop() {
return !!this._permissions.stop;
}

configure() {
return !!this._permissions.configure;
}
}


class CredentialPermissions {
constructor(blueUser = {}) {
if (blueUser.permission && blueUser.permission.credential) {
this._permissions = blueUser.permission.credential;
} else {
this._permissions = {};
}
}

create() {
return !!this._permissions.create;
}

view() {
return !!this._permissions.view;
}

delete() {
return !!this._permissions.delete;
}

update() {
return !!this._permissions.update;
}

manageDomains() {
return !!this._permissions.manageDomains;
}
}

export class User {

constructor(blueUser = {}) {
this._class = blueUser._class;
this._links = blueUser._links;
this.email = blueUser.email;
this.fullName = blueUser.fullName;
this.id = blueUser.id || 'anonymous';
this._blueUser = blueUser;
}

get _class() {
return this._blueUser._class;
}

get _links() {
return this._blueUser._links;
}

get email() {
return this._blueUser.email;
}

get fullName() {
return this._blueUser.fullName;
}

get id() {
return this._blueUser.id || 'anonymous';
}

isAnonymous() {
Expand All @@ -21,6 +98,18 @@ export class User {
static current() {
return CURRENT; // eslint-disable-line no-use-before-define
}

get isAdministrator() {
const permission = this._blueUser.permission || {};
return !!permission.administrator;
}

get permissions() {
return {
pipeline: new PipelinePermissions(this._blueUser),
credential: new CredentialPermissions(this._blueUser),
};
}
}

let CURRENT = new User(blueocean.user);
Expand Down
3 changes: 2 additions & 1 deletion blueocean-core-js/src/js/components/ContentPageHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const SiteHeader = props => {
return (
<BasicHeader className="ContentPageHeader">
<TopNav>
<BlueLogo />
<BlueLogo href={props.homeURL} />
<div className="u-flex-grow" />
{ topNavLinks }
{ userComponents }
Expand All @@ -39,6 +39,7 @@ SiteHeader.propTypes = {
topNavLinks: PropTypes.node,
userComponents: PropTypes.node,
children: PropTypes.node,
homeURL: PropTypes.string,
};

export const ContentPageHeader = props => {
Expand Down
5 changes: 3 additions & 2 deletions blueocean-core-js/src/js/components/ReplayButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { Icon } from '@jenkins-cd/react-material-icons';

import { capable, RunApi as runApi, ToastUtils } from '../index';
import Security from '../security';
import i18nTranslator from '../i18n/i18n';

const { permit } = Security;
const translate = i18nTranslator('blueocean-web');

const stopProp = (event) => {
event.stopPropagation();
Expand Down Expand Up @@ -79,8 +81,7 @@ export class ReplayButton extends Component {
const isPipeline = capable(this.props.runnable, PIPELINE_CAPABILITIES);
const hasPermission = permit(this.props.runnable).start();

const replayLabel = 'Re-run';

const replayLabel = translate('toast.re-run', { defaultValue: 'Re-run' });

if (!isFinished || !isPipeline || !hasPermission) {
return null;
Expand Down
Loading

0 comments on commit e852705

Please sign in to comment.