Add ability to toggle whether to show locked users

This is almost copy of https://github.com/Awesome-Technologies/synapse-admin/pull/573 PR,
authored by @huw1990
This commit is contained in:
Aine 2024-09-03 11:09:46 +03:00
parent 7747dc7f28
commit 50c96cfd77
No known key found for this signature in database
GPG key ID: 34969C908CCA2804
6 changed files with 8 additions and 3 deletions

View file

@ -4,7 +4,7 @@ on:
branches: [ "main" ] branches: [ "main" ]
env: env:
upstream_version: v0.10.3 upstream_version: v0.10.3
etke_version: etke3 etke_version: etke4
bunny_version: v0.1.0 bunny_version: v0.1.0
permissions: permissions:
checks: write checks: write

View file

@ -26,6 +26,7 @@ The following changes are already implemented:
* [Prevent admins from deleting themselves](https://github.com/etkecc/synapse-admin/pull/1) * [Prevent admins from deleting themselves](https://github.com/etkecc/synapse-admin/pull/1)
* [Fix user's default tab not being shown](https://github.com/etkecc/synapse-admin/pull/8) * [Fix user's default tab not being shown](https://github.com/etkecc/synapse-admin/pull/8)
* [Add identifier when authorizing with password](https://github.com/Awesome-Technologies/synapse-admin/pull/601) * [Add identifier when authorizing with password](https://github.com/Awesome-Technologies/synapse-admin/pull/601)
* [Add ability to toggle whether to show locked users](https://github.com/Awesome-Technologies/synapse-admin/pull/573)
_the list will be updated as new changes are added_ _the list will be updated as new changes are added_

View file

@ -124,6 +124,7 @@ const en: SynapseTranslationMessages = {
erased: "Erased", erased: "Erased",
guests: "Show guests", guests: "Show guests",
show_deactivated: "Show deactivated users", show_deactivated: "Show deactivated users",
show_locked: "Show locked users",
user_id: "Search user", user_id: "Search user",
displayname: "Displayname", displayname: "Displayname",
password: "Password", password: "Password",

1
src/i18n/index.d.ts vendored
View file

@ -120,6 +120,7 @@ interface SynapseTranslationMessages extends TranslationMessages {
erased?: string; // TODO: fa, fr, it, zh erased?: string; // TODO: fa, fr, it, zh
guests: string; guests: string;
show_deactivated: string; show_deactivated: string;
show_locked?: string; // TODO: de, fa, fr, it, zh
user_id: string; user_id: string;
displayname: string; displayname: string;
password: string; password: string;

View file

@ -98,6 +98,7 @@ const userFilters = [
<SearchInput source="name" alwaysOn />, <SearchInput source="name" alwaysOn />,
<BooleanInput source="guests" alwaysOn />, <BooleanInput source="guests" alwaysOn />,
<BooleanInput label="resources.users.fields.show_deactivated" source="deactivated" alwaysOn />, <BooleanInput label="resources.users.fields.show_deactivated" source="deactivated" alwaysOn />,
<BooleanInput label="resources.users.fields.show_locked" source="locked" alwaysOn />,
]; ];
const UserPreventSelfDelete: React.FC<{ children: React.ReactNode, ownUserIsSelected: boolean }> = (props) => { const UserPreventSelfDelete: React.FC<{ children: React.ReactNode, ownUserIsSelected: boolean }> = (props) => {
@ -150,7 +151,7 @@ export const UserList = (props: ListProps) => (
<List <List
{...props} {...props}
filters={userFilters} filters={userFilters}
filterDefaultValues={{ guests: true, deactivated: false }} filterDefaultValues={{ guests: true, deactivated: false, locked: false }}
sort={{ field: "name", order: "ASC" }} sort={{ field: "name", order: "ASC" }}
actions={<UserListActions />} actions={<UserListActions />}
pagination={<UserPagination />} pagination={<UserPagination />}

View file

@ -491,7 +491,7 @@ function getSearchOrder(order: "ASC" | "DESC") {
const dataProvider: SynapseDataProvider = { const dataProvider: SynapseDataProvider = {
getList: async (resource, params) => { getList: async (resource, params) => {
console.log("getList " + resource); console.log("getList " + resource);
const { user_id, name, guests, deactivated, search_term, destination, valid } = params.filter; const { user_id, name, guests, deactivated, locked, search_term, destination, valid } = params.filter;
const { page, perPage } = params.pagination; const { page, perPage } = params.pagination;
const { field, order } = params.sort; const { field, order } = params.sort;
const from = (page - 1) * perPage; const from = (page - 1) * perPage;
@ -504,6 +504,7 @@ const dataProvider: SynapseDataProvider = {
destination: destination, destination: destination,
guests: guests, guests: guests,
deactivated: deactivated, deactivated: deactivated,
locked: locked,
valid: valid, valid: valid,
order_by: field, order_by: field,
dir: getSearchOrder(order), dir: getSearchOrder(order),