File tree 5 files changed +34
-5
lines changed
5 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "/app.js" : " /app.js?id=c6b0db33328045843a901c6840bbbb55 " ,
2
+ "/app.js" : " /app.js?id=10fd202d284550adc56be1499fbd44c1 " ,
3
3
"/app.css" : " /app.css?id=12c5e78a91987c11d8a0cc04436541e9" ,
4
4
"/img/log-viewer-128.png" : " /img/log-viewer-128.png?id=d576c6d2e16074d3f064e60fe4f35166" ,
5
5
"/img/log-viewer-32.png" : " /img/log-viewer-32.png?id=f8ec67d10f996aa8baf00df3b61eea6d" ,
Original file line number Diff line number Diff line change 35
35
import { ArrowLeftIcon , ArrowRightIcon } from ' @heroicons/vue/24/outline' ;
36
36
import { usePaginationStore } from ' ../stores/pagination.js' ;
37
37
import { useRoute , useRouter } from ' vue-router' ;
38
- import { computed } from ' vue' ;
38
+ import {computed , onBeforeUnmount , onMounted } from ' vue' ;
39
39
import { replaceQuery } from ' ../helpers.js' ;
40
40
41
41
const props = defineProps ({
@@ -69,4 +69,14 @@ const gotoPage = (page) => {
69
69
70
70
const nextPage = () => gotoPage (paginationStore .page + 1 );
71
71
const previousPage = () => gotoPage (paginationStore .page - 1 );
72
+
73
+ onMounted (() => {
74
+ document .addEventListener (' goToNextPage' , nextPage);
75
+ document .addEventListener (' goToPreviousPage' , previousPage);
76
+ })
77
+
78
+ onBeforeUnmount (() => {
79
+ document .removeEventListener (' goToNextPage' , nextPage);
80
+ document .removeEventListener (' goToPreviousPage' , previousPage);
81
+ })
72
82
</script >
Original file line number Diff line number Diff line change @@ -50,8 +50,16 @@ export const openNextLogEntry = () => {
50
50
const el = document . activeElement ;
51
51
const nextElement = getNextElementWithClass ( el , logToggleButtonClass ) ;
52
52
if ( ! nextElement ) {
53
+ const onNextPageLoad = ( ) => {
54
+ setTimeout ( ( ) => {
55
+ focusFirstLogEntry ( ) ;
56
+ ensureIsExpanded ( document . activeElement ) ;
57
+ } , 50 )
58
+ document . removeEventListener ( 'logsPageLoaded' , onNextPageLoad ) ;
59
+ } ;
60
+ document . addEventListener ( 'logsPageLoaded' , onNextPageLoad ) ;
61
+ document . dispatchEvent ( new Event ( 'goToNextPage' ) ) ;
53
62
return ;
54
- // TODO: check if there's a next pagination page to load and open the next log entry.
55
63
}
56
64
ensureIsCollapsed ( el ) ;
57
65
nextElement . focus ( ) ;
@@ -62,8 +70,16 @@ export const openPreviousLogEntry = () => {
62
70
const el = document . activeElement ;
63
71
const previousElement = getPreviousElementWithClass ( el , logToggleButtonClass ) ;
64
72
if ( ! previousElement ) {
73
+ const onPreviousPageLoad = ( ) => {
74
+ setTimeout ( ( ) => {
75
+ focusLastLogEntry ( ) ;
76
+ ensureIsExpanded ( document . activeElement ) ;
77
+ } , 50 )
78
+ document . removeEventListener ( 'logsPageLoaded' , onPreviousPageLoad ) ;
79
+ } ;
80
+ document . addEventListener ( 'logsPageLoaded' , onPreviousPageLoad ) ;
81
+ document . dispatchEvent ( new Event ( 'goToPreviousPage' ) ) ;
65
82
return ;
66
- // TODO: check if there's a previous pagination page to load and open the previous log entry.
67
83
}
68
84
ensureIsCollapsed ( el ) ;
69
85
previousElement . focus ( ) ;
Original file line number Diff line number Diff line change @@ -234,11 +234,14 @@ export const useLogViewerStore = defineStore({
234
234
235
235
if ( ! silently ) {
236
236
nextTick ( ( ) => {
237
+ document . dispatchEvent ( new Event ( 'logsPageLoaded' ) ) ;
237
238
this . reset ( ) ;
238
239
if ( data . expandAutomatically ) {
239
240
this . stacksOpen . push ( 0 ) ;
240
241
}
241
242
} ) ;
243
+ } else {
244
+ document . dispatchEvent ( new Event ( 'logsPageLoadedSilently' ) ) ;
242
245
}
243
246
244
247
if ( this . hasMoreResults ) {
You can’t perform that action at this time.
0 commit comments