mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
d8a298fd20 | |||
369622d5af | |||
a40d722d7c | |||
440f74dfc1 | |||
8621ca5333 | |||
24edc82b1b | |||
0a2124f2c2 | |||
a8521317a5 | |||
88408da745 | |||
d52b7af297 | |||
e4a4696dd3 | |||
f0255c0065 | |||
9991173685 | |||
|
874dc6298b | ||
5b1b8cf4cc | |||
a521274d01 | |||
86e4c1d58f | |||
ba5a1b68ab | |||
2c45bce1ee | |||
|
2e05fa4bdc | ||
dd9c089d27 | |||
e6955550fa | |||
fe39c1d388 | |||
d114f8a651 | |||
84168d1d75 | |||
498a9b48e2 | |||
01f607cd40 | |||
efe134a059 | |||
40cb4dd98d | |||
a142d3c4d7 | |||
89da957a49 | |||
05c2f9836c | |||
ebc325ae0c | |||
39326eb52e | |||
df681147aa | |||
ffc645ba5e | |||
1fb1205319 | |||
c90ab0e880 | |||
9dc700e13e |
31
.github/workflows/create-artifact-macos.yml
vendored
Normal file
31
.github/workflows/create-artifact-macos.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Create artifact [MAC]
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
|
||||||
|
- name: npm install & build
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macos-build
|
||||||
|
retention-days: 3
|
||||||
|
path: |
|
||||||
|
build
|
||||||
|
!build/*-unpacked
|
||||||
|
!build/.icon-ico
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -5,7 +5,6 @@
|
|||||||
"name": "Electron: Main",
|
"name": "Electron: Main",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"port": 9222,
|
"port": 9222,
|
||||||
"protocol": "inspector",
|
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"type": "node",
|
"type": "node",
|
||||||
@@ -23,7 +22,6 @@
|
|||||||
"name": "Electron: Worker",
|
"name": "Electron: Worker",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"port": 9224,
|
"port": 9224,
|
||||||
"protocol": "inspector",
|
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"type": "node",
|
"type": "node",
|
||||||
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -7,7 +7,8 @@
|
|||||||
"SQLite",
|
"SQLite",
|
||||||
"Windows",
|
"Windows",
|
||||||
"translation",
|
"translation",
|
||||||
"Linux"
|
"Linux",
|
||||||
|
"MacOS"
|
||||||
],
|
],
|
||||||
"svg.preview.background": "transparent"
|
"svg.preview.background": "transparent"
|
||||||
}
|
}
|
57
CHANGELOG.md
57
CHANGELOG.md
@@ -2,6 +2,63 @@
|
|||||||
|
|
||||||
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.19](https://github.com/antares-sql/antares/compare/v0.5.18...v0.5.19) (2022-10-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* context menu option to fill cell with random values ([0a2124f](https://github.com/antares-sql/antares/commit/0a2124f2c2bdadc7c753db11d1e29f8acb9ddcac))
|
||||||
|
* uuid fill for string cells ([24edc82](https://github.com/antares-sql/antares/commit/24edc82b1be7299a09df18611b2a0ba361a6b46f))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* app stuck inserting a random value if field length high ([440f74d](https://github.com/antares-sql/antares/commit/440f74dfc1f4942ba585b9bdae7517fe6ab04a81))
|
||||||
|
* error joining tables with different schema ([88408da](https://github.com/antares-sql/antares/commit/88408da745e45c70de977bc4270e5f61825be65f))
|
||||||
|
* **SQLite:** save boolean as integer to improve compativility, fixes [#463](https://github.com/antares-sql/antares/issues/463) ([d52b7af](https://github.com/antares-sql/antares/commit/d52b7af2978bc8beafd2d22078c72abb62e9e532))
|
||||||
|
* unable to edit text fields if value is NULL, fixes [#466](https://github.com/antares-sql/antares/issues/466) ([8621ca5](https://github.com/antares-sql/antares/commit/8621ca5333b5c51dc7a2ea1fcc0c5ec7f752a00a))
|
||||||
|
|
||||||
|
### [0.5.18](https://github.com/antares-sql/antares/compare/v0.5.17...v0.5.18) (2022-10-14)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **PostgreSQL:** UUID random generation option on UUID fields, closes [#424](https://github.com/antares-sql/antares/issues/424) ([a521274](https://github.com/antares-sql/antares/commit/a521274d01031c1411bbbb136369802d43368089))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* auto-scroll on sidebar not working, fixes [#447](https://github.com/antares-sql/antares/issues/447) ([dd9c089](https://github.com/antares-sql/antares/commit/dd9c089d27c61ab76d49887c7de2849cbb6e88a6))
|
||||||
|
* trackpad horizontal scroll on tabs not working properly ([ba5a1b6](https://github.com/antares-sql/antares/commit/ba5a1b68ab2d56777a5c94eede26e9bded5819e6))
|
||||||
|
|
||||||
|
### [0.5.17](https://github.com/antares-sql/antares/compare/v0.5.16...v0.5.17) (2022-09-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* added more editor font sizes, closes [#440](https://github.com/antares-sql/antares/issues/440) ([d114f8a](https://github.com/antares-sql/antares/commit/d114f8a65164f702b23175095e6fc2b021e0e038))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* "run or reload" shortcut triggers on all connections open ([01f607c](https://github.com/antares-sql/antares/commit/01f607cd40c18ab0f9761b2a05705a966aaae43a))
|
||||||
|
* cant run procedures with parameters from leftbar ([efe134a](https://github.com/antares-sql/antares/commit/efe134a059700ca87333dc6e66166d6ec8d289e8))
|
||||||
|
* editor font size doesn't change on new tabs, fixes [#442](https://github.com/antares-sql/antares/issues/442) ([84168d1](https://github.com/antares-sql/antares/commit/84168d1d75460acc2c844bfece7d85f0c977e74c))
|
||||||
|
* empty definer when editing a view, fixes [#437](https://github.com/antares-sql/antares/issues/437) ([498a9b4](https://github.com/antares-sql/antares/commit/498a9b48e25ee061960f5f649c953cdaf6ff1a58))
|
||||||
|
* **MacOS:** empty options on macos menubar ([a142d3c](https://github.com/antares-sql/antares/commit/a142d3c4d77e31375dfbea148eec54ce1f635192))
|
||||||
|
|
||||||
|
### [0.5.16](https://github.com/antares-sql/antares/compare/v0.5.15...v0.5.16) (2022-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* CTRL+Right/Left not working on text editor, closes [#427](https://github.com/antares-sql/antares/issues/427) ([ffc645b](https://github.com/antares-sql/antares/commit/ffc645ba5efb1c52670096e4f8c7f992b7335dae))
|
||||||
|
* issue updating datetime cells with null value, closes [#423](https://github.com/antares-sql/antares/issues/423) ([ebc325a](https://github.com/antares-sql/antares/commit/ebc325ae0c656dca2eb8f7544ab271beaee9b47e))
|
||||||
|
* ts exceptions ([df68114](https://github.com/antares-sql/antares/commit/df681147aaf0bfca69f3ffdc474cc1846541b1d8))
|
||||||
|
* **UI:** editor themes group not visible in select element ([9dc700e](https://github.com/antares-sql/antares/commit/9dc700e13ea65bb8c6feac4ff4ffeadd32053614))
|
||||||
|
* **UI:** wrong position of fields resizable area ([c90ab0e](https://github.com/antares-sql/antares/commit/c90ab0e8807ff30a9ab58e9aa3515cf427dd6e86))
|
||||||
|
* unable to set null or delete rows without primary key ([39326eb](https://github.com/antares-sql/antares/commit/39326eb52e038728b5419d4a8de8024c7ead3002))
|
||||||
|
|
||||||
### [0.5.15](https://github.com/antares-sql/antares/compare/v0.5.14...v0.5.15) (2022-08-17)
|
### [0.5.15](https://github.com/antares-sql/antares/compare/v0.5.14...v0.5.15) (2022-08-17)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ We are actively working on it, hoping to provide new cool features, improvements
|
|||||||
- SSH tunnel support.
|
- SSH tunnel support.
|
||||||
- Manual commit mode.
|
- Manual commit mode.
|
||||||
- Import and export database dumps.
|
- Import and export database dumps.
|
||||||
|
- Customizable keyboard shortcuts.
|
||||||
- Dark and light theme.
|
- Dark and light theme.
|
||||||
- Editor themes.
|
- Editor themes.
|
||||||
|
|
||||||
|
4453
package-lock.json
generated
4453
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "antares",
|
"name": "antares",
|
||||||
"productName": "Antares",
|
"productName": "Antares",
|
||||||
"version": "0.5.15",
|
"version": "0.5.19",
|
||||||
"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",
|
||||||
@@ -132,21 +132,21 @@
|
|||||||
"electron-window-state": "~5.0.3",
|
"electron-window-state": "~5.0.3",
|
||||||
"encoding": "~0.1.13",
|
"encoding": "~0.1.13",
|
||||||
"leaflet": "~1.7.1",
|
"leaflet": "~1.7.1",
|
||||||
"marked": "~4.0.0",
|
"marked": "~4.0.19",
|
||||||
"moment": "~2.29.4",
|
"moment": "~2.29.4",
|
||||||
"mysql2": "~2.3.2",
|
"mysql2": "~2.3.2",
|
||||||
"pg": "~8.7.1",
|
"pg": "~8.7.1",
|
||||||
"pg-connection-string": "~2.5.0",
|
"pg-connection-string": "~2.5.0",
|
||||||
"pg-query-stream": "~4.2.3",
|
"pg-query-stream": "~4.2.3",
|
||||||
"pgsql-ast-parser": "~7.2.1",
|
"pgsql-ast-parser": "~7.2.1",
|
||||||
"pinia": "~2.0.13",
|
"pinia": "~2.0.23",
|
||||||
"source-map-support": "~0.5.20",
|
"source-map-support": "~0.5.20",
|
||||||
"spectre.css": "~0.5.9",
|
"spectre.css": "~0.5.9",
|
||||||
"sql-formatter": "~8.2.0",
|
"sql-formatter": "~11.0.2",
|
||||||
"ssh2-promise": "~1.0.2",
|
"ssh2-promise": "~1.0.2",
|
||||||
"v-mask": "~2.3.0",
|
"v-mask": "~2.3.0",
|
||||||
"vue": "~3.2.37",
|
"vue": "~3.2.40",
|
||||||
"vue-i18n": "~9.2.0",
|
"vue-i18n": "~9.2.2",
|
||||||
"vuedraggable": "~4.1.0"
|
"vuedraggable": "~4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
"@playwright/test": "~1.21.1",
|
"@playwright/test": "~1.21.1",
|
||||||
"@types/better-sqlite3": "~7.5.0",
|
"@types/better-sqlite3": "~7.5.0",
|
||||||
"@types/leaflet": "~1.7.9",
|
"@types/leaflet": "~1.7.9",
|
||||||
"@types/marked": "~4.0.3",
|
"@types/marked": "~4.0.7",
|
||||||
"@types/node": "~17.0.23",
|
"@types/node": "~17.0.23",
|
||||||
"@types/pg": "~8.6.5",
|
"@types/pg": "~8.6.5",
|
||||||
"@typescript-eslint/eslint-plugin": "~5.18.0",
|
"@typescript-eslint/eslint-plugin": "~5.18.0",
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
"chalk": "~4.1.2",
|
"chalk": "~4.1.2",
|
||||||
"cross-env": "~7.0.2",
|
"cross-env": "~7.0.2",
|
||||||
"css-loader": "~6.5.0",
|
"css-loader": "~6.5.0",
|
||||||
"electron": "~19.0.5",
|
"electron": "~19.1.2",
|
||||||
"electron-builder": "~23.0.3",
|
"electron-builder": "~23.0.3",
|
||||||
"eslint": "~7.32.0",
|
"eslint": "~7.32.0",
|
||||||
"eslint-config-standard": "~16.0.3",
|
"eslint-config-standard": "~16.0.3",
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
// @ts-check
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-nocheck
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
|
@@ -140,7 +140,7 @@ export default class {
|
|||||||
{ name: 'arrayElement', group: 'random', types: ['string'] },
|
{ name: 'arrayElement', group: 'random', types: ['string'] },
|
||||||
{ name: 'arrayElements', group: 'random', types: ['string'] },
|
{ name: 'arrayElements', group: 'random', types: ['string'] },
|
||||||
{ name: 'objectElement', group: 'random', types: ['string'] },
|
{ name: 'objectElement', group: 'random', types: ['string'] },
|
||||||
{ name: 'uuid', group: 'random', types: ['string'] },
|
{ name: 'uuid', group: 'random', types: ['string', 'uuid'] },
|
||||||
{ name: 'boolean', group: 'random', types: ['string'] },
|
{ name: 'boolean', group: 'random', types: ['string'] },
|
||||||
{ name: 'word', group: 'random', types: ['string'] },
|
{ name: 'word', group: 'random', types: ['string'] },
|
||||||
{ name: 'words', group: 'random', types: ['string'] },
|
{ name: 'words', group: 'random', types: ['string'] },
|
||||||
|
@@ -29,7 +29,6 @@ export const NUMBER = [
|
|||||||
'SMALLINT',
|
'SMALLINT',
|
||||||
'MEDIUMINT',
|
'MEDIUMINT',
|
||||||
'BIGINT',
|
'BIGINT',
|
||||||
'DECIMAL',
|
|
||||||
'NUMERIC',
|
'NUMERIC',
|
||||||
'INTEGER',
|
'INTEGER',
|
||||||
'SMALLSERIAL',
|
'SMALLSERIAL',
|
||||||
@@ -78,6 +77,7 @@ export const BLOB = [
|
|||||||
'TINYBLOB',
|
'TINYBLOB',
|
||||||
'MEDIUMBLOB',
|
'MEDIUMBLOB',
|
||||||
'LONGBLOB',
|
'LONGBLOB',
|
||||||
|
'LONG_BLOB',
|
||||||
'BYTEA'
|
'BYTEA'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -86,6 +86,14 @@ export const BIT = [
|
|||||||
'BIT VARYING'
|
'BIT VARYING'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const BINARY = [
|
||||||
|
'BINARY'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const UUID = [
|
||||||
|
'UUID'
|
||||||
|
];
|
||||||
|
|
||||||
export const SPATIAL = [
|
export const SPATIAL = [
|
||||||
'POINT',
|
'POINT',
|
||||||
'LINESTRING',
|
'LINESTRING',
|
||||||
|
@@ -176,7 +176,7 @@ function isMD (str: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function langDetector (str: string) {
|
export function langDetector (str: string) {
|
||||||
if (!str.trim().length)
|
if (!str || !str.trim().length)
|
||||||
return 'text';
|
return 'text';
|
||||||
if (isJSON(str))
|
if (isJSON(str))
|
||||||
return 'json';
|
return 'json';
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { app, ipcMain, dialog, BrowserWindow } from 'electron';
|
import { app, ipcMain, dialog } from 'electron';
|
||||||
import { ShortcutRegister } from '../libs/ShortcutRegister';
|
import { ShortcutRegister } from '../libs/ShortcutRegister';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
@@ -15,26 +15,22 @@ export default () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('resotre-default-shortcuts', () => {
|
ipcMain.handle('resotre-default-shortcuts', () => {
|
||||||
const mainWindow = BrowserWindow.getAllWindows()[0];
|
const shortCutRegister = ShortcutRegister.getInstance();
|
||||||
const shortCutRegister = ShortcutRegister.getInstance({ mainWindow });
|
|
||||||
shortCutRegister.restoreDefaults();
|
shortCutRegister.restoreDefaults();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('reload-shortcuts', () => {
|
ipcMain.handle('reload-shortcuts', () => {
|
||||||
const mainWindow = BrowserWindow.getAllWindows()[0];
|
const shortCutRegister = ShortcutRegister.getInstance();
|
||||||
const shortCutRegister = ShortcutRegister.getInstance({ mainWindow });
|
|
||||||
shortCutRegister.reload();
|
shortCutRegister.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('update-shortcuts', (event, shortcuts) => {
|
ipcMain.handle('update-shortcuts', (event, shortcuts) => {
|
||||||
const mainWindow = BrowserWindow.getAllWindows()[0];
|
const shortCutRegister = ShortcutRegister.getInstance();
|
||||||
const shortCutRegister = ShortcutRegister.getInstance({ mainWindow });
|
|
||||||
shortCutRegister.updateShortcuts(shortcuts);
|
shortCutRegister.updateShortcuts(shortcuts);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('unregister-shortcuts', () => {
|
ipcMain.handle('unregister-shortcuts', () => {
|
||||||
const mainWindow = BrowserWindow.getAllWindows()[0];
|
const shortCutRegister = ShortcutRegister.getInstance();
|
||||||
const shortCutRegister = ShortcutRegister.getInstance({ mainWindow });
|
|
||||||
shortCutRegister.unregister();
|
shortCutRegister.unregister();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -5,7 +5,7 @@ import { ipcMain } from 'electron';
|
|||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { sqlEscaper } from 'common/libs/sqlUtils';
|
import { sqlEscaper } from 'common/libs/sqlUtils';
|
||||||
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME, BOOLEAN } from 'common/fieldTypes';
|
||||||
import customizations from 'common/customizations';
|
import customizations from 'common/customizations';
|
||||||
|
|
||||||
export default (connections: {[key: string]: antares.Client}) => {
|
export default (connections: {[key: string]: antares.Client}) => {
|
||||||
@@ -153,6 +153,18 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
escapedParam = `b'${sqlEscaper(params.content)}'`;
|
escapedParam = `b'${sqlEscaper(params.content)}'`;
|
||||||
reload = true;
|
reload = true;
|
||||||
}
|
}
|
||||||
|
else if (BOOLEAN.includes(params.type)) {
|
||||||
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = params.content;
|
||||||
|
break;
|
||||||
|
case 'sqlite':
|
||||||
|
escapedParam = Number(params.content === 'true');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (params.content === null)
|
else if (params.content === null)
|
||||||
escapedParam = 'NULL';
|
escapedParam = 'NULL';
|
||||||
else
|
else
|
||||||
@@ -177,6 +189,9 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
if (typeof orgRow[key] === 'string')
|
if (typeof orgRow[key] === 'string')
|
||||||
orgRow[key] = `'${orgRow[key]}'`;
|
orgRow[key] = `'${orgRow[key]}'`;
|
||||||
|
|
||||||
|
if (orgRow[key] === null)
|
||||||
|
orgRow[key] = `IS ${orgRow[key]}`;
|
||||||
|
else
|
||||||
orgRow[key] = `= ${orgRow[key]}`;
|
orgRow[key] = `= ${orgRow[key]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { BrowserWindow, globalShortcut } from 'electron';
|
import { BrowserWindow, globalShortcut, Menu, MenuItem, MenuItemConstructorOptions } from 'electron';
|
||||||
import * as Store from 'electron-store';
|
import * as Store from 'electron-store';
|
||||||
import { ShortcutRecord, shortcuts } from 'common/shortcuts';
|
import { ShortcutRecord, shortcuts } from 'common/shortcuts';
|
||||||
|
|
||||||
@@ -6,19 +6,34 @@ const shortcutsStore = new Store({ name: 'shortcuts' });
|
|||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
const defaultShortcuts = shortcuts.filter(s => s.os.includes(process.platform));
|
const defaultShortcuts = shortcuts.filter(s => s.os.includes(process.platform));
|
||||||
|
|
||||||
|
export type ShortcutMode = 'local' | 'global'
|
||||||
|
export type OsMenu = {
|
||||||
|
[key in NodeJS.Platform]?: MenuItemConstructorOptions[];
|
||||||
|
};
|
||||||
|
|
||||||
export class ShortcutRegister {
|
export class ShortcutRegister {
|
||||||
private _shortcuts: ShortcutRecord[];
|
private _shortcuts: ShortcutRecord[];
|
||||||
private _mainWindow: BrowserWindow;
|
private _mainWindow: BrowserWindow;
|
||||||
|
private _menu: Menu;
|
||||||
|
private _menuTemplate: OsMenu;
|
||||||
|
private _mode: ShortcutMode;
|
||||||
private static _instance: ShortcutRegister;
|
private static _instance: ShortcutRegister;
|
||||||
|
|
||||||
private constructor (args: { mainWindow: BrowserWindow }) {
|
private constructor (args: { mainWindow: BrowserWindow; menuTemplate?: OsMenu; mode: ShortcutMode }) {
|
||||||
this._mainWindow = args.mainWindow;
|
this._mainWindow = args.mainWindow;
|
||||||
|
this._menuTemplate = args.menuTemplate || {};
|
||||||
|
this._mode = args.mode;
|
||||||
this.shortcuts = shortcutsStore.get('shortcuts', defaultShortcuts) as ShortcutRecord[];
|
this.shortcuts = shortcutsStore.get('shortcuts', defaultShortcuts) as ShortcutRecord[];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getInstance (args: { mainWindow: BrowserWindow }) {
|
public static getInstance (args?: { mainWindow?: BrowserWindow; menuTemplate?: OsMenu; mode?: ShortcutMode }) {
|
||||||
if (!ShortcutRegister._instance)
|
if (!ShortcutRegister._instance && args.menuTemplate !== undefined && args.mode !== undefined) {
|
||||||
ShortcutRegister._instance = new ShortcutRegister(args);
|
ShortcutRegister._instance = new ShortcutRegister({
|
||||||
|
mainWindow: args.mainWindow,
|
||||||
|
menuTemplate: args.menuTemplate,
|
||||||
|
mode: args.mode
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return ShortcutRegister._instance;
|
return ShortcutRegister._instance;
|
||||||
}
|
}
|
||||||
@@ -33,24 +48,74 @@ export class ShortcutRegister {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init () {
|
init () {
|
||||||
|
this._mainWindow.webContents.send('update-shortcuts', this.shortcuts);
|
||||||
|
|
||||||
|
this.buildBaseMenu();
|
||||||
|
|
||||||
|
if (this._mode === 'global')
|
||||||
|
this.setGlobalShortcuts();
|
||||||
|
else if (this._mode === 'local')
|
||||||
|
this.setLocalShortcuts();
|
||||||
|
else
|
||||||
|
throw new Error(`Unknown mode "${this._mode}"`);
|
||||||
|
|
||||||
|
Menu.setApplicationMenu(this._menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildBaseMenu () {
|
||||||
|
if (Object.keys(this._menuTemplate).includes(process.platform))
|
||||||
|
this._menu = Menu.buildFromTemplate(this._menuTemplate[process.platform]);
|
||||||
|
else
|
||||||
|
this._menu = new Menu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private setLocalShortcuts () {
|
||||||
for (const shortcut of this.shortcuts) {
|
for (const shortcut of this.shortcuts) {
|
||||||
if (shortcut.os.includes(process.platform)) {
|
if (shortcut.os.includes(process.platform)) {
|
||||||
for (const key of shortcut.keys) {
|
for (const key of shortcut.keys) {
|
||||||
try {
|
try {
|
||||||
globalShortcut.register(key, () => {
|
this._menu.append(new MenuItem({
|
||||||
|
label: 'Shortcuts',
|
||||||
|
visible: false,
|
||||||
|
submenu: [{
|
||||||
|
label: String(key),
|
||||||
|
accelerator: key,
|
||||||
|
visible: false,
|
||||||
|
click: () => {
|
||||||
this._mainWindow.webContents.send(shortcut.event);
|
this._mainWindow.webContents.send(shortcut.event);
|
||||||
if (isDevelopment) console.log('EVENT:', shortcut);
|
if (isDevelopment) console.log('LOCAL EVENT:', shortcut);
|
||||||
});
|
}
|
||||||
|
}]
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
if (isDevelopment) console.log(error);
|
||||||
this.restoreDefaults();
|
this.restoreDefaults();
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._mainWindow.webContents.send('update-shortcuts', this.shortcuts);
|
private setGlobalShortcuts () {
|
||||||
|
for (const shortcut of this.shortcuts) {
|
||||||
|
if (shortcut.os.includes(process.platform)) {
|
||||||
|
for (const key of shortcut.keys) {
|
||||||
|
try {
|
||||||
|
globalShortcut.register(key, () => {
|
||||||
|
this._mainWindow.webContents.send(shortcut.event);
|
||||||
|
if (isDevelopment) console.log('GLOBAL EVENT:', shortcut);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (isDevelopment) console.log(error);
|
||||||
|
this.restoreDefaults();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reload () {
|
reload () {
|
||||||
@@ -69,6 +134,6 @@ export class ShortcutRegister {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unregister () {
|
unregister () {
|
||||||
globalShortcut.unregisterAll();
|
if (this._mode === 'global') globalShortcut.unregisterAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -469,7 +469,12 @@ export class MySQLClient extends AntaresCore {
|
|||||||
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
||||||
.run<TableColumnsResult>();
|
.run<TableColumnsResult>();
|
||||||
|
|
||||||
const { rows: fields } = await this.raw<antares.QueryResult<CreateTableResult>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
|
let fields: CreateTableResult[] = [];
|
||||||
|
try {
|
||||||
|
const { rows } = await this.raw<antares.QueryResult<CreateTableResult>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
|
||||||
|
fields = rows;
|
||||||
|
}
|
||||||
|
catch (_) {}
|
||||||
|
|
||||||
const remappedFields = fields.map(row => {
|
const remappedFields = fields.map(row => {
|
||||||
if (!row['Create Table']) return false;
|
if (!row['Create Table']) return false;
|
||||||
@@ -940,7 +945,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
algorithm: algorithm[0]['Create View'].match(/(?<=CREATE ALGORITHM=).*?(?=\s)/gs)[0],
|
algorithm: algorithm[0]['Create View'].match(/(?<=CREATE ALGORITHM=).*?(?=\s)/gs)[0],
|
||||||
definer: viewInfo[0].DEFINER,
|
definer: viewInfo[0].DEFINER.split('@').map((str: string) => `\`${str}\``).join('@'),
|
||||||
security: viewInfo[0].SECURITY_TYPE,
|
security: viewInfo[0].SECURITY_TYPE,
|
||||||
updateOption: viewInfo[0].CHECK_OPTION === 'NONE' ? '' : viewInfo[0].CHECK_OPTION,
|
updateOption: viewInfo[0].CHECK_OPTION === 'NONE' ? '' : viewInfo[0].CHECK_OPTION,
|
||||||
sql: viewInfo[0].VIEW_DEFINITION,
|
sql: viewInfo[0].VIEW_DEFINITION,
|
||||||
@@ -1588,7 +1593,8 @@ export class MySQLClient extends AntaresCore {
|
|||||||
let timeStop: Date;
|
let timeStop: Date;
|
||||||
let keysArr: antares.QueryForeign[] = [];
|
let keysArr: antares.QueryForeign[] = [];
|
||||||
|
|
||||||
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const { rows, report, fields, keys, duration }: any = await new Promise((resolve, reject) => {
|
||||||
connection.query({ sql: query, nestTables }).then(async ([response, fields]) => {
|
connection.query({ sql: query, nestTables }).then(async ([response, fields]) => {
|
||||||
timeStop = new Date();
|
timeStop = new Date();
|
||||||
const queryResult = response;
|
const queryResult = response;
|
||||||
|
@@ -1426,7 +1426,8 @@ export class PostgreSQLClient extends AntaresCore {
|
|||||||
let timeStop: Date;
|
let timeStop: Date;
|
||||||
let keysArr: antares.QueryForeign[] = [];
|
let keysArr: antares.QueryForeign[] = [];
|
||||||
|
|
||||||
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const { rows, report, fields, keys, duration }: any = await new Promise((resolve, reject) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const res = await connection.query({ rowMode: args.nest ? 'array' : null, text: query });
|
const res = await connection.query({ rowMode: args.nest ? 'array' : null, text: query });
|
||||||
|
@@ -628,7 +628,8 @@ export class SQLiteClient extends AntaresCore {
|
|||||||
let timeStop;
|
let timeStop;
|
||||||
const keysArr: antares.QueryForeign[] = [];
|
const keysArr: antares.QueryForeign[] = [];
|
||||||
|
|
||||||
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const { rows, report, fields, keys, duration }: any = await new Promise((resolve, reject) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
let queryRunResult: sqlite.RunResult;
|
let queryRunResult: sqlite.RunResult;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
@@ -1,16 +1,14 @@
|
|||||||
import { app, BrowserWindow, globalShortcut, nativeImage, Menu, ipcMain } from 'electron';
|
import { app, BrowserWindow, nativeImage, 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 { ShortcutRegister } from './libs/ShortcutRegister';
|
import { OsMenu, ShortcutRegister } from './libs/ShortcutRegister';
|
||||||
|
|
||||||
Store.initRenderer();
|
Store.initRenderer();
|
||||||
const settingsStore = new Store({ name: 'settings' });
|
const settingsStore = new Store({ name: 'settings' });
|
||||||
|
|
||||||
let shortCutRegister: ShortcutRegister;
|
|
||||||
const appTheme = settingsStore.get('application_theme');
|
const appTheme = settingsStore.get('application_theme');
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
const isMacOS = process.platform === 'darwin';
|
const isMacOS = process.platform === 'darwin';
|
||||||
@@ -122,32 +120,12 @@ else {
|
|||||||
mainWindow = await createMainWindow();
|
mainWindow = await createMainWindow();
|
||||||
createAppMenu();
|
createAppMenu();
|
||||||
|
|
||||||
shortCutRegister = ShortcutRegister.getInstance({ mainWindow });
|
|
||||||
|
|
||||||
if (isWindows)
|
if (isWindows)
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
|
||||||
if (isDevelopment)
|
if (isDevelopment)
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.webContents.openDevTools();
|
||||||
|
|
||||||
app.on('browser-window-focus', () => {
|
|
||||||
// Send registered shortcut events to window
|
|
||||||
shortCutRegister.init();
|
|
||||||
|
|
||||||
if (isDevelopment) { // Dev shortcuts
|
|
||||||
globalShortcut.register('Shift+CommandOrControl+F5', () => {
|
|
||||||
mainWindow.reload();
|
|
||||||
});
|
|
||||||
globalShortcut.register('Shift+CommandOrControl+F12', () => {
|
|
||||||
mainWindow.webContents.openDevTools();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on('browser-window-blur', () => {
|
|
||||||
shortCutRegister.unregister();
|
|
||||||
});
|
|
||||||
|
|
||||||
process.on('uncaughtException', error => {
|
process.on('uncaughtException', error => {
|
||||||
mainWindow.webContents.send('unhandled-exception', error);
|
mainWindow.webContents.send('unhandled-exception', error);
|
||||||
});
|
});
|
||||||
@@ -167,10 +145,8 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createAppMenu () {
|
function createAppMenu () {
|
||||||
let menu: Electron.Menu = null;
|
const menuTemplate: OsMenu = {
|
||||||
|
darwin: [
|
||||||
if (isMacOS) {
|
|
||||||
menu = Menu.buildFromTemplate([
|
|
||||||
{
|
{
|
||||||
label: app.name,
|
label: app.name,
|
||||||
submenu: [
|
submenu: [
|
||||||
@@ -201,10 +177,11 @@ function createAppMenu () {
|
|||||||
{
|
{
|
||||||
role: 'windowMenu'
|
role: 'windowMenu'
|
||||||
}
|
}
|
||||||
]);
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
Menu.setApplicationMenu(menu);
|
const shortCutRegister = ShortcutRegister.getInstance({ mainWindow, menuTemplate, mode: 'local' });
|
||||||
|
shortCutRegister.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveWindowState () {
|
function saveWindowState () {
|
||||||
|
@@ -51,14 +51,17 @@ watch(editorTheme, () => {
|
|||||||
|
|
||||||
watch(editorFontSize, () => {
|
watch(editorFontSize, () => {
|
||||||
const sizes = {
|
const sizes = {
|
||||||
small: 12,
|
xsmall: '10px',
|
||||||
medium: 14,
|
small: '12px',
|
||||||
large: 16
|
medium: '14px',
|
||||||
|
large: '16px',
|
||||||
|
xlarge: '18px',
|
||||||
|
xxlarge: '20px'
|
||||||
};
|
};
|
||||||
|
|
||||||
if (editor) {
|
if (editor) {
|
||||||
editor.setOptions({
|
editor.setOptions({
|
||||||
fontSize: sizes[editorFontSize.value as undefined as 'small' | 'medium' | 'large']
|
fontSize: sizes[editorFontSize.value]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, PropType, Ref, ref, watch } from 'vue';
|
import { computed, PropType, Ref, ref, watch } from 'vue';
|
||||||
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT, UUID } from 'common/fieldTypes';
|
||||||
import BaseUploadInput from '@/components/BaseUploadInput.vue';
|
import BaseUploadInput from '@/components/BaseUploadInput.vue';
|
||||||
import ForeignKeySelect from '@/components/ForeignKeySelect.vue';
|
import ForeignKeySelect from '@/components/ForeignKeySelect.vue';
|
||||||
import FakerMethods from 'common/FakerMethods';
|
import FakerMethods from 'common/FakerMethods';
|
||||||
@@ -126,6 +126,8 @@ const fakerGroups = computed(() => {
|
|||||||
localType.value = 'datetime';
|
localType.value = 'datetime';
|
||||||
else if (TIME.includes(props.type))
|
else if (TIME.includes(props.type))
|
||||||
localType.value = 'time';
|
localType.value = 'time';
|
||||||
|
else if (UUID.includes(props.type))
|
||||||
|
localType.value = 'uuid';
|
||||||
else
|
else
|
||||||
localType.value = 'none';
|
localType.value = 'none';
|
||||||
|
|
||||||
|
@@ -239,7 +239,7 @@
|
|||||||
<div class="column col-12 h6 text-uppercase mb-2 mt-4">
|
<div class="column col-12 h6 text-uppercase mb-2 mt-4">
|
||||||
{{ t('message.editorTheme') }}
|
{{ t('message.editorTheme') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6 h5 mb-4">
|
<div class="column col-5 h5 mb-4">
|
||||||
<BaseSelect
|
<BaseSelect
|
||||||
v-model="localEditorTheme"
|
v-model="localEditorTheme"
|
||||||
class="form-select"
|
class="form-select"
|
||||||
@@ -251,28 +251,49 @@
|
|||||||
@change="changeEditorTheme(localEditorTheme)"
|
@change="changeEditorTheme(localEditorTheme)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6 mb-4">
|
<div class="column col-7 mb-4">
|
||||||
<div class="btn-group btn-group-block">
|
<div class="btn-group btn-group-block">
|
||||||
|
<button
|
||||||
|
class="btn btn-dark cut-text"
|
||||||
|
:class="{'active': editorFontSize === 'xsmall'}"
|
||||||
|
@click="changeEditorFontSize('xsmall')"
|
||||||
|
>
|
||||||
|
10px
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-dark cut-text"
|
class="btn btn-dark cut-text"
|
||||||
:class="{'active': editorFontSize === 'small'}"
|
:class="{'active': editorFontSize === 'small'}"
|
||||||
@click="changeEditorFontSize('small')"
|
@click="changeEditorFontSize('small')"
|
||||||
>
|
>
|
||||||
{{ t('word.small') }}
|
12px
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-dark cut-text"
|
class="btn btn-dark cut-text"
|
||||||
:class="{'active': editorFontSize === 'medium'}"
|
:class="{'active': editorFontSize === 'medium'}"
|
||||||
@click="changeEditorFontSize('medium')"
|
@click="changeEditorFontSize('medium')"
|
||||||
>
|
>
|
||||||
{{ t('word.medium') }}
|
14px
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-dark cut-text"
|
class="btn btn-dark cut-text"
|
||||||
:class="{'active': editorFontSize === 'large'}"
|
:class="{'active': editorFontSize === 'large'}"
|
||||||
@click="changeEditorFontSize('large')"
|
@click="changeEditorFontSize('large')"
|
||||||
>
|
>
|
||||||
{{ t('word.large') }}
|
16px
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-dark cut-text"
|
||||||
|
:class="{'active': editorFontSize === 'xlarge'}"
|
||||||
|
@click="changeEditorFontSize('xlarge')"
|
||||||
|
>
|
||||||
|
18px
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-dark cut-text"
|
||||||
|
:class="{'active': editorFontSize === 'xxlarge'}"
|
||||||
|
@click="changeEditorFontSize('xxlarge')"
|
||||||
|
>
|
||||||
|
20px
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -395,7 +416,29 @@ const contributors = process.env.APP_CONTRIBUTORS;
|
|||||||
const appLogo = require('../images/logo.svg');
|
const appLogo = require('../images/logo.svg');
|
||||||
const darkPreview = require('../images/dark.png');
|
const darkPreview = require('../images/dark.png');
|
||||||
const lightPreview = require('../images/light.png');
|
const lightPreview = require('../images/light.png');
|
||||||
const editorThemes= [
|
const exampleQuery = `-- This is an example
|
||||||
|
SELECT
|
||||||
|
employee.id,
|
||||||
|
employee.first_name,
|
||||||
|
employee.last_name,
|
||||||
|
SUM(DATEDIFF("SECOND", call.start, call.end)) AS call_duration
|
||||||
|
FROM call
|
||||||
|
INNER JOIN employee ON call.employee_id = employee.id
|
||||||
|
GROUP BY
|
||||||
|
employee.id,
|
||||||
|
employee.first_name,
|
||||||
|
employee.last_name
|
||||||
|
ORDER BY
|
||||||
|
employee.id ASC;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const localLocale: Ref<AvailableLocale> = ref(null);
|
||||||
|
const localPageSize: Ref<number> = ref(null);
|
||||||
|
const localTimeout: Ref<number> = ref(null);
|
||||||
|
const localEditorTheme: Ref<string> = ref(null);
|
||||||
|
const selectedTab: Ref<string> = ref('general');
|
||||||
|
|
||||||
|
const editorThemes = computed(() => [
|
||||||
{
|
{
|
||||||
group: t('word.light'),
|
group: t('word.light'),
|
||||||
themes: [
|
themes: [
|
||||||
@@ -443,28 +486,7 @@ const editorThemes= [
|
|||||||
{ code: 'vibrant_ink', name: 'Vibrant Ink' }
|
{ code: 'vibrant_ink', name: 'Vibrant Ink' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
]);
|
||||||
const exampleQuery = `-- This is an example
|
|
||||||
SELECT
|
|
||||||
employee.id,
|
|
||||||
employee.first_name,
|
|
||||||
employee.last_name,
|
|
||||||
SUM(DATEDIFF("SECOND", call.start, call.end)) AS call_duration
|
|
||||||
FROM call
|
|
||||||
INNER JOIN employee ON call.employee_id = employee.id
|
|
||||||
GROUP BY
|
|
||||||
employee.id,
|
|
||||||
employee.first_name,
|
|
||||||
employee.last_name
|
|
||||||
ORDER BY
|
|
||||||
employee.id ASC;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const localLocale: Ref<AvailableLocale> = ref(null);
|
|
||||||
const localPageSize: Ref<number> = ref(null);
|
|
||||||
const localTimeout: Ref<number> = ref(null);
|
|
||||||
const localEditorTheme: Ref<string> = ref(null);
|
|
||||||
const selectedTab: Ref<string> = ref('general');
|
|
||||||
|
|
||||||
const locales = computed(() => {
|
const locales = computed(() => {
|
||||||
const locales = [];
|
const locales = [];
|
||||||
|
@@ -34,6 +34,15 @@ const {
|
|||||||
lineWrap
|
lineWrap
|
||||||
} = storeToRefs(settingsStore);
|
} = storeToRefs(settingsStore);
|
||||||
|
|
||||||
|
const sizes = {
|
||||||
|
xsmall: '10px',
|
||||||
|
small: '12px',
|
||||||
|
medium: '14px',
|
||||||
|
large: '16px',
|
||||||
|
xlarge: '18px',
|
||||||
|
xxlarge: '20px'
|
||||||
|
};
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: String,
|
modelValue: String,
|
||||||
workspace: Object as Prop<Workspace>,
|
workspace: Object as Prop<Workspace>,
|
||||||
@@ -240,12 +249,6 @@ watch(editorTheme, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(editorFontSize, () => {
|
watch(editorFontSize, () => {
|
||||||
const sizes = {
|
|
||||||
small: '12px',
|
|
||||||
medium: '14px',
|
|
||||||
large: '16px'
|
|
||||||
};
|
|
||||||
|
|
||||||
if (editor.value) {
|
if (editor.value) {
|
||||||
editor.value.setOptions({
|
editor.value.setOptions({
|
||||||
fontSize: sizes[editorFontSize.value]
|
fontSize: sizes[editorFontSize.value]
|
||||||
@@ -305,7 +308,8 @@ onMounted(() => {
|
|||||||
enableBasicAutocompletion: true,
|
enableBasicAutocompletion: true,
|
||||||
wrap: lineWrap.value,
|
wrap: lineWrap.value,
|
||||||
enableSnippets: true,
|
enableSnippets: true,
|
||||||
enableLiveAutocompletion: autoComplete.value
|
enableLiveAutocompletion: autoComplete.value,
|
||||||
|
fontSize: sizes[editorFontSize.value]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!baseCompleter.value.length)
|
if (!baseCompleter.value.length)
|
||||||
|
@@ -326,7 +326,7 @@
|
|||||||
v-if="tab.type ==='query'"
|
v-if="tab.type ==='query'"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
/>
|
/>
|
||||||
<WorkspaceTabTable
|
<WorkspaceTabTable
|
||||||
@@ -334,7 +334,7 @@
|
|||||||
v-once
|
v-once
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:table="tab.elementName"
|
:table="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
:element-type="tab.elementType"
|
:element-type="tab.elementType"
|
||||||
@@ -344,14 +344,14 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
<WorkspaceTabPropsTable
|
<WorkspaceTabPropsTable
|
||||||
v-else-if="tab.type === 'table-props'"
|
v-else-if="tab.type === 'table-props'"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:table="tab.elementName"
|
:table="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -360,13 +360,13 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
<WorkspaceTabPropsView
|
<WorkspaceTabPropsView
|
||||||
v-else-if="tab.type === 'view-props'"
|
v-else-if="tab.type === 'view-props'"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:view="tab.elementName"
|
:view="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
@@ -376,7 +376,7 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:trigger="tab.elementName"
|
:trigger="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -384,7 +384,7 @@
|
|||||||
v-else-if="['temp-trigger-props', 'trigger-props'].includes(tab.type)"
|
v-else-if="['temp-trigger-props', 'trigger-props'].includes(tab.type)"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:trigger="tab.elementName"
|
:trigger="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -393,7 +393,7 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:trigger="tab.elementName"
|
:trigger="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -401,7 +401,7 @@
|
|||||||
v-else-if="['temp-trigger-function-props', 'trigger-function-props'].includes(tab.type)"
|
v-else-if="['temp-trigger-function-props', 'trigger-function-props'].includes(tab.type)"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:function="tab.elementName"
|
:function="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -410,7 +410,7 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:trigger="tab.elementName"
|
:trigger="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -418,7 +418,7 @@
|
|||||||
v-else-if="['temp-routine-props', 'routine-props'].includes(tab.type)"
|
v-else-if="['temp-routine-props', 'routine-props'].includes(tab.type)"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:routine="tab.elementName"
|
:routine="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -427,7 +427,7 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:trigger="tab.elementName"
|
:trigger="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -435,7 +435,7 @@
|
|||||||
v-else-if="['temp-function-props', 'function-props'].includes(tab.type)"
|
v-else-if="['temp-function-props', 'function-props'].includes(tab.type)"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:function="tab.elementName"
|
:function="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -444,7 +444,7 @@
|
|||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:tab="tab"
|
:tab="tab"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:trigger="tab.elementName"
|
:trigger="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -452,7 +452,7 @@
|
|||||||
v-else-if="['temp-scheduler-props', 'scheduler-props'].includes(tab.type)"
|
v-else-if="['temp-scheduler-props', 'scheduler-props'].includes(tab.type)"
|
||||||
:tab-uid="tab.uid"
|
:tab-uid="tab.uid"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid && isSelected"
|
||||||
:scheduler="tab.elementName"
|
:scheduler="tab.elementName"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
/>
|
/>
|
||||||
@@ -638,6 +638,8 @@ const hideProcessesModal = () => {
|
|||||||
const addWheelEvent = () => {
|
const addWheelEvent = () => {
|
||||||
if (!hasWheelEvent.value) {
|
if (!hasWheelEvent.value) {
|
||||||
tabWrap.value.$el.addEventListener('wheel', (e: WheelEvent) => {
|
tabWrap.value.$el.addEventListener('wheel', (e: WheelEvent) => {
|
||||||
|
if (e.deltaX !== 0) return; // If trackpad horizontal scroll
|
||||||
|
|
||||||
if (e.deltaY > 0) tabWrap.value.$el.scrollLeft += 50;
|
if (e.deltaY > 0) tabWrap.value.$el.scrollLeft += 50;
|
||||||
else tabWrap.value.$el.scrollLeft -= 50;
|
else tabWrap.value.$el.scrollLeft -= 50;
|
||||||
});
|
});
|
||||||
|
@@ -217,7 +217,7 @@ const runElementCheck = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const runElement = (params: string[]) => {
|
const runElement = (params: string[]) => {
|
||||||
if (props.selectedMisc.type === 'procedure')
|
if (['procedure', 'routine'].includes(props.selectedMisc.type))
|
||||||
runRoutine(params);
|
runRoutine(params);
|
||||||
else if (props.selectedMisc.type === 'function')
|
else if (props.selectedMisc.type === 'function')
|
||||||
runFunction(params);
|
runFunction(params);
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
<ul class="menu menu-nav pt-0">
|
<ul class="menu menu-nav pt-0">
|
||||||
<li
|
<li
|
||||||
v-for="table of filteredTables"
|
v-for="table of filteredTables"
|
||||||
:ref="breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name) ? 'explorebarSelected' : ''"
|
|
||||||
:key="table.name"
|
:key="table.name"
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'selected': breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name)}"
|
:class="{'selected': breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name)}"
|
||||||
@@ -69,7 +68,6 @@
|
|||||||
<li
|
<li
|
||||||
v-for="trigger of filteredTriggers"
|
v-for="trigger of filteredTriggers"
|
||||||
:key="trigger.name"
|
:key="trigger.name"
|
||||||
:ref="breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name ? 'explorebarSelected' : ''"
|
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name}"
|
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name}"
|
||||||
@mousedown.left="selectMisc({schema: database.name, misc: trigger, type: 'trigger'})"
|
@mousedown.left="selectMisc({schema: database.name, misc: trigger, type: 'trigger'})"
|
||||||
@@ -111,7 +109,6 @@
|
|||||||
<li
|
<li
|
||||||
v-for="(routine, i) of filteredProcedures"
|
v-for="(routine, i) of filteredProcedures"
|
||||||
:key="`${routine.name}-${i}`"
|
:key="`${routine.name}-${i}`"
|
||||||
:ref="breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name ? 'explorebarSelected' : ''"
|
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name}"
|
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name}"
|
||||||
@mousedown.left="selectMisc({schema: database.name, misc: routine, type: 'routine'})"
|
@mousedown.left="selectMisc({schema: database.name, misc: routine, type: 'routine'})"
|
||||||
@@ -145,7 +142,6 @@
|
|||||||
<li
|
<li
|
||||||
v-for="(func, i) of filteredTriggerFunctions"
|
v-for="(func, i) of filteredTriggerFunctions"
|
||||||
:key="`${func.name}-${i}`"
|
:key="`${func.name}-${i}`"
|
||||||
:ref="breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name ? 'explorebarSelected' : ''"
|
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name}"
|
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name}"
|
||||||
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'triggerFunction'})"
|
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'triggerFunction'})"
|
||||||
@@ -179,7 +175,6 @@
|
|||||||
<li
|
<li
|
||||||
v-for="(func, i) of filteredFunctions"
|
v-for="(func, i) of filteredFunctions"
|
||||||
:key="`${func.name}-${i}`"
|
:key="`${func.name}-${i}`"
|
||||||
:ref="breadcrumbs.schema === database.name && breadcrumbs.function === func.name ? 'explorebarSelected' : ''"
|
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
|
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
|
||||||
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'function'})"
|
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'function'})"
|
||||||
@@ -213,7 +208,6 @@
|
|||||||
<li
|
<li
|
||||||
v-for="scheduler of filteredSchedulers"
|
v-for="scheduler of filteredSchedulers"
|
||||||
:key="scheduler.name"
|
:key="scheduler.name"
|
||||||
:ref="breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name ? 'explorebarSelected' : ''"
|
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name}"
|
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name}"
|
||||||
@mousedown.left="selectMisc({schema: database.name, misc: scheduler, type: 'scheduler'})"
|
@mousedown.left="selectMisc({schema: database.name, misc: scheduler, type: 'scheduler'})"
|
||||||
@@ -281,7 +275,6 @@ const {
|
|||||||
} = workspacesStore;
|
} = workspacesStore;
|
||||||
|
|
||||||
const schemaAccordion: Ref<HTMLDetailsElement> = ref(null);
|
const schemaAccordion: Ref<HTMLDetailsElement> = ref(null);
|
||||||
const explorebarSelected: Ref<HTMLElement[]> = ref(null);
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
const searchTerm = computed(() => {
|
const searchTerm = computed(() => {
|
||||||
@@ -340,7 +333,8 @@ const maxSize = computed(() => {
|
|||||||
watch(breadcrumbs, (newVal, oldVal) => {
|
watch(breadcrumbs, (newVal, oldVal) => {
|
||||||
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const element = explorebarSelected.value ? explorebarSelected.value[0] : null;
|
const element = document.querySelector<HTMLElement>('.workspace-explorebar-database .selected');
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
const elemTop = rect.top;
|
const elemTop = rect.top;
|
||||||
@@ -353,7 +347,7 @@ watch(breadcrumbs, (newVal, oldVal) => {
|
|||||||
element.removeAttribute('tabindex');
|
element.removeAttribute('tabindex');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 100);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
@show-delete-modal="showDeleteConfirmModal"
|
@show-delete-modal="showDeleteConfirmModal"
|
||||||
@set-null="setNull"
|
@set-null="setNull"
|
||||||
@copy-cell="copyCell"
|
@copy-cell="copyCell"
|
||||||
|
@fill-cell="fillCell"
|
||||||
@copy-row="copyRow"
|
@copy-row="copyRow"
|
||||||
@duplicate-row="duplicateRow"
|
@duplicate-row="duplicateRow"
|
||||||
@close-context="closeContext"
|
@close-context="closeContext"
|
||||||
@@ -122,7 +123,7 @@ import { useSettingsStore } from '@/stores/settings';
|
|||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
import { useConsoleStore } from '@/stores/console';
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { exportRows } from '../libs/exportRows';
|
import { exportRows } from '../libs/exportRows';
|
||||||
import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, BLOB, DATE, DATETIME, TIME } 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';
|
||||||
@@ -133,6 +134,7 @@ import { TableField, QueryResult } from 'common/interfaces/antares';
|
|||||||
import { TableUpdateParams } from 'common/interfaces/tableApis';
|
import { TableUpdateParams } from 'common/interfaces/tableApis';
|
||||||
import { jsonToSqlInsert } from 'common/libs/sqlUtils';
|
import { jsonToSqlInsert } from 'common/libs/sqlUtils';
|
||||||
import { unproxify } from '@/libs/unproxify';
|
import { unproxify } from '@/libs/unproxify';
|
||||||
|
import faker from '@faker-js/faker';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
@@ -377,7 +379,7 @@ const deleteSelected = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
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),
|
||||||
rows
|
rows
|
||||||
@@ -389,7 +391,7 @@ const setNull = () => {
|
|||||||
const row = localResults.value.find((row: any) => selectedRows.value.includes(row._antares_id));
|
const row = localResults.value.find((row: any) => selectedRows.value.includes(row._antares_id));
|
||||||
|
|
||||||
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(row),
|
id: getPrimaryValue(row),
|
||||||
@@ -463,6 +465,53 @@ const copyRow = (format: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fillCell = (event: { name: string; group: string; type: string }) => {
|
||||||
|
const row = localResults.value.find((row: any) => selectedRows.value.includes(row._antares_id));
|
||||||
|
let fakeValue;
|
||||||
|
let datePrecision = '';
|
||||||
|
|
||||||
|
if (['datetime', 'time'].includes(event.group)) {
|
||||||
|
for (let i = 0; i < selectedCell.value.length; i++)
|
||||||
|
datePrecision += i === 0 ? '.S' : 'S';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.group === 'custom') {
|
||||||
|
if (event.type === 'time' && event.name === 'now')
|
||||||
|
fakeValue = moment().format(`HH:mm:ss${datePrecision}`);
|
||||||
|
else if (event.type === 'time' && event.name === 'random')
|
||||||
|
fakeValue = moment(faker.date.recent()).format(`HH:mm:ss${datePrecision}`);
|
||||||
|
else if (event.type === 'datetime' && event.name === 'now')
|
||||||
|
fakeValue = moment().format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fakeValue = (faker as any)[event.group][event.name]();
|
||||||
|
if (['string', 'number'].includes(typeof fakeValue)) {
|
||||||
|
if (typeof fakeValue === 'number')
|
||||||
|
fakeValue = String(fakeValue);
|
||||||
|
|
||||||
|
if (selectedCell.value.length)
|
||||||
|
fakeValue = fakeValue.substring(0, selectedCell.value.length < 1024 ? Number(selectedCell.value.length) : 1024);
|
||||||
|
}
|
||||||
|
else if ([...DATE, ...DATETIME].includes(selectedCell.value.type))
|
||||||
|
fakeValue = moment(fakeValue).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
|
||||||
|
else if (TIME.includes(selectedCell.value.type))
|
||||||
|
fakeValue = moment(fakeValue).format(`HH:mm:ss${datePrecision}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
primary: primaryField.value?.name,
|
||||||
|
schema: getSchema(resultsetIndex.value),
|
||||||
|
table: getTable(resultsetIndex.value),
|
||||||
|
id: getPrimaryValue(row),
|
||||||
|
row,
|
||||||
|
orgRow: row,
|
||||||
|
field: selectedCell.value.field,
|
||||||
|
content: fakeValue
|
||||||
|
};
|
||||||
|
|
||||||
|
emit('update-field', params);
|
||||||
|
};
|
||||||
|
|
||||||
const duplicateRow = () => {
|
const duplicateRow = () => {
|
||||||
const row = localResults.value.find((row: any) => selectedRows.value.includes(row._antares_id));
|
const row = localResults.value.find((row: any) => selectedRows.value.includes(row._antares_id));
|
||||||
const rowToDuplicate = JSON.parse(JSON.stringify(row));
|
const rowToDuplicate = JSON.parse(JSON.stringify(row));
|
||||||
@@ -611,7 +660,7 @@ const onKey = async (e: KeyboardEvent) => {
|
|||||||
selectAllRows(e);
|
selectAllRows(e);
|
||||||
|
|
||||||
// row navigation stuff
|
// row navigation stuff
|
||||||
if ((e.code.includes('Arrow') || e.code === 'Tab') && sortedResults.value.length > 0 && !e.altKey) {
|
if (!(e.ctrlKey || e.metaKey) && (e.code.includes('Arrow') || e.code === 'Tab') && sortedResults.value.length > 0 && !e.altKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const aviableFields= Object.keys(sortedResults.value[0]).slice(0, -1); // removes _antares_id
|
const aviableFields= Object.keys(sortedResults.value[0]).slice(0, -1); // removes _antares_id
|
||||||
|
@@ -42,6 +42,27 @@
|
|||||||
<i class="mdi mdi-18px mdi-content-duplicate text-light pr-1" /> {{ t('word.duplicate') }}
|
<i class="mdi mdi-18px mdi-content-duplicate text-light pr-1" /> {{ t('word.duplicate') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="selectedRows.length === 1 && selectedCell.isEditable && mode === 'table' && fakerGroup"
|
||||||
|
class="context-element"
|
||||||
|
>
|
||||||
|
<span class="d-flex">
|
||||||
|
<i class="mdi mdi-18px mdi-auto-fix text-light pr-1" /> {{ t('message.fillCell') }}
|
||||||
|
</span>
|
||||||
|
<i class="mdi mdi-18px mdi-chevron-right text-light pl-1" />
|
||||||
|
<div class="context-submenu">
|
||||||
|
<div
|
||||||
|
v-for="method in fakerMethods[fakerGroup]"
|
||||||
|
:key="method.name"
|
||||||
|
class="context-element"
|
||||||
|
@click="fillCell(method)"
|
||||||
|
>
|
||||||
|
<span class="d-flex">
|
||||||
|
{{ t(`faker.${method.name}`) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="selectedRows.length === 1 && selectedCell.isEditable"
|
v-if="selectedRows.length === 1 && selectedCell.isEditable"
|
||||||
class="context-element"
|
class="context-element"
|
||||||
@@ -64,13 +85,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Prop } from 'vue';
|
import { computed, Prop } from 'vue';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, UUID } from 'common/fieldTypes';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
contextEvent: MouseEvent,
|
contextEvent: MouseEvent,
|
||||||
selectedRows: Array,
|
selectedRows: Array,
|
||||||
selectedCell: Object,
|
selectedCell: Object,
|
||||||
@@ -83,9 +105,62 @@ const emit = defineEmits([
|
|||||||
'set-null',
|
'set-null',
|
||||||
'copy-cell',
|
'copy-cell',
|
||||||
'copy-row',
|
'copy-row',
|
||||||
'duplicate-row'
|
'duplicate-row',
|
||||||
|
'fill-cell'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const fakerMethods = {
|
||||||
|
string: [
|
||||||
|
{ name: 'word', group: 'lorem' },
|
||||||
|
{ name: 'text', group: 'lorem' },
|
||||||
|
{ name: 'firstName', group: 'name' },
|
||||||
|
{ name: 'lastName', group: 'name' },
|
||||||
|
{ name: 'jobTitle', group: 'name' },
|
||||||
|
{ name: 'phoneNumber', group: 'phone' },
|
||||||
|
{ name: 'exampleEmail', group: 'internet' },
|
||||||
|
{ name: 'ip', group: 'internet' },
|
||||||
|
{ name: 'domainName', group: 'internet' },
|
||||||
|
{ name: 'color', group: 'internet' },
|
||||||
|
{ name: 'uuid', group: 'random' }
|
||||||
|
],
|
||||||
|
number: [
|
||||||
|
{ name: 'number', group: 'random' }
|
||||||
|
],
|
||||||
|
float: [
|
||||||
|
{ name: 'float', group: 'random' },
|
||||||
|
{ name: 'amount', group: 'finance' }
|
||||||
|
],
|
||||||
|
datetime: [
|
||||||
|
{ name: 'now', group: 'custom' },
|
||||||
|
{ name: 'past', group: 'date' },
|
||||||
|
{ name: 'future', group: 'date' }
|
||||||
|
],
|
||||||
|
time: [
|
||||||
|
{ name: 'now', group: 'custom' },
|
||||||
|
{ name: 'random', group: 'custom' }
|
||||||
|
],
|
||||||
|
uuid: [
|
||||||
|
{ name: 'uuid', group: 'random' }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const fakerGroup = computed(() => {
|
||||||
|
if ([...TEXT, ...LONG_TEXT].includes(props.selectedCell.type))
|
||||||
|
return 'string';
|
||||||
|
else if (NUMBER.includes(props.selectedCell.type))
|
||||||
|
return 'number';
|
||||||
|
else if (FLOAT.includes(props.selectedCell.type))
|
||||||
|
return 'float';
|
||||||
|
else if ([...DATE, ...DATETIME].includes(props.selectedCell.type))
|
||||||
|
return 'datetime';
|
||||||
|
else if (TIME.includes(props.selectedCell.type))
|
||||||
|
return 'time';
|
||||||
|
else if (UUID.includes(props.selectedCell.type))
|
||||||
|
return 'uuid';
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
const showConfirmModal = () => {
|
const showConfirmModal = () => {
|
||||||
emit('show-delete-modal');
|
emit('show-delete-modal');
|
||||||
};
|
};
|
||||||
@@ -113,4 +188,9 @@ const duplicateRow = () => {
|
|||||||
emit('duplicate-row');
|
emit('duplicate-row');
|
||||||
closeContext();
|
closeContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fillCell = (method: {name: string; group: string}) => {
|
||||||
|
emit('fill-cell', { ...method, type: fakerGroup.value });
|
||||||
|
closeContext();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -11,7 +11,12 @@
|
|||||||
:class="{selected: selectedCell === cKey}"
|
:class="{selected: selectedCell === cKey}"
|
||||||
@click="selectRow($event, cKey)"
|
@click="selectRow($event, cKey)"
|
||||||
|
|
||||||
@contextmenu.prevent="openContext($event, { id: row._antares_id, orgField: cKey })"
|
@contextmenu.prevent="openContext($event, {
|
||||||
|
id: row._antares_id,
|
||||||
|
orgField: cKey,
|
||||||
|
type: fields[cKey].type,
|
||||||
|
length: fields[cKey].charLength || fields[cKey].length
|
||||||
|
})"
|
||||||
>
|
>
|
||||||
<template v-if="cKey !== '_antares_id'">
|
<template v-if="cKey !== '_antares_id'">
|
||||||
<span
|
<span
|
||||||
@@ -212,6 +217,7 @@ import {
|
|||||||
DATETIME,
|
DATETIME,
|
||||||
BLOB,
|
BLOB,
|
||||||
BIT,
|
BIT,
|
||||||
|
BINARY,
|
||||||
HAS_TIMEZONE,
|
HAS_TIMEZONE,
|
||||||
SPATIAL,
|
SPATIAL,
|
||||||
IS_MULTI_SPATIAL
|
IS_MULTI_SPATIAL
|
||||||
@@ -379,6 +385,9 @@ const editON = async (field: string) => {
|
|||||||
|
|
||||||
const content = props.row[field];
|
const content = props.row[field];
|
||||||
const type = props.fields[field].type.toUpperCase();
|
const type = props.fields[field].type.toUpperCase();
|
||||||
|
|
||||||
|
if (BINARY.includes(type)) return;
|
||||||
|
|
||||||
originalContent.value = typeFormat(content, type, props.fields[field].length);
|
originalContent.value = typeFormat(content, type, props.fields[field].length);
|
||||||
editingType.value = type;
|
editingType.value = type;
|
||||||
editingField.value = field;
|
editingField.value = field;
|
||||||
@@ -442,7 +451,7 @@ const editOFF = () => {
|
|||||||
let content;
|
let content;
|
||||||
if (!BLOB.includes(editingType.value)) {
|
if (!BLOB.includes(editingType.value)) {
|
||||||
if ([...DATETIME, ...TIME].includes(editingType.value)) {
|
if ([...DATETIME, ...TIME].includes(editingType.value)) {
|
||||||
if (editingContent.value.substring(editingContent.value.length - 1) === '.')
|
if (editingContent.value !== null && editingContent.value.substring(editingContent.value.length - 1) === '.')
|
||||||
editingContent.value = editingContent.value.slice(0, -1);
|
editingContent.value = editingContent.value.slice(0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +535,14 @@ const getKeyUsage = (keyName: string) => {
|
|||||||
return props.keyUsage.find(key => key.field === keyName);
|
return props.keyUsage.find(key => key.field === keyName);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openContext = (event: MouseEvent, payload: { id: string; field?: string; orgField: string; isEditable?: boolean }) => {
|
const openContext = (event: MouseEvent, payload: {
|
||||||
|
id: string;
|
||||||
|
field?: string;
|
||||||
|
orgField: string;
|
||||||
|
isEditable?: boolean;
|
||||||
|
type: string;
|
||||||
|
length: number | false;
|
||||||
|
}) => {
|
||||||
payload.field = props.fields[payload.orgField].name;// Ensures field name only
|
payload.field = props.fields[payload.orgField].name;// Ensures field name only
|
||||||
payload.isEditable = isEditable.value;
|
payload.isEditable = isEditable.value;
|
||||||
emit('contextmenu', event, payload);
|
emit('contextmenu', event, payload);
|
||||||
@@ -582,6 +598,9 @@ const typeFormat = (val: string | number | Date | number[], type: string, precis
|
|||||||
return parseInt(bitString).toString().padStart(Number(precision), '0');
|
return parseInt(bitString).toString().padStart(Number(precision), '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BINARY.includes(type))
|
||||||
|
return Buffer.from(val as number[]).toString('hex');
|
||||||
|
|
||||||
if (ARRAY.includes(type)) {
|
if (ARRAY.includes(type)) {
|
||||||
if (Array.isArray(val))
|
if (Array.isArray(val))
|
||||||
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
|
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
|
||||||
|
@@ -322,7 +322,8 @@ export const enUS = {
|
|||||||
clearQuery: 'Clear query',
|
clearQuery: 'Clear query',
|
||||||
openFilter: 'Open filter',
|
openFilter: 'Open filter',
|
||||||
nextResultsPage: 'Next results page',
|
nextResultsPage: 'Next results page',
|
||||||
previousResultsPage: 'Previous results page'
|
previousResultsPage: 'Previous results page',
|
||||||
|
fillCell: 'Fill cell'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: 'Address',
|
address: 'Address',
|
||||||
@@ -388,6 +389,7 @@ export const enUS = {
|
|||||||
collation: 'Collation',
|
collation: 'Collation',
|
||||||
engine: 'Engine',
|
engine: 'Engine',
|
||||||
past: 'Past',
|
past: 'Past',
|
||||||
|
now: 'Now',
|
||||||
future: 'Future',
|
future: 'Future',
|
||||||
between: 'Between',
|
between: 'Between',
|
||||||
recent: 'Recent',
|
recent: 'Recent',
|
||||||
|
@@ -138,7 +138,11 @@ export const ptBR = {
|
|||||||
commit: 'Enviar',
|
commit: 'Enviar',
|
||||||
rollback: 'Reverter',
|
rollback: 'Reverter',
|
||||||
connectionString: 'String da conexão',
|
connectionString: 'String da conexão',
|
||||||
contributors: 'Contribuintes'
|
contributors: 'Contribuintes',
|
||||||
|
pin: 'Fixar',
|
||||||
|
unpin: 'Desafixar',
|
||||||
|
console: 'Console',
|
||||||
|
shortcuts: 'Atalhos'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
appWelcome: 'Bem vindo ao Antares SQL Client!',
|
appWelcome: 'Bem vindo ao Antares SQL Client!',
|
||||||
@@ -293,7 +297,30 @@ export const ptBR = {
|
|||||||
allConnections: 'Todas as conexões',
|
allConnections: 'Todas as conexões',
|
||||||
searchForConnections: 'Procurar por conexões',
|
searchForConnections: 'Procurar por conexões',
|
||||||
disableScratchpad: 'Desativar bloco de notas',
|
disableScratchpad: 'Desativar bloco de notas',
|
||||||
reportABug: 'Reportar um problema'
|
reportABug: 'Reportar um problema',
|
||||||
|
nextTab: 'Próxima guia',
|
||||||
|
previousTab: 'Guia anterior',
|
||||||
|
selectTabNumber: 'Selecionar guia número {param}',
|
||||||
|
toggleConsole: 'Alterar console',
|
||||||
|
addShortcut: 'Adicionar Atalho',
|
||||||
|
editShortcut: 'Editar atalho',
|
||||||
|
deleteShortcut: 'Delete shortcut',
|
||||||
|
restoreDefaults: 'Restaurar padrões',
|
||||||
|
restoreDefaultsQuestion: 'Você confirma que quer restaurar os valores padrões?',
|
||||||
|
registerAShortcut: 'Registrar um atalho',
|
||||||
|
invalidShortcutMessage: 'Combinação inválida, continue digitando',
|
||||||
|
shortcutAlreadyExists: 'O atalho já existe',
|
||||||
|
saveContent: 'Salvar conteúdo',
|
||||||
|
openAllConnections: 'Abrir todas as conexões',
|
||||||
|
openSettings: 'Abrir Configurações',
|
||||||
|
openScratchpad: 'Abrir scratchpad',
|
||||||
|
runOrReload: 'Executar ou recarregar',
|
||||||
|
formatQuery: 'Formatar consulta',
|
||||||
|
queryHistory: 'Histórico de consulta',
|
||||||
|
clearQuery: 'Limpar consulta',
|
||||||
|
openFilter: 'Abrir Filtro',
|
||||||
|
nextResultsPage: 'Próxima página de resultados',
|
||||||
|
previousResultsPage: 'Página de resultados anterior'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: 'Endereço',
|
address: 'Endereço',
|
||||||
|
@@ -63,6 +63,7 @@
|
|||||||
"mediumblob": $blob-color,
|
"mediumblob": $blob-color,
|
||||||
"medium_blob": $blob-color,
|
"medium_blob": $blob-color,
|
||||||
"longblob": $blob-color,
|
"longblob": $blob-color,
|
||||||
|
"long_blob": $blob-color,
|
||||||
"bytea": $blob-color,
|
"bytea": $blob-color,
|
||||||
"enum": $enum-color,
|
"enum": $enum-color,
|
||||||
"set": $enum-color,
|
"set": $enum-color,
|
||||||
|
@@ -109,7 +109,8 @@ option:checked {
|
|||||||
|
|
||||||
> div {
|
> div {
|
||||||
padding: 0.1rem 0.2rem;
|
padding: 0.1rem 0.2rem;
|
||||||
min-width: fill-available;
|
/* stylelint-disable-next-line value-no-vendor-prefix */
|
||||||
|
min-width: -webkit-fill-available;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ const isDarkTheme = window.matchMedia('(prefers-color-scheme: dark)');
|
|||||||
const defaultAppTheme = isDarkTheme.matches ? 'dark' : 'light';
|
const defaultAppTheme = isDarkTheme.matches ? 'dark' : 'light';
|
||||||
const defaultEditorTheme = isDarkTheme.matches ? 'twilight' : 'sqlserver';
|
const defaultEditorTheme = isDarkTheme.matches ? 'twilight' : 'sqlserver';
|
||||||
|
|
||||||
export type EditorFontSize = 'small' | 'medium' | 'large';
|
export type EditorFontSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
|
||||||
export type ApplicationTheme = 'light' | 'dark';
|
export type ApplicationTheme = 'light' | 'dark';
|
||||||
|
|
||||||
export const useSettingsStore = defineStore('settings', {
|
export const useSettingsStore = defineStore('settings', {
|
||||||
|
Reference in New Issue
Block a user