| 
      
            Lines 1-6
          
      
      
        Link Here
      
     | 
  
        
          | 1 | 
          // composables/useBaseWidget.js  | 
          1 | 
          // composables/useBaseWidget.js  | 
        
        
          | 2 | 
          import { ref, computed, watch, provide, onMounted, onBeforeMount } from "vue"; | 
          2 | 
          import { ref, computed, watch, provide, onMounted, onBeforeMount } from "vue"; | 
        
            
              | 3 | 
              import VueCookies from "vue-cookies";  | 
               | 
               | 
            
        
          | 4 | 
           | 
          3 | 
           | 
        
        
          | 5 | 
          export function useBaseWidget(widgetConfig, emit) { | 
          4 | 
          export function useBaseWidget(widgetConfig, emit) { | 
        
        
          | 6 | 
              const loading = ref(  | 
          5 | 
              const loading = ref(  | 
        
  
    | 
      
            Lines 37-53
          export function useBaseWidget(widgetConfig, emit) {
      
      
        Link Here
      
     | 
  
        
          | 37 | 
              }));  | 
          36 | 
              }));  | 
        
        
          | 38 | 
           | 
          37 | 
           | 
        
        
          | 39 | 
              const getWidgetSavedSettings = () => { | 
          38 | 
              const getWidgetSavedSettings = () => { | 
        
          
            
              | 40 | 
                      const cookie = VueCookies.get(  | 
              39 | 
                      const savedSettings = localStorage.getItem(  | 
            
        
          | 41 | 
                      "widget-" + widgetConfig.id + "-settings"  | 
          40 | 
                      "widget-" + widgetConfig.id + "-settings"  | 
        
        
          | 42 | 
                  );  | 
          41 | 
                  );  | 
        
          
            
              | 43 | 
                      return cookie || null;  | 
              42 | 
                      return savedSettings || null;  | 
            
        
          | 44 | 
              };  | 
          43 | 
              };  | 
        
        
          | 45 | 
           | 
          44 | 
           | 
        
        
          | 46 | 
              onBeforeMount(() => { | 
          45 | 
              onBeforeMount(() => { | 
        
        
          | 47 | 
                  if (widgetConfig.display === "dashboard") { | 
          46 | 
                  if (widgetConfig.display === "dashboard") { | 
        
          
            
              | 48 | 
                          const cookie = getWidgetSavedSettings();  | 
              47 | 
                          const savedSettings = getWidgetSavedSettings();  | 
            
            
              | 49 | 
                          if (cookie) { | 
              48 | 
                          if (savedSettings) { | 
            
            
              | 50 | 
                              settings.value = cookie;  | 
              49 | 
                              settings.value = savedSettings;  | 
            
        
          | 51 | 
                      }  | 
          50 | 
                      }  | 
        
        
          | 52 | 
                  }  | 
          51 | 
                  }  | 
        
        
          | 53 | 
              });  | 
          52 | 
              });  | 
        
  
    | 
      
            Lines 74-83
          export function useBaseWidget(widgetConfig, emit) {
      
      
        Link Here
      
     | 
  
        
          | 74 | 
                  settings,  | 
          73 | 
                  settings,  | 
        
        
          | 75 | 
                  newSettings => { | 
          74 | 
                  newSettings => { | 
        
        
          | 76 | 
                      if (widgetConfig.display === "dashboard" && newSettings !== null) { | 
          75 | 
                      if (widgetConfig.display === "dashboard" && newSettings !== null) { | 
        
          
            
              | 77 | 
                              VueCookies.set(  | 
              76 | 
                              localStorage.setItem(  | 
            
        
          | 78 | 
                              "widget-" + widgetConfig.id + "-settings",  | 
          77 | 
                              "widget-" + widgetConfig.id + "-settings",  | 
        
          
            
              | 79 | 
                                  JSON.stringify(newSettings),  | 
              78 | 
                                  JSON.stringify(newSettings)  | 
            
            
              | 80 | 
                                  "30d"  | 
               | 
               | 
            
        
          | 81 | 
                          );  | 
          79 | 
                          );  | 
        
        
          | 82 | 
                      }  | 
          80 | 
                      }  | 
        
        
          | 83 | 
                  },  | 
          81 | 
                  },  |