Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ You can also check the
- Use most recent value toggle is now correctly displaying in the single
filters section
- Dataset browse view is now correctly displayed on mobile devices
- Database-related actions are now hidden in preview mode (copy URL, share)
- Security
- Added additional protection against data source URL injection
- Removed feature flag for custom GraphQL endpoint
Expand Down
6 changes: 6 additions & 0 deletions app/components/chart-published.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ export const ChartPublished = ({
configKey,
embedParams,
shouldShrink,
isPreview,
}: {
configKey?: string;
embedParams?: EmbedQueryParams;
shouldShrink?: boolean;
isPreview?: boolean;
}) => {
const [state] = useConfiguratorState(isPublished);
const { dataSource } = state;
Expand Down Expand Up @@ -234,6 +236,7 @@ export const ChartPublished = ({
metadataPanelStore={metadataPanelStore}
embedParams={embedParams}
shouldShrink={shouldShrink}
isPreview={isPreview}
/>
</ChartWrapper>
</ChartTablePreviewProvider>
Expand Down Expand Up @@ -285,6 +288,7 @@ type ChartPublishInnerProps = {
metadataPanelStore: ReturnType<typeof createMetadataPanelStore>;
embedParams?: EmbedQueryParams;
shouldShrink?: boolean;
isPreview?: boolean;
};

const ChartPublishedInnerImpl = ({
Expand All @@ -297,6 +301,7 @@ const ChartPublishedInnerImpl = ({
metadataPanelStore,
embedParams,
shouldShrink: _shouldShrink,
isPreview,
}: ChartPublishInnerProps) => {
const { meta } = chartConfig;
const rootRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -448,6 +453,7 @@ const ChartPublishedInnerImpl = ({
chartKey={chartConfig.key}
chartWrapperNode={rootRef.current}
components={allComponents}
disableDatabaseRelatedActions={isPreview}
/>
</ActionElementsContainer>
)}
Expand Down
6 changes: 5 additions & 1 deletion app/components/chart-shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ export const ChartMoreButton = ({
chartKey,
chartWrapperNode,
components,
disableDatabaseRelatedActions,
}: {
configKey?: string;
chartKey: string;
chartWrapperNode?: HTMLElement | null;
components: Component[];
disableDatabaseRelatedActions?: boolean;
}) => {
const locale = useLocale();
const [state, dispatch] = useConfiguratorState(hasChartConfigs);
Expand Down Expand Up @@ -227,7 +229,9 @@ export const ChartMoreButton = ({
/>
</>
) : null}
{state.layout.type !== "dashboard" && configKey ? (
{state.layout.type !== "dashboard" &&
configKey &&
!disableDatabaseRelatedActions ? (
<>
<CopyChartMenuActionItem configKey={configKey} />
<ShareChartMenuActionItem configKey={configKey} />
Expand Down
4 changes: 2 additions & 2 deletions app/pages/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
ConfiguratorStatePublished,
decodeConfiguratorState,
} from "@/config-types";
import { ConfiguratorStateProvider } from "@/configurator/configurator-state";
import { GraphqlProvider } from "@/graphql/graphql-provider";
import { i18n } from "@/locales/locales";
import { LocaleProvider, useLocale } from "@/locales/use-locale";
import { ConfiguratorStateProvider } from "@/src";
import * as federalTheme from "@/themes/theme";
import { migrateConfiguratorState } from "@/utils/chart-config/versioning";
import { hashStringToObject } from "@/utils/hash-utils";
Expand Down Expand Up @@ -101,7 +101,7 @@ export default function Preview() {
chartId="published"
initialState={state}
>
<ChartPublished configKey="preview" {...state} />
<ChartPublished configKey="preview" isPreview {...state} />
</ConfiguratorStateProvider>
) : null}
</ThemeProvider>
Expand Down
6 changes: 5 additions & 1 deletion app/pages/preview_post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export default function Preview({ configuratorState, locale }: PageProps) {
chartId="published"
initialState={parsedState}
>
<ChartPublished configKey="preview" {...parsedState} />
<ChartPublished
configKey="preview"
isPreview
{...parsedState}
/>
</ConfiguratorStateProvider>
) : null}
</ThemeProvider>
Expand Down