Skip to content

Commit 72f34c5

Browse files
authored
Fix form validation and redirect to topology page in dev perspective (openshift#94)
1 parent 03ebd8b commit 72f34c5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

frontend/public/extend/devconsole/components/source-to-image/SourceToImage.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { getBuilderTagsSortedByVersion } from '../../../../components/image-stre
1111
import { ButtonBar } from '../../../../components/utils/button-bar';
1212
import PerspectiveLink from '../../shared/components/PerspectiveLink';
1313
import { getActivePerspective } from '../../../../ui/ui-selectors';
14-
import { pathWithPerspective } from '../../../../components/utils/perspective';
1514
import {
1615
getPorts,
1716
getSampleRepo,
@@ -144,13 +143,14 @@ class BuildSource extends React.Component<
144143
const {
145144
name,
146145
namespace,
146+
application,
147147
selectedTag,
148148
repository,
149149
createRoute: canCreateRoute,
150150
ports,
151151
} = this.state;
152-
if (!name || !selectedTag || !namespace || !repository) {
153-
this.setState({ error: 'Please complete all fields.' });
152+
if (!name || !selectedTag || !namespace || !application || !repository) {
153+
this.setState({ error: 'Please complete all required fields.' });
154154
return;
155155
}
156156

@@ -174,9 +174,12 @@ class BuildSource extends React.Component<
174174
.then(() => {
175175
this.setState({ inProgress: false });
176176
if (!this.state.error) {
177-
history.push(
178-
pathWithPerspective(activePerspective, `/overview/ns/${this.state.namespace}`),
179-
);
177+
switch(activePerspective) {
178+
case 'dev':
179+
history.push(`/dev/topology/ns/${this.state.namespace}`);
180+
default:
181+
history.push(`/overview/ns/${this.state.namespace}`);
182+
}
180183
}
181184
})
182185
.catch(() => this.setState({ inProgress: false }));

0 commit comments

Comments
 (0)