Skip to content

Conversation

@odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Jul 10, 2025

What do these changes do?

Continuation of #8087

Related issue/s

How to test

Dev-ops

@odeimaiz odeimaiz self-assigned this Jul 10, 2025
@odeimaiz odeimaiz added this to the Engage milestone Jul 10, 2025
@odeimaiz odeimaiz changed the title 🎨 [Frontend] Enh: Move Study State and Study Debt to Study Store ♻️🎨 [Frontend] Study Store II Jul 11, 2025
@odeimaiz odeimaiz requested a review from Copilot July 11, 2025 12:23
@odeimaiz odeimaiz marked this pull request as ready for review July 11, 2025 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors study-related API interactions to use centralized store singletons (osparc.store.Study and osparc.store.Templates), reducing duplicated fetch calls and consolidating state and debt management.

  • Introduces osparc.store.Study with methods for opening, closing, creating, duplicating, and paying debt for studies, plus events and caching for study state/debt.
  • Adds osparc.store.Templates.createTemplate and updates the Resources specification for postToTemplate.
  • Replaces direct osparc.data.Resources.fetch calls across multiple components and updates corresponding tests and handlers.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
services/static-webserver/client/source/class/osparc/viewer/NodeViewer.js Switched study open to use osparc.store.Study.openStudy
services/static-webserver/client/source/class/osparc/study/Utils.js Updated createStudyAndPoll to call osparc.store.Study methods
services/static-webserver/client/source/class/osparc/study/CreateFunction.js Replaced template fetch with osparc.store.Templates.createTemplate
services/static-webserver/client/source/class/osparc/study/BillingSettings.js Changed debt payment to use osparc.store.Study.payDebt
services/static-webserver/client/source/class/osparc/store/Templates.js Added createTemplate helper
services/static-webserver/client/source/class/osparc/store/Study.js New singleton with state/debt management and API wrappers
services/static-webserver/client/source/class/osparc/store/Store.js Removed duplicated state/debt logic
services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js Updated close and state polling to use store methods
services/static-webserver/client/source/class/osparc/desktop/MainPage.js Updated template creation and study state polling via stores
services/static-webserver/client/source/class/osparc/data/model/Study.js Modified model’s openStudy to delegate to store.Study
services/static-webserver/client/source/class/osparc/data/Resources.js Moved postToTemplate endpoint under correct section
services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js Switched listeners and invalidation to store.Study
services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js Updated debt lookup to store.Study.getStudyDebt
Comments suppressed due to low confidence (5)

services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js:631

  • The call to osparc.store.Study is incorrect. You should use osparc.store.Study.getInstance().getStudyState(pipelineId) without invoking Study as a function.
          osparc.store.Study().getInstance().getStudyState(pipelineId);

services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js:931

  • closeStudy was moved to osparc.store.Study. Update this call to osparc.store.Study.getInstance().closeStudy(this.getStudy().getUuid()).
      osparc.store.Store.getInstance().closeStudy(this.getStudy().getUuid())

services/static-webserver/client/source/class/osparc/desktop/MainPage.js:312

  • Incorrect invocation of the Study store. Use osparc.store.Study.getInstance().getStudyState(studyId) instead of calling Study().
        osparc.store.Study().getInstance().getStudyState(studyId);

services/static-webserver/client/source/class/osparc/desktop/MainPage.js:358

  • Incorrect invocation of the Study store. Replace with osparc.store.Study.getInstance().getStudyState(studyId).
        osparc.store.Study().getInstance().getStudyState(studyId);

services/static-webserver/client/source/class/osparc/study/BillingSettings.js:241

  • The variable walletId is not defined here. You should extract it from the wallet object returned by __getSelectedWallet(), e.g., wallet.getWalletId().
      osparc.store.Study.getInstance().payDebt(this.__studyData["uuid"], walletId, this.__studyData["debt"])

@odeimaiz odeimaiz added the 🤖-automerge marks PR as ready to be merged for Mergify label Jul 11, 2025
@odeimaiz
Copy link
Member Author

@mergify queue

@mergify
Copy link
Contributor

mergify bot commented Jul 11, 2025

queue

🟠 Waiting for conditions to match

  • -closed [📌 queue requirement]
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of: [📌 queue -> configuration change requirements]
    • -mergify-configuration-changed
    • check-success = Configuration changed
  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue default]
      • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
      • #approved-reviews-by>=2
      • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
      • #changes-requested-reviews-by=0
      • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
      • #review-threads-unresolved=0
      • -conflict
      • -draft
      • base=master
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • label!=🤖-do-not-merge
      • label=🤖-automerge
      • any of: [🛡 GitHub branch protection]
        • check-skipped = deploy to dockerhub
        • check-neutral = deploy to dockerhub
        • check-success = deploy to dockerhub
      • any of: [🛡 GitHub branch protection]
        • check-success = system-tests
        • check-neutral = system-tests
        • check-skipped = system-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = unit-tests
        • check-neutral = unit-tests
        • check-skipped = unit-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = check OAS' are up to date
        • check-neutral = check OAS' are up to date
        • check-skipped = check OAS' are up to date
      • any of: [🛡 GitHub branch protection]
        • check-success = integration-tests
        • check-neutral = integration-tests
        • check-skipped = integration-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = build-test-images (frontend) / build-test-images
        • check-neutral = build-test-images (frontend) / build-test-images
        • check-skipped = build-test-images (frontend) / build-test-images

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

👍

@sonarqubecloud
Copy link

@odeimaiz odeimaiz enabled auto-merge (squash) July 14, 2025 07:48
@odeimaiz odeimaiz merged commit 83c06b5 into ITISFoundation:master Jul 14, 2025
110 of 112 checks passed
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:frontend issue affecting the front-end (area group) t:enhancement Improvement or request on an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants