diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-22 15:19:32 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:48:20 +0200 |
| commit | 94cc7acc9eeb88177b7d75ff1d1c3245d09bce53 (patch) | |
| tree | 4dafa247409b3c3c51ff8cdf59866acffa155773 /frontend/src | |
| parent | dbb652a4c97a627a0c5969d1f75e4777e3efd06f (diff) | |
Set first scenario name to be "Base scenario"
Diffstat (limited to 'frontend/src')
3 files changed, 9 insertions, 2 deletions
diff --git a/frontend/src/components/app/results/PortfolioResultsComponent.js b/frontend/src/components/app/results/PortfolioResultsComponent.js index 286dd48c..90325b2b 100644 --- a/frontend/src/components/app/results/PortfolioResultsComponent.js +++ b/frontend/src/components/app/results/PortfolioResultsComponent.js @@ -54,7 +54,7 @@ const PortfolioResultsComponent = ({ portfolio, scenarios }) => { <div className="col-6 mb-2" key={metric}> <h4>{METRIC_NAMES[metric]}</h4> <ResponsiveContainer aspect={16 / 9} width="100%"> - <ComposedChart data={dataPerMetric[metric]} margin={{ bottom: 15 }} layout="vertical"> + <ComposedChart data={dataPerMetric[metric]} margin={{ left: 20, bottom: 15 }} layout="vertical"> <CartesianGrid strokeDasharray="3 3" /> <XAxis tickFormatter={(tick) => approx(tick)} diff --git a/frontend/src/components/modals/custom-components/NewScenarioModalComponent.js b/frontend/src/components/modals/custom-components/NewScenarioModalComponent.js index 0bb4aeab..51116f59 100644 --- a/frontend/src/components/modals/custom-components/NewScenarioModalComponent.js +++ b/frontend/src/components/modals/custom-components/NewScenarioModalComponent.js @@ -7,6 +7,7 @@ class NewScenarioModalComponent extends React.Component { static propTypes = { show: PropTypes.bool.isRequired, currentPortfolioId: PropTypes.string.isRequired, + currentPortfolioScenarioIds: PropTypes.arrayOf(PropTypes.string), traces: PropTypes.arrayOf(Shapes.Trace), topologies: PropTypes.arrayOf(Shapes.Topology), schedulers: PropTypes.arrayOf(Shapes.Scheduler), @@ -17,8 +18,12 @@ class NewScenarioModalComponent extends React.Component { this.reset() } + componentDidUpdate() { + this.textInput.value = this.props.currentPortfolioScenarioIds.length === 0 ? 'Base scenario' : '' + } + reset() { - this.textInput.value = '' + this.textInput.value = this.props.currentPortfolioScenarioIds.length === 0 ? 'Base scenario' : '' this.traceSelect.selectedIndex = 0 this.traceLoadInput.value = 1.0 this.topologySelect.selectedIndex = 0 @@ -72,6 +77,7 @@ class NewScenarioModalComponent extends React.Component { type="text" className="form-control" required + disabled={this.props.currentPortfolioScenarioIds.length === 0} ref={(textInput) => (this.textInput = textInput)} /> </div> diff --git a/frontend/src/containers/modals/NewScenarioModal.js b/frontend/src/containers/modals/NewScenarioModal.js index 6a87d697..c46d0a13 100644 --- a/frontend/src/containers/modals/NewScenarioModal.js +++ b/frontend/src/containers/modals/NewScenarioModal.js @@ -15,6 +15,7 @@ const mapStateToProps = (state) => { return { show: state.modals.newScenarioModalVisible, currentPortfolioId: state.currentPortfolioId, + currentPortfolioScenarioIds: state.currentPortfolioId !== '-1' && state.objects.portfolio[state.currentPortfolioId] ? state.objects.portfolio[state.currentPortfolioId].scenarioIds : [], traces: Object.values(state.objects.trace), topologies, schedulers: Object.values(state.objects.scheduler), |
