Merge with 2.0.0-m3

This commit is contained in:
Florian Scholdei
2019-10-10 10:59:04 +02:00
94 changed files with 2176 additions and 481 deletions

View File

@@ -46,7 +46,7 @@ export function createUrl(url: string) {
class ApiClient {
get(url: string): Promise<Response> {
return fetch(createUrl(url), applyFetchOptions).then(handleFailure);
return fetch(createUrl(url), applyFetchOptions({})).then(handleFailure);
}
post(url: string, payload: any, contentType: string = "application/json") {

View File

@@ -14,7 +14,7 @@ class ButtonGroup extends React.Component<Props> {
const childWrapper = [];
React.Children.forEach(children, child => {
if (child) {
childWrapper.push(<p className="control" key={childWrapper.length}>{child}</p>);
childWrapper.push(<div className="control" key={childWrapper.length}>{child}</div>);
}
});

View File

@@ -7,20 +7,22 @@ import TagGroup from "./TagGroup";
type Props = {
members: string[],
memberListChanged: (string[]) => void,
label?: string,
helpText?: string,
t: string => string
};
class MemberNameTagGroup extends React.Component<Props> {
render() {
const { members, t } = this.props;
const { members, label, helpText, t } = this.props;
const membersExtended = members.map(id => {
return { id, displayName: id, mail: "" };
});
return (
<TagGroup
items={membersExtended}
label={t("group.members")}
helpText={t("groupForm.help.memberHelpText")}
label={label ? label : t("group.members")}
helpText={helpText ? helpText : t("groupForm.help.memberHelpText")}
onRemove={this.removeEntry}
/>
);

View File

@@ -0,0 +1,21 @@
//@flow
import * as React from "react";
import classNames from "classnames";
type Props = {
className?: string,
left?: React.Node,
right?: React.Node
};
export default class Level extends React.Component<Props> {
render() {
const { className, left, right } = this.props;
return (
<div className={classNames("level", className)}>
<div className="level-left">{left}</div>
<div className="level-right">{right}</div>
</div>
);
}
}

View File

@@ -2,6 +2,7 @@
export { default as Footer } from "./Footer.js";
export { default as Header } from "./Header.js";
export { default as Level } from "./Level.js";
export { default as Page } from "./Page.js";
export { default as PageActions } from "./PageActions.js";
export { default as Subtitle } from "./Subtitle.js";

View File

@@ -4,7 +4,8 @@ import DiffFile from "./DiffFile";
import type {DiffObjectProps, File} from "./DiffTypes";
type Props = DiffObjectProps & {
diff: File[]
diff: File[],
defaultCollapse?: boolean
};
class Diff extends React.Component<Props> {
@@ -17,7 +18,7 @@ class Diff extends React.Component<Props> {
return (
<>
{diff.map((file, index) => (
<DiffFile key={index} file={file} {...fileProps} />
<DiffFile key={index} file={file} {...fileProps} {...this.props} />
))}
</>
);

View File

@@ -9,7 +9,8 @@ import Diff from "./Diff";
import type {DiffObjectProps, File} from "./DiffTypes";
type Props = DiffObjectProps & {
url: string
url: string,
defaultCollapse?: boolean
};
type State = {

View File

@@ -7,6 +7,7 @@ import {translate} from "react-i18next";
type Props = {
changeset: Changeset,
defaultCollapse?: boolean,
// context props
t: string => string
@@ -23,12 +24,12 @@ class ChangesetDiff extends React.Component<Props> {
}
render() {
const { changeset, t } = this.props;
const { changeset, defaultCollapse, t } = this.props;
if (!this.isDiffSupported(changeset)) {
return <Notification type="danger">{t("changeset.diffNotSupported")}</Notification>;
} else {
const url = this.createUrl(changeset);
return <LoadingDiff url={url} />;
return <LoadingDiff url={url} defaultCollapse={defaultCollapse} />;
}
}