From: Adam Dullage Date: Thu, 9 Jun 2022 14:05:18 +0000 (+0100) Subject: Added rudimentary loading indicators and "No Results" warning X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=e6f6842692a7cfe42d311728132c4f718137e189;p=flatnotes.git Added rudimentary loading indicators and "No Results" warning --- diff --git a/flatnotes/src/components/App.js b/flatnotes/src/components/App.js index 4d2f725..8aebd25 100644 --- a/flatnotes/src/components/App.js +++ b/flatnotes/src/components/App.js @@ -27,7 +27,7 @@ export default { usernameInput: null, passwordInput: null, rememberMeInput: false, - notes: [], + notes: null, searchTerm: null, draftSaveTimeout: null, searchResults: null, @@ -42,9 +42,13 @@ export default { computed: { notesByLastModifiedDesc: function() { - return this.notes.sort(function(a, b) { - return b.lastModified - a.lastModified; - }); + if (this.notes == null) { + return null; + } else { + return this.notes.sort(function(a, b) { + return b.lastModified - a.lastModified; + }); + } }, }, @@ -127,8 +131,8 @@ export default { getNotes: function() { let parent = this; - parent.notes = []; api.get("/api/notes").then(function(response) { + parent.notes = []; response.data.forEach(function(note) { parent.notes.push(new Note(note.filename, note.lastModified)); }); diff --git a/flatnotes/src/components/App.vue b/flatnotes/src/components/App.vue index 986eba9..c0e9746 100644 --- a/flatnotes/src/components/App.vue +++ b/flatnotes/src/components/App.vue @@ -136,35 +136,53 @@ -
- -
- +
+ +
+

Loading...

- -
- - + +
+ +
+ +
+ + +
+ + +
- -
+ +
+

Searching...

+
+ + +
+

No Results

+
+ + +
- + +
+

Loading...

+
+ + +
+

No Notes

+
+ + +