diff --git a/scm-ui/ui-components/src/OverviewPageActions.tsx b/scm-ui/ui-components/src/OverviewPageActions.tsx index ffdc65c68a..86d7ac173b 100644 --- a/scm-ui/ui-components/src/OverviewPageActions.tsx +++ b/scm-ui/ui-components/src/OverviewPageActions.tsx @@ -26,47 +26,52 @@ import { withRouter, RouteComponentProps } from "react-router-dom"; import classNames from "classnames"; import { Button, DropDown, urls } from "./index"; import { FilterInput } from "./forms"; -import { Namespace } from "@scm-manager/ui-types"; type Props = RouteComponentProps & { showCreateButton: boolean; - namespace: string; - namespaces: Namespace[]; + currentGroup: string; + groups: string[]; link: string; - namespaceSelected: (namespace: string) => void; + groupSelected: (namespace: string) => void; label?: string; testId?: string; }; class OverviewPageActions extends React.Component { render() { - const { history, namespace, namespaces, location, link, testId } = this.props; - const sortedNamespaces = namespaces ? namespaces.map(n => n.namespace).sort() : []; - const namespaceOptions = ["", ...sortedNamespaces]; - return ( - <> - - { - history.push(`/${link}/?q=${filter}`); - }} - testId={testId + "-filter"} + const { history, currentGroup, groups, location, link, testId, groupSelected } = this.props; + const groupSelector = groups && ( +
+ +
+ ); + + return ( +
+ {groupSelector} +
+ { + history.push(`/${link}/?q=${filter}`); + }} + testId={testId + "-filter"} + /> +
{this.renderCreateButton()} - +
); } - namespaceSelected = (newNamespace: string) => { - this.props.namespaceSelected(newNamespace); - }; - renderCreateButton() { const { showCreateButton, link, label } = this.props; if (showCreateButton) { return ( -
+
); diff --git a/scm-ui/ui-components/src/layout/Page.tsx b/scm-ui/ui-components/src/layout/Page.tsx index d12012a3cf..174ebdb31a 100644 --- a/scm-ui/ui-components/src/layout/Page.tsx +++ b/scm-ui/ui-components/src/layout/Page.tsx @@ -100,7 +100,7 @@ export default class Page extends React.Component { if (this.isPageAction(child)) { pageActions = ( {child} diff --git a/scm-ui/ui-webapp/src/repos/containers/Overview.tsx b/scm-ui/ui-webapp/src/repos/containers/Overview.tsx index 05564003db..d67dad0861 100644 --- a/scm-ui/ui-webapp/src/repos/containers/Overview.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/Overview.tsx @@ -114,15 +114,17 @@ class Overview extends React.Component { const link = namespace ? `repos/${namespace}` : "repos"; + const namespacesToRender = namespaces?["", ...namespaces.map(n => n.namespace).sort()]:[]; + return ( {this.renderOverview()}