Bugzilla – Attachment 188096 Details for
Bug 39320
Create a 'landing page' for ERM
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39320: (QA follow-up): Use localStorage instead of vue-cookies
Bug-39320-QA-follow-up-Use-localStorage-instead-of.patch (text/plain), 4.58 KB, created by
Pedro Amorim
on 2025-10-17 15:05:03 UTC
(
hide
)
Description:
Bug 39320: (QA follow-up): Use localStorage instead of vue-cookies
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-10-17 15:05:03 UTC
Size:
4.58 KB
patch
obsolete
>From 1d2b1ce58bb68c3356896f415ce3304ca65f2c61 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Fri, 17 Oct 2025 09:36:45 +0000 >Subject: [PATCH] Bug 39320: (QA follow-up): Use localStorage instead of > vue-cookies > >--- > .../ModuleDashboard/ModuleDashboard.vue | 12 +++++------- > .../prog/js/vue/composables/base-widget.js | 16 +++++++--------- > package.json | 1 - > 3 files changed, 12 insertions(+), 17 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/ModuleDashboard.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/ModuleDashboard.vue >index 126944fcd53..de7828dc660 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/ModuleDashboard.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/ModuleDashboard.vue >@@ -56,13 +56,12 @@ > <script> > import { onMounted, ref, watch, inject } from "vue"; > import WidgetPicker from "./WidgetPicker.vue"; >-import VueCookies from "vue-cookies"; > import { $__ } from "@koha-vue/i18n"; > import { VueDraggableNext } from "vue-draggable-next"; > > export default { > props: { >- availableWidgets: Array >+ availableWidgets: Array, > }, > setup(props) { > const availableWidgets = props.availableWidgets; >@@ -186,9 +185,9 @@ export default { > }; > > onMounted(() => { >- const storedWidgets = VueCookies.get("dashboard-widgets"); >+ const storedWidgets = localStorage.getItem("dashboard-widgets"); > if (storedWidgets) { >- const { left, right } = storedWidgets; >+ const { left, right } = JSON.parse(storedWidgets); > left.forEach(widgetName => { > const widget = availableWidgets.find( > widget => widget.name === widgetName >@@ -215,13 +214,12 @@ export default { > ([left, right]) => { > const leftWidgetNames = left.map(widget => widget.name); > const rightWidgetNames = right.map(widget => widget.name); >- VueCookies.set( >+ localStorage.setItem( > "dashboard-widgets", > JSON.stringify({ > left: leftWidgetNames, > right: rightWidgetNames, >- }), >- "30d" >+ }) > ); > }, > { deep: true } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-widget.js b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-widget.js >index 102bb9e9e80..7dd41d7398f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-widget.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/base-widget.js >@@ -1,6 +1,5 @@ > // composables/useBaseWidget.js > import { ref, computed, watch, provide, onMounted, onBeforeMount } from "vue"; >-import VueCookies from "vue-cookies"; > > export function useBaseWidget(widgetConfig, emit) { > const loading = ref( >@@ -37,17 +36,17 @@ export function useBaseWidget(widgetConfig, emit) { > })); > > const getWidgetSavedSettings = () => { >- const cookie = VueCookies.get( >+ const savedSettings = localStorage.getItem( > "widget-" + widgetConfig.id + "-settings" > ); >- return cookie || null; >+ return savedSettings || null; > }; > > onBeforeMount(() => { > if (widgetConfig.display === "dashboard") { >- const cookie = getWidgetSavedSettings(); >- if (cookie) { >- settings.value = cookie; >+ const savedSettings = getWidgetSavedSettings(); >+ if (savedSettings) { >+ settings.value = savedSettings; > } > } > }); >@@ -74,10 +73,9 @@ export function useBaseWidget(widgetConfig, emit) { > settings, > newSettings => { > if (widgetConfig.display === "dashboard" && newSettings !== null) { >- VueCookies.set( >+ localStorage.setItem( > "widget-" + widgetConfig.id + "-settings", >- JSON.stringify(newSettings), >- "30d" >+ JSON.stringify(newSettings) > ); > } > }, >diff --git a/package.json b/package.json >index c26e457a80c..df9c29893bb 100644 >--- a/package.json >+++ b/package.json >@@ -40,7 +40,6 @@ > "sass": "^1.58.1", > "style-loader": "^3.3.1", > "vue": "^3.5.4", >- "vue-cookies": "^1.8.6", > "vue-draggable-next": "^2.2.1", > "vue-flatpickr-component": "^9", > "vue-router": "^4.0.14", >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39320
:
187513
|
187514
|
187515
|
187516
|
187517
|
187518
|
187519
|
187520
|
187521
|
187522
|
187563
|
187568
|
187635
|
187636
|
187637
|
187638
|
187639
|
187640
|
187641
|
187642
|
187643
|
187644
|
187645
|
188094
|
188095
|
188096
|
188097
|
188098
|
188099
|
188100
|
188101
|
188102
|
188103
|
188104
|
188151
|
188279
|
188280
|
188281
|
188282
|
188283
|
188284
|
188285
|
188312
|
188315
|
188372
|
188375
|
188376
|
188637
|
188638
|
188639
|
188640
|
188641
|
188830
|
188831
|
188832
|
188833
|
188834
|
188835
|
188836
|
188837
|
188838
|
188839
|
188840
|
188841
|
188842
|
188843
|
188844
|
188845
|
188846
|
188847
|
188848
|
188849
|
188850
|
188851
|
188852
|
188853
|
188854
|
188855
|
188856
|
188857
|
188858
|
188859
|
188860
|
188861
|
188862
|
188863
|
188864