@gooddata/sdk-ui-semantic-search 11.39.0-alpha.3 → 11.39.0

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.
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
3
3
  import { type GenAIObjectType, type ISemanticSearchRelationship, type ISemanticSearchResultItem } from "@gooddata/sdk-model";
4
+ import { type UIPathOptions } from "../utils/getUIPath.js";
4
5
  export type SearchOnSelect = {
5
6
  item: ISemanticSearchResultItem | ISemanticSearchRelationship;
6
7
  index: number;
@@ -77,6 +78,10 @@ export type SearchOverlayProps = {
77
78
  * The list of tags the returned objects must not have.
78
79
  */
79
80
  excludeTags?: string[];
81
+ /**
82
+ * Options for building UI paths for search result links.
83
+ */
84
+ uiPathOptions?: UIPathOptions;
80
85
  /**
81
86
  * A function to render the footer of the search overlay.
82
87
  */
@@ -49,7 +49,7 @@ const THRESHOLD = 0.5;
49
49
  * Core implementation of the SemanticSearchOverlay component.
50
50
  */
51
51
  function SearchOverlayCore(props) {
52
- const { onSelect, onSearch, backend, workspace, objectTypes, deepSearch, canManage, canFullControl, canAnalyze, limit = LIMIT, className, threshold = THRESHOLD, renderFooter, includeTags, excludeTags, } = props;
52
+ const { onSelect, onSearch, backend, workspace, objectTypes, deepSearch, canManage, canFullControl, canAnalyze, limit = LIMIT, className, threshold = THRESHOLD, renderFooter, includeTags, excludeTags, uiPathOptions, } = props;
53
53
  const canEdit = canFullControl || canManage || canAnalyze;
54
54
  const allowedRelationshipTypes = canEdit ? undefined : ALLOWED_RELATIONSHIP_TYPES_FOR_VIEWER;
55
55
  const intl = useIntl();
@@ -162,6 +162,7 @@ function SearchOverlayCore(props) {
162
162
  relationships,
163
163
  threshold,
164
164
  canEdit,
165
+ uiPathOptions,
165
166
  });
166
167
  if (!items.length) {
167
168
  return (_jsxs(_Fragment, { children: [
@@ -1,5 +1,6 @@
1
1
  import type { IntlShape } from "react-intl";
2
2
  import type { ISemanticSearchRelationship, ISemanticSearchResultItem } from "@gooddata/sdk-model";
3
+ import { type UIPathOptions } from "../utils/getUIPath.js";
3
4
  import { type SearchTreeViewItem } from "./LeveledSearchTreeView.js";
4
5
  type BuildSearchOverlayItemsProps = {
5
6
  intl: IntlShape;
@@ -8,6 +9,7 @@ type BuildSearchOverlayItemsProps = {
8
9
  workspace?: string;
9
10
  threshold?: number;
10
11
  canEdit?: boolean;
12
+ uiPathOptions?: UIPathOptions;
11
13
  };
12
- export declare function buildSemanticSearchTreeViewItems({ intl, workspace, searchResults, relationships, threshold, canEdit }: BuildSearchOverlayItemsProps): SearchTreeViewItem[];
14
+ export declare function buildSemanticSearchTreeViewItems({ intl, workspace, searchResults, relationships, threshold, canEdit, uiPathOptions }: BuildSearchOverlayItemsProps): SearchTreeViewItem[];
13
15
  export {};
@@ -2,7 +2,7 @@
2
2
  import { thresholdFilter } from "../filters/items.filters.js";
3
3
  import { getUIPath } from "../utils/getUIPath.js";
4
4
  import { getItemRelationships, isItemLocked, isRelationshipLocked } from "../utils/searchItem.js";
5
- export function buildSemanticSearchTreeViewItems({ intl, workspace = "", searchResults, relationships, threshold = 0.8, canEdit = false, }) {
5
+ export function buildSemanticSearchTreeViewItems({ intl, workspace = "", searchResults, relationships, threshold = 0.8, canEdit = false, uiPathOptions, }) {
6
6
  return searchResults
7
7
  .filter(thresholdFilter(threshold))
8
8
  .sort((a, b) => (b.score ?? 0) - (a.score ?? 0))
@@ -10,7 +10,7 @@ export function buildSemanticSearchTreeViewItems({ intl, workspace = "", searchR
10
10
  // Items are not actually disabled, but we need to display the lock icon for locked items,
11
11
  // so this API is used for that purpose as a convenience.
12
12
  const isDisabled = isItemLocked(item, workspace);
13
- const url = getUIPath(item.type, item.id, workspace);
13
+ const url = getUIPath(item.type, item.id, workspace, undefined, uiPathOptions);
14
14
  // Do not show relationships for dashboard items
15
15
  if (item.type === "dashboard") {
16
16
  return {
@@ -26,7 +26,7 @@ export function buildSemanticSearchTreeViewItems({ intl, workspace = "", searchR
26
26
  const rels = getItemRelationships(item, relationships);
27
27
  const children = rels.map((relationship) => {
28
28
  const isDisabled = isRelationshipLocked(relationship, workspace);
29
- const url = getUIPath("dashboardVisualization", relationship.sourceObjectId, workspace, item.id);
29
+ const url = getUIPath("dashboardVisualization", relationship.sourceObjectId, workspace, item.id, uiPathOptions);
30
30
  return {
31
31
  item: {
32
32
  id: relationship.sourceObjectId,
@@ -3,6 +3,9 @@
3
3
  * @internal
4
4
  */
5
5
  export type UIPathObjectTypes = "dashboard" | "dashboardVisualization" | "visualization" | "metric" | "dataset" | "date" | "fact" | "attribute" | "label";
6
+ export type UIPathOptions = {
7
+ useHostedMetricEditor?: boolean;
8
+ };
6
9
  /**
7
10
  * Get the UI path for the given object type, object ID, and workspace ID.
8
11
  * TODO - this logic should live in gdc-ui repo, would require refactoring of the sdk-ui-semantic-search
@@ -10,4 +13,4 @@ export type UIPathObjectTypes = "dashboard" | "dashboardVisualization" | "visual
10
13
  * - gdc-ui would need to inject the URL between the data is loaded and the render
11
14
  * @internal
12
15
  */
13
- export declare const getUIPath: (objectType: UIPathObjectTypes, objectId: string, workspaceId: string, visualizationId?: string | undefined) => string;
16
+ export declare const getUIPath: (objectType: UIPathObjectTypes, objectId: string, workspaceId: string, visualizationId?: string | undefined, options?: UIPathOptions) => string;
@@ -1,4 +1,4 @@
1
- // (C) 2024-2025 GoodData Corporation
1
+ // (C) 2024-2026 GoodData Corporation
2
2
  /**
3
3
  * Get the UI path for the given object type, object ID, and workspace ID.
4
4
  * TODO - this logic should live in gdc-ui repo, would require refactoring of the sdk-ui-semantic-search
@@ -6,7 +6,7 @@
6
6
  * - gdc-ui would need to inject the URL between the data is loaded and the render
7
7
  * @internal
8
8
  */
9
- export const getUIPath = (objectType, objectId, workspaceId, visualizationId) => {
9
+ export const getUIPath = (objectType, objectId, workspaceId, visualizationId, options = {}) => {
10
10
  switch (objectType) {
11
11
  case "dashboard":
12
12
  return `/dashboards/#/workspace/${workspaceId}/dashboard/${objectId}`;
@@ -15,6 +15,9 @@ export const getUIPath = (objectType, objectId, workspaceId, visualizationId) =>
15
15
  case "visualization":
16
16
  return `/analyze/#/${workspaceId}/${objectId}/edit`;
17
17
  case "metric":
18
+ if (options.useHostedMetricEditor) {
19
+ return `/workspace/${workspaceId}/metrics/metric/${objectId}`;
20
+ }
18
21
  return `/metrics/#/${workspaceId}/metric/${objectId}`;
19
22
  case "dataset":
20
23
  return `/modeler/#/${workspaceId}`; // TODO - deep links
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-semantic-search",
3
- "version": "11.39.0-alpha.3",
3
+ "version": "11.39.0",
4
4
  "description": "GoodData SDK TypeScript & React skeleton",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -35,12 +35,12 @@
35
35
  "lodash-es": "^4.17.23",
36
36
  "react-intl": "7.1.11",
37
37
  "tslib": "2.8.1",
38
- "@gooddata/sdk-model": "11.39.0-alpha.3",
39
- "@gooddata/sdk-backend-spi": "11.39.0-alpha.3",
40
- "@gooddata/sdk-ui": "11.39.0-alpha.3",
41
- "@gooddata/sdk-ui-theme-provider": "11.39.0-alpha.3",
42
- "@gooddata/sdk-ui-kit": "11.39.0-alpha.3",
43
- "@gooddata/util": "11.39.0-alpha.3"
38
+ "@gooddata/sdk-model": "11.39.0",
39
+ "@gooddata/sdk-backend-spi": "11.39.0",
40
+ "@gooddata/sdk-ui": "11.39.0",
41
+ "@gooddata/sdk-ui-kit": "11.39.0",
42
+ "@gooddata/sdk-ui-theme-provider": "11.39.0",
43
+ "@gooddata/util": "11.39.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@microsoft/api-documenter": "^7.17.0",
@@ -80,11 +80,11 @@
80
80
  "typescript": "5.9.3",
81
81
  "vitest": "4.1.0",
82
82
  "vitest-dom": "0.1.1",
83
- "@gooddata/eslint-config": "11.39.0-alpha.3",
84
- "@gooddata/oxlint-config": "11.39.0-alpha.3",
85
- "@gooddata/sdk-backend-mockingbird": "11.39.0-alpha.3",
86
- "@gooddata/stylelint-config": "11.39.0-alpha.3",
87
- "@gooddata/i18n-toolkit": "11.39.0-alpha.3"
83
+ "@gooddata/eslint-config": "11.39.0",
84
+ "@gooddata/oxlint-config": "11.39.0",
85
+ "@gooddata/i18n-toolkit": "11.39.0",
86
+ "@gooddata/stylelint-config": "11.39.0",
87
+ "@gooddata/sdk-backend-mockingbird": "11.39.0"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "react": "^18.0.0 || ^19.0.0",