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

Added Copy Button for Lineage ID #2578

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions web/src/components/core/copy/MqCopy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2018-2023 contributors to the Marquez project
// SPDX-License-Identifier: Apache-2.0

import { Snackbar, Tooltip } from '@mui/material'
import ContentCopyIcon from '@mui/icons-material/ContentCopy'
import IconButton from '@mui/material/IconButton'
import React from 'react'

interface MqCopyProps {
string: string
}

const MqEmpty: React.FC<MqCopyProps> = ({ string }) => {
const [open, setOpen] = React.useState(false)
const handleClose = (event: React.SyntheticEvent | Event, reason?: string) => {
if (reason === 'clickaway') {
return
}

setOpen(false)
}
return (
<>
<Tooltip title='Copy'>
<IconButton
onClick={(event) => {
event.stopPropagation()
navigator.clipboard.writeText(string)
setOpen(true)
}}
aria-label='copy'
size={'small'}
color={'primary'}
>
<ContentCopyIcon fontSize={'small'} />
</IconButton>
</Tooltip>
<Snackbar
open={open}
autoHideDuration={2000}
onClose={handleClose}
message={`Copied ${string}`}
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
/>
</>
)
}

export default MqEmpty
6 changes: 5 additions & 1 deletion web/src/routes/events/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import MqStatus from '../../components/core/status/MqStatus'
import MqText from '../../components/core/text/MqText'
import React, { useEffect, useRef } from 'react'
import moment from 'moment'
import MqCopy from '../../components/core/copy/MqCopy'

interface StateProps {
events: Event[]
Expand Down Expand Up @@ -248,7 +249,10 @@ const Events: React.FC<EventsProps> = ({
}}
>
<TableCell align='left'>
<MqText font={'mono'}>{event.run.runId}</MqText>
<Box display={"flex"} alignItems={"center"}>
<MqText font={'mono'}>{event.run.runId}</MqText>
<MqCopy string={event.run.runId}/>
</Box>
</TableCell>
<TableCell align='left'>
<MqStatus
Expand Down