@@ -43,7 +43,7 @@ export class RegisterApplicationFormComponent extends FormComponent implements O
4343
4444 labels = {
4545 heading : 'Add Applications' ,
46- uploadButton : 'Upload '
46+ uploadButton : 'Done '
4747 } ;
4848
4949 constructor (
@@ -138,36 +138,28 @@ export class RegisterApplicationFormComponent extends FormComponent implements O
138138 }
139139
140140 register ( ) {
141+ if ( ! this . isValid ) {
142+ return false ;
143+ }
144+
141145 if ( this . mode == "PATH" ) {
142146 this . registerPath ( ) ;
143147 } else {
144- this . navigateOnSuccess ( ) ;
145148 return false ;
146149 }
147150 }
148151
149- private registerPath ( ) {
150- /**
151- * If there are already some uploaded applications, we consider form to be valid
152- * But if user is on Register Path section, clicking submit button triggers registering app by path with invalid
153- * path.
154- * To avoid that, treat it as success and do the navigation right away, even when no input path is set.
155- */
156- if ( ( ! this . fileInputPath || this . fileInputPath . length === 0 ) && this . isValid ) {
157- this . navigateOnSuccess ( ) ;
158- return ;
159- }
160-
152+ public registerPath ( ) {
161153 this . _fileService . queryServerPathTargetType ( this . fileInputPath ) . subscribe ( ( type_ : string ) => {
162154 if ( type_ === "DIRECTORY" && ! this . isDirWithExplodedApp ) { //this.isDirWithApps
163155 this . _registeredApplicationService . registerApplicationInDirectoryByPath ( this . project , this . fileInputPath )
164156 . subscribe (
165- application => this . navigateOnSuccess ( ) ,
157+ ( ) => this . fileInputPath = '' ,
166158 error => this . handleError ( error )
167159 ) ;
168160 } else {
169161 this . _registeredApplicationService . registerByPath ( this . project , this . fileInputPath , this . isDirWithExplodedApp ) . subscribe (
170- application => this . navigateOnSuccess ( ) ,
162+ ( ) => this . fileInputPath = '' ,
171163 error => this . handleError ( < any > error )
172164 )
173165 }
@@ -224,7 +216,7 @@ export class RegisterApplicationFormComponent extends FormComponent implements O
224216 this . mode = mode ;
225217
226218 if ( this . mode === 'PATH' ) {
227- this . labels . uploadButton = 'Upload ' ;
219+ this . labels . uploadButton = 'Done ' ;
228220 } else if ( this . mode === 'UPLOADED' ) {
229221 // this is not really nice, but when using UPLOADED mode, upload is done automatically
230222 // so no action is actually being executed, so label is 'Done'
@@ -246,17 +238,6 @@ export class RegisterApplicationFormComponent extends FormComponent implements O
246238 }
247239
248240 public get isValid ( ) {
249- /**
250- * If project already has some applications,
251- * form is always valid for "upload" tab and also for empty path in "server path" tab.
252- *
253- * This allows us to have 'Back' step in wizard and not requiring
254- * user to upload new application.
255- */
256- if ( this . isInWizard && this . projectHasApplications ( ) && this . fileInputPath . length === 0 ) {
257- return true ;
258- }
259-
260241 if ( this . mode === 'PATH' ) {
261242 const appPathField = this . registrationForm . get ( 'appPathToRegister' ) ;
262243
0 commit comments