Skip to content

Commit

Permalink
Merge pull request #10067 from divyanshiGupta/Bug#2004075
Browse files Browse the repository at this point in the history
[release-4.9] Bug 2004075: Fix to show image-tag selector in s2i form and re-validate git url on git-type change
  • Loading branch information
openshift-merge-robot committed Oct 27, 2021
2 parents 14d13a7 + 1cecb46 commit 9f85e9d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
ImportData,
Resources,
BaseFormData,
ImportTypes,
} from './import-types';
import { validationSchema } from './import-validation-utils';
import { useUpdateKnScalingDefaultValues } from './serverless/useUpdateKnScalingDefaultValues';
Expand Down Expand Up @@ -113,7 +114,7 @@ const ImportForm: React.FC<ImportFormProps & StateProps> = ({
detectedFiles: [],
},
recommendedStrategy: null,
showEditImportStrategy: false,
showEditImportStrategy: importData.type !== ImportTypes.git,
strategyChanged: false,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const BuilderImageTagSelector: React.FC<BuilderImageTagSelectorProps> = ({
return (
<>
<div style={!showEditImportStrategy ? { display: 'none' } : {}}>
<br />
<DropdownField
name="image.tag"
label={t('devconsole~Builder Image version')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const GitSection: React.FC<GitSectionProps> = ({
name: nameTouched,
application: { name: applicationNameTouched } = {},
image: { selected: imageSelectorTouched } = {},
git: { dir: gitDirTouched } = {},
git: { dir: gitDirTouched, type: gitTypeTouched } = {},
} = touched;
const { git: { url: gitUrlError } = {} } = errors;

Expand Down Expand Up @@ -312,7 +312,7 @@ const GitSection: React.FC<GitSectionProps> = ({
setFieldValue('import.loadError', loadError);
setFieldValue('import.strategies', importStrategies);
if (importStrategies.length > 0) {
values.formType !== 'edit' && setFieldValue('import.showEditImportStrategy', false);
setFieldValue('import.showEditImportStrategy', false);
setFieldValue('import.selectedStrategy', importStrategies[0]);
setFieldValue('import.recommendedStrategy', importStrategies[0]);
} else {
Expand All @@ -323,7 +323,7 @@ const GitSection: React.FC<GitSectionProps> = ({
detectedFiles: [],
});
setFieldValue('import.recommendedStrategy', null);
values.formType !== 'edit' && setFieldValue('import.showEditImportStrategy', true);
setFieldValue('import.showEditImportStrategy', true);
}
setFieldValue('import.strategyChanged', false);

Expand Down Expand Up @@ -397,7 +397,7 @@ const GitSection: React.FC<GitSectionProps> = ({
}, [handleGitUrlChange, sampleRepo, setFieldTouched, setFieldValue, tag]);

React.useEffect(() => {
(!dirty || gitDirTouched) &&
(!dirty || gitDirTouched || gitTypeTouched) &&
values.git.url &&
debouncedHandleGitUrlChange(values.git.url, values.git.ref, values.git.dir);
}, [
Expand All @@ -408,6 +408,8 @@ const GitSection: React.FC<GitSectionProps> = ({
values.git.url,
values.git.ref,
values.git.dir,
values.git.type,
gitTypeTouched,
]);

const helpText = React.useMemo(() => {
Expand Down

0 comments on commit 9f85e9d

Please sign in to comment.