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

Add a copy method to task run result locations #1033

Merged
merged 13 commits into from
Sep 2, 2021
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
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Features and Improvements

- Add a copy method to task run result locations - [#1033](https://github.com/PrefectHQ/ui/pull/1033)
- Route to task run page on timeline click - [#1024](https://github.com/PrefectHQ/ui/pull/1024
- Fix artifact title overlap - [#1032](https://github.com/PrefectHQ/ui/pull/1032)
- Increase default number of flows shown in the flow table - [#1027](https://github.com/PrefectHQ/ui/pull/1027)
- Remove global max width on dashboard etc screens - [#1026](https://github.com/PrefectHQ/ui/pull/1026)
Expand Down
54 changes: 52 additions & 2 deletions src/pages/TaskRun/Details-Tile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export default {
}
},
data() {
return {}
return {
copiedText: {}
}
},
computed: {
expectedRuns() {
Expand All @@ -35,6 +37,20 @@ export default {
]
}
}
},
methods: {
copyTextToClipboard(text) {
if (!text) return

this.copiedText = {}
this.copiedText[text] = true
navigator.clipboard.writeText(text)

setTimeout(() => {
this.copiedText = {}
this.copiedText[text] = false
}, 1000)
}
}
}
</script>
Expand Down Expand Up @@ -227,7 +243,28 @@ export default {
<v-col cols="6" class="text-right font-weight-bold">
<v-tooltip top>
<template #activator="{ on }">
<span v-on="on">
<span
class="cursor-pointer show-icon-hover-focus-only pa-2px"
role="button"
@click="
copyTextToClipboard(
taskRun.serialized_state._result.location
)
"
v-on="on"
>
<v-icon
v-if="taskRun.serialized_state._result.location"
x-small
class="mb-2px mr-2"
tabindex="0"
>
{{
copiedText[taskRun.serialized_state._result.location]
? 'check'
: 'file_copy'
}}
</v-icon>
{{ taskRun.serialized_state._result.location || 'None' }}
</span>
</template>
Expand Down Expand Up @@ -284,4 +321,17 @@ a {
content: '' !important;
}
}

.show-icon-hover-focus-only {
.v-icon {
visibility: hidden;
}

&:hover,
&:focus {
.v-icon {
visibility: visible;
}
}
}
</style>