Disable sync when import users is off (#2599)
This commit is contained in:
parent
b8569db87c
commit
783396acb9
1 changed files with 18 additions and 2 deletions
|
@ -11,6 +11,7 @@ import { useAlerts } from "../../components/alert/Alerts";
|
||||||
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
||||||
import { useAdminClient } from "../../context/auth/AdminClient";
|
import { useAdminClient } from "../../context/auth/AdminClient";
|
||||||
import { Header } from "./Header";
|
import { Header } from "./Header";
|
||||||
|
import { useFormContext, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
type ExtendedHeaderProps = {
|
type ExtendedHeaderProps = {
|
||||||
provider: string;
|
provider: string;
|
||||||
|
@ -30,6 +31,13 @@ export const ExtendedHeader = ({
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
|
||||||
|
const { control } = useFormContext();
|
||||||
|
const hasImportUsers = useWatch({
|
||||||
|
name: "config.importEnabled",
|
||||||
|
control,
|
||||||
|
defaultValue: ["true"],
|
||||||
|
})[0];
|
||||||
|
|
||||||
const [toggleUnlinkUsersDialog, UnlinkUsersDialog] = useConfirmDialog({
|
const [toggleUnlinkUsersDialog, UnlinkUsersDialog] = useConfirmDialog({
|
||||||
titleKey: "user-federation:userFedUnlinkUsersConfirmTitle",
|
titleKey: "user-federation:userFedUnlinkUsersConfirmTitle",
|
||||||
messageKey: "user-federation:userFedUnlinkUsersConfirm",
|
messageKey: "user-federation:userFedUnlinkUsersConfirm",
|
||||||
|
@ -126,10 +134,18 @@ export const ExtendedHeader = ({
|
||||||
noDivider={noDivider}
|
noDivider={noDivider}
|
||||||
save={save}
|
save={save}
|
||||||
dropdownItems={[
|
dropdownItems={[
|
||||||
<DropdownItem key="sync" onClick={syncChangedUsers}>
|
<DropdownItem
|
||||||
|
key="sync"
|
||||||
|
onClick={syncChangedUsers}
|
||||||
|
isDisabled={hasImportUsers === "false"}
|
||||||
|
>
|
||||||
{t("syncChangedUsers")}
|
{t("syncChangedUsers")}
|
||||||
</DropdownItem>,
|
</DropdownItem>,
|
||||||
<DropdownItem key="syncall" onClick={syncAllUsers}>
|
<DropdownItem
|
||||||
|
key="syncall"
|
||||||
|
onClick={syncAllUsers}
|
||||||
|
isDisabled={hasImportUsers === "false"}
|
||||||
|
>
|
||||||
{t("syncAllUsers")}
|
{t("syncAllUsers")}
|
||||||
</DropdownItem>,
|
</DropdownItem>,
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
|
|
Loading…
Reference in a new issue