diff --git a/scm-ui/ui-components/src/repos/Diff.stories.tsx b/scm-ui/ui-components/src/repos/Diff.stories.tsx
index 2e92c01474..be343c70ae 100644
--- a/scm-ui/ui-components/src/repos/Diff.stories.tsx
+++ b/scm-ui/ui-components/src/repos/Diff.stories.tsx
@@ -29,14 +29,14 @@ import parser from "gitdiff-parser";
import simpleDiff from "../__resources__/Diff.simple";
import hunksDiff from "../__resources__/Diff.hunks";
import binaryDiff from "../__resources__/Diff.binary";
-import {DiffEventContext, File, FileControlFactory} from "./DiffTypes";
+import { DiffEventContext, File, FileControlFactory } from "./DiffTypes";
import Toast from "../toast/Toast";
import { getPath } from "./diffs";
import DiffButton from "./DiffButton";
import styled from "styled-components";
import { MemoryRouter } from "react-router-dom";
-import {one, two} from "../__resources__/changesets";
-import {Changeset} from "@scm-manager/ui-types";
+import { one, two } from "../__resources__/changesets";
+import { Changeset } from "@scm-manager/ui-types";
import JumpToFileButton from "./JumpToFileButton";
const diffFiles = parser.parse(simpleDiff);
@@ -47,7 +47,7 @@ const Container = styled.div`
const RoutingDecorator = (story: () => ReactNode) => {story()};
-const fileControlFactory: (changeset: Changeset) => FileControlFactory = (changeset) => (file) => {
+const fileControlFactory: (changeset: Changeset) => FileControlFactory = changeset => file => {
const baseUrl = "/repo/hitchhiker/heartOfGold/code/changeset";
const sourceLink = {
url: `${baseUrl}/${changeset.id}/${file.newPath}/`,
@@ -76,10 +76,7 @@ const fileControlFactory: (changeset: Changeset) => FileControlFactory = (change
}
}
- return links.map(({url, label}) => );
+ return links.map(({ url, label }) => );
};
storiesOf("Diff", module)
@@ -164,8 +161,4 @@ storiesOf("Diff", module)
});
return ;
})
- .add("WithLinkToFile", () => (
-
- ));
+ .add("WithLinkToFile", () => );
diff --git a/scm-ui/ui-components/src/repos/Diff.tsx b/scm-ui/ui-components/src/repos/Diff.tsx
index 627b52027c..5a0571e95f 100644
--- a/scm-ui/ui-components/src/repos/Diff.tsx
+++ b/scm-ui/ui-components/src/repos/Diff.tsx
@@ -23,15 +23,15 @@
*/
import React from "react";
import DiffFile from "./DiffFile";
-import {DiffObjectProps, File, FileControlFactory} from "./DiffTypes";
+import { DiffObjectProps, File, FileControlFactory } from "./DiffTypes";
import Notification from "../Notification";
-import {WithTranslation, withTranslation} from "react-i18next";
+import { WithTranslation, withTranslation } from "react-i18next";
type Props = WithTranslation &
DiffObjectProps & {
- diff: File[];
- fileControlFactory?: FileControlFactory;
-};
+ diff: File[];
+ fileControlFactory?: FileControlFactory;
+ };
class Diff extends React.Component {
static defaultProps: Partial = {
@@ -39,7 +39,7 @@ class Diff extends React.Component {
};
render() {
- const {diff, t, ...fileProps} = this.props;
+ const { diff, t, ...fileProps } = this.props;
return (
<>
{diff.length === 0 ? (
diff --git a/scm-ui/ui-components/src/repos/DiffFile.tsx b/scm-ui/ui-components/src/repos/DiffFile.tsx
index 6a7d390146..637128fae9 100644
--- a/scm-ui/ui-components/src/repos/DiffFile.tsx
+++ b/scm-ui/ui-components/src/repos/DiffFile.tsx
@@ -22,21 +22,21 @@
* SOFTWARE.
*/
import React from "react";
-import {withTranslation, WithTranslation} from "react-i18next";
+import { withTranslation, WithTranslation } from "react-i18next";
import classNames from "classnames";
import styled from "styled-components";
// @ts-ignore
-import {Decoration, getChangeKey, Hunk} from "react-diff-view";
-import {ButtonGroup} from "../buttons";
+import { Decoration, getChangeKey, Hunk } from "react-diff-view";
+import { ButtonGroup } from "../buttons";
import Tag from "../Tag";
import Icon from "../Icon";
-import {Change, ChangeEvent, DiffObjectProps, File, Hunk as HunkType} from "./DiffTypes";
+import { Change, ChangeEvent, DiffObjectProps, File, Hunk as HunkType } from "./DiffTypes";
import TokenizedDiffView from "./TokenizedDiffView";
import DiffButton from "./DiffButton";
-import {MenuContext} from "@scm-manager/ui-components";
-import DiffExpander, {ExpandableHunk} from "./DiffExpander";
+import { MenuContext } from "@scm-manager/ui-components";
+import DiffExpander, { ExpandableHunk } from "./DiffExpander";
import HunkExpandLink from "./HunkExpandLink";
-import {Modal} from "../modals";
+import { Modal } from "../modals";
import ErrorNotification from "../ErrorNotification";
import HunkExpandDivider from "./HunkExpandDivider";
@@ -44,8 +44,8 @@ const EMPTY_ANNOTATION_FACTORY = {};
type Props = DiffObjectProps &
WithTranslation & {
- file: File;
-};
+ file: File;
+ };
type Collapsible = {
collapsed?: boolean;
@@ -115,7 +115,7 @@ class DiffFile extends React.Component {
}
defaultCollapse: () => boolean = () => {
- const {defaultCollapse, file} = this.props;
+ const { defaultCollapse, file } = this.props;
if (typeof defaultCollapse === "boolean") {
return defaultCollapse;
} else if (typeof defaultCollapse === "function") {
@@ -126,7 +126,7 @@ class DiffFile extends React.Component {
};
toggleCollapse = () => {
- const {file} = this.state;
+ const { file } = this.state;
if (this.hasContent(file)) {
this.setState(state => ({
collapsed: !state.collapsed
@@ -157,7 +157,7 @@ class DiffFile extends React.Component {
);
@@ -167,19 +167,19 @@ class DiffFile extends React.Component {
{" "}
);
}
}
// hunk header must be defined
- return ;
+ return ;
};
createHunkFooter = (expandableHunk: ExpandableHunk) => {
@@ -190,7 +190,7 @@ class DiffFile extends React.Component {
);
@@ -200,19 +200,19 @@ class DiffFile extends React.Component {
{" "}
);
}
}
// hunk footer must be defined
- return ;
+ return ;
};
createLastHunkFooter = (expandableHunk: ExpandableHunk) => {
@@ -222,7 +222,7 @@ class DiffFile extends React.Component {
{" "}
{
);
}
// hunk header must be defined
- return ;
+ return ;
};
expandHead = (expandableHunk: ExpandableHunk, count: number) => {
@@ -255,16 +255,16 @@ class DiffFile extends React.Component {
};
diffExpanded = (newFile: File) => {
- this.setState({file: newFile, diffExpander: new DiffExpander(newFile)});
+ this.setState({ file: newFile, diffExpander: new DiffExpander(newFile) });
};
diffExpansionFailed = (err: any) => {
- this.setState({expansionError: err});
+ this.setState({ expansionError: err });
};
collectHunkAnnotations = (hunk: HunkType) => {
- const {annotationFactory} = this.props;
- const {file} = this.state;
+ const { annotationFactory } = this.props;
+ const { file } = this.state;
if (annotationFactory) {
return annotationFactory({
hunk,
@@ -276,8 +276,8 @@ class DiffFile extends React.Component {
};
handleClickEvent = (change: Change, hunk: HunkType) => {
- const {onClick} = this.props;
- const {file} = this.state;
+ const { onClick } = this.props;
+ const { file } = this.state;
const context = {
changeId: getChangeKey(change),
change,
@@ -290,7 +290,7 @@ class DiffFile extends React.Component {
};
createGutterEvents = (hunk: HunkType) => {
- const {onClick} = this.props;
+ const { onClick } = this.props;
if (onClick) {
return {
onClick: (event: ChangeEvent) => {
@@ -311,7 +311,7 @@ class DiffFile extends React.Component {
} else if (i > 0) {
items.push(
-
+
);
}
@@ -354,7 +354,7 @@ class DiffFile extends React.Component {
if (file.oldPath !== file.newPath && (file.type === "copy" || file.type === "rename")) {
return (
<>
- {file.oldPath} {file.newPath}
+ {file.oldPath} {file.newPath}
>
);
} else if (file.type === "delete") {
@@ -373,7 +373,7 @@ class DiffFile extends React.Component {
};
renderChangeTag = (file: File) => {
- const {t} = this.props;
+ const { t } = this.props;
if (!file.type) {
return;
}
@@ -385,14 +385,14 @@ class DiffFile extends React.Component {
const color =
value === "added" ? "success is-outlined" : value === "deleted" ? "danger is-outlined" : "info is-outlined";
- return ;
+ return ;
};
hasContent = (file: File) => file && !file.isBinary && file.hunks && file.hunks.length > 0;
render() {
- const {fileControlFactory, fileAnnotationFactory, t} = this.props;
- const {file, collapsed, sideBySide, diffExpander, expansionError} = this.state;
+ const { fileControlFactory, fileAnnotationFactory, t } = this.props;
+ const { file, collapsed, sideBySide, diffExpander, expansionError } = this.state;
const viewType = sideBySide ? "split" : "unified";
let body = null;
@@ -413,39 +413,41 @@ class DiffFile extends React.Component {
);
}
- const collapseIcon = this.hasContent(file) ? : null;
+ const collapseIcon = this.hasContent(file) ? : null;
const fileControls = fileControlFactory ? fileControlFactory(file, this.setCollapse) : null;
- const sideBySideToggle = file.hunks && file.hunks.length &&
- {({setCollapsed}) => (
-
- this.toggleSideBySide(() => {
- if (this.state.sideBySide) {
- setCollapsed(true);
- }
- })
- }
- />
- )}
- ;
+ const sideBySideToggle = file.hunks && file.hunks.length && (
+
+ {({ setCollapsed }) => (
+
+ this.toggleSideBySide(() => {
+ if (this.state.sideBySide) {
+ setCollapsed(true);
+ }
+ })
+ }
+ />
+ )}
+
+ );
const headerButtons = (
-
-
- {sideBySideToggle}
- {fileControls}
-
-
- );
+
+
+ {sideBySideToggle}
+ {fileControls}
+
+
+ );
let errorModal;
if (expansionError) {
errorModal = (
this.setState({expansionError: undefined})}
- body={}
+ closeFunction={() => this.setState({ expansionError: undefined })}
+ body={}
active={true}
/>
);
diff --git a/scm-ui/ui-components/src/repos/LoadingDiff.tsx b/scm-ui/ui-components/src/repos/LoadingDiff.tsx
index 59db938a6a..7bf8c38142 100644
--- a/scm-ui/ui-components/src/repos/LoadingDiff.tsx
+++ b/scm-ui/ui-components/src/repos/LoadingDiff.tsx
@@ -22,22 +22,22 @@
* SOFTWARE.
*/
import React from "react";
-import {apiClient} from "../apiclient";
+import { apiClient } from "../apiclient";
import ErrorNotification from "../ErrorNotification";
// @ts-ignore
import parser from "gitdiff-parser";
import Loading from "../Loading";
import Diff from "./Diff";
-import {DiffObjectProps, File} from "./DiffTypes";
-import {NotFoundError} from "../errors";
-import {Notification} from "../index";
-import {withTranslation, WithTranslation} from "react-i18next";
+import { DiffObjectProps, File } from "./DiffTypes";
+import { NotFoundError } from "../errors";
+import { Notification } from "../index";
+import { withTranslation, WithTranslation } from "react-i18next";
type Props = WithTranslation &
DiffObjectProps & {
- url: string;
-};
+ url: string;
+ };
type State = {
diff?: File[];
@@ -68,8 +68,8 @@ class LoadingDiff extends React.Component {
}
fetchDiff = () => {
- const {url} = this.props;
- this.setState({loading: true});
+ const { url } = this.props;
+ this.setState({ loading: true });
apiClient
.get(url)
.then(response => {
@@ -95,14 +95,14 @@ class LoadingDiff extends React.Component {
};
render() {
- const {diff, loading, error} = this.state;
+ const { diff, loading, error } = this.state;
if (error) {
if (error instanceof NotFoundError) {
return {this.props.t("changesets.noChangesets")};
}
- return ;
+ return ;
} else if (loading) {
- return ;
+ return ;
} else if (!diff) {
return null;
} else {
diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.tsx
index 8ec86cab41..5bffd9adc3 100644
--- a/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.tsx
+++ b/scm-ui/ui-components/src/repos/changesets/ChangesetDiff.tsx
@@ -22,11 +22,11 @@
* SOFTWARE.
*/
import React from "react";
-import {Changeset, Collection, Link} from "@scm-manager/ui-types";
+import { Changeset, Collection, Link } from "@scm-manager/ui-types";
import LoadingDiff from "../LoadingDiff";
import Notification from "../../Notification";
-import {WithTranslation, withTranslation} from "react-i18next";
-import {FileControlFactory} from "../DiffTypes";
+import { WithTranslation, withTranslation } from "react-i18next";
+import { FileControlFactory } from "../DiffTypes";
type Props = WithTranslation & {
changeset: Changeset;
@@ -49,12 +49,19 @@ export const createUrl = (changeset: Collection) => {
class ChangesetDiff extends React.Component {
render() {
- const {changeset, fileControlFactory, defaultCollapse, t} = this.props;
+ const { changeset, fileControlFactory, defaultCollapse, t } = this.props;
if (!isDiffSupported(changeset)) {
return {t("changeset.diffNotSupported")};
} else {
const url = createUrl(changeset);
- return ;
+ return (
+
+ );
}
}
}
diff --git a/scm-ui/ui-components/src/repos/changesets/ChangesetRow.tsx b/scm-ui/ui-components/src/repos/changesets/ChangesetRow.tsx
index cf8adcebd5..41ad388841 100644
--- a/scm-ui/ui-components/src/repos/changesets/ChangesetRow.tsx
+++ b/scm-ui/ui-components/src/repos/changesets/ChangesetRow.tsx
@@ -35,7 +35,7 @@ import ChangesetAuthor from "./ChangesetAuthor";
import ChangesetTags from "./ChangesetTags";
import ChangesetButtonGroup from "./ChangesetButtonGroup";
import ChangesetDescription from "./ChangesetDescription";
-import {FileControlFactory} from "../DiffTypes";
+import { FileControlFactory } from "../DiffTypes";
type Props = WithTranslation & {
repository: Repository;
@@ -102,7 +102,7 @@ class ChangesetRow extends React.Component {
-
+
@@ -120,24 +120,24 @@ class ChangesetRow extends React.Component {
-
+
-
+
-
+
-
+
-
+
{
componentDidMount() {
- const {fetchChangesetIfNeeded, repository, id} = this.props;
+ const { fetchChangesetIfNeeded, repository, id } = this.props;
fetchChangesetIfNeeded(repository, id);
}
componentDidUpdate(prevProps: Props) {
- const {fetchChangesetIfNeeded, repository, id} = this.props;
+ const { fetchChangesetIfNeeded, repository, id } = this.props;
if (prevProps.id !== id) {
fetchChangesetIfNeeded(repository, id);
}
}
render() {
- const {changeset, loading, error, t, repository, fileControlFactoryFactory} = this.props;
+ const { changeset, loading, error, t, repository, fileControlFactoryFactory } = this.props;
if (error) {
- return ;
+ return ;
}
- if (!changeset || loading) return ;
+ if (!changeset || loading) return ;
- return ;
+ return (
+
+ );
}
}
diff --git a/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx b/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx
index e835c0ea1d..2981ecad28 100644
--- a/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx
+++ b/scm-ui/ui-webapp/src/repos/containers/RepositoryRoot.tsx
@@ -22,11 +22,11 @@
* SOFTWARE.
*/
import React from "react";
-import {connect} from "react-redux";
-import {Redirect, Route, RouteComponentProps, Switch} from "react-router-dom";
-import {WithTranslation, withTranslation} from "react-i18next";
-import {binder, ExtensionPoint} from "@scm-manager/ui-extensions";
-import {Changeset, Repository} from "@scm-manager/ui-types";
+import { connect } from "react-redux";
+import { Redirect, Route, RouteComponentProps, Switch } from "react-router-dom";
+import { WithTranslation, withTranslation } from "react-i18next";
+import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
+import { Changeset, Repository } from "@scm-manager/ui-types";
import {
CustomQueryFlexWrappedColumns,
ErrorPage,
@@ -39,7 +39,7 @@ import {
StateMenuContextProvider,
SubNavigation
} from "@scm-manager/ui-components";
-import {fetchRepoByName, getFetchRepoFailure, getRepository, isFetchRepoPending} from "../modules/repos";
+import { fetchRepoByName, getFetchRepoFailure, getRepository, isFetchRepoPending } from "../modules/repos";
import RepositoryDetails from "../components/RepositoryDetails";
import EditRepo from "./EditRepo";
import BranchesOverview from "../branches/containers/BranchesOverview";
@@ -49,34 +49,34 @@ import EditRepoNavLink from "../components/EditRepoNavLink";
import BranchRoot from "../branches/containers/BranchRoot";
import PermissionsNavLink from "../components/PermissionsNavLink";
import RepositoryNavLink from "../components/RepositoryNavLink";
-import {getLinks, getRepositoriesLink} from "../../modules/indexResource";
+import { getLinks, getRepositoriesLink } from "../../modules/indexResource";
import CodeOverview from "../codeSection/containers/CodeOverview";
import ChangesetView from "./ChangesetView";
import SourceExtensions from "../sources/containers/SourceExtensions";
-import {FileControlFactory, JumpToFileButton} from "@scm-manager/ui-components";
+import { FileControlFactory, JumpToFileButton } from "@scm-manager/ui-components";
type Props = RouteComponentProps &
WithTranslation & {
- namespace: string;
- name: string;
- repository: Repository;
- loading: boolean;
- error: Error;
- repoLink: string;
- indexLinks: object;
+ namespace: string;
+ name: string;
+ repository: Repository;
+ loading: boolean;
+ error: Error;
+ repoLink: string;
+ indexLinks: object;
- // dispatch functions
- fetchRepoByName: (link: string, namespace: string, name: string) => void;
-};
+ // dispatch functions
+ fetchRepoByName: (link: string, namespace: string, name: string) => void;
+ };
class RepositoryRoot extends React.Component {
componentDidMount() {
- const {fetchRepoByName, namespace, name, repoLink} = this.props;
+ const { fetchRepoByName, namespace, name, repoLink } = this.props;
fetchRepoByName(repoLink, namespace, name);
}
componentDidUpdate(prevProps: Props) {
- const {fetchRepoByName, namespace, name, repoLink} = this.props;
+ const { fetchRepoByName, namespace, name, repoLink } = this.props;
if (namespace !== prevProps.namespace || name !== prevProps.name) {
fetchRepoByName(repoLink, namespace, name);
}
@@ -106,7 +106,7 @@ class RepositoryRoot extends React.Component {
};
getCodeLinkname = () => {
- const {repository} = this.props;
+ const { repository } = this.props;
if (repository?._links?.sources) {
return "sources";
}
@@ -117,7 +117,7 @@ class RepositoryRoot extends React.Component {
};
evaluateDestinationForCodeLink = () => {
- const {repository} = this.props;
+ const { repository } = this.props;
const url = `${this.matchedUrl()}/code`;
if (repository?._links?.sources) {
return `${url}/sources/`;
@@ -126,16 +126,16 @@ class RepositoryRoot extends React.Component {
};
render() {
- const {loading, error, indexLinks, repository, t} = this.props;
+ const { loading, error, indexLinks, repository, t } = this.props;
if (error) {
return (
-
+
);
}
if (!repository || loading) {
- return ;
+ return ;
}
const url = this.matchedUrl();
@@ -154,7 +154,7 @@ class RepositoryRoot extends React.Component {
redirectedUrl = url + "/info";
}
- const fileControlFactoryFactory: (changeset: Changeset) => FileControlFactory = (changeset) => (file) => {
+ const fileControlFactoryFactory: (changeset: Changeset) => FileControlFactory = changeset => file => {
const baseUrl = `${url}/code/sources`;
const sourceLink = {
url: `${baseUrl}/${changeset.id}/${file.newPath}/`,
@@ -183,73 +183,71 @@ class RepositoryRoot extends React.Component {
}
}
- return links.map(({url, label}) => );
+ return links.map(({ url, label }) => );
};
return (
}
+ afterTitle={}
>
-
+
{/* redirect pre 2.0.0-rc2 links */}
-
-
-
-
-
+
+
+
+
+
- }/>
- }/>
+ } />
+ } />
(
-
+
)}
/>
}
+ render={() => (
+
+ )}
/>
}
+ render={() => }
/>
}
+ render={() => }
/>
}
+ render={() => }
/>
}
+ render={() => }
/>
}
+ render={() => }
/>
- }/>
-
+ } />
+
-
+
{
activeOnlyWhenExact={false}
title={t("repositoryRoot.menu.sourcesNavLink")}
/>
-
+
-
-
-
+
+
+
@@ -296,7 +294,7 @@ class RepositoryRoot extends React.Component {
}
const mapStateToProps = (state: any, ownProps: Props) => {
- const {namespace, name} = ownProps.match.params;
+ const { namespace, name } = ownProps.match.params;
const repository = getRepository(state, namespace, name);
const loading = isFetchRepoPending(state, namespace, name);
const error = getFetchRepoFailure(state, namespace, name);