Skip to content

Commit 5512a49

Browse files
Merge pull request #123 from hydroserver2/208-no-sites-fix
Fix sites table not showing up if there's aren't any sites
2 parents 80223b2 + ce687bc commit 5512a49

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

src/components/Site/SiteFilterToolbar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
/>
3636

3737
<v-btn
38+
class="mx-2"
3839
color="white-darken-2"
3940
@click="clear"
4041
rounded="xl"

src/components/Site/SiteTagManager.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
key and value for each metadata property.
1414
</p>
1515
<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.
16+
On the 'Your Sites' page, you'll be able to filter and color your
17+
sites by these metadata tags. For example, you can filter by only the
18+
sites that have a specific key and color code the markers on the map
19+
by the values of that key.
2020
</p>
2121
<p>
2222
Additionally, if a URL is added as a value, it will be clickable from

src/components/base/Navbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const paths: {
156156
},
157157
{
158158
attrs: { to: '/sites' },
159-
label: 'My Sites',
159+
label: 'Your Sites',
160160
icon: 'mdi-map-marker-multiple',
161161
},
162162
{

src/pages/Sites.vue

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="my-4 mx-6">
1212
<v-row class="my-2">
1313
<v-col cols="auto">
14-
<h5 class="text-h5">My registered sites</h5>
14+
<h5 class="text-h5">Your registered sites</h5>
1515
</v-col>
1616
</v-row>
1717

@@ -26,9 +26,10 @@
2626
</KeepAlive>
2727
</v-card>
2828

29-
<v-card v-if="ownedThings?.length">
29+
<v-card>
3030
<v-toolbar flat color="blue-darken-2">
3131
<v-text-field
32+
:disabled="!ownedThings?.length"
3233
class="mx-2"
3334
clearable
3435
v-model="search"
@@ -42,6 +43,7 @@
4243
<v-spacer />
4344

4445
<v-btn
46+
:disabled="!ownedThings?.length"
4547
class="mr-2"
4648
@click="showFilter = !showFilter"
4749
prependIcon="mdi-filter"
@@ -64,10 +66,37 @@
6466
class="elevation-3 owned-sites-table"
6567
@click:row="onRowClick"
6668
color="primary"
67-
hover
69+
:hover="coloredThings?.length > 0 && sitesLoaded"
6870
:style="{ 'max-height': `200vh` }"
6971
fixed-header
72+
:loading="!sitesLoaded"
73+
loading-text="Loading sites..."
7074
>
75+
<template v-slot:no-data>
76+
<div class="text-center pa-4" v-if="ownedThings.length === 0">
77+
<v-icon size="48" color="grey lighten-1">mdi-radio-tower</v-icon>
78+
<h4 class="mt-2">You have not registered any sites</h4>
79+
<p class="mb-4">
80+
Click the "Register a new site" button to start managing your
81+
data.
82+
</p>
83+
</div>
84+
85+
<!-- Check if filters result in no matching sites -->
86+
<div
87+
class="text-center pa-4"
88+
v-else-if="ownedThings.length > 0 && coloredThings.length === 0"
89+
>
90+
<v-icon size="48" color="grey lighten-1"
91+
>mdi-filter-remove-outline</v-icon
92+
>
93+
<h4 class="mt-2">No sites match your filters</h4>
94+
<p class="mb-4">
95+
Try adjusting your search keywords or filter criteria to find
96+
sites.
97+
</p>
98+
</div>
99+
</template>
71100
<template v-slot:item.tagValue="{ item }">
72101
<template v-for="(tag, index) in item.tags">
73102
<v-chip
@@ -80,11 +109,6 @@
80109
</template>
81110
</v-data-table-virtual>
82111
</v-card>
83-
84-
<h5 v-if="!sitesLoaded" class="text-h5">Loading sites...</h5>
85-
<h5 v-else-if="!ownedThings.length" class="text-h5">
86-
You have not registered any sites.
87-
</h5>
88112
</div>
89113

90114
<v-dialog v-model="showSiteForm" width="60rem">

src/router/routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export const routes: RouteRecordRaw[] = [
2626
component: () => import('@/pages/Sites.vue'),
2727
meta: {
2828
hasAuthGuard: true,
29-
title: 'My Sites',
29+
title: 'Your Sites',
3030
metaTags: [
3131
{
3232
name: 'keywords',
33-
content: 'HydroServer, My Sites',
33+
content: 'HydroServer, Your Sites',
3434
},
3535
],
3636
},

0 commit comments

Comments
 (0)