mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Ran npx prettier --write "**/*.js" "*.js"
This commit is contained in:
parent
a5733075d6
commit
12279686e8
85 changed files with 3428 additions and 3318 deletions
|
@ -1,37 +1,33 @@
|
|||
module.exports = {
|
||||
"extends": [
|
||||
extends: [
|
||||
"standard",
|
||||
"plugin:jest/recommended",
|
||||
"plugin:react/recommended",
|
||||
"prettier",
|
||||
"prettier/react"
|
||||
],
|
||||
"plugins": [
|
||||
"react",
|
||||
"jest",
|
||||
"prettier"
|
||||
],
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2016,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
plugins: ["react", "jest", "prettier"],
|
||||
parser: "babel-eslint",
|
||||
parserOptions: {
|
||||
ecmaVersion: 2016,
|
||||
sourceType: "module",
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
node: true,
|
||||
"jest/globals": true
|
||||
},
|
||||
"rules": {
|
||||
rules: {
|
||||
"react/prop-types": 1,
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
"trailingComma": "all",
|
||||
"useTabs": true
|
||||
trailingComma: "all",
|
||||
useTabs: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ export const drone = (client, Component) => {
|
|||
const component = class extends React.Component {
|
||||
getChildContext() {
|
||||
return {
|
||||
drone: client,
|
||||
drone: client
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ export const drone = (client, Component) => {
|
|||
};
|
||||
|
||||
component.childContextTypes = {
|
||||
drone: (props, propName) => {},
|
||||
drone: (props, propName) => {}
|
||||
};
|
||||
|
||||
return component;
|
||||
|
|
|
@ -11,62 +11,62 @@ const state = {
|
|||
data: user,
|
||||
error: undefined,
|
||||
loaded: true,
|
||||
syncing: sync,
|
||||
syncing: sync
|
||||
},
|
||||
|
||||
feed: {
|
||||
loaded: false,
|
||||
error: undefined,
|
||||
data: {},
|
||||
data: {}
|
||||
},
|
||||
|
||||
repos: {
|
||||
loaded: false,
|
||||
error: undefined,
|
||||
data: {},
|
||||
data: {}
|
||||
},
|
||||
|
||||
secrets: {
|
||||
loaded: false,
|
||||
error: undefined,
|
||||
data: {},
|
||||
data: {}
|
||||
},
|
||||
|
||||
registry: {
|
||||
error: undefined,
|
||||
loaded: false,
|
||||
data: {},
|
||||
data: {}
|
||||
},
|
||||
|
||||
builds: {
|
||||
loaded: false,
|
||||
error: undefined,
|
||||
data: {},
|
||||
data: {}
|
||||
},
|
||||
|
||||
logs: {
|
||||
follow: false,
|
||||
loading: true,
|
||||
error: false,
|
||||
data: {},
|
||||
data: {}
|
||||
},
|
||||
|
||||
token: {
|
||||
value: undefined,
|
||||
error: undefined,
|
||||
loading: false,
|
||||
loading: false
|
||||
},
|
||||
|
||||
message: {
|
||||
show: false,
|
||||
text: undefined,
|
||||
error: false,
|
||||
error: false
|
||||
},
|
||||
|
||||
location: {
|
||||
protocol: window.location.protocol,
|
||||
host: window.location.host,
|
||||
},
|
||||
host: window.location.host
|
||||
}
|
||||
};
|
||||
|
||||
const tree = new Baobab(state);
|
||||
|
|
|
@ -26,7 +26,7 @@ export default class Sidebar extends Component {
|
|||
this.setState({
|
||||
starred: JSON.parse(localStorage.getItem("starred") || "[]"),
|
||||
starredOpen: (localStorage.getItem("starredOpen") || "true") === "true",
|
||||
reposOpen: (localStorage.getItem("reposOpen") || "true") === "true",
|
||||
reposOpen: (localStorage.getItem("reposOpen") || "true") === "true"
|
||||
});
|
||||
|
||||
this.handleFilter = this.handleFilter.bind(this);
|
||||
|
@ -44,7 +44,7 @@ export default class Sidebar extends Component {
|
|||
|
||||
handleFilter(e) {
|
||||
this.setState({
|
||||
filter: e.target.value,
|
||||
filter: e.target.value
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -122,15 +122,13 @@ export default class Sidebar extends Component {
|
|||
triggerOpenedClassName={style.Collapsible__trigger}
|
||||
triggerClassName={style.Collapsible__trigger}
|
||||
>
|
||||
{feed.loaded === false ? (
|
||||
LOADING
|
||||
) : feed.error ? (
|
||||
ERROR
|
||||
) : list.length === 0 ? (
|
||||
EMPTY
|
||||
) : (
|
||||
this.renderFeed(list, true)
|
||||
)}
|
||||
{feed.loaded === false
|
||||
? LOADING
|
||||
: feed.error
|
||||
? ERROR
|
||||
: list.length === 0
|
||||
? EMPTY
|
||||
: this.renderFeed(list, true)}
|
||||
</Collapsible>
|
||||
<Collapsible
|
||||
trigger="Repos"
|
||||
|
@ -147,17 +145,15 @@ export default class Sidebar extends Component {
|
|||
placeholder="Search …"
|
||||
onChange={this.handleFilter}
|
||||
/>
|
||||
{feed.loaded === false ? (
|
||||
LOADING
|
||||
) : feed.error ? (
|
||||
ERROR
|
||||
) : list.length === 0 ? (
|
||||
EMPTY
|
||||
) : filtered.length > 0 ? (
|
||||
this.renderFeed(filtered.sort(compareFeedItem), false)
|
||||
) : (
|
||||
NO_MATCHES
|
||||
)}
|
||||
{feed.loaded === false
|
||||
? LOADING
|
||||
: feed.error
|
||||
? ERROR
|
||||
: list.length === 0
|
||||
? EMPTY
|
||||
: filtered.length > 0
|
||||
? this.renderFeed(filtered.sort(compareFeedItem), false)
|
||||
: NO_MATCHES}
|
||||
</Collapsible>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -34,7 +34,7 @@ const binding = (props, context) => {
|
|||
user: ["user"],
|
||||
message: ["message"],
|
||||
sidebar: ["sidebar"],
|
||||
menu: ["menu"],
|
||||
menu: ["menu"]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ const mapScreenSizeToProps = screenSize => {
|
|||
return {
|
||||
isTablet: screenSize["small"],
|
||||
isMobile: screenSize["mobile"],
|
||||
isDesktop: screenSize["> small"],
|
||||
isDesktop: screenSize["> small"]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -54,7 +54,7 @@ export default class Default extends Component {
|
|||
super(props, context);
|
||||
this.state = {
|
||||
menu: false,
|
||||
feed: false,
|
||||
feed: false
|
||||
};
|
||||
|
||||
this.openMenu = this.openMenu.bind(this);
|
||||
|
@ -140,11 +140,8 @@ export default class Default extends Component {
|
|||
exact={true}
|
||||
component={UserReposMenu}
|
||||
/>
|
||||
<Route
|
||||
path="/account/"
|
||||
exact={false}
|
||||
component={undefined}
|
||||
/>BuildMenu
|
||||
<Route path="/account/" exact={false} component={undefined} />
|
||||
BuildMenu
|
||||
<Route
|
||||
path="/:owner/:repo/:build(\d*)/:proc(\d*)"
|
||||
exact={true}
|
||||
|
|
|
@ -7,7 +7,7 @@ const binding = (props, context) => {
|
|||
return {
|
||||
feed: ["feed"],
|
||||
user: ["user", "data"],
|
||||
syncing: ["user", "syncing"],
|
||||
syncing: ["user", "syncing"]
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ export class Elapsed extends Component {
|
|||
super(props);
|
||||
|
||||
this.state = {
|
||||
elapsed: 0,
|
||||
elapsed: 0
|
||||
};
|
||||
|
||||
this.tick = this.tick.bind(this);
|
||||
|
@ -23,7 +23,7 @@ export class Elapsed extends Component {
|
|||
const { start } = this.props;
|
||||
const stop = ~~(Date.now() / 1000);
|
||||
this.setState({
|
||||
elapsed: stop - start,
|
||||
elapsed: stop - start
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,11 @@ export class Elapsed extends Component {
|
|||
date.setSeconds(elapsed);
|
||||
return (
|
||||
<time>
|
||||
{!elapsed ? (
|
||||
undefined
|
||||
) : elapsed > 3600 ? (
|
||||
date.toISOString().substr(11, 8)
|
||||
) : (
|
||||
date.toISOString().substr(14, 5)
|
||||
)}
|
||||
{!elapsed
|
||||
? undefined
|
||||
: elapsed > 3600
|
||||
? date.toISOString().substr(11, 8)
|
||||
: date.toISOString().substr(14, 5)}
|
||||
</time>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { fetchBuild, approveBuild, declineBuild } from "shared/utils/build";
|
|||
import {
|
||||
STATUS_BLOCKED,
|
||||
STATUS_DECLINED,
|
||||
STATUS_ERROR,
|
||||
STATUS_ERROR
|
||||
} from "shared/constants/status";
|
||||
|
||||
import { findChildProcess } from "shared/utils/proc";
|
||||
|
@ -29,7 +29,7 @@ const binding = (props, context) => {
|
|||
|
||||
return {
|
||||
repo: ["repos", "data", slug],
|
||||
build: ["builds", "data", slug, number],
|
||||
build: ["builds", "data", slug, number]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -54,7 +54,7 @@ export default class BuildLogs extends Component {
|
|||
drone,
|
||||
repo.owner,
|
||||
repo.name,
|
||||
build.number,
|
||||
build.number
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ export default class BuildLogs extends Component {
|
|||
drone,
|
||||
repo.owner,
|
||||
repo.name,
|
||||
build.number,
|
||||
build.number
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ export default class BuildLogs extends Component {
|
|||
fetchRepository,
|
||||
props.drone,
|
||||
props.match.params.owner,
|
||||
props.match.params.repo,
|
||||
props.match.params.repo
|
||||
);
|
||||
}
|
||||
if (!props.build || !props.build.procs) {
|
||||
|
@ -90,7 +90,7 @@ export default class BuildLogs extends Component {
|
|||
props.drone,
|
||||
props.match.params.owner,
|
||||
props.match.params.repo,
|
||||
props.match.params.build,
|
||||
props.match.params.build
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -160,11 +160,9 @@ export default class BuildLogs extends Component {
|
|||
</div>
|
||||
<div className={styles.left}>
|
||||
<div className={styles.logerror}>
|
||||
{build.status === STATUS_ERROR ? (
|
||||
build.error
|
||||
) : (
|
||||
"Pipeline execution was declined"
|
||||
)}
|
||||
{build.status === STATUS_ERROR
|
||||
? build.error
|
||||
: "Pipeline execution was declined"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -249,7 +247,7 @@ export class BuildLogsTitle extends Component {
|
|||
key={`${owner}-${repo}-${build}`}
|
||||
>
|
||||
{build}
|
||||
</Link>,
|
||||
</Link>
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -24,7 +24,7 @@ const binding = (props, context) => {
|
|||
eof: ["logs", "data", slug, number, pid, "eof"],
|
||||
loading: ["logs", "data", slug, number, pid, "loading"],
|
||||
error: ["logs", "data", slug, number, pid, "error"],
|
||||
follow: ["logs", "follow"],
|
||||
follow: ["logs", "follow"]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -57,7 +57,7 @@ export default class Output extends Component {
|
|||
nextProps.match.params.owner,
|
||||
nextProps.match.params.repo,
|
||||
nextProps.build.number,
|
||||
nextProps.proc.pid,
|
||||
nextProps.proc.pid
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ export default class Output extends Component {
|
|||
nextProps.match.params.owner,
|
||||
nextProps.match.params.repo,
|
||||
nextProps.build.number,
|
||||
nextProps.proc,
|
||||
nextProps.proc
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const binding = (props, context) => {
|
|||
const number = parseInt(build);
|
||||
return {
|
||||
repo: ["repos", "data", slug],
|
||||
build: ["builds", "data", slug, number],
|
||||
build: ["builds", "data", slug, number]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ export default class BuildMenu extends Component {
|
|||
repo.owner,
|
||||
repo.name,
|
||||
build.number,
|
||||
proc.ppid,
|
||||
proc.ppid
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default class Header extends Component {
|
|||
elements={[
|
||||
<Link to={`/${owner}/${repo}`} key={`${owner}-${repo}`}>
|
||||
{owner} / {repo}
|
||||
</Link>,
|
||||
</Link>
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,7 @@ const binding = (props, context) => {
|
|||
repo: ["repos", "data", slug],
|
||||
builds: ["builds", "data", slug],
|
||||
loaded: ["builds", "loaded"],
|
||||
error: ["builds", "error"],
|
||||
error: ["builds", "error"]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -75,7 +75,7 @@ export default class Main extends Component {
|
|||
drone,
|
||||
match.params.owner,
|
||||
match.params.repo,
|
||||
page,
|
||||
page
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ export default class RepoMenu extends Component {
|
|||
{ to: `/${owner}/${repo}`, label: "Builds" },
|
||||
{ to: `/${owner}/${repo}/settings/secrets`, label: "Secrets" },
|
||||
{ to: `/${owner}/${repo}/settings/registry`, label: "Registry" },
|
||||
{ to: `/${owner}/${repo}/settings`, label: "Settings" },
|
||||
{ to: `/${owner}/${repo}/settings`, label: "Settings" }
|
||||
];
|
||||
return <Menu items={menu} {...this.props} />;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export class Form extends Component {
|
|||
this.state = {
|
||||
address: "",
|
||||
username: "",
|
||||
password: "",
|
||||
password: ""
|
||||
};
|
||||
|
||||
this._handleAddressChange = this._handleAddressChange.bind(this);
|
||||
|
@ -37,7 +37,7 @@ export class Form extends Component {
|
|||
const detail = {
|
||||
address: this.state.address,
|
||||
username: this.state.username,
|
||||
password: this.state.password,
|
||||
password: this.state.password
|
||||
};
|
||||
|
||||
onsubmit({ detail });
|
||||
|
|
|
@ -4,7 +4,7 @@ import { repositorySlug } from "shared/utils/repository";
|
|||
import {
|
||||
fetchRegistryList,
|
||||
createRegistry,
|
||||
deleteRegistry,
|
||||
deleteRegistry
|
||||
} from "shared/utils/registry";
|
||||
|
||||
import { branch } from "baobab-react/higher-order";
|
||||
|
@ -19,7 +19,7 @@ const binding = (props, context) => {
|
|||
const slug = repositorySlug(owner, repo);
|
||||
return {
|
||||
loaded: ["registry", "loaded"],
|
||||
registries: ["registry", "data", slug],
|
||||
registries: ["registry", "data", slug]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ export default class RepoRegistry extends Component {
|
|||
const registry = {
|
||||
address: e.detail.address,
|
||||
username: e.detail.username,
|
||||
password: e.detail.password,
|
||||
password: e.detail.password
|
||||
};
|
||||
|
||||
dispatch(createRegistry, drone, owner, repo, registry);
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
EVENT_PUSH,
|
||||
EVENT_TAG,
|
||||
EVENT_PULL_REQUEST,
|
||||
EVENT_DEPLOY,
|
||||
EVENT_DEPLOY
|
||||
} from "shared/constants/events";
|
||||
|
||||
import styles from "./form.less";
|
||||
|
@ -16,7 +16,7 @@ export class Form extends Component {
|
|||
this.state = {
|
||||
name: "",
|
||||
value: "",
|
||||
event: [EVENT_PUSH, EVENT_TAG, EVENT_DEPLOY],
|
||||
event: [EVENT_PUSH, EVENT_TAG, EVENT_DEPLOY]
|
||||
};
|
||||
|
||||
this._handleNameChange = this._handleNameChange.bind(this);
|
||||
|
@ -55,7 +55,7 @@ export class Form extends Component {
|
|||
const detail = {
|
||||
name: this.state.name,
|
||||
value: this.state.value,
|
||||
event: this.state.event,
|
||||
event: this.state.event
|
||||
};
|
||||
|
||||
onsubmit({ detail });
|
||||
|
|
|
@ -4,7 +4,7 @@ import { repositorySlug } from "shared/utils/repository";
|
|||
import {
|
||||
fetchSecretList,
|
||||
createSecret,
|
||||
deleteSecret,
|
||||
deleteSecret
|
||||
} from "shared/utils/secrets";
|
||||
|
||||
import { branch } from "baobab-react/higher-order";
|
||||
|
@ -19,7 +19,7 @@ const binding = (props, context) => {
|
|||
const slug = repositorySlug(owner, repo);
|
||||
return {
|
||||
loaded: ["secrets", "loaded"],
|
||||
secrets: ["secrets", "data", slug],
|
||||
secrets: ["secrets", "data", slug]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,7 @@ export default class RepoSecrets extends Component {
|
|||
const secret = {
|
||||
name: e.detail.name,
|
||||
value: e.detail.value,
|
||||
event: e.detail.event,
|
||||
event: e.detail.event
|
||||
};
|
||||
|
||||
dispatch(createSecret, drone, owner, repo, secret);
|
||||
|
|
|
@ -6,13 +6,13 @@ import { inject } from "config/client/inject";
|
|||
import {
|
||||
fetchRepository,
|
||||
updateRepository,
|
||||
repositorySlug,
|
||||
repositorySlug
|
||||
} from "shared/utils/repository";
|
||||
|
||||
import {
|
||||
VISIBILITY_PUBLIC,
|
||||
VISIBILITY_PRIVATE,
|
||||
VISIBILITY_INTERNAL,
|
||||
VISIBILITY_INTERNAL
|
||||
} from "shared/constants/visibility";
|
||||
|
||||
import styles from "./index.less";
|
||||
|
@ -22,7 +22,7 @@ const binding = (props, context) => {
|
|||
const slug = repositorySlug(owner, repo);
|
||||
return {
|
||||
user: ["user", "data"],
|
||||
repo: ["repos", "data", slug],
|
||||
repo: ["repos", "data", slug]
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { inject } from "config/client/inject";
|
|||
import {
|
||||
fetchRepostoryList,
|
||||
disableRepository,
|
||||
enableRepository,
|
||||
enableRepository
|
||||
} from "shared/utils/repository";
|
||||
|
||||
import { List, Item } from "./components";
|
||||
|
@ -18,7 +18,7 @@ const binding = (props, context) => {
|
|||
return {
|
||||
repos: ["repos", "data"],
|
||||
loaded: ["repos", "loaded"],
|
||||
error: ["repos", "error"],
|
||||
error: ["repos", "error"]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ export default class UserRepos extends Component {
|
|||
|
||||
handleFilter(e) {
|
||||
this.setState({
|
||||
search: e.target.value,
|
||||
search: e.target.value
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import Menu from "shared/components/menu";
|
|||
|
||||
const binding = (props, context) => {
|
||||
return {
|
||||
repos: ["repos"],
|
||||
repos: ["repos"]
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import styles from "./index.less";
|
|||
const binding = (props, context) => {
|
||||
return {
|
||||
location: ["location"],
|
||||
token: ["token"],
|
||||
token: ["token"]
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,9 @@ export default class Tokens extends Component {
|
|||
}
|
||||
|
||||
const usageWithCURL = (location, token) => {
|
||||
return `curl -i ${location.protocol}//${location.host}/api/user -H "Authorization: Bearer ${token}"`;
|
||||
return `curl -i ${location.protocol}//${
|
||||
location.host
|
||||
}/api/user -H "Authorization: Bearer ${token}"`;
|
||||
};
|
||||
|
||||
const usageWithCLI = (location, token) => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import Status from "../status";
|
|||
import {
|
||||
STATUS_FAILURE,
|
||||
STATUS_RUNNING,
|
||||
STATUS_SUCCESS,
|
||||
STATUS_SUCCESS
|
||||
} from "shared/constants/status";
|
||||
|
||||
jest.dontMock("../status");
|
||||
|
@ -16,10 +16,10 @@ describe("Status component", () => {
|
|||
const instance = status.instance();
|
||||
|
||||
expect(
|
||||
instance.shouldComponentUpdate({ status: STATUS_FAILURE }),
|
||||
instance.shouldComponentUpdate({ status: STATUS_FAILURE })
|
||||
).toBeFalsy();
|
||||
expect(
|
||||
instance.shouldComponentUpdate({ status: STATUS_SUCCESS }),
|
||||
instance.shouldComponentUpdate({ status: STATUS_SUCCESS })
|
||||
).toBeTruthy();
|
||||
expect(status.hasClass("failure")).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ export default class Avatar extends Component {
|
|||
render() {
|
||||
const image = this.props.image;
|
||||
const style = {
|
||||
backgroundImage: `url(${image})`,
|
||||
backgroundImage: `url(${image})`
|
||||
};
|
||||
return <div className={styles.avatar} style={style} />;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ import {
|
|||
DeployIcon,
|
||||
LaunchIcon,
|
||||
MergeIcon,
|
||||
TagIcon,
|
||||
TagIcon
|
||||
} from "shared/components/icons/index";
|
||||
import {
|
||||
EVENT_TAG,
|
||||
EVENT_PULL_REQUEST,
|
||||
EVENT_DEPLOY,
|
||||
EVENT_DEPLOY
|
||||
} from "shared/constants/events";
|
||||
|
||||
import styles from "./build_event.less";
|
||||
|
@ -40,15 +40,13 @@ export default class BuildEvent extends Component {
|
|||
)}
|
||||
</div>
|
||||
<div>
|
||||
{event === EVENT_TAG && refs ? (
|
||||
trimTagRef(refs)
|
||||
) : event === EVENT_PULL_REQUEST && refspec ? (
|
||||
trimMergeRef(refs)
|
||||
) : event === EVENT_DEPLOY && target ? (
|
||||
target
|
||||
) : (
|
||||
branch
|
||||
)}
|
||||
{event === EVENT_TAG && refs
|
||||
? trimTagRef(refs)
|
||||
: event === EVENT_PULL_REQUEST && refspec
|
||||
? trimMergeRef(refs)
|
||||
: event === EVENT_DEPLOY && target
|
||||
? target
|
||||
: branch}
|
||||
</div>
|
||||
</div>
|
||||
<a href={link} target="_blank">
|
||||
|
|
|
@ -41,5 +41,5 @@ export {
|
|||
StarIcon,
|
||||
SyncIcon,
|
||||
TagIcon,
|
||||
TimelapseIcon,
|
||||
TimelapseIcon
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
STATUS_RUNNING,
|
||||
STATUS_SKIPPED,
|
||||
STATUS_STARTED,
|
||||
STATUS_SUCCESS,
|
||||
STATUS_SUCCESS
|
||||
} from "shared/constants/status";
|
||||
import style from "./status.less";
|
||||
|
||||
|
@ -19,7 +19,7 @@ import {
|
|||
CloseIcon,
|
||||
ClockIcon,
|
||||
RefreshIcon,
|
||||
RemoveIcon,
|
||||
RemoveIcon
|
||||
} from "./icons/index";
|
||||
|
||||
const defaultIconSize = 15;
|
||||
|
|
|
@ -19,5 +19,5 @@ export {
|
|||
STATUS_RUNNING,
|
||||
STATUS_SKIPPED,
|
||||
STATUS_SUCCESS,
|
||||
STATUS_STARTED,
|
||||
STATUS_STARTED
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ export function fetchLogs(tree, client, owner, repo, build, proc) {
|
|||
const slug = repositorySlug(owner, repo);
|
||||
const init = {
|
||||
data: [],
|
||||
loading: true,
|
||||
loading: true
|
||||
};
|
||||
|
||||
tree.set(["logs", "data", slug, build, proc], init);
|
||||
|
|
253
web/vendor/drone-js/index.js
vendored
253
web/vendor/drone-js/index.js
vendored
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
var _createClass = function () {
|
||||
var _createClass = (function() {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
|
@ -39,9 +39,9 @@
|
|||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
})();
|
||||
|
||||
var DroneClient = function () {
|
||||
var DroneClient = (function() {
|
||||
function DroneClient(server, token, csrf) {
|
||||
_classCallCheck(this, DroneClient);
|
||||
|
||||
|
@ -50,160 +50,260 @@
|
|||
this.csrf = csrf;
|
||||
}
|
||||
|
||||
_createClass(DroneClient, [{
|
||||
_createClass(
|
||||
DroneClient,
|
||||
[
|
||||
{
|
||||
key: "getRepoList",
|
||||
value: function getRepoList(opts) {
|
||||
var query = encodeQueryString(opts);
|
||||
return this._get("/api/user/repos?" + query);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getRepo",
|
||||
value: function getRepo(owner, repo) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "activateRepo",
|
||||
value: function activateRepo(owner, repo) {
|
||||
return this._post("/api/repos/" + owner + "/" + repo);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "updateRepo",
|
||||
value: function updateRepo(owner, repo, data) {
|
||||
return this._patch("/api/repos/" + owner + "/" + repo, data);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "deleteRepo",
|
||||
value: function deleteRepo(owner, repo) {
|
||||
return this._delete("/api/repos/" + owner + "/" + repo);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getBuildList",
|
||||
value: function getBuildList(owner, repo, opts) {
|
||||
var query = encodeQueryString(opts);
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/builds?" + query);
|
||||
return this._get(
|
||||
"/api/repos/" + owner + "/" + repo + "/builds?" + query
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getBuild",
|
||||
value: function getBuild(owner, repo, number) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/builds/" + number);
|
||||
return this._get(
|
||||
"/api/repos/" + owner + "/" + repo + "/builds/" + number
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getBuildFeed",
|
||||
value: function getBuildFeed(opts) {
|
||||
var query = encodeQueryString(opts);
|
||||
return this._get("/api/user/feed?" + query);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "cancelBuild",
|
||||
value: function cancelBuild(owner, repo, number, ppid) {
|
||||
return this._delete("/api/repos/" + owner + "/" + repo + "/builds/" + number + "/" + ppid);
|
||||
return this._delete(
|
||||
"/api/repos/" +
|
||||
owner +
|
||||
"/" +
|
||||
repo +
|
||||
"/builds/" +
|
||||
number +
|
||||
"/" +
|
||||
ppid
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "approveBuild",
|
||||
value: function approveBuild(owner, repo, build) {
|
||||
return this._post("/api/repos/" + owner + "/" + repo + "/builds/" + build + "/approve");
|
||||
return this._post(
|
||||
"/api/repos/" +
|
||||
owner +
|
||||
"/" +
|
||||
repo +
|
||||
"/builds/" +
|
||||
build +
|
||||
"/approve"
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "declineBuild",
|
||||
value: function declineBuild(owner, repo, build) {
|
||||
return this._post("/api/repos/" + owner + "/" + repo + "/builds/" + build + "/decline");
|
||||
return this._post(
|
||||
"/api/repos/" +
|
||||
owner +
|
||||
"/" +
|
||||
repo +
|
||||
"/builds/" +
|
||||
build +
|
||||
"/decline"
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "restartBuild",
|
||||
value: function restartBuild(owner, repo, build, opts) {
|
||||
var query = encodeQueryString(opts);
|
||||
return this._post("/api/repos/" + owner + "/" + repo + "/builds/" + build + "?" + query);
|
||||
return this._post(
|
||||
"/api/repos/" +
|
||||
owner +
|
||||
"/" +
|
||||
repo +
|
||||
"/builds/" +
|
||||
build +
|
||||
"?" +
|
||||
query
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getLogs",
|
||||
value: function getLogs(owner, repo, build, proc) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/logs/" + build + "/" + proc);
|
||||
return this._get(
|
||||
"/api/repos/" + owner + "/" + repo + "/logs/" + build + "/" + proc
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getArtifact",
|
||||
value: function getArtifact(owner, repo, build, proc, file) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/files/" + build + "/" + proc + "/" + file + "?raw=true");
|
||||
return this._get(
|
||||
"/api/repos/" +
|
||||
owner +
|
||||
"/" +
|
||||
repo +
|
||||
"/files/" +
|
||||
build +
|
||||
"/" +
|
||||
proc +
|
||||
"/" +
|
||||
file +
|
||||
"?raw=true"
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getArtifactList",
|
||||
value: function getArtifactList(owner, repo, build) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/files/" + build);
|
||||
return this._get(
|
||||
"/api/repos/" + owner + "/" + repo + "/files/" + build
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getSecretList",
|
||||
value: function getSecretList(owner, repo) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/secrets");
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "createSecret",
|
||||
value: function createSecret(owner, repo, secret) {
|
||||
return this._post("/api/repos/" + owner + "/" + repo + "/secrets", secret);
|
||||
return this._post(
|
||||
"/api/repos/" + owner + "/" + repo + "/secrets",
|
||||
secret
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "deleteSecret",
|
||||
value: function deleteSecret(owner, repo, secret) {
|
||||
return this._delete("/api/repos/" + owner + "/" + repo + "/secrets/" + secret);
|
||||
return this._delete(
|
||||
"/api/repos/" + owner + "/" + repo + "/secrets/" + secret
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getRegistryList",
|
||||
value: function getRegistryList(owner, repo) {
|
||||
return this._get("/api/repos/" + owner + "/" + repo + "/registry");
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "createRegistry",
|
||||
value: function createRegistry(owner, repo, registry) {
|
||||
return this._post("/api/repos/" + owner + "/" + repo + "/registry", registry);
|
||||
return this._post(
|
||||
"/api/repos/" + owner + "/" + repo + "/registry",
|
||||
registry
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "deleteRegistry",
|
||||
value: function deleteRegistry(owner, repo, address) {
|
||||
return this._delete("/api/repos/" + owner + "/" + repo + "/registry/" + address);
|
||||
return this._delete(
|
||||
"/api/repos/" + owner + "/" + repo + "/registry/" + address
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getSelf",
|
||||
value: function getSelf() {
|
||||
return this._get("/api/user");
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "getToken",
|
||||
value: function getToken() {
|
||||
return this._post("/api/user/token");
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "on",
|
||||
value: function on(callback) {
|
||||
return this._subscribe("/stream/events", callback, {
|
||||
reconnect: true
|
||||
});
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "stream",
|
||||
value: function stream(owner, repo, build, proc, callback) {
|
||||
return this._subscribe("/stream/logs/" + owner + "/" + repo + "/" + build + "/" + proc, callback, {
|
||||
return this._subscribe(
|
||||
"/stream/logs/" + owner + "/" + repo + "/" + build + "/" + proc,
|
||||
callback,
|
||||
{
|
||||
reconnect: false
|
||||
});
|
||||
}
|
||||
}, {
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "_get",
|
||||
value: function _get(path) {
|
||||
return this._request("GET", path, null);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "_post",
|
||||
value: function _post(path, data) {
|
||||
return this._request("POST", path, data);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "_patch",
|
||||
value: function _patch(path, data) {
|
||||
return this._request("PATCH", path, data);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "_delete",
|
||||
value: function _delete(path) {
|
||||
return this._request("DELETE", path, null);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "_subscribe",
|
||||
value: function _subscribe(path, callback, opts) {
|
||||
var query = encodeQueryString({
|
||||
|
@ -226,7 +326,8 @@
|
|||
}
|
||||
return events;
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "_request",
|
||||
value: function _request(method, path, data) {
|
||||
var endpoint = [this.server, path].join("");
|
||||
|
@ -238,7 +339,8 @@
|
|||
if (method !== "GET" && this.csrf) {
|
||||
xhr.setRequestHeader("X-CSRF-TOKEN", this.csrf);
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(
|
||||
function(resolve, reject) {
|
||||
xhr.onload = function() {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status >= 300) {
|
||||
|
@ -253,7 +355,10 @@
|
|||
return;
|
||||
}
|
||||
var contentType = xhr.getResponseHeader("Content-Type");
|
||||
if (contentType && contentType.startsWith("application/json")) {
|
||||
if (
|
||||
contentType &&
|
||||
contentType.startsWith("application/json")
|
||||
) {
|
||||
resolve(JSON.parse(xhr.response));
|
||||
} else {
|
||||
resolve(xhr.response);
|
||||
|
@ -269,38 +374,58 @@
|
|||
} else {
|
||||
xhr.send();
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
}], [{
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
key: "fromEnviron",
|
||||
value: function fromEnviron() {
|
||||
return new DroneClient(process && process.env && process.env.DRONE_SERVER, process && process.env && process.env.DRONE_TOKEN, process && process.env && process.env.DRONE_CSRF);
|
||||
return new DroneClient(
|
||||
process && process.env && process.env.DRONE_SERVER,
|
||||
process && process.env && process.env.DRONE_TOKEN,
|
||||
process && process.env && process.env.DRONE_CSRF
|
||||
);
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
key: "fromWindow",
|
||||
value: function fromWindow() {
|
||||
return new DroneClient(window && window.DRONE_SERVER, window && window.DRONE_TOKEN, window && window.DRONE_CSRF);
|
||||
return new DroneClient(
|
||||
window && window.DRONE_SERVER,
|
||||
window && window.DRONE_TOKEN,
|
||||
window && window.DRONE_CSRF
|
||||
);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
return DroneClient;
|
||||
}();
|
||||
})();
|
||||
|
||||
exports.default = DroneClient;
|
||||
|
||||
|
||||
/**
|
||||
* Encodes the values into url encoded form sorted by key.
|
||||
*
|
||||
* @param {object} query parameters in key value object.
|
||||
* @return {string} query parameter string
|
||||
*/
|
||||
var encodeQueryString = exports.encodeQueryString = function encodeQueryString() {
|
||||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var encodeQueryString = (exports.encodeQueryString = function encodeQueryString() {
|
||||
var params =
|
||||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
return params ? Object.keys(params).sort().map(function (key) {
|
||||
return params
|
||||
? Object.keys(params)
|
||||
.sort()
|
||||
.map(function(key) {
|
||||
var val = params[key];
|
||||
return encodeURIComponent(key) + "=" + encodeURIComponent(val);
|
||||
}).join("&") : "";
|
||||
};
|
||||
})
|
||||
.join("&")
|
||||
: "";
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue