web/satellite: sync timeout modal with user session timeout
This change updates the session timeout modal to be triggered based on the user's selected session timeout instead of the default config value that is if the user has set a custom session timeout duration. Change-Id: I1d3ace8542efe04c8ef4d729da6b6bec376d5ea4
This commit is contained in:
parent
efcae857ba
commit
b4ac006462
@ -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);
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
|
@ -212,7 +212,12 @@ const dashboardContent = ref<HTMLElement | null>(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<void> {
|
||||
* 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()) {
|
||||
|
@ -194,7 +194,12 @@ const dashboardContent = ref<HTMLElement | null>(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<void> {
|
||||
* 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user