-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DAPS-1283] Add Resume Flow For Consent Reconstruct #1327
Conversation
Reviewer's Guide by SourceryThis pull request introduces session storage to persist and resume the transfer flow, especially when consent is required. It also refactors the endpoint manager to use a state object and modifies the browse button functionality to support resuming the flow. Sequence diagram for resuming transfer flowsequenceDiagram
participant User
participant Browser
participant TransferDialogController
User->>Browser: Navigates to page after consent
Browser->>Browser: Checks sessionStorage for 'resumeFlow'
alt resumeFlow === "true"
Browser->>Browser: Retrieves 'transferDialogState' from sessionStorage
Browser->>TransferDialogController: new TransferDialogController(state.mode, state.ids, state.callback)
TransferDialogController->>TransferDialogController: show()
TransferDialogController->>Browser: Initializes UI components
Browser->>User: Displays transfer dialog with previous state
Browser->>Browser: Removes 'resumeFlow' from sessionStorage
else resumeFlow !== "true"
Browser->>User: Normal page load
end
Updated class diagram for TransferEndpointManagerclassDiagram
class TransferEndpointManager {
-controller
-api
-dialogs
+state
+constructor(controller, services)
+loadCache()
+saveCache()
+handlePathInput(searchToken)
+searchEndpoint(endpoint, searchToken)
+updateMatchesList(endpoints)
+handleSelectedEndpoint(data)
}
note for TransferEndpointManager "State object added to manage component state and sessionStorage integration."
Updated class diagram for TransferUIManagerclassDiagram
class TransferUIManager {
-api
-dialogs
+cachedComponentData
+inputTimer
+state
+constructor(services)
+loadCache()
+saveCache()
+initializeComponents()
+initializePathInput()
+initializeBrowseButton()
+showBrowseDialog(pathInput)
+getBrowsePath(currentPath)
+getDefaultPath(endpoint)
+handleSelectedEndpoint(data)
+updateEndpointOptions(endpoint)
+enableStartButton(enable)
+enableBrowseButton(enable)
+safelyExecuteUIOperation(operation)
}
note for TransferUIManager "Added caching and state management for UI persistence."
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
a8e334a
to
58172e5
Compare
|
bc94435
to
b3fdd17
Compare
… need to reinit function from string
… state management
…I state management
… TransferEndpointManager
a76a16a
to
c755b0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR adds a resume flow for the transfer process after consent redirects by leveraging redux‐persist with sessionStorage. Key changes include:
- Configuring a Redux store with redux‐persist for transfer state management.
- Integrating a resume flow in main.js that restores a previous transfer session.
- Updating multiple transfer components (dialog controller, UI manager, endpoint manager, and endpoint browser) to support independent state management and caching.
Reviewed Changes
File | Description |
---|---|
web/static/store/store.js | Introduces Redux store setup and persistence with sessionStorage. |
web/static/main.js | Implements resumeTransferFlow with rehydration and state validation before restoring transfers. |
web/static/components/transfer/transfer-dialog-controller.js | Adds state saving and clearing within the transfer dialog lifecycle. |
web/static/components/transfer/transfer-ui-manager.js | Enhances UI state management by syncing with the Redux store. |
web/datafed-ws.js | Updates session metadata during logout processing. |
web/static/dlg_data_new_edit.js | Adjusts transfer dialog invocation to pass an explicit TransferMode. |
web/static/store/reducers/transfer-reducer.js | Defines reducer actions for saving, clearing, and updating transfer-related states. |
web/static/store/index.js | Provides a simple Redux-like store implementation. |
web/static/components/transfer/transfer-endpoint-manager.js | Refactors endpoint manager to load and update state from Redux store. |
web/static/components/transfer/index.js | Updates transfer dialog type annotations with TransferMode. |
web/static/components/endpoint-browse/index.js | Integrates cached state handling and consent redirect flow improvements. |
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
web/static/components/endpoint-browse/index.js:55
- The use of new Function to reconstruct a callback from a string can introduce security risks if the stored string is tampered with. Consider using a safer serialization/deserialization approach for callbacks.
onSelect: props.onSelect || Function("return " + cachedComponentData.props.onSelect),
// Set resumeFlow flag in sessionStorage | ||
sessionStorage.setItem("resumeFlow", "true"); | ||
|
||
window.location.reload(consentLink.getAttribute("data-url")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
window.location.reload() does not accept a URL parameter; instead, assign the URL to window.location.href. For example, replace the line with: window.location.href = consentLink.getAttribute("data-url");
window.location.reload(consentLink.getAttribute("data-url")); | |
window.location.href = consentLink.getAttribute("data-url"); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
PR Description
This pr:
resumeTransferFlow
check toweb/static/main.js
Addressesd [Web, UI] Manage Consent Redirect
Tasks
Summary by Sourcery
This pull request introduces the ability to resume the transfer flow after a consent redirect. It leverages sessionStorage to persist the state of the transfer dialog and endpoint browser, allowing users to continue their transfer process seamlessly after granting consent. It also adds a check for
resumeTransferFlow
toweb/static/main.js
to handle the resumption of the transfer flow.New Features:
Enhancements: