From 367b7d08533892f66a144062aac5f6f9839440c6 Mon Sep 17 00:00:00 2001 From: ACoolName Date: Fri, 31 May 2024 20:08:33 +0300 Subject: [PATCH] test --- src/actions.tsx | 9 +-------- src/common.tsx | 34 +++++++++++----------------------- src/servers.tsx | 1 + src/users.tsx | 1 + 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/src/actions.tsx b/src/actions.tsx index 19e280d..f8f3205 100644 --- a/src/actions.tsx +++ b/src/actions.tsx @@ -424,14 +424,7 @@ export const SERVER_ACTIONS: ActionInfo[] = [ default: [] }, command: { - anyOf: [ - { - type: "string" - }, - { - type: "null" - } - ], + type: "string", title: "Command" } }, diff --git a/src/common.tsx b/src/common.tsx index 61b9d18..97ece36 100644 --- a/src/common.tsx +++ b/src/common.tsx @@ -130,28 +130,16 @@ export const actionIdentifierContext: Context = createContext('') function convertNumber(permissions: number): number[]{ var arr: number[] = [] - if (permissions&Permission.Start){ - arr.push(Permission.Start) - } - if (permissions&Permission.Stop){ - arr.push(Permission.Stop) - } - if (permissions&Permission.Browse){ - arr.push(Permission.Browse) - } - if (permissions&Permission.RunCommand){ - arr.push(Permission.RunCommand) - } - if (permissions&Permission.Create){ - arr.push(Permission.Create) - } - if (permissions&Permission.Delete){ - arr.push(Permission.Delete) - } - if (permissions&Permission.Admin){ - arr.push(Permission.Admin) - } - return arr + + Object.entries(Permission).forEach( + ([key, value]) => { + if (permissions&value){ + arr.push(value) + } + } + ); + + return arr } function CustomField(props: WidgetProps){ @@ -370,7 +358,7 @@ export function ActionGroup(p: { actions: ActionInfo[], identifierSubstring?: st return handleMenuItemClick(event, index)} + // onClick={(event) => handleMenuItemClick(event, index)} disabled={!isUserAllowed(user, option.props.action)} > {option.props.action.name} diff --git a/src/servers.tsx b/src/servers.tsx index 82fb8d5..eba376e 100644 --- a/src/servers.tsx +++ b/src/servers.tsx @@ -75,6 +75,7 @@ function ServerItem(props: { server_info: ServerInfo }) { export default function ServersBoard() { const [servers, setServers]: [ServerInfo[], Dispatch] = useState([] as ServerInfo[]); + servers.sort() const [apiAuthenticated, setApiAuthenticated] = useContext(apiAuthenticatedContext) function handleServers() { diff --git a/src/users.tsx b/src/users.tsx index 853c5b8..108c7a6 100644 --- a/src/users.tsx +++ b/src/users.tsx @@ -51,6 +51,7 @@ function UserItem(p: { user: User }) { export function UsersPage(p: {}) { const [apiAuthenticated, setApiAuthenticated] = useContext(apiAuthenticatedContext) const [users, setUsers]: [User[], Dispatch] = useState([] as User[]) + users.sort() const action: ActionInfo|undefined = INVITE_USER_ACTION