From 116e850b66945066fdac493dbcf3f886c65649ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sat, 27 May 2023 23:01:45 +0200 Subject: [PATCH] fix: url labels on client, not backend --- cli/src/routes.rs | 21 +------------------- webui/src/components/display/UpObject.svelte | 13 ++++++++---- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/cli/src/routes.rs b/cli/src/routes.rs index 04c7bda..3f08bde 100644 --- a/cli/src/routes.rs +++ b/cli/src/routes.rs @@ -448,22 +448,7 @@ pub async fn put_object( (None, None) } PutInput::Address { entity: in_address } => { - let address = in_address.try_into().map_err(ErrorBadRequest)?; - - let label_entry = match &address { - Address::Hash(_) | Address::Uuid(_) => None, - Address::Attribute(_) => None, - Address::Url(url) => Some(Entry { - entity: address.clone(), - attribute: LABEL_ATTR.to_string(), - value: url.clone().into(), - provenance: match &query.provenance { - Some(s) => format!("API {}", s), - None => "API".to_string(), - }, - timestamp: chrono::Utc::now().naive_utc(), - }), - }; + let address: Address = in_address.try_into().map_err(ErrorBadRequest)?; let _address = address.clone(); let _job_container = state.job_container.clone(); @@ -497,10 +482,6 @@ pub async fn put_object( })?; } - if let Some(label_entry) = label_entry { - connection.insert_entry(label_entry)?; - } - Ok((None, Some(address))) }) }) diff --git a/webui/src/components/display/UpObject.svelte b/webui/src/components/display/UpObject.svelte index 48985ad..b757118 100644 --- a/webui/src/components/display/UpObject.svelte +++ b/webui/src/components/display/UpObject.svelte @@ -36,9 +36,9 @@ let displayLabel = address; $: { - displayLabel = Array.from(new Set(inferredIds.concat(labels || []))).join( - " | " - ); + const allLabels = [].concat(inferredIds).concat(labels || []); + displayLabel = Array.from(new Set(allLabels)).join(" | "); + if (!displayLabel && $entityInfo?.t === "Attribute") { displayLabel = `${$i18n.t("Attribute")}: ${$entityInfo.c}`; } @@ -117,7 +117,12 @@ {/if} {#if banner} -
{$entityInfo?.t}
+
+ {$entityInfo?.t} + {#if $entityInfo?.t === "Url"} + — {$entityInfo.c} + {/if} +
{/if} {#if $vaultInfo?.desktop}