mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
add domain verify feature
This commit is contained in:
@ -77,14 +77,6 @@ class DatabaseConfigurationController extends Controller
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sqlsrv':
|
|
||||||
$databaseData = [
|
|
||||||
'driver' => 'sqlsrv',
|
|
||||||
'host' => '127.0.0.1',
|
|
||||||
'port' => 1433,
|
|
||||||
];
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,10 @@ class RequirementsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function requirements()
|
public function requirements()
|
||||||
{
|
{
|
||||||
$phpSupportInfo = $this->requirements->checkPHPversion(
|
$phpSupportInfo = $this->requirements->checkPHPVersion(
|
||||||
config('installer.core.minPhpVersion')
|
config('installer.core.minPhpVersion')
|
||||||
);
|
);
|
||||||
|
|
||||||
$requirements = $this->requirements->check(
|
$requirements = $this->requirements->check(
|
||||||
config('installer.requirements')
|
config('installer.requirements')
|
||||||
);
|
);
|
||||||
|
|||||||
@ -78,6 +78,15 @@ class EnvironmentManager
|
|||||||
try {
|
try {
|
||||||
$this->checkDatabaseConnection($request);
|
$this->checkDatabaseConnection($request);
|
||||||
|
|
||||||
|
$requirement = $this->checkVersionRequirements($request);
|
||||||
|
|
||||||
|
if ($requirement) {
|
||||||
|
return [
|
||||||
|
'error' => 'minimum_version_requirement',
|
||||||
|
'requirement' => $requirement,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if (\Schema::hasTable('users')) {
|
if (\Schema::hasTable('users')) {
|
||||||
return [
|
return [
|
||||||
'error' => 'database_should_be_empty',
|
'error' => 'database_should_be_empty',
|
||||||
@ -134,6 +143,7 @@ class EnvironmentManager
|
|||||||
{
|
{
|
||||||
$connection = $request->database_connection;
|
$connection = $request->database_connection;
|
||||||
|
|
||||||
|
$settings = config("database.connections.$connection");
|
||||||
$settings = config("database.connections.$connection");
|
$settings = config("database.connections.$connection");
|
||||||
|
|
||||||
$connectionArray = array_merge($settings, [
|
$connectionArray = array_merge($settings, [
|
||||||
@ -161,6 +171,60 @@ class EnvironmentManager
|
|||||||
return DB::connection()->getPdo();
|
return DB::connection()->getPdo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param DatabaseEnvironmentRequest $request
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function checkVersionRequirements(DatabaseEnvironmentRequest $request)
|
||||||
|
{
|
||||||
|
$connection = $request->database_connection;
|
||||||
|
|
||||||
|
$checker = new RequirementsChecker();
|
||||||
|
|
||||||
|
$phpSupportInfo = $checker->checkPHPVersion(
|
||||||
|
config('crater.min_php_version')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! $phpSupportInfo['supported']) {
|
||||||
|
return $phpSupportInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbSupportInfo = [];
|
||||||
|
|
||||||
|
switch ($connection) {
|
||||||
|
case 'mysql':
|
||||||
|
$dbSupportInfo = $checker->checkMysqlVersion(
|
||||||
|
config('crater.min_mysql_version')
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pgsql':
|
||||||
|
$conn = pg_connect("host={$request->database_hostname} port={$request->database_port} dbname={$request->database_name} user={$request->database_username} password={$request->database_password}");
|
||||||
|
$dbSupportInfo = $checker->checkPgsqlVersion(
|
||||||
|
$conn,
|
||||||
|
config('crater.min_pgsql_version')
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sqlite':
|
||||||
|
$dbSupportInfo = $checker->checkSqliteVersion(
|
||||||
|
config('crater.min_sqlite_version')
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $dbSupportInfo['supported']) {
|
||||||
|
return $dbSupportInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the mail content to the .env file.
|
* Save the mail content to the .env file.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Crater\Space;
|
namespace Crater\Space;
|
||||||
|
|
||||||
|
use SQLite3;
|
||||||
|
|
||||||
class RequirementsChecker
|
class RequirementsChecker
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -63,7 +65,7 @@ class RequirementsChecker
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function checkPHPversion(string $minPhpVersion = null)
|
public function checkPHPVersion(string $minPhpVersion = null)
|
||||||
{
|
{
|
||||||
$minVersionPhp = $minPhpVersion;
|
$minVersionPhp = $minPhpVersion;
|
||||||
$currentPhpVersion = $this->getPhpVersionInfo();
|
$currentPhpVersion = $this->getPhpVersionInfo();
|
||||||
@ -113,4 +115,112 @@ class RequirementsChecker
|
|||||||
{
|
{
|
||||||
return $this->_minPhpVersion;
|
return $this->_minPhpVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check PHP version requirement.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function checkMysqlVersion(string $minMysqlVersion = null)
|
||||||
|
{
|
||||||
|
$minVersionMysql = $minMysqlVersion;
|
||||||
|
$currentMysqlVersion = $this->getMysqlVersionInfo();
|
||||||
|
$supported = false;
|
||||||
|
|
||||||
|
if (version_compare($currentMysqlVersion, $minVersionMysql) >= 0) {
|
||||||
|
$supported = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpStatus = [
|
||||||
|
'current' => $currentMysqlVersion,
|
||||||
|
'minimum' => $minVersionMysql,
|
||||||
|
'supported' => $supported,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $phpStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current Mysql version information.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getMysqlVersionInfo()
|
||||||
|
{
|
||||||
|
$currentVersion = explode(' ', mysqli_get_client_info());
|
||||||
|
|
||||||
|
return $currentVersion[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Sqlite version requirement.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function checkSqliteVersion(string $minSqliteVersion = null)
|
||||||
|
{
|
||||||
|
$minVersionSqlite = $minSqliteVersion;
|
||||||
|
$currentSqliteVersion = $this->getSqliteVersionInfo();
|
||||||
|
$supported = false;
|
||||||
|
|
||||||
|
if (version_compare($currentSqliteVersion, $minVersionSqlite) >= 0) {
|
||||||
|
$supported = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpStatus = [
|
||||||
|
'current' => $currentSqliteVersion,
|
||||||
|
'minimum' => $minVersionSqlite,
|
||||||
|
'supported' => $supported,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $phpStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current Sqlite version information.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getSqliteVersionInfo()
|
||||||
|
{
|
||||||
|
$currentVersion = SQLite3::version();
|
||||||
|
|
||||||
|
return $currentVersion['versionString'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Pgsql version requirement.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function checkPgsqlVersion($conn, string $minPgsqlVersion = null)
|
||||||
|
{
|
||||||
|
$minVersionPgsql = $minPgsqlVersion;
|
||||||
|
$currentPgsqlVersion = $this->getPgsqlVersionInfo($conn);
|
||||||
|
$supported = false;
|
||||||
|
|
||||||
|
if (version_compare($currentPgsqlVersion, $minVersionPgsql) >= 0) {
|
||||||
|
$supported = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpStatus = [
|
||||||
|
'current' => $currentPgsqlVersion,
|
||||||
|
'minimum' => $minVersionPgsql,
|
||||||
|
'supported' => $supported,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $phpStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current Pgsql version information.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private static function getPgsqlVersionInfo($conn)
|
||||||
|
{
|
||||||
|
$currentVersion = pg_version($conn);
|
||||||
|
|
||||||
|
return $currentVersion['server'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,9 +3,27 @@
|
|||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current version of the application.
|
* Minimum php version of the application.
|
||||||
*/
|
*/
|
||||||
'version' => '4.0.0',
|
'min_php_version' => '7.4.0',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Minimum mysql version of the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'min_mysql_version' => '5.7.7',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Minimum pgsql version of the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'min_pgsql_version' => '9.2.0',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Minimum sqlite version of the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'min_sqlite_version' => '3.24.0',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of languages supported by Crater.
|
* List of languages supported by Crater.
|
||||||
|
|||||||
@ -1109,7 +1109,8 @@
|
|||||||
"database_variables_save_error": "Cannot write configuration to .env file. Please check its file permissions",
|
"database_variables_save_error": "Cannot write configuration to .env file. Please check its file permissions",
|
||||||
"mail_variables_save_error": "Email configuration failed.",
|
"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"
|
"database_should_be_empty": "Database should be empty",
|
||||||
|
"minimum_version_requirement": "Minimum {name} version {version} required."
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"mail_variables_save_successfully": "Email configured successfully",
|
"mail_variables_save_successfully": "Email configured successfully",
|
||||||
|
|||||||
@ -19,14 +19,12 @@
|
|||||||
import Mysql from './database/MysqlDatabase'
|
import Mysql from './database/MysqlDatabase'
|
||||||
import Pgsql from './database/PgsqlDatabase'
|
import Pgsql from './database/PgsqlDatabase'
|
||||||
import Sqlite from './database/SqliteDatabase'
|
import Sqlite from './database/SqliteDatabase'
|
||||||
import Sqlsrv from './database/SqlsrvDatabase'
|
|
||||||
import { mapActions } from 'vuex'
|
import { mapActions } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Mysql,
|
Mysql,
|
||||||
Pgsql,
|
Pgsql,
|
||||||
Sqlite,
|
Sqlite,
|
||||||
Sqlsrv,
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -36,7 +34,7 @@ export default {
|
|||||||
isLoading: false,
|
isLoading: false,
|
||||||
isFetching: false,
|
isFetching: false,
|
||||||
database_connection: 'mysql',
|
database_connection: 'mysql',
|
||||||
connections: ['sqlite', 'mysql', 'pgsql', 'sqlsrv'],
|
connections: ['sqlite', 'mysql', 'pgsql'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -83,6 +81,16 @@ export default {
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
} else if (response.data.error) {
|
} else if (response.data.error) {
|
||||||
|
if (response.data.requirement) {
|
||||||
|
this.showNotification({
|
||||||
|
type: 'error',
|
||||||
|
message: this.$t('wizard.errors.' + response.data.error, {
|
||||||
|
version: response.data.requirement.minimum,
|
||||||
|
name: this.database_connection,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
this.showNotification({
|
this.showNotification({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: this.$t('wizard.errors.' + response.data.error),
|
message: this.$t('wizard.errors.' + response.data.error),
|
||||||
|
|||||||
@ -150,7 +150,7 @@ export default {
|
|||||||
database_password: null,
|
database_password: null,
|
||||||
app_url: window.location.origin,
|
app_url: window.location.origin,
|
||||||
},
|
},
|
||||||
connections: ['sqlite', 'mysql', 'pgsql', 'sqlsrv'],
|
connections: ['sqlite', 'mysql', 'pgsql'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validations: {
|
validations: {
|
||||||
|
|||||||
@ -147,7 +147,7 @@ export default {
|
|||||||
database_password: null,
|
database_password: null,
|
||||||
app_url: window.location.origin,
|
app_url: window.location.origin,
|
||||||
},
|
},
|
||||||
connections: ['sqlite', 'mysql', 'pgsql', 'sqlsrv'],
|
connections: ['sqlite', 'mysql', 'pgsql'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@ -94,7 +94,7 @@ export default {
|
|||||||
database_name: null,
|
database_name: null,
|
||||||
app_url: window.location.origin,
|
app_url: window.location.origin,
|
||||||
},
|
},
|
||||||
connections: ['sqlite', 'mysql', 'pgsql', 'sqlsrv'],
|
connections: ['sqlite', 'mysql', 'pgsql'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validations: {
|
validations: {
|
||||||
|
|||||||
@ -1,264 +0,0 @@
|
|||||||
<template>
|
|
||||||
<form action="" @submit.prevent="next()">
|
|
||||||
<div>
|
|
||||||
<div class="grid grid-cols-1 gap-5 md:grid-cols-2 lg:mb-6 md:mb-6">
|
|
||||||
<sw-input-group
|
|
||||||
:label="$t('wizard.database.app_url')"
|
|
||||||
:error="urlError"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<sw-input
|
|
||||||
:invalid="$v.databaseData.app_url.$error"
|
|
||||||
v-model.trim="databaseData.app_url"
|
|
||||||
type="text"
|
|
||||||
name="name"
|
|
||||||
@input="$v.databaseData.app_url.$touch()"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
|
|
||||||
<sw-input-group
|
|
||||||
:label="$t('wizard.database.connection')"
|
|
||||||
:error="connectionError"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<sw-select
|
|
||||||
v-model="databaseData.database_connection"
|
|
||||||
:invalid="$v.databaseData.database_connection.$error"
|
|
||||||
:options="connections"
|
|
||||||
:searchable="true"
|
|
||||||
:show-labels="false"
|
|
||||||
:allow-empty="false"
|
|
||||||
@input="onChangeConnection"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
|
|
||||||
<sw-input-group
|
|
||||||
:label="$t('wizard.database.port')"
|
|
||||||
:error="portError"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<sw-input
|
|
||||||
:invalid="$v.databaseData.database_port.$error"
|
|
||||||
v-model.trim="databaseData.database_port"
|
|
||||||
type="text"
|
|
||||||
name="database_port"
|
|
||||||
@input="$v.databaseData.database_port.$touch()"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
|
|
||||||
<sw-input-group
|
|
||||||
:label="$t('wizard.database.db_name')"
|
|
||||||
:error="nameError"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<sw-input
|
|
||||||
:invalid="$v.databaseData.database_name.$error"
|
|
||||||
v-model.trim="databaseData.database_name"
|
|
||||||
type="text"
|
|
||||||
name="database_name"
|
|
||||||
@input="$v.databaseData.database_name.$touch()"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
|
|
||||||
<sw-input-group
|
|
||||||
:label="$t('wizard.database.username')"
|
|
||||||
:error="usernameError"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<sw-input
|
|
||||||
:invalid="$v.databaseData.database_username.$error"
|
|
||||||
v-model.trim="databaseData.database_username"
|
|
||||||
type="text"
|
|
||||||
name="database_username"
|
|
||||||
@input="$v.databaseData.database_username.$touch()"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
|
|
||||||
<sw-input-group :label="$t('wizard.database.password')">
|
|
||||||
<sw-input
|
|
||||||
v-model.trim="databaseData.database_password"
|
|
||||||
type="password"
|
|
||||||
name="name"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
|
|
||||||
<sw-input-group
|
|
||||||
:label="$t('wizard.database.host')"
|
|
||||||
:error="hostnameError"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<sw-input
|
|
||||||
:invalid="$v.databaseData.database_hostname.$error"
|
|
||||||
v-model.trim="databaseData.database_hostname"
|
|
||||||
type="text"
|
|
||||||
name="database_hostname"
|
|
||||||
@input="$v.databaseData.database_hostname.$touch()"
|
|
||||||
/>
|
|
||||||
</sw-input-group>
|
|
||||||
</div>
|
|
||||||
<sw-button
|
|
||||||
v-show="!isFetching"
|
|
||||||
:loading="isLoading"
|
|
||||||
:disabled="isLoading"
|
|
||||||
variant="primary"
|
|
||||||
class="mt-4"
|
|
||||||
type="submit"
|
|
||||||
>
|
|
||||||
<save-icon v-if="!isLoading" class="h-5 mr-2" />
|
|
||||||
{{ $t('wizard.save_cont') }}
|
|
||||||
</sw-button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { SaveIcon } from '@vue-hero-icons/outline'
|
|
||||||
const { required, numeric } = require('vuelidate/lib/validators')
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
SaveIcon,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
configData: {
|
|
||||||
type: Object,
|
|
||||||
require: true,
|
|
||||||
default: Object,
|
|
||||||
},
|
|
||||||
isLoading: {
|
|
||||||
type: Boolean,
|
|
||||||
require: true,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isFetching: {
|
|
||||||
type: Boolean,
|
|
||||||
require: true,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
databaseData: {
|
|
||||||
database_connection: 'mysql',
|
|
||||||
database_hostname: '127.0.0.1',
|
|
||||||
database_port: '3306',
|
|
||||||
database_name: null,
|
|
||||||
database_username: null,
|
|
||||||
database_password: null,
|
|
||||||
app_url: window.location.origin,
|
|
||||||
},
|
|
||||||
connections: ['sqlite', 'mysql', 'pgsql', 'sqlsrv'],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
validations: {
|
|
||||||
databaseData: {
|
|
||||||
database_connection: {
|
|
||||||
required,
|
|
||||||
},
|
|
||||||
database_hostname: {
|
|
||||||
required,
|
|
||||||
},
|
|
||||||
database_port: {
|
|
||||||
required,
|
|
||||||
numeric,
|
|
||||||
},
|
|
||||||
database_name: {
|
|
||||||
required,
|
|
||||||
},
|
|
||||||
database_username: {
|
|
||||||
required,
|
|
||||||
},
|
|
||||||
app_url: {
|
|
||||||
required,
|
|
||||||
isUrl(val) {
|
|
||||||
return this.$utils.checkValidUrl(val)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
urlError() {
|
|
||||||
if (!this.$v.databaseData.app_url.$error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.app_url.required) {
|
|
||||||
return this.$tc('validation.required')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.app_url.isUrl) {
|
|
||||||
return this.$tc('validation.invalid_url')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
connectionError() {
|
|
||||||
if (!this.$v.databaseData.database_connection.$error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.database_connection.required) {
|
|
||||||
return this.$tc('validation.required')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
portError() {
|
|
||||||
if (!this.$v.databaseData.database_port.$error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.database_port.required) {
|
|
||||||
return this.$tc('validation.required')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.database_port.numeric) {
|
|
||||||
return this.$tc('validation.numbers_only')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nameError() {
|
|
||||||
if (!this.$v.databaseData.database_name.$error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.database_name.required) {
|
|
||||||
return this.$tc('validation.required')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
usernameError() {
|
|
||||||
if (!this.$v.databaseData.database_username.$error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.database_username.required) {
|
|
||||||
return this.$tc('validation.required')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hostnameError() {
|
|
||||||
if (!this.$v.databaseData.database_hostname.$error) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.$v.databaseData.database_hostname.required) {
|
|
||||||
return this.$tc('validation.required')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
for (const key in this.databaseData) {
|
|
||||||
if (this.configData.hasOwnProperty(key)) {
|
|
||||||
this.databaseData[key] = this.configData[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async next() {
|
|
||||||
this.$v.databaseData.$touch()
|
|
||||||
if (!this.$v.databaseData.$invalid) {
|
|
||||||
this.$emit('submit-data', this.databaseData)
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
onChangeConnection() {
|
|
||||||
this.$v.databaseData.database_connection.$touch()
|
|
||||||
this.$emit('on-change-driver', this.databaseData.database_connection)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
Reference in New Issue
Block a user