From cd57527689315e091e0010cb6ffa514c003f6d73 Mon Sep 17 00:00:00 2001 From: ThetaSinner Date: Tue, 20 Feb 2024 02:38:46 +0000 Subject: [PATCH] Lint and format --- .../coordinator/trusted/src/gpg_key_dist.rs | 8 ++- ui/src/component/GpgFingerprint.vue | 26 ++++----- ui/src/component/KeyList.vue | 22 ++++++-- ui/src/main.ts | 13 +++-- ui/src/trusted/trusted/DistributeGpgKey.vue | 56 +++++++++++++++---- ui/src/trusted/trusted/KeyCollections.vue | 7 ++- 6 files changed, 93 insertions(+), 39 deletions(-) diff --git a/dnas/trusted/zomes/coordinator/trusted/src/gpg_key_dist.rs b/dnas/trusted/zomes/coordinator/trusted/src/gpg_key_dist.rs index cbc021c..55cf6ea 100644 --- a/dnas/trusted/zomes/coordinator/trusted/src/gpg_key_dist.rs +++ b/dnas/trusted/zomes/coordinator/trusted/src/gpg_key_dist.rs @@ -33,7 +33,13 @@ pub fn distribute_gpg_key(request: DistributeGpgKeyRequest) -> ExternResult -import { computed } from 'vue'; - +import { computed } from "vue"; const props = defineProps<{ - fingerprint: string + fingerprint: string; }>(); // There's nothing particularly special about this format but it's the same as the GPG CLI prints and // it's what people are used to looking at for GPG keys. Hopefully that means its a little easier to // 40 characters grouped together. const fingerprintDisplay = computed(() => { - // It's a 160 bit hash, so 20 bytes, in hex is 40 characters - if (!props.fingerprint || props.fingerprint.length != 40) return ''; + // It's a 160 bit hash, so 20 bytes, in hex is 40 characters + if (!props.fingerprint || props.fingerprint.length != 40) return ""; - let repr = ''; - for (let i = 0; i < 40; i += 4) { - repr += props.fingerprint.slice(i, i + 4) + ' '; + let repr = ""; + for (let i = 0; i < 40; i += 4) { + repr += props.fingerprint.slice(i, i + 4) + " "; - if (i === 20) repr += ' '; - } + if (i === 20) repr += " "; + } - return repr.trim(); + return repr.trim(); }); - \ No newline at end of file + {{ fingerprintDisplay }} + diff --git a/ui/src/component/KeyList.vue b/ui/src/component/KeyList.vue index 9a4a774..e3d9460 100644 --- a/ui/src/component/KeyList.vue +++ b/ui/src/component/KeyList.vue @@ -44,16 +44,28 @@ const copyFingerprint = (keyDist: GpgKeyDist) => { - + {{ k.name }} {{ k.email ?? "-" }} {{ k.expires_at ? formatDistanceToNow(k.expires_at) : "-" }} - - - - + + + + diff --git a/ui/src/main.ts b/ui/src/main.ts index e9c6382..5d07921 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -3,14 +3,17 @@ import "./style.css"; import App from "./App.vue"; import { createPinia } from "pinia"; -import { library } from '@fortawesome/fontawesome-svg-core' -import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' -import { faClipboard, faCheckCircle } from '@fortawesome/free-regular-svg-icons' -library.add(faClipboard, faCheckCircle) +import { library } from "@fortawesome/fontawesome-svg-core"; +import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; +import { + faClipboard, + faCheckCircle, +} from "@fortawesome/free-regular-svg-icons"; +library.add(faClipboard, faCheckCircle); const pinia = createPinia(); const app = createApp(App); -app.component('font-awesome-icon', FontAwesomeIcon) +app.component("font-awesome-icon", FontAwesomeIcon); app.use(pinia); app.mount("#app"); diff --git a/ui/src/trusted/trusted/DistributeGpgKey.vue b/ui/src/trusted/trusted/DistributeGpgKey.vue index 0ca8134..705b49b 100644 --- a/ui/src/trusted/trusted/DistributeGpgKey.vue +++ b/ui/src/trusted/trusted/DistributeGpgKey.vue @@ -12,7 +12,7 @@ const notifications = useNotificationsStore(); const selected = ref>({}); const creating = ref(false); -const inputType = ref<'file' | 'paste'>('file'); +const inputType = ref<"file" | "paste">("file"); const fileInputField = ref(null); const textAreaInputField = ref(null); @@ -83,10 +83,12 @@ const onPublicKeySelect = async (event: Event) => { }; const onPublicKeyPaste = async (event: Event) => { - if (event.type === 'paste') { - const value = (event as ClipboardEvent).clipboardData?.getData('text/plain'); + if (event.type === "paste") { + const value = (event as ClipboardEvent).clipboardData?.getData( + "text/plain", + ); if (!value) return; - + handleNewKeyProvided(value); } else { if (!event.target) return; @@ -148,16 +150,38 @@ const distributeGpgKey = async () => {
- - + +
@@ -168,13 +192,21 @@ const distributeGpgKey = async () => {
- -
diff --git a/ui/src/trusted/trusted/KeyCollections.vue b/ui/src/trusted/trusted/KeyCollections.vue index bc6743d..9393752 100644 --- a/ui/src/trusted/trusted/KeyCollections.vue +++ b/ui/src/trusted/trusted/KeyCollections.vue @@ -7,8 +7,11 @@ const keyCollectionsStore = useKeyCollectionsStore();