Skip to content

Commit

Permalink
feat(): Show data platform instances in policy modal if they are set …
Browse files Browse the repository at this point in the history
…on the policy (datahub-project#10645)

Co-authored-by: Hendrik Richert <[email protected]>
  • Loading branch information
githendrik and hrichert authored Jul 3, 2024
1 parent 73cdfeb commit 6628ef6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datahub-web-react/src/app/ingest/source/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ export const getExecutionRequestStatusDisplayColor = (status: string) => {
export const validateURL = (fieldName: string) => {
return {
validator(_, value) {
const URLPattern = new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[a-zA-Z0-9.-]{2,})+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/);
const URLPattern = new RegExp(
/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[a-zA-Z0-9.-]{2,})+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/,
);
const isURLValid = URLPattern.test(value);
if (!value || isURLValid) {
return Promise.resolve();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default function PolicyDetailsModal({ policy, visible, onClose, privilege

const resources = convertLegacyResourceFilter(policy?.resources);
const resourceTypes = getFieldValues(resources?.filter, 'TYPE') || [];
const dataPlatformInstances = getFieldValues(resources?.filter, 'DATA_PLATFORM_INSTANCE') || [];
const resourceEntities = getFieldValues(resources?.filter, 'URN') || [];
const domains = getFieldValues(resources?.filter, 'DOMAIN') || [];

Expand Down Expand Up @@ -170,6 +171,20 @@ export default function PolicyDetailsModal({ policy, visible, onClose, privilege
);
})) || <PoliciesTag>All</PoliciesTag>}
</div>
{dataPlatformInstances?.length > 0 && (
<div>
<Typography.Title level={5}>Data Platform Instances</Typography.Title>
<ThinDivider />
{dataPlatformInstances.map((value, key) => {
return (
// eslint-disable-next-line react/no-array-index-key
<PoliciesTag key={`dataPlatformInstance-${value.value}-${key}`}>
<Typography.Text>{getDisplayName(value.entity)}</Typography.Text>
</PoliciesTag>
);
})}
</div>
)}
<div>
<Typography.Title level={5}>Domains</Typography.Title>
<ThinDivider />
Expand Down

0 comments on commit 6628ef6

Please sign in to comment.