diff --git a/src/main/ipc-handlers/views.js b/src/main/ipc-handlers/views.js index 135cc2ff..b41c62f0 100644 --- a/src/main/ipc-handlers/views.js +++ b/src/main/ipc-handlers/views.js @@ -20,4 +20,14 @@ export default (connections) => { return { status: 'error', response: err.toString() }; } }); + + ipcMain.handle('alter-view', async (event, params) => { + try { + await connections[params.uid].alterView(params); + return { status: 'success' }; + } + catch (err) { + return { status: 'error', response: err.toString() }; + } + }); }; diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 1c44a245..2acf7df5 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -295,6 +295,18 @@ export class MySQLClient extends AntaresCore { return await this.raw(sql); } + /** + * ALTER VIEW + * + * @returns {Array.} parameters + * @memberof MySQLClient + */ + async alterView (params) { + const { view } = params; + const sql = `ALTER ALGORITHM = ${view.algorithm} DEFINER=${view.definer} SQL SECURITY ${view.security} VIEW \`${view.name}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`; + return await this.raw(sql); + } + /** * SHOW COLLATION * diff --git a/src/renderer/components/QueryEditor.vue b/src/renderer/components/QueryEditor.vue index ec2bd616..ac84f9fc 100644 --- a/src/renderer/components/QueryEditor.vue +++ b/src/renderer/components/QueryEditor.vue @@ -182,8 +182,13 @@ export default { if (this.autoFocus) { setTimeout(() => { this.editor.focus(); + this.editor.resize(); }, 20); } + + setTimeout(() => { + this.editor.resize(); + }, 20); } }; diff --git a/src/renderer/components/Workspace.vue b/src/renderer/components/Workspace.vue index 4bea670d..44f3f573 100644 --- a/src/renderer/components/Workspace.vue +++ b/src/renderer/components/Workspace.vue @@ -13,25 +13,25 @@
  • - {{ $t('word.properties').toUpperCase() }}: {{ workspace.breadcrumbs.table }} + {{ $t('word.properties').toUpperCase() }}: {{ schemaChild }}
  • - - {{ $t('word.data').toUpperCase() }}: {{ workspace.breadcrumbs.table }} + + {{ $t('word.data').toUpperCase() }}: {{ schemaChild }}
  • + tab.uid === this.workspace.selected_tab) || @@ -133,6 +141,13 @@ export default { }, queryTabs () { return this.workspace.tabs.filter(tab => tab.type === 'query'); + }, + schemaChild () { + for (const key in this.workspace.breadcrumbs) { + if (key === 'schema') continue; + if (this.workspace.breadcrumbs[key]) return this.workspace.breadcrumbs[key]; + } + return false; } }, async created () { diff --git a/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue b/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue index 0e3ea2f6..b168f8e8 100644 --- a/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue +++ b/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue @@ -10,6 +10,18 @@
    {{ $t('word.table') }}
    +
    + {{ $t('word.view') }} +
    +
    + {{ $t('word.trigger') }} +
    +
    + {{ $t('word.storedRoutine') }} +
    +
    + {{ $t('word.scheduler') }} +
    @@ -124,3 +136,8 @@ export default { } }; + diff --git a/src/renderer/components/WorkspacePropsTabView.vue b/src/renderer/components/WorkspacePropsTabView.vue new file mode 100644 index 00000000..c6367d24 --- /dev/null +++ b/src/renderer/components/WorkspacePropsTabView.vue @@ -0,0 +1,296 @@ + + + diff --git a/src/renderer/ipc-api/Views.js b/src/renderer/ipc-api/Views.js index f85428b7..cd7d04bc 100644 --- a/src/renderer/ipc-api/Views.js +++ b/src/renderer/ipc-api/Views.js @@ -9,4 +9,8 @@ export default class { static dropView (params) { return ipcRenderer.invoke('drop-view', params); } + + static alterView (params) { + return ipcRenderer.invoke('alter-view', params); + } }