Merge branch 'master' into order_users

This commit is contained in:
Dirk Klimpel 2021-05-04 20:43:09 +02:00 committed by GitHub
commit 42a84d32d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3183 additions and 2605 deletions

View File

@ -11,26 +11,26 @@
},
"devDependencies": {
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^10.0.2",
"@testing-library/user-event": "^12.0.11",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^13.1.8",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.1.2",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.0.0",
"ra-test": "^3.14.0"
"prettier": "^2.2.0",
"ra-test": "^3.15.0"
},
"dependencies": {
"papaparse": "^5.2.0",
"prop-types": "^15.7.2",
"ra-language-chinese": "^2.0.10",
"ra-language-german": "^2.1.2",
"ra-language-german": "^3.13.4",
"react": "^17.0.0",
"react-admin": "^3.14.0",
"react-dom": "^16.14.0",
"react-scripts": "^3.4.4"
"react-admin": "^3.15.0",
"react-dom": "^17.0.2",
"react-scripts": "^4.0.0"
},
"scripts": {
"start": "REACT_APP_VERSION=$(git describe --tags) react-scripts start",

View File

@ -111,7 +111,9 @@ const LoginPage = ({ theme }) => {
if (!values.base_url.match(/^(http|https):\/\//)) {
errors.base_url = translate("synapseadmin.auth.protocol_error");
} else if (
!values.base_url.match(/^(http|https):\/\/[a-zA-Z0-9\-.]+(:\d{1,5})?$/)
!values.base_url.match(
/^(http|https):\/\/[a-zA-Z0-9\-.]+(:\d{1,5})?[^?&\s]*$/
)
) {
errors.base_url = translate("synapseadmin.auth.url_error");
}

View File

@ -421,6 +421,7 @@ export const UserEdit = props => {
addLabel={false}
pagination={<UserPagination />}
perPage={50}
sort={{ field: "created_ts", order: "DESC" }}
>
<Datagrid style={{ width: "100%" }}>
<DateField
@ -434,7 +435,6 @@ export const UserEdit = props => {
minute: "2-digit",
second: "2-digit",
}}
sortable={false}
/>
<DateField
source="last_access_ts"
@ -447,14 +447,13 @@ export const UserEdit = props => {
minute: "2-digit",
second: "2-digit",
}}
sortable={false}
/>
<TextField source="media_id" sortable={false} />
<NumberField source="media_length" sortable={false} />
<TextField source="media_type" sortable={false} />
<TextField source="upload_name" sortable={false} />
<TextField source="quarantined_by" sortable={false} />
<BooleanField source="safe_from_quarantine" sortable={false} />
<TextField source="media_id" />
<NumberField source="media_length" />
<TextField source="media_type" />
<TextField source="upload_name" />
<TextField source="quarantined_by" />
<BooleanField source="safe_from_quarantine" />
<DeleteButton mutationMode="pessimistic" redirect={false} />
</Datagrid>
</ReferenceManyField>

View File

@ -1,6 +1,6 @@
import germanMessages from "ra-language-german";
export default {
const de = {
...germanMessages,
synapseadmin: {
auth: {
@ -351,3 +351,4 @@ export default {
},
},
};
export default de;

View File

@ -1,6 +1,6 @@
import englishMessages from "ra-language-english";
export default {
const en = {
...englishMessages,
synapseadmin: {
auth: {
@ -319,3 +319,4 @@ export default {
},
},
};
export default en;

View File

@ -1,6 +1,6 @@
import chineseMessages from "ra-language-chinese";
export default {
const zh = {
...chineseMessages,
synapseadmin: {
auth: {
@ -288,3 +288,4 @@ export default {
},
},
};
export default zh;

View File

@ -10,6 +10,7 @@ const authProvider = {
type: "m.login.password",
user: username,
password: password,
device_id: localStorage.getItem("device_id"),
initial_device_display_name: "Synapse Admin",
}),
};
@ -17,6 +18,7 @@ const authProvider = {
// use the base_url from login instead of the well_known entry from the
// server, since the admin might want to access the admin API via some
// private address
base_url = base_url.replace(/\/+$/g, "");
localStorage.setItem("base_url", base_url);
const decoded_base_url = window.decodeURIComponent(base_url);
@ -48,7 +50,6 @@ const authProvider = {
if (typeof access_token === "string") {
fetchUtils.fetchJson(logout_api_url, options).then(({ json }) => {
localStorage.removeItem("access_token");
localStorage.removeItem("device_id");
});
}
return Promise.resolve();

View File

@ -314,10 +314,13 @@ const dataProvider = {
getManyReference: (resource, params) => {
console.log("getManyReference " + resource);
const { page, perPage } = params.pagination;
const { field, order } = params.sort;
const from = (page - 1) * perPage;
const query = {
from: from,
limit: perPage,
order_by: field,
dir: getSearchOrder(order),
};
const homeserver = localStorage.getItem("base_url");

5734
yarn.lock

File diff suppressed because it is too large Load Diff