Skip to content
Snippets Groups Projects
Unverified Commit 8655a146 authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Move model cache section back to OSS (#23485)

* Move model cache section to OSS

* Don't handle "off" state as it won't be shown

* Tweak copy
parent 96d4efe4
No related branches found
No related tags found
No related merge requests found
......@@ -2,11 +2,9 @@ import { PLUGIN_MODEL_PERSISTENCE } from "metabase/plugins";
import { hasPremiumFeature } from "metabase-enterprise/settings";
import ModelCacheControl from "./components/ModelCacheControl";
import ModelCacheManagementSection from "./components/ModelCacheManagementSection";
if (hasPremiumFeature("advanced_config")) {
PLUGIN_MODEL_PERSISTENCE.isModelLevelPersistenceEnabled = () => true;
PLUGIN_MODEL_PERSISTENCE.ModelCacheControl = ModelCacheControl;
PLUGIN_MODEL_PERSISTENCE.ModelCacheManagementSection = ModelCacheManagementSection;
}
......@@ -188,5 +188,4 @@ export const PLUGIN_GROUP_MANAGERS: PluginGroupManagersType = {
export const PLUGIN_MODEL_PERSISTENCE = {
isModelLevelPersistenceEnabled: () => false,
ModelCacheControl: PluginPlaceholder as any,
ModelCacheManagementSection: PluginPlaceholder as any,
};
......@@ -29,14 +29,11 @@ type LoaderRenderProps = {
};
function getStatusMessage(job: ModelCacheRefreshStatus) {
if (job.state === "off") {
return t`Caching is turned off`;
}
if (job.state === "error") {
return t`Failed to update model cache`;
}
if (job.state === "creating") {
return t`Queued`;
return t`Waiting to create the first model cache`;
}
if (job.state === "refreshing") {
return t`Refreshing model cache`;
......
......@@ -90,7 +90,9 @@ describe("ModelCacheManagementSection", () => {
it("displays 'creating' state correctly", async () => {
await setup({ state: "creating" });
expect(screen.getByText("Queued")).toBeInTheDocument();
expect(
screen.getByText("Waiting to create the first model cache"),
).toBeInTheDocument();
expect(screen.queryByLabelText("refresh icon")).not.toBeInTheDocument();
});
......
import React from "react";
import { t } from "ttag";
import {
PLUGIN_MODERATION,
PLUGIN_MODEL_PERSISTENCE,
PLUGIN_CACHING,
} from "metabase/plugins";
import { PLUGIN_MODERATION, PLUGIN_CACHING } from "metabase/plugins";
import MetabaseSettings from "metabase/lib/settings";
......@@ -15,6 +11,8 @@ import Question from "metabase-lib/lib/Question";
import { Card } from "metabase-types/types/Card";
import EditableText from "metabase/core/components/EditableText";
import ModelCacheManagementSection from "./ModelCacheManagementSection";
import { Root, ContentSection } from "./QuestionInfoSidebar.styled";
interface QuestionInfoSidebarProps {
......@@ -60,9 +58,7 @@ export const QuestionInfoSidebar = ({
{isPersisted && (
<ContentSection extraPadding>
<PLUGIN_MODEL_PERSISTENCE.ModelCacheManagementSection
model={question}
/>
<ModelCacheManagementSection model={question} />
</ContentSection>
)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment