@@ -24,7 +24,7 @@ import router from '@/router'
2424import store from '@/store'
2525import { login , logout , api } from '@/api'
2626import i18n from '@/locales'
27- import { ACCESS_TOKEN , CURRENT_PROJECT , DEFAULT_THEME , APIS , ASYNC_JOB_IDS , ZONES , TIMEZONE_OFFSET } from '@/store/mutation-types'
27+ import { ACCESS_TOKEN , CURRENT_PROJECT , DEFAULT_THEME , APIS , ASYNC_JOB_IDS , ZONES , TIMEZONE_OFFSET , USE_BROWSER_TIMEZONE } from '@/store/mutation-types'
2828
2929const user = {
3030 state : {
@@ -39,7 +39,8 @@ const user = {
3939 isLdapEnabled : false ,
4040 cloudian : { } ,
4141 zones : { } ,
42- timezoneoffset : '0.0'
42+ timezoneoffset : 0.0 ,
43+ usebrowsertimezone : false
4344 } ,
4445
4546 mutations : {
@@ -50,6 +51,10 @@ const user = {
5051 Vue . ls . set ( TIMEZONE_OFFSET , timezoneoffset )
5152 state . timezoneoffset = timezoneoffset
5253 } ,
54+ SET_USE_BROWSER_TIMEZONE : ( state , bool ) => {
55+ Vue . ls . set ( USE_BROWSER_TIMEZONE , bool )
56+ state . usebrowsertimezone = bool
57+ } ,
5358 SET_PROJECT : ( state , project = { } ) => {
5459 Vue . ls . set ( CURRENT_PROJECT , project )
5560 state . project = project
@@ -109,6 +114,9 @@ const user = {
109114 commit ( 'SET_TOKEN' , result . sessionkey )
110115 commit ( 'SET_TIMEZONE_OFFSET' , result . timezoneoffset )
111116
117+ const cachedUseBrowserTimezone = Vue . ls . get ( USE_BROWSER_TIMEZONE , false )
118+ commit ( 'SET_USE_BROWSER_TIMEZONE' , cachedUseBrowserTimezone )
119+
112120 commit ( 'SET_APIS' , { } )
113121 commit ( 'SET_NAME' , '' )
114122 commit ( 'SET_AVATAR' , '' )
@@ -133,12 +141,14 @@ const user = {
133141 const cachedApis = Vue . ls . get ( APIS , { } )
134142 const cachedZones = Vue . ls . get ( ZONES , [ ] )
135143 const cachedTimezoneOffset = Vue . ls . get ( TIMEZONE_OFFSET , 0.0 )
144+ const cachedUseBrowserTimezone = Vue . ls . get ( USE_BROWSER_TIMEZONE , false )
136145 const hasAuth = Object . keys ( cachedApis ) . length > 0
137146 if ( hasAuth ) {
138147 console . log ( 'Login detected, using cached APIs' )
139148 commit ( 'SET_ZONES' , cachedZones )
140149 commit ( 'SET_APIS' , cachedApis )
141150 commit ( 'SET_TIMEZONE_OFFSET' , cachedTimezoneOffset )
151+ commit ( 'SET_USE_BROWSER_TIMEZONE' , cachedUseBrowserTimezone )
142152
143153 // Ensuring we get the user info so that store.getters.user is never empty when the page is freshly loaded
144154 api ( 'listUsers' , { username : Cookies . get ( 'username' ) , listall : true } ) . then ( response => {
0 commit comments