Add 3pids to user (#24)

This commit is contained in:
dklimpel 2020-03-30 10:22:27 +02:00 committed by Manuel Stahl
parent fccf23c64c
commit dfc643a10f
3 changed files with 39 additions and 0 deletions

View file

@ -1,11 +1,13 @@
import React from "react"; import React from "react";
import { import {
ArrayInput,
Datagrid, Datagrid,
Create, Create,
Edit, Edit,
List, List,
Filter, Filter,
SimpleForm, SimpleForm,
SimpleFormIterator,
BooleanField, BooleanField,
BooleanInput, BooleanInput,
ImageField, ImageField,
@ -13,6 +15,7 @@ import {
TextField, TextField,
TextInput, TextInput,
ReferenceField, ReferenceField,
SelectInput,
regex, regex,
} from "react-admin"; } from "react-admin";
@ -73,6 +76,18 @@ export const UserCreate = props => (
<TextInput source="displayname" /> <TextInput source="displayname" />
<PasswordInput source="password" autoComplete="new-password" /> <PasswordInput source="password" autoComplete="new-password" />
<BooleanInput source="admin" /> <BooleanInput source="admin" />
<ArrayInput source="threepids">
<SimpleFormIterator>
<SelectInput
source="medium"
choices={[
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
]}
/>
<TextInput source="address" />
</SimpleFormIterator>
</ArrayInput>
</SimpleForm> </SimpleForm>
</Create> </Create>
); );
@ -85,6 +100,18 @@ export const UserEdit = props => (
<PasswordInput source="password" autoComplete="new-password" /> <PasswordInput source="password" autoComplete="new-password" />
<BooleanInput source="admin" /> <BooleanInput source="admin" />
<BooleanInput source="deactivated" /> <BooleanInput source="deactivated" />
<ArrayInput source="threepids">
<SimpleFormIterator>
<SelectInput
source="medium"
choices={[
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
]}
/>
<TextInput source="address" />
</SimpleFormIterator>
</ArrayInput>
</SimpleForm> </SimpleForm>
</Edit> </Edit>
); );

View file

@ -15,6 +15,8 @@ export default {
resources: { resources: {
users: { users: {
name: "Benutzer", name: "Benutzer",
email: "E-Mail",
msisdn: "Telefon",
fields: { fields: {
avatar: "Avatar", avatar: "Avatar",
id: "Benutzer-ID", id: "Benutzer-ID",
@ -27,6 +29,10 @@ export default {
user_id: "Suche Benutzer", user_id: "Suche Benutzer",
displayname: "Anzeigename", displayname: "Anzeigename",
password: "Passwort", password: "Passwort",
avatar_url: "Avatar URL",
medium: "Medium",
threepids: "3PIDs",
address: "Adresse",
}, },
}, },
rooms: { rooms: {

View file

@ -15,6 +15,8 @@ export default {
resources: { resources: {
users: { users: {
name: "User |||| Users", name: "User |||| Users",
email: "Email",
msisdn: "Phone",
fields: { fields: {
avatar: "Avatar", avatar: "Avatar",
id: "User-ID", id: "User-ID",
@ -27,6 +29,10 @@ export default {
user_id: "Search user", user_id: "Search user",
displayname: "Displayname", displayname: "Displayname",
password: "Password", password: "Password",
avatar_url: "Avatar URL",
medium: "Medium",
threepids: "3PIDs",
address: "Address",
}, },
}, },
rooms: { rooms: {