mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Merged in bugfix/new_pr_undefined_on_diff (pull request #359)
show notification if diff is empty
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import DiffFile from "./DiffFile";
|
import DiffFile from "./DiffFile";
|
||||||
import { DiffObjectProps, File } from "./DiffTypes";
|
import { DiffObjectProps, File } from "./DiffTypes";
|
||||||
|
import Notification from "../Notification";
|
||||||
|
import { WithTranslation, withTranslation } from "react-i18next";
|
||||||
|
|
||||||
type Props = DiffObjectProps & {
|
type Props = WithTranslation &
|
||||||
|
DiffObjectProps & {
|
||||||
diff: File[];
|
diff: File[];
|
||||||
defaultCollapse?: boolean;
|
defaultCollapse?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Diff extends React.Component<Props> {
|
class Diff extends React.Component<Props> {
|
||||||
static defaultProps: Partial<Props> = {
|
static defaultProps: Partial<Props> = {
|
||||||
@@ -13,15 +16,17 @@ class Diff extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { diff, ...fileProps } = this.props;
|
const { diff, t, ...fileProps } = this.props;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{diff.map((file, index) => (
|
{diff.length === 0 ? (
|
||||||
<DiffFile key={index} file={file} {...fileProps} {...this.props} />
|
<Notification type="info">{t("noDiffFound")}</Notification>
|
||||||
))}
|
) : (
|
||||||
|
diff.map((file, index) => <DiffFile key={index} file={file} {...fileProps} {...this.props} />)
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Diff;
|
export default withTranslation("plugins")(Diff);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class LoadingDiff extends React.Component<Props, State> {
|
|||||||
|
|
||||||
fetchDiff = () => {
|
fetchDiff = () => {
|
||||||
const { url } = this.props;
|
const { url } = this.props;
|
||||||
|
this.setState({loading: true});
|
||||||
apiClient
|
apiClient
|
||||||
.get(url)
|
.get(url)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
|
|||||||
@@ -202,5 +202,6 @@
|
|||||||
"CustomNamespaceStrategy": "Benutzerdefiniert",
|
"CustomNamespaceStrategy": "Benutzerdefiniert",
|
||||||
"CurrentYearNamespaceStrategy": "Aktuelles Jahr",
|
"CurrentYearNamespaceStrategy": "Aktuelles Jahr",
|
||||||
"RepositoryTypeNamespaceStrategy": "Repository Typ"
|
"RepositoryTypeNamespaceStrategy": "Repository Typ"
|
||||||
}
|
},
|
||||||
|
"noDiffFound": "Kein Diff zwischen den ausgewählten Branches gefunden."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,5 +202,6 @@
|
|||||||
"CustomNamespaceStrategy": "Custom",
|
"CustomNamespaceStrategy": "Custom",
|
||||||
"CurrentYearNamespaceStrategy": "Current year",
|
"CurrentYearNamespaceStrategy": "Current year",
|
||||||
"RepositoryTypeNamespaceStrategy": "Repository type"
|
"RepositoryTypeNamespaceStrategy": "Repository type"
|
||||||
}
|
},
|
||||||
|
"noDiffFound": "No Diff between the selected branches found."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,5 +182,6 @@
|
|||||||
"CustomNamespaceStrategy": "Personalizar",
|
"CustomNamespaceStrategy": "Personalizar",
|
||||||
"CurrentYearNamespaceStrategy": "Año actual",
|
"CurrentYearNamespaceStrategy": "Año actual",
|
||||||
"RepositoryTypeNamespaceStrategy": "Tipo de repositorio"
|
"RepositoryTypeNamespaceStrategy": "Tipo de repositorio"
|
||||||
}
|
},
|
||||||
|
"noDiffFound": "No se encontraron diferencias entre las ramas seleccionadas."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user