mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
eafdb1cc3d | |||
91e0630513 | |||
bf768c3800 | |||
0b1aa3dd29 | |||
ec75f9546a | |||
9bc9adb7cf | |||
b4d14d98db | |||
c21bd6075c | |||
44647f5b55 | |||
3f9e6d85ca | |||
6a6f43a718 | |||
f12a04b052 | |||
abf829867e | |||
b71f04e5aa | |||
7725fafe85 | |||
ed3d35f131 | |||
e0946f04f7 | |||
0891e7be8c | |||
f312cf5f85 | |||
05e0d310ec | |||
|
1e0b2b4cae | ||
5ee728cfe4 | |||
a91fa8ff54 | |||
|
2c13433900 | ||
dcc2a4c51c |
36
CHANGELOG.md
36
CHANGELOG.md
@@ -2,6 +2,42 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.5.11](https://github.com/antares-sql/antares/compare/v0.5.10...v0.5.11) (2022-07-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* console events disabled in production ([0b1aa3d](https://github.com/antares-sql/antares/commit/0b1aa3dd299db641df3d4c56c7ee56a187fc3ab3))
|
||||||
|
* filter persists switching temporary table tabs ([bf768c3](https://github.com/antares-sql/antares/commit/bf768c380087b65604b5b571a9858a7f07bd681d))
|
||||||
|
* unable to edit table fields content on tables with datetime fields ([91e0630](https://github.com/antares-sql/antares/commit/91e06305133c97ea02dcfdc4e739a4b0a7e7049d))
|
||||||
|
|
||||||
|
### [0.5.10](https://github.com/antares-sql/antares/compare/v0.5.9...v0.5.10) (2022-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* context menu to copy queries from console ([c21bd60](https://github.com/antares-sql/antares/commit/c21bd6075c1203607c05e45b76233d57e3008190))
|
||||||
|
* Ctrl+PgUp & Ctrl+PgDn to navigate between tabs ([abf8298](https://github.com/antares-sql/antares/commit/abf829867e567354e534cff3e02a6d43f4c7a262))
|
||||||
|
* field names suggestion for tables in the query ([b71f04e](https://github.com/antares-sql/antares/commit/b71f04e5aa3c37eaa160dfbc76d1b84789e3543e))
|
||||||
|
* initial console implementation ([6a6f43a](https://github.com/antares-sql/antares/commit/6a6f43a718561e0abd2cb89048b7fe45d08736ae))
|
||||||
|
* ipc event channel to send logs to renderer ([f12a04b](https://github.com/antares-sql/antares/commit/f12a04b0524f1172334c89afeb27675c19ff68d2))
|
||||||
|
* open/close console on single connection ([44647f5](https://github.com/antares-sql/antares/commit/44647f5b5508965bf5a7264add89e175c725e877))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* exception on QueryEditor with null modelValue ([9bc9adb](https://github.com/antares-sql/antares/commit/9bc9adb7cff19b86a99491d968485a4cd7b47b99))
|
||||||
|
* fields content language detection not working properly ([a91fa8f](https://github.com/antares-sql/antares/commit/a91fa8ff54bbf1f8475666efd3a268a3a4f07f0c))
|
||||||
|
* **Linux:** ctrl+space shortcut not working ([ed3d35f](https://github.com/antares-sql/antares/commit/ed3d35f1319a1e2edcb8104f2045a71b9e9754a2))
|
||||||
|
* unable to delete by select all in left bar search, closes [#368](https://github.com/antares-sql/antares/issues/368) ([7725faf](https://github.com/antares-sql/antares/commit/7725fafe852479720fa619ced0970f2fa0099191))
|
||||||
|
* unable to update data on tables missing primary or unique key ([e0946f0](https://github.com/antares-sql/antares/commit/e0946f04f792d25c187ea56d4714bdacc016ada3))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* improved resize of text editor resizing console height ([3f9e6d8](https://github.com/antares-sql/antares/commit/3f9e6d85ca445eea1028effa32418eee4980f87d))
|
||||||
|
* **UI:** improved visibility of explore bar tooltips ([f312cf5](https://github.com/antares-sql/antares/commit/f312cf5f855deddd562c26d1835f78d16499b93b))
|
||||||
|
|
||||||
### [0.5.9](https://github.com/antares-sql/antares/compare/v0.5.8...v0.5.9) (2022-07-06)
|
### [0.5.9](https://github.com/antares-sql/antares/compare/v0.5.8...v0.5.9) (2022-07-06)
|
||||||
|
|
||||||
|
|
||||||
|
18326
package-lock.json
generated
18326
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "antares",
|
"name": "antares",
|
||||||
"productName": "Antares",
|
"productName": "Antares",
|
||||||
"version": "0.5.9",
|
"version": "0.5.11",
|
||||||
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
|
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "https://github.com/antares-sql/antares.git",
|
"repository": "https://github.com/antares-sql/antares.git",
|
||||||
@@ -119,7 +119,6 @@
|
|||||||
"@faker-js/faker": "~6.1.2",
|
"@faker-js/faker": "~6.1.2",
|
||||||
"@mdi/font": "~6.9.96",
|
"@mdi/font": "~6.9.96",
|
||||||
"@turf/helpers": "~6.5.0",
|
"@turf/helpers": "~6.5.0",
|
||||||
"@vscode/vscode-languagedetection": "~1.0.21",
|
|
||||||
"@vueuse/core": "~8.7.5",
|
"@vueuse/core": "~8.7.5",
|
||||||
"ace-builds": "~1.4.13",
|
"ace-builds": "~1.4.13",
|
||||||
"better-sqlite3": "~7.5.1",
|
"better-sqlite3": "~7.5.1",
|
||||||
@@ -130,7 +129,7 @@
|
|||||||
"encoding": "~0.1.13",
|
"encoding": "~0.1.13",
|
||||||
"leaflet": "~1.7.1",
|
"leaflet": "~1.7.1",
|
||||||
"marked": "~4.0.0",
|
"marked": "~4.0.0",
|
||||||
"moment": "~2.29.1",
|
"moment": "~2.29.4",
|
||||||
"mysql2": "~2.3.2",
|
"mysql2": "~2.3.2",
|
||||||
"pg": "~8.7.1",
|
"pg": "~8.7.1",
|
||||||
"pg-query-stream": "~4.2.3",
|
"pg-query-stream": "~4.2.3",
|
||||||
|
@@ -25,6 +25,7 @@ export interface IpcResponse<T = any> {
|
|||||||
*/
|
*/
|
||||||
export interface ClientParams {
|
export interface ClientParams {
|
||||||
client: ClientCode;
|
client: ClientCode;
|
||||||
|
uid?: string;
|
||||||
params:
|
params:
|
||||||
mysql.ConnectionOptions & {schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean}
|
mysql.ConnectionOptions & {schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean}
|
||||||
| pg.ClientConfig & {schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean}
|
| pg.ClientConfig & {schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean}
|
||||||
|
192
src/common/libs/langDetector.ts
Normal file
192
src/common/libs/langDetector.ts
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
function isJSON (str: string) {
|
||||||
|
try {
|
||||||
|
if (!['{', '['].includes(str.trim()[0]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
JSON.parse(str);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isHTML (str: string) {
|
||||||
|
const tags = [
|
||||||
|
'a',
|
||||||
|
'abbr',
|
||||||
|
'address',
|
||||||
|
'area',
|
||||||
|
'article',
|
||||||
|
'aside',
|
||||||
|
'audio',
|
||||||
|
'b',
|
||||||
|
'base',
|
||||||
|
'bdi',
|
||||||
|
'bdo',
|
||||||
|
'blockquote',
|
||||||
|
'body',
|
||||||
|
'br',
|
||||||
|
'button',
|
||||||
|
'canvas',
|
||||||
|
'caption',
|
||||||
|
'cite',
|
||||||
|
'code',
|
||||||
|
'col',
|
||||||
|
'colgroup',
|
||||||
|
'data',
|
||||||
|
'datalist',
|
||||||
|
'dd',
|
||||||
|
'del',
|
||||||
|
'details',
|
||||||
|
'dfn',
|
||||||
|
'dialog',
|
||||||
|
'div',
|
||||||
|
'dl',
|
||||||
|
'dt',
|
||||||
|
'em',
|
||||||
|
'embed',
|
||||||
|
'fieldset',
|
||||||
|
'figcaption',
|
||||||
|
'figure',
|
||||||
|
'footer',
|
||||||
|
'form',
|
||||||
|
'h1',
|
||||||
|
'h2',
|
||||||
|
'h3',
|
||||||
|
'h4',
|
||||||
|
'h5',
|
||||||
|
'h6',
|
||||||
|
'head',
|
||||||
|
'header',
|
||||||
|
'hgroup',
|
||||||
|
'hr',
|
||||||
|
'html',
|
||||||
|
'i',
|
||||||
|
'iframe',
|
||||||
|
'img',
|
||||||
|
'input',
|
||||||
|
'ins',
|
||||||
|
'kbd',
|
||||||
|
'label',
|
||||||
|
'legend',
|
||||||
|
'li',
|
||||||
|
'link',
|
||||||
|
'main',
|
||||||
|
'map',
|
||||||
|
'mark',
|
||||||
|
'math',
|
||||||
|
'menu',
|
||||||
|
'menuitem',
|
||||||
|
'meta',
|
||||||
|
'meter',
|
||||||
|
'nav',
|
||||||
|
'noscript',
|
||||||
|
'object',
|
||||||
|
'ol',
|
||||||
|
'optgroup',
|
||||||
|
'option',
|
||||||
|
'output',
|
||||||
|
'p',
|
||||||
|
'param',
|
||||||
|
'picture',
|
||||||
|
'pre',
|
||||||
|
'progress',
|
||||||
|
'q',
|
||||||
|
'rb',
|
||||||
|
'rp',
|
||||||
|
'rt',
|
||||||
|
'rtc',
|
||||||
|
'ruby',
|
||||||
|
's',
|
||||||
|
'samp',
|
||||||
|
'script',
|
||||||
|
'section',
|
||||||
|
'select',
|
||||||
|
'slot',
|
||||||
|
'small',
|
||||||
|
'source',
|
||||||
|
'span',
|
||||||
|
'strong',
|
||||||
|
'style',
|
||||||
|
'sub',
|
||||||
|
'summary',
|
||||||
|
'sup',
|
||||||
|
'svg',
|
||||||
|
'table',
|
||||||
|
'tbody',
|
||||||
|
'td',
|
||||||
|
'template',
|
||||||
|
'textarea',
|
||||||
|
'tfoot',
|
||||||
|
'th',
|
||||||
|
'thead',
|
||||||
|
'time',
|
||||||
|
'title',
|
||||||
|
'tr',
|
||||||
|
'track',
|
||||||
|
'u',
|
||||||
|
'ul',
|
||||||
|
'var',
|
||||||
|
'video',
|
||||||
|
'wbr'
|
||||||
|
];
|
||||||
|
const doc = new DOMParser().parseFromString(str, 'text/html');
|
||||||
|
const lowerStr = str.toLowerCase();
|
||||||
|
if (Array.from(doc.body.childNodes).some(node => node.nodeType === 1))
|
||||||
|
return tags.some((tag) => lowerStr.includes(`<${tag}>`));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSVG (str: string) {
|
||||||
|
const doc = new DOMParser().parseFromString(str, 'text/xml');
|
||||||
|
const lowerStr = str.toLowerCase();
|
||||||
|
const errorNode = doc.querySelector('parsererror');
|
||||||
|
if (!errorNode)
|
||||||
|
return lowerStr.includes('<svg');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isXML (str: string) {
|
||||||
|
const doc = new DOMParser().parseFromString(str, 'text/xml');
|
||||||
|
const errorNode = doc.querySelector('parsererror');
|
||||||
|
return !errorNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMD (str: string) {
|
||||||
|
const mdChecks = [
|
||||||
|
'# ',
|
||||||
|
'`',
|
||||||
|
'- ',
|
||||||
|
'+ ',
|
||||||
|
'* ',
|
||||||
|
'1. ',
|
||||||
|
'**',
|
||||||
|
'__',
|
||||||
|
'~~',
|
||||||
|
'>> ',
|
||||||
|
'](http',
|
||||||
|
'![',
|
||||||
|
'[ ]',
|
||||||
|
'[x]'
|
||||||
|
];
|
||||||
|
|
||||||
|
return mdChecks.some((tag) => str.includes(tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function langDetector (str: string) {
|
||||||
|
if (!str.trim().length)
|
||||||
|
return 'text';
|
||||||
|
if (isJSON(str))
|
||||||
|
return 'json';
|
||||||
|
if (isHTML(str))
|
||||||
|
return 'html';
|
||||||
|
if (isSVG(str))
|
||||||
|
return 'svg';
|
||||||
|
if (isXML(str))
|
||||||
|
return 'xml';
|
||||||
|
if (isMD(str))
|
||||||
|
return 'markdown';
|
||||||
|
return 'text';
|
||||||
|
}
|
49
src/common/shortcuts.ts
Normal file
49
src/common/shortcuts.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
interface ShortcutRecord {
|
||||||
|
event: string;
|
||||||
|
keys: Electron.Accelerator[];
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const shortcuts: ShortcutRecord[] = [
|
||||||
|
{
|
||||||
|
event: 'open-new-tab',
|
||||||
|
keys: ['CommandOrControl+T'],
|
||||||
|
description: 'Open a new query tab'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event: 'close-tab',
|
||||||
|
keys: ['CommandOrControl+W'],
|
||||||
|
description: 'Close tab'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event: 'next-tab',
|
||||||
|
keys: ['Alt+CommandOrControl+Right', 'CommandOrControl+PageDown'],
|
||||||
|
description: 'Next tab'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event: 'prev-tab',
|
||||||
|
keys: ['Alt+CommandOrControl+Left', 'CommandOrControl+PageUp'],
|
||||||
|
description: 'Previous tab'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event: 'open-connections-modal',
|
||||||
|
keys: ['Shift+CommandOrControl+Space'],
|
||||||
|
description: 'Show all connections'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event: 'toggle-console',
|
||||||
|
keys: ['CommandOrControl+F12', 'CommandOrControl+`'],
|
||||||
|
description: 'Toggle console'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
for (let i = 1; i <= 9; i++) {
|
||||||
|
shortcuts.push(
|
||||||
|
{
|
||||||
|
event: `select-tab-${i}`,
|
||||||
|
keys: [`CommandOrControl+${i}`],
|
||||||
|
description: `Select tab number ${i}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export { shortcuts };
|
@@ -55,6 +55,7 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const connection = await ClientsFactory.getClient({
|
const connection = await ClientsFactory.getClient({
|
||||||
|
uid: conn.uid,
|
||||||
client: conn.client,
|
client: conn.client,
|
||||||
params
|
params
|
||||||
});
|
});
|
||||||
@@ -128,6 +129,7 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const connection = ClientsFactory.getClient({
|
const connection = ClientsFactory.getClient({
|
||||||
|
uid: conn.uid,
|
||||||
client: conn.client,
|
client: conn.client,
|
||||||
params,
|
params,
|
||||||
poolSize: 5
|
poolSize: 5
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
|
import { webContents } from 'electron';
|
||||||
import mysql from 'mysql2/promise';
|
import mysql from 'mysql2/promise';
|
||||||
import * as pg from 'pg';
|
import * as pg from 'pg';
|
||||||
import SSH2Promise from 'ssh2-promise';
|
import SSH2Promise from 'ssh2-promise';
|
||||||
|
|
||||||
const queryLogger = (sql: string) => {
|
const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
|
||||||
// Remove comments, newlines and multiple spaces
|
// Remove comments, newlines and multiple spaces
|
||||||
const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
|
const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
|
||||||
console.log(escapedSql);
|
const mainWindow = webContents.fromId(1);
|
||||||
|
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
|
||||||
|
if (process.env.NODE_ENV === 'development') console.log(escapedSql);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,15 +17,17 @@ const queryLogger = (sql: string) => {
|
|||||||
*/
|
*/
|
||||||
export class AntaresCore {
|
export class AntaresCore {
|
||||||
_client: antares.ClientCode;
|
_client: antares.ClientCode;
|
||||||
|
protected _cUid: string
|
||||||
protected _params: mysql.ConnectionOptions | pg.ClientConfig | { databasePath: string; readonly: boolean};
|
protected _params: mysql.ConnectionOptions | pg.ClientConfig | { databasePath: string; readonly: boolean};
|
||||||
protected _poolSize: number;
|
protected _poolSize: number;
|
||||||
protected _ssh?: SSH2Promise;
|
protected _ssh?: SSH2Promise;
|
||||||
protected _logger: (sql: string) => void;
|
protected _logger: (args: {sql: string; cUid: string}) => void;
|
||||||
protected _queryDefaults: antares.QueryBuilderObject;
|
protected _queryDefaults: antares.QueryBuilderObject;
|
||||||
protected _query: antares.QueryBuilderObject;
|
protected _query: antares.QueryBuilderObject;
|
||||||
|
|
||||||
constructor (args: antares.ClientParams) {
|
constructor (args: antares.ClientParams) {
|
||||||
this._client = args.client;
|
this._client = args.client;
|
||||||
|
this._cUid = args.uid;
|
||||||
this._params = args.params;
|
this._params = args.params;
|
||||||
this._poolSize = args.poolSize || undefined;
|
this._poolSize = args.poolSize || undefined;
|
||||||
this._logger = args.logger || queryLogger;
|
this._logger = args.logger || queryLogger;
|
||||||
|
@@ -1536,7 +1536,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
|
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
|
||||||
if (process.env.NODE_ENV === 'development') this._logger(sql);
|
this._logger({ cUid: this._cUid, sql });
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
nest: false,
|
nest: false,
|
||||||
|
@@ -1314,7 +1314,7 @@ export class PostgreSQLClient extends AntaresCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
|
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
|
||||||
if (process.env.NODE_ENV === 'development') this._logger(sql);
|
this._logger({ cUid: this._cUid, sql });
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
nest: false,
|
nest: false,
|
||||||
|
@@ -586,7 +586,7 @@ export class SQLiteClient extends AntaresCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
|
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
|
||||||
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder
|
this._logger({ cUid: this._cUid, sql });// TODO: replace BLOB content with a placeholder
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
nest: false,
|
nest: false,
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { app, BrowserWindow, /* session, */ nativeImage, Menu, ipcMain } from 'electron';
|
import { app, BrowserWindow, globalShortcut, nativeImage, Menu, ipcMain } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as Store from 'electron-store';
|
import * as Store from 'electron-store';
|
||||||
import * as windowStateKeeper from 'electron-window-state';
|
import * as windowStateKeeper from 'electron-window-state';
|
||||||
import * as remoteMain from '@electron/remote/main';
|
import * as remoteMain from '@electron/remote/main';
|
||||||
|
|
||||||
import ipcHandlers from './ipc-handlers';
|
import ipcHandlers from './ipc-handlers';
|
||||||
|
import { shortcuts } from 'common/shortcuts';
|
||||||
|
|
||||||
Store.initRenderer();
|
Store.initRenderer();
|
||||||
const persistentStore = new Store({ name: 'settings' });
|
const persistentStore = new Store({ name: 'settings' });
|
||||||
@@ -142,6 +143,31 @@ else {
|
|||||||
window.webContents.session.loadExtension(extensionPath, { allowFileAccess: true }).catch(console.error);
|
window.webContents.session.loadExtension(extensionPath, { allowFileAccess: true }).catch(console.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.on('browser-window-focus', () => {
|
||||||
|
// Send registered shortcut events to window
|
||||||
|
for (const shortcut of shortcuts) {
|
||||||
|
for (const key of shortcut.keys) {
|
||||||
|
globalShortcut.register(key, () => {
|
||||||
|
mainWindow.webContents.send(shortcut.event);
|
||||||
|
if (isDevelopment) console.log('EVENT:', shortcut);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDevelopment) { // Dev shortcuts
|
||||||
|
globalShortcut.register('Shift+CommandOrControl+F5', () => {
|
||||||
|
mainWindow.reload();
|
||||||
|
});
|
||||||
|
globalShortcut.register('Shift+CommandOrControl+F12', () => {
|
||||||
|
mainWindow.webContents.openDevTools();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('browser-window-blur', () => {
|
||||||
|
globalShortcut.unregisterAll();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAppMenu () {
|
function createAppMenu () {
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineAsyncComponent, onBeforeUnmount, onMounted, Ref, ref } from 'vue';
|
import { defineAsyncComponent, onMounted, Ref, ref } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@@ -67,14 +67,9 @@ const { changeApplicationTheme } = settingsStore;
|
|||||||
|
|
||||||
const isAllConnectionsModal: Ref<boolean> = ref(false);
|
const isAllConnectionsModal: Ref<boolean> = ref(false);
|
||||||
|
|
||||||
const onKey = (e: KeyboardEvent) => {
|
ipcRenderer.on('open-connections-modal', () => {
|
||||||
if (e.ctrlKey || e.metaKey) {
|
isAllConnectionsModal.value = true;
|
||||||
if (e.code === 'Space') {
|
});
|
||||||
isAllConnectionsModal.value = true;
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -82,8 +77,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('keypress', onKey);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
ipcRenderer.send('check-for-updates');
|
ipcRenderer.send('check-for-updates');
|
||||||
checkVersionUpdate();
|
checkVersionUpdate();
|
||||||
@@ -126,10 +119,6 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
|
||||||
window.removeEventListener('keydown', onKey);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -162,7 +151,7 @@ onBeforeUnmount(() => {
|
|||||||
.connection-panel-wrapper {
|
.connection-panel-wrapper {
|
||||||
height: calc(100vh - #{$excluding-size});
|
height: calc(100vh - #{$excluding-size});
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: 15vh;
|
padding-top: 10vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
@@ -47,10 +47,11 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
const cursorPosition = ref(0);
|
const cursorPosition = ref(0);
|
||||||
const fields = ref([]);
|
const lastTableFields = ref([]);
|
||||||
const customCompleter = ref([]);
|
const customCompleter = ref([]);
|
||||||
const id = ref(uidGen());
|
const id = ref(uidGen());
|
||||||
const lastSchema: Ref<string> = ref(null);
|
const lastSchema: Ref<string> = ref(null);
|
||||||
|
const fields: Ref<{name: string; type: string}[]> = ref([]);
|
||||||
|
|
||||||
const tables = computed(() => {
|
const tables = computed(() => {
|
||||||
return props.workspace
|
return props.workspace
|
||||||
@@ -61,13 +62,27 @@ const tables = computed(() => {
|
|||||||
}, []).map(table => {
|
}, []).map(table => {
|
||||||
return {
|
return {
|
||||||
name: table.name as string,
|
name: table.name as string,
|
||||||
type: table.type as string,
|
type: table.type as string
|
||||||
fields: []
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tablesInQuery = computed(() => {
|
||||||
|
if (!props.modelValue) return [];
|
||||||
|
const words = props.modelValue
|
||||||
|
.replaceAll(/[.'"`]/g, ' ')
|
||||||
|
.split(' ')
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
|
const includedTables = tables.value.reduce((acc, curr) => {
|
||||||
|
acc.push(curr.name);
|
||||||
|
return acc;
|
||||||
|
}, [] as string[]).filter((t) => words.includes(t));
|
||||||
|
|
||||||
|
return includedTables;
|
||||||
|
});
|
||||||
|
|
||||||
const triggers = computed(() => {
|
const triggers = computed(() => {
|
||||||
return props.workspace
|
return props.workspace
|
||||||
? props.workspace.structure.filter(schema => schema.name === props.schema)
|
? props.workspace.structure.filter(schema => schema.name === props.schema)
|
||||||
@@ -150,11 +165,11 @@ const lastWord = computed(() => {
|
|||||||
|
|
||||||
const isLastWordATable = computed(() => /\w+\.\w*/gm.test(lastWord.value));
|
const isLastWordATable = computed(() => /\w+\.\w*/gm.test(lastWord.value));
|
||||||
|
|
||||||
const fieldsCompleter = computed(() => {
|
const tableFieldsCompleter = computed(() => {
|
||||||
return {
|
return {
|
||||||
getCompletions: (editor: never, session: never, pos: never, prefix: never, callback: (err: null, response: ace.Ace.Completion[]) => void) => {
|
getCompletions: (editor: never, session: never, pos: never, prefix: never, callback: (err: null, response: ace.Ace.Completion[]) => void) => {
|
||||||
const completions: ace.Ace.Completion[] = [];
|
const completions: ace.Ace.Completion[] = [];
|
||||||
fields.value.forEach(field => {
|
lastTableFields.value.forEach(field => {
|
||||||
completions.push({
|
completions.push({
|
||||||
value: field,
|
value: field,
|
||||||
meta: 'column',
|
meta: 'column',
|
||||||
@@ -175,7 +190,8 @@ const setCustomCompleter = () => {
|
|||||||
...triggers.value,
|
...triggers.value,
|
||||||
...procedures.value,
|
...procedures.value,
|
||||||
...functions.value,
|
...functions.value,
|
||||||
...schedulers.value
|
...schedulers.value,
|
||||||
|
...fields.value
|
||||||
].forEach(el => {
|
].forEach(el => {
|
||||||
completions.push({
|
completions.push({
|
||||||
value: el.name,
|
value: el.name,
|
||||||
@@ -195,6 +211,29 @@ watch(() => props.modelValue, () => {
|
|||||||
cursorPosition.value = (editor.value.session as any).doc.positionToIndex(editor.value.getCursorPosition());
|
cursorPosition.value = (editor.value.session as any).doc.positionToIndex(editor.value.getCursorPosition());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(() => tablesInQuery.value.length, () => {
|
||||||
|
const localFields: {name: string; type: string}[] = [];
|
||||||
|
tablesInQuery.value.forEach(async table => {
|
||||||
|
const params = {
|
||||||
|
uid: props.workspace.uid,
|
||||||
|
schema: props.schema,
|
||||||
|
table: table
|
||||||
|
};
|
||||||
|
|
||||||
|
const { response } = await Tables.getTableColumns(params);
|
||||||
|
|
||||||
|
response.forEach((field: { name: string }) => {
|
||||||
|
localFields.push({
|
||||||
|
name: field.name,
|
||||||
|
type: 'column'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
fields.value = localFields;
|
||||||
|
setCustomCompleter();
|
||||||
|
});
|
||||||
|
|
||||||
watch(editorTheme, () => {
|
watch(editorTheme, () => {
|
||||||
if (editor.value)
|
if (editor.value)
|
||||||
editor.value.setTheme(`ace/theme/${editorTheme.value}`);
|
editor.value.setTheme(`ace/theme/${editorTheme.value}`);
|
||||||
@@ -289,8 +328,8 @@ onMounted(() => {
|
|||||||
|
|
||||||
Tables.getTableColumns(params).then(res => {
|
Tables.getTableColumns(params).then(res => {
|
||||||
if (res.response.length)
|
if (res.response.length)
|
||||||
fields.value = res.response.map((field: { name: string }) => field.name);
|
lastTableFields.value = res.response.map((field: { name: string }) => field.name);
|
||||||
editor.value.completers = [fieldsCompleter.value];
|
editor.value.completers = [tableFieldsCompleter.value];
|
||||||
editor.value.execCommand('startAutocomplete');
|
editor.value.execCommand('startAutocomplete');
|
||||||
}).catch(console.log);
|
}).catch(console.log);
|
||||||
}
|
}
|
||||||
|
@@ -11,14 +11,30 @@
|
|||||||
|
|
||||||
<div class="footer-right-elements">
|
<div class="footer-right-elements">
|
||||||
<ul class="footer-elements">
|
<ul class="footer-elements">
|
||||||
|
<li
|
||||||
|
v-if="workspace.connectionStatus === 'connected' "
|
||||||
|
class="footer-element footer-link"
|
||||||
|
@click="toggleConsole()"
|
||||||
|
>
|
||||||
|
<i class="mdi mdi-18px mdi-console-line mr-1" />
|
||||||
|
<small>{{ t('word.console') }}</small>
|
||||||
|
</li>
|
||||||
<li class="footer-element footer-link" @click="openOutside('https://www.paypal.com/paypalme/fabiodistasio')">
|
<li class="footer-element footer-link" @click="openOutside('https://www.paypal.com/paypalme/fabiodistasio')">
|
||||||
<i class="mdi mdi-18px mdi-coffee mr-1" />
|
<i class="mdi mdi-18px mdi-coffee mr-1" />
|
||||||
<small>{{ $t('word.donate') }}</small>
|
<small>{{ t('word.donate') }}</small>
|
||||||
</li>
|
</li>
|
||||||
<li class="footer-element footer-link" @click="openOutside('https://github.com/antares-sql/antares/issues')">
|
<li
|
||||||
|
class="footer-element footer-link"
|
||||||
|
:title="t('message.reportABug')"
|
||||||
|
@click="openOutside('https://github.com/antares-sql/antares/issues')"
|
||||||
|
>
|
||||||
<i class="mdi mdi-18px mdi-bug" />
|
<i class="mdi mdi-18px mdi-bug" />
|
||||||
</li>
|
</li>
|
||||||
<li class="footer-element footer-link" @click="showSettingModal('about')">
|
<li
|
||||||
|
class="footer-element footer-link"
|
||||||
|
:title="t('word.about')"
|
||||||
|
@click="showSettingModal('about')"
|
||||||
|
>
|
||||||
<i class="mdi mdi-18px mdi-information-outline" />
|
<i class="mdi mdi-18px mdi-information-outline" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -29,9 +45,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { shell } from 'electron';
|
import { shell } from 'electron';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { computed, ComputedRef } from 'vue';
|
import { computed, ComputedRef } from 'vue';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
interface DatabaseInfos {// TODO: temp
|
interface DatabaseInfos {// TODO: temp
|
||||||
name: string;
|
name: string;
|
||||||
@@ -43,13 +63,15 @@ interface DatabaseInfos {// TODO: temp
|
|||||||
const applicationStore = useApplicationStore();
|
const applicationStore = useApplicationStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
const { getSelected: workspace } = storeToRefs(workspacesStore);
|
const { getSelected: workspaceUid } = storeToRefs(workspacesStore);
|
||||||
|
const { toggleConsole } = useConsoleStore();
|
||||||
|
|
||||||
const { showSettingModal } = applicationStore;
|
const { showSettingModal } = applicationStore;
|
||||||
const { getWorkspace } = workspacesStore;
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
const workspace = computed(() => getWorkspace(workspaceUid.value));
|
||||||
const version: ComputedRef<DatabaseInfos> = computed(() => {
|
const version: ComputedRef<DatabaseInfos> = computed(() => {
|
||||||
return getWorkspace(workspace.value) ? getWorkspace(workspace.value).version : null;
|
return getWorkspace(workspaceUid.value) ? workspace.value.version : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const versionString = computed(() => {
|
const versionString = computed(() => {
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
@mouseover.self="tooltipPosition"
|
@mouseover.self="tooltipPosition"
|
||||||
>
|
>
|
||||||
<i class="settingbar-element-icon mdi mdi-24px mdi-dots-horizontal text-light" />
|
<i class="settingbar-element-icon mdi mdi-24px mdi-dots-horizontal text-light" />
|
||||||
<span class="ex-tooltip-content">{{ $t('message.allConnections') }} (CTRL+Space)</span>
|
<span class="ex-tooltip-content">{{ $t('message.allConnections') }} (Shift+CTRL+Space)</span>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
class="settingbar-element btn btn-link ex-tooltip"
|
class="settingbar-element btn btn-link ex-tooltip"
|
||||||
|
@@ -279,6 +279,12 @@
|
|||||||
<span>{{ $t('message.processesList') }}</span>
|
<span>{{ $t('message.processesList') }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="menu-item">
|
||||||
|
<a class="c-hand p-vcentered" @click="toggleConsole">
|
||||||
|
<i class="mdi mdi-console-line mr-1 tool-icon" />
|
||||||
|
<span>{{ $t('word.console') }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li
|
<li
|
||||||
v-if="workspace.customizations.variables"
|
v-if="workspace.customizations.variables"
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
@@ -451,8 +457,9 @@
|
|||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<WorkspaceQueryConsole v-if="isConsoleOpen(workspace.uid)" :uid="workspace.uid" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="connection-panel-wrapper">
|
<div v-else class="connection-panel-wrapper p-relative">
|
||||||
<WorkspaceEditConnectionPanel :connection="connection" />
|
<WorkspaceEditConnectionPanel :connection="connection" />
|
||||||
</div>
|
</div>
|
||||||
<ModalProcessesList
|
<ModalProcessesList
|
||||||
@@ -470,11 +477,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onBeforeUnmount, Prop, ref, watch } from 'vue';
|
import { ipcRenderer } from 'electron';
|
||||||
|
import { computed, onMounted, Prop, ref, watch } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import * as Draggable from 'vuedraggable';
|
import * as Draggable from 'vuedraggable';
|
||||||
import Connection from '@/ipc-api/Connection';
|
import Connection from '@/ipc-api/Connection';
|
||||||
import { useWorkspacesStore, WorkspaceTab } from '@/stores/workspaces';
|
import { useWorkspacesStore, WorkspaceTab } from '@/stores/workspaces';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { ConnectionParams } from 'common/interfaces/antares';
|
import { ConnectionParams } from 'common/interfaces/antares';
|
||||||
|
|
||||||
import WorkspaceEmptyState from '@/components/WorkspaceEmptyState.vue';
|
import WorkspaceEmptyState from '@/components/WorkspaceEmptyState.vue';
|
||||||
@@ -482,6 +491,7 @@ import WorkspaceExploreBar from '@/components/WorkspaceExploreBar.vue';
|
|||||||
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel.vue';
|
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel.vue';
|
||||||
import WorkspaceTabQuery from '@/components/WorkspaceTabQuery.vue';
|
import WorkspaceTabQuery from '@/components/WorkspaceTabQuery.vue';
|
||||||
import WorkspaceTabTable from '@/components/WorkspaceTabTable.vue';
|
import WorkspaceTabTable from '@/components/WorkspaceTabTable.vue';
|
||||||
|
import WorkspaceQueryConsole from '@/components/WorkspaceQueryConsole.vue';
|
||||||
|
|
||||||
import WorkspaceTabNewTable from '@/components/WorkspaceTabNewTable.vue';
|
import WorkspaceTabNewTable from '@/components/WorkspaceTabNewTable.vue';
|
||||||
import WorkspaceTabNewView from '@/components/WorkspaceTabNewView.vue';
|
import WorkspaceTabNewView from '@/components/WorkspaceTabNewView.vue';
|
||||||
@@ -517,6 +527,11 @@ const {
|
|||||||
selectPrevTab
|
selectPrevTab
|
||||||
} = workspacesStore;
|
} = workspacesStore;
|
||||||
|
|
||||||
|
const consoleStore = useConsoleStore();
|
||||||
|
|
||||||
|
const { isConsoleOpen } = storeToRefs(consoleStore);
|
||||||
|
const { toggleConsole } = consoleStore;
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
connection: Object as Prop<ConnectionParams>
|
connection: Object as Prop<ConnectionParams>
|
||||||
});
|
});
|
||||||
@@ -568,46 +583,13 @@ watch(queryTabs, (newVal, oldVal) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const addQueryTab = () => {
|
const addQueryTab = () => {
|
||||||
newTab({ uid: props.connection.uid, type: 'query' });
|
newTab({ uid: props.connection.uid, type: 'query', schema: workspace.value.breadcrumbs.schema });
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedTab = () => {
|
const getSelectedTab = () => {
|
||||||
return workspace.value.tabs.find(tab => tab.uid === selectedTab.value);
|
return workspace.value.tabs.find(tab => tab.uid === selectedTab.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onKey = (e: KeyboardEvent) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
if (!isSelected.value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((e.ctrlKey || e.metaKey) && e.key === 't' && !e.altKey) { // CTRL|Command + t
|
|
||||||
addQueryTab();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((e.ctrlKey || e.metaKey) && e.key === 'w' && !e.altKey) { // CTRL|Command + w
|
|
||||||
const currentTab = getSelectedTab();
|
|
||||||
if (currentTab)
|
|
||||||
closeTab(currentTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
// select next tab
|
|
||||||
if (e.altKey && (e.ctrlKey || e.metaKey) && e.key === 'ArrowRight')
|
|
||||||
selectNextTab({ uid: props.connection.uid });
|
|
||||||
|
|
||||||
// select prev tab
|
|
||||||
if (e.altKey && (e.ctrlKey || e.metaKey) && e.key === 'ArrowLeft')
|
|
||||||
selectPrevTab({ uid: props.connection.uid });
|
|
||||||
|
|
||||||
// select tab by index (range 1-9). CTRL|CMD number
|
|
||||||
if ((e.ctrlKey || e.metaKey) && !e.altKey && e.keyCode >= 49 && e.keyCode <= 57) {
|
|
||||||
const newIndex = parseInt(e.key) - 1;
|
|
||||||
|
|
||||||
if (workspace.value.tabs[newIndex])
|
|
||||||
selectTab({ uid: props.connection.uid, tab: workspace.value.tabs[newIndex].uid });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const openAsPermanentTab = (tab: WorkspaceTab) => {
|
const openAsPermanentTab = (tab: WorkspaceTab) => {
|
||||||
const permanentTabs = {
|
const permanentTabs = {
|
||||||
table: 'data',
|
table: 'data',
|
||||||
@@ -667,15 +649,42 @@ const cutText = (string: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
window.addEventListener('keydown', onKey);
|
|
||||||
await addWorkspace(props.connection.uid);
|
await addWorkspace(props.connection.uid);
|
||||||
const isInitiated = await Connection.checkConnection(props.connection.uid);
|
const isInitiated = await Connection.checkConnection(props.connection.uid);
|
||||||
if (isInitiated)
|
if (isInitiated)
|
||||||
connectWorkspace(props.connection);
|
connectWorkspace(props.connection);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onMounted(() => {
|
||||||
window.removeEventListener('keydown', onKey);
|
ipcRenderer.on('open-new-tab', () => {
|
||||||
|
if (!isSelected.value) return;
|
||||||
|
addQueryTab();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('close-tab', () => {
|
||||||
|
if (!isSelected.value) return;
|
||||||
|
const currentTab = getSelectedTab();
|
||||||
|
if (currentTab)
|
||||||
|
closeTab(currentTab);
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('next-tab', () => {
|
||||||
|
if (!isSelected.value) return;
|
||||||
|
selectNextTab({ uid: props.connection.uid });
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('prev-tab', () => {
|
||||||
|
if (!isSelected.value) return;
|
||||||
|
selectPrevTab({ uid: props.connection.uid });
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 1; i <= 9; i++) {
|
||||||
|
ipcRenderer.on(`select-tab-${i}`, () => {
|
||||||
|
if (!isSelected.value) return;
|
||||||
|
if (workspace.value.tabs[i-1])
|
||||||
|
selectTab({ uid: props.connection.uid, tab: workspace.value.tabs[i-1].uid });
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -685,8 +694,9 @@ onBeforeUnmount(() => {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
.workspace-tabs {
|
.workspace-tabs {
|
||||||
overflow: hidden;
|
overflow-y: hidden;
|
||||||
height: calc(100vh - #{$excluding-size});
|
height: calc(100vh - #{$excluding-size});
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.tab-block {
|
.tab-block {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
@@ -551,7 +551,8 @@ localConnection.value = JSON.parse(JSON.stringify(props.connection));
|
|||||||
.connection-panel {
|
.connection-panel {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: .5rem;
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
min-width: 450px;
|
min-width: 450px;
|
||||||
|
@@ -235,17 +235,7 @@ const refresh = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const explorebarSearch = (e: KeyboardEvent) => {
|
const explorebarSearch = () => {
|
||||||
if (e.code === 'Backspace') {
|
|
||||||
e.preventDefault();
|
|
||||||
if (searchTerm.value.length)
|
|
||||||
searchTerm.value = searchTerm.value.slice(0, -1);
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (e.key.length > 1)// Prevent non-alphanumerics
|
|
||||||
return;
|
|
||||||
|
|
||||||
searchInput.value.focus();
|
searchInput.value.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -580,7 +580,7 @@ defineExpose({ selectSchema, schemaAccordion });
|
|||||||
transition: opacity 0.2s;
|
transition: opacity 0.2s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 0.8;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
|
177
src/renderer/components/WorkspaceQueryConsole.vue
Normal file
177
src/renderer/components/WorkspaceQueryConsole.vue
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
ref="wrapper"
|
||||||
|
class="query-console-wrapper"
|
||||||
|
@mouseenter="isHover = true"
|
||||||
|
@mouseleave="isHover = false"
|
||||||
|
>
|
||||||
|
<div ref="resizer" class="query-console-resizer" />
|
||||||
|
<div
|
||||||
|
id="query-console"
|
||||||
|
ref="queryConsole"
|
||||||
|
class="query-console column col-12"
|
||||||
|
:style="{height: localHeight ? localHeight+'px' : ''}"
|
||||||
|
>
|
||||||
|
<div class="query-console-header">
|
||||||
|
<div>{{ t('word.console') }}</div>
|
||||||
|
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
|
||||||
|
</div>
|
||||||
|
<div ref="queryConsoleBody" class="query-console-body">
|
||||||
|
<div
|
||||||
|
v-for="(wLog, i) in workspaceLogs"
|
||||||
|
:key="i"
|
||||||
|
class="query-console-log"
|
||||||
|
tabindex="0"
|
||||||
|
@contextmenu.prevent="contextMenu($event, wLog)"
|
||||||
|
>
|
||||||
|
<span class="type-datetime">{{ moment(wLog.date).format('HH:mm:ss') }}</span>: <code class="query-console-log-sql">{{ wLog.sql }}</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<BaseContextMenu
|
||||||
|
v-if="isContext"
|
||||||
|
:context-event="contextEvent"
|
||||||
|
@close-context="isContext = false"
|
||||||
|
>
|
||||||
|
<div class="context-element" @click="copyQuery">
|
||||||
|
<span class="d-flex"><i class="mdi mdi-18px mdi-content-copy text-light pr-1" /> {{ $t('word.copy') }}</span>
|
||||||
|
</div>
|
||||||
|
</BaseContextMenu>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, nextTick, onMounted, ref, Ref, watch } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const consoleStore = useConsoleStore();
|
||||||
|
|
||||||
|
const { resizeConsole, getLogsByWorkspace } = consoleStore;
|
||||||
|
const { consoleHeight } = storeToRefs(consoleStore);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
uid: String
|
||||||
|
});
|
||||||
|
|
||||||
|
const wrapper: Ref<HTMLInputElement> = ref(null);
|
||||||
|
const queryConsole: Ref<HTMLInputElement> = ref(null);
|
||||||
|
const queryConsoleBody: Ref<HTMLInputElement> = ref(null);
|
||||||
|
const resizer: Ref<HTMLInputElement> = ref(null);
|
||||||
|
const localHeight = ref(250);
|
||||||
|
const isHover = ref(false);
|
||||||
|
const isContext = ref(false);
|
||||||
|
const contextQuery: Ref<string> = ref(null);
|
||||||
|
const contextEvent: Ref<MouseEvent> = ref(null);
|
||||||
|
|
||||||
|
const resize = (e: MouseEvent) => {
|
||||||
|
const el = queryConsole.value;
|
||||||
|
let consoleHeight = el.getBoundingClientRect().bottom - e.pageY;
|
||||||
|
if (consoleHeight > 400) consoleHeight = 400;
|
||||||
|
localHeight.value = consoleHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
const workspaceLogs = computed(() => {
|
||||||
|
return getLogsByWorkspace(props.uid);
|
||||||
|
});
|
||||||
|
|
||||||
|
const stopResize = () => {
|
||||||
|
if (localHeight.value < 0) localHeight.value = 0;
|
||||||
|
resizeConsole(localHeight.value);
|
||||||
|
window.removeEventListener('mousemove', resize);
|
||||||
|
window.removeEventListener('mouseup', stopResize);
|
||||||
|
};
|
||||||
|
|
||||||
|
const contextMenu = (event: MouseEvent, wLog: {date: Date; sql: string}) => {
|
||||||
|
contextEvent.value = event;
|
||||||
|
contextQuery.value = wLog.sql;
|
||||||
|
isContext.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyQuery = () => {
|
||||||
|
navigator.clipboard.writeText(contextQuery.value);
|
||||||
|
isContext.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(workspaceLogs, async () => {
|
||||||
|
if (!isHover.value) {
|
||||||
|
await nextTick();
|
||||||
|
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
localHeight.value = consoleHeight.value;
|
||||||
|
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
resizer.value.addEventListener('mousedown', (e: MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
window.addEventListener('mousemove', resize);
|
||||||
|
window.addEventListener('mouseup', stopResize);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.query-console-wrapper{
|
||||||
|
width: 100%;
|
||||||
|
z-index: 9;
|
||||||
|
margin-top: auto;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
.query-console-resizer{
|
||||||
|
height: 4px;
|
||||||
|
top: -1px;
|
||||||
|
width: 100%;
|
||||||
|
cursor: ns-resize;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 99;
|
||||||
|
transition: background 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba($primary-color, 50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-console {
|
||||||
|
padding: 0;
|
||||||
|
padding-bottom: $footer-height;
|
||||||
|
.query-console-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 4px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-console-body {
|
||||||
|
overflow: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-height: 100%;
|
||||||
|
padding: 0 6px 3px;
|
||||||
|
|
||||||
|
.query-console-log {
|
||||||
|
padding: 1px 3px;
|
||||||
|
margin: 1px 0;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
|
||||||
|
.query-console-log-sql {
|
||||||
|
font-size: 95%;
|
||||||
|
opacity: .8;
|
||||||
|
font-weight: 700;
|
||||||
|
user-select: text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
@@ -179,6 +179,8 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
@@ -200,6 +202,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -274,8 +277,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -311,6 +318,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
originalFunction.value = {
|
originalFunction.value = {
|
||||||
sql: customizations.value.functionSql,
|
sql: customizations.value.functionSql,
|
||||||
language: customizations.value.languages ? customizations.value.languages[0] : null,
|
language: customizations.value.languages ? customizations.value.languages[0] : null,
|
||||||
|
@@ -151,6 +151,8 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import Routines from '@/ipc-api/Routines';
|
import Routines from '@/ipc-api/Routines';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import QueryEditor from '@/components/QueryEditor.vue';
|
import QueryEditor from '@/components/QueryEditor.vue';
|
||||||
@@ -169,6 +171,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -243,8 +246,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -280,6 +287,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
originalRoutine.value = {
|
originalRoutine.value = {
|
||||||
sql: customizations.value.functionSql,
|
sql: customizations.value.functionSql,
|
||||||
language: customizations.value.languages ? customizations.value.languages[0] : null,
|
language: customizations.value.languages ? customizations.value.languages[0] : null,
|
||||||
|
@@ -129,6 +129,8 @@ import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Prop, Ref
|
|||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { ConnectionParams, EventInfos } from 'common/interfaces/antares';
|
import { ConnectionParams, EventInfos } from 'common/interfaces/antares';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
@@ -149,6 +151,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -233,8 +236,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -270,6 +277,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
originalScheduler.value = {
|
originalScheduler.value = {
|
||||||
definer: '',
|
definer: '',
|
||||||
sql: 'BEGIN\r\n\r\nEND',
|
sql: 'BEGIN\r\n\r\nEND',
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="px-2">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-auto">
|
<div class="column col-auto">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -118,8 +118,10 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import QueryEditor from '@/components/QueryEditor.vue';
|
import QueryEditor from '@/components/QueryEditor.vue';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
import Triggers from '@/ipc-api/Triggers';
|
import Triggers from '@/ipc-api/Triggers';
|
||||||
@@ -137,6 +139,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -254,8 +257,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -264,7 +271,7 @@ const resizeQueryEditor = () => {
|
|||||||
const onKey = (e: KeyboardEvent) => {
|
const onKey = (e: KeyboardEvent) => {
|
||||||
if (props.isSelected) {
|
if (props.isSelected) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
if (e.ctrlKey && e.key === 's') { // CTRL + S
|
||||||
if (isChanged.value)
|
if (isChanged.value)
|
||||||
saveChanges();
|
saveChanges();
|
||||||
}
|
}
|
||||||
@@ -288,6 +295,10 @@ originalTrigger.value = {
|
|||||||
name: ''
|
name: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
localTrigger.value = JSON.parse(JSON.stringify(originalTrigger.value));
|
localTrigger.value = JSON.parse(JSON.stringify(originalTrigger.value));
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@@ -99,6 +99,8 @@ import { Ace } from 'ace-builds';
|
|||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
import QueryEditor from '@/components/QueryEditor.vue';
|
import QueryEditor from '@/components/QueryEditor.vue';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
@@ -116,6 +118,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -189,8 +192,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -212,6 +219,18 @@ originalFunction.value = {
|
|||||||
name: ''
|
name: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(() => props.isSelected, (val) => {
|
||||||
|
if (val) changeBreadcrumbs({ schema: props.schema });
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(isChanged, (val) => {
|
||||||
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
localFunction.value = JSON.parse(JSON.stringify(originalFunction.value));
|
localFunction.value = JSON.parse(JSON.stringify(originalFunction.value));
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -238,12 +257,4 @@ onUnmounted(() => {
|
|||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
window.removeEventListener('keydown', onKey);
|
window.removeEventListener('keydown', onKey);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => props.isSelected, (val) => {
|
|
||||||
if (val) changeBreadcrumbs({ schema: props.schema });
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(isChanged, (val) => {
|
|
||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
@@ -107,6 +107,8 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
@@ -126,6 +128,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -202,8 +205,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -233,6 +240,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
originalView.value = {
|
originalView.value = {
|
||||||
algorithm: 'UNDEFINED',
|
algorithm: 'UNDEFINED',
|
||||||
definer: '',
|
definer: '',
|
||||||
|
@@ -194,6 +194,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
@@ -218,6 +220,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -344,8 +347,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -443,6 +450,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await getFunctionData();
|
await getFunctionData();
|
||||||
queryEditor.value.editor.session.setValue(localFunction.value.sql);
|
queryEditor.value.editor.session.setValue(localFunction.value.sql);
|
||||||
|
@@ -168,6 +168,8 @@ import { Component, computed, onUnmounted, onBeforeUnmount, onMounted, Ref, ref,
|
|||||||
import { AlterRoutineParams, FunctionParam, RoutineInfos } from 'common/interfaces/antares';
|
import { AlterRoutineParams, FunctionParam, RoutineInfos } from 'common/interfaces/antares';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
@@ -190,6 +192,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -316,8 +319,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -413,6 +420,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await getRoutineData();
|
await getRoutineData();
|
||||||
queryEditor.value.editor.session.setValue(localRoutine.value.sql);
|
queryEditor.value.editor.session.setValue(localRoutine.value.sql);
|
||||||
|
@@ -127,6 +127,8 @@ import { AlterEventParams, EventInfos } from 'common/interfaces/antares';
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
@@ -147,6 +149,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -269,8 +272,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -331,6 +338,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await getSchedulerData();
|
await getSchedulerData();
|
||||||
queryEditor.value.editor.session.setValue(localScheduler.value.sql);
|
queryEditor.value.editor.session.setValue(localScheduler.value.sql);
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
:confirm-text="t('word.confirm')"
|
:confirm-text="t('word.confirm')"
|
||||||
size="400"
|
size="400"
|
||||||
|
:disable-autofocus="true"
|
||||||
@confirm="confirmOptionsChange"
|
@confirm="confirmOptionsChange"
|
||||||
@hide="$emit('hide')"
|
@hide="$emit('hide')"
|
||||||
>
|
>
|
||||||
|
@@ -126,8 +126,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Component, computed, onMounted, onUnmounted, onUpdated, Prop, ref, Ref, watch } from 'vue';
|
import { Component, computed, onMounted, onUnmounted, onUpdated, Prop, ref, Ref, watch } from 'vue';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import * as Draggable from 'vuedraggable';
|
import * as Draggable from 'vuedraggable';
|
||||||
import TableRow from '@/components/WorkspaceTabPropsTableRow.vue';
|
import TableRow from '@/components/WorkspaceTabPropsTableRow.vue';
|
||||||
import TableContext from '@/components/WorkspaceTabPropsTableContext.vue';
|
import TableContext from '@/components/WorkspaceTabPropsTableContext.vue';
|
||||||
@@ -150,9 +152,12 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field']);
|
const emit = defineEmits(['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field']);
|
||||||
|
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const consoleStore = useConsoleStore();
|
||||||
|
|
||||||
const { getWorkspace } = workspacesStore;
|
const { getWorkspace } = workspacesStore;
|
||||||
|
|
||||||
|
const { consoleHeight } = storeToRefs(consoleStore);
|
||||||
|
|
||||||
const tableWrapper: Ref<HTMLDivElement> = ref(null);
|
const tableWrapper: Ref<HTMLDivElement> = ref(null);
|
||||||
const propTable: Ref<HTMLDivElement> = ref(null);
|
const propTable: Ref<HTMLDivElement> = ref(null);
|
||||||
const resultTable: Ref<Component> = ref(null);
|
const resultTable: Ref<Component> = ref(null);
|
||||||
@@ -172,8 +177,13 @@ const resizeResults = () => {
|
|||||||
const el = tableWrapper.value;
|
const el = tableWrapper.value;
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
resultsSize.value = size;
|
resultsSize.value = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,6 +226,10 @@ watch(fieldsLength, () => {
|
|||||||
refreshScroller();
|
refreshScroller();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeResults();
|
||||||
|
});
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
if (propTable.value)
|
if (propTable.value)
|
||||||
refreshScroller();
|
refreshScroller();
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="px-2">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-auto">
|
<div class="column col-auto">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -118,6 +118,8 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import QueryEditor from '@/components/QueryEditor.vue';
|
import QueryEditor from '@/components/QueryEditor.vue';
|
||||||
@@ -139,6 +141,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -304,8 +307,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -345,6 +352,10 @@ watch(isChanged, (val) => {
|
|||||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await getTriggerData();
|
await getTriggerData();
|
||||||
queryEditor.value.editor.session.setValue(localTrigger.value.sql);
|
queryEditor.value.editor.session.setValue(localTrigger.value.sql);
|
||||||
|
@@ -84,8 +84,10 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
import QueryEditor from '@/components/QueryEditor.vue';
|
import QueryEditor from '@/components/QueryEditor.vue';
|
||||||
import Functions from '@/ipc-api/Functions';
|
import Functions from '@/ipc-api/Functions';
|
||||||
@@ -104,6 +106,7 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
@@ -209,8 +212,12 @@ const clearChanges = () => {
|
|||||||
|
|
||||||
const resizeQueryEditor = () => {
|
const resizeQueryEditor = () => {
|
||||||
if (queryEditor.value) {
|
if (queryEditor.value) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
editorHeight.value = size;
|
editorHeight.value = size;
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
}
|
}
|
||||||
@@ -242,6 +249,10 @@ watch(() => props.function, async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeQueryEditor();
|
||||||
|
});
|
||||||
|
|
||||||
watch(() => props.isSelected, (val) => {
|
watch(() => props.isSelected, (val) => {
|
||||||
if (val) changeBreadcrumbs({ schema: props.schema });
|
if (val) changeBreadcrumbs({ schema: props.schema });
|
||||||
});
|
});
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
<div class="workspace-query-runner column col-12">
|
<div class="workspace-query-runner column col-12">
|
||||||
<QueryEditor
|
<QueryEditor
|
||||||
v-show="isSelected"
|
v-show="isSelected"
|
||||||
|
id="query-editor"
|
||||||
ref="queryEditor"
|
ref="queryEditor"
|
||||||
v-model="query"
|
v-model="query"
|
||||||
:auto-focus="true"
|
:auto-focus="true"
|
||||||
@@ -187,18 +188,20 @@
|
|||||||
import { Component, computed, onBeforeUnmount, onMounted, Prop, ref, Ref, watch } from 'vue';
|
import { Component, computed, onBeforeUnmount, onMounted, Prop, ref, Ref, watch } from 'vue';
|
||||||
import { Ace } from 'ace-builds';
|
import { Ace } from 'ace-builds';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { format } from 'sql-formatter';
|
import { format } from 'sql-formatter';
|
||||||
import { ConnectionParams } from 'common/interfaces/antares';
|
import { ConnectionParams } from 'common/interfaces/antares';
|
||||||
import { useHistoryStore } from '@/stores/history';
|
import { useHistoryStore } from '@/stores/history';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { useResultTables } from '@/composables/useResultTables';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
import QueryEditor from '@/components/QueryEditor.vue';
|
import QueryEditor from '@/components/QueryEditor.vue';
|
||||||
import BaseLoader from '@/components/BaseLoader.vue';
|
import BaseLoader from '@/components/BaseLoader.vue';
|
||||||
import WorkspaceTabQueryTable from '@/components/WorkspaceTabQueryTable.vue';
|
import WorkspaceTabQueryTable from '@/components/WorkspaceTabQueryTable.vue';
|
||||||
import WorkspaceTabQueryEmptyState from '@/components/WorkspaceTabQueryEmptyState.vue';
|
import WorkspaceTabQueryEmptyState from '@/components/WorkspaceTabQueryEmptyState.vue';
|
||||||
import ModalHistory from '@/components/ModalHistory.vue';
|
import ModalHistory from '@/components/ModalHistory.vue';
|
||||||
import { useResultTables } from '@/composables/useResultTables';
|
|
||||||
import BaseSelect from '@/components/BaseSelect.vue';
|
import BaseSelect from '@/components/BaseSelect.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -223,6 +226,8 @@ const { saveHistory } = useHistoryStore();
|
|||||||
const { addNotification } = useNotificationsStore();
|
const { addNotification } = useNotificationsStore();
|
||||||
const workspacesStore = useWorkspacesStore();
|
const workspacesStore = useWorkspacesStore();
|
||||||
|
|
||||||
|
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getWorkspace,
|
getWorkspace,
|
||||||
changeBreadcrumbs,
|
changeBreadcrumbs,
|
||||||
@@ -365,14 +370,17 @@ const resize = (e: MouseEvent) => {
|
|||||||
const el = queryEditor.value.$el;
|
const el = queryEditor.value.$el;
|
||||||
const queryFooterHeight = queryAreaFooter.value.clientHeight;
|
const queryFooterHeight = queryAreaFooter.value.clientHeight;
|
||||||
const bottom = e.pageY || resizer.value.getBoundingClientRect().bottom;
|
const bottom = e.pageY || resizer.value.getBoundingClientRect().bottom;
|
||||||
const maxHeight = window.innerHeight - 100 - queryFooterHeight;
|
const maxHeight = window.innerHeight - 100 - queryFooterHeight - consoleHeight.value;
|
||||||
let localEditorHeight = bottom - el.getBoundingClientRect().top;
|
let localEditorHeight = bottom - el.getBoundingClientRect().top;
|
||||||
if (localEditorHeight > maxHeight) localEditorHeight = maxHeight;
|
if (localEditorHeight > maxHeight) localEditorHeight = maxHeight;
|
||||||
if (localEditorHeight < 50) localEditorHeight = 50;
|
if (localEditorHeight < 50) localEditorHeight = 50;
|
||||||
editorHeight.value = localEditorHeight;
|
editorHeight.value = localEditorHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resizeResults = () => queryTable.value.resizeResults();
|
||||||
|
|
||||||
const onWindowResize = (e: MouseEvent) => {
|
const onWindowResize = (e: MouseEvent) => {
|
||||||
|
if (!queryEditor.value) return;
|
||||||
const el = queryEditor.value.$el;
|
const el = queryEditor.value.$el;
|
||||||
const queryFooterHeight = queryAreaFooter.value.clientHeight;
|
const queryFooterHeight = queryAreaFooter.value.clientHeight;
|
||||||
const bottom = e.pageY || resizer.value.getBoundingClientRect().bottom;
|
const bottom = e.pageY || resizer.value.getBoundingClientRect().bottom;
|
||||||
@@ -386,7 +394,7 @@ const onWindowResize = (e: MouseEvent) => {
|
|||||||
const stopResize = () => {
|
const stopResize = () => {
|
||||||
window.removeEventListener('mousemove', resize);
|
window.removeEventListener('mousemove', resize);
|
||||||
if (queryTable.value && results.value.length)
|
if (queryTable.value && results.value.length)
|
||||||
queryTable.value.resizeResults();
|
resizeResults();
|
||||||
|
|
||||||
if (queryEditor.value)
|
if (queryEditor.value)
|
||||||
queryEditor.value.editor.resize();
|
queryEditor.value.editor.resize();
|
||||||
@@ -476,6 +484,8 @@ const rollbackTab = async () => {
|
|||||||
isQuering.value = false;
|
isQuering.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defineExpose({ resizeResults });
|
||||||
|
|
||||||
query.value = props.tab.content as string;
|
query.value = props.tab.content as string;
|
||||||
selectedSchema.value = props.tab.schema || breadcrumbsSchema.value;
|
selectedSchema.value = props.tab.schema || breadcrumbsSchema.value;
|
||||||
|
|
||||||
|
@@ -118,13 +118,14 @@ import { storeToRefs } from 'pinia';
|
|||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import { useSettingsStore } from '@/stores/settings';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { arrayToFile } from '../libs/arrayToFile';
|
import { arrayToFile } from '../libs/arrayToFile';
|
||||||
import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll.vue';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll.vue';
|
||||||
import WorkspaceTabQueryTableRow from '@/components/WorkspaceTabQueryTableRow.vue';
|
import WorkspaceTabQueryTableRow from '@/components/WorkspaceTabQueryTableRow.vue';
|
||||||
import TableContext from '@/components/WorkspaceTabQueryTableContext.vue';
|
import TableContext from '@/components/WorkspaceTabQueryTableContext.vue';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal.vue';
|
import ConfirmModal from '@/components/BaseConfirmModal.vue';
|
||||||
import moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { TableField, QueryResult } from 'common/interfaces/antares';
|
import { TableField, QueryResult } from 'common/interfaces/antares';
|
||||||
import { TableUpdateParams } from 'common/interfaces/tableApis';
|
import { TableUpdateParams } from 'common/interfaces/tableApis';
|
||||||
@@ -132,10 +133,13 @@ import { TableUpdateParams } from 'common/interfaces/tableApis';
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
|
const consoleStore = useConsoleStore();
|
||||||
const { getWorkspace } = useWorkspacesStore();
|
const { getWorkspace } = useWorkspacesStore();
|
||||||
|
|
||||||
const { dataTabLimit: pageSize } = storeToRefs(settingsStore);
|
const { dataTabLimit: pageSize } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
const { consoleHeight } = storeToRefs(consoleStore);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
results: Array as Prop<QueryResult[]>,
|
results: Array as Prop<QueryResult[]>,
|
||||||
connUid: String,
|
connUid: String,
|
||||||
@@ -272,6 +276,8 @@ const getSchema = (index: number) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPrimaryValue = (row: any) => {
|
const getPrimaryValue = (row: any) => {
|
||||||
|
if (!primaryField.value) return null;
|
||||||
|
|
||||||
const primaryFieldName = Object.keys(row).find(prop => [
|
const primaryFieldName = Object.keys(row).find(prop => [
|
||||||
primaryField.value.alias,
|
primaryField.value.alias,
|
||||||
primaryField.value.name,
|
primaryField.value.name,
|
||||||
@@ -296,8 +302,13 @@ const resizeResults = () => {
|
|||||||
const el = tableWrapper.value;
|
const el = tableWrapper.value;
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
|
let sizeToSubtract = 0;
|
||||||
const footer = document.getElementById('footer');
|
const footer = document.getElementById('footer');
|
||||||
const size = window.innerHeight - el.getBoundingClientRect().top - footer.offsetHeight;
|
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||||
|
|
||||||
|
sizeToSubtract += consoleHeight.value;
|
||||||
|
|
||||||
|
const size = window.innerHeight - el.getBoundingClientRect().top - sizeToSubtract;
|
||||||
resultsSize.value = size;
|
resultsSize.value = size;
|
||||||
}
|
}
|
||||||
resultTable.value.updateWindow();
|
resultTable.value.updateWindow();
|
||||||
@@ -321,7 +332,7 @@ const updateField = (payload: { field: string; type: string; content: any }, row
|
|||||||
});
|
});
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
primary: primaryField.value.name,
|
primary: primaryField.value?.name,
|
||||||
schema: getSchema(resultsetIndex.value),
|
schema: getSchema(resultsetIndex.value),
|
||||||
table: getTable(resultsetIndex.value),
|
table: getTable(resultsetIndex.value),
|
||||||
id: getPrimaryValue(orgRow),
|
id: getPrimaryValue(orgRow),
|
||||||
@@ -662,6 +673,10 @@ watch(() => props.isSelected, async (val) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(consoleHeight, () => {
|
||||||
|
resizeResults();
|
||||||
|
});
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
if (table.value)
|
if (table.value)
|
||||||
refreshScroller();
|
refreshScroller();
|
||||||
|
@@ -194,9 +194,9 @@
|
|||||||
import { computed, onBeforeUnmount, Prop, ref, Ref, watch, nextTick } from 'vue';
|
import { computed, onBeforeUnmount, Prop, ref, Ref, watch, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { ModelOperations } from '@vscode/vscode-languagedetection';
|
|
||||||
import { mimeFromHex } from 'common/libs/mimeFromHex';
|
import { mimeFromHex } from 'common/libs/mimeFromHex';
|
||||||
import { formatBytes } from 'common/libs/formatBytes';
|
import { formatBytes } from 'common/libs/formatBytes';
|
||||||
|
import { langDetector } from 'common/libs/langDetector';
|
||||||
import { bufferToBase64 } from 'common/libs/bufferToBase64';
|
import { bufferToBase64 } from 'common/libs/bufferToBase64';
|
||||||
import hexToBinary, { HexChar } from 'common/libs/hexToBinary';
|
import hexToBinary, { HexChar } from 'common/libs/hexToBinary';
|
||||||
import {
|
import {
|
||||||
@@ -604,19 +604,8 @@ watch(() => props.fields, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(isTextareaEditor, (val) => {
|
watch(isTextareaEditor, (val) => {
|
||||||
if (val) {
|
if (val)
|
||||||
const modelOperations = new ModelOperations();
|
editorMode.value = langDetector(editingContent.value);
|
||||||
(async () => {
|
|
||||||
const detected = await modelOperations.runModel(editingContent.value);
|
|
||||||
const filteredLanguages = detected.filter(dLang =>
|
|
||||||
availableLanguages.value.some(aLang => aLang.id === dLang.languageId) &&
|
|
||||||
dLang.confidence > 0.1
|
|
||||||
);
|
|
||||||
|
|
||||||
if (filteredLanguages.length)
|
|
||||||
editorMode.value = availableLanguages.value.find(lang => lang.id === filteredLanguages[0].languageId).slug;
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => props.selected, (isSelected) => {
|
watch(() => props.selected, (isSelected) => {
|
||||||
|
@@ -412,6 +412,8 @@ watch(() => props.schema, () => {
|
|||||||
watch(() => props.table, () => {
|
watch(() => props.table, () => {
|
||||||
if (props.isSelected) {
|
if (props.isSelected) {
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
|
filters.value = [];
|
||||||
|
isSearch.value = false;
|
||||||
approximateCount.value = 0;
|
approximateCount.value = 0;
|
||||||
sortParams.value = {} as { field: string; dir: 'asc' | 'desc'};
|
sortParams.value = {} as { field: string; dir: 'asc' | 'desc'};
|
||||||
getTableData();
|
getTableData();
|
||||||
|
@@ -141,7 +141,8 @@ module.exports = {
|
|||||||
connectionString: 'Connection string',
|
connectionString: 'Connection string',
|
||||||
contributors: 'Contributors',
|
contributors: 'Contributors',
|
||||||
pin: 'Pin',
|
pin: 'Pin',
|
||||||
unpin: 'Unpin'
|
unpin: 'Unpin',
|
||||||
|
console: 'Console'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
appWelcome: 'Welcome to Antares SQL Client!',
|
appWelcome: 'Welcome to Antares SQL Client!',
|
||||||
@@ -296,7 +297,8 @@ module.exports = {
|
|||||||
disableFKChecks: 'Disable foreigh key checks',
|
disableFKChecks: 'Disable foreigh key checks',
|
||||||
allConnections: 'All connections',
|
allConnections: 'All connections',
|
||||||
searchForConnections: 'Search for connections',
|
searchForConnections: 'Search for connections',
|
||||||
disableScratchpad: 'Disable scratchpad'
|
disableScratchpad: 'Disable scratchpad',
|
||||||
|
reportABug: 'Report a bug'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: 'Address',
|
address: 'Address',
|
||||||
|
@@ -51,12 +51,12 @@ module.exports = {
|
|||||||
unsigned: '无符号',
|
unsigned: '无符号',
|
||||||
default: '默认',
|
default: '默认',
|
||||||
comment: '注释',
|
comment: '注释',
|
||||||
key: '键',
|
key: 'Key | Keys',
|
||||||
order: 'Order',
|
order: 'Order',
|
||||||
expression: '表达式',
|
expression: '表达式',
|
||||||
autoIncrement: '自动增量',
|
autoIncrement: '自动增量',
|
||||||
engine: 'Engine',
|
engine: 'Engine',
|
||||||
field: '字段',
|
field: 'Field | 字段',
|
||||||
approximately: '大约',
|
approximately: '大约',
|
||||||
total: '总计',
|
total: '总计',
|
||||||
table: '表',
|
table: '表',
|
||||||
@@ -71,15 +71,16 @@ module.exports = {
|
|||||||
view: '视图',
|
view: '视图',
|
||||||
definer: '定义者',
|
definer: '定义者',
|
||||||
algorithm: 'Algorithm',
|
algorithm: 'Algorithm',
|
||||||
trigger: '触发器',
|
trigger: 'Trigger | 触发器',
|
||||||
storedRoutine: '存储例程',
|
storedRoutine: 'Stored routine | 存储例程',
|
||||||
scheduler: '调度器',
|
scheduler: 'Scheduler | 调度器',
|
||||||
event: '事件',
|
event: '事件',
|
||||||
parameters: '参数',
|
parameters: '参数',
|
||||||
function: '函数',
|
function: 'Function | 函数',
|
||||||
deterministic: 'Deterministic',
|
deterministic: 'Deterministic',
|
||||||
context: '上下文',
|
context: '上下文',
|
||||||
export: '导出',
|
export: '导出',
|
||||||
|
import: '导入',
|
||||||
returns: '返回',
|
returns: '返回',
|
||||||
timing: '定时器',
|
timing: '定时器',
|
||||||
state: '状态',
|
state: '状态',
|
||||||
@@ -111,9 +112,9 @@ module.exports = {
|
|||||||
small: '小',
|
small: '小',
|
||||||
medium: '中',
|
medium: '中',
|
||||||
large: '大',
|
large: '大',
|
||||||
row: '行',
|
row: 'Row | 行',
|
||||||
cell: '单元格',
|
cell: 'Cell | 单元格',
|
||||||
triggerFunction: '触发函数',
|
triggerFunction: 'Trigger function | 触发函数',
|
||||||
all: '全部',
|
all: '全部',
|
||||||
duplicate: '重复',
|
duplicate: '重复',
|
||||||
routine: '例程',
|
routine: '例程',
|
||||||
@@ -122,9 +123,25 @@ module.exports = {
|
|||||||
select: '选择',
|
select: '选择',
|
||||||
passphrase: '密码',
|
passphrase: '密码',
|
||||||
filter: '过滤器',
|
filter: '过滤器',
|
||||||
|
change: '变更',
|
||||||
|
views: '视图',
|
||||||
|
triggers: '触发器',
|
||||||
|
routines: '例程',
|
||||||
|
functions: '函数',
|
||||||
|
schedulers: '调度器',
|
||||||
|
includes: '包括',
|
||||||
|
drop: '按下([使]掉下)',
|
||||||
|
completed: '完成',
|
||||||
|
aborted: '中止',
|
||||||
disabled: '禁用',
|
disabled: '禁用',
|
||||||
enable: '启用',
|
enable: '启用',
|
||||||
disable: '是否禁用'
|
disable: '是否禁用',
|
||||||
|
commit: '提交',
|
||||||
|
rollback: '回滚',
|
||||||
|
connectionString: '连接字符串',
|
||||||
|
contributors: '贡献者',
|
||||||
|
pin: 'Pin',
|
||||||
|
unpin: 'Unpin'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
appWelcome: '欢迎来到Antares SQL Client!',
|
appWelcome: '欢迎来到Antares SQL Client!',
|
||||||
@@ -250,9 +267,36 @@ module.exports = {
|
|||||||
searchForQueries: '搜索查询',
|
searchForQueries: '搜索查询',
|
||||||
killProcess: '杀死进程',
|
killProcess: '杀死进程',
|
||||||
closeTab: '关闭标签',
|
closeTab: '关闭标签',
|
||||||
|
exportSchema: '导出 schema',
|
||||||
|
importSchema: '导入 schema',
|
||||||
|
directoryPath: '目录路径',
|
||||||
|
newInserStmtEvery: '新的 INSERT 语句每个',
|
||||||
|
processingTableExport: '处理 {table}',
|
||||||
|
fechingTableExport: '正在从 {table} 获取数据中',
|
||||||
|
writingTableExport: '正在将 {table} 数据写入中',
|
||||||
|
checkAllTables: '检查所有表格',
|
||||||
|
uncheckAllTables: '取消选中所有表格',
|
||||||
goToDownloadPage: '跳转到下载页面',
|
goToDownloadPage: '跳转到下载页面',
|
||||||
readOnlyMode: '只读模式',
|
readOnlyMode: '只读模式',
|
||||||
killQuery: '停止查询'
|
killQuery: '停止查询',
|
||||||
|
insertRow: '插入行 | 插入多行',
|
||||||
|
commitMode: '提交模式',
|
||||||
|
autoCommit: '自动提交',
|
||||||
|
manualCommit: '手动提交',
|
||||||
|
actionSuccessful: '{action} 成功',
|
||||||
|
importQueryErrors: '警告: {n} 错误已发生 | 警告: 发生 {n} 个错误',
|
||||||
|
executedQueries: '{n} 个查询已执行 | {n} 个查询已执行',
|
||||||
|
ourputFormat: '输出格式',
|
||||||
|
singleFile: '单个 {ext} 文件',
|
||||||
|
zipCompressedFile: 'ZIP 压缩 {ext} 文件',
|
||||||
|
disableBlur: '禁用模糊',
|
||||||
|
untrustedConnection: '不受信任的连接',
|
||||||
|
missingOrIncompleteTranslation: '翻译缺失或不完整?',
|
||||||
|
findOutHowToContribute: '找出如何贡献',
|
||||||
|
disableFKChecks: '禁用外键检查',
|
||||||
|
allConnections: '所有连接',
|
||||||
|
searchForConnections: '搜索连接',
|
||||||
|
disableScratchpad: '禁用暂存器'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: '地址',
|
address: '地址',
|
||||||
@@ -262,8 +306,8 @@ module.exports = {
|
|||||||
date: '日期',
|
date: '日期',
|
||||||
finance: '财务',
|
finance: '财务',
|
||||||
git: 'Git',
|
git: 'Git',
|
||||||
hacker: '黑客',
|
hacker: 'Hacker',
|
||||||
internet: '互联网',
|
internet: 'Internet',
|
||||||
lorem: 'Lorem',
|
lorem: 'Lorem',
|
||||||
name: '姓名',
|
name: '姓名',
|
||||||
music: '音乐',
|
music: '音乐',
|
||||||
|
@@ -10,6 +10,7 @@ import { VueMaskDirective } from 'v-mask';
|
|||||||
import { useApplicationStore } from '@/stores/application';
|
import { useApplicationStore } from '@/stores/application';
|
||||||
import { useSettingsStore } from '@/stores/settings';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
import { useConsoleStore } from '@/stores/console';
|
||||||
|
|
||||||
import App from '@/App.vue';
|
import App from '@/App.vue';
|
||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
@@ -36,6 +37,11 @@ ipcRenderer.on('unhandled-exception', (event, error) => {
|
|||||||
useNotificationsStore().addNotification({ status: 'error', message: error.message });
|
useNotificationsStore().addNotification({ status: 'error', message: error.message });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// IPC query logs
|
||||||
|
ipcRenderer.on('query-log', (event, logRecord) => {
|
||||||
|
useConsoleStore().putLog(logRecord);
|
||||||
|
});
|
||||||
|
|
||||||
// IPC app updates
|
// IPC app updates
|
||||||
ipcRenderer.on('checking-for-update', () => {
|
ipcRenderer.on('checking-for-update', () => {
|
||||||
useApplicationStore().updateStatus = 'checking';
|
useApplicationStore().updateStatus = 'checking';
|
||||||
|
@@ -264,6 +264,12 @@ option:checked {
|
|||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tooltip:hover {
|
||||||
|
&::after {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.badge {
|
.badge {
|
||||||
&[data-badge],
|
&[data-badge],
|
||||||
&:not([data-badge]) {
|
&:not([data-badge]) {
|
||||||
|
@@ -305,6 +305,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.query-console {
|
||||||
|
border-top: 1px solid #444;
|
||||||
|
background-color: $bg-color-dark;
|
||||||
|
|
||||||
|
.query-console-log {
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
background: $bg-color-gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tile {
|
.tile {
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
|
|
||||||
|
@@ -128,6 +128,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.query-console {
|
||||||
|
border-top: 1px solid darken($bg-color-light-gray, 15%);
|
||||||
|
background-color: $bg-color-light;
|
||||||
|
|
||||||
|
.query-console-log {
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
background: $bg-color-light-gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#titlebar {
|
#titlebar {
|
||||||
background: $bg-color-light;
|
background: $bg-color-light;
|
||||||
box-shadow: 0 0 1px 0 #000;
|
box-shadow: 0 0 1px 0 #000;
|
||||||
@@ -222,6 +234,10 @@
|
|||||||
|
|
||||||
.table-size {
|
.table-size {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
63
src/renderer/stores/console.ts
Normal file
63
src/renderer/stores/console.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import { ipcRenderer } from 'electron';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { useWorkspacesStore } from './workspaces';
|
||||||
|
const logsSize = 1000;
|
||||||
|
|
||||||
|
export interface ConsoleRecord {
|
||||||
|
cUid: string;
|
||||||
|
sql: string;
|
||||||
|
date: Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useConsoleStore = defineStore('console', {
|
||||||
|
state: () => ({
|
||||||
|
records: [] as ConsoleRecord[],
|
||||||
|
consolesHeight: new Map<string, number>(),
|
||||||
|
consolesOpened: new Set([])
|
||||||
|
}),
|
||||||
|
getters: {
|
||||||
|
getLogsByWorkspace: state => (uid: string) => state.records.filter(r => r.cUid === uid),
|
||||||
|
isConsoleOpen: state => (uid: string) => state.consolesOpened.has(uid),
|
||||||
|
consoleHeight: state => {
|
||||||
|
const uid = useWorkspacesStore().getSelected;
|
||||||
|
return state.consolesHeight.get(uid) || 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
putLog (record: ConsoleRecord) {
|
||||||
|
this.records.push(record);
|
||||||
|
|
||||||
|
if (this.records.length > logsSize)
|
||||||
|
this.records = this.records.slice(0, logsSize);
|
||||||
|
},
|
||||||
|
openConsole () {
|
||||||
|
const uid = useWorkspacesStore().getSelected;
|
||||||
|
this.consolesOpened.add(uid);
|
||||||
|
this.consolesHeight.set(uid, 250);
|
||||||
|
},
|
||||||
|
closeConsole () {
|
||||||
|
const uid = useWorkspacesStore().getSelected;
|
||||||
|
this.consolesOpened.delete(uid);
|
||||||
|
this.consolesHeight.set(uid, 0);
|
||||||
|
},
|
||||||
|
resizeConsole (height: number) {
|
||||||
|
const uid = useWorkspacesStore().getSelected;
|
||||||
|
if (height < 30)
|
||||||
|
this.closeConsole();
|
||||||
|
else
|
||||||
|
this.consolesHeight.set(uid, height);
|
||||||
|
},
|
||||||
|
toggleConsole () {
|
||||||
|
const uid = useWorkspacesStore().getSelected;
|
||||||
|
|
||||||
|
if (this.consolesOpened.has(uid))
|
||||||
|
this.closeConsole();
|
||||||
|
else
|
||||||
|
this.openConsole();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('toggle-console', () => {
|
||||||
|
useConsoleStore().toggleConsole();
|
||||||
|
});
|
@@ -100,6 +100,15 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
|||||||
getSelected: state => {
|
getSelected: state => {
|
||||||
if (!state.workspaces.length) return 'NEW';
|
if (!state.workspaces.length) return 'NEW';
|
||||||
if (state.selectedWorkspace) return state.selectedWorkspace;
|
if (state.selectedWorkspace) return state.selectedWorkspace;
|
||||||
|
const connectionsStore = useConnectionsStore();
|
||||||
|
if (connectionsStore.lastConnections.length) {
|
||||||
|
return connectionsStore.lastConnections.sort((a, b) => {
|
||||||
|
if (a.time < b.time) return 1;
|
||||||
|
else if (a.time > b.time) return -1;
|
||||||
|
return 0;
|
||||||
|
})[0].uid;
|
||||||
|
}
|
||||||
|
|
||||||
return state.workspaces[0].uid;
|
return state.workspaces[0].uid;
|
||||||
},
|
},
|
||||||
getWorkspace: state => (uid: string) => {
|
getWorkspace: state => (uid: string) => {
|
||||||
|
@@ -23,8 +23,8 @@ test('main window elements visibility', async () => {
|
|||||||
const visibleSelectors = [
|
const visibleSelectors = [
|
||||||
// '#titlebar',
|
// '#titlebar',
|
||||||
'#window-content',
|
'#window-content',
|
||||||
'#settingbar',
|
'#settingbar'
|
||||||
'#footer'
|
// '#footer'
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const selector of visibleSelectors)
|
for (const selector of visibleSelectors)
|
||||||
|
Reference in New Issue
Block a user