mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 13:11:08 -04:00 
			
		
		
		
	Merge branch 'fix-small-issue' into 'master'
add validation on installation wizard See merge request mohit.panjvani/crater-web!22
This commit is contained in:
		| @ -35,9 +35,7 @@ class EnvironmentController extends Controller | ||||
|     { | ||||
|         $results = $this->EnvironmentManager->saveDatabaseVariables($request); | ||||
|  | ||||
|  | ||||
|         if(array_key_exists("success", $results)) { | ||||
|  | ||||
|             Artisan::call('config:clear'); | ||||
|             Artisan::call('migrate --seed'); | ||||
|             Artisan::call('migrate', ['--path' => 'vendor/laravel/passport/database/migrations']); | ||||
|  | ||||
| @ -203,7 +203,7 @@ class OnboardingController extends Controller | ||||
|             ); | ||||
|         } | ||||
|  | ||||
|         Setting::setSetting('version','1.0.0'); | ||||
|         Setting::setSetting('version', config('crater.version')); | ||||
|  | ||||
|         Artisan::call('passport:install --force'); | ||||
|  | ||||
|  | ||||
| @ -49,12 +49,20 @@ class EnvironmentManager | ||||
|         'DB_PASSWORD='.$request->database_password."\n\n"; | ||||
|  | ||||
|         if (! $this->checkDatabaseConnection($request)) { | ||||
|  | ||||
|             return [ | ||||
|                 'error' => 'connection_failed' | ||||
|             ]; | ||||
|         } else { | ||||
|             if(count(DB::connection()->select('SHOW TABLES'))) { | ||||
|                 return [ | ||||
|                     'error' => 'database_should_be_empty' | ||||
|                 ]; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         try { | ||||
|  | ||||
|             file_put_contents($this->envPath, str_replace( | ||||
|                 $oldDatabaseData, | ||||
|                 $newDatabaseData, | ||||
| @ -101,7 +109,7 @@ class EnvironmentManager | ||||
|         'MAIL_USERNAME='.$request->mail_username."\n". | ||||
|         'MAIL_PASSWORD='.$request->mail_password."\n". | ||||
|         'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n"; | ||||
|         // dd($newMailData); | ||||
|  | ||||
|         try { | ||||
|  | ||||
|             file_put_contents($this->envPath, str_replace( | ||||
|  | ||||
							
								
								
									
										14
									
								
								config/crater.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								config/crater.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | ||||
| <?php | ||||
|  | ||||
| return [ | ||||
|  | ||||
|     /* | ||||
|     |-------------------------------------------------------------------------- | ||||
|     | Crater Requirements | ||||
|     |-------------------------------------------------------------------------- | ||||
|     | | ||||
|     */ | ||||
|  | ||||
|     'version' => '1.0.0', | ||||
|  | ||||
| ]; | ||||
| @ -1,9 +1,29 @@ | ||||
| <template> | ||||
|   <button :type="type" :class="btnClass" :disabled="disabled" @click="handleClick"> | ||||
|     <font-awesome-icon v-if="icon && !loading && !rightIcon" :class="iconClass" :icon="icon" class="vue-icon icon-left" /> | ||||
|     <font-awesome-icon v-if="loading" :class="iconClass" icon="spinner" class="fa-spin"/> | ||||
|   <button | ||||
|     :type="type" | ||||
|     :class="btnClass" | ||||
|     :disabled="disabled || loading" | ||||
|     @click="handleClick" | ||||
|   > | ||||
|     <font-awesome-icon | ||||
|       v-if="icon && !loading && !rightIcon" | ||||
|       :class="iconClass" | ||||
|       :icon="icon" | ||||
|       class="vue-icon icon-left" | ||||
|     /> | ||||
|     <font-awesome-icon | ||||
|       v-if="loading" | ||||
|       :class="iconClass" | ||||
|       icon="spinner" | ||||
|       class="fa-spin" | ||||
|     /> | ||||
|     <slot /> | ||||
|     <font-awesome-icon v-if="icon && !loading && rightIcon" :class="iconClass" :icon="icon" class="vue-icon icon-right" /> | ||||
|     <font-awesome-icon | ||||
|       v-if="icon && !loading && rightIcon" | ||||
|       :class="iconClass" | ||||
|       :icon="icon" | ||||
|       class="vue-icon icon-right" | ||||
|     /> | ||||
|   </button> | ||||
| </template> | ||||
|  | ||||
|  | ||||
| @ -736,7 +736,8 @@ export default { | ||||
|       migrate_failed: 'Migrate Failed', | ||||
|       database_variables_save_error: 'Unable to connect to the DB with Provided Values.', | ||||
|       mail_variables_save_error: 'Email configuration failed.', | ||||
|       connection_failed: 'Database Connection Failed' | ||||
|       connection_failed: 'Database connection failed', | ||||
|       database_should_be_empty: 'Database should be empty' | ||||
|     }, | ||||
|     success: { | ||||
|       mail_variables_save_successfully: 'Email configured successfully', | ||||
|  | ||||
| @ -97,7 +97,6 @@ | ||||
|         </div> | ||||
|         <div class="col-md-6"> | ||||
|           <label class="form-label">{{ $t('wizard.database.password') }}</label> | ||||
|           <span class="text-danger"> *</span> | ||||
|           <base-input | ||||
|             v-model.trim="databaseData.database_password" | ||||
|             type="password" | ||||
| @ -154,7 +153,7 @@ export default { | ||||
|         database_name: null, | ||||
|         database_username: null, | ||||
|         database_password: null, | ||||
|         app_url: null | ||||
|         app_url: window.location.origin | ||||
|       }, | ||||
|       loading: false, | ||||
|       connections: [ | ||||
| @ -207,8 +206,8 @@ export default { | ||||
|         } | ||||
|         this.loading = false | ||||
|       } catch (e) { | ||||
|         console.log(e) | ||||
|         window.toastr['error']('Something went wrong') | ||||
|         console.log(e.response) | ||||
|         window.toastr['error'](e.response.data.message) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @ -67,8 +67,8 @@ export default { | ||||
|   data () { | ||||
|     return { | ||||
|       loading: false, | ||||
|       tab: 'step_1', | ||||
|       step: 1 | ||||
|       tab: 'step_3', | ||||
|       step: 3 | ||||
|     } | ||||
|   }, | ||||
|   created () { | ||||
|  | ||||
| @ -35,7 +35,7 @@ | ||||
|       </div> | ||||
|     </div> | ||||
|     <base-button | ||||
|       v-if="requirements" | ||||
|       v-if="hasNext" | ||||
|       :loading="loading" | ||||
|       class="pull-right mt-4" | ||||
|       icon="arrow-right" | ||||
| @ -46,7 +46,7 @@ | ||||
|       {{ $t('wizard.continue') }} | ||||
|     </base-button> | ||||
|     <base-button | ||||
|       v-else | ||||
|       v-if="!requirements" | ||||
|       :loading="loading" | ||||
|       class="pull-right mt-4" | ||||
|       color="theme" | ||||
| @ -74,6 +74,20 @@ export default { | ||||
|       isShow: true | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     hasNext () { | ||||
|       if (this.requirements) { | ||||
|         let isRequired = true | ||||
|         for (const key in this.requirements) { | ||||
|           if (!this.requirements[key]) { | ||||
|             isRequired = false | ||||
|           } | ||||
|         } | ||||
|         return this.requirements && this.phpSupportInfo.supported && isRequired | ||||
|       } | ||||
|       return false | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     listToggle  () { | ||||
|       this.isShow = !this.isShow | ||||
|  | ||||
		Reference in New Issue
	
	Block a user