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

fix: move workflow link to source query tab #1445

Merged
merged 8 commits into from
May 6, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
border-radius: var(--border-radius);
}
}
.DataTableViewSourceQuery-workflow {
margin-bottom: 12px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent<IProps> = ({
dataJobMetadataById,
}) => {
const [showOldJobMetadata, setShowOldJobMetadata] = useState(false);

const jobMetadataIds = useMemo(
() =>
Array.from(
Expand Down Expand Up @@ -80,6 +81,26 @@ export const DataTableViewSourceQuery: React.FunctionComponent<IProps> = ({
);
});

const customProperties = table.custom_properties ?? {};
const workflowValue = customProperties['workflow'];
const workflowDOM =
workflowValue && typeof workflowValue === 'string' ? (
<div className="DataTableViewSourceQuery-workflow">
<div className="data-table-workflow">
<Title size="med" className="mb12">
Workflow
</Title>
</div>
{/https?:\/\/[^\s]+/.test(workflowValue.trim()) ? (
Copy link
Collaborator

Choose a reason for hiding this comment

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

use isValidUrl in lib/utils/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks! added

<Link to={workflowValue} newTab>
{workflowValue}
</Link>
) : (
workflowValue
)}
</div>
) : null;

const errorDOM =
jobMetadataIds.length > 0 ? null : (
<EmptyText className="m24">
Expand All @@ -99,6 +120,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent<IProps> = ({

return (
<div className="DataTableViewSourceQuery">
{workflowDOM}
zhangvi7 marked this conversation as resolved.
Show resolved Hide resolved
{parentDOM}
{errorDOM}
{showMoreDOM}
Expand Down
Loading