Client - display copy to clipboard icon only when clipboard is available

This commit is contained in:
Sam 2022-09-15 17:04:53 +02:00
parent 3c31245bc5
commit 9a3ffbf783

View File

@ -25,7 +25,7 @@
<dd> <dd>
{{ client.client_id }} {{ client.client_id }}
<i <i
v-if="afterCreation" v-if="afterCreation && clipboardSupport"
:class="`fa fa-${idCopied ? 'check' : 'copy'}`" :class="`fa fa-${idCopied ? 'check' : 'copy'}`"
aria-hidden="true" aria-hidden="true"
:title="$t('oauth2.COPY_TO_CLIPBOARD')" :title="$t('oauth2.COPY_TO_CLIPBOARD')"
@ -39,6 +39,7 @@
<dd v-if="afterCreation && client.client_secret" class="app-secret"> <dd v-if="afterCreation && client.client_secret" class="app-secret">
{{ client.client_secret }} {{ client.client_secret }}
<i <i
v-if="clipboardSupport"
:class="`fa fa-${secretCopied ? 'check' : 'copy'}`" :class="`fa fa-${secretCopied ? 'check' : 'copy'}`"
aria-hidden="true" aria-hidden="true"
:title="$t('oauth2.COPY_TO_CLIPBOARD')" :title="$t('oauth2.COPY_TO_CLIPBOARD')"
@ -146,9 +147,13 @@
const messageToDisplay: Ref<string | null> = ref(null) const messageToDisplay: Ref<string | null> = ref(null)
const idCopied: Ref<boolean> = ref(false) const idCopied: Ref<boolean> = ref(false)
const secretCopied: Ref<boolean> = ref(false) const secretCopied: Ref<boolean> = ref(false)
const clipboardSupport: Ref<boolean> = ref(false)
onBeforeMount(() => { onBeforeMount(() => {
loadClient() loadClient()
if (navigator.clipboard) {
clipboardSupport.value = true
}
}) })
function loadClient() { function loadClient() {