addresses missing name property and fixes tests

This commit is contained in:
Alex Corey
2020-12-07 18:35:38 -05:00
committed by mabashian
parent 7d5b198ce6
commit 307c9eafb3
42 changed files with 1704 additions and 987 deletions

View File

@@ -44,6 +44,7 @@ class LaunchButton extends React.Component {
showLaunchPrompt: false,
launchConfig: null,
launchError: false,
surveyConfig: null,
};
this.handleLaunch = this.handleLaunch.bind(this);
@@ -67,15 +68,28 @@ class LaunchButton extends React.Component {
resource.type === 'workflow_job_template'
? WorkflowJobTemplatesAPI.readLaunch(resource.id)
: JobTemplatesAPI.readLaunch(resource.id);
const readSurvey =
resource.type === 'workflow_job_template'
? WorkflowJobTemplatesAPI.readSurvey(resource.id)
: JobTemplatesAPI.readSurvey(resource.id);
try {
const { data: launchConfig } = await readLaunch;
let surveyConfig = null;
if (launchConfig.survey_enabled) {
const { data } = await readSurvey;
surveyConfig = data;
}
if (canLaunchWithoutPrompt(launchConfig)) {
this.launchWithParams({});
} else {
this.setState({
showLaunchPrompt: true,
launchConfig,
surveyConfig,
});
}
} catch (err) {
@@ -151,7 +165,12 @@ class LaunchButton extends React.Component {
}
render() {
const { launchError, showLaunchPrompt, launchConfig } = this.state;
const {
launchError,
showLaunchPrompt,
launchConfig,
surveyConfig,
} = this.state;
const { resource, i18n, children } = this.props;
return (
<Fragment>
@@ -172,7 +191,8 @@ class LaunchButton extends React.Component {
)}
{showLaunchPrompt && (
<LaunchPrompt
config={launchConfig}
launchConfig={launchConfig}
surveyConfig={surveyConfig}
resource={resource}
onLaunch={this.launchWithParams}
onCancel={() => this.setState({ showLaunchPrompt: false })}