From 3fc227d2de53aae115226ad3c965bfb6e9f3eca6 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Tue, 16 Nov 2021 13:21:33 +0100 Subject: [PATCH] feat(SQLite): readonly mode --- src/common/customizations/defaults.js | 3 ++- src/common/customizations/sqlite.js | 3 ++- src/main/ipc-handlers/connection.js | 6 ++++-- src/main/libs/clients/SQLiteClient.js | 3 ++- src/renderer/components/WorkspaceAddConnectionPanel.vue | 9 +++++++++ src/renderer/components/WorkspaceEditConnectionPanel.vue | 8 ++++++++ src/renderer/i18n/en-US.js | 3 ++- 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/common/customizations/defaults.js b/src/common/customizations/defaults.js index 70c5ad67..dc06eb57 100644 --- a/src/common/customizations/defaults.js +++ b/src/common/customizations/defaults.js @@ -80,5 +80,6 @@ module.exports = { triggerFunctionSql: false, triggerFunctionlanguages: false, parametersLength: false, - languages: false + languages: false, + readOnlyMode: false }; diff --git a/src/common/customizations/sqlite.js b/src/common/customizations/sqlite.js index ca736ad8..d16ee470 100644 --- a/src/common/customizations/sqlite.js +++ b/src/common/customizations/sqlite.js @@ -78,5 +78,6 @@ module.exports = { triggerFunctionSql: false, triggerFunctionlanguages: false, parametersLength: false, - languages: false + languages: false, + readOnlyMode: true }; diff --git a/src/main/ipc-handlers/connection.js b/src/main/ipc-handlers/connection.js index 78d6278b..5ac0aac5 100644 --- a/src/main/ipc-handlers/connection.js +++ b/src/main/ipc-handlers/connection.js @@ -9,7 +9,8 @@ export default connections => { port: +conn.port, user: conn.user, password: conn.password, - application_name: 'Antares SQL' + application_name: 'Antares SQL', + readonly: conn.readonly }; if (conn.database) @@ -65,7 +66,8 @@ export default connections => { port: +conn.port, user: conn.user, password: conn.password, - application_name: 'Antares SQL' + application_name: 'Antares SQL', + readonly: conn.readonly }; if (conn.database) diff --git a/src/main/libs/clients/SQLiteClient.js b/src/main/libs/clients/SQLiteClient.js index 44fd15f8..b48163a5 100644 --- a/src/main/libs/clients/SQLiteClient.js +++ b/src/main/libs/clients/SQLiteClient.js @@ -21,7 +21,8 @@ export class SQLiteClient extends AntaresCore { */ async connect () { this._connection = sqlite(this._params.databasePath, { - fileMustExist: true + fileMustExist: true, + readonly: this._params.readonly }); } diff --git a/src/renderer/components/WorkspaceAddConnectionPanel.vue b/src/renderer/components/WorkspaceAddConnectionPanel.vue index ede77563..8d6b144c 100644 --- a/src/renderer/components/WorkspaceAddConnectionPanel.vue +++ b/src/renderer/components/WorkspaceAddConnectionPanel.vue @@ -151,6 +151,14 @@ > +
+
+
+ +
+
@@ -392,6 +400,7 @@ export default { user: null, password: '', ask: false, + readonly: false, uid: uidGen('C'), ssl: false, cert: '', diff --git a/src/renderer/components/WorkspaceEditConnectionPanel.vue b/src/renderer/components/WorkspaceEditConnectionPanel.vue index 55e5253e..c62a02bf 100644 --- a/src/renderer/components/WorkspaceEditConnectionPanel.vue +++ b/src/renderer/components/WorkspaceEditConnectionPanel.vue @@ -151,6 +151,14 @@ >
+
+
+
+ +
+
diff --git a/src/renderer/i18n/en-US.js b/src/renderer/i18n/en-US.js index de1f6d8b..daed3a73 100644 --- a/src/renderer/i18n/en-US.js +++ b/src/renderer/i18n/en-US.js @@ -250,7 +250,8 @@ module.exports = { searchForQueries: 'Search for queries', killProcess: 'Kill process', closeTab: 'Close tab', - goToDownloadPage: 'Go to download page' + goToDownloadPage: 'Go to download page', + readOnlyMode: 'Read-only mode' }, faker: { address: 'Address',