-
Notifications
You must be signed in to change notification settings - Fork 3k
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(ui/data-contract): Data contract UI under Validation Tab #10625
feat(ui/data-contract): Data contract UI under Validation Tab #10625
Conversation
datahub-web-react/src/app/entity/shared/tabs/Dataset/Validations/AcrylAssertionsList.tsx
Outdated
Show resolved
Hide resolved
...ct/src/app/entity/shared/tabs/Dataset/Validations/contract/proposal/DataContractProposal.tsx
Outdated
Show resolved
Hide resolved
datahub-web-react/src/app/entity/shared/tabs/Dataset/Validations/fieldDescriptionUtils.ts
Show resolved
Hide resolved
...entity/shared/tabs/Dataset/Validations/contract/builder/DataContractAssertionGroupSelect.tsx
Outdated
Show resolved
Hide resolved
datahub-web-react/src/app/entity/shared/tabs/Dataset/Validations/acrylTypes.tsx
Outdated
Show resolved
Hide resolved
…-datacontract-tab
…tem on data contract
datahub-web-react/src/app/entity/shared/tabs/Dataset/Validations/assertionUtils.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, for context john - Amit did a minimal set of changes to make the existing assertion list in OSS selectable (check/uncheck option). This will work for OSS until we get to porting over our acryl assertion list code.
@@ -77,6 +81,26 @@ export const ValidationsTab = () => { | |||
}, | |||
]; | |||
|
|||
if (appConfig.config.featureFlags?.dataContractsEnabled) { | |||
// If contracts feature is enabled, add to list. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit we can remove space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const getPropertyFromVolumeType = (type: VolumeAssertionType) => { | ||
switch (type) { | ||
case VolumeAssertionType.RowCountTotal: | ||
return 'rowCountTotal' as VolumeTypeField; | ||
case VolumeAssertionType.RowCountChange: | ||
return 'rowCountChange' as VolumeTypeField; | ||
case VolumeAssertionType.IncrementingSegmentRowCountTotal: | ||
return 'incrementingSegmentRowCountTotal' as VolumeTypeField; | ||
case VolumeAssertionType.IncrementingSegmentRowCountChange: | ||
return 'incrementingSegmentRowCountChange' as VolumeTypeField; | ||
default: | ||
throw new Error(`Unknown volume assertion type: ${type}`); | ||
} | ||
}; | ||
|
||
const getVolumeTypeInfo = (volumeAssertion: VolumeAssertionInfo) => { | ||
const result = volumeAssertion[getPropertyFromVolumeType(volumeAssertion.type)]; | ||
if (!result) { | ||
return undefined; | ||
} | ||
return result; | ||
}; | ||
|
||
const getIsRowCountChange = (type: VolumeAssertionType) => { | ||
return [VolumeAssertionType.RowCountChange, VolumeAssertionType.IncrementingSegmentRowCountChange].includes(type); | ||
}; | ||
|
||
const getVolumeTypeDescription = (volumeType: VolumeAssertionType) => { | ||
switch (volumeType) { | ||
case VolumeAssertionType.RowCountTotal: | ||
case VolumeAssertionType.IncrementingSegmentRowCountTotal: | ||
return 'has'; | ||
case VolumeAssertionType.RowCountChange: | ||
case VolumeAssertionType.IncrementingSegmentRowCountChange: | ||
return 'should grow by'; | ||
default: | ||
throw new Error(`Unknown volume type ${volumeType}`); | ||
} | ||
}; | ||
|
||
const getOperatorDescription = (operator: AssertionStdOperator) => { | ||
switch (operator) { | ||
case AssertionStdOperator.GreaterThanOrEqualTo: | ||
return 'at least'; | ||
case AssertionStdOperator.LessThanOrEqualTo: | ||
return 'at most'; | ||
case AssertionStdOperator.Between: | ||
return 'between'; | ||
default: | ||
throw new Error(`Unknown operator ${operator}`); | ||
} | ||
}; | ||
|
||
const getValueChangeTypeDescription = (valueChangeType: AssertionValueChangeType) => { | ||
switch (valueChangeType) { | ||
case AssertionValueChangeType.Absolute: | ||
return 'rows'; | ||
case AssertionValueChangeType.Percentage: | ||
return '%'; | ||
default: | ||
throw new Error(`Unknown value change type ${valueChangeType}`); | ||
} | ||
}; | ||
|
||
const getParameterDescription = (parameters: AssertionStdParameters) => { | ||
if (parameters.value) { | ||
return formatNumberWithoutAbbreviation( | ||
parseMaybeStringAsFloatOrDefault(parameters.value.value, parameters.value.value), | ||
); | ||
} | ||
if (parameters.minValue && parameters.maxValue) { | ||
return `${formatNumberWithoutAbbreviation( | ||
parseMaybeStringAsFloatOrDefault(parameters.minValue.value, parameters.minValue.value), | ||
)} and ${formatNumberWithoutAbbreviation( | ||
parseMaybeStringAsFloatOrDefault(parameters.maxValue.value, parameters.maxValue.value), | ||
)}`; | ||
} | ||
throw new Error('Invalid assertion parameters provided'); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's a lot of utils before the component code begins I wonder if it's worth moving this to a utils file.
And I know in SaaS we have many of these under the assertion/builder/...
folder. So we should modify SaaS to take it out of that assertion/builder/...
folder utils file and put it in a higher level common folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
datahub-web-react/src/app/entity/shared/tabs/Dataset/Validations/fieldDescriptionUtils.ts
Show resolved
Hide resolved
datahub-web-react/yarn.lock
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undo all changes in lock file
…on validation tab
Looks like there's failing checks, please fix before merge. |
…b-project#10625) Co-authored-by: jayacryl <[email protected]>
Co-authored-by: jayacryl <[email protected]>
Screencast.from.14-06-24.04.42.06.PM.IST.webm
Test cases
Tested with below scenarios on OSS for Data Contract Feature:
Checklist
Tested Below Scenarios: