mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
refactor / enable routing after createRepoRole
This commit is contained in:
@@ -66,7 +66,7 @@ class Config extends React.Component<Props> {
|
|||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={`${url}/roles/create`}
|
path={`${url}/roles/create`}
|
||||||
render={() => <CreateRepositoryRole disabled={false} />}
|
render={() => <CreateRepositoryRole disabled={false} history={this.props.history} />}
|
||||||
/>
|
/>
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
name="config.route"
|
name="config.route"
|
||||||
|
|||||||
@@ -34,4 +34,4 @@ class PermissionRoleDetails extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate("roles")(PermissionRoleDetails);
|
export default translate("config")(PermissionRoleDetails);
|
||||||
|
|||||||
@@ -61,5 +61,5 @@ class PermissionRoleDetailsTable extends React.Component<Props> {
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
injectSheet(styles),
|
injectSheet(styles),
|
||||||
translate("roles")
|
translate("config")
|
||||||
)(PermissionRoleDetailsTable);
|
)(PermissionRoleDetailsTable);
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ type Props = {
|
|||||||
repositoryRolesLink: string,
|
repositoryRolesLink: string,
|
||||||
|
|
||||||
//dispatch function
|
//dispatch function
|
||||||
addRole: (link: string, role: Role) => void
|
addRole: (link: string, role: Role, callback?: () => void) => void
|
||||||
};
|
};
|
||||||
|
|
||||||
class CreateRepositoryRole extends React.Component<Props> {
|
class CreateRepositoryRole extends React.Component<Props> {
|
||||||
//Callback after dispatch
|
|
||||||
repositoryRoleCreated = (role: Role) => {
|
repositoryRoleCreated = (role: Role) => {
|
||||||
const { history } = this.props;
|
const { history } = this.props;
|
||||||
history.push("/role/" + role.name);
|
history.push("/config/role/" + role.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
createRepositoryRole = (role: Role) => {
|
createRepositoryRole = (role: Role) => {
|
||||||
@@ -63,8 +63,8 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
addRole: (link: string, role: Role) => {
|
addRole: (link: string, role: Role, callback?: () => void) => {
|
||||||
dispatch(createRole(link, role));
|
dispatch(createRole(link, role, callback));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -72,4 +72,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("roles")(CreateRepositoryRole));
|
)(translate("config")(CreateRepositoryRole));
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import type { Role } from "@scm-manager/ui-types";
|
|||||||
import { InputField, SubmitButton } from "@scm-manager/ui-components";
|
import { InputField, SubmitButton } from "@scm-manager/ui-components";
|
||||||
import PermissionCheckbox from "../../../repos/permissions/components/PermissionCheckbox";
|
import PermissionCheckbox from "../../../repos/permissions/components/PermissionCheckbox";
|
||||||
import {
|
import {
|
||||||
createRole,
|
|
||||||
fetchAvailableVerbs,
|
fetchAvailableVerbs,
|
||||||
getFetchVerbsFailure,
|
getFetchVerbsFailure,
|
||||||
getVerbsFromState,
|
getVerbsFromState,
|
||||||
@@ -27,7 +26,6 @@ type Props = {
|
|||||||
|
|
||||||
// dispatch functions
|
// dispatch functions
|
||||||
fetchAvailableVerbs: (link: string) => void
|
fetchAvailableVerbs: (link: string) => void
|
||||||
// addRole: (link: string, role: Role) => void
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@@ -107,7 +105,6 @@ class RepositoryRoleForm extends React.Component<Props, State> {
|
|||||||
: availableVerbs.map(verb => (
|
: availableVerbs.map(verb => (
|
||||||
<PermissionCheckbox
|
<PermissionCheckbox
|
||||||
key={verb}
|
key={verb}
|
||||||
// disabled={readOnly}
|
|
||||||
name={verb}
|
name={verb}
|
||||||
checked={role.verbs.includes(verb)}
|
checked={role.verbs.includes(verb)}
|
||||||
onChange={this.handleVerbChange}
|
onChange={this.handleVerbChange}
|
||||||
@@ -164,13 +161,10 @@ const mapDispatchToProps = dispatch => {
|
|||||||
fetchAvailableVerbs: (link: string) => {
|
fetchAvailableVerbs: (link: string) => {
|
||||||
dispatch(fetchAvailableVerbs(link));
|
dispatch(fetchAvailableVerbs(link));
|
||||||
},
|
},
|
||||||
// addRole: (link: string, role: Role) => {
|
|
||||||
// createRole(link, role)
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("roles")(RepositoryRoleForm));
|
)(translate("config")(RepositoryRoleForm));
|
||||||
|
|||||||
Reference in New Issue
Block a user