summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-07 15:07:11 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-07 15:07:11 +0200
commitaa788a3ad18badfac8beaabdaffc88b9e52f9306 (patch)
tree2046d0a401ca0853d5e85de9d6360edcb79f7ebd /opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js
parent1ce8bf170cda2afab334cd330325cd4fbb97dab4 (diff)
ui: Remove current ids state from Redux
This change removes the current active identifiers from the Redux state. Instead, we use the router query to track the active project, portfolio and topology.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js')
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js38
1 files changed, 3 insertions, 35 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js b/opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js
index f990dfcb..e81d2b78 100644
--- a/opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js
+++ b/opendc-web/opendc-web-ui/src/components/app/sidebars/project/ScenarioListComponent.js
@@ -1,48 +1,19 @@
import PropTypes from 'prop-types'
import React from 'react'
import { Scenario } from '../../../../shapes'
-import Link from 'next/link'
import { Button, Col, Row } from 'reactstrap'
-import classNames from 'classnames'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-import { faPlus, faPlay, faTrash } from '@fortawesome/free-solid-svg-icons'
+import { faPlus, faTrash } from '@fortawesome/free-solid-svg-icons'
-function ScenarioListComponent({
- scenarios,
- portfolioId,
- currentProjectId,
- currentScenarioId,
- onNewScenario,
- onChooseScenario,
- onDeleteScenario,
-}) {
+function ScenarioListComponent({ scenarios, portfolioId, onNewScenario, onDeleteScenario }) {
return (
<>
{scenarios.map((scenario, idx) => (
<Row key={scenario._id} className="mb-1">
- <Col
- xs="7"
- className={classNames('pl-5 align-self-center', {
- 'font-weight-bold': scenario._id === currentScenarioId,
- })}
- >
+ <Col xs="7" className="pl-5 align-self-center">
{scenario.name}
</Col>
<Col xs="5" className="text-right">
- <Link
- passHref
- href={`/projects/${currentProjectId}/portfolios/${scenario.portfolioId}/scenarios/${scenario._id}`}
- >
- <Button
- color="primary"
- outline
- disabled
- className="mr-1"
- onClick={() => onChooseScenario(scenario.portfolioId, scenario._id)}
- >
- <FontAwesomeIcon icon={faPlay} />
- </Button>
- </Link>
<Button
color="danger"
outline
@@ -67,10 +38,7 @@ function ScenarioListComponent({
ScenarioListComponent.propTypes = {
scenarios: PropTypes.arrayOf(Scenario),
portfolioId: PropTypes.string,
- currentProjectId: PropTypes.string.isRequired,
- currentScenarioId: PropTypes.string,
onNewScenario: PropTypes.func.isRequired,
- onChooseScenario: PropTypes.func.isRequired,
onDeleteScenario: PropTypes.func.isRequired,
}