-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* CB-4436 update session only in touchSession * CB-4346 adds session touch for user actions * CB-4346 adds core-activity package * CB-4346 fix: mobx version core-activity package * CB-4346 ClientActivityService cleanup * CB-4346 ClientActivityService cleanup [2] * CB-4346 fix: client activity function contexts bind * CB-4346 useClientActivity cleanup * CB-4346 removed unneeded deps * CB-4346 session warning dialog props renaming * CB-4364 adds client activity service setsActivity method * CB-4346 activity timers refactor * CB-4346 adds min time for session expire setting * CB-4346 adds update client activity each 300ms * CB-4346 touchSession logic moved to SessionExpiredService * СB-4346 session expire service uses session resource to touchSession * CB-4346 code cleanup * CB-4346 removed unused activity package from plugin session expiration * CB-4346 SessionExpireService - removed cycle dependency * CB-4346 code cleanup * CB-4346 update session state if it is invalid * CB-4346 removed arrow function from useClientActivity * Revert "CB-4346 SessionExpireService - removed cycle dependency" This reverts commit adba2d5. * CB-4346 touchSession logic moved from SessionExpiredService to SessionResource because of cycle dependency * CB-4346 chore: core-activity -> core-client-activity renaming * CB-4346 chore: vars renaming * CB-4346 refactor: removed force from sessionResource.touchSession() * CB-4346 adds SessionTouchService * CB-4346 chore: SESSION_EXPIRE_MIN_TIME const new name * CB-4346 sessionTouchService license * CB-4346 uses SessionTouchService as Dependency * CB-4346 pr fixes * CB-4346 adds core-localization to plugin-session-expiration * CB-4346 adds core coreClientActivityManifest to unit tests * CB-4346 updates ts references * CB-4436 new update session gql api * CB-4346 adds updateSession API call * CB-4346 code cleanup sessionResource * CB-4346 do not send state event for not authorized session * CB-4346 chore: update session info with event * CB-4346 adds update activity on touch (tablets, phones support) * CB-4346 add debug log * CB-4346 force update session on create --------- Co-authored-by: s.teleshev <[email protected]> Co-authored-by: Aleksei Potsetsuev <[email protected]> Co-authored-by: Evgenia Bezborodova <[email protected]>
- Loading branch information
1 parent
3898729
commit c0c4e18
Showing
82 changed files
with
489 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import { useEffect } from 'react'; | ||
|
||
import { ClientActivityService } from '@cloudbeaver/core-client-activity'; | ||
import { useService } from '@cloudbeaver/core-di'; | ||
import { throttle } from '@cloudbeaver/core-utils'; | ||
|
||
const UPDATE_THROTTLE = 300; | ||
|
||
export function useClientActivity() { | ||
const clientActivityService = useService(ClientActivityService); | ||
|
||
const updateActivity = throttle(function updateActivity() { | ||
clientActivityService.updateActivity(); | ||
}, UPDATE_THROTTLE); | ||
|
||
function subscribeEvents() { | ||
document.addEventListener('mousemove', updateActivity); | ||
document.addEventListener('click', updateActivity); | ||
document.addEventListener('keydown', updateActivity); | ||
document.addEventListener('scroll', updateActivity); | ||
document.addEventListener('touchstart', updateActivity); | ||
} | ||
|
||
function unsubscribeEvents() { | ||
document.removeEventListener('mousemove', updateActivity); | ||
document.removeEventListener('click', updateActivity); | ||
document.removeEventListener('keydown', updateActivity); | ||
document.removeEventListener('scroll', updateActivity); | ||
document.removeEventListener('touchstart', updateActivity); | ||
} | ||
|
||
useEffect(() => { | ||
subscribeEvents(); | ||
|
||
return () => { | ||
unsubscribeEvents(); | ||
}; | ||
}, []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.