diff --git a/web/satellite/src/components/modals/editSessionTimeout/TimeoutSelector.vue b/web/satellite/src/components/modals/editSessionTimeout/TimeoutSelector.vue index 8f0bc7369..337ce9589 100644 --- a/web/satellite/src/components/modals/editSessionTimeout/TimeoutSelector.vue +++ b/web/satellite/src/components/modals/editSessionTimeout/TimeoutSelector.vue @@ -111,13 +111,14 @@ function toggleSelector() { align-items: center; justify-content: space-between; position: relative; - margin: 10px 14px; + padding: 10px 14px; &__label { font-family: 'font_regular', sans-serif; font-size: 14px; line-height: 20px; color: var(--c-grey-6); + cursor: default; } &__arrow { @@ -143,6 +144,10 @@ function toggleSelector() { &__item { padding: 10px; + &__label { + cursor: default; + } + &.selected { background: var(--c-grey-1); } diff --git a/web/satellite/src/utils/time.ts b/web/satellite/src/utils/time.ts index 764c775bf..889ba5b67 100644 --- a/web/satellite/src/utils/time.ts +++ b/web/satellite/src/utils/time.ts @@ -63,6 +63,10 @@ export class Duration { return this.parsed.seconds; } + get fullSeconds(): number { + return Math.floor((this.nanoseconds / 1000000) / 1000); + } + /** * shortString represents this duration in the appropriate unit. * */ @@ -75,7 +79,7 @@ export class Duration { } else if (this.hours > 0) { numberPart = this.hours; unitPart = 'hour'; - } if (this.minutes > 0) { + } else if (this.minutes > 0) { numberPart = this.minutes; unitPart = 'minute'; } diff --git a/web/satellite/src/views/DashboardArea.vue b/web/satellite/src/views/DashboardArea.vue index 815f78ca8..1ba8dc805 100644 --- a/web/satellite/src/views/DashboardArea.vue +++ b/web/satellite/src/views/DashboardArea.vue @@ -212,7 +212,12 @@ const dashboardContent = ref(null); * Returns the session duration from the store. */ const sessionDuration = computed((): number => { - return configStore.state.config.inactivityTimerDuration * 1000; + const duration = (usersStore.state.settings.sessionDuration?.fullSeconds || configStore.state.config.inactivityTimerDuration) * 1000; + const maxTimeout = 2.1427e+9; // 24.8 days https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value + if (duration > maxTimeout) { + return maxTimeout; + } + return duration; }); /** @@ -695,8 +700,13 @@ async function onSessionActivity(): Promise { * Pre fetches user`s and project information. */ onMounted(async () => { - usersStore.$onAction((action) => { - if (action.name === 'clear') clearSessionTimers(); + usersStore.$onAction(({ name, after, args }) => { + if (name === 'clear') clearSessionTimers(); + else if (name === 'updateSettings') { + if (args[0].sessionDuration !== usersStore.state.settings.sessionDuration?.nanoseconds) { + after((_) => refreshSession()); + } + } }); if (LocalData.getLargeUploadNotificationDismissed()) { diff --git a/web/satellite/src/views/all-dashboard/AllDashboardArea.vue b/web/satellite/src/views/all-dashboard/AllDashboardArea.vue index 65878bab0..5cc0dba65 100644 --- a/web/satellite/src/views/all-dashboard/AllDashboardArea.vue +++ b/web/satellite/src/views/all-dashboard/AllDashboardArea.vue @@ -194,7 +194,12 @@ const dashboardContent = ref(null); * Returns the session duration from the store. */ const sessionDuration = computed((): number => { - return configStore.state.config.inactivityTimerDuration * 1000; + const duration = (usersStore.state.settings.sessionDuration?.fullSeconds || configStore.state.config.inactivityTimerDuration) * 1000; + const maxTimeout = 2.1427e+9; // 24.8 days https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value + if (duration > maxTimeout) { + return maxTimeout; + } + return duration; }); /** @@ -579,8 +584,13 @@ async function onSessionActivity(): Promise { * Pre fetches user`s and project information. */ onMounted(async () => { - usersStore.$onAction((action) => { - if (action.name === 'clear') clearSessionTimers(); + usersStore.$onAction(({ name, after, args }) => { + if (name === 'clear') clearSessionTimers(); + else if (name === 'updateSettings') { + if (args[0].sessionDuration !== usersStore.state.settings.sessionDuration?.nanoseconds) { + after((_) => refreshSession()); + } + } }); try {