mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
updates users structure
This commit is contained in:
@@ -9,6 +9,7 @@ import Loading from "../../components/Loading";
|
||||
type Props = {
|
||||
submitForm: User => void,
|
||||
user?: User,
|
||||
loading?: boolean,
|
||||
t: string => string
|
||||
};
|
||||
|
||||
@@ -38,20 +39,14 @@ class UserForm extends React.Component<Props, User> {
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
const user = this.state;
|
||||
|
||||
let nameField = null;
|
||||
if (!this.props.user) {
|
||||
nameField = (
|
||||
if (user) {
|
||||
return (
|
||||
<form onSubmit={this.submit}>
|
||||
<InputField
|
||||
label={t("user.name")}
|
||||
onChange={this.handleUsernameChange}
|
||||
value={user ? user.name : ""}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<form onSubmit={this.submit}>
|
||||
{nameField}
|
||||
<InputField
|
||||
label={t("user.displayName")}
|
||||
onChange={this.handleDisplayNameChange}
|
||||
@@ -78,9 +73,15 @@ class UserForm extends React.Component<Props, User> {
|
||||
onChange={this.handleActiveChange}
|
||||
checked={user ? user.active : false}
|
||||
/>
|
||||
<SubmitButton label={t("user-form.submit")} />
|
||||
<SubmitButton
|
||||
label={t("user-form.submit")}
|
||||
loading={this.props.loading}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
} else {
|
||||
return <Loading />;
|
||||
}
|
||||
}
|
||||
|
||||
handleUsernameChange = (name: string) => {
|
||||
@@ -1,9 +1,9 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import type { User } from "../types/User";
|
||||
import { confirmAlert } from "../../components/modals/ConfirmAlert";
|
||||
import { NavAction } from "../../components/navigation";
|
||||
import type { User } from "../../types/User";
|
||||
import { confirmAlert } from "../../../components/modals/ConfirmAlert";
|
||||
import { NavAction } from "../../../components/navigation";
|
||||
|
||||
type Props = {
|
||||
user: User,
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from "react";
|
||||
import { mount, shallow } from "enzyme";
|
||||
import "../../tests/enzyme";
|
||||
import "../../tests/i18n";
|
||||
import "../../../tests/enzyme";
|
||||
import "../../../tests/i18n";
|
||||
import DeleteUserButton from "./DeleteUserButton";
|
||||
|
||||
import { confirmAlert } from "../../components/modals/ConfirmAlert";
|
||||
jest.mock("../../components/modals/ConfirmAlert");
|
||||
import { confirmAlert } from "../../../components/modals/ConfirmAlert";
|
||||
jest.mock("../../../components/modals/ConfirmAlert");
|
||||
|
||||
describe("DeleteUserButton", () => {
|
||||
it("should render nothing, if the delete link is missing", () => {
|
||||
@@ -1,8 +1,8 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { EditButton } from "../../components/buttons";
|
||||
import type { UserEntry } from "../types/UserEntry";
|
||||
import { EditButton } from "../../../components/buttons";
|
||||
import type { UserEntry } from "../../types/UserEntry";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
import "../../tests/enzyme";
|
||||
import "../../tests/i18n";
|
||||
import "../../../tests/enzyme";
|
||||
import "../../../tests/i18n";
|
||||
import EditUserButton from "./EditUserButton";
|
||||
|
||||
it("should render nothing, if the edit link is missing", () => {
|
||||
2
scm-ui/src/users/components/buttons/index.js
Normal file
2
scm-ui/src/users/components/buttons/index.js
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as DeleteUserButton } from "./DeleteUserButton";
|
||||
export { default as EditUserButton } from "./EditUserButton";
|
||||
@@ -1,8 +1,8 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import type { User } from "../types/User";
|
||||
import type { User } from "../../types/User";
|
||||
import { translate } from "react-i18next";
|
||||
import { Checkbox } from "../../components/forms";
|
||||
import { Checkbox } from "../../../components/forms";
|
||||
|
||||
type Props = {
|
||||
user: User,
|
||||
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import type { User } from "../types/User";
|
||||
import type { User } from "../../types/User";
|
||||
|
||||
type Props = {
|
||||
user: User
|
||||
@@ -2,7 +2,7 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import UserRow from "./UserRow";
|
||||
import type { UserEntry } from "../types/UserEntry";
|
||||
import type { UserEntry } from "../../types/UserEntry";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
3
scm-ui/src/users/components/table/index.js
Normal file
3
scm-ui/src/users/components/table/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as Details } from "./Details";
|
||||
export { default as UserRow } from "./UserRow";
|
||||
export { default as UserTable } from "./UserTable";
|
||||
@@ -1,7 +1,7 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import UserForm from "./UserForm";
|
||||
import UserForm from "./../components/UserForm";
|
||||
import type { User } from "../types/User";
|
||||
import type { History } from "history";
|
||||
import { createUser } from "../modules/users";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import UserForm from "./UserForm";
|
||||
import UserForm from "./../components/UserForm";
|
||||
import type { User } from "../types/User";
|
||||
import { modifyUser } from "../modules/users";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Page } from "../../components/layout";
|
||||
import { Route } from "react-router";
|
||||
import Details from "./Details";
|
||||
import { Details } from "./../components/table";
|
||||
import EditUser from "./EditUser";
|
||||
import type { User } from "../types/User";
|
||||
import type { UserEntry } from "../types/UserEntry";
|
||||
@@ -11,7 +11,7 @@ import { fetchUser, deleteUser } from "../modules/users";
|
||||
import Loading from "../../components/Loading";
|
||||
|
||||
import { Navigation, Section, NavLink } from "../../components/navigation";
|
||||
import DeleteUserButton from "./DeleteUserButton";
|
||||
import { DeleteUserButton } from "./../components/buttons";
|
||||
import ErrorPage from "../../components/ErrorPage";
|
||||
|
||||
type Props = {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { translate } from "react-i18next";
|
||||
|
||||
import { fetchUsers, getUsersFromState } from "../modules/users";
|
||||
import { Page } from "../../components/layout";
|
||||
import UserTable from "./UserTable";
|
||||
import { UserTable } from "./../components/table";
|
||||
import type { User } from "../types/User";
|
||||
import { AddButton } from "../../components/buttons";
|
||||
import type { UserEntry } from "../types/UserEntry";
|
||||
|
||||
Reference in New Issue
Block a user