Skip to content
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

[#50908] Implement redirect to project folder with waiting under /projects/:project_id/project_storages/:id/open #14204

Conversation

ba1ash
Copy link
Member

@ba1ash ba1ash commented Nov 21, 2023

See feature for description: https://community.openproject.org/wp/50437
Link to the implementation chunk(no useful information there): https://community.openproject.org/work_packages/50908
Some technical implementation details worth mentioning:

  1. A new flash message type has been introduced. A sample of usage:
        flash[:modal] = {
          type: 'Storages::OpenProjectStorageModalComponent',
          parameters: {
            project_storage_open_url: request.path,
            redirect_url: storage_open_url,
            state: :waiting
            }
          } 
    type is a class name for desired modal view_component.
    parameter are attributes that are passed to the modal class constructor.
  2. The waiting modal has a polling mechanism implemented. It is located in storages/open-project-storage-modal.controller.ts.
    In short:
    1. It starts polling.
    2. Wait for response to arrive.
    3. Is it 200?
      1. Yes, then there is a turbo_stream in the body with updated modal content. Apply the turbo_stream. Stop polling.
      2. No, it returns to it starts from the beginning.
  3. The logic that responds to the polling is located in storages/project_storages_controller.rb. Check the test for it: modules/storages/spec/requests/project_storages_open_spec.rb. I believe I was quite descriptive there.
  4. Storage links in project menu has been updated to be `[ensure_connection_url]?destination_url=[project_storage_open_url]
  5. To see the waiting modal locally you need to set nextcloud integration up, enable a project storage to be automatically managed, run a background synchronization job once, then add a user to the project, click on the link in a project menu, then there should be a waiting modal, then fire Nextcloud sync job again, the modal should be updated. Or contact me and let's test it together :)

@ba1ash ba1ash self-assigned this Nov 21, 2023
@ba1ash ba1ash marked this pull request as ready for review November 24, 2023 12:56
@ba1ash ba1ash requested a review from a team November 24, 2023 12:57
@apfohl apfohl self-requested a review November 28, 2023 09:59
Copy link
Contributor

@apfohl apfohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No major things to change. Mostly one 🟡 I would like you to change. The other 🟡 and 🟢 are just topics I would like to talk about with someone.

Refactor project_storages_controller to be more readable.
Extract some blocks of code to named methods.
…mplement-redirect-to-project-foler-with-waiting-under-projectsproject_idproject_storagesidopen
…oject-foler-with-waiting-under-projectsproject_idproject_storagesidopen
@ba1ash ba1ash requested a review from apfohl November 30, 2023 09:05
@ba1ash ba1ash merged commit 45deda6 into dev Nov 30, 2023
11 checks passed
@ba1ash ba1ash deleted the implementation/50908-implement-redirect-to-project-foler-with-waiting-under-projectsproject_idproject_storagesidopen branch November 30, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants