fix: url labels on client, not backend

feat/type-attributes
Tomáš Mládek 2023-05-27 23:01:45 +02:00
parent 4d7ef092fb
commit 116e850b66
2 changed files with 10 additions and 24 deletions

View File

@ -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)))
})
})

View File

@ -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 @@
<Ellipsis value={displayLabel} />
{/if}
{#if banner}
<div class="type">{$entityInfo?.t}</div>
<div class="type">
{$entityInfo?.t}
{#if $entityInfo?.t === "Url"}
&mdash; {$entityInfo.c}
{/if}
</div>
{/if}
</div>
{#if $vaultInfo?.desktop}