Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: #11346 Add UI Support to Add Custom Profiler Metrics #14132

Merged
merged 30 commits into from
Dec 11, 2023

Conversation

ShaileshParmar11
Copy link
Contributor

@ShaileshParmar11 ShaileshParmar11 commented Nov 27, 2023

fixs #11346

  • Refactor Profiler tab
  • Integrated Custom metric for table and column
  • Added Unit test for new component
  • Added E2E cypress test for custom metric flow and covered below criteria
    • Add table custom metric (it will add and validate the newly added metric)
    • Edit table custom metric
    • Delete table custom metric
    • Add column custom metric (it will add and validate the newly added metric)
    • Edit column custom metric
    • Delete column custom metric
  • Table custom metric
Screen.Recording.2023-12-05.at.6.06.58.PM.mov
  • Column custom metric
Screen.Recording.2023-12-05.at.6.08.36.PM.mov

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@github-actions github-actions bot added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Nov 27, 2023
Copy link
Contributor

github-actions bot commented Nov 27, 2023

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 49%
49.39% (24568/49739) 32.02% (9587/29942) 30.56% (2776/9083)

@ShaileshParmar11 ShaileshParmar11 self-assigned this Nov 28, 2023
Copy link
Contributor

The Java checkstyle failed.

Please run mvn googleformatter:format@reformat-sources in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Java code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@ShaileshParmar11 ShaileshParmar11 changed the title #11346 Add UI Support to Add Custom Profiler Metrics Feat: #11346 Add UI Support to Add Custom Profiler Metrics Dec 5, 2023
@ShaileshParmar11 ShaileshParmar11 marked this pull request as ready for review December 5, 2023 12:43
const addButtonContent = [
{
label: <TabsLabel id="test-case" name={t('label.test-case')} />,
key: '1',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
key: '1',
key: 'test-case',

},
{
label: <TabsLabel id="metric" name={t('label.custom-metric')} />,
key: '2',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
key: '2',
key: 'custom-metric',

Comment on lines 102 to 128
const testCaseTypeOption = useMemo(() => {
const testCaseStatus: DefaultOptionType[] = map(TestType, (value, key) => ({
label: key,
value: value,
}));
testCaseStatus.unshift({
label: t('label.all'),
value: '',
});

return testCaseStatus;
}, []);

const testCaseStatusOption = useMemo(() => {
const testCaseStatus: DefaultOptionType[] = Object.values(
TestCaseStatus
).map((value) => ({
label: value,
value: value,
}));
testCaseStatus.unshift({
label: t('label.all'),
value: '',
});

return testCaseStatus;
}, []);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have this things as const to execute it only once and use it across

);

return searchData as { activeTab: string; activeColumnFqn: string };
}, [location.search, isTourOpen]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please import location from useLocation

Comment on lines 50 to 52
export const TableProfilerContext = createContext<TableProfilerContextType>(
{} as TableProfilerContextType
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface

);

return searchData as { activeTab: string; activeColumnFqn: string };
}, [location.search, isTourOpen]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import location from useLocation

Comment on lines 88 to 90
const isColumnProfile = activeTab === TableProfilerTab.COLUMN_PROFILE;
const isDataQuality = activeTab === TableProfilerTab.DATA_QUALITY;
const isTableProfile = activeTab === TableProfilerTab.TABLE_PROFILE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

// As we are encoding the fqn in API function to apply all over the application
// and the datasetFQN comes form url parameter which is already encoded,
// we are decoding FQN below to avoid double encoding in the API function
const decodedDatasetFQN = decodeURIComponent(datasetFQN);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const decodedDatasetFQN = decodeURIComponent(datasetFQN);
const decodedDatasetFQN = getDecodedFQN(datasetFQN);

@@ -63,6 +63,8 @@ const DeleteWidgetModal = ({
afterDeleteAction,
successMessage,
deleteOptions,
onDelete,
loading = false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why loading for Modal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's for the submit button, as we are also providing an option for onDelete, we also need to provide a loading option for that.

Copy link

[open-metadata-ui] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Comment on lines +231 to +248
const fetchProfiler =
!isTableDeleted &&
datasetFQN &&
!isTourOpen &&
[
TableProfilerTab.TABLE_PROFILE,
TableProfilerTab.COLUMN_PROFILE,
].includes(activeTab) &&
isUndefined(tableProfiler);

if (fetchProfiler) {
fetchLatestProfilerData();
} else {
setIsProfilerDataLoading(false);
}
if (isTourOpen) {
setTableProfiler(mockDatasetData.tableDetails as unknown as Table);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify this conditions?

Comment on lines +252 to +264
const fetchTest =
viewTest &&
!isTourOpen &&
[TableProfilerTab.DATA_QUALITY, TableProfilerTab.COLUMN_PROFILE].includes(
activeTab
) &&
isEmpty(allTestCases);

if (fetchTest) {
fetchAllTests();
} else {
setIsTestsLoading(false);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too

@chirag-madlani chirag-madlani merged commit 9a07849 into main Dec 11, 2023
@chirag-madlani chirag-madlani deleted the custom-profiler-matrix branch December 11, 2023 11:12
MrVinegar pushed a commit to MrVinegar/OpenMetadata that referenced this pull request Dec 15, 2023
…cs (open-metadata#14132)

* open-metadata#11346 Add UI Support to Add Custom Profiler Metrics

* fixed failing unit test

* fixed loading issue and added no profiler banner in column profile component

* create context provider and removed all the common props to context

* fixed failing unit test

* miner fixes

* added view part of custom metrics

* added:
- Edit action
- Delete action
- Basic structure of add form

* translation

* work on create custom metric for table and column.

* refactor structure in addCustomMetric page

* fixed failing unit test

* fixed failing cypress test and added create custom metric cypress test

* added cypress test for custom metric covered below scenarios
- Add
- Edit
- Delete
table and column custom metric

* added unit test for customMetricForm

* added unit test for
- NoProfilerBanner
- CustomMetricGraphs

* unit test for addCustomMetricPage

* added unit test for utils file

* fixed failing unit test

* fixed encoding issue

* addressing comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test Add this label to run secure Github workflows on PRs UI UI specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants