diff --git a/src/routes/settings/costModels/costModel/updateCostModel.tsx b/src/routes/settings/costModels/costModel/updateCostModel.tsx index 8aa4a07078..705484f2fc 100644 --- a/src/routes/settings/costModels/costModel/updateCostModel.tsx +++ b/src/routes/settings/costModels/costModel/updateCostModel.tsx @@ -1,10 +1,14 @@ import { Alert, Button, Form, FormGroup, Modal, TextArea, TextInput } from '@patternfly/react-core'; +import { SelectDirection } from '@patternfly/react-core/deprecated'; import type { CostModel } from 'api/costModels'; import messages from 'locales/messages'; import React from 'react'; import type { WrappedComponentProps } from 'react-intl'; import { injectIntl } from 'react-intl'; import { connect } from 'react-redux'; +import { currencyOptions } from 'routes/components/currency'; +import { Selector } from 'routes/settings/costModels/components/inputs/selector'; +import { styles } from 'routes/settings/costModels/costModelWizard/wizard.styles'; import { createMapStateToProps } from 'store/common'; import { costModelsActions, costModelsSelectors } from 'store/costModels'; @@ -26,6 +30,7 @@ interface UpdateCostModelDispatchProps { interface UpdateCostModelState { name?: string; + currency?: string; description?: string; } @@ -37,12 +42,17 @@ class UpdateCostModelBase extends React.Component { + const val = options.find(o => o.value === valStr); + return !val ? valStr : intl.formatMessage(val.label, { units: val.value }); + }; return ( provider.uuid), name: this.state.name, + currency: this.state.currency, description: this.state.description, source_type: current.source_type === 'OpenShift Container Platform' ? 'OCP' : 'AWS', } as any, @@ -68,7 +79,10 @@ class UpdateCostModelBase extends React.Component {intl.formatMessage(messages.save)} @@ -105,6 +119,24 @@ class UpdateCostModelBase extends React.Component this.setState({ description: value })} /> + + this.setState({ currency: value })} + id="currency-units-selector" + options={currencyOptions.map(o => { + return { + label: intl.formatMessage(o.label, { units: o.value }), + value: o.value, + }; + })} + /> +