Skip to content

Commit

Permalink
feat(MySQL): option to enable single connection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Feb 18, 2024
1 parent 90b9b87 commit d3f71e6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/common/customizations/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const defaults: Customizations = {
sshConnection: false,
fileConnection: false,
cancelQueries: false,
singleConnectionMode: false,
// Tools
processesList: false,
usersManagement: false,
Expand Down
1 change: 1 addition & 0 deletions src/common/customizations/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const customizations: Customizations = {
sslConnection: true,
sshConnection: true,
cancelQueries: true,
singleConnectionMode: true,
// Tools
processesList: true,
// Structure
Expand Down
1 change: 1 addition & 0 deletions src/common/interfaces/antares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface ConnectionParams {
password: string;
ask: boolean;
readonly: boolean;
singleConnectionMode: boolean;
ssl: boolean;
cert?: string;
key?: string;
Expand Down
1 change: 1 addition & 0 deletions src/common/interfaces/customizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface Customizations {
sshConnection?: boolean;
fileConnection?: boolean;
cancelQueries?: boolean;
singleConnectionMode?: boolean;
// Tools
processesList?: boolean;
usersManagement?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/main/ipc-handlers/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default (connections: Record<string, antares.Client>) => {
uid: conn.uid,
client: conn.client,
params,
poolSize: 5
poolSize: conn.singleConnectionMode ? 0 : 5
});

await connection.connect();
Expand Down
16 changes: 12 additions & 4 deletions src/renderer/components/WorkspaceAddConnectionPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,30 @@
>
</div>
</div>
<div v-if="clientCustomizations.readOnlyMode" class="form-group columns">
<div v-if="clientCustomizations.readOnlyMode" class="form-group columns mb-0">
<div class="column col-5 col-sm-12" />
<div class="column col-7 col-sm-12">
<label class="form-checkbox form-inline">
<label class="form-checkbox form-inline my-0">
<input v-model="connection.readonly" type="checkbox"><i class="form-icon" /> {{ t('connection.readOnlyMode') }}
</label>
</div>
</div>
<div v-if="!clientCustomizations.fileConnection" class="form-group columns">
<div v-if="!clientCustomizations.fileConnection" class="form-group columns mb-0">
<div class="column col-5 col-sm-12" />
<div class="column col-7 col-sm-12">
<label class="form-checkbox form-inline">
<label class="form-checkbox form-inline my-0">
<input v-model="connection.ask" type="checkbox"><i class="form-icon" /> {{ t('connection.askCredentials') }}
</label>
</div>
</div>
<div v-if="clientCustomizations.singleConnectionMode" class="form-group columns mb-0">
<div class="column col-5 col-sm-12" />
<div class="column col-7 col-sm-12">
<label class="form-checkbox form-inline my-0">
<input v-model="connection.singleConnectionMode" type="checkbox"><i class="form-icon" /> {{ t('connection.singleConnection') }}
</label>
</div>
</div>
</fieldset>
</form>
</div>
Expand Down
16 changes: 12 additions & 4 deletions src/renderer/components/WorkspaceEditConnectionPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,30 @@
>
</div>
</div>
<div v-if="clientCustomizations.readOnlyMode" class="form-group columns">
<div v-if="clientCustomizations.readOnlyMode" class="form-group columns mb-0">
<div class="column col-5 col-sm-12" />
<div class="column col-7 col-sm-12">
<label class="form-checkbox form-inline">
<label class="form-checkbox form-inline my-0">
<input v-model="localConnection.readonly" type="checkbox"><i class="form-icon" /> {{ t('connection.readOnlyMode') }}
</label>
</div>
</div>
<div v-if="!clientCustomizations.fileConnection" class="form-group columns">
<div v-if="!clientCustomizations.fileConnection" class="form-group columns mb-0">
<div class="column col-5 col-sm-12" />
<div class="column col-7 col-sm-12">
<label class="form-checkbox form-inline">
<label class="form-checkbox form-inline my-0">
<input v-model="localConnection.ask" type="checkbox"><i class="form-icon" /> {{ t('connection.askCredentials') }}
</label>
</div>
</div>
<div v-if="clientCustomizations.singleConnectionMode" class="form-group columns mb-0">
<div class="column col-5 col-sm-12" />
<div class="column col-7 col-sm-12">
<label class="form-checkbox form-inline my-0">
<input v-model="localConnection.singleConnectionMode" type="checkbox"><i class="form-icon" /> {{ t('connection.singleConnection') }}
</label>
</div>
</div>
</fieldset>
</form>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/i18n/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export const enUS = {
readOnlyMode: 'Read-only mode',
allConnections: 'All connections',
searchForConnections: 'Search for connections',
keepAliveInterval: 'Keep alive interval'
keepAliveInterval: 'Keep alive interval',
singleConnection: 'Single connection'
},
database: { // Database related terms
schema: 'Schema',
Expand Down

0 comments on commit d3f71e6

Please sign in to comment.