forked from frappe/books
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes frappe#907 Add support for remote database connections when importing an existing database. * **backend/database/manager.ts** - Add `connectToRemoteDatabase` method to support remote database connections. - Update `connectToDatabase` method to handle both local and remote database connections based on the provided configuration. - Add `_connectRemote` method to handle remote database connections. * **backend/database/core.ts** - Add `connectToRemoteDatabase` method to support remote database connections. * **README.md** - Add instructions for configuring and using the remote database connection feature. * **src/pages/DatabaseConnections.vue** - Add a new user interface to configure remote database details. - Include fields for database type, authentication method, connection string, connection timeout, and request timeout. - Add buttons for testing the connection, saving, and canceling.
- Loading branch information
Showing
4 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<template> | ||
<div class="database-connections"> | ||
<h1>{{ t`Database Connections` }}</h1> | ||
<div class="new-connection"> | ||
<h2>{{ t`New Database Connection` }}</h2> | ||
<form @submit.prevent="saveConnection"> | ||
<div class="form-group"> | ||
<label for="id">{{ t`ID` }}</label> | ||
<input type="text" id="id" v-model="connection.id" required /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="databaseType">{{ t`Database type` }}</label> | ||
<select id="databaseType" v-model="connection.databaseType" required> | ||
<option value="SQL Server">{{ t`SQL Server` }}</option> | ||
<!-- Add more database types as needed --> | ||
</select> | ||
</div> | ||
<div class="form-group"> | ||
<label for="authenticationMethod">{{ t`Authentication method` }}</label> | ||
<select id="authenticationMethod" v-model="connection.authenticationMethod" required> | ||
<option value="">{{ t`Select authentication method` }}</option> | ||
<!-- Add more authentication methods as needed --> | ||
</select> | ||
</div> | ||
<div class="form-group"> | ||
<label for="connectionString">{{ t`Connection String` }}</label> | ||
<input type="text" id="connectionString" v-model="connection.connectionString" required /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="connectionTimeout">{{ t`Connection timeout (ms)` }}</label> | ||
<input type="number" id="connectionTimeout" v-model="connection.connectionTimeout" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="requestTimeout">{{ t`Request timeout (ms)` }}</label> | ||
<input type="number" id="requestTimeout" v-model="connection.requestTimeout" /> | ||
</div> | ||
<div class="form-actions"> | ||
<button type="button" @click="testConnection">{{ t`Test Connection` }}</button> | ||
<button type="button" @click="cancel">{{ t`Cancel` }}</button> | ||
<button type="submit">{{ t`Save` }}</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import { t } from 'fyo'; | ||
export default defineComponent({ | ||
name: 'DatabaseConnections', | ||
data() { | ||
return { | ||
connection: { | ||
id: '', | ||
databaseType: '', | ||
authenticationMethod: '', | ||
connectionString: '', | ||
connectionTimeout: null, | ||
requestTimeout: null, | ||
}, | ||
}; | ||
}, | ||
methods: { | ||
async testConnection() { | ||
// Implement the logic to test the database connection | ||
}, | ||
cancel() { | ||
// Implement the logic to cancel the connection creation | ||
}, | ||
async saveConnection() { | ||
// Implement the logic to save the database connection | ||
}, | ||
}, | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
.database-connections { | ||
padding: 20px; | ||
} | ||
.new-connection { | ||
margin-top: 20px; | ||
} | ||
.form-group { | ||
margin-bottom: 15px; | ||
} | ||
.form-group label { | ||
display: block; | ||
margin-bottom: 5px; | ||
} | ||
.form-group input, | ||
.form-group select { | ||
width: 100%; | ||
padding: 8px; | ||
box-sizing: border-box; | ||
} | ||
.form-actions { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-top: 20px; | ||
} | ||
.form-actions button { | ||
padding: 10px 20px; | ||
} | ||
</style> |