summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-api/static/schema.yml
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-08 16:08:02 +0200
committerGitHub <noreply@github.com>2021-07-08 16:08:02 +0200
commit1a2416043f0b877f570e89da74e0d0a4aff1d8ae (patch)
tree1bed18bb62d223be954faca87b0736d2a571b443 /opendc-web/opendc-web-api/static/schema.yml
parentdfd2ded56780995cec6d91af37443b710d4ddb3b (diff)
parent2c8d675c2cf140eac05988065a9d20fd2773399a (diff)
ui: Simplify data fetching in frontend
This pull request aims to simplify the data fetching logic in the OpenDC frontend. Previously, the frontend used Redux extensively to sync the server state with the client state, which introduced a lot of unnecessary complexity. With this pull request, we move most of the data fetching logic out of Redux and instead use React Query to perform the logic for fetching and caching API requests. * Move all server data except topologies outside Redux * Use React Query for fetching server data * (De)normalize topology using Normalizr * Remove current ids state from Redux * Combine fetching of project relations
Diffstat (limited to 'opendc-web/opendc-web-api/static/schema.yml')
-rw-r--r--opendc-web/opendc-web-api/static/schema.yml182
1 files changed, 181 insertions, 1 deletions
diff --git a/opendc-web/opendc-web-api/static/schema.yml b/opendc-web/opendc-web-api/static/schema.yml
index 6a07ae52..56cf58e7 100644
--- a/opendc-web/opendc-web-api/static/schema.yml
+++ b/opendc-web/opendc-web-api/static/schema.yml
@@ -222,6 +222,49 @@ paths:
schema:
$ref: "#/components/schemas/NotFound"
"/projects/{projectId}/topologies":
+ get:
+ tags:
+ - projects
+ description: Get Project Topologies.
+ parameters:
+ - name: projectId
+ in: path
+ description: Project's ID.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Successfully retrieved Project Topologies.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ type: array
+ items:
+ $ref: "#/components/schemas/Topology"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "403":
+ description: Forbidden from retrieving Project.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Forbidden"
+ "404":
+ description: Project not found.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/NotFound"
post:
tags:
- projects
@@ -273,9 +316,52 @@ paths:
schema:
$ref: "#/components/schemas/NotFound"
"/projects/{projectId}/portfolios":
+ get:
+ tags:
+ - projects
+ description: Get Project Portfolios.
+ parameters:
+ - name: projectId
+ in: path
+ description: Project's ID.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Successfully retrieved Project Portfolios.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ type: array
+ items:
+ $ref: "#/components/schemas/Portfolio"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "403":
+ description: Forbidden from retrieving Project.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Forbidden"
+ "404":
+ description: Project not found.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/NotFound"
post:
tags:
- - portfolios
+ - projects
description: Add a Portfolio.
parameters:
- name: projectId
@@ -611,6 +697,100 @@ paths:
"application/json":
schema:
$ref: "#/components/schemas/NotFound"
+ "/portfolios/{portfolioId}/scenarios":
+ get:
+ tags:
+ - portfolios
+ description: Get Portfolio Scenarios.
+ parameters:
+ - name: portfolioId
+ in: path
+ description: Portfolio's ID.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Successfully retrieved Portfolio Scenarios.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ type: array
+ items:
+ $ref: "#/components/schemas/Scenario"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "403":
+ description: Forbidden from retrieving Portfolio.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Forbidden"
+ "404":
+ description: Portfolio not found.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/NotFound"
+ post:
+ tags:
+ - portfolios
+ description: Add a Scenario.
+ parameters:
+ - name: portfolioId
+ in: path
+ description: Portfolio's ID.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ topology:
+ $ref: "#/components/schemas/Scenario"
+ description: The new Scenario.
+ required: true
+ responses:
+ "200":
+ description: Successfully added Scenario.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ $ref: "#/components/schemas/Scenario"
+ "400":
+ description: Missing or incorrectly typed parameter.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Invalid"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "404":
+ description: Portfolio not found.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/NotFound"
"/scenarios/{scenarioId}":
get:
tags: