moved config components in admin dir

This commit is contained in:
Florian Scholdei
2019-06-19 09:58:17 +02:00
parent 71c4967594
commit c5252da2ec
29 changed files with 80 additions and 32 deletions

View File

@@ -99,7 +99,7 @@ class ConfigForm extends React.Component<Props, State> {
return ( return (
<Notification <Notification
type={"danger"} type={"danger"}
children={t("config-form.no-read-permission-notification")} children={t("config.form.no-read-permission-notification")}
/> />
); );
} }
@@ -108,7 +108,7 @@ class ConfigForm extends React.Component<Props, State> {
noPermissionNotification = ( noPermissionNotification = (
<Notification <Notification
type={"info"} type={"info"}
children={t("config-form.no-write-permission-notification")} children={t("config.form.no-write-permission-notification")}
onClose={() => this.onClose()} onClose={() => this.onClose()}
/> />
); );
@@ -167,7 +167,7 @@ class ConfigForm extends React.Component<Props, State> {
<hr /> <hr />
<SubmitButton <SubmitButton
loading={loading} loading={loading}
label={t("config-form.submit")} label={t("config.form.submit")}
disabled={ disabled={
!configUpdatePermission || this.hasError() || !this.state.changed !configUpdatePermission || this.hasError() || !this.state.changed
} }

View File

@@ -1,14 +1,15 @@
// @flow // @flow
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { translate } from "react-i18next";
import { Route, Switch } from "react-router-dom"; import {Redirect, Route, Switch} from "react-router-dom";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
import type { History } from "history"; import type { History } from "history";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { compose } from "redux"; import { compose } from "redux";
import type { Links } from "@scm-manager/ui-types"; import type { Links } from "@scm-manager/ui-types";
import { Page, Navigation, NavLink, Section } from "@scm-manager/ui-components"; import { Page, Navigation, NavLink, Section, SubNavigation } from "@scm-manager/ui-components";
import { getLinks } from "../../modules/indexResource"; import { getLinks } from "../../modules/indexResource";
import AdminDetails from "./AdminDetails";
import GlobalConfig from "./GlobalConfig"; import GlobalConfig from "./GlobalConfig";
import RepositoryRoles from "../roles/containers/RepositoryRoles"; import RepositoryRoles from "../roles/containers/RepositoryRoles";
import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole"; import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole";
@@ -23,7 +24,7 @@ type Props = {
history: History history: History
}; };
class Config extends React.Component<Props> { class Admin extends React.Component<Props> {
stripEndingSlash = (url: string) => { stripEndingSlash = (url: string) => {
if (url.endsWith("/")) { if (url.endsWith("/")) {
return url.substring(0, url.length - 2); return url.substring(0, url.length - 2);
@@ -55,7 +56,9 @@ class Config extends React.Component<Props> {
<div className="columns"> <div className="columns">
<div className="column is-three-quarters"> <div className="column is-three-quarters">
<Switch> <Switch>
<Route path={url} exact component={GlobalConfig} /> <Redirect exact from={url} to={`${url}/info`} />
<Route path={`${url}/info`} exact component={AdminDetails} />
<Route path={`${url}/settings/general`} exact component={GlobalConfig} />
<Route <Route
path={`${url}/role/:role`} path={`${url}/role/:role`}
render={() => ( render={() => (
@@ -86,7 +89,7 @@ class Config extends React.Component<Props> {
)} )}
/> />
<ExtensionPoint <ExtensionPoint
name="config.route" name="admin.route"
props={extensionProps} props={extensionProps}
renderAll={true} renderAll={true}
/> />
@@ -94,22 +97,38 @@ class Config extends React.Component<Props> {
</div> </div>
<div className="column is-one-quarter"> <div className="column is-one-quarter">
<Navigation> <Navigation>
<Section label={t("config.navigationLabel")}> <Section label={t("admin.menu.navigationLabel")}>
<NavLink <NavLink
to={`${url}`} to={`${url}/info`}
label={t("config.globalConfigurationNavLink")} icon="fas fa-info-circle"
label={t("admin.menu.informationNavLink")}
/> />
<NavLink <NavLink
to={`${url}/roles/`} to={`${url}/roles/`}
icon="fas fa-user-shield"
label={t("repositoryRole.navLink")} label={t("repositoryRole.navLink")}
activeWhenMatch={this.matchesRoles} activeWhenMatch={this.matchesRoles}
activeOnlyWhenExact={false} activeOnlyWhenExact={false}
/> />
<ExtensionPoint <ExtensionPoint
name="config.navigation" name="admin.navigation"
props={extensionProps} props={extensionProps}
renderAll={true} renderAll={true}
/> />
<SubNavigation
to={`${url}/settings/general`}
label={t("admin.menu.settingsNavLink")}
>
<NavLink
to={`${url}/settings/general`}
label={t("admin.menu.generalNavLink")}
/>
<ExtensionPoint
name="admin.setting"
props={extensionProps}
renderAll={true}
/>
</SubNavigation>
</Section> </Section>
</Navigation> </Navigation>
</div> </div>
@@ -128,5 +147,5 @@ const mapStateToProps = (state: any) => {
export default compose( export default compose(
connect(mapStateToProps), connect(mapStateToProps),
translate("config") translate("admin")
)(Config); )(Admin);

View File

@@ -0,0 +1,30 @@
// @flow
import React from "react";
import { translate } from "react-i18next";
import { Title, Loading, ErrorNotification } from "@scm-manager/ui-components";
type Props = {
loading: boolean,
error: Error,
// context objects
t: string => string
};
class AdminDetails extends React.Component<Props> {
render() {
const { t, loading } = this.props;
if (loading) {
return <Loading />;
}
return (
<>Nothing special.</>
);
}
}
export default translate("admin")(AdminDetails);

View File

@@ -80,7 +80,7 @@ class GlobalConfig extends React.Component<Props, State> {
className="delete" className="delete"
onClick={() => this.setState({ configChanged: false })} onClick={() => this.setState({ configChanged: false })}
/> />
{this.props.t("config-form.submit-success-notification")} {this.props.t("config.form.submit-success-notification")}
</div> </div>
); );
} }

View File

@@ -1,5 +1,4 @@
// @flow // @flow
import * as types from "../../modules/types"; import * as types from "../../modules/types";
import type { Action, NamespaceStrategies } from "@scm-manager/ui-types"; import type { Action, NamespaceStrategies } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components"; import { apiClient } from "@scm-manager/ui-components";

View File

@@ -47,4 +47,4 @@ class PermissionRoleDetails extends React.Component<Props> {
} }
} }
export default translate("config")(PermissionRoleDetails); export default translate("admin")(PermissionRoleDetails);

View File

@@ -35,4 +35,4 @@ class PermissionRoleDetailsTable extends React.Component<Props> {
} }
} }
export default translate("config")(PermissionRoleDetailsTable); export default translate("admin")(PermissionRoleDetailsTable);

View File

@@ -34,4 +34,4 @@ class PermissionRoleTable extends React.Component<Props> {
} }
} }
export default translate("config")(PermissionRoleTable); export default translate("admin")(PermissionRoleTable);

View File

@@ -34,4 +34,4 @@ class SystemRoleTag extends React.Component<Props> {
} }
} }
export default injectSheet(styles)(translate("config")(SystemRoleTag)); export default injectSheet(styles)(translate("admin")(SystemRoleTag));

View File

@@ -85,4 +85,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("config")(CreateRepositoryRole)); )(translate("admin")(CreateRepositoryRole));

View File

@@ -45,15 +45,15 @@ class DeleteRepositoryRole extends React.Component<Props> {
confirmDelete = () => { confirmDelete = () => {
const { t } = this.props; const { t } = this.props;
confirmAlert({ confirmAlert({
title: t("deleteRole.confirmAlert.title"), title: t("repositoryRole.delete.confirmAlert.title"),
message: t("deleteRole.confirmAlert.message"), message: t("repositoryRole.delete.confirmAlert.message"),
buttons: [ buttons: [
{ {
label: t("deleteRole.confirmAlert.submit"), label: t("repositoryRole.delete.confirmAlert.submit"),
onClick: () => this.deleteRole() onClick: () => this.deleteRole()
}, },
{ {
label: t("deleteRole.confirmAlert.cancel"), label: t("repositoryRole.delete.confirmAlert.cancel"),
onClick: () => null onClick: () => null
} }
] ]
@@ -74,12 +74,12 @@ class DeleteRepositoryRole extends React.Component<Props> {
return ( return (
<> <>
<Subtitle subtitle={t("deleteRole.subtitle")} /> <Subtitle subtitle={t("repositoryRole.delete.subtitle")} />
<div className="columns"> <div className="columns">
<div className="column"> <div className="column">
<ErrorNotification error={error} /> <ErrorNotification error={error} />
<DeleteButton <DeleteButton
label={t("deleteRole.button")} label={t("repositoryRole.delete.button")}
action={action} action={action}
loading={loading} loading={loading}
/> />
@@ -110,4 +110,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(withRouter(translate("config")(DeleteRepositoryRole))); )(withRouter(translate("admin")(DeleteRepositoryRole)));

View File

@@ -78,4 +78,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("config")(EditRepositoryRole)); )(translate("admin")(EditRepositoryRole));

View File

@@ -169,4 +169,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("config")(RepositoryRoleForm)); )(translate("admin")(RepositoryRoleForm));

View File

@@ -151,5 +151,5 @@ export default withRouter(
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("config")(RepositoryRoles)) )(translate("admin")(RepositoryRoles))
); );

View File

@@ -129,5 +129,5 @@ export default withRouter(
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("config")(SingleRepositoryRole)) )(translate("admin")(SingleRepositoryRole))
); );