diff --git a/src/www/index.html b/src/www/index.html index 7d5da28d..629fa899 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -23,7 +23,7 @@
-
+
Logout @@ -59,7 +59,7 @@

Clients

-
+
+
+
+ +
+
diff --git a/src/www/js/app.js b/src/www/js/app.js index e22cbfe0..77d6054e 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -110,6 +110,7 @@ new Vue({ }, }, }, + sortation: 'name', }, methods: { dateTime: value => { @@ -169,6 +170,7 @@ new Vue({ return client; }); + this.onSortationChange(); }, login(e) { e.preventDefault(); @@ -239,6 +241,21 @@ new Vue({ .catch(err => alert(err.message || err.toString())) .finally(() => this.refresh().catch(console.error)); }, + onSortationChange() { + this.clients.sort((a, b) => { + const nameA = a[this.sortation].toUpperCase(); // ignore upper and lowercase + const nameB = b[this.sortation].toUpperCase(); // ignore upper and lowercase + if (nameA < nameB) { + return -1; + } + if (nameA > nameB) { + return 1; + } + + // names must be equal + return 0; + }); + }, }, filters: { bytes,