mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-27 16:47:13 +09:00
Add loading={!synced} to table and inputs
This commit is contained in:
3 files changed
+11
-7
No files matched your search
@@ -5,7 +5,7 @@ import { useModPacks } from "../model/mod_pack";
|
|||||||
import { InputComponentProps } from "../BaseWebPlugin";
|
import { InputComponentProps } from "../BaseWebPlugin";
|
||||||
|
|
||||||
export default function InputModPack(props: InputComponentProps) {
|
export default function InputModPack(props: InputComponentProps) {
|
||||||
const [modPacks] = useModPacks();
|
const [modPacks, synced] = useModPacks();
|
||||||
return <Select
|
return <Select
|
||||||
showSearch
|
showSearch
|
||||||
optionFilterProp="label"
|
optionFilterProp="label"
|
||||||
@@ -17,6 +17,7 @@ export default function InputModPack(props: InputComponentProps) {
|
|||||||
value: modPack.id,
|
value: modPack.id,
|
||||||
}))}
|
}))}
|
||||||
allowClear={props.fieldDefinition.optional}
|
allowClear={props.fieldDefinition.optional}
|
||||||
disabled={props.disabled}
|
disabled={!synced || props.disabled}
|
||||||
|
loading={!synced}
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ import { InputComponentProps } from "../BaseWebPlugin";
|
|||||||
import { useRoles } from "../model/roles";
|
import { useRoles } from "../model/roles";
|
||||||
|
|
||||||
export default function InputRole(props: InputComponentProps) {
|
export default function InputRole(props: InputComponentProps) {
|
||||||
const [roles] = useRoles();
|
const [roles, synced] = useRoles();
|
||||||
|
|
||||||
return <Select
|
return <Select
|
||||||
showSearch
|
showSearch
|
||||||
@@ -17,6 +17,7 @@ export default function InputRole(props: InputComponentProps) {
|
|||||||
value: role.id,
|
value: role.id,
|
||||||
}))}
|
}))}
|
||||||
allowClear={props.fieldDefinition.optional}
|
allowClear={props.fieldDefinition.optional}
|
||||||
disabled={props.disabled}
|
disabled={!synced || props.disabled}
|
||||||
|
loading={!synced}
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
@@ -36,12 +36,12 @@ export interface UsersTableProps {
|
|||||||
const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare;
|
const strcmp = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }).compare;
|
||||||
|
|
||||||
export default function UsersTable({ instanceId, onlyOnline = false, pagination, size }: UsersTableProps) {
|
export default function UsersTable({ instanceId, onlyOnline = false, pagination, size }: UsersTableProps) {
|
||||||
const [roles] = useRoles();
|
const [roles, rolesSynced] = useRoles();
|
||||||
|
const [users, usersSynced] = useUsers();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const {filterDropdown, filterDropdownProps} = useUserFilter(true);
|
const {filterDropdown, filterDropdownProps} = useUserFilter(true);
|
||||||
|
|
||||||
const [users] = useUsers();
|
|
||||||
const data = [...users.values()];
|
const data = [...users.values()];
|
||||||
|
|
||||||
// Determine online predicate based on instanceId
|
// Determine online predicate based on instanceId
|
||||||
@@ -154,7 +154,8 @@ export default function UsersTable({ instanceId, onlyOnline = false, pagination,
|
|||||||
: null),
|
: null),
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
sorter: (a: lib.UserDetails, b: lib.UserDetails) => (a.playerStats?.onlineTimeMs ?? 0) - (b.playerStats?.onlineTimeMs ?? 0),
|
sorter: (a: lib.UserDetails, b: lib.UserDetails) => (a.playerStats?.onlineTimeMs ?? 0) - (b.playerStats?.onlineTimeMs ?? 0),
|
||||||
responsive: ["lg"],
|
// Responsive breaks defaultFilteredValue, see: https://github.com/ant-design/ant-design/issues/32847
|
||||||
|
// responsive: ["lg"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "First seen",
|
title: "First seen",
|
||||||
@@ -223,6 +224,7 @@ export default function UsersTable({ instanceId, onlyOnline = false, pagination,
|
|||||||
pagination={defaultPagination}
|
pagination={defaultPagination}
|
||||||
size={size}
|
size={size}
|
||||||
scroll={{ x: "max-content" }}
|
scroll={{ x: "max-content" }}
|
||||||
|
loading={!usersSynced || !rolesSynced}
|
||||||
onRow={(user) => ({
|
onRow={(user) => ({
|
||||||
onClick: (event) => {
|
onClick: (event) => {
|
||||||
if ((event.target as HTMLElement).closest("a")) {
|
if ((event.target as HTMLElement).closest("a")) {
|
||||||
|
|||||||
Reference in new issue
Block a user