Add copy button to api keys page, logo shrinking fix on versions page

This commit is contained in:
Nassim Jahnke 2023-03-19 12:52:30 +01:00
parent fbb830772b
commit 5800c587d5
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
4 changed files with 15 additions and 4 deletions

@ -1 +1 @@
Subproject commit 8f9271f0e61147fc6e4c6d281aafb3996538c9f2
Subproject commit 69c2729cee147195ece7b12ef25ab7a06bf8876f

View File

@ -846,7 +846,9 @@
"created": "Copy the created key before creating another one or refreshing the page. Do not share this with anyone else.",
"keyIdentifier": "Identifier",
"permissions": "Permissions",
"permissionRequired": "At least one permission needs to be set.",
"delete": "Delete",
"copy": "Click to copy key to clipboard",
"createKey": "Create key",
"noKeys": "You haven't created any api keys yet",
"success": {

View File

@ -312,7 +312,7 @@ async function restoreVersion() {
</template>
<div v-for="platform in versionPlatforms" :key="platform" class="flex items-center mb-1">
<PlatformLogo :platform="platform" :size="24" class="mr-1" />
<PlatformLogo :platform="platform" :size="24" class="mr-1 flex-shrink-0" />
{{ useBackendData.platforms.get(platform).name }}
({{ projectVersion?.platformDependenciesFormatted[platform] }})
<span class="flex-grow" />
@ -336,7 +336,7 @@ async function restoreVersion() {
<Spoiler :with-line="projectVersion?.pluginDependencies[platform] !== undefined" open>
<template #title>
<div class="flex gap-1 w-full">
<PlatformLogo :platform="platform" :size="24" />
<PlatformLogo :platform="platform" :size="24" class="flex-shrink-0" />
{{ useBackendData.platforms.get(platform).name }}
<span class="flex-grow" />
<DependencyEditModal :project="project" :version="version" :platform="useBackendData.platforms.get(platform)" />

View File

@ -80,14 +80,22 @@ async function deleteKey(key: ApiKey) {
notification.success(i18n.t("apiKeys.success.delete", [key.name]));
loadingDelete[key.name] = false;
}
function copy(event: any) {
const clipboardData = event.clipboardData || event.originalEvent?.clipboardData || navigator.clipboard;
clipboardData.writeText(createdKey.value as string);
}
</script>
<template>
<div class="space-y-2">
<Alert v-if="createdKey" type="info">
<Alert v-if="createdKey" type="info" class="flex">
{{ i18n.t("apiKeys.created") }}
<br />
{{ createdKey }}
<span class="flex-grow" />
<!-- todo: show tooltip/change button text when copied -->
<Button button-type="secondary" size="large" @click="copy">{{ i18n.t("apiKeys.copy") }}</Button>
</Alert>
<Card>
<template #header>
@ -106,6 +114,7 @@ async function deleteKey(key: ApiKey) {
<InputCheckbox v-for="perm in possiblePerms" :key="perm" v-model="selectedPerms" :label="perm" :value="perm" />
</div>
</InputGroup>
<div class="mt-2">{{ i18n.t("apiKeys.permissionRequired") }}</div>
</Card>
<Card>
<template #header>