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
68 changes: 68 additions & 0 deletions .github/playwright/impact-map.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -7979,6 +7979,7 @@
"openmetadata-ui/src/main/resources/ui/src/components/SearchSettings/EntitySeachSettings/EntitySearchSettings.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts",
"playwright/e2e/Search/SearchRelevance.spec.ts"
]
Expand All @@ -7988,6 +7989,7 @@
"openmetadata-ui/src/main/resources/ui/src/components/SearchSettings/FieldConfiguration/FieldConfiguration.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/CustomProperties.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
Expand Down Expand Up @@ -8027,6 +8029,7 @@
"playwright/e2e/Features/MetricAssets.spec.ts",
"playwright/e2e/Features/OnlineUsers.spec.ts",
"playwright/e2e/Features/Pagination.spec.ts",
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Features/SchemaSearch.spec.ts",
"playwright/e2e/Features/Table.spec.ts",
"playwright/e2e/Flow/PersonaFlow.spec.ts",
Expand Down Expand Up @@ -10532,6 +10535,70 @@
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/EntitySearchSettings.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/CustomProperties.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/FieldValueBoostTable.tsx"
],
"specs": [
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/GlobalSearchSettings.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/MatchingFieldCard.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/CustomProperties.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/RankingSection.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Search/SearchRelevance.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/SearchPreviewPanel.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Search/SearchRelevance.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/platform-settings/search/SearchSettingsView.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
},
{
"sources": [
"openmetadata-ui/src/main/resources/ui/src/components/integration/ConnectionServiceDetailsPage/ConnectionServiceDetailsPage.tsx"
Expand Down Expand Up @@ -12448,6 +12515,7 @@
"openmetadata-ui/src/main/resources/ui/src/pages/SearchSettingsPage/SearchSettingsPage.tsx"
],
"specs": [
"playwright/e2e/Features/ProfilePlatformSettings.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ test.describe(
['lineage', 'lineage-settings'],
['brand-url', 'brand-url-settings'],
['learning-resources', 'learning-resources-settings'],
['search', 'search-settings'],
['app-mode', 'default-app-mode-page'],
];

Expand Down Expand Up @@ -710,5 +711,160 @@ test.describe(
await afterAction();
}
});

test('search: global settings save the full config on each change', async ({
page,
}) => {
const settings = await stubSettingRoundTrip(page, 'searchSettings');
await openPlatformSettings(page);
await openCard(page, 'search');
await expect(page.getByTestId('search-settings')).toBeVisible({
timeout: 30_000,
});

const accessControl = page
.getByTestId('enable-roles-polices-in-search-switch')
.locator('input');
const wasEnabled = await accessControl.isChecked();
await clickAndWaitFor(
page,
page.getByTestId('enable-roles-polices-in-search-switch'),
SETTINGS_PUT
);

const saved = settings.puts[0].config_value as {
globalSettings: { enableAccessControl: boolean };
assetTypeConfigurations: unknown[];
};

expect(saved.globalSettings.enableAccessControl).toBe(!wasEnabled);
// The whole document is saved, not just the changed flag.
expect(saved.assetTypeConfigurations.length).toBeGreaterThan(0);

await page.getByTestId('global-setting-edit-maxResultHits').click();
const input = page.getByTestId('global-setting-input-maxResultHits');
await input.fill('50');
await expect(
page.getByTestId('global-setting-save-maxResultHits')
).toBeDisabled();
await input.fill('500');
await clickAndWaitFor(
page,
page.getByTestId('global-setting-save-maxResultHits'),
SETTINGS_PUT
);

expect(
(settings.puts[1].config_value as { globalSettings: object })
.globalSettings
).toEqual(expect.objectContaining({ maxResultHits: 500 }));
await expect(
page.getByTestId('global-setting-value-maxResultHits')
).toHaveText('500');
});

test('search: reset restores the defaults only after confirmation', async ({
page,
}) => {
// Never reset the shared tenant's settings.
let resets = 0;
await page.route(
'**/api/v1/system/settings/reset/searchSettings',
(route) => {
resets += 1;

return route.fulfill({ json: {} });
}
);
await openPlatformSettings(page);
await openCard(page, 'search');
await expect(page.getByTestId('search-settings')).toBeVisible({
timeout: 30_000,
});

await header(page).getByTestId('reset-search-settings-btn').click();
await page.getByTestId('reset-search-settings-dialog-cancel').click();
expect(resets).toBe(0);

await header(page).getByTestId('reset-search-settings-btn').click();
await clickAndWaitFor(
page,
page.getByTestId('reset-search-settings-dialog-confirm'),
'**/api/v1/system/settings/reset/searchSettings'
);
expect(resets).toBe(1);
await toastNotification(page, /updated successfully/);
});

test('search: an entity page previews the draft and saves it', async ({
page,
}) => {
const settings = await stubSettingRoundTrip(page, 'searchSettings');
await openPlatformSettings(page);
await openCard(page, 'search');
await page.getByTestId('search-entity-card-tables').click();

await expect(page.getByTestId('entity-search-settings')).toBeVisible({
timeout: 30_000,
});
await expect(header(page)).toContainText('Table');
await expect(page.getByTestId('ranking-settings')).toBeVisible();
await expect(page.getByTestId('search-preview')).toBeVisible();
await expect(header(page).getByTestId('save-btn')).toBeDisabled();

// A field the default table configuration always matches on.
const fieldName = 'displayName.keyword';
const field = page.getByTestId(`field-configuration-panel-${fieldName}`);

// Removing a field re-runs the preview with the unsaved draft.
const previewWithoutField = page.waitForRequest((request) => {
if (!request.url().includes('/api/v1/search/preview')) {
return false;
}
const table = (
request.postDataJSON() as {
searchSettings: {
assetTypeConfigurations: {
assetType: string;
searchFields?: { field: string }[];
}[];
};
}
).searchSettings.assetTypeConfigurations.find(
(config) => config.assetType === 'table'
);

return !table?.searchFields?.some((field) => field.field === fieldName);
});
await field.getByTestId('delete-search-field').click();
await previewWithoutField;
await expect(field).toHaveCount(0);

await clickAndWaitFor(
page,
header(page).getByTestId('save-btn'),
SETTINGS_PUT
);

const table = (
settings.puts[0].config_value as {
assetTypeConfigurations: {
assetType: string;
searchFields: { field: string }[];
}[];
}
).assetTypeConfigurations.find((config) => config.assetType === 'table');

expect(table?.searchFields.map((field) => field.field)).not.toContain(
fieldName
);
await expect(header(page).getByTestId('save-btn')).toBeDisabled();

await header(page)
.getByLabel('Breadcrumb')
.getByText('Search', { exact: true })
.click();
await expect(page.getByTestId('search-settings')).toBeVisible();
});
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright 2026 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
Button,
Dialog,
Modal,
ModalOverlay,
Typography,
} from '@openmetadata/ui-core-components';
import { useTranslation } from 'react-i18next';

interface ConfirmDialogProps {
isOpen: boolean;
title: string;
message: string;
confirmLabel: string;
isLoading?: boolean;
isDestructive?: boolean;
testId: string;
onConfirm: () => void;
onCancel: () => void;
}

const ConfirmDialog = ({
isOpen,
title,
message,
confirmLabel,
isLoading,
isDestructive,
testId,
onConfirm,
onCancel,
}: ConfirmDialogProps) => {
const { t } = useTranslation();

return (
<ModalOverlay
isDismissable={!isLoading}
isOpen={isOpen}
onOpenChange={(open) => !open && onCancel()}>
<Modal>
<Dialog
showCloseButton
data-testid={testId}
dividers="scroll"
title={title}
width={480}
onClose={onCancel}>
<Dialog.Content>
<Typography className="tw:text-tertiary" size="text-sm">
{message}
</Typography>
</Dialog.Content>
<Dialog.Footer>
<div className="tw:col-span-2 tw:flex tw:justify-end tw:gap-3">
<Button
color="tertiary"
data-testid={`${testId}-cancel`}
isDisabled={isLoading}
size="sm"
onPress={onCancel}>
{t('label.cancel')}
</Button>
<Button
color={isDestructive ? 'primary-destructive' : 'primary'}
data-testid={`${testId}-confirm`}
isLoading={isLoading}
size="sm"
onPress={onConfirm}>
{confirmLabel}
</Button>
</div>
</Dialog.Footer>
</Dialog>
</Modal>
</ModalOverlay>
);
};

export default ConfirmDialog;
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ import {
Lock01,
Mail01,
RunProfiler,
Search,
SwitchHorizontal01,
} from '@openmetadata/ui-core-components/icons';
import { startCase } from 'lodash';
import { ENTITY_PATH } from '../../../../../../constants/constants';
import { isLoginConfigurationApplicable } from '../../../../../../utils/AuthProvider.util';
import type { PlatformSettingsPage } from './PlatformSettings.types';

Expand Down Expand Up @@ -84,6 +87,15 @@ export const PLATFORM_SETTINGS_PAGES: PlatformSettingsPage[] = [
descriptionKey: 'message.page-sub-header-for-lineage-config-setting',
hasEditView: true,
},
{
id: 'search',
icon: Search,
titleKey: 'label.search',
descriptionKey: 'message.page-sub-header-for-search-setting',
hasItemViews: true,
getItemTitle: (_t, itemId) =>
startCase(ENTITY_PATH[itemId as keyof typeof ENTITY_PATH] ?? itemId),
},
{
id: 'brand-url',
icon: Link01,
Expand Down
Loading
Loading