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 copy to clipboard for credentials dialogs #2231

Merged
merged 5 commits into from
Jun 6, 2023

Conversation

Steve-Mcl
Copy link
Contributor

@Steve-Mcl Steve-Mcl commented Jun 5, 2023

closes #2199

Description

Adds a new mixin "clipboard"

Example Usage:

<template>
    <ff-dialog ref="dialog" header="Device Credentials">
        <ff-button v-if="clipboardSupported" kind="secondary" @click="copy()">Copy to Clipboard</ff-button>
    </ff-dialog>
</template>

<script>
import clipboardMixin from '../../../../mixins/Clipboard.js'
export default {
    name: 'myForm',
    mixins: [clipboardMixin],
    methods: {
        copy () {
            this.copyToClipboard(this.dataToCopy).then(() => {
                // Success
            }).catch((err) => {
                console.warn('Clipboard write permission denied: ', err)
            })
        }
    }
}
</script>

Adds a copy to clipboard button to the device credentials and provisioning credentials dialog.

This issue was identified during the dev demo of Device UI work as a good UX feature as it complements the UI for setting up a device via its new UI

NOTE: Since this uses navigator.clipboard the buttons will only be shown in Secure Contexts

Non Secure Context:
image

Secure Context:
image

Related Issue(s)

#2199

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on flowforge/helm to update ConfigMap Template
    • Issue/PR raised on flowforge/CloudProject to update values for Staging/Production

Labels

  • Backport needed? -> add the backport label
  • Includes a DB migration? -> add the area:migration label

@Steve-Mcl Steve-Mcl requested a review from Pezmc June 5, 2023 18:05
@Steve-Mcl Steve-Mcl requested a review from Pezmc June 6, 2023 09:44
@Steve-Mcl
Copy link
Contributor Author

Steve-Mcl commented Jun 6, 2023

@Pezmc please (re)review. Added Clipboard mixin as suggested - to deduplicate clipboard code in the touched files.

Copy link
Contributor

@Pezmc Pezmc left a comment

Choose a reason for hiding this comment

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

Love it! 🚢

…g.vue

Co-authored-by: Pez Cuckow <email@pezcuckow.com>
@Steve-Mcl Steve-Mcl merged commit 1a4a4ad into main Jun 6, 2023
@Steve-Mcl Steve-Mcl deleted the 2199-add-copy-to-creds-dialog branch June 6, 2023 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Copy" button to Device Config dialog
2 participants