Web: store footer popover state in local storage
Keep the footer popover state in the local storage, restoring it on load: - Visibility of the popover - Current tab of the popover
This commit is contained in:
parent
6a8d959301
commit
4562e98df5
@ -1,13 +1,18 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import NotificationList from './NotificationList.vue'
|
import NotificationList from './NotificationList.vue'
|
||||||
import TaskLog from './TaskLog.vue'
|
import TaskLog from './TaskLog.vue'
|
||||||
import ConnectionStatus from '@/components/ConnectionStatus.vue'
|
import ConnectionStatus from '@/components/ConnectionStatus.vue'
|
||||||
|
|
||||||
const emit = defineEmits(['clickClose'])
|
const emit = defineEmits(['clickClose'])
|
||||||
|
|
||||||
const currentTab = ref('NotificationList')
|
const initialTab = localStorage.getItem("footer-popover-active-tab") || 'NotificationList';
|
||||||
|
const currentTab = ref(initialTab)
|
||||||
const tabs = { NotificationList, TaskLog }
|
const tabs = { NotificationList, TaskLog }
|
||||||
|
|
||||||
|
watch(currentTab, async (newTab) => {
|
||||||
|
localStorage.setItem("footer-popover-active-tab", newTab);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -57,7 +57,7 @@ export default {
|
|||||||
tasks: useTasks(),
|
tasks: useTasks(),
|
||||||
notifs: useNotifs(),
|
notifs: useNotifs(),
|
||||||
taskLog: useTaskLog(),
|
taskLog: useTaskLog(),
|
||||||
showFooterPopup: false,
|
showFooterPopup: !!localStorage.getItem("footer-popover-visible"),
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
hasJobData() {
|
hasJobData() {
|
||||||
@ -85,6 +85,10 @@ export default {
|
|||||||
this.taskLog.clear();
|
this.taskLog.clear();
|
||||||
this._fetchTask(newTaskID);
|
this._fetchTask(newTaskID);
|
||||||
},
|
},
|
||||||
|
showFooterPopup(shown) {
|
||||||
|
if (shown) localStorage.setItem("footer-popover-visible", "true");
|
||||||
|
else localStorage.removeItem("footer-popover-visible");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onTableJobClicked(rowData) {
|
onTableJobClicked(rowData) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user