diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js
index 0a5d95ef1dc..c0d9200a463 100644
--- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js
+++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js
@@ -818,4 +818,128 @@ describe('Data Quality and Profiler should work properly', () => {
expect(text).to.eq('Table test case display name');
});
});
+
+ it('Update profiler setting modal', () => {
+ const profilerSetting = {
+ profileSample: 60,
+ sampleDataCount: 100,
+ profileQuery: 'select * from table',
+ excludeColumns: 'user_id',
+ includeColumns: 'shop_id',
+ partitionColumnName: 'name',
+ partitionIntervalType: 'COLUMN-VALUE',
+ partitionValues: 'test',
+ };
+ interceptURL('GET', '/api/v1/tables/*/tableProfile?*', 'tableProfiler');
+ interceptURL('GET', '/api/v1/tables/*/systemProfile?*', 'systemProfiler');
+ interceptURL(
+ 'GET',
+ '/api/v1/tables/*/tableProfilerConfig*',
+ 'tableProfilerConfig'
+ );
+ visitEntityDetailsPage({
+ term: DATABASE_SERVICE.entity.name,
+ serviceName: DATABASE_SERVICE.service.name,
+ entity: DATA_ASSETS.tables,
+ });
+ cy.get('[data-testid="profiler"]').should('be.visible').click();
+ verifyResponseStatusCode('@tableProfiler', 200);
+ verifyResponseStatusCode('@systemProfiler', 200);
+ cy.get('[data-testid="profiler-setting-btn"]').click();
+ verifyResponseStatusCode('@tableProfilerConfig', 200);
+ cy.get('.ant-modal-body').should('be.visible');
+ cy.get('[data-testid="slider-input"]')
+ .clear()
+ .type(profilerSetting.profileSample);
+ cy.get('[data-testid="sample-data-count-input"]')
+ .clear()
+ .type(profilerSetting.sampleDataCount);
+ cy.get('[data-testid="exclude-column-select"]')
+ .scrollIntoView()
+ .type(`${profilerSetting.excludeColumns}{enter}`);
+ cy.clickOutside();
+ cy.get('.CodeMirror-scroll')
+ .scrollIntoView()
+ .click()
+ .type(profilerSetting.profileQuery);
+
+ cy.get('[data-testid="include-column-select"]').scrollIntoView().click();
+ cy.get('.ant-select-dropdown')
+ .not('.ant-select-dropdown-hidden')
+ .find(`[title="${profilerSetting.includeColumns}"]`)
+ .click();
+ cy.get('[data-testid="enable-partition-switch"]').scrollIntoView().click();
+ cy.get('[data-testid="interval-type"]').scrollIntoView().click();
+ cy.get('.ant-select-dropdown')
+ .not('.ant-select-dropdown-hidden')
+ .find(`[title="${profilerSetting.partitionIntervalType}"]`)
+ .click();
+ cy.get('[data-testid="column-name"]').click();
+ cy.get('.ant-select-dropdown')
+ .not('.ant-select-dropdown-hidden')
+ .find(`[title="${profilerSetting.partitionColumnName}"]`)
+ .click();
+ cy.get('[data-testid="partition-value"]')
+ .scrollIntoView()
+ .type(profilerSetting.partitionValues);
+
+ interceptURL(
+ 'PUT',
+ '/api/v1/tables/*/tableProfilerConfig',
+ 'updateTableProfilerConfig'
+ );
+ cy.get('.ant-modal-footer').contains('Save').scrollIntoView().click();
+ cy.wait('@updateTableProfilerConfig').then(({ request }) => {
+ expect(request.body).to.deep.equal({
+ excludeColumns: ['user_id'],
+ profileQuery: 'select * from table',
+ profileSample: 60,
+ profileSampleType: 'PERCENTAGE',
+ includeColumns: [{ columnName: 'shop_id' }],
+ partitioning: {
+ partitionColumnName: 'name',
+ partitionIntervalType: 'COLUMN-VALUE',
+ partitionValues: ['test'],
+ enablePartitioning: true,
+ },
+ sampleDataCount: 100,
+ });
+ });
+
+ cy.reload();
+ // verify profiler setting details
+ verifyResponseStatusCode('@tableProfiler', 200);
+ verifyResponseStatusCode('@systemProfiler', 200);
+ cy.get('[data-testid="profiler-setting-btn"]').click();
+ verifyResponseStatusCode('@tableProfilerConfig', 200);
+
+ cy.get('[data-testid="slider-input"]').should(
+ 'have.value',
+ `${profilerSetting.profileSample}%`
+ );
+ cy.get('.CodeMirror-scroll').should(
+ 'contain',
+ profilerSetting.profileQuery
+ );
+ cy.get('[data-testid="exclude-column-select"]').should(
+ 'contain',
+ profilerSetting.excludeColumns
+ );
+ cy.get('[data-testid="enable-partition-switch"]').should(
+ 'have.value',
+ 'true'
+ );
+ cy.get('[data-testid="interval-type"]').should(
+ 'contain',
+ profilerSetting.partitionIntervalType
+ );
+ cy.get('[data-testid="column-name"]').should(
+ 'contain',
+ profilerSetting.partitionColumnName
+ );
+ cy.get('[data-testid="partition-value"]').should(
+ 'have.value',
+ profilerSetting.partitionValues
+ );
+ });
});
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.test.tsx
index 1de8593d2b1..a6c713259bb 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.test.tsx
@@ -14,12 +14,14 @@
import {
act,
cleanup,
+ findByText,
fireEvent,
render,
screen,
} from '@testing-library/react';
import React from 'react';
import { MOCK_TABLE } from '../../../mocks/TableData.mock';
+import { getTableProfilerConfig } from '../../../rest/tableAPI';
import { ProfilerSettingsModalProps } from '../TableProfiler.interface';
import ProfilerSettingsModal from './ProfilerSettingsModal';
@@ -103,4 +105,69 @@ describe('Test ProfilerSettingsModal component', () => {
expect(intervalType).not.toHaveClass('ant-select-disabled');
expect(columnName).not.toHaveClass('ant-select-disabled');
});
+
+ it('initial values should be visible in the form', async () => {
+ const tableProfilerConfig = {
+ profileSample: 60.0,
+ profileSampleType: 'PERCENTAGE',
+ sampleDataCount: 500,
+ profileQuery: 'select * from table',
+ excludeColumns: ['address_id'],
+ includeColumns: [
+ {
+ columnName: 'first_name',
+ },
+ ],
+ partitioning: {
+ enablePartitioning: true,
+ partitionColumnName: 'last_name',
+ partitionIntervalType: 'COLUMN-VALUE',
+ partitionValues: ['test'],
+ },
+ };
+ (getTableProfilerConfig as jest.Mock).mockImplementationOnce(() =>
+ Promise.resolve({ ...MOCK_TABLE, tableProfilerConfig })
+ );
+ render();
+
+ const excludeSelect = await screen.findByTestId('exclude-column-select');
+ const includeSelect = await screen.findByTestId('include-column-select');
+ const partitionSwitch = await screen.findByTestId(
+ 'enable-partition-switch'
+ );
+ const intervalType = await screen.findByTestId('interval-type');
+ const columnName = await screen.findByTestId('column-name');
+
+ expect(await screen.findByTestId('sample-data-count-input')).toHaveValue(
+ tableProfilerConfig.sampleDataCount.toString()
+ );
+ expect(await screen.findByTestId('slider-input')).toHaveValue(
+ `${tableProfilerConfig.profileSample}%`
+ );
+ expect(await screen.findByTestId('partition-value')).toHaveValue(
+ tableProfilerConfig.partitioning.partitionValues[0]
+ );
+ expect(
+ await findByText(excludeSelect, tableProfilerConfig.excludeColumns[0])
+ ).toBeInTheDocument();
+ expect(
+ await findByText(
+ includeSelect,
+ tableProfilerConfig.includeColumns[0].columnName
+ )
+ ).toBeInTheDocument();
+ expect(
+ await findByText(
+ intervalType,
+ tableProfilerConfig.partitioning.partitionIntervalType
+ )
+ ).toBeInTheDocument();
+ expect(
+ await findByText(
+ columnName,
+ tableProfilerConfig.partitioning.partitionColumnName
+ )
+ ).toBeInTheDocument();
+ expect(partitionSwitch).toHaveAttribute('aria-checked', 'true');
+ });
});
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.tsx
index ffb8a104543..171c790ed5a 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/Component/ProfilerSettingsModal.tsx
@@ -171,6 +171,9 @@ const ProfilerSettingsModal: React.FC = ({
profileSampleType ?? ProfileSampleType.Percentage,
sampleDataCount,
});
+ form.setFieldsValue({
+ sampleDataCount: sampleDataCount ?? initialState.sampleDataCount,
+ });
const profileSampleTypeCheck =
profileSampleType === ProfileSampleType.Percentage;
@@ -575,7 +578,7 @@ const ProfilerSettingsModal: React.FC = ({
name={[name, 'columnName']}>