diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-08 13:36:39 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-08 13:36:39 +0200 |
| commit | 2c8d675c2cf140eac05988065a9d20fd2773399a (patch) | |
| tree | 1bed18bb62d223be954faca87b0736d2a571b443 /opendc-web/opendc-web-ui/src/api | |
| parent | 29196842447d841d2e21462adcfc8c2ed1d851ad (diff) | |
ui: Combine fetching of project relations
This change updates the OpenDC frontend to combine the fetching of
project relations. This means that for a single project, we make only
one additional request to retrieve all its topologies.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/api')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/api/portfolios.js | 4 | ||||
| -rw-r--r-- | opendc-web/opendc-web-ui/src/api/scenarios.js | 4 | ||||
| -rw-r--r-- | opendc-web/opendc-web-ui/src/api/topologies.js | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/src/api/portfolios.js b/opendc-web/opendc-web-ui/src/api/portfolios.js index 36709b36..82ac0ced 100644 --- a/opendc-web/opendc-web-ui/src/api/portfolios.js +++ b/opendc-web/opendc-web-ui/src/api/portfolios.js @@ -26,6 +26,10 @@ export function fetchPortfolio(auth, portfolioId) { return request(auth, `portfolios/${portfolioId}`) } +export function fetchPortfoliosOfProject(auth, projectId) { + return request(auth, `projects/${projectId}/portfolios`) +} + export function addPortfolio(auth, portfolio) { return request(auth, `projects/${portfolio.projectId}/portfolios`, 'POST', { portfolio }) } diff --git a/opendc-web/opendc-web-ui/src/api/scenarios.js b/opendc-web/opendc-web-ui/src/api/scenarios.js index 3a7c7e6f..88516caa 100644 --- a/opendc-web/opendc-web-ui/src/api/scenarios.js +++ b/opendc-web/opendc-web-ui/src/api/scenarios.js @@ -26,6 +26,10 @@ export function fetchScenario(auth, scenarioId) { return request(auth, `scenarios/${scenarioId}`) } +export function fetchScenariosOfPortfolio(auth, portfolioId) { + return request(auth, `portfolios/${portfolioId}/scenarios`) +} + export function addScenario(auth, scenario) { return request(auth, `portfolios/${scenario.portfolioId}/scenarios`, 'POST', { scenario }) } diff --git a/opendc-web/opendc-web-ui/src/api/topologies.js b/opendc-web/opendc-web-ui/src/api/topologies.js index 74fc1977..0b8864e0 100644 --- a/opendc-web/opendc-web-ui/src/api/topologies.js +++ b/opendc-web/opendc-web-ui/src/api/topologies.js @@ -26,6 +26,10 @@ export function fetchTopology(auth, topologyId) { return request(auth, `topologies/${topologyId}`) } +export function fetchTopologiesOfProject(auth, projectId) { + return request(auth, `projects/${projectId}/topologies`) +} + export function addTopology(auth, topology) { return request(auth, `projects/${topology.projectId}/topologies`, 'POST', { topology }) } |
