diff --git a/dashboard/src/components/AppNew/AppNew.tsx b/dashboard/src/components/AppNew/AppNew.tsx index db5ae5f453f..882a11fd816 100644 --- a/dashboard/src/components/AppNew/AppNew.tsx +++ b/dashboard/src/components/AppNew/AppNew.tsx @@ -20,6 +20,7 @@ interface IAppNewProps { selected: IChartState["selected"]; chartVersion: string; push: (location: string) => RouterAction; + fetchChartVersions: (id: string) => Promise<{}>; getBindings: () => Promise; getChartVersion: (id: string, chartVersion: string) => Promise<{}>; getChartValues: (id: string, chartVersion: string) => Promise<{}>; @@ -29,6 +30,7 @@ interface IAppNewState { isDeploying: boolean; // deployment options releaseName: string; + chartVersion: string; namespace: string; appValues?: string; valuesModified: boolean; @@ -39,6 +41,7 @@ interface IAppNewState { class AppNew extends React.Component { public state: IAppNewState = { appValues: undefined, + chartVersion: "", error: undefined, isDeploying: false, namespace: "default", @@ -46,11 +49,24 @@ class AppNew extends React.Component { selectedBinding: undefined, valuesModified: false, }; + + constructor(props: any) { + super(props); + this.state.chartVersion = props.chartVersion; + } + public componentDidMount() { - const { chartID, getBindings, getChartVersion, getChartValues, chartVersion } = this.props; + const { + chartID, + fetchChartVersions, + getBindings, + getChartVersion, + getChartValues, + } = this.props; + fetchChartVersions(chartID); getBindings(); - getChartVersion(chartID, chartVersion); - getChartValues(chartID, chartVersion); + getChartVersion(chartID, this.state.chartVersion); + getChartValues(chartID, this.state.chartVersion); } public componentWillReceiveProps(nextProps: IAppNewProps) { @@ -120,6 +136,20 @@ class AppNew extends React.Component { required={true} /> +
+ + +
{ public handleReleaseNameChange = (e: React.FormEvent) => { this.setState({ releaseName: e.currentTarget.value }); }; + public handleChartVersionChange = (e: React.FormEvent) => { + const { chartID, getChartVersion, getChartValues } = this.props; + getChartVersion(chartID, e.currentTarget.value); + getChartValues(chartID, e.currentTarget.value); + this.setState({ chartVersion: e.currentTarget.value }); + }; public handleNamespaceChange = (e: React.FormEvent) => { this.setState({ namespace: e.currentTarget.value }); }; diff --git a/dashboard/src/containers/AppNewContainer/AppNewContainer.tsx b/dashboard/src/containers/AppNewContainer/AppNewContainer.tsx index 0d2af123b3b..76c79e080eb 100644 --- a/dashboard/src/containers/AppNewContainer/AppNewContainer.tsx +++ b/dashboard/src/containers/AppNewContainer/AppNewContainer.tsx @@ -36,6 +36,7 @@ function mapDispatchToProps(dispatch: Dispatch) { namespace: string, values?: string, ) => dispatch(actions.charts.deployChart(version, releaseName, namespace, values)), + fetchChartVersions: (id: string) => dispatch(actions.charts.fetchChartVersions(id)), getBindings: () => dispatch(actions.catalog.getBindings()), getChartValues: (id: string, version: string) => dispatch(actions.charts.getChartValues(id, version)),