mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
lang file + fixed edit group subtitle, paths + remaned editgroup to general
This commit is contained in:
@@ -46,12 +46,12 @@
|
|||||||
"placeholder": "Enter member",
|
"placeholder": "Enter member",
|
||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
"no-options": "No suggestion available"
|
"no-options": "No suggestion available"
|
||||||
},
|
},
|
||||||
|
"groupForm": {
|
||||||
"group-form": {
|
"subtitle": "Edit Group",
|
||||||
"submit": "Submit",
|
"submit": "Submit",
|
||||||
"name-error": "Group name is invalid",
|
"nameError": "Group name is invalid",
|
||||||
"description-error": "Description is invalid",
|
"descriptionError": "Description is invalid",
|
||||||
"help": {
|
"help": {
|
||||||
"nameHelpText": "Unique name of the group",
|
"nameHelpText": "Unique name of the group",
|
||||||
"descriptionHelpText": "A short description of the group",
|
"descriptionHelpText": "A short description of the group",
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
"informationNavLink": "Information",
|
"informationNavLink": "Information",
|
||||||
"settingsNavLink": "Settings",
|
"settingsNavLink": "Settings",
|
||||||
"editNavLink": "General",
|
"editNavLink": "General",
|
||||||
"setPasswordNavLink": "Set Password",
|
"setPasswordNavLink": "Password",
|
||||||
"setPermissionsNavLink": "Set Permissions"
|
"setPermissionsNavLink": "Permissions"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"addUser": {
|
"addUser": {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
|
Subtitle,
|
||||||
AutocompleteAddEntryToTableField,
|
AutocompleteAddEntryToTableField,
|
||||||
LabelWithHelpIcon,
|
LabelWithHelpIcon,
|
||||||
MemberNameTable,
|
MemberNameTable,
|
||||||
@@ -73,34 +74,38 @@ class GroupForm extends React.Component<Props, State> {
|
|||||||
render() {
|
render() {
|
||||||
const { t, loading } = this.props;
|
const { t, loading } = this.props;
|
||||||
const { group } = this.state;
|
const { group } = this.state;
|
||||||
let nameField = null;
|
let firstField = null;
|
||||||
if (!this.props.group) {
|
if (!this.props.group) {
|
||||||
nameField = (
|
// create new group
|
||||||
|
firstField = (
|
||||||
<InputField
|
<InputField
|
||||||
label={t("group.name")}
|
label={t("group.name")}
|
||||||
errorMessage={t("group-form.name-error")}
|
errorMessage={t("groupForm.nameError")}
|
||||||
onChange={this.handleGroupNameChange}
|
onChange={this.handleGroupNameChange}
|
||||||
value={group.name}
|
value={group.name}
|
||||||
validationError={this.state.nameValidationError}
|
validationError={this.state.nameValidationError}
|
||||||
helpText={t("group-form.help.nameHelpText")}
|
helpText={t("groupForm.help.nameHelpText")}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
// edit existing group
|
||||||
|
firstField = <Subtitle subtitle={t("groupForm.subtitle")} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={this.submit}>
|
<form onSubmit={this.submit}>
|
||||||
{nameField}
|
{firstField}
|
||||||
<Textarea
|
<Textarea
|
||||||
label={t("group.description")}
|
label={t("group.description")}
|
||||||
errorMessage={t("group-form.description-error")}
|
errorMessage={t("groupForm.descriptionError")}
|
||||||
onChange={this.handleDescriptionChange}
|
onChange={this.handleDescriptionChange}
|
||||||
value={group.description}
|
value={group.description}
|
||||||
validationError={false}
|
validationError={false}
|
||||||
helpText={t("group-form.help.descriptionHelpText")}
|
helpText={t("groupForm.help.descriptionHelpText")}
|
||||||
/>
|
/>
|
||||||
<LabelWithHelpIcon
|
<LabelWithHelpIcon
|
||||||
label={t("group.members")}
|
label={t("group.members")}
|
||||||
helpText={t("group-form.help.memberHelpText")}
|
helpText={t("groupForm.help.memberHelpText")}
|
||||||
/>
|
/>
|
||||||
<MemberNameTable
|
<MemberNameTable
|
||||||
members={group.members}
|
members={group.members}
|
||||||
@@ -120,7 +125,7 @@ class GroupForm extends React.Component<Props, State> {
|
|||||||
/>
|
/>
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
disabled={!this.isValid()}
|
disabled={!this.isValid()}
|
||||||
label={t("group-form.submit")}
|
label={t("groupForm.submit")}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ import React from "react";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import GroupForm from "../components/GroupForm";
|
import GroupForm from "../components/GroupForm";
|
||||||
import {
|
import {
|
||||||
|
modifyGroup,
|
||||||
|
deleteGroup,
|
||||||
getModifyGroupFailure,
|
getModifyGroupFailure,
|
||||||
isModifyGroupPending,
|
isModifyGroupPending,
|
||||||
modifyGroup,
|
getDeleteGroupFailure,
|
||||||
|
isDeleteGroupPending,
|
||||||
modifyGroupReset
|
modifyGroupReset
|
||||||
} from "../modules/groups";
|
} from "../modules/groups";
|
||||||
import type { History } from "history";
|
import type { History } from "history";
|
||||||
@@ -13,19 +16,21 @@ import { withRouter } from "react-router-dom";
|
|||||||
import type { Group } from "@scm-manager/ui-types";
|
import type { Group } from "@scm-manager/ui-types";
|
||||||
import { ErrorNotification } from "@scm-manager/ui-components";
|
import { ErrorNotification } from "@scm-manager/ui-components";
|
||||||
import { getUserAutoCompleteLink } from "../../modules/indexResource";
|
import { getUserAutoCompleteLink } from "../../modules/indexResource";
|
||||||
|
import DeleteGroup from "../components/DeleteGroup";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
group: Group,
|
group: Group,
|
||||||
|
fetchGroup: (name: string) => void,
|
||||||
modifyGroup: (group: Group, callback?: () => void) => void,
|
modifyGroup: (group: Group, callback?: () => void) => void,
|
||||||
modifyGroupReset: Group => void,
|
modifyGroupReset: Group => void,
|
||||||
fetchGroup: (name: string) => void,
|
deleteGroup: (group: Group, callback?: () => void) => void,
|
||||||
autocompleteLink: string,
|
autocompleteLink: string,
|
||||||
history: History,
|
history: History,
|
||||||
loading?: boolean,
|
loading?: boolean,
|
||||||
error: Error
|
error: Error
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditGroup extends React.Component<Props> {
|
class GeneralGroup extends React.Component<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { group, modifyGroupReset } = this.props;
|
const { group, modifyGroupReset } = this.props;
|
||||||
modifyGroupReset(group);
|
modifyGroupReset(group);
|
||||||
@@ -39,6 +44,14 @@ class EditGroup extends React.Component<Props> {
|
|||||||
this.props.modifyGroup(group, this.groupModified(group));
|
this.props.modifyGroup(group, this.groupModified(group));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
deleteGroup = (group: Group) => {
|
||||||
|
this.props.deleteGroup(group, this.groupDeleted);
|
||||||
|
};
|
||||||
|
|
||||||
|
groupDeleted = () => {
|
||||||
|
this.props.history.push("/groups");
|
||||||
|
};
|
||||||
|
|
||||||
loadUserAutocompletion = (inputValue: string) => {
|
loadUserAutocompletion = (inputValue: string) => {
|
||||||
const url = this.props.autocompleteLink + "?q=";
|
const url = this.props.autocompleteLink + "?q=";
|
||||||
return fetch(url + inputValue)
|
return fetch(url + inputValue)
|
||||||
@@ -66,14 +79,18 @@ class EditGroup extends React.Component<Props> {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
loadUserSuggestions={this.loadUserAutocompletion}
|
loadUserSuggestions={this.loadUserAutocompletion}
|
||||||
/>
|
/>
|
||||||
|
<hr />
|
||||||
|
<DeleteGroup
|
||||||
|
group={group}
|
||||||
|
deleteGroup={this.deleteGroup} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
const loading = isModifyGroupPending(state, ownProps.group.name);
|
const loading = isModifyGroupPending(state, ownProps.group.name) || isDeleteGroupPending(state, ownProps.group.name);
|
||||||
const error = getModifyGroupFailure(state, ownProps.group.name);
|
const error = getModifyGroupFailure(state, ownProps.group.name) || getDeleteGroupFailure(state, ownProps.group.name);
|
||||||
const autocompleteLink = getUserAutoCompleteLink(state);
|
const autocompleteLink = getUserAutoCompleteLink(state);
|
||||||
return {
|
return {
|
||||||
loading,
|
loading,
|
||||||
@@ -89,6 +106,9 @@ const mapDispatchToProps = dispatch => {
|
|||||||
},
|
},
|
||||||
modifyGroupReset: (group: Group) => {
|
modifyGroupReset: (group: Group) => {
|
||||||
dispatch(modifyGroupReset(group));
|
dispatch(modifyGroupReset(group));
|
||||||
|
},
|
||||||
|
deleteGroup: (group: Group, callback?: () => void) => {
|
||||||
|
dispatch(deleteGroup(group, callback));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -96,4 +116,4 @@ const mapDispatchToProps = dispatch => {
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(withRouter(EditGroup));
|
)(withRouter(GeneralGroup));
|
||||||
@@ -26,7 +26,7 @@ import {
|
|||||||
} from "../modules/groups";
|
} from "../modules/groups";
|
||||||
|
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import EditGroup from "./EditGroup";
|
import GeneralGroup from "./GeneralGroup";
|
||||||
import { getGroupsLink } from "../../modules/indexResource";
|
import { getGroupsLink } from "../../modules/indexResource";
|
||||||
import SetPermissions from "../../permissions/components/SetPermissions";
|
import SetPermissions from "../../permissions/components/SetPermissions";
|
||||||
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||||
@@ -99,10 +99,10 @@ class SingleGroup extends React.Component<Props> {
|
|||||||
<Route
|
<Route
|
||||||
path={`${url}/settings/general`}
|
path={`${url}/settings/general`}
|
||||||
exact
|
exact
|
||||||
component={() => <EditGroup group={group} />}
|
component={() => <GeneralGroup group={group} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={`${url}/permissions`}
|
path={`${url}/settings/permissions`}
|
||||||
exact
|
exact
|
||||||
component={() => (
|
component={() => (
|
||||||
<SetPermissions selectedPermissionsLink={group._links.permissions} />
|
<SetPermissions selectedPermissionsLink={group._links.permissions} />
|
||||||
@@ -136,7 +136,7 @@ class SingleGroup extends React.Component<Props> {
|
|||||||
/>
|
/>
|
||||||
<SetPermissionsNavLink
|
<SetPermissionsNavLink
|
||||||
group={group}
|
group={group}
|
||||||
permissionsUrl={`${url}/permissions`}
|
permissionsUrl={`${url}/settings/permissions`}
|
||||||
/>
|
/>
|
||||||
</SubNavigation>
|
</SubNavigation>
|
||||||
</Section>
|
</Section>
|
||||||
|
|||||||
Reference in New Issue
Block a user