summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2023-01-30 22:22:59 +0000
committerFabian Mastenbroek <mail.fabianm@gmail.com>2023-02-02 21:56:07 +0000
commit49b3015a16287bb4486aa64c5c26f05f7c22089c (patch)
tree2c2e3ef49181ed740ac938b00a00ae5958d96d30 /opendc-web/opendc-web-ui/src
parent6927c51885bb3073b310150c4f40c64eea44a919 (diff)
refactor(web/server): Remove unnecessary service indirections
This change removes the unnecessary service classes where they are only used to forward data from the resource to the entities. Furthermore, DTOs are now moved from the service layer to the resources.
Diffstat (limited to 'opendc-web/opendc-web-ui/src')
-rw-r--r--opendc-web/opendc-web-ui/src/components/portfolios/PortfolioResults.js19
-rw-r--r--opendc-web/opendc-web-ui/src/components/portfolios/ScenarioTable.js4
-rw-r--r--opendc-web/opendc-web-ui/src/shapes.js2
3 files changed, 14 insertions, 11 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/portfolios/PortfolioResults.js b/opendc-web/opendc-web-ui/src/components/portfolios/PortfolioResults.js
index f50105ed..62150fa7 100644
--- a/opendc-web/opendc-web-ui/src/components/portfolios/PortfolioResults.js
+++ b/opendc-web/opendc-web-ui/src/components/portfolios/PortfolioResults.js
@@ -57,14 +57,17 @@ function PortfolioResults({ projectId, portfolioId }) {
const dataPerMetric = {}
AVAILABLE_METRICS.forEach((metric) => {
dataPerMetric[metric] = scenarios
- .filter((scenario) => scenario.job?.results)
- .map((scenario) => ({
- metric,
- x: scenario.name,
- y: mean(scenario.job.results[metric]),
- errorY: std(scenario.job.results[metric]),
- label,
- }))
+ .filter((scenario) => scenario.jobs && scenario.jobs[scenario.jobs.length - 1].results)
+ .map((scenario) => {
+ const job = scenario.jobs[scenario.jobs.length - 1]
+ return {
+ metric,
+ x: scenario.name,
+ y: mean(job.results[metric]),
+ errorY: std(job.results[metric]),
+ label,
+ }
+ })
})
return dataPerMetric
}, [scenarios])
diff --git a/opendc-web/opendc-web-ui/src/components/portfolios/ScenarioTable.js b/opendc-web/opendc-web-ui/src/components/portfolios/ScenarioTable.js
index 5fd2a1da..b068d045 100644
--- a/opendc-web/opendc-web-ui/src/components/portfolios/ScenarioTable.js
+++ b/opendc-web/opendc-web-ui/src/components/portfolios/ScenarioTable.js
@@ -59,7 +59,7 @@ function ScenarioTable({ portfolio, status }) {
<Td dataLabel="Topology">
{scenario.topology ? (
<Link href={`/projects/${projectId}/topologies/${scenario.topology.number}`}>
- scenario.topology.name
+ {scenario.topology.name}
</Link>
) : (
'Unknown Topology'
@@ -69,7 +69,7 @@ function ScenarioTable({ portfolio, status }) {
scenario.workload.samplingFraction * 100
}%)`}</Td>
<Td dataLabel="State">
- <ScenarioState state={scenario.job.state} />
+ <ScenarioState state={scenario.jobs[scenario.jobs.length - 1].state} />
</Td>
<Td isActionCell>
<ActionsColumn items={actions(scenario)} />
diff --git a/opendc-web/opendc-web-ui/src/shapes.js b/opendc-web/opendc-web-ui/src/shapes.js
index 6c93f458..50b82361 100644
--- a/opendc-web/opendc-web-ui/src/shapes.js
+++ b/opendc-web/opendc-web-ui/src/shapes.js
@@ -159,7 +159,7 @@ export const Scenario = PropTypes.shape({
topology: TopologySummary.isRequired,
phenomena: Phenomena.isRequired,
schedulerName: PropTypes.string.isRequired,
- job: Job.isRequired,
+ jobs: PropTypes.arrayOf(Job).isRequired,
})
export const Portfolio = PropTypes.shape({