Fixed a small UI display bug when directly opening the permission editor for the client/client channel permissions

canary
WolverinDEV 2020-06-15 17:02:28 +02:00
parent 8978d3d5d2
commit 7e8c77fd09
2 changed files with 13 additions and 11 deletions

View File

@ -909,19 +909,22 @@ const ClientSelect = (props: { events: Registry<PermissionModalEvents>, tabTarge
}
});
props.events.reactUse("query_client_info", event => {
if(event.client !== clientIdentifier)
return;
const resetInfoFields = (placeholder?: string) => {
refNickname.current?.setValue(undefined);
refUniqueIdentifier.current?.setValue(undefined);
refDatabaseId.current?.setValue(undefined);
refInput.current?.setState({ disabled: true });
refNickname.current?.setState({ placeholder: tr("loading...") });
refUniqueIdentifier.current?.setState({ placeholder: tr("loading...") });
refDatabaseId.current?.setState({ placeholder: tr("loading...") });
refNickname.current?.setState({ placeholder: placeholder });
refUniqueIdentifier.current?.setState({ placeholder: placeholder });
refDatabaseId.current?.setState({ placeholder: placeholder });
};
props.events.reactUse("query_client_info", event => {
if(event.client !== clientIdentifier)
return;
refInput.current?.setState({ disabled: true });
resetInfoFields(tr("loading..."));
props.events.fire("action_set_permission_editor_subject", { mode: props.tabTarget, clientDatabaseId: 0 });
});
@ -963,9 +966,7 @@ const ClientSelect = (props: { events: Registry<PermissionModalEvents>, tabTarge
props.events.fire_async("query_client_info", { client: event.id });
} else {
refInput.current?.setValue(undefined);
refNickname.current?.setState({ placeholder: undefined });
refUniqueIdentifier.current?.setState({ placeholder: undefined });
refDatabaseId.current?.setState({ placeholder: undefined });
resetInfoFields(undefined);
props.events.fire("action_set_permission_editor_subject", { mode: props.tabTarget, clientDatabaseId: 0 });
}
});

View File

@ -200,6 +200,7 @@ export class FlatInputField extends React.Component<FlatInputFieldProperties, Fl
setValue(value: string | undefined) {
this.refInput.current.value = typeof value === "undefined" ? "" : value;
this.setState({ filled: !!value });
}
inputElement() : HTMLInputElement | undefined {