Skip to content

Commit

Permalink
feat: Support namesapce in submitJob
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege committed Sep 29, 2019
1 parent 35ef85e commit e029caa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions pkg/ui/v1alpha3/frontend/src/actions/hpCreateActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ export const changeTrial = (trial) => ({
trial,
})

export const CHANGE_TRIAL_NAMESPACE_HP = "CHANGE_TRIAL_NAMESPACE_HP";

export const changeTrialNamespace = (namespace) => ({
type: CHANGE_TRIAL_NAMESPACE_HP,
namespace,
})

export const SUBMIT_HP_JOB_REQUEST = "SUBMIT_HP_JOB_REQUEST";
export const SUBMIT_HP_JOB_SUCCESS = "SUBMIT_HP_JOB_SUCCESS";
export const SUBMIT_HP_JOB_FAILURE = "SUBMIT_HP_JOB_FAILURE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ const mapStateToProps = (state) => ({
algorithmName: state[module].algorithmName,
algorithmSettings: state[module].algorithmSettings,
parameters: state[module].parameters,
trial: state[module].trial
trial: state[module].trial,
trialNamespace: state[module].trialNamespace,
})

//TODO: Added validation and remove it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Select from '@material-ui/core/Select';
import TextField from '@material-ui/core/TextField';

import { connect } from 'react-redux';
import { changeTrial } from '../../../../actions/hpCreateActions';
import { changeTrial, changeTrialNamespace } from '../../../../actions/hpCreateActions';
import { fetchTrialTemplates } from '../../../../actions/templateActions';

const module = "hpCreate";
Expand Down Expand Up @@ -44,6 +44,7 @@ class TrialSpecParam extends React.Component {

onTrialNamespaceChange = (event) => {
this.props.fetchTrialTemplates(event.target.value);
this.props.changeTrialNamespace(event.target.value);
}

onTrialChange = (event) => {
Expand Down Expand Up @@ -118,7 +119,8 @@ const mapStateToProps = state => {
return {
trial: state[module].trial,
templates: state[templateModule].trialTemplates,
trialNamespace: state[module].trialNamespace,
}
}

export default connect(mapStateToProps, { changeTrial, fetchTrialTemplates })(withStyles(styles)(TrialSpecParam));
export default connect(mapStateToProps, { changeTrialNamespace, changeTrial, fetchTrialTemplates })(withStyles(styles)(TrialSpecParam));
5 changes: 5 additions & 0 deletions pkg/ui/v1alpha3/frontend/src/reducers/hpCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ const hpCreateReducer = (state = initialState, action) => {
...state,
trial: action.trial,
}
case actions.CHANGE_TRIAL_NAMESPACE_HP:
return {
...state,
trialNamespace: action.namespace,
}
default:
return state;
}
Expand Down

0 comments on commit e029caa

Please sign in to comment.