This commit is contained in:
Mohamed Karray
2019-02-05 08:49:01 +01:00
198 changed files with 6827 additions and 2080 deletions

View File

@@ -1,7 +1,7 @@
// @flow
import React from "react";
import type {Branch} from "@scm-manager/ui-types";
import type { Branch } from "@scm-manager/ui-types";
import injectSheet from "react-jss";
import classNames from "classnames";
import DropDown from "./forms/DropDown";
@@ -39,7 +39,9 @@ class BranchSelector extends React.Component<Props, State> {
}
componentDidMount() {
const selectedBranch = this.props.branches.find(branch => branch.name === this.props.selectedBranch);
const selectedBranch = this.props.branches.find(
branch => branch.name === this.props.selectedBranch
);
this.setState({ selectedBranch });
}

View File

@@ -0,0 +1,44 @@
// @flow
import React from "react";
import Button from "./Button";
type Props = {
firstlabel: string,
secondlabel: string,
firstAction?: (event: Event) => void,
secondAction?: (event: Event) => void,
firstIsSelected: boolean
};
class ButtonGroup extends React.Component<Props> {
render() {
const { firstlabel, secondlabel, firstAction, secondAction, firstIsSelected } = this.props;
let showFirstColor = "";
let showSecondColor = "";
if (firstIsSelected) {
showFirstColor += "link is-selected";
} else {
showSecondColor += "link is-selected";
}
return (
<div className="buttons has-addons">
<Button
label={firstlabel}
color={showFirstColor}
action={firstAction}
/>
<Button
label={secondlabel}
color={showSecondColor}
action={secondAction}
/>
</div>
);
}
}
export default ButtonGroup;

View File

@@ -1,27 +1,28 @@
//@flow
import React from "react";
import injectSheet from "react-jss";
import SubmitButton, { type ButtonProps } from "./SubmitButton";
import classNames from "classnames";
const styles = {
spacing: {
marginTop: "2em",
border: "2px solid #e9f7fd",
padding: "1em 1em"
}
};
class CreateButton extends React.Component<ButtonProps> {
render() {
const { classes } = this.props;
return (
<div className={classNames("has-text-centered", classes.spacing)}>
<SubmitButton {...this.props} />
</div>
);
}
}
export default injectSheet(styles)(CreateButton);
//@flow
import React from "react";
import injectSheet from "react-jss";
import { type ButtonProps } from "./Button";
import SubmitButton from "./SubmitButton";
import classNames from "classnames";
const styles = {
spacing: {
marginTop: "2em",
border: "2px solid #e9f7fd",
padding: "1em 1em"
}
};
class CreateButton extends React.Component<ButtonProps> {
render() {
const { classes } = this.props;
return (
<div className={classNames("has-text-centered", classes.spacing)}>
<SubmitButton {...this.props} />
</div>
);
}
}
export default injectSheet(styles)(CreateButton);

View File

@@ -5,6 +5,9 @@ export { default as Button } from "./Button.js";
export { default as CreateButton } from "./CreateButton.js";
export { default as DeleteButton } from "./DeleteButton.js";
export { default as EditButton } from "./EditButton.js";
export { default as RemoveEntryOfTableButton } from "./RemoveEntryOfTableButton.js";
export { default as SubmitButton } from "./SubmitButton.js";
export {default as DownloadButton} from "./DownloadButton.js";
export { default as DownloadButton } from "./DownloadButton.js";
export { default as ButtonGroup } from "./ButtonGroup.js";
export {
default as RemoveEntryOfTableButton
} from "./RemoveEntryOfTableButton.js";

View File

@@ -36,9 +36,9 @@ class ConfigurationBinder {
binder.bind("config.navigation", ConfigNavLink, configPredicate);
// route for global configuration, passes the link from the index resource to component
const ConfigRoute = ({ url, links }) => {
const ConfigRoute = ({ url, links, ...additionalProps }) => {
const link = links[linkName].href;
return this.route(url + to, <ConfigurationComponent link={link}/>);
return this.route(url + to, <ConfigurationComponent link={link} {...additionalProps} />);
};
// bind config route to extension point
@@ -63,9 +63,9 @@ class ConfigurationBinder {
// route for global configuration, passes the current repository to component
const RepoRoute = ({url, repository}) => {
const link = repository._links[linkName].href
return this.route(url + to, <RepositoryComponent repository={repository} link={link}/>);
const RepoRoute = ({url, repository, ...additionalProps}) => {
const link = repository._links[linkName].href;
return this.route(url + to, <RepositoryComponent repository={repository} link={link} {...additionalProps}/>);
};
// bind config route to extension point

View File

@@ -48,7 +48,7 @@ class AddEntryToTableField extends React.Component<Props, State> {
<AddButton
label={buttonLabel}
action={this.addButtonClicked}
disabled={disabled}
disabled={disabled || this.state.entryToAdd ===""}
/>
</div>
);

View File

@@ -54,7 +54,7 @@ class Select extends React.Component<Props> {
>
{options.map(opt => {
return (
<option value={opt.value} key={opt.value}>
<option value={opt.value} key={"KEY_" + opt.value}>
{opt.label}
</option>
);