Skip to content

Commit 72fda04

Browse files
Merge pull request #95 from hydroserver2/141-URL-detection
Add URL detection to SiteDetails page metadata tags
2 parents 696bfe7 + c38e085 commit 72fda04

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

src/components/Site/SiteDetailsTable.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
:key="tag.id"
2121
class="ma-1"
2222
>
23-
{{ tag.key }}: {{ tag.value }}
23+
{{ tag.key }}:
24+
<span v-if="isUrl(tag.value)">
25+
<a :href="tag.value" target="_blank">{{ tag.value }}</a>
26+
</span>
27+
<span v-else>{{ tag.value }}</span>
2428
</v-chip>
2529
</td>
2630
</tr>
@@ -46,6 +50,15 @@ const props = defineProps({
4650
},
4751
})
4852
53+
const isUrl = (value: string): boolean => {
54+
try {
55+
new URL(value)
56+
return true
57+
} catch (_) {
58+
return false
59+
}
60+
}
61+
4962
const thingProperties = computed(() => {
5063
return thing.value
5164
? [

src/components/Site/SiteTagManager.vue

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
<template>
2-
<h6 class="text-h6 my-5">Add Additional Metadata</h6>
2+
<h6 class="text-h6 my-5">
3+
Add Additional Metadata
4+
<v-tooltip>
5+
<template v-slot:activator="{ props }">
6+
<v-icon small class="ml-2" color="grey lighten-1" v-bind="props">
7+
mdi-help-circle-outline
8+
</v-icon>
9+
</template>
10+
<template v-slot:default>
11+
<p>
12+
Use site metadata tags to add additional metadata to a site. Specify a
13+
key and value for each metadata property.
14+
</p>
15+
<p>
16+
On the 'My Sites' page, you'll be able to filter and color your sites
17+
by these metadata tags. For example, you can filter by only the sites
18+
that have a specific key and color code the markers on the map by the
19+
values of that key.
20+
</p>
21+
<p>
22+
Additionally, if a URL is added as a value, it will be clickable from
23+
the Site Details page, allowing direct access to relevant links.
24+
</p>
25+
</template>
26+
</v-tooltip>
27+
</h6>
328

429
<v-row class="mt-8" align="center">
530
<v-col cols="5">

0 commit comments

Comments
 (0)