Merge branch 'develop' into feature/manage-tags

# Conflicts:
#	scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java
This commit is contained in:
Konstantin Schaper
2020-11-30 14:18:05 +01:00
228 changed files with 4954 additions and 3576 deletions

View File

@@ -24,14 +24,14 @@
import { storiesOf } from "@storybook/react";
import { BranchSelector } from "./index";
import { Branch } from "@scm-manager/ui-types/src";
import { Branch } from "@scm-manager/ui-types";
import * as React from "react";
import styled from "styled-components";
const master = { name: "master", revision: "1", defaultBranch: true, _links: {} };
const develop = { name: "develop", revision: "2", defaultBranch: false, _links: {} };
const branchSelected = (branch?: Branch) => {};
const branchSelected = (branch?: Branch) => null;
const branches = [master, develop];
@@ -42,6 +42,4 @@ const Wrapper = styled.div`
storiesOf("BranchSelector", module)
.addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
.add("Default", () => (
<BranchSelector branches={branches} onSelectBranch={branchSelected} label="Select branch:" />
));
.add("Default", () => <BranchSelector branches={branches} onSelectBranch={branchSelected} label="Select branch:" />);

View File

@@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import React from "react";
import { withRouter, RouteComponentProps } from "react-router-dom";
import React, { FC } from "react";
import { useHistory, useLocation } from "react-router-dom";
import classNames from "classnames";
import { Button, DropDown, urls } from "./index";
import { FilterInput } from "./forms";
type Props = RouteComponentProps & {
type Props = {
showCreateButton: boolean;
currentGroup: string;
groups: string[];
@@ -35,41 +35,33 @@ type Props = RouteComponentProps & {
groupSelected: (namespace: string) => void;
label?: string;
testId?: string;
searchPlaceholder?: string;
};
class OverviewPageActions extends React.Component<Props> {
render() {
const { history, currentGroup, groups, location, link, testId, groupSelected } = this.props;
const groupSelector = groups && (
<div className={"column is-flex"}>
<DropDown
className={"is-fullwidth"}
options={groups}
preselectedOption={currentGroup}
optionSelected={groupSelected}
/>
</div>
);
const OverviewPageActions: FC<Props> = ({
groups,
currentGroup,
showCreateButton,
link,
groupSelected,
label,
testId,
searchPlaceholder
}) => {
const history = useHistory();
const location = useLocation();
const groupSelector = groups && (
<div className={"column is-flex"}>
<DropDown
className={"is-fullwidth"}
options={groups}
preselectedOption={currentGroup}
optionSelected={groupSelected}
/>
</div>
);
return (
<div className={"columns is-tablet"}>
{groupSelector}
<div className={"column"}>
<FilterInput
value={urls.getQueryStringFromLocation(location)}
filter={filter => {
history.push(`/${link}/?q=${filter}`);
}}
testId={testId + "-filter"}
/>
</div>
{this.renderCreateButton()}
</div>
);
}
renderCreateButton() {
const { showCreateButton, link, label } = this.props;
const renderCreateButton = () => {
if (showCreateButton) {
return (
<div className={classNames("input-button", "control", "column")}>
@@ -78,7 +70,24 @@ class OverviewPageActions extends React.Component<Props> {
);
}
return null;
}
}
};
export default withRouter(OverviewPageActions);
return (
<div className={"columns is-tablet"}>
{groupSelector}
<div className={"column"}>
<FilterInput
placeholder={searchPlaceholder}
value={urls.getQueryStringFromLocation(location)}
filter={filter => {
history.push(`/${link}/?q=${filter}`);
}}
testId={testId + "-filter"}
/>
</div>
{renderCreateButton()}
</div>
);
};
export default OverviewPageActions;

View File

@@ -50439,36 +50439,70 @@ exports[`Storyshots RepositoryEntry Avatar EP 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div
@@ -50553,36 +50587,70 @@ exports[`Storyshots RepositoryEntry Before Title EP 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div
@@ -50664,36 +50732,70 @@ exports[`Storyshots RepositoryEntry Default 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div
@@ -50775,27 +50877,56 @@ exports[`Storyshots RepositoryEntry Quick Link EP 1`] = `
href="/repo/hitchhiker/heartOfGold/branches/"
onClick={[Function]}
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.branches"
>
<i
className="fas fa-code-branch has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/tags/"
onClick={[Function]}
>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.tags"
>
<i
className="fas fa-tags has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/changesets/"
onClick={[Function]}
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.commits"
>
<i
className="fas fa-exchange-alt has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="RepositoryEntryLink__PointerEventsLink-sc-1hpqj0w-0 iZuqoP level-item"
href="/repo/hitchhiker/heartOfGold/code/sources/"
onClick={[Function]}
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.sources"
>
<i
className="fas fa-code has-text-inherit fa-lg"
/>
</span>
</a>
<a
className="level-item"
@@ -50809,9 +50940,14 @@ exports[`Storyshots RepositoryEntry Quick Link EP 1`] = `
href="/repo/hitchhiker/heartOfGold/settings/general"
onClick={[Function]}
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
<span
className="tooltip has-tooltip-top"
data-tooltip="repositoryRoot.tooltip.settings"
>
<i
className="fas fa-cog has-text-inherit fa-lg"
/>
</span>
</a>
</div>
<div

View File

@@ -27,10 +27,11 @@ import { CardColumn, DateFromNow } from "@scm-manager/ui-components";
import RepositoryEntryLink from "./RepositoryEntryLink";
import RepositoryAvatar from "./RepositoryAvatar";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { withTranslation, WithTranslation } from "react-i18next";
type DateProp = Date | string;
type Props = {
type Props = WithTranslation & {
repository: Repository;
// @VisibleForTesting
// the baseDate is only to avoid failing snapshot tests
@@ -43,29 +44,67 @@ class RepositoryEntry extends React.Component<Props> {
};
renderBranchesLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["branches"]) {
return <RepositoryEntryLink icon="code-branch" to={repositoryLink + "/branches/"} />;
return (
<RepositoryEntryLink
icon="code-branch"
to={repositoryLink + "/branches/"}
tooltip={t("repositoryRoot.tooltip.branches")}
/>
);
}
return null;
};
renderTagsLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["tags"]) {
return (
<RepositoryEntryLink icon="tags" to={repositoryLink + "/tags/"} tooltip={t("repositoryRoot.tooltip.tags")} />
);
}
return null;
};
renderChangesetsLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["changesets"]) {
return <RepositoryEntryLink icon="exchange-alt" to={repositoryLink + "/code/changesets/"} />;
return (
<RepositoryEntryLink
icon="exchange-alt"
to={repositoryLink + "/code/changesets/"}
tooltip={t("repositoryRoot.tooltip.commits")}
/>
);
}
return null;
};
renderSourcesLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["sources"]) {
return <RepositoryEntryLink icon="code" to={repositoryLink + "/code/sources/"} />;
return (
<RepositoryEntryLink
icon="code"
to={repositoryLink + "/code/sources/"}
tooltip={t("repositoryRoot.tooltip.sources")}
/>
);
}
return null;
};
renderModifyLink = (repository: Repository, repositoryLink: string) => {
const { t } = this.props;
if (repository._links["update"]) {
return <RepositoryEntryLink icon="cog" to={repositoryLink + "/settings/general"} />;
return (
<RepositoryEntryLink
icon="cog"
to={repositoryLink + "/settings/general"}
tooltip={t("repositoryRoot.tooltip.settings")}
/>
);
}
return null;
};
@@ -74,6 +113,7 @@ class RepositoryEntry extends React.Component<Props> {
return (
<>
{this.renderBranchesLink(repository, repositoryLink)}
{this.renderTagsLink(repository, repositoryLink)}
{this.renderChangesetsLink(repository, repositoryLink)}
{this.renderSourcesLink(repository, repositoryLink)}
<ExtensionPoint name={"repository.card.quickLink"} props={{ repository, repositoryLink }} renderAll={true} />
@@ -118,4 +158,4 @@ class RepositoryEntry extends React.Component<Props> {
}
}
export default RepositoryEntry;
export default withTranslation("repos")(RepositoryEntry);

View File

@@ -25,10 +25,12 @@ import React from "react";
import { Link } from "react-router-dom";
import styled from "styled-components";
import { Icon } from "@scm-manager/ui-components";
import Tooltip from "../Tooltip";
type Props = {
to: string;
icon: string;
tooltip?: string;
};
const PointerEventsLink = styled(Link)`
@@ -37,10 +39,20 @@ const PointerEventsLink = styled(Link)`
class RepositoryEntryLink extends React.Component<Props> {
render() {
const { to, icon } = this.props;
const { to, icon, tooltip } = this.props;
let content = <Icon className="fa-lg" name={icon} color="inherit" />;
if (tooltip) {
content = (
<Tooltip message={tooltip} location="top">
{content}
</Tooltip>
);
}
return (
<PointerEventsLink className="level-item" to={to}>
<Icon className="fa-lg" name={icon} color="inherit" />
{content}
</PointerEventsLink>
);
}