This commit is contained in:
Manav Rathi
2024-08-27 14:01:51 +05:30
parent 15ba2dd297
commit 3f12ff2830
2 changed files with 23 additions and 3 deletions

View File

@@ -1,12 +1,14 @@
import { EnteDrawer } from "@/base/components/EnteDrawer";
import { MenuItemGroup } from "@/base/components/Menu";
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
import { Titlebar } from "@/base/components/Titlebar";
import { ut } from "@/base/i18n";
import log from "@/base/log";
import {
disableML,
enableML,
mlStatusSnapshot,
mlStatusSubscribe,
wipClusterEnable,
type MLStatus,
} from "@/new/photos/services/ml";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
@@ -295,8 +297,11 @@ const ManageML: React.FC<ManageMLProps> = ({
onDisableML,
setDialogBoxAttributesV2,
}) => {
const [showClusterOpt, setShowClusterOpt] = useState(false);
const { phase, nSyncedFiles, nTotalFiles } = mlStatus;
useEffect(() => void wipClusterEnable().then(setShowClusterOpt), []);
let status: string;
switch (phase) {
case "scheduled":
@@ -372,6 +377,21 @@ const ManageML: React.FC<ManageMLProps> = ({
</Stack>
</Stack>
</Paper>
{showClusterOpt && (
<Box>
<MenuItemGroup>
<EnteMenuItem
label={ut("Cluster internal only option")}
onClick={confirmDisableML}
/>
</MenuItemGroup>
<MenuSectionTitle
title={ut(
"(Re)-Create clusters locally, afresh. They will not be synced to remote.",
)}
/>
</Box>
)}
</Stack>
);
};

View File

@@ -323,8 +323,8 @@ export const indexNewUpload = (enteFile: EnteFile, uploadItem: UploadItem) => {
/**
* WIP! Don't enable, dragon eggs are hatching here.
*/
export const wipClusterEnable = async () =>
process.env.NEXT_PUBLIC_ENTE_WIP_CL &&
export const wipClusterEnable = async (): Promise<boolean> =>
!!process.env.NEXT_PUBLIC_ENTE_WIP_CL &&
isDevBuild &&
(await isInternalUser());