Merge branch 'master' into fed_api

This commit is contained in:
Dirk Klimpel 2023-01-16 16:49:39 +01:00 committed by GitHub
commit 94fe541273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 4473 additions and 5497 deletions

View File

@ -14,7 +14,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 14 node-version: 16
- name: Install dependencies - name: Install dependencies
run: yarn --frozen-lockfile run: yarn --frozen-lockfile
- name: Run tests - name: Run tests

View File

@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v2.3.1 uses: actions/checkout@v2.3.1
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: "14" node-version: "16"
- name: Install and Build 🔧 - name: Install and Build 🔧
run: | run: |
yarn install yarn install

View File

@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: "14" node-version: "16"
- run: yarn install - run: yarn install
- run: yarn build - run: yarn build
- run: | - run: |

View File

@ -6,6 +6,6 @@
"singleQuote": false, "singleQuote": false,
"trailingComma": "es5", "trailingComma": "es5",
"bracketSpacing": true, "bracketSpacing": true,
"jsxBracketSameLine": false, "bracketSameLine": false,
"arrowParens": "avoid" "arrowParens": "avoid"
} }

View File

@ -1,5 +1,5 @@
language: node_js language: node_js
node_js: node_js:
- lts/* - 17
cache: yarn cache: yarn

View File

@ -1,5 +1,9 @@
[![GitHub license](https://img.shields.io/github/license/Awesome-Technologies/synapse-admin)](https://github.com/Awesome-Technologies/synapse-admin/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/Awesome-Technologies/synapse-admin.svg?branch=master)](https://travis-ci.org/Awesome-Technologies/synapse-admin) [![Build Status](https://travis-ci.org/Awesome-Technologies/synapse-admin.svg?branch=master)](https://travis-ci.org/Awesome-Technologies/synapse-admin)
[![build-test](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml/badge.svg)](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml) [![build-test](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml/badge.svg)](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/build-test.yml)
[![gh-pages](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/edge_ghpage.yml/badge.svg)](https://awesome-technologies.github.io/synapse-admin/)
[![docker-release](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/docker-release.yml/badge.svg)](https://hub.docker.com/r/awesometechnologies/synapse-admin)
[![github-release](https://github.com/Awesome-Technologies/synapse-admin/actions/workflows/github-release.yml/badge.svg)](https://github.com/Awesome-Technologies/synapse-admin/releases)
# Synapse admin ui # Synapse admin ui

View File

@ -15,6 +15,7 @@
"@testing-library/user-event": "^13.1.8", "@testing-library/user-event": "^13.1.8",
"eslint": "^7.25.0", "eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-prettier": "^3.1.2", "eslint-plugin-prettier": "^3.1.2",
"jest-fetch-mock": "^3.0.3", "jest-fetch-mock": "^3.0.3",
"prettier": "^2.2.0", "prettier": "^2.2.0",
@ -28,7 +29,7 @@
"react": "^17.0.0", "react": "^17.0.0",
"react-admin": "^3.19.7", "react-admin": "^3.19.7",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-scripts": "^4.0.0" "react-scripts": "^5.0.1"
}, },
"scripts": { "scripts": {
"start": "REACT_APP_VERSION=$(git describe --tags) react-scripts start", "start": "REACT_APP_VERSION=$(git describe --tags) react-scripts start",

View File

@ -71,6 +71,16 @@ const useStyles = makeStyles({
}, },
}); });
const choices_medium = [
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
];
const choices_type = [
{ id: "bot", name: "bot" },
{ id: "support", name: "support" },
];
const date_format = { const date_format = {
year: "numeric", year: "numeric",
month: "2-digit", month: "2-digit",
@ -249,20 +259,31 @@ export function generateRandomUser() {
}; };
} }
const UserEditToolbar = props => { const UserEditToolbar = props => (
<Toolbar {...props}>
<SaveButton submitOnEnter={true} disabled={props.pristine} />
</Toolbar>
);
const UserEditActions = ({ data }) => {
const translate = useTranslate(); const translate = useTranslate();
var userStatus = "";
if (data) {
userStatus = data.deactivated;
}
return ( return (
<Toolbar {...props}> <TopToolbar>
<SaveButton submitOnEnter={true} disabled={props.pristine} /> {!userStatus && <ServerNoticeButton record={data} />}
<DeleteButton <DeleteButton
record={data}
label="resources.users.action.erase" label="resources.users.action.erase"
confirmTitle={translate("resources.users.helper.erase", { confirmTitle={translate("resources.users.helper.erase", {
smart_count: 1, smart_count: 1,
})} })}
mutationMode="pessimistic" mutationMode="pessimistic"
/> />
<ServerNoticeButton /> </TopToolbar>
</Toolbar>
); );
}; };
@ -276,15 +297,19 @@ export const UserCreate = props => (
autoComplete="new-password" autoComplete="new-password"
validate={maxLength(512)} validate={maxLength(512)}
/> />
<SelectInput
source="user_type"
choices={choices_type}
translateChoice={false}
allowEmpty={true}
resettable
/>
<BooleanInput source="admin" /> <BooleanInput source="admin" />
<ArrayInput source="threepids"> <ArrayInput source="threepids">
<SimpleFormIterator disableReordering> <SimpleFormIterator disableReordering>
<SelectInput <SelectInput
source="medium" source="medium"
choices={[ choices={choices_medium}
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
]}
validate={required()} validate={required()}
/> />
<TextInput source="address" validate={validateAddress} /> <TextInput source="address" validate={validateAddress} />
@ -315,11 +340,12 @@ const UserTitle = ({ record }) => {
</span> </span>
); );
}; };
export const UserEdit = props => { export const UserEdit = props => {
const classes = useStyles(); const classes = useStyles();
const translate = useTranslate(); const translate = useTranslate();
return ( return (
<Edit {...props} title={<UserTitle />}> <Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
<TabbedForm toolbar={<UserEditToolbar />}> <TabbedForm toolbar={<UserEditToolbar />}>
<FormTab <FormTab
label={translate("resources.users.name", { smart_count: 1 })} label={translate("resources.users.name", { smart_count: 1 })}
@ -333,6 +359,13 @@ export const UserEdit = props => {
<TextInput source="id" disabled /> <TextInput source="id" disabled />
<TextInput source="displayname" /> <TextInput source="displayname" />
<PasswordInput source="password" autoComplete="new-password" /> <PasswordInput source="password" autoComplete="new-password" />
<SelectInput
source="user_type"
choices={choices_type}
translateChoice={false}
allowEmpty={true}
resettable
/>
<BooleanInput source="admin" /> <BooleanInput source="admin" />
<BooleanInput <BooleanInput
source="deactivated" source="deactivated"
@ -349,13 +382,7 @@ export const UserEdit = props => {
> >
<ArrayInput source="threepids"> <ArrayInput source="threepids">
<SimpleFormIterator disableReordering> <SimpleFormIterator disableReordering>
<SelectInput <SelectInput source="medium" choices={choices_medium} />
source="medium"
choices={[
{ id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" },
]}
/>
<TextInput source="address" /> <TextInput source="address" />
</SimpleFormIterator> </SimpleFormIterator>
</ArrayInput> </ArrayInput>

View File

@ -121,6 +121,7 @@ const de = {
creation_ts_ms: "Zeitpunkt der Erstellung", creation_ts_ms: "Zeitpunkt der Erstellung",
consent_version: "Zugestimmte Geschäftsbedingungen", consent_version: "Zugestimmte Geschäftsbedingungen",
auth_provider: "Provider", auth_provider: "Provider",
user_type: "Benutzertyp",
}, },
helper: { helper: {
deactivate: deactivate:

View File

@ -120,6 +120,7 @@ const en = {
creation_ts_ms: "Creation timestamp", creation_ts_ms: "Creation timestamp",
consent_version: "Consent version", consent_version: "Consent version",
auth_provider: "Provider", auth_provider: "Provider",
user_type: "User type",
}, },
helper: { helper: {
deactivate: "You must provide a password to re-activate an account.", deactivate: "You must provide a password to re-activate an account.",

View File

@ -326,7 +326,8 @@ const resourceMap = {
function filterNullValues(key, value) { function filterNullValues(key, value) {
// Filtering out null properties // Filtering out null properties
if (value === null) { // to reset user_type from user, it must be null
if (value === null && key !== "user_type") {
return undefined; return undefined;
} }
return value; return value;

9887
yarn.lock

File diff suppressed because it is too large Load Diff