mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 23:28:14 +00:00
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -49,13 +49,19 @@
|
|||||||
class="c-notebook__controls__time"
|
class="c-notebook__controls__time"
|
||||||
>
|
>
|
||||||
<option value="0"
|
<option value="0"
|
||||||
selected="selected"
|
:selected="showTime === 0"
|
||||||
>
|
>
|
||||||
Show all
|
Show all
|
||||||
</option>
|
</option>
|
||||||
<option value="1">Last hour</option>
|
<option value="1"
|
||||||
<option value="8">Last 8 hours</option>
|
:selected="showTime === 1"
|
||||||
<option value="24">Last 24 hours</option>
|
>Last hour</option>
|
||||||
|
<option value="8"
|
||||||
|
:selected="showTime === 8"
|
||||||
|
>Last 8 hours</option>
|
||||||
|
<option value="24"
|
||||||
|
:selected="showTime === 24"
|
||||||
|
>Last 24 hours</option>
|
||||||
</select>
|
</select>
|
||||||
<select v-model="defaultSort"
|
<select v-model="defaultSort"
|
||||||
class="c-notebook__controls__time"
|
class="c-notebook__controls__time"
|
||||||
@ -132,9 +138,17 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filteredAndSortedEntries() {
|
filteredAndSortedEntries() {
|
||||||
|
const filterTime = Date.now();
|
||||||
const pageEntries = getNotebookEntries(this.internalDomainObject, this.selectedSection, this.selectedPage) || [];
|
const pageEntries = getNotebookEntries(this.internalDomainObject, this.selectedSection, this.selectedPage) || [];
|
||||||
|
|
||||||
return pageEntries.sort(this.sortEntries);
|
const hours = parseInt(this.showTime, 10);
|
||||||
|
const filteredPageEntriesByTime = hours
|
||||||
|
? pageEntries.filter(entry => (filterTime - entry.createdOn) <= hours * 60 * 60 * 1000)
|
||||||
|
: pageEntries;
|
||||||
|
|
||||||
|
return this.defaultSort === 'oldest'
|
||||||
|
? filteredPageEntriesByTime
|
||||||
|
: [...filteredPageEntriesByTime].reverse();
|
||||||
},
|
},
|
||||||
pages() {
|
pages() {
|
||||||
return this.getPages() || [];
|
return this.getPages() || [];
|
||||||
@ -420,11 +434,6 @@ export default {
|
|||||||
searchItem(input) {
|
searchItem(input) {
|
||||||
this.search = input;
|
this.search = input;
|
||||||
},
|
},
|
||||||
sortEntries(right, left) {
|
|
||||||
return this.defaultSort === 'newest'
|
|
||||||
? left.createdOn - right.createdOn
|
|
||||||
: right.createdOn - left.createdOn;
|
|
||||||
},
|
|
||||||
toggleNav() {
|
toggleNav() {
|
||||||
this.showNav = !this.showNav;
|
this.showNav = !this.showNav;
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user