mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
26 Commits
v0.7.20-be
...
v0.7.20
Author | SHA1 | Date | |
---|---|---|---|
ba6063e636 | |||
b055350726 | |||
b5b35be45c | |||
6a72f6b4ae | |||
861b704344 | |||
9ce53165e8 | |||
62614dceb9 | |||
8774dd44e6 | |||
f0ae01ca5e | |||
03be777c2a | |||
45a695ac0a | |||
c176841b75 | |||
329246e2d8 | |||
e26809f260 | |||
f13d4e6dce | |||
879de91516 | |||
38b32bfb28 | |||
315d9d84c2 | |||
c3d96cb35b | |||
05bd7672e1 | |||
390bf88bb8 | |||
984aa893d3 | |||
1ac816eaa9 | |||
6f25fcbc05 | |||
bc44465132 | |||
634a442213 |
4
.github/workflows/build-beta.yml
vendored
4
.github/workflows/build-beta.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-11, ubuntu-latest, windows-latest]
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm i
|
run: npm i
|
||||||
|
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-11, ubuntu-latest, windows-latest]
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Exit if not on master branch
|
- name: Exit if not on master branch
|
||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm i
|
run: npm i
|
||||||
|
4
.github/workflows/create-artifact-linux.yml
vendored
4
.github/workflows/create-artifact-linux.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm i
|
run: npm i
|
||||||
|
29
.github/workflows/create-artifact-macos.yml
vendored
29
.github/workflows/create-artifact-macos.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
|
|
||||||
- name: npm install & build
|
- name: npm install & build
|
||||||
run: |
|
run: |
|
||||||
@@ -29,3 +29,30 @@ jobs:
|
|||||||
build
|
build
|
||||||
!build/*-unpacked
|
!build/*-unpacked
|
||||||
!build/.icon-ico
|
!build/.icon-ico
|
||||||
|
build-beta:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: beta
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: npm install & build
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: macos-build-beta
|
||||||
|
retention-days: 3
|
||||||
|
path: |
|
||||||
|
build
|
||||||
|
!build/*-unpacked
|
||||||
|
!build/.icon-ico
|
||||||
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -10,7 +10,8 @@
|
|||||||
"translation",
|
"translation",
|
||||||
"Linux",
|
"Linux",
|
||||||
"MacOS",
|
"MacOS",
|
||||||
"deps"
|
"deps",
|
||||||
|
"Flatpak"
|
||||||
],
|
],
|
||||||
"svg.preview.background": "transparent"
|
"svg.preview.background": "transparent"
|
||||||
}
|
}
|
27
CHANGELOG.md
27
CHANGELOG.md
@@ -2,6 +2,33 @@
|
|||||||
|
|
||||||
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.7.20](https://github.com/antares-sql/antares/compare/v0.7.20-beta.2...v0.7.20) (2023-12-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* missing update indicator on setting icon ([b055350](https://github.com/antares-sql/antares/commit/b055350726774e05a4e04ea6d890c46f64f2112e))
|
||||||
|
|
||||||
|
### [0.7.20-beta.2](https://github.com/antares-sql/antares/compare/v0.7.20-beta.1...v0.7.20-beta.2) (2023-12-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* communication with worker thread not working ([6a72f6b](https://github.com/antares-sql/antares/commit/6a72f6b4ae3f4c1d6c42ca7a817d2f2c135696a7))
|
||||||
|
|
||||||
|
### [0.7.20-beta.1](https://github.com/antares-sql/antares/compare/v0.7.20-beta.0...v0.7.20-beta.1) (2023-12-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* copy element names on sidebar from context menu, closes [#718](https://github.com/antares-sql/antares/issues/718) ([f13d4e6](https://github.com/antares-sql/antares/commit/f13d4e6dceb70b0c7cb8d56ddfb5f00e938571cc))
|
||||||
|
* logging errors on log file ([315d9d8](https://github.com/antares-sql/antares/commit/315d9d84c2caa29852d68bd189750b2a4028d953))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Flatpak:** import/export schema not working ([e26809f](https://github.com/antares-sql/antares/commit/e26809f260099ba194bf5d00671cae14d438197b))
|
||||||
|
|
||||||
### [0.7.20-beta.0](https://github.com/antares-sql/antares/compare/v0.7.19...v0.7.20-beta.0) (2023-11-15)
|
### [0.7.20-beta.0](https://github.com/antares-sql/antares/compare/v0.7.19...v0.7.20-beta.0) (2023-11-15)
|
||||||
|
|
||||||
|
|
||||||
|
6527
package-lock.json
generated
6527
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.7.20-beta.0",
|
"version": "0.7.20",
|
||||||
"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",
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
"@vueuse/core": "~10.4.1",
|
"@vueuse/core": "~10.4.1",
|
||||||
"ace-builds": "~1.24.1",
|
"ace-builds": "~1.24.1",
|
||||||
"better-sqlite3": "~9.1.1",
|
"better-sqlite3": "~9.1.1",
|
||||||
"electron-log": "~4.4.1",
|
"electron-log": "~5.0.1",
|
||||||
"electron-store": "~8.1.0",
|
"electron-store": "~8.1.0",
|
||||||
"electron-updater": "~4.6.5",
|
"electron-updater": "~4.6.5",
|
||||||
"electron-window-state": "~5.0.3",
|
"electron-window-state": "~5.0.3",
|
||||||
|
@@ -63,43 +63,39 @@ async function restartElectron () {
|
|||||||
if (!manualRestart) process.exit(0);
|
if (!manualRestart) process.exit(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function startWorkers () {
|
||||||
|
const compiler = webpack(workersConfig);
|
||||||
|
const { name } = compiler;
|
||||||
|
|
||||||
function startMain () {
|
compiler.hooks.afterEmit.tap('afterEmit', () => {
|
||||||
const webpackSetup = webpack([mainConfig, workersConfig]);
|
console.log(chalk.gray(`\nCompiled ${name} script!`));
|
||||||
|
console.log(chalk.gray(`\nWatching file changes for ${name} script...`));
|
||||||
webpackSetup.compilers.forEach((compiler) => {
|
|
||||||
const { name } = compiler;
|
|
||||||
|
|
||||||
switch (name) {
|
|
||||||
case 'workers':
|
|
||||||
compiler.hooks.afterEmit.tap('afterEmit', async () => {
|
|
||||||
console.log(chalk.gray(`\nCompiled ${name} script!`));
|
|
||||||
console.log(
|
|
||||||
chalk.gray(`\nWatching file changes for ${name} script...`)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'main':
|
|
||||||
default:
|
|
||||||
compiler.hooks.afterEmit.tap('afterEmit', async () => {
|
|
||||||
console.log(chalk.gray(`\nCompiled ${name} script!`));
|
|
||||||
|
|
||||||
manualRestart = true;
|
|
||||||
await restartElectron();
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
manualRestart = false;
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
chalk.gray(`\nWatching file changes for ${name} script...`)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
webpackSetup.watch({ aggregateTimeout: 500 }, err => {
|
compiler.watch({ aggregateTimeout: 500 }, err => {
|
||||||
|
if (err) console.error(chalk.red(err));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function startMain () {
|
||||||
|
const compiler = webpack(mainConfig);
|
||||||
|
const { name } = compiler;
|
||||||
|
|
||||||
|
compiler.hooks.afterEmit.tap('afterEmit', async () => {
|
||||||
|
console.log(chalk.gray(`\nCompiled ${name} script!`));
|
||||||
|
|
||||||
|
manualRestart = true;
|
||||||
|
await restartElectron();
|
||||||
|
startWorkers();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
manualRestart = false;
|
||||||
|
}, 2500);
|
||||||
|
|
||||||
|
console.log(chalk.gray(`\nWatching file changes for ${name} script...`));
|
||||||
|
});
|
||||||
|
|
||||||
|
compiler.watch({ aggregateTimeout: 500 }, err => {
|
||||||
if (err) console.error(chalk.red(err));
|
if (err) console.error(chalk.red(err));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,7 @@ const downloadFile = url => {
|
|||||||
await unzip(filePath, destFolder);
|
await unzip(filePath, destFolder);
|
||||||
fs.unlinkSync(filePath);
|
fs.unlinkSync(filePath);
|
||||||
fs.unlinkSync(`${destFolder}/package.json`);// <- Avoid to display annoyng npm script in vscode
|
fs.unlinkSync(`${destFolder}/package.json`);// <- Avoid to display annoyng npm script in vscode
|
||||||
|
process.exit();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@@ -1,17 +1,14 @@
|
|||||||
import { ChildProcess, fork } from 'child_process';
|
|
||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
import * as workers from 'common/interfaces/workers';
|
import * as workers from 'common/interfaces/workers';
|
||||||
import { dialog, ipcMain } from 'electron';
|
import { dialog, ipcMain } from 'electron';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import { Worker } from 'worker_threads';
|
||||||
|
|
||||||
import { validateSender } from '../libs/misc/validateSender';
|
import { validateSender } from '../libs/misc/validateSender';
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
|
||||||
|
|
||||||
export default (connections: {[key: string]: antares.Client}) => {
|
export default (connections: {[key: string]: antares.Client}) => {
|
||||||
let exporter: ChildProcess = null;
|
let exporter: Worker = null;
|
||||||
let importer: ChildProcess = null;
|
let importer: Worker = null;
|
||||||
|
|
||||||
ipcMain.handle('create-schema', async (event, params) => {
|
ipcMain.handle('create-schema', async (event, params) => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||||
@@ -202,7 +199,7 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||||
|
|
||||||
if (exporter !== null) {
|
if (exporter !== null) {
|
||||||
exporter.kill();
|
exporter.terminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,11 +224,12 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init exporter process
|
// Init exporter thread
|
||||||
exporter = fork(isDevelopment ? './dist/exporter.js' : path.resolve(__dirname, './exporter.js'), [], {
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
execArgv: isDevelopment ? ['--inspect=9224'] : undefined
|
// @ts-ignore
|
||||||
});
|
exporter = new Worker(new URL('../workers/exporter', import.meta.url));
|
||||||
exporter.send({
|
|
||||||
|
exporter.postMessage({
|
||||||
type: 'init',
|
type: 'init',
|
||||||
client: {
|
client: {
|
||||||
name: type,
|
name: type,
|
||||||
@@ -242,32 +240,34 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Exporter message listener
|
// Exporter message listener
|
||||||
exporter.on('message', ({ type, payload }: workers.WorkerIpcMessage) => {
|
exporter.on('message', (message: workers.WorkerIpcMessage) => {
|
||||||
|
const { type, payload } = message;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'export-progress':
|
case 'export-progress':
|
||||||
event.sender.send('export-progress', payload);
|
event.sender.send('export-progress', payload);
|
||||||
break;
|
break;
|
||||||
case 'end':
|
case 'end':
|
||||||
setTimeout(() => { // Ensures that writing process has finished
|
setTimeout(() => { // Ensures that writing thread has finished
|
||||||
exporter.kill();
|
exporter?.terminate();
|
||||||
exporter = null;
|
exporter = null;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
resolve({ status: 'success', response: payload });
|
resolve({ status: 'success', response: payload });
|
||||||
break;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
exporter.kill();
|
exporter?.terminate();
|
||||||
exporter = null;
|
exporter = null;
|
||||||
resolve({ status: 'error', response: 'Operation cancelled' });
|
resolve({ status: 'error', response: 'Operation cancelled' });
|
||||||
break;
|
break;
|
||||||
case 'error':
|
case 'error':
|
||||||
exporter.kill();
|
exporter?.terminate();
|
||||||
exporter = null;
|
exporter = null;
|
||||||
resolve({ status: 'error', response: payload });
|
resolve({ status: 'error', response: payload });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exporter.on('exit', code => {
|
exporter.on('close', code => {
|
||||||
exporter = null;
|
exporter = null;
|
||||||
resolve({ status: 'error', response: `Operation ended with code: ${code}` });
|
resolve({ status: 'error', response: `Operation ended with code: ${code}` });
|
||||||
});
|
});
|
||||||
@@ -291,7 +291,7 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
|
|
||||||
if (result.response === 1) {
|
if (result.response === 1) {
|
||||||
willAbort = true;
|
willAbort = true;
|
||||||
exporter.send({ type: 'cancel' });
|
exporter.postMessage({ type: 'cancel' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||||
|
|
||||||
if (importer !== null) {
|
if (importer !== null) {
|
||||||
importer.kill();
|
importer.terminate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,18 +310,21 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
(async () => {
|
(async () => {
|
||||||
const dbConfig = await connections[options.uid].getDbConfig();
|
const dbConfig = await connections[options.uid].getDbConfig();
|
||||||
|
|
||||||
// Init importer process
|
// Init importer thread
|
||||||
importer = fork(isDevelopment ? './dist/importer.js' : path.resolve(__dirname, './importer.js'), [], {
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
execArgv: isDevelopment ? ['--inspect=9224'] : undefined
|
// @ts-ignore
|
||||||
});
|
importer = new Worker(new URL('../workers/importer', import.meta.url));
|
||||||
importer.send({
|
|
||||||
|
importer.postMessage({
|
||||||
type: 'init',
|
type: 'init',
|
||||||
dbConfig,
|
dbConfig,
|
||||||
options
|
options
|
||||||
});
|
});
|
||||||
|
|
||||||
// Importer message listener
|
// Importer message listener
|
||||||
importer.on('message', ({ type, payload }: workers.WorkerIpcMessage) => {
|
importer.on('message', (message: workers.WorkerIpcMessage) => {
|
||||||
|
const { type, payload } = message;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'import-progress':
|
case 'import-progress':
|
||||||
event.sender.send('import-progress', payload);
|
event.sender.send('import-progress', payload);
|
||||||
@@ -331,23 +334,28 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
break;
|
break;
|
||||||
case 'end':
|
case 'end':
|
||||||
setTimeout(() => { // Ensures that writing process has finished
|
setTimeout(() => { // Ensures that writing process has finished
|
||||||
importer?.kill();
|
importer?.terminate();
|
||||||
importer = null;
|
importer = null;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
resolve({ status: 'success', response: payload });
|
resolve({ status: 'success', response: payload });
|
||||||
break;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
importer.kill();
|
importer.terminate();
|
||||||
importer = null;
|
importer = null;
|
||||||
resolve({ status: 'error', response: 'Operation cancelled' });
|
resolve({ status: 'error', response: 'Operation cancelled' });
|
||||||
break;
|
break;
|
||||||
case 'error':
|
case 'error':
|
||||||
importer.kill();
|
importer.terminate();
|
||||||
importer = null;
|
importer = null;
|
||||||
resolve({ status: 'error', response: payload });
|
resolve({ status: 'error', response: payload });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
importer.on('close', code => {
|
||||||
|
importer = null;
|
||||||
|
resolve({ status: 'error', response: `Operation ended with code: ${code}` });
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -368,7 +376,7 @@ export default (connections: {[key: string]: antares.Client}) => {
|
|||||||
|
|
||||||
if (result.response === 1) {
|
if (result.response === 1) {
|
||||||
willAbort = true;
|
willAbort = true;
|
||||||
importer.send({ type: 'cancel' });
|
importer.postMessage({ type: 'cancel' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
|
import * as log from 'electron-log/main';
|
||||||
import * as Store from 'electron-store';
|
import * as Store from 'electron-store';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ export default () => {
|
|||||||
mainWindow.reply('update-downloaded');
|
mainWindow.reply('update-downloaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
// autoUpdater.logger = require('electron-log');
|
log.transports.file.level = 'info';
|
||||||
// autoUpdater.logger.transports.console.format = '{h}:{i}:{s} {text}';
|
// log.transports.console.format = '{h}:{i}:{s} {text}';
|
||||||
// autoUpdater.logger.transports.file.level = 'info';
|
autoUpdater.logger = log;
|
||||||
};
|
};
|
||||||
|
@@ -10,7 +10,7 @@ const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
|
|||||||
const mainWindow = require('electron').webContents.fromId(1);
|
const mainWindow = require('electron').webContents.fromId(1);
|
||||||
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
|
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV === 'development') console.log(escapedSql);
|
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(escapedSql);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import * as exporter from 'common/interfaces/exporter';
|
import * as exporter from 'common/interfaces/exporter';
|
||||||
import { valueToSqlString } from 'common/libs/sqlUtils';
|
import { valueToSqlString } from 'common/libs/sqlUtils';
|
||||||
import * as mysql from 'mysql2/promise';
|
|
||||||
|
|
||||||
import { MySQLClient } from '../../clients/MySQLClient';
|
import { MySQLClient } from '../../clients/MySQLClient';
|
||||||
import { SqlExporter } from './SqlExporter';
|
import { SqlExporter } from './SqlExporter';
|
||||||
@@ -334,12 +333,10 @@ CREATE TABLE \`${view.Name}\`(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _queryStream (sql: string) {
|
async _queryStream (sql: string) {
|
||||||
if (process.env.NODE_ENV === 'development') console.log('EXPORTER:', sql);
|
const connection = await this._client.getConnection();
|
||||||
const isPool = 'getConnection' in this._client._connection;
|
|
||||||
const connection = isPool ? await (this._client._connection as mysql.Pool).getConnection() : this._client._connection;
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const stream = (connection as any).connection.query(sql).stream();
|
const stream = (connection as any).connection.query(sql).stream();
|
||||||
const dispose = () => (connection as mysql.PoolConnection).release();
|
const dispose = () => connection.end();
|
||||||
|
|
||||||
stream.on('end', dispose);
|
stream.on('end', dispose);
|
||||||
stream.on('error', dispose);
|
stream.on('error', dispose);
|
||||||
|
@@ -425,7 +425,6 @@ SET row_security = off;\n\n\n`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _queryStream (sql: string) {
|
async _queryStream (sql: string) {
|
||||||
if (process.env.NODE_ENV === 'development') console.log('EXPORTER:', sql);
|
|
||||||
const connection = await this._client.getConnection();
|
const connection = await this._client.getConnection();
|
||||||
const query = new QueryStream(sql, null);
|
const query = new QueryStream(sql, null);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
@@ -33,8 +33,8 @@ export default class MySQLImporter extends BaseImporter {
|
|||||||
parser.on('error', reject);
|
parser.on('error', reject);
|
||||||
|
|
||||||
parser.on('close', async () => {
|
parser.on('close', async () => {
|
||||||
console.log('TOTAL QUERIES', queryCount);
|
// console.log('TOTAL QUERIES', queryCount);
|
||||||
console.log('import end');
|
// console.log('import end');
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@ export default class PostgreSQLImporter extends BaseImporter {
|
|||||||
parser.on('error', reject);
|
parser.on('error', reject);
|
||||||
|
|
||||||
parser.on('close', async () => {
|
parser.on('close', async () => {
|
||||||
console.log('TOTAL QUERIES', queryCount);
|
// console.log('TOTAL QUERIES', queryCount);
|
||||||
console.log('import end');
|
// console.log('import end');
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ const isWindows = process.platform === 'win32';
|
|||||||
const indexPath = path.resolve(__dirname, 'index.html').split(path.sep).join('/');
|
const indexPath = path.resolve(__dirname, 'index.html').split(path.sep).join('/');
|
||||||
|
|
||||||
export function validateSender (frame: WebFrameMain) {
|
export function validateSender (frame: WebFrameMain) {
|
||||||
if (process.windowsStore) return true; // TEMP HOTFIX
|
if (isWindows) return true; // TEMP HOTFIX
|
||||||
const frameUrl = new URL(frame.url);
|
const frameUrl = new URL(frame.url);
|
||||||
const prefix = isWindows ? 'file:///' : 'file://';
|
const prefix = isWindows ? 'file:///' : 'file://';
|
||||||
const framePath = frameUrl.href.replace(prefix, '');
|
const framePath = frameUrl.href.replace(prefix, '');
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import * as remoteMain from '@electron/remote/main';
|
import * as remoteMain from '@electron/remote/main';
|
||||||
import { app, BrowserWindow, ipcMain, nativeImage, safeStorage } from 'electron';
|
import { app, BrowserWindow, ipcMain, nativeImage, safeStorage } from 'electron';
|
||||||
|
import * as log from 'electron-log/main';
|
||||||
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 path from 'path';
|
import * as path from 'path';
|
||||||
@@ -8,6 +9,7 @@ import ipcHandlers from './ipc-handlers';
|
|||||||
import { OsMenu, ShortcutRegister } from './libs/ShortcutRegister';
|
import { OsMenu, ShortcutRegister } from './libs/ShortcutRegister';
|
||||||
|
|
||||||
Store.initRenderer();
|
Store.initRenderer();
|
||||||
|
log.errorHandler.startCatching();
|
||||||
const settingsStore = new Store({ name: 'settings' });
|
const settingsStore = new Store({ name: 'settings' });
|
||||||
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';
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
|
import * as log from 'electron-log/main';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import { parentPort } from 'worker_threads';
|
||||||
|
|
||||||
import { MySQLClient } from '../libs/clients/MySQLClient';
|
import { MySQLClient } from '../libs/clients/MySQLClient';
|
||||||
import { PostgreSQLClient } from '../libs/clients/PostgreSQLClient';
|
import { PostgreSQLClient } from '../libs/clients/PostgreSQLClient';
|
||||||
@@ -8,63 +10,78 @@ import MysqlExporter from '../libs/exporters/sql/MysqlExporter';
|
|||||||
import PostgreSQLExporter from '../libs/exporters/sql/PostgreSQLExporter';
|
import PostgreSQLExporter from '../libs/exporters/sql/PostgreSQLExporter';
|
||||||
let exporter: antares.Exporter;
|
let exporter: antares.Exporter;
|
||||||
|
|
||||||
process.on('message', async ({ type, client, tables, options }: any) => {
|
log.transports.file.fileName = 'workers.log';
|
||||||
|
log.transports.console = null;
|
||||||
|
log.errorHandler.startCatching();
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const exportHandler = async (data: any) => {
|
||||||
|
const { type, client, tables, options } = data;
|
||||||
|
|
||||||
if (type === 'init') {
|
if (type === 'init') {
|
||||||
const connection = await ClientsFactory.getClient({
|
try {
|
||||||
client: client.name,
|
const connection = await ClientsFactory.getClient({
|
||||||
params: client.config,
|
client: client.name,
|
||||||
poolSize: 5
|
params: client.config,
|
||||||
}) as MySQLClient | PostgreSQLClient;
|
poolSize: 5
|
||||||
await connection.connect();
|
}) as MySQLClient | PostgreSQLClient;
|
||||||
|
await connection.connect();
|
||||||
|
|
||||||
switch (client.name) {
|
switch (client.name) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'maria':
|
case 'maria':
|
||||||
exporter = new MysqlExporter(connection as MySQLClient, tables, options);
|
exporter = new MysqlExporter(connection as MySQLClient, tables, options);
|
||||||
break;
|
break;
|
||||||
case 'pg':
|
case 'pg':
|
||||||
exporter = new PostgreSQLExporter(connection as PostgreSQLClient, tables, options);
|
exporter = new PostgreSQLExporter(connection as PostgreSQLClient, tables, options);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
|
type: 'error',
|
||||||
|
payload: `"${client.name}" exporter not aviable`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exporter.once('error', err => {
|
||||||
|
log.error(err.toString());
|
||||||
|
parentPort.postMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
payload: `"${client.name}" exporter not aviable`
|
payload: err.toString()
|
||||||
});
|
});
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
exporter.once('error', err => {
|
exporter.once('end', () => {
|
||||||
console.error(err);
|
parentPort.postMessage({
|
||||||
process.send({
|
type: 'end',
|
||||||
|
payload: { cancelled: exporter.isCancelled }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
exporter.once('cancel', () => {
|
||||||
|
fs.unlinkSync(exporter.outputFile);
|
||||||
|
parentPort.postMessage({ type: 'cancel' });
|
||||||
|
});
|
||||||
|
|
||||||
|
exporter.on('progress', state => {
|
||||||
|
parentPort.postMessage({
|
||||||
|
type: 'export-progress',
|
||||||
|
payload: state
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
exporter.run();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
log.error(err.toString());
|
||||||
|
parentPort.postMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
payload: err.toString()
|
payload: err.toString()
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
exporter.once('end', () => {
|
|
||||||
process.send({
|
|
||||||
type: 'end',
|
|
||||||
payload: { cancelled: exporter.isCancelled }
|
|
||||||
});
|
|
||||||
connection.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
exporter.once('cancel', () => {
|
|
||||||
fs.unlinkSync(exporter.outputFile);
|
|
||||||
process.send({ type: 'cancel' });
|
|
||||||
});
|
|
||||||
|
|
||||||
exporter.on('progress', state => {
|
|
||||||
process.send({
|
|
||||||
type: 'export-progress',
|
|
||||||
payload: state
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
exporter.run();
|
|
||||||
}
|
}
|
||||||
else if (type === 'cancel')
|
else if (type === 'cancel')
|
||||||
exporter.cancel();
|
exporter.cancel();
|
||||||
});
|
};
|
||||||
|
|
||||||
process.on('beforeExit', console.log);
|
parentPort.on('message', exportHandler);
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
import { ImportOptions } from 'common/interfaces/importer';
|
import { ImportOptions } from 'common/interfaces/importer';
|
||||||
|
import * as log from 'electron-log/main';
|
||||||
import * as mysql from 'mysql2';
|
import * as mysql from 'mysql2';
|
||||||
import * as pg from 'pg';
|
import * as pg from 'pg';
|
||||||
|
import { parentPort } from 'worker_threads';
|
||||||
|
|
||||||
import { MySQLClient } from '../libs/clients/MySQLClient';
|
import { MySQLClient } from '../libs/clients/MySQLClient';
|
||||||
import { PostgreSQLClient } from '../libs/clients/PostgreSQLClient';
|
import { PostgreSQLClient } from '../libs/clients/PostgreSQLClient';
|
||||||
@@ -11,14 +13,18 @@ import MySQLImporter from '../libs/importers/sql/MySQLlImporter';
|
|||||||
import PostgreSQLImporter from '../libs/importers/sql/PostgreSQLImporter';
|
import PostgreSQLImporter from '../libs/importers/sql/PostgreSQLImporter';
|
||||||
let importer: antares.Importer;
|
let importer: antares.Importer;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
log.transports.file.fileName = 'workers.log';
|
||||||
process.on('message', async ({ type, dbConfig, options }: {
|
log.transports.console = null;
|
||||||
|
log.errorHandler.startCatching();
|
||||||
|
|
||||||
|
const importHandler = async (data: {
|
||||||
type: string;
|
type: string;
|
||||||
dbConfig: mysql.ConnectionOptions & { schema: string; ssl?: mysql.SslOptions; ssh?: SSHConfig; readonly: boolean }
|
dbConfig: 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 }
|
||||||
| { databasePath: string; readonly: boolean };
|
| { databasePath: string; readonly: boolean };
|
||||||
options: ImportOptions;
|
options: ImportOptions;
|
||||||
}) => {
|
}) => {
|
||||||
|
const { type, dbConfig, options } = data;
|
||||||
if (type === 'init') {
|
if (type === 'init') {
|
||||||
try {
|
try {
|
||||||
const connection = await ClientsFactory.getClient({
|
const connection = await ClientsFactory.getClient({
|
||||||
@@ -41,7 +47,7 @@ process.on('message', async ({ type, dbConfig, options }: {
|
|||||||
importer = new PostgreSQLImporter(pool as unknown as pg.PoolClient, options);
|
importer = new PostgreSQLImporter(pool as unknown as pg.PoolClient, options);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
payload: `"${options.type}" importer not aviable`
|
payload: `"${options.type}" importer not aviable`
|
||||||
});
|
});
|
||||||
@@ -49,33 +55,33 @@ process.on('message', async ({ type, dbConfig, options }: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
importer.once('error', err => {
|
importer.once('error', err => {
|
||||||
console.error(err);
|
log.error(err.toString());
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
payload: err.toString()
|
payload: err.toString()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
importer.once('end', () => {
|
importer.once('end', () => {
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
type: 'end',
|
type: 'end',
|
||||||
payload: { cancelled: importer.isCancelled }
|
payload: { cancelled: importer.isCancelled }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
importer.once('cancel', () => {
|
importer.once('cancel', () => {
|
||||||
process.send({ type: 'cancel' });
|
parentPort.postMessage({ type: 'cancel' });
|
||||||
});
|
});
|
||||||
|
|
||||||
importer.on('progress', state => {
|
importer.on('progress', state => {
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
type: 'import-progress',
|
type: 'import-progress',
|
||||||
payload: state
|
payload: state
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
importer.on('query-error', state => {
|
importer.on('query-error', state => {
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
type: 'query-error',
|
type: 'query-error',
|
||||||
payload: state
|
payload: state
|
||||||
});
|
});
|
||||||
@@ -84,8 +90,8 @@ process.on('message', async ({ type, dbConfig, options }: {
|
|||||||
importer.run();
|
importer.run();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
log.error(err.toString());
|
||||||
process.send({
|
parentPort.postMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
payload: err.toString()
|
payload: err.toString()
|
||||||
});
|
});
|
||||||
@@ -93,20 +99,6 @@ process.on('message', async ({ type, dbConfig, options }: {
|
|||||||
}
|
}
|
||||||
else if (type === 'cancel')
|
else if (type === 'cancel')
|
||||||
importer.cancel();
|
importer.cancel();
|
||||||
});
|
};
|
||||||
|
|
||||||
process.on('uncaughtException', (err) => {
|
parentPort.on('message', importHandler);
|
||||||
console.error(err);
|
|
||||||
process.send({
|
|
||||||
type: 'error',
|
|
||||||
payload: err.toString()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
process.on('unhandledRejection', (err) => {
|
|
||||||
console.error(err);
|
|
||||||
process.send({
|
|
||||||
type: 'error',
|
|
||||||
payload: err.toString()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
@@ -133,6 +133,7 @@ import BaseIcon from '@/components/BaseIcon.vue';
|
|||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll.vue';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll.vue';
|
||||||
import { useFilters } from '@/composables/useFilters';
|
import { useFilters } from '@/composables/useFilters';
|
||||||
import { useFocusTrap } from '@/composables/useFocusTrap';
|
import { useFocusTrap } from '@/composables/useFocusTrap';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { useConnectionsStore } from '@/stores/connections';
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
import { HistoryRecord, useHistoryStore } from '@/stores/history';
|
import { HistoryRecord, useHistoryStore } from '@/stores/history';
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ watch(searchTerm, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const copyQuery = (sql: string) => {
|
const copyQuery = (sql: string) => {
|
||||||
navigator.clipboard.writeText(sql);
|
copyText(sql);
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteQuery = (query: HistoryRecord[]) => {
|
const deleteQuery = (query: HistoryRecord[]) => {
|
||||||
|
@@ -161,6 +161,7 @@ import ModalProcessesListContext from '@/components/ModalProcessesListContext.vu
|
|||||||
import ModalProcessesListRow from '@/components/ModalProcessesListRow.vue';
|
import ModalProcessesListRow from '@/components/ModalProcessesListRow.vue';
|
||||||
import { useFocusTrap } from '@/composables/useFocusTrap';
|
import { useFocusTrap } from '@/composables/useFocusTrap';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { useConnectionsStore } from '@/stores/connections';
|
import { useConnectionsStore } from '@/stores/connections';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
|
|
||||||
@@ -322,13 +323,13 @@ const closeContext = () => {
|
|||||||
const copyCell = () => {
|
const copyCell = () => {
|
||||||
const row = results.value.find(row => Number(row.id) === selectedRow.value);
|
const row = results.value.find(row => Number(row.id) === selectedRow.value);
|
||||||
const valueToCopy = row[selectedCell.value.field];
|
const valueToCopy = row[selectedCell.value.field];
|
||||||
navigator.clipboard.writeText(valueToCopy);
|
copyText(valueToCopy);
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyRow = () => {
|
const copyRow = () => {
|
||||||
const row = results.value.find(row => Number(row.id) === selectedRow.value);
|
const row = results.value.find(row => Number(row.id) === selectedRow.value);
|
||||||
const rowToCopy = JSON.parse(JSON.stringify(row));
|
const rowToCopy = JSON.parse(JSON.stringify(row));
|
||||||
navigator.clipboard.writeText(JSON.stringify(rowToCopy));
|
copyText(JSON.stringify(rowToCopy));
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeModal = () => emit('close');
|
const closeModal = () => emit('close');
|
||||||
|
@@ -15,6 +15,14 @@
|
|||||||
:size="18"
|
:size="18"
|
||||||
/> {{ t('connection.disconnect') }}</span>
|
/> {{ t('connection.disconnect') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="context-element" @click.stop="showAppearanceModal">
|
||||||
|
<span class="d-flex">
|
||||||
|
<BaseIcon
|
||||||
|
class="text-light mt-1 mr-1"
|
||||||
|
icon-name="mdiBrushVariant"
|
||||||
|
:size="18"
|
||||||
|
/> {{ t('application.appearance') }}</span>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="!contextConnection.isFolder"
|
v-if="!contextConnection.isFolder"
|
||||||
class="context-element"
|
class="context-element"
|
||||||
@@ -27,14 +35,6 @@
|
|||||||
:size="18"
|
:size="18"
|
||||||
/> {{ t('general.duplicate') }}</span>
|
/> {{ t('general.duplicate') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click.stop="showAppearanceModal">
|
|
||||||
<span class="d-flex">
|
|
||||||
<BaseIcon
|
|
||||||
class="text-light mt-1 mr-1"
|
|
||||||
icon-name="mdiBrushVariant"
|
|
||||||
:size="18"
|
|
||||||
/> {{ t('application.appearance') }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="context-element" @click="showConfirmModal">
|
<div class="context-element" @click="showConfirmModal">
|
||||||
<span class="d-flex">
|
<span class="d-flex">
|
||||||
<BaseIcon
|
<BaseIcon
|
||||||
|
@@ -84,12 +84,15 @@
|
|||||||
@click="showSettingModal('general')"
|
@click="showSettingModal('general')"
|
||||||
>
|
>
|
||||||
<div class="settingbar-element-icon-wrapper">
|
<div class="settingbar-element-icon-wrapper">
|
||||||
<BaseIcon
|
<div
|
||||||
icon-name="mdiCog"
|
|
||||||
class="settingbar-element-icon text-light"
|
class="settingbar-element-icon text-light"
|
||||||
:class="{ 'badge badge-update': hasUpdates }"
|
:class="{ 'badge badge-update': hasUpdates }"
|
||||||
:size="24"
|
>
|
||||||
/>
|
<BaseIcon
|
||||||
|
icon-name="mdiCog"
|
||||||
|
:size="24"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -266,7 +269,7 @@ if (!connectionsArr.value.length)
|
|||||||
.settingbar-element-icon {
|
.settingbar-element-icon {
|
||||||
&.badge::after {
|
&.badge::after {
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: -6px;
|
right: -3px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,6 +55,14 @@
|
|||||||
/> {{ t('general.disable') }}
|
/> {{ t('general.disable') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="context-element" @click="copyName(selectedMisc.name)">
|
||||||
|
<span class="d-flex">
|
||||||
|
<BaseIcon
|
||||||
|
class="text-light mt-1 mr-1"
|
||||||
|
icon-name="mdiContentCopy"
|
||||||
|
:size="18"
|
||||||
|
/> {{ t('general.copyName') }}</span>
|
||||||
|
</div>
|
||||||
<div class="context-element" @click="showDeleteModal">
|
<div class="context-element" @click="showDeleteModal">
|
||||||
<span class="d-flex">
|
<span class="d-flex">
|
||||||
<BaseIcon
|
<BaseIcon
|
||||||
@@ -108,6 +116,7 @@ import Functions from '@/ipc-api/Functions';
|
|||||||
import Routines from '@/ipc-api/Routines';
|
import Routines from '@/ipc-api/Routines';
|
||||||
import Schedulers from '@/ipc-api/Schedulers';
|
import Schedulers from '@/ipc-api/Schedulers';
|
||||||
import Triggers from '@/ipc-api/Triggers';
|
import Triggers from '@/ipc-api/Triggers';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
|
|
||||||
@@ -163,6 +172,11 @@ const deleteMessage = computed(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const copyName = (name: string) => {
|
||||||
|
copyText(name);
|
||||||
|
closeContext();
|
||||||
|
};
|
||||||
|
|
||||||
const showDeleteModal = () => {
|
const showDeleteModal = () => {
|
||||||
isDeleteModal.value = true;
|
isDeleteModal.value = true;
|
||||||
};
|
};
|
||||||
|
@@ -102,6 +102,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="context-element" @click="copyName(selectedSchema)">
|
||||||
|
<span class="d-flex">
|
||||||
|
<BaseIcon
|
||||||
|
class="text-light mt-1 mr-1"
|
||||||
|
icon-name="mdiContentCopy"
|
||||||
|
:size="18"
|
||||||
|
/> {{ t('general.copyName') }}</span>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="workspace.customizations.schemaExport"
|
v-if="workspace.customizations.schemaExport"
|
||||||
class="context-element"
|
class="context-element"
|
||||||
@@ -198,6 +206,7 @@ import ModalEditSchema from '@/components/ModalEditSchema.vue';
|
|||||||
import ModalImportSchema from '@/components/ModalImportSchema.vue';
|
import ModalImportSchema from '@/components/ModalImportSchema.vue';
|
||||||
import Application from '@/ipc-api/Application';
|
import Application from '@/ipc-api/Application';
|
||||||
import Schema from '@/ipc-api/Schema';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useSchemaExportStore } from '@/stores/schemaExport';
|
import { useSchemaExportStore } from '@/stores/schemaExport';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
@@ -268,6 +277,11 @@ const openCreateSchedulerTab = () => {
|
|||||||
emit('open-create-scheduler-tab');
|
emit('open-create-scheduler-tab');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyName = (name: string) => {
|
||||||
|
copyText(name);
|
||||||
|
closeContext();
|
||||||
|
};
|
||||||
|
|
||||||
const showDeleteModal = () => {
|
const showDeleteModal = () => {
|
||||||
isDeleteModal.value = true;
|
isDeleteModal.value = true;
|
||||||
};
|
};
|
||||||
|
@@ -15,6 +15,14 @@
|
|||||||
:size="18"
|
:size="18"
|
||||||
/> {{ t('application.settings') }}</span>
|
/> {{ t('application.settings') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="context-element" @click="copyName(selectedTable.name)">
|
||||||
|
<span class="d-flex">
|
||||||
|
<BaseIcon
|
||||||
|
class="text-light mt-1 mr-1"
|
||||||
|
icon-name="mdiContentCopy"
|
||||||
|
:size="18"
|
||||||
|
/> {{ t('general.copyName') }}</span>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="selectedTable && selectedTable.type === 'table' && customizations.schemaExport"
|
v-if="selectedTable && selectedTable.type === 'table' && customizations.schemaExport"
|
||||||
class="context-element"
|
class="context-element"
|
||||||
@@ -130,6 +138,7 @@ import ConfirmModal from '@/components/BaseConfirmModal.vue';
|
|||||||
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||||
import BaseIcon from '@/components/BaseIcon.vue';
|
import BaseIcon from '@/components/BaseIcon.vue';
|
||||||
import Tables from '@/ipc-api/Tables';
|
import Tables from '@/ipc-api/Tables';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { useNotificationsStore } from '@/stores/notifications';
|
import { useNotificationsStore } from '@/stores/notifications';
|
||||||
import { useSchemaExportStore } from '@/stores/schemaExport';
|
import { useSchemaExportStore } from '@/stores/schemaExport';
|
||||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||||
@@ -170,6 +179,11 @@ const showTableExportModal = () => {
|
|||||||
closeContext();
|
closeContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyName = (name: string) => {
|
||||||
|
copyText(name);
|
||||||
|
closeContext();
|
||||||
|
};
|
||||||
|
|
||||||
const showDeleteModal = () => {
|
const showDeleteModal = () => {
|
||||||
isDeleteModal.value = true;
|
isDeleteModal.value = true;
|
||||||
};
|
};
|
||||||
|
@@ -52,6 +52,7 @@ import { useI18n } from 'vue-i18n';
|
|||||||
|
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||||
import BaseIcon from '@/components/BaseIcon.vue';
|
import BaseIcon from '@/components/BaseIcon.vue';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { useConsoleStore } from '@/stores/console';
|
import { useConsoleStore } from '@/stores/console';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -100,7 +101,7 @@ const contextMenu = (event: MouseEvent, wLog: {date: Date; sql: string}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const copyQuery = () => {
|
const copyQuery = () => {
|
||||||
navigator.clipboard.writeText(contextQuery.value);
|
copyText(contextQuery.value);
|
||||||
isContext.value = false;
|
isContext.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -270,6 +270,7 @@ import BaseSelect from '@/components/BaseSelect.vue';
|
|||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll.vue';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll.vue';
|
||||||
import TableContext from '@/components/WorkspaceTabQueryTableContext.vue';
|
import TableContext from '@/components/WorkspaceTabQueryTableContext.vue';
|
||||||
import WorkspaceTabQueryTableRow from '@/components/WorkspaceTabQueryTableRow.vue';
|
import WorkspaceTabQueryTableRow from '@/components/WorkspaceTabQueryTableRow.vue';
|
||||||
|
import { copyText } from '@/libs/copyText';
|
||||||
import { unproxify } from '@/libs/unproxify';
|
import { unproxify } from '@/libs/unproxify';
|
||||||
import { useConsoleStore } from '@/stores/console';
|
import { useConsoleStore } from '@/stores/console';
|
||||||
import { useSettingsStore } from '@/stores/settings';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
@@ -571,7 +572,7 @@ const copyCell = () => {
|
|||||||
let valueToCopy = row[cellName];
|
let valueToCopy = row[cellName];
|
||||||
if (typeof valueToCopy === 'object')
|
if (typeof valueToCopy === 'object')
|
||||||
valueToCopy = JSON.stringify(valueToCopy);
|
valueToCopy = JSON.stringify(valueToCopy);
|
||||||
navigator.clipboard.writeText(valueToCopy);
|
copyText(valueToCopy);
|
||||||
};
|
};
|
||||||
|
|
||||||
const copyRow = (format: string) => {
|
const copyRow = (format: string) => {
|
||||||
@@ -593,7 +594,7 @@ const copyRow = (format: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (format === 'json')
|
if (format === 'json')
|
||||||
navigator.clipboard.writeText(JSON.stringify(contentToCopy));
|
copyText(JSON.stringify(contentToCopy));
|
||||||
else if (format === 'sql') {
|
else if (format === 'sql') {
|
||||||
if (!Array.isArray(contentToCopy)) contentToCopy = [contentToCopy];
|
if (!Array.isArray(contentToCopy)) contentToCopy = [contentToCopy];
|
||||||
|
|
||||||
@@ -605,7 +606,7 @@ const copyRow = (format: string) => {
|
|||||||
},
|
},
|
||||||
table: getTable(resultsetIndex.value)
|
table: getTable(resultsetIndex.value)
|
||||||
});
|
});
|
||||||
navigator.clipboard.writeText(sqlInserts);
|
copyText(sqlInserts);
|
||||||
}
|
}
|
||||||
else if (format === 'csv') {
|
else if (format === 'csv') {
|
||||||
const csv = [];
|
const csv = [];
|
||||||
@@ -617,7 +618,7 @@ const copyRow = (format: string) => {
|
|||||||
for (const row of contentToCopy)
|
for (const row of contentToCopy)
|
||||||
csv.push(Object.values(row).map(col => typeof col === 'string' ? `"${col}"` : col).join(';'));
|
csv.push(Object.values(row).map(col => typeof col === 'string' ? `"${col}"` : col).join(';'));
|
||||||
|
|
||||||
navigator.clipboard.writeText(csv.join('\n'));
|
copyText(csv.join('\n'));
|
||||||
}
|
}
|
||||||
else if (format === 'html') {
|
else if (format === 'html') {
|
||||||
const arrayContent = new Array<string[]>();
|
const arrayContent = new Array<string[]>();
|
||||||
@@ -640,7 +641,7 @@ const copyRow = (format: string) => {
|
|||||||
if (!Array.isArray(contentToCopy)) contentToCopy = [contentToCopy];
|
if (!Array.isArray(contentToCopy)) contentToCopy = [contentToCopy];
|
||||||
const printer = json2php.make({ linebreak: '\n', indent: '\t', shortArraySyntax: true });
|
const printer = json2php.make({ linebreak: '\n', indent: '\t', shortArraySyntax: true });
|
||||||
const phpString = printer(contentToCopy);
|
const phpString = printer(contentToCopy);
|
||||||
navigator.clipboard.writeText(phpString);
|
copyText(phpString);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -878,7 +879,7 @@ const onKey = async (e: KeyboardEvent) => {
|
|||||||
const copyType = defaultCopyType.value;
|
const copyType = defaultCopyType.value;
|
||||||
if (selectedRows.value.length >= 1) {
|
if (selectedRows.value.length >= 1) {
|
||||||
if (selectedRows.value.length === 1 && copyType === 'cell')
|
if (selectedRows.value.length === 1 && copyType === 'cell')
|
||||||
await navigator.clipboard.writeText(scrollElement.value.querySelector('.td.selected').innerText);
|
await copyText(scrollElement.value.querySelector('.td.selected').innerText);
|
||||||
else if (selectedRows.value.length > 1 && copyType === 'cell')
|
else if (selectedRows.value.length > 1 && copyType === 'cell')
|
||||||
copyRow('html');
|
copyRow('html');
|
||||||
else
|
else
|
||||||
|
@@ -65,7 +65,8 @@ export const enUS = {
|
|||||||
actionSuccessful: '{action} successful',
|
actionSuccessful: '{action} successful',
|
||||||
outputFormat: 'Output format',
|
outputFormat: 'Output format',
|
||||||
singleFile: 'Single {ext} file',
|
singleFile: 'Single {ext} file',
|
||||||
zipCompressedFile: 'ZIP compressed {ext} file'
|
zipCompressedFile: 'ZIP compressed {ext} file',
|
||||||
|
copyName: 'Copy name'
|
||||||
},
|
},
|
||||||
connection: { // Database connection
|
connection: { // Database connection
|
||||||
connectionName: 'Connection name',
|
connectionName: 'Connection name',
|
||||||
|
7
src/renderer/libs/copyText.ts
Normal file
7
src/renderer/libs/copyText.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Copy a string on clipboard
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
export const copyText = (text: string) => {
|
||||||
|
navigator.clipboard.writeText(text);
|
||||||
|
};
|
@@ -2,9 +2,18 @@ import * as Store from 'electron-store';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
const persistentStore = new Store({ name: 'notes' });
|
const persistentStore = new Store({ name: 'notes' });
|
||||||
|
|
||||||
|
export interface ConnectionNote {
|
||||||
|
uid: string;
|
||||||
|
note: string;
|
||||||
|
date: Date;
|
||||||
|
}
|
||||||
|
|
||||||
export const useScratchpadStore = defineStore('scratchpad', {
|
export const useScratchpadStore = defineStore('scratchpad', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n') as string
|
/** Global notes */
|
||||||
|
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n') as string,
|
||||||
|
/** Connection specific notes */
|
||||||
|
connectionNotes: persistentStore.get('connectionNotes', {}) as {[k: string]: ConnectionNote}
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
changeNotes (notes: string) {
|
changeNotes (notes: string) {
|
||||||
|
@@ -19,7 +19,15 @@ module.exports = { // Main
|
|||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs2',
|
libraryTarget: 'commonjs2',
|
||||||
path: path.join(__dirname, 'dist'),
|
path: path.join(__dirname, 'dist'),
|
||||||
filename: '[name].js'
|
filename: '[name].js',
|
||||||
|
assetModuleFilename: (pathData) => {
|
||||||
|
const { filename } = pathData;
|
||||||
|
|
||||||
|
if (filename.endsWith('.ts'))
|
||||||
|
return '[name].js';
|
||||||
|
else
|
||||||
|
return '[name][ext]';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
global: true,
|
global: true,
|
||||||
@@ -43,7 +51,8 @@ module.exports = { // Main
|
|||||||
new ProgressPlugin(true),
|
new ProgressPlugin(true),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
PACKAGE_VERSION: `"${version}"`
|
PACKAGE_VERSION: `"${version}"`,
|
||||||
|
DISTRIBUTION: `"${process.env.DISTRIBUTION || 'none'}"`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
@@ -62,7 +62,8 @@ const config = {
|
|||||||
new ProgressPlugin(true),
|
new ProgressPlugin(true),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
PACKAGE_VERSION: `"${version}"`
|
PACKAGE_VERSION: `"${version}"`,
|
||||||
|
DISTRIBUTION: `"${process.env.DISTRIBUTION || 'none'}"`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user