Adds elements and identifiers for cypress tests

Properly display instance groups and labels on node details view
This commit is contained in:
mabashian 2022-09-13 14:42:58 -04:00 committed by Alan Rominger
parent d63c940e2f
commit ead56bfa1b
No known key found for this signature in database
GPG Key ID: C2D7EAAA12B63559
8 changed files with 195 additions and 182 deletions

View File

@ -132,7 +132,7 @@ function CredentialsStep({
);
return (
<>
<div data-cy="credentials-prompt">
{meta.error && (
<CredentialErrorAlert variant="danger" isInline title={meta.error} />
)}
@ -208,7 +208,7 @@ function CredentialsStep({
}}
renderItemChip={renderChip}
/>
</>
</div>
);
}

View File

@ -66,50 +66,52 @@ function ExecutionEnvironmentStep() {
}
return (
<OptionsList
value={field.value ? [field.value] : []}
options={execution_environments}
optionCount={count}
columns={[
{
name: t`Name`,
key: 'name',
},
{
name: t`Image`,
key: 'image',
},
]}
searchColumns={[
{
name: t`Name`,
key: 'name__icontains',
isDefault: true,
},
{
name: t`Image`,
key: 'image__icontains',
},
]}
sortColumns={[
{
name: t`Name`,
key: 'name',
},
{
name: t`Image`,
key: 'image',
},
]}
searchableKeys={searchableKeys}
relatedSearchableKeys={relatedSearchableKeys}
header={t`Execution Environments`}
name="execution_environment"
qsConfig={QS_CONFIG}
readOnly
selectItem={helpers.setValue}
deselectItem={() => helpers.setValue(null)}
/>
<div data-cy="execution-environment-prompt">
<OptionsList
value={field.value ? [field.value] : []}
options={execution_environments}
optionCount={count}
columns={[
{
name: t`Name`,
key: 'name',
},
{
name: t`Image`,
key: 'image',
},
]}
searchColumns={[
{
name: t`Name`,
key: 'name__icontains',
isDefault: true,
},
{
name: t`Image`,
key: 'image__icontains',
},
]}
sortColumns={[
{
name: t`Name`,
key: 'name',
},
{
name: t`Image`,
key: 'image',
},
]}
searchableKeys={searchableKeys}
relatedSearchableKeys={relatedSearchableKeys}
header={t`Execution Environments`}
name="execution_environment"
qsConfig={QS_CONFIG}
readOnly
selectItem={helpers.setValue}
deselectItem={() => helpers.setValue(null)}
/>
</div>
);
}

View File

@ -68,38 +68,40 @@ function InstanceGroupsStep() {
}
return (
<OptionsList
value={selected}
options={instance_groups}
optionCount={count}
searchColumns={[
{
name: t`Name`,
key: 'name__icontains',
isDefault: true,
},
{
name: t`Credential Name`,
key: 'credential__name__icontains',
},
]}
sortColumns={[
{
name: t`Name`,
key: 'name',
},
]}
searchableKeys={searchableKeys}
relatedSearchableKeys={relatedSearchableKeys}
multiple
header={t`Instance Groups`}
name="instanceGroups"
qsConfig={QS_CONFIG}
selectItem={handleSelect}
deselectItem={handleSelect}
sortSelectedItems={(selectedItems) => setSelected(selectedItems)}
isSelectedDraggable
/>
<div data-cy="instance-groups-prompt">
<OptionsList
value={selected}
options={instance_groups}
optionCount={count}
searchColumns={[
{
name: t`Name`,
key: 'name__icontains',
isDefault: true,
},
{
name: t`Credential Name`,
key: 'credential__name__icontains',
},
]}
sortColumns={[
{
name: t`Name`,
key: 'name',
},
]}
searchableKeys={searchableKeys}
relatedSearchableKeys={relatedSearchableKeys}
multiple
header={t`Instance Groups`}
name="instanceGroups"
qsConfig={QS_CONFIG}
selectItem={handleSelect}
deselectItem={handleSelect}
sortSelectedItems={(selectedItems) => setSelected(selectedItems)}
isSelectedDraggable
/>
</div>
);
}

View File

@ -70,7 +70,7 @@ function InventoryStep({ warningMessage = null }) {
}
return (
<>
<div data-cy="inventory-prompt">
{meta.touched && meta.error && (
<InventoryErrorAlert variant="danger" isInline title={meta.error} />
)}
@ -109,7 +109,7 @@ function InventoryStep({ warningMessage = null }) {
selectItem={helpers.setValue}
deselectItem={() => field.onChange(null)}
/>
</>
</div>
);
}

View File

@ -28,95 +28,97 @@ function OtherPromptsStep({ launchConfig, variablesMode, onVarModeChange }) {
? jobHelpText
: workflowHelpText;
return (
<Form
onSubmit={(e) => {
e.preventDefault();
}}
>
{launchConfig.ask_job_type_on_launch && (
<JobTypeField helpTextSource={helpTextSource} />
)}
{launchConfig.ask_scm_branch_on_launch && (
<FormField
id="prompt-scm-branch"
name="scm_branch"
label={t`Source Control Branch`}
tooltip={helpTextSource.sourceControlBranch}
/>
)}
{launchConfig.ask_labels_on_launch && (
<LabelsField helpTextSource={helpTextSource} />
)}
{launchConfig.ask_forks_on_launch && (
<FormField
id="prompt-forks"
name="forks"
label={t`Forks`}
type="number"
min="0"
tooltip={helpTextSource.forks}
/>
)}
{launchConfig.ask_limit_on_launch && (
<FormField
id="prompt-limit"
name="limit"
label={t`Limit`}
tooltip={helpTextSource.limit}
/>
)}
{launchConfig.ask_verbosity_on_launch && (
<VerbosityField helpTextSource={helpTextSource} />
)}
{launchConfig.ask_job_slice_count_on_launch && (
<FormField
id="prompt-job-slicing"
name="job_slice_count"
label={t`Job Slicing`}
type="number"
min="1"
tooltip={helpTextSource.jobSlicing}
/>
)}
{launchConfig.ask_timeout_on_launch && (
<FormField
id="prompt-timeout"
name="timeout"
label={t`Timeout`}
type="number"
min="0"
tooltip={helpTextSource.timeout}
/>
)}
{launchConfig.ask_diff_mode_on_launch && <ShowChangesToggle />}
{launchConfig.ask_tags_on_launch && (
<TagField
id="prompt-job-tags"
name="job_tags"
label={t`Job Tags`}
aria-label={t`Job Tags`}
tooltip={helpTextSource.jobTags}
/>
)}
{launchConfig.ask_skip_tags_on_launch && (
<TagField
id="prompt-skip-tags"
name="skip_tags"
label={t`Skip Tags`}
aria-label={t`Skip Tags`}
tooltip={helpTextSource.skipTags}
/>
)}
{launchConfig.ask_variables_on_launch && (
<VariablesField
id="prompt-variables"
name="extra_vars"
label={t`Variables`}
initialMode={variablesMode}
onModeChange={onVarModeChange}
/>
)}
</Form>
<div data-cy="other-prompts">
<Form
onSubmit={(e) => {
e.preventDefault();
}}
>
{launchConfig.ask_job_type_on_launch && (
<JobTypeField helpTextSource={helpTextSource} />
)}
{launchConfig.ask_scm_branch_on_launch && (
<FormField
id="prompt-scm-branch"
name="scm_branch"
label={t`Source Control Branch`}
tooltip={helpTextSource.sourceControlBranch}
/>
)}
{launchConfig.ask_labels_on_launch && (
<LabelsField helpTextSource={helpTextSource} />
)}
{launchConfig.ask_forks_on_launch && (
<FormField
id="prompt-forks"
name="forks"
label={t`Forks`}
type="number"
min="0"
tooltip={helpTextSource.forks}
/>
)}
{launchConfig.ask_limit_on_launch && (
<FormField
id="prompt-limit"
name="limit"
label={t`Limit`}
tooltip={helpTextSource.limit}
/>
)}
{launchConfig.ask_verbosity_on_launch && (
<VerbosityField helpTextSource={helpTextSource} />
)}
{launchConfig.ask_job_slice_count_on_launch && (
<FormField
id="prompt-job-slicing"
name="job_slice_count"
label={t`Job Slicing`}
type="number"
min="1"
tooltip={helpTextSource.jobSlicing}
/>
)}
{launchConfig.ask_timeout_on_launch && (
<FormField
id="prompt-timeout"
name="timeout"
label={t`Timeout`}
type="number"
min="0"
tooltip={helpTextSource.timeout}
/>
)}
{launchConfig.ask_diff_mode_on_launch && <ShowChangesToggle />}
{launchConfig.ask_tags_on_launch && (
<TagField
id="prompt-job-tags"
name="job_tags"
label={t`Job Tags`}
aria-label={t`Job Tags`}
tooltip={helpTextSource.jobTags}
/>
)}
{launchConfig.ask_skip_tags_on_launch && (
<TagField
id="prompt-skip-tags"
name="skip_tags"
label={t`Skip Tags`}
aria-label={t`Skip Tags`}
tooltip={helpTextSource.skipTags}
/>
)}
{launchConfig.ask_variables_on_launch && (
<VariablesField
id="prompt-variables"
name="extra_vars"
label={t`Variables`}
initialMode={variablesMode}
onModeChange={onVarModeChange}
/>
)}
</Form>
</div>
);
}

View File

@ -52,7 +52,7 @@ function PreviewStep({ resource, launchConfig, surveyConfig, formErrors }) {
}
return (
<>
<div data-cy="prompt-preview">
{formErrors && (
<ErrorMessageWrapper>
{t`Some of the previous step(s) have errors`}
@ -70,7 +70,7 @@ function PreviewStep({ resource, launchConfig, surveyConfig, formErrors }) {
launchConfig={launchConfig}
overrides={overrides}
/>
</>
</div>
);
}

View File

@ -31,16 +31,18 @@ function SurveyStep({ surveyConfig }) {
float: NumberField,
};
return (
<Form
onSubmit={(e) => {
e.preventDefault();
}}
>
{surveyConfig.spec.map((question) => {
const Field = fieldTypes[question.type];
return <Field key={question.variable} question={question} />;
})}
</Form>
<div data-cy="survey-prompts">
<Form
onSubmit={(e) => {
e.preventDefault();
}}
>
{surveyConfig.spec.map((question) => {
const Field = fieldTypes[question.type];
return <Field key={question.variable} question={question} />;
})}
</Form>
</div>
);
}
SurveyStep.propTypes = {

View File

@ -19,6 +19,8 @@ function NodeViewModal({ readOnly }) {
const {
fullUnifiedJobTemplate,
originalNodeCredentials,
originalNodeInstanceGroups,
originalNodeLabels,
originalNodeObject,
promptValues,
} = nodeToView;
@ -160,7 +162,7 @@ function NodeViewModal({ readOnly }) {
originalNodeObject.summary_fields.execution_environment;
}
if (launchConfig.ask_labels_on_launch) {
overrides.labels = originalNodeObject.labels;
overrides.labels = originalNodeLabels || [];
}
if (launchConfig.ask_forks_on_launch) {
overrides.forks = originalNodeObject.forks;
@ -204,6 +206,9 @@ function NodeViewModal({ readOnly }) {
if (launchConfig.ask_credential_on_launch) {
overrides.credentials = originalNodeCredentials || [];
}
if (launchConfig.ask_instance_groups_on_launch) {
overrides.instance_groups = originalNodeInstanceGroups || [];
}
}
let nodeUpdatedConvergence = {};