@gooddata/sdk-ui-analytical-designer 11.67.0-alpha.3 → 11.67.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +16 -233
- package/README.md +13 -5
- package/esm/Root.d.ts +0 -2
- package/esm/Root.d.ts.map +1 -1
- package/esm/Root.js +0 -4
- package/esm/actions/app_context_actions.d.ts.map +1 -1
- package/esm/actions/app_context_actions.js +2 -4
- package/esm/actions/dialogs_actions.d.ts +2 -2
- package/esm/actions/dialogs_actions.js +2 -2
- package/esm/components/Editor.d.ts.map +1 -1
- package/esm/components/Editor.js +31 -2
- package/esm/components/EditorHeader.d.ts +19 -1
- package/esm/components/EditorHeader.d.ts.map +1 -1
- package/esm/components/EditorHeader.js +38 -86
- package/esm/components/ReportDescription.d.ts +8 -1
- package/esm/components/ReportDescription.d.ts.map +1 -1
- package/esm/components/ReportDescription.js +37 -7
- package/esm/components/buckets/MeasureAttributeFilterOrganized.d.ts.map +1 -1
- package/esm/components/buckets/MeasureAttributeFilterOrganized.js +1 -1
- package/esm/components/buckets/MeasureDateFilter.d.ts.map +1 -1
- package/esm/components/buckets/MeasureDateFilter.js +1 -1
- package/esm/components/buckets/categories/DateDatasetsDropdown.d.ts.map +1 -1
- package/esm/components/filterBar/dateFilter/TimeComparisonSection/TimeComparisonTypesDropdown.d.ts.map +1 -1
- package/esm/components/header/CancelButton.d.ts +13 -0
- package/esm/components/header/CancelButton.d.ts.map +1 -0
- package/esm/components/header/CancelButton.js +32 -0
- package/esm/components/header/ClearButton.d.ts +7 -0
- package/esm/components/header/ClearButton.d.ts.map +1 -0
- package/esm/components/header/ClearButton.js +24 -0
- package/esm/components/header/EditorActions.d.ts +14 -0
- package/esm/components/header/EditorActions.d.ts.map +1 -0
- package/esm/components/header/EditorActions.js +71 -0
- package/esm/components/header/Embed/EmbedButton.d.ts +6 -1
- package/esm/components/header/Embed/EmbedButton.d.ts.map +1 -1
- package/esm/components/header/Embed/EmbedButton.js +48 -48
- package/esm/components/header/Embed/EmbedInsightDialogContainer.d.ts +6 -0
- package/esm/components/header/Embed/EmbedInsightDialogContainer.d.ts.map +1 -0
- package/esm/components/header/Embed/EmbedInsightDialogContainer.js +52 -0
- package/esm/components/header/Embed/EmbedMenu.d.ts +6 -4
- package/esm/components/header/Embed/EmbedMenu.d.ts.map +1 -1
- package/esm/components/header/Embed/EmbedMenu.js +2 -6
- package/esm/components/header/InsightPickerDialog.d.ts +5 -1
- package/esm/components/header/InsightPickerDialog.d.ts.map +1 -1
- package/esm/components/header/InsightPickerDialog.js +9 -29
- package/esm/components/header/OpenControl.d.ts +7 -0
- package/esm/components/header/OpenControl.d.ts.map +1 -0
- package/esm/components/header/OpenControl.js +69 -0
- package/esm/components/header/OptionsMenu/OptionsButton.d.ts +5 -1
- package/esm/components/header/OptionsMenu/OptionsButton.d.ts.map +1 -1
- package/esm/components/header/OptionsMenu/OptionsButton.js +19 -9
- package/esm/components/header/OptionsMenu/OptionsMenu.d.ts +8 -60
- package/esm/components/header/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/esm/components/header/OptionsMenu/OptionsMenu.js +56 -112
- package/esm/components/header/OptionsMenu/OptionsMenuItem.d.ts +3 -4
- package/esm/components/header/OptionsMenu/OptionsMenuItem.d.ts.map +1 -1
- package/esm/components/header/OptionsMenu/OptionsMenuItem.js +5 -9
- package/esm/components/header/OptionsMenu/useOptionsProps.d.ts +26 -0
- package/esm/components/header/OptionsMenu/useOptionsProps.d.ts.map +1 -0
- package/esm/components/header/OptionsMenu/useOptionsProps.js +188 -0
- package/esm/components/header/SaveAsNewReportButton.d.ts +6 -1
- package/esm/components/header/SaveAsNewReportButton.d.ts.map +1 -1
- package/esm/components/header/SaveAsNewReportButton.js +20 -10
- package/esm/components/header/SaveReportButton.d.ts +6 -1
- package/esm/components/header/SaveReportButton.d.ts.map +1 -1
- package/esm/components/header/SaveReportButton.js +41 -18
- package/esm/components/header/TimezoneDialog.d.ts +1 -1
- package/esm/components/header/TimezoneDialog.js +1 -1
- package/esm/components/header/UndoRedoButtons.d.ts +7 -0
- package/esm/components/header/UndoRedoButtons.d.ts.map +1 -0
- package/esm/components/header/UndoRedoButtons.js +31 -0
- package/esm/components/header/VisualizationInfo.d.ts +11 -0
- package/esm/components/header/VisualizationInfo.d.ts.map +1 -0
- package/esm/components/header/VisualizationInfo.js +47 -0
- package/esm/components/header/VisualizationTitle.d.ts +7 -0
- package/esm/components/header/VisualizationTitle.d.ts.map +1 -0
- package/esm/components/header/VisualizationTitle.js +36 -0
- package/esm/components/header/VisualizationsDropdown.d.ts +5 -1
- package/esm/components/header/VisualizationsDropdown.d.ts.map +1 -1
- package/esm/components/header/VisualizationsDropdown.js +7 -33
- package/esm/components/header/editorHeaderContext.d.ts +20 -0
- package/esm/components/header/editorHeaderContext.d.ts.map +1 -0
- package/esm/components/header/editorHeaderContext.js +58 -0
- package/esm/components/header/share/InsightAccess.d.ts +30 -1
- package/esm/components/header/share/InsightAccess.d.ts.map +1 -1
- package/esm/components/header/share/InsightAccess.js +81 -18
- package/esm/components/header/share/InsightAccessChip.d.ts +2 -2
- package/esm/components/header/share/InsightAccessChip.d.ts.map +1 -1
- package/esm/components/header/share/InsightAccessChip.js +3 -3
- package/esm/embedding/AnalyticalDesignerEmbedded.d.ts +1 -1
- package/esm/embedding/AnalyticalDesignerEmbedded.js +1 -1
- package/esm/embedding/editorHeaderSlotTypes.d.ts +569 -0
- package/esm/embedding/editorHeaderSlotTypes.d.ts.map +1 -0
- package/esm/embedding/editorHeaderSlotTypes.js +2 -0
- package/esm/embedding/slots.d.ts +73 -0
- package/esm/embedding/slots.d.ts.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/metrics_changed_events.d.ts +1 -1
- package/esm/postMessageApi/outgoing/metrics_changed_events.js +1 -1
- package/esm/postMessageApi/outgoing/post_event_helper.d.ts +1 -1
- package/esm/postMessageApi/outgoing/post_event_helper.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/post_event_helper.js +1 -1
- package/esm/postMessageApi/sagas/control_filtering_saga.js +1 -1
- package/esm/sdk-ui-analytical-designer.d.ts +664 -0
- package/esm/selectors/editor_header_selector.d.ts +225 -0
- package/esm/selectors/editor_header_selector.d.ts.map +1 -1
- package/esm/selectors/editor_header_selector.js +8 -1
- package/esm/selectors/insight_access_selector.d.ts +185 -4
- package/esm/selectors/insight_access_selector.d.ts.map +1 -1
- package/esm/selectors/insight_access_selector.js +5 -3
- package/esm/selectors/report_title_selector.d.ts +6 -6
- package/esm/selectors/report_title_selector.d.ts.map +1 -1
- package/esm/selectors/report_title_selector.js +4 -3
- package/esm/selectors/report_visualization_selector.d.ts +4 -0
- package/esm/selectors/report_visualization_selector.d.ts.map +1 -1
- package/esm/selectors/save_report_selector.d.ts +7 -0
- package/esm/selectors/save_report_selector.d.ts.map +1 -1
- package/esm/selectors/save_report_selector.js +11 -1
- package/esm/selectors/uri_selector.js +1 -1
- package/esm/store/app_context/app_context_slices.d.ts.map +1 -1
- package/esm/store/app_context/app_context_slices.js +2 -3
- package/esm/store/app_context/session_id_reducer.d.ts +2 -3
- package/esm/store/app_context/session_id_reducer.d.ts.map +1 -1
- package/esm/store/app_context/session_id_reducer.js +2 -3
- package/esm/store/intl/intl_slice.d.ts.map +1 -1
- package/esm/store/intl/intl_slice.js +2 -3
- package/esm/translations/en-US.json +8 -0
- package/esm/utils/browser_detect.d.ts +2 -1
- package/esm/utils/browser_detect.d.ts.map +1 -1
- package/esm/utils/browser_detect.js +21 -3
- package/esm/utils/dropdown.d.ts +6 -2
- package/esm/utils/dropdown.d.ts.map +1 -1
- package/esm/utils/dropdown.js +10 -3
- package/package.json +23 -31
- package/styles/css/catalog.css +2 -2
- package/styles/css/catalog_sidebar.css +1 -1
- package/styles/css/catalog_sidebar.css.map +1 -1
- package/styles/css/editor_canvas.css +1 -1
- package/styles/css/editor_header.css +16 -1
- package/styles/css/editor_header.css.map +1 -1
- package/styles/css/main.css +20 -5
- package/styles/css/main.css.map +1 -1
- package/styles/scss/catalog.scss +2 -2
- package/styles/scss/catalog_sidebar.scss +2 -1
- package/styles/scss/editor_canvas.scss +1 -1
- package/styles/scss/editor_header.scss +20 -1
- package/esm/components/ReportTitle.d.ts +0 -2
- package/esm/components/ReportTitle.d.ts.map +0 -1
- package/esm/components/ReportTitle.js +0 -51
- package/esm/components/header/Embed/utils.d.ts +0 -4
- package/esm/components/header/Embed/utils.d.ts.map +0 -1
- package/esm/components/header/Embed/utils.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UndoRedoButtons.d.ts","sourceRoot":"","sources":["../../../src/components/header/UndoRedoButtons.tsx"],"names":[],"mappings":"AAUA,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACxC,MAAM,0CAA0C,CAAC;AAgBlD,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,gCAAgC,GAC1C,gCAAgC,CAUlC;AA4BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC5B,cAAc,EACd,cAAc,EACd,MAAM,EACN,MAAM,GACT,EAAE,gCAAgC,2CAmBlC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2007-2026 GoodData Corporation
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { useSelector } from "react-redux";
|
|
6
|
+
import { Bubble, BubbleHoverTrigger, Button } from "@gooddata/sdk-ui-kit";
|
|
7
|
+
import { redo, undo } from "../../actions/time_travel_actions.js";
|
|
8
|
+
import { isRedoDisabled as isRedoDisabledSelector, isUndoDisabled as isUndoDisabledSelector, } from "../../selectors/editor_header_selector.js";
|
|
9
|
+
import { useGuardedCallback } from "./editorHeaderContext.js";
|
|
10
|
+
const BUBBLE_ALIGN_POINTS = [{ align: "bc tc", offset: { x: 0, y: 12 } }];
|
|
11
|
+
const canUndo = (state) => !isUndoDisabledSelector(state);
|
|
12
|
+
const canRedo = (state) => !isRedoDisabledSelector(state);
|
|
13
|
+
const runUndo = (dispatch) => dispatch(undo());
|
|
14
|
+
const runRedo = (dispatch) => dispatch(redo());
|
|
15
|
+
export function useUndoRedoProps(context) {
|
|
16
|
+
const isUndoDisabled = useSelector(isUndoDisabledSelector);
|
|
17
|
+
const isRedoDisabled = useSelector(isRedoDisabledSelector);
|
|
18
|
+
const onUndo = useGuardedCallback(canUndo, runUndo);
|
|
19
|
+
const onRedo = useGuardedCallback(canRedo, runRedo);
|
|
20
|
+
return useMemo(() => ({ ...context, isUndoDisabled, isRedoDisabled, onUndo, onRedo }), [context, isUndoDisabled, isRedoDisabled, onUndo, onRedo]);
|
|
21
|
+
}
|
|
22
|
+
function HistoryButton({ className, label, isDisabled, onClick }) {
|
|
23
|
+
return (_jsx("span", { children: _jsxs(BubbleHoverTrigger, { children: [_jsx(Button, { className: `gd-button-secondary gd-button-icon-only ${className}`, value: "", disabled: isDisabled, onClick: onClick, accessibilityConfig: { ariaLabel: label } }), _jsx(Bubble, { className: "bubble-primary", alignPoints: BUBBLE_ALIGN_POINTS, children: label })] }) }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Default of the UndoRedo slot: both buttons in one group, with their own tooltips and accessible names.
|
|
27
|
+
*/
|
|
28
|
+
export function DefaultUndoRedo({ isUndoDisabled, isRedoDisabled, onUndo, onRedo, }) {
|
|
29
|
+
const intl = useIntl();
|
|
30
|
+
return (_jsxs("div", { className: "gd-button-group editor-header-item", children: [_jsx(HistoryButton, { className: "gd-icon-undo undo s-undo", label: intl.formatMessage({ id: "undo" }), isDisabled: isUndoDisabled, onClick: onUndo }), _jsx(HistoryButton, { className: "gd-icon-redo redo s-redo", label: intl.formatMessage({ id: "redo" }), isDisabled: isRedoDisabled, onClick: onRedo })] }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerVisualizationInfoProps } from "../../embedding/editorHeaderSlotTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* The VisualizationInfo region with its title, description and access slots resolved.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useVisualizationInfo(context: IAnalyticalDesignerHeaderContext): ReactElement;
|
|
7
|
+
/**
|
|
8
|
+
* Default of the VisualizationInfo slot: the indicators, then the title with its description, access and usages.
|
|
9
|
+
*/
|
|
10
|
+
export declare function DefaultVisualizationInfo({ hasUnsavedChanges, indicators, visualizationTitle, visualizationDescription, visualizationAccess, usages, }: IAnalyticalDesignerVisualizationInfoProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=VisualizationInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisualizationInfo.d.ts","sourceRoot":"","sources":["../../../src/components/header/VisualizationInfo.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,yCAAyC,EACjD,MAAM,0CAA0C,CAAC;AAiDlD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gCAAgC,GAAG,YAAY,CAkC5F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,MAAM,GACT,EAAE,yCAAyC,2CAY3C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { useSelector } from "react-redux";
|
|
4
|
+
import { Bubble, BubbleHoverTrigger } from "@gooddata/sdk-ui-kit";
|
|
5
|
+
import { renderSlot, useAdSlots } from "../../embedding/slots.js";
|
|
6
|
+
import { isNavigationDisabled as isNavigationDisabledSelector } from "../../selectors/editor_header_selector.js";
|
|
7
|
+
import { isEnabledInsightUsageOnDashboards } from "../../selectors/report_selector.js";
|
|
8
|
+
import { InsightUsageOnDashboards } from "../InsightUsageOnDashboards.js";
|
|
9
|
+
import { DefaultVisualizationDescription, useVisualizationDescriptionProps } from "../ReportDescription.js";
|
|
10
|
+
import { useRequestCancellation } from "./CancelButton.js";
|
|
11
|
+
import { DefaultVisualizationAccess, InsightAccessDialogProvider, useVisualizationAccess, } from "./share/InsightAccess.js";
|
|
12
|
+
import { DefaultVisualizationTitle, useVisualizationTitleProps } from "./VisualizationTitle.js";
|
|
13
|
+
const LOCK_ALIGN_POINTS = [{ align: "bc tl" }];
|
|
14
|
+
const UNSAVED_ALIGN_POINTS = [{ align: "bc tl", offset: { x: 0, y: 0 } }];
|
|
15
|
+
function VisualizationIndicators({ isLocked, hasUnsavedChanges }) {
|
|
16
|
+
const intl = useIntl();
|
|
17
|
+
return (_jsxs(_Fragment, { children: [isLocked ? (_jsxs(BubbleHoverTrigger, { className: "gd-icon-lock-wrapper", showDelay: 0, hideDelay: 0, children: [_jsx("i", { className: "gd-icon-lock" }), _jsx(Bubble, { className: "bubble-primary", alignPoints: LOCK_ALIGN_POINTS, children: intl.formatMessage({ id: "inherited_report" }) })] })) : null, hasUnsavedChanges ? (_jsxs(BubbleHoverTrigger, { children: [_jsx("i", { className: "gd-icon-circle unsaved-notification" }), _jsx(Bubble, { className: "bubble-primary", alignPoints: UNSAVED_ALIGN_POINTS, children: intl.formatMessage({ id: "unsaved_changes" }) })] })) : null] }));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The VisualizationInfo region with its title, description and access slots resolved.
|
|
21
|
+
*/
|
|
22
|
+
export function useVisualizationInfo(context) {
|
|
23
|
+
const slots = useAdSlots();
|
|
24
|
+
const titleProps = useVisualizationTitleProps(context);
|
|
25
|
+
const descriptionProps = useVisualizationDescriptionProps(context);
|
|
26
|
+
const { props: accessProps, dialogContext } = useVisualizationAccess(context);
|
|
27
|
+
const isEnabledUsages = useSelector(isEnabledInsightUsageOnDashboards);
|
|
28
|
+
const isNavigationDisabled = useSelector(isNavigationDisabledSelector);
|
|
29
|
+
const onRequestBack = useRequestCancellation();
|
|
30
|
+
const props = {
|
|
31
|
+
...context,
|
|
32
|
+
visualizationTitle: renderSlot(slots.VisualizationTitle, DefaultVisualizationTitle, titleProps),
|
|
33
|
+
visualizationDescription: renderSlot(slots.VisualizationDescription, DefaultVisualizationDescription, descriptionProps),
|
|
34
|
+
visualizationAccess: (_jsx(InsightAccessDialogProvider, { value: dialogContext, children: renderSlot(slots.VisualizationAccess, DefaultVisualizationAccess, accessProps) })),
|
|
35
|
+
indicators: (_jsx(VisualizationIndicators, { isLocked: titleProps.isLocked, hasUnsavedChanges: context.hasUnsavedChanges })),
|
|
36
|
+
usages: isEnabledUsages ? _jsx(InsightUsageOnDashboards, {}) : null,
|
|
37
|
+
isNavigationDisabled,
|
|
38
|
+
onRequestBack,
|
|
39
|
+
};
|
|
40
|
+
return renderSlot(slots.VisualizationInfo, DefaultVisualizationInfo, props);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Default of the VisualizationInfo slot: the indicators, then the title with its description, access and usages.
|
|
44
|
+
*/
|
|
45
|
+
export function DefaultVisualizationInfo({ hasUnsavedChanges, indicators, visualizationTitle, visualizationDescription, visualizationAccess, usages, }) {
|
|
46
|
+
return (_jsxs("div", { className: "report-title-wrapper", children: [indicators, _jsxs("div", { className: hasUnsavedChanges ? "move-right-animation" : "", children: [visualizationTitle, visualizationDescription, visualizationAccess, usages] })] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerVisualizationTitleProps } from "../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
export declare function useVisualizationTitleProps(context: IAnalyticalDesignerHeaderContext): IAnalyticalDesignerVisualizationTitleProps;
|
|
3
|
+
/**
|
|
4
|
+
* Default of the VisualizationTitle slot: an editable label, or plain text when the title cannot change.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DefaultVisualizationTitle({ title, placeholder, maxLength, isEditable, onTitleChange, }: IAnalyticalDesignerVisualizationTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=VisualizationTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisualizationTitle.d.ts","sourceRoot":"","sources":["../../../src/components/header/VisualizationTitle.tsx"],"names":[],"mappings":"AAYA,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,0CAA0C,EAClD,MAAM,0CAA0C,CAAC;AAUlD,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,gCAAgC,GAC1C,0CAA0C,CAiB5C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,EACtC,KAAK,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,aAAa,GAChB,EAAE,0CAA0C,2CAiB5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2007-2026 GoodData Corporation
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { useSelector } from "react-redux";
|
|
7
|
+
import { EditableLabel } from "@gooddata/sdk-ui-kit";
|
|
8
|
+
import { reportTitleChange } from "../../actions/report_actions.js";
|
|
9
|
+
import { MAX_TITLE_LENGTH } from "../../constants/report.js";
|
|
10
|
+
import { reportTitleSelector } from "../../selectors/report_title_selector.js";
|
|
11
|
+
import { useGuardedCallback } from "./editorHeaderContext.js";
|
|
12
|
+
const canEditTitle = (state) => reportTitleSelector(state).canEditTitle;
|
|
13
|
+
const runTitleChange = (dispatch, _state, title) => dispatch(reportTitleChange(title));
|
|
14
|
+
export function useVisualizationTitleProps(context) {
|
|
15
|
+
const intl = useIntl();
|
|
16
|
+
const { isReportLocked, canEditTitle: isEditable } = useSelector(reportTitleSelector);
|
|
17
|
+
const onTitleChange = useGuardedCallback(canEditTitle, runTitleChange);
|
|
18
|
+
const placeholder = intl.formatMessage({ id: "dialogs.savingUntitledReportConfirmation.placeholder" });
|
|
19
|
+
return useMemo(() => ({
|
|
20
|
+
...context,
|
|
21
|
+
placeholder,
|
|
22
|
+
maxLength: MAX_TITLE_LENGTH,
|
|
23
|
+
isEditable,
|
|
24
|
+
isLocked: isReportLocked,
|
|
25
|
+
onTitleChange,
|
|
26
|
+
}), [context, placeholder, isEditable, isReportLocked, onTitleChange]);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Default of the VisualizationTitle slot: an editable label, or plain text when the title cannot change.
|
|
30
|
+
*/
|
|
31
|
+
export function DefaultVisualizationTitle({ title, placeholder, maxLength, isEditable, onTitleChange, }) {
|
|
32
|
+
if (!isEditable) {
|
|
33
|
+
return _jsx("span", { className: "report-title report-title-locked s-report-title", children: title });
|
|
34
|
+
}
|
|
35
|
+
return (_jsx(EditableLabel, { textareaInOverlay: false, value: title, maxLength: maxLength, maxRows: 1, onSubmit: onTitleChange, className: classNames("report-title", "s-report-title", { "has-defined-title": title !== "" }), placeholder: placeholder, isEditableLabelWidthDynamic: true }));
|
|
36
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IAnalyticalDesignerOpenProps } from "../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
/**
|
|
3
|
+
* The Open control as a dropdown list of visualizations.
|
|
4
|
+
*/
|
|
5
|
+
export declare function VisualizationsDropdown({ workspace: workspaceId, label: buttonText, isDisabled, selectedInsightId: openInsightId, includeTags: tags, excludeTags, enabledVisualizationUrls: enabledVisualizationClassesUrls, isSemanticSearchEnabled: isSmartSearchResultsEnabled, onOpenInsight, }: IAnalyticalDesignerOpenProps): import("react/jsx-runtime").JSX.Element;
|
|
2
6
|
//# sourceMappingURL=VisualizationsDropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualizationsDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/header/VisualizationsDropdown.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VisualizationsDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/header/VisualizationsDropdown.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAmD7F;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACnC,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,UAAU,EACjB,UAAU,EACV,iBAAiB,EAAE,aAAa,EAChC,WAAW,EAAE,IAAI,EACjB,WAAW,EACX,wBAAwB,EAAE,+BAA+B,EACzD,uBAAuB,EAAE,2BAA2B,EACpD,aAAa,GAChB,EAAE,4BAA4B,2CAgR9B"}
|
|
@@ -5,21 +5,16 @@ import { isEmpty } from "lodash-es";
|
|
|
5
5
|
import { defineMessage, useIntl } from "react-intl";
|
|
6
6
|
import { useDispatch, useSelector } from "react-redux";
|
|
7
7
|
import { createSelector, createStructuredSelector } from "reselect";
|
|
8
|
-
import { insightCreated, insightId, insightIsLocked, insightSummary, insightTitle, insightUpdated, insightUri, insightVisualizationUrl,
|
|
8
|
+
import { insightCreated, insightId, insightIsLocked, insightSummary, insightTitle, insightUpdated, insightUri, insightVisualizationUrl, uriRef, } from "@gooddata/sdk-model";
|
|
9
9
|
import { useBackend } from "@gooddata/sdk-ui";
|
|
10
10
|
import { useInsightPagedList } from "@gooddata/sdk-ui-ext";
|
|
11
11
|
import { Dropdown, DropdownButton, DropdownList, InsightListItem, NoData, UiIcon, UiSkeleton, } from "@gooddata/sdk-ui-kit";
|
|
12
12
|
import { customMatcher, useHybridSearch, } from "@gooddata/sdk-ui-semantic-search";
|
|
13
13
|
import { deleteReport } from "../../actions/delete_actions.js";
|
|
14
|
-
import { openReport } from "../../actions/open_actions.js";
|
|
15
14
|
import { descriptionTooltipOpened } from "../../sagas/description_tooltip/description_tooltip_ui_actions.js";
|
|
16
15
|
import { isOwnershipSupported, supportsObjectUris } from "../../selectors/backend_capabilities_selector.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { canOpenReport } from "../../selectors/open_report_selector.js";
|
|
20
|
-
import { openReportIdSelector } from "../../selectors/report_selector.js";
|
|
21
|
-
import { getTagsConfiguration } from "../../selectors/route_selector.js";
|
|
22
|
-
import { getEnabledVisualizationClassesUrls } from "../../services/visualization_class_service.js";
|
|
16
|
+
import { getUserLoginMD5, getUserUri } from "../../selectors/bootstrap_selector.js";
|
|
17
|
+
import { getMetadataTimeZone } from "../../selectors/feature_flag_selector.js";
|
|
23
18
|
import { getIsReadOnlyMode } from "../../store/embedding/embedding_selectors.js";
|
|
24
19
|
const INSIGHT_DROPDOWN_MY_TAB_ID = defineMessage({ id: "gs.visualizationsList.tabs.my" }).id;
|
|
25
20
|
const INSIGHT_DROPDOWN_ALL_TAB_ID = defineMessage({ id: "gs.visualizationsList.tabs.all" }).id;
|
|
@@ -40,49 +35,28 @@ const insightItemBuilder = (item, { ref }) => ({
|
|
|
40
35
|
created: item.createdAt,
|
|
41
36
|
updated: item.modifiedAt,
|
|
42
37
|
});
|
|
43
|
-
const isDisabledSelector = createSelector([canOpenReport], (canOpenReport) => !canOpenReport);
|
|
44
38
|
const authorSelector = createSelector(supportsObjectUris, getUserUri, getUserLoginMD5, (isObjectUriSupported, userUri, userLoginMd5) => {
|
|
45
39
|
return isObjectUriSupported ? userUri : userLoginMd5;
|
|
46
40
|
});
|
|
47
41
|
const tabsIds = { my: INSIGHT_DROPDOWN_MY_TAB_ID, all: INSIGHT_DROPDOWN_ALL_TAB_ID };
|
|
48
42
|
const divider = { divider: true };
|
|
49
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The Open control as a dropdown list of visualizations.
|
|
45
|
+
*/
|
|
46
|
+
export function VisualizationsDropdown({ workspace: workspaceId, label: buttonText, isDisabled, selectedInsightId: openInsightId, includeTags: tags, excludeTags, enabledVisualizationUrls: enabledVisualizationClassesUrls, isSemanticSearchEnabled: isSmartSearchResultsEnabled, onOpenInsight, }) {
|
|
50
47
|
const intl = useIntl();
|
|
51
48
|
const dispatch = useDispatch();
|
|
52
|
-
const workspaceId = useSelector(getProjectId);
|
|
53
49
|
const author = useSelector(authorSelector);
|
|
54
|
-
const isDisabled = useSelector(isDisabledSelector);
|
|
55
|
-
const openInsightId = useSelector(openReportIdSelector);
|
|
56
|
-
const enabledVisualizationClassesUrls = useSelector(getEnabledVisualizationClassesUrls);
|
|
57
50
|
const hasOwnershipSupport = useSelector(isOwnershipSupported);
|
|
58
|
-
const isSmartSearchResultsEnabled = useSelector(enableCatalogSmartSearchResults);
|
|
59
51
|
const metadataTimeZone = useSelector(getMetadataTimeZone);
|
|
60
|
-
const isFilteringByTagsEnabled = useSelector(enableVisualizationFilteringByTags);
|
|
61
|
-
const tagsConfiguration = useSelector(getTagsConfiguration);
|
|
62
52
|
const isReadOnly = useSelector(getIsReadOnlyMode);
|
|
63
|
-
const onOpenInsight = useCallback((insightRef) => {
|
|
64
|
-
dispatch(openReport(insightRef, false));
|
|
65
|
-
}, [dispatch]);
|
|
66
53
|
const onDeleteInsight = useCallback((insightRef, title) => {
|
|
67
54
|
dispatch(deleteReport(insightRef, false, { title }));
|
|
68
55
|
}, [dispatch]);
|
|
69
56
|
const onDescriptionTooltipOpened = useCallback((description) => {
|
|
70
57
|
dispatch(descriptionTooltipOpened(description));
|
|
71
58
|
}, [dispatch]);
|
|
72
|
-
const buttonText = intl.formatMessage({ id: "openReportPlaceholder" });
|
|
73
59
|
const backend = useBackend();
|
|
74
|
-
// Extract tag identifiers from tags configuration only when the feature flag is enabled
|
|
75
|
-
// Tags come as ObjRef (idRef) from route selector, extract identifier directly as the method expects
|
|
76
|
-
// just strings
|
|
77
|
-
const [tags, excludeTags] = useMemo(() => {
|
|
78
|
-
const tags = isFilteringByTagsEnabled
|
|
79
|
-
? tagsConfiguration?.includeObjectsWithTags?.map((tag) => objRefToString(tag))
|
|
80
|
-
: undefined;
|
|
81
|
-
const excludeTags = isFilteringByTagsEnabled
|
|
82
|
-
? tagsConfiguration?.excludeObjectsWithTags?.map((tag) => objRefToString(tag))
|
|
83
|
-
: undefined;
|
|
84
|
-
return [tags, excludeTags];
|
|
85
|
-
}, [isFilteringByTagsEnabled, tagsConfiguration]);
|
|
86
60
|
const { items, totalItemsCount: totalInsightsCount, isLoading, isNextPageLoading, initialLoadCompleted, search, selectedTabId, hasNextPage, skeletonItemsCount, fetchItems, loadNextPage, onSearch, onTabSelect, reset, } = useInsightPagedList({
|
|
87
61
|
backend,
|
|
88
62
|
workspaceId,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerHeaderLayout } from "../../embedding/editorHeaderSlotTypes.js";
|
|
2
|
+
import { type AppDispatch, type IAppState } from "../../store/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Layout of the editor header: the collapsible catalog takes precedence, then the right panel flag removes the
|
|
5
|
+
* catalog-width offset of the legacy header.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEditorHeaderLayout(): IAnalyticalDesignerHeaderLayout;
|
|
8
|
+
/**
|
|
9
|
+
* The data every editor header slot receives.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useEditorHeaderContext(): IAnalyticalDesignerHeaderContext;
|
|
12
|
+
/**
|
|
13
|
+
* A callback for a slot that checks the current state when called, so that a control shown as enabled, or a
|
|
14
|
+
* host calling it at any time, cannot run an operation AD would refuse.
|
|
15
|
+
*
|
|
16
|
+
* @param isAllowed - whether the operation may run in the current state; keep it stable
|
|
17
|
+
* @param run - the operation; keep it stable
|
|
18
|
+
*/
|
|
19
|
+
export declare function useGuardedCallback<TArgs extends unknown[]>(isAllowed: (state: IAppState) => boolean, run: (dispatch: AppDispatch, state: IAppState, ...args: TArgs) => void): (...args: TArgs) => void;
|
|
20
|
+
//# sourceMappingURL=editorHeaderContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorHeaderContext.d.ts","sourceRoot":"","sources":["../../../src/components/header/editorHeaderContext.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EACvC,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGxE;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,+BAA+B,CAevE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,gCAAgC,CAiBzE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,OAAO,EAAE,EACtD,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,EACxC,GAAG,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,GACvE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,IAAI,CAa1B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { useDispatch, useSelector, useStore } from "react-redux";
|
|
4
|
+
import { getProjectId } from "../../selectors/bootstrap_selector.js";
|
|
5
|
+
import { enableGenAiRightPanel } from "../../selectors/feature_flag_selector.js";
|
|
6
|
+
import { insightAccessTarget } from "../../selectors/insight_access_selector.js";
|
|
7
|
+
import { reportTitleSelector } from "../../selectors/report_title_selector.js";
|
|
8
|
+
import { useCatalogSidebar } from "../catalogSidebar/useCatalogSidebarState.js";
|
|
9
|
+
/**
|
|
10
|
+
* Layout of the editor header: the collapsible catalog takes precedence, then the right panel flag removes the
|
|
11
|
+
* catalog-width offset of the legacy header.
|
|
12
|
+
*/
|
|
13
|
+
export function useEditorHeaderLayout() {
|
|
14
|
+
const { canCollapse, isCollapsed } = useCatalogSidebar();
|
|
15
|
+
const isGenAiRightPanelEnabled = useSelector(enableGenAiRightPanel);
|
|
16
|
+
let mode = "legacy";
|
|
17
|
+
if (canCollapse) {
|
|
18
|
+
mode = "catalogSidebar";
|
|
19
|
+
}
|
|
20
|
+
else if (isGenAiRightPanelEnabled) {
|
|
21
|
+
mode = "compact";
|
|
22
|
+
}
|
|
23
|
+
return useMemo(() => ({ mode, isCatalogCollapsed: isCollapsed, canCollapseCatalog: canCollapse }), [mode, isCollapsed, canCollapse]);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The data every editor header slot receives.
|
|
27
|
+
*/
|
|
28
|
+
export function useEditorHeaderContext() {
|
|
29
|
+
const layout = useEditorHeaderLayout();
|
|
30
|
+
const workspace = useSelector(getProjectId);
|
|
31
|
+
const target = useSelector(insightAccessTarget);
|
|
32
|
+
const { currentTitle, hasUnsavedChanges } = useSelector(reportTitleSelector);
|
|
33
|
+
const insightRef = target?.ref;
|
|
34
|
+
return useMemo(() => ({
|
|
35
|
+
layout,
|
|
36
|
+
workspace,
|
|
37
|
+
...(insightRef ? { insightRef } : {}),
|
|
38
|
+
title: currentTitle,
|
|
39
|
+
hasUnsavedChanges,
|
|
40
|
+
}), [layout, workspace, insightRef, currentTitle, hasUnsavedChanges]);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A callback for a slot that checks the current state when called, so that a control shown as enabled, or a
|
|
44
|
+
* host calling it at any time, cannot run an operation AD would refuse.
|
|
45
|
+
*
|
|
46
|
+
* @param isAllowed - whether the operation may run in the current state; keep it stable
|
|
47
|
+
* @param run - the operation; keep it stable
|
|
48
|
+
*/
|
|
49
|
+
export function useGuardedCallback(isAllowed, run) {
|
|
50
|
+
const store = useStore();
|
|
51
|
+
const dispatch = useDispatch();
|
|
52
|
+
return useCallback((...args) => {
|
|
53
|
+
const state = store.getState();
|
|
54
|
+
if (isAllowed(state)) {
|
|
55
|
+
run(dispatch, state, ...args);
|
|
56
|
+
}
|
|
57
|
+
}, [store, dispatch, isAllowed, run]);
|
|
58
|
+
}
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IObjectShareDraft, useObjectAccessLevel } from "@gooddata/sdk-ui-ext";
|
|
2
|
+
import { type IAnalyticalDesignerHeaderContext, type IAnalyticalDesignerVisualizationAccessProps } from "../../../embedding/editorHeaderSlotTypes.js";
|
|
3
|
+
import { getDefaultVisualizationVisibility } from "../../../selectors/feature_flag_selector.js";
|
|
4
|
+
type InsightAccessSummaryHandler = ReturnType<typeof useObjectAccessLevel>["onSummaryChange"];
|
|
5
|
+
/**
|
|
6
|
+
* What the default sharing dialog needs beyond the public props: the staged draft of an unsaved visualization
|
|
7
|
+
* and the summary the dialog reports back. Kept out of the public props because their types are internal.
|
|
8
|
+
*/
|
|
9
|
+
export interface IInsightAccessDialogContext {
|
|
10
|
+
draft: IObjectShareDraft | undefined;
|
|
11
|
+
defaultGeneralAccess: ReturnType<typeof getDefaultVisualizationVisibility>;
|
|
12
|
+
onDraftChange: (draft: IObjectShareDraft) => void;
|
|
13
|
+
onSummaryChange: InsightAccessSummaryHandler;
|
|
14
|
+
onDialogClosed: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const InsightAccessDialogProvider: import("react").Provider<IInsightAccessDialogContext | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Props of the VisualizationAccess slot and the value of {@link InsightAccessDialogProvider} for its default.
|
|
19
|
+
* The access level is read only once a component requests it, so a host's own access control causes no request.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useVisualizationAccess(context: IAnalyticalDesignerHeaderContext): {
|
|
22
|
+
props: IAnalyticalDesignerVisualizationAccessProps;
|
|
23
|
+
dialogContext: IInsightAccessDialogContext;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Default of the VisualizationAccess slot: a chip with the access level that opens the sharing dialog. Renders
|
|
27
|
+
* nothing where the built-in sharing is unavailable.
|
|
28
|
+
*/
|
|
29
|
+
export declare function DefaultVisualizationAccess(props: IAnalyticalDesignerVisualizationAccessProps): import("react/jsx-runtime").JSX.Element | null;
|
|
30
|
+
export {};
|
|
2
31
|
//# sourceMappingURL=InsightAccess.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightAccess.d.ts","sourceRoot":"","sources":["../../../../src/components/header/share/InsightAccess.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InsightAccess.d.ts","sourceRoot":"","sources":["../../../../src/components/header/share/InsightAccess.tsx"],"names":[],"mappings":"AAQA,OAAO,EACH,KAAK,iBAAiB,EAGtB,oBAAoB,EACvB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,2CAA2C,EACnD,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAuBhG,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,iBAAiB,CAAC,CAAC;AAE9F;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IACxC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACrC,oBAAoB,EAAE,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC;IAC3E,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,eAAe,EAAE,2BAA2B,CAAC;IAC7C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC9B;AAID,eAAO,MAAM,2BAA2B,mEAAsC,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gCAAgC,GAAG;IAC/E,KAAK,EAAE,2CAA2C,CAAC;IACnD,aAAa,EAAE,2BAA2B,CAAC;CAC9C,CAuEA;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,2CAA2C,kDAE5F"}
|
|
@@ -1,43 +1,106 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2026 GoodData Corporation
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { defineMessages, useIntl } from "react-intl";
|
|
5
5
|
import { useDispatch, useSelector } from "react-redux";
|
|
6
|
-
import { ObjectShareDialog, useObjectAccessLevel } from "@gooddata/sdk-ui-ext";
|
|
6
|
+
import { ObjectShareDialog, useObjectAccessLevel, } from "@gooddata/sdk-ui-ext";
|
|
7
7
|
import { insightAccessDraftChanged, insightShareDialogClosed, } from "../../../actions/insight_access_actions.js";
|
|
8
8
|
import { getDefaultVisualizationVisibility } from "../../../selectors/feature_flag_selector.js";
|
|
9
|
-
import { canManageInsightAccess, insightAccessTarget } from "../../../selectors/insight_access_selector.js";
|
|
9
|
+
import { canManageInsightAccess, canShareInsight, insightAccessTarget, } from "../../../selectors/insight_access_selector.js";
|
|
10
10
|
import { getLastSavedReportIdentifier } from "../../../selectors/report_selector.js";
|
|
11
|
-
import { currentReportTitle } from "../../../selectors/report_title_selector.js";
|
|
12
11
|
import { getInsightAccessDraft } from "../../../store/insight_access/insight_access_selectors.js";
|
|
13
12
|
import { InsightAccessChip } from "./InsightAccessChip.js";
|
|
14
13
|
const messages = defineMessages({
|
|
15
14
|
untitled: { id: "dialogs.savingUntitledReportConfirmation.placeholder" },
|
|
16
15
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
// The public props use the model's share status; the sharing internals of sdk-ui-ext have their own names.
|
|
17
|
+
const ACCESS_LEVELS = {
|
|
18
|
+
PRIVATE: "private",
|
|
19
|
+
SHARED: "shared",
|
|
20
|
+
WORKSPACE: "public",
|
|
21
|
+
};
|
|
22
|
+
const InsightAccessDialogContext = createContext(undefined);
|
|
23
|
+
export const InsightAccessDialogProvider = InsightAccessDialogContext.Provider;
|
|
24
|
+
/**
|
|
25
|
+
* Props of the VisualizationAccess slot and the value of {@link InsightAccessDialogProvider} for its default.
|
|
26
|
+
* The access level is read only once a component requests it, so a host's own access control causes no request.
|
|
27
|
+
*/
|
|
28
|
+
export function useVisualizationAccess(context) {
|
|
22
29
|
const intl = useIntl();
|
|
23
30
|
const dispatch = useDispatch();
|
|
31
|
+
const isDefaultAvailable = useSelector(canManageInsightAccess);
|
|
32
|
+
const canManageAccess = useSelector(canShareInsight);
|
|
24
33
|
const target = useSelector(insightAccessTarget);
|
|
25
34
|
const draft = useSelector(getInsightAccessDraft);
|
|
26
|
-
const title = useSelector(currentReportTitle);
|
|
27
35
|
const identifier = useSelector(getLastSavedReportIdentifier);
|
|
28
|
-
const
|
|
29
|
-
const [
|
|
36
|
+
const defaultGeneralAccess = useSelector(getDefaultVisualizationVisibility);
|
|
37
|
+
const [isRequested, setIsRequested] = useState(false);
|
|
38
|
+
const isReading = isRequested && isDefaultAvailable;
|
|
30
39
|
const { level, isLoading, onSummaryChange } = useObjectAccessLevel({
|
|
31
40
|
target,
|
|
41
|
+
enabled: isReading,
|
|
32
42
|
draft,
|
|
33
|
-
initialDraftGeneralAccess:
|
|
43
|
+
initialDraftGeneralAccess: defaultGeneralAccess,
|
|
34
44
|
});
|
|
45
|
+
const onRequestAccessSummary = useCallback(() => {
|
|
46
|
+
if (isDefaultAvailable) {
|
|
47
|
+
setIsRequested(true);
|
|
48
|
+
}
|
|
49
|
+
}, [isDefaultAvailable]);
|
|
50
|
+
const objectTitle = context.title.trim() || intl.formatMessage(messages.untitled);
|
|
51
|
+
const accessLevel = isReading && level ? ACCESS_LEVELS[level] : undefined;
|
|
52
|
+
const isAccessLoading = isReading && isLoading;
|
|
53
|
+
const isAccessError = isReading && !isLoading && level === undefined;
|
|
54
|
+
const props = useMemo(() => ({
|
|
55
|
+
...context,
|
|
56
|
+
isDefaultAvailable,
|
|
57
|
+
canManageAccess,
|
|
58
|
+
...(target ? { target } : {}),
|
|
59
|
+
objectTitle,
|
|
60
|
+
...(accessLevel ? { accessLevel } : {}),
|
|
61
|
+
isAccessLoading,
|
|
62
|
+
isAccessError,
|
|
63
|
+
onRequestAccessSummary,
|
|
64
|
+
}), [
|
|
65
|
+
context,
|
|
66
|
+
isDefaultAvailable,
|
|
67
|
+
canManageAccess,
|
|
68
|
+
target,
|
|
69
|
+
objectTitle,
|
|
70
|
+
accessLevel,
|
|
71
|
+
isAccessLoading,
|
|
72
|
+
isAccessError,
|
|
73
|
+
onRequestAccessSummary,
|
|
74
|
+
]);
|
|
75
|
+
const dialogContext = useMemo(() => ({
|
|
76
|
+
draft,
|
|
77
|
+
defaultGeneralAccess,
|
|
78
|
+
onDraftChange: (next) => dispatch(insightAccessDraftChanged(next)),
|
|
79
|
+
onSummaryChange,
|
|
80
|
+
onDialogClosed: () => {
|
|
81
|
+
if (target && identifier) {
|
|
82
|
+
dispatch(insightShareDialogClosed(identifier));
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
}), [draft, defaultGeneralAccess, dispatch, onSummaryChange, target, identifier]);
|
|
86
|
+
return { props, dialogContext };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Default of the VisualizationAccess slot: a chip with the access level that opens the sharing dialog. Renders
|
|
90
|
+
* nothing where the built-in sharing is unavailable.
|
|
91
|
+
*/
|
|
92
|
+
export function DefaultVisualizationAccess(props) {
|
|
93
|
+
return props.isDefaultAvailable ? _jsx(InsightAccessControl, { ...props }) : null;
|
|
94
|
+
}
|
|
95
|
+
function InsightAccessControl({ target, objectTitle, accessLevel, isAccessError, onRequestAccessSummary, }) {
|
|
96
|
+
const dialogContext = useContext(InsightAccessDialogContext);
|
|
97
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
onRequestAccessSummary();
|
|
100
|
+
}, [onRequestAccessSummary]);
|
|
35
101
|
const onClose = () => {
|
|
36
102
|
setIsOpen(false);
|
|
37
|
-
|
|
38
|
-
dispatch(insightShareDialogClosed(identifier));
|
|
39
|
-
}
|
|
103
|
+
dialogContext?.onDialogClosed();
|
|
40
104
|
};
|
|
41
|
-
|
|
42
|
-
return (_jsxs("span", { className: "insight-access", children: [_jsx(InsightAccessChip, { level: level, isLoading: isLoading, isOpen: isOpen, onClick: () => setIsOpen(true) }), isOpen ? (_jsx(ObjectShareDialog, { isOpen: true, onClose: onClose, objectTitle: title.trim() || intl.formatMessage(messages.untitled), target: target, draft: target === undefined, initialDraft: draft, onDraftChange: onDraftChange, onSummaryChange: onSummaryChange, initialDraftGeneralAccess: defaultVisualizationVisibility })) : null] }));
|
|
105
|
+
return (_jsxs("span", { className: "insight-access", children: [_jsx(InsightAccessChip, { level: accessLevel, isLoading: accessLevel === undefined && !isAccessError, isOpen: isOpen, onClick: () => setIsOpen(true) }), isOpen ? (_jsx(ObjectShareDialog, { isOpen: true, onClose: onClose, objectTitle: objectTitle, target: target, draft: target === undefined, initialDraft: dialogContext?.draft, onDraftChange: dialogContext?.onDraftChange, onSummaryChange: dialogContext?.onSummaryChange, initialDraftGeneralAccess: dialogContext?.defaultGeneralAccess })) : null] }));
|
|
43
106
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ShareStatus } from "@gooddata/sdk-model";
|
|
2
2
|
export interface IInsightAccessChipProps {
|
|
3
|
-
level:
|
|
3
|
+
level: ShareStatus | undefined;
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
isOpen?: boolean;
|
|
6
6
|
onClick: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightAccessChip.d.ts","sourceRoot":"","sources":["../../../../src/components/header/share/InsightAccessChip.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"InsightAccessChip.d.ts","sourceRoot":"","sources":["../../../../src/components/header/share/InsightAccessChip.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAqBvD,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,uBAAuB,2CAyC/F"}
|
|
@@ -14,9 +14,9 @@ const messages = defineMessages({
|
|
|
14
14
|
fallbackLabel: { id: "insightAccess.share" },
|
|
15
15
|
});
|
|
16
16
|
const LEVELS = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
private: { icon: "invisible", label: messages.privateLabel, tooltip: messages.privateTooltip },
|
|
18
|
+
shared: { icon: "users", label: messages.sharedLabel, tooltip: messages.sharedTooltip },
|
|
19
|
+
public: { icon: "building", label: messages.workspaceLabel, tooltip: messages.workspaceTooltip },
|
|
20
20
|
};
|
|
21
21
|
export function InsightAccessChip({ level, isLoading, isOpen, onClick }) {
|
|
22
22
|
const intl = useIntl();
|
|
@@ -61,7 +61,7 @@ export interface IAnalyticalDesignerEmbeddedProps {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Analytical Designer rendered in-process as a React component — the iframe-free alternative to
|
|
64
|
-
* embedding the deployed AD app. Communication uses the same
|
|
64
|
+
* embedding the deployed AD app. Communication uses the same `@gooddata/sdk-embedding` contract as
|
|
65
65
|
* the postMessage transport, carried over the host adapter: events arrive through `callbacks`,
|
|
66
66
|
* commands are sent through `apiRef`.
|
|
67
67
|
*
|
|
@@ -38,7 +38,7 @@ const NOOP_TELEMETRY = {
|
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Analytical Designer rendered in-process as a React component — the iframe-free alternative to
|
|
41
|
-
* embedding the deployed AD app. Communication uses the same
|
|
41
|
+
* embedding the deployed AD app. Communication uses the same `@gooddata/sdk-embedding` contract as
|
|
42
42
|
* the postMessage transport, carried over the host adapter: events arrive through `callbacks`,
|
|
43
43
|
* commands are sent through `apiRef`.
|
|
44
44
|
*
|