The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
import { t } from "ttag";
import { useToast } from "metabase/common/hooks";
import { useUpdateMetabotMutation } from "metabase/metabot";
import { SettingHeader } from "metabase/settings-components";
import { Stack, Switch } from "metabase/ui";
import type { MetabotInfo } from "metabase-types/api";
export function MetabotVerifiedContentConfigurationPane({
metabot,
}: {
metabot: MetabotInfo;
}) {
const [updateMetabot, { isLoading: isUpdating }] = useUpdateMetabotMutation();
const [sendToast] = useToast();
const handleVerifiedContentToggle = async (checked: boolean) => {
const result = await updateMetabot({
id: metabot.id,
use_verified_content: checked,
});
if (result.error) {
sendToast({
message: t`Error updating Metabot`,
variant: "negative",
});
}
};
return (
<Stack gap="sm">
<SettingHeader
id="verified-content"
title={t`Verified or curated content`}
description={t`When enabled, Metabot will only use content that's verified, in an official collection, or published to the library.`}
/>
<Switch
label={t`Only use verified or curated content`}
checked={!!metabot.use_verified_content}
onChange={(e) => handleVerifiedContentToggle(e.target.checked)}
disabled={isUpdating}
w="auto"
/>
</Stack>
);
}