Compare commits
145 Commits
Author | SHA1 | Date | |
---|---|---|---|
c9ccf786cd | |||
5e9c88a7fd | |||
e0e6483d1f | |||
66227569f4 | |||
faa799c8ea | |||
acc1eeb094 | |||
865dad80df | |||
f502620779 | |||
f61d7eeaf4 | |||
e71c7568c0 | |||
79f033e524 | |||
310cfaa3c2 | |||
6f93e1f9ab | |||
04bdd085a5 | |||
c568acae14 | |||
7a46a119d8 | |||
f1636f1528 | |||
f839d5cd3c | |||
8f4f1d393c | |||
ab17c6d4bf | |||
b4b2f3d0cf | |||
7a766f04e6 | |||
f6b77d1243 | |||
840241c3cc | |||
0f10c9e824 | |||
1e37f2a96f | |||
0d6137195d | |||
d26f168250 | |||
5efcad4d3f | |||
0a872e7023 | |||
0e425a9c6d | |||
434711a360 | |||
854472c7a3 | |||
9a7cd90d5c | |||
026400d242 | |||
4bd8cbbf6c | |||
1382bc9300 | |||
ae103e5477 | |||
6b0b8b19d7 | |||
475397ca34 | |||
7a62131cc7 | |||
c7663be338 | |||
496490b14a | |||
|
672573d8c2 | ||
d923453919 | |||
0435279604 | |||
79cef61fea | |||
dec334737f | |||
84c3692e95 | |||
5dc0b0bea4 | |||
19d16e46bb | |||
3baf6fa173 | |||
29e2d92b5b | |||
bebba64d06 | |||
9dfe7cca22 | |||
35ef070725 | |||
370ad6a536 | |||
5822b3df43 | |||
5208ec171b | |||
6e332da425 | |||
bf3367b41d | |||
ecfb732c26 | |||
fd4f032a6f | |||
1b09909126 | |||
04cd806954 | |||
773cb36ca1 | |||
ccacd3e2c3 | |||
15948b30c9 | |||
3dcb5d4f14 | |||
|
64d93d7c40 | ||
|
2d85295093 | ||
|
cd58e2d8ca | ||
d87495822e | |||
|
8720bcdad6 | ||
1df57dc705 | |||
86240fb53c | |||
1d363f755e | |||
0d77aee3eb | |||
a41cf1ab56 | |||
5ceddb8e00 | |||
16e17b39b6 | |||
20cba6ee9b | |||
9ffd443a66 | |||
f82dbd24dc | |||
6eb2977568 | |||
cafb65560a | |||
532d963019 | |||
1b0a63ff31 | |||
c22187c305 | |||
dcccb544f9 | |||
7d2ace9456 | |||
2584c9b9c2 | |||
a6b75ad0dc | |||
90fd9db917 | |||
c0f54b9514 | |||
cd31413256 | |||
b33199ea59 | |||
dea5ec7513 | |||
be816e8588 | |||
1e938adc5d | |||
8735a0c5f9 | |||
3dde1c109e | |||
d0b3e1b1b8 | |||
c20bff7bcb | |||
9f5ec0276c | |||
55932fe115 | |||
d374372e20 | |||
bb5f44681f | |||
49a4e1cb7b | |||
c2f76e490a | |||
e349dd5eab | |||
280697698e | |||
0783f8b57e | |||
c981244d7a | |||
dcb135dd01 | |||
99f7511c4d | |||
fe4c8e12b3 | |||
21728a663d | |||
9ca03f4625 | |||
affb7288b0 | |||
614e0d3275 | |||
feef5e30ee | |||
82c25711b6 | |||
2ca2988832 | |||
e3f259c6e8 | |||
e7401cc96e | |||
13b9840f3d | |||
d20414b692 | |||
22a8c25717 | |||
db47b4040a | |||
e89911b185 | |||
fccfe92453 | |||
d465e18dba | |||
ffb1712a59 | |||
9f6a183d9b | |||
1f80a64fe1 | |||
fc651149b9 | |||
964570247f | |||
8a6c59f7ce | |||
4d844fe2c9 | |||
d892fa6fb3 | |||
8c9e4f6e96 | |||
966ca60c89 | |||
9bbe218f90 | |||
a1c6be372b |
44
.eslintrc
@@ -9,22 +9,25 @@
|
|||||||
"plugin:vue/recommended"
|
"plugin:vue/recommended"
|
||||||
],
|
],
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"parser": "babel-eslint",
|
"parser": "@babel/eslint-parser",
|
||||||
"ecmaVersion": 9,
|
"ecmaVersion": 9,
|
||||||
"sourceType": "module"
|
"sourceType": "module",
|
||||||
|
"requireConfigFile": false
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": [
|
"indent": [
|
||||||
"error",
|
"error",
|
||||||
3,
|
3,
|
||||||
{ "SwitchCase": 1 }
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"linebreak-style": [
|
"linebreak-style": [
|
||||||
"error",
|
"error",
|
||||||
"unix"
|
"unix"
|
||||||
],
|
],
|
||||||
"brace-style": [
|
"brace-style": [
|
||||||
"error",
|
"error",
|
||||||
"stroustrup"
|
"stroustrup"
|
||||||
],
|
],
|
||||||
"quotes": [
|
"quotes": [
|
||||||
@@ -36,7 +39,7 @@
|
|||||||
"always"
|
"always"
|
||||||
],
|
],
|
||||||
"curly": [
|
"curly": [
|
||||||
"error",
|
"error",
|
||||||
"multi-or-nest"
|
"multi-or-nest"
|
||||||
],
|
],
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
@@ -44,18 +47,25 @@
|
|||||||
"vue/no-side-effects-in-computed-properties": "off",
|
"vue/no-side-effects-in-computed-properties": "off",
|
||||||
"vue/require-default-prop": "off",
|
"vue/require-default-prop": "off",
|
||||||
"vue/no-v-html": "off",
|
"vue/no-v-html": "off",
|
||||||
"vue/html-indent": ["error", 3, {
|
"vue/html-indent": [
|
||||||
"attribute": 1,
|
"error",
|
||||||
"baseIndent": 1,
|
3,
|
||||||
"closeBracket": 0,
|
{
|
||||||
"ignores": []
|
"attribute": 1,
|
||||||
}],
|
"baseIndent": 1,
|
||||||
"vue/max-attributes-per-line": ["error", {
|
"closeBracket": 0,
|
||||||
"singleline": 2,
|
"ignores": []
|
||||||
"multiline": {
|
|
||||||
"max": 1,
|
|
||||||
"allowFirstLine": false
|
|
||||||
}
|
}
|
||||||
}]
|
],
|
||||||
|
"vue/max-attributes-per-line": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"singleline": 2,
|
||||||
|
"multiline": {
|
||||||
|
"max": 1,
|
||||||
|
"allowFirstLine": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
2
.github/FUNDING.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: [fabio286]
|
github: [fabio286]
|
||||||
patreon: fabio286
|
patreon: #fabio286
|
||||||
open_collective: # Replace with a single Open Collective username
|
open_collective: # Replace with a single Open Collective username
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
20
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -3,7 +3,7 @@ name: Bug report
|
|||||||
about: Create a report to help us improve
|
about: Create a report to help us improve
|
||||||
title: ''
|
title: ''
|
||||||
labels: ''
|
labels: ''
|
||||||
assignees: ''
|
assignees: Fabio286
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
|
|||||||
|
|
||||||
**To Reproduce**
|
**To Reproduce**
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
@@ -23,16 +24,15 @@ A clear and concise description of what you expected to happen.
|
|||||||
**Screenshots**
|
**Screenshots**
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Application (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
|
||||||
- Browser [e.g. chrome, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Smartphone (please complete the following information):**
|
- Version [e.g. 0.14.0]
|
||||||
- Device: [e.g. iPhone6]
|
- Distribution: [e.g. exe, Linux Store, AppImage, dmg]
|
||||||
- OS: [e.g. iOS8.1]
|
|
||||||
- Browser [e.g. stock browser, safari]
|
**Desktop (please complete the following information):**
|
||||||
- Version [e.g. 22]
|
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -3,7 +3,7 @@ name: Feature request
|
|||||||
about: Suggest an idea for this project
|
about: Suggest an idea for this project
|
||||||
title: ''
|
title: ''
|
||||||
labels: ''
|
labels: ''
|
||||||
assignees: ''
|
assignees: Fabio286
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
26
.github/workflows/build-linux.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Build/release [linux]
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install Node.js, NPM and Yarn
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
|
||||||
|
- name: Build/release Electron app
|
||||||
|
uses: samuelmeuli/action-electron-builder@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
26
.github/workflows/build-mac.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Build/release [mac]
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install Node.js, NPM and Yarn
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
|
||||||
|
- name: Build/release Electron app
|
||||||
|
uses: samuelmeuli/action-electron-builder@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
26
.github/workflows/build-win.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Build/release [windows]
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [windows-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install Node.js, NPM and Yarn
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
|
||||||
|
- name: Build/release Electron app
|
||||||
|
uses: samuelmeuli/action-electron-builder@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
@@ -8,7 +8,8 @@
|
|||||||
"stylelint-scss"
|
"stylelint-scss"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"at-rule-no-unknown": null
|
"at-rule-no-unknown": null,
|
||||||
|
"no-descending-specificity": null
|
||||||
},
|
},
|
||||||
"syntax": "scss"
|
"syntax": "scss"
|
||||||
}
|
}
|
52
.travis.yml
@@ -1,52 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js: 12
|
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- node_modules
|
|
||||||
- app/node_modules
|
|
||||||
- $HOME/.cache/electron
|
|
||||||
- $HOME/.cache/electron-builder
|
|
||||||
- $HOME/.npm/_prebuilds
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- ELECTRON_CACHE=$HOME/.cache/electron
|
|
||||||
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- stage: Test
|
|
||||||
before_install:
|
|
||||||
- sudo apt-get install libsecret-1-dev
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm test
|
|
||||||
|
|
||||||
- stage: Deploy Linux & Windows
|
|
||||||
if: tag IS present
|
|
||||||
os: linux
|
|
||||||
services: docker
|
|
||||||
before_install:
|
|
||||||
- sudo apt-get install libsecret-1-dev
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- docker run --rm --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') -v ${PWD}:/project -v ~/.cache/electron:/root/.cache/electron -v ~/.cache/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine /bin/bash -c "npm run build -- --linux --win -p always"
|
|
||||||
before_cache:
|
|
||||||
- rm -rf $HOME/.cache/electron-builder/wine
|
|
||||||
|
|
||||||
- stage: Deploy Mac
|
|
||||||
if: tag IS present
|
|
||||||
os: osx
|
|
||||||
before_install:
|
|
||||||
- npm install
|
|
||||||
osx_image: xcode10.2
|
|
||||||
script:
|
|
||||||
- npm run build -- -p always
|
|
||||||
|
|
||||||
# - stage: Deploy ARM Linux
|
|
||||||
# if: tag IS present
|
|
||||||
# os: linux
|
|
||||||
# arch: arm64
|
|
||||||
# script:
|
|
||||||
# - npm run build -- --linux AppImage -p always
|
|
209
CHANGELOG.md
@@ -2,6 +2,215 @@
|
|||||||
|
|
||||||
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.1.11](https://github.com/Fabio286/antares/compare/v0.1.10...v0.1.11) (2021-06-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **UI:** prevent canc key to trigger delete modal when editing a row ([5e9c88a](https://github.com/Fabio286/antares/commit/5e9c88a7fd656dd69b92ba4384ca81f4e8cdd422))
|
||||||
|
* table row loses internal id after cell update ([6622756](https://github.com/Fabio286/antares/commit/66227569f4c032298e20d44c253d30109ffde0b2))
|
||||||
|
* **MySQL:** missing schema altering tables in some conditions ([faa799c](https://github.com/Fabio286/antares/commit/faa799c8ea2329e7ca1b54c9414a060bc8a2a840))
|
||||||
|
* empty offset in cell update queries ([acc1eeb](https://github.com/Fabio286/antares/commit/acc1eeb0948db35f2c9a4d85d70fb654b41b15e5))
|
||||||
|
|
||||||
|
### [0.1.10](https://github.com/Fabio286/antares/compare/v0.1.9...v0.1.10) (2021-05-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* key shortcuts to change DATA tab page ([f61d7ee](https://github.com/Fabio286/antares/commit/f61d7eeaf42406eb88b3285ac4606794f56e88d3))
|
||||||
|
* option to set DATA tab page size ([e71c756](https://github.com/Fabio286/antares/commit/e71c7568c09bf8ad184753d3d0f14046f1e386d0))
|
||||||
|
* prev/next buttons to browse the results pages of data tab ([79f033e](https://github.com/Fabio286/antares/commit/79f033e5245e0e744c35540d25a30b1eadc4d603))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **MySQL:** wrong schema in view data tab select, closes [#71](https://github.com/Fabio286/antares/issues/71) ([310cfaa](https://github.com/Fabio286/antares/commit/310cfaa3c2324b1159a46be566b6af2555dc9732))
|
||||||
|
* wrong detection of field default expressions in some cases ([04bdd08](https://github.com/Fabio286/antares/commit/04bdd085a56240273133586d23196e52341d5f27))
|
||||||
|
|
||||||
|
### [0.1.9](https://github.com/Fabio286/antares/compare/v0.1.8...v0.1.9) (2021-05-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **MySQL:** can't access tables having UNIQUE KEY, closes [#69](https://github.com/Fabio286/antares/issues/69) ([f1636f1](https://github.com/Fabio286/antares/commit/f1636f1528b5765423535f84027fdc853c58ce80))
|
||||||
|
|
||||||
|
### [0.1.8](https://github.com/Fabio286/antares/compare/v0.1.7...v0.1.8) (2021-05-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* internal id not removed before row update ([0f10c9e](https://github.com/Fabio286/antares/commit/0f10c9e824b679cfebd8a31085236da3d38a7953))
|
||||||
|
* unable to add new ENUM fields ([1e37f2a](https://github.com/Fabio286/antares/commit/1e37f2a96f660a36f2739fea57ca298059e9c31a))
|
||||||
|
* unable to delete table rows ([0d61371](https://github.com/Fabio286/antares/commit/0d6137195da9e0e9afe68f6d3ebcd50e913a888e))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* improved the way how field default value are handled ([7a766f0](https://github.com/Fabio286/antares/commit/7a766f04e668868e8844aac1d7d445bc2da21558))
|
||||||
|
|
||||||
|
### [0.1.7](https://github.com/Fabio286/antares/compare/v0.1.6...v0.1.7) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* row loses internal id after cell update ([854472c](https://github.com/Fabio286/antares/commit/854472c7a3d8442b1eede12f978cad5aa684094e))
|
||||||
|
* **MySQL:** connection loses schema in some conditions ([6b0b8b1](https://github.com/Fabio286/antares/commit/6b0b8b19d7176ef8647d6f401a33315f8732fdf3))
|
||||||
|
* issue with ENUM and SET fields on table filler modal ([475397c](https://github.com/Fabio286/antares/commit/475397ca34c5b7d8925e2d97d32216d5b80d8211))
|
||||||
|
* issue with ENUM and SET length when creating a new field ([7a62131](https://github.com/Fabio286/antares/commit/7a62131cc707aa1c98bb12513de76229472b7c38))
|
||||||
|
* multiple row select on sorted tables not work properly ([c7663be](https://github.com/Fabio286/antares/commit/c7663be338ccb5ff31e241e824593531ad95bd32))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* **core:** increased connection pool size to improve performance ([ae103e5](https://github.com/Fabio286/antares/commit/ae103e5477ad190c541d0f29e277c41de6947063))
|
||||||
|
* **MySQL:** improved connections pool handling ([434711a](https://github.com/Fabio286/antares/commit/434711a360bd7539d2ec3adec92e7ccc96fa828e))
|
||||||
|
|
||||||
|
### [0.1.6](https://github.com/Fabio286/antares/compare/v0.1.5...v0.1.6) (2021-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **MySQL:** ENUM and SET fields support, closes [#61](https://github.com/Fabio286/antares/issues/61) ([bebba64](https://github.com/Fabio286/antares/commit/bebba64d06532990405763284e27cb768dc050f7))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* better detection and handling of field default type ([3baf6fa](https://github.com/Fabio286/antares/commit/3baf6fa1736a405c95fb02d17c11514861ca9e04))
|
||||||
|
* no quotes around strings in field default custom value ([29e2d92](https://github.com/Fabio286/antares/commit/29e2d92b5bf66ff9e80bb1fee1274967c4418601))
|
||||||
|
* **UI:** data type figure twice on type select ([9dfe7cc](https://github.com/Fabio286/antares/commit/9dfe7cca2234ce6de512bb4c21205c2217e7f765))
|
||||||
|
* support to mDNS/zeroconf in snap build, closes [#58](https://github.com/Fabio286/antares/issues/58) ([35ef070](https://github.com/Fabio286/antares/commit/35ef070725f5779923bf3ad428b44accddf22dbe))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* italian translation updated ([5dc0b0b](https://github.com/Fabio286/antares/commit/5dc0b0bea40f9d5a5944af2f1c5dc6ff3e60c396))
|
||||||
|
|
||||||
|
### [0.1.5](https://github.com/Fabio286/antares/compare/v0.1.4...v0.1.5) (2021-04-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **MySQL:** multiple queries non properly split in some cases ([5208ec1](https://github.com/Fabio286/antares/commit/5208ec171b44da0e6bfa93f15bfedd03ef2aa868))
|
||||||
|
* % character not properly escaped, closes [#60](https://github.com/Fabio286/antares/issues/60) ([ecfb732](https://github.com/Fabio286/antares/commit/ecfb732c265a5485e131e75f3d20ff07d9409753))
|
||||||
|
* semicolon inside strings breaks queries, closes [#59](https://github.com/Fabio286/antares/issues/59) ([1b09909](https://github.com/Fabio286/antares/commit/1b0990912627a3a4a4e8d62b4593f8a7aa3a7fe5))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* **UI:** new application icon ([5822b3d](https://github.com/Fabio286/antares/commit/5822b3df432e0a2b305d0ff37a20dc466c3a3992))
|
||||||
|
|
||||||
|
### [0.1.4](https://github.com/Fabio286/antares/compare/v0.1.3...v0.1.4) (2021-04-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* query results export ([1d363f7](https://github.com/Fabio286/antares/commit/1d363f755e025d0fc6fec61cbd47ff87a8f25728))
|
||||||
|
* **UI:** canc press to delete selected rows ([20cba6e](https://github.com/Fabio286/antares/commit/20cba6ee9bc1daa902b04d6e2ddcb31d04fbf805))
|
||||||
|
* **UI:** ctrl+s shortcut to save changes ([16e17b3](https://github.com/Fabio286/antares/commit/16e17b39b6c8b561cc018d02afee2276190ce304))
|
||||||
|
* **UI:** format and clear queries ([9ffd443](https://github.com/Fabio286/antares/commit/9ffd443a66303f88fc4529896f6d1d7917454f7a))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* launch from shortcut of procedures or functions with parameters without name dont works ([f82dbd2](https://github.com/Fabio286/antares/commit/f82dbd24dcef7b4d8d127a604e256b3f79a6c617))
|
||||||
|
* wrong changelog in some cases ([a41cf1a](https://github.com/Fabio286/antares/commit/a41cf1ab5662f5f5fdedff4a9e1c626c23071377))
|
||||||
|
* **UI:** data type not listed in selection if not present in global types ([6eb2977](https://github.com/Fabio286/antares/commit/6eb2977568987b9440b62ae7dbd7183338bfcc9b))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* **UI:** improved connection status indicator ([5ceddb8](https://github.com/Fabio286/antares/commit/5ceddb8e00f3bc1984b8e47de270dc39b367903f))
|
||||||
|
|
||||||
|
### [0.1.3](https://github.com/Fabio286/antares/compare/v0.1.2...v0.1.3) (2021-04-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **PostgreSQL:** functions management ([cd31413](https://github.com/Fabio286/antares/commit/cd3141325681ea572c06b8998dd7bd334ceb3236))
|
||||||
|
* **PostgreSQL:** procedure language select ([b33199e](https://github.com/Fabio286/antares/commit/b33199ea59c60b467601f333857494aa40adf4e8))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **MySQL:** invalid JavaScript datetime values not shown ([dcccb54](https://github.com/Fabio286/antares/commit/dcccb544f9ec24ad693c9e81fb4bcfbdbb7cc4e1))
|
||||||
|
* approximate row count shown for results less than 1000 ([a6b75ad](https://github.com/Fabio286/antares/commit/a6b75ad0dc0d884332464c277e8542b2698630b9))
|
||||||
|
* field apparently loses index or foreign key on rename in table editor ([7d2ace9](https://github.com/Fabio286/antares/commit/7d2ace94562f8da307b15b83c89d919727d800c8))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* **MySQL:** improved the way to get routine and functions parameters ([90fd9db](https://github.com/Fabio286/antares/commit/90fd9db917c40262f2bc2501ab86f5feba3d8db4))
|
||||||
|
* **UI:** improved table fields suggestion in query editor ([c22187c](https://github.com/Fabio286/antares/commit/c22187c3053aef368a351cc35e2f1d407ecde209))
|
||||||
|
|
||||||
|
### [0.1.2](https://github.com/Fabio286/antares/compare/v0.1.1...v0.1.2) (2021-04-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* in-app last release changelog ([1e938ad](https://github.com/Fabio286/antares/commit/1e938adc5d8eb5ad16ab16342375eecd88f68d20))
|
||||||
|
* **PostgreSQL:** edit timezone in cell editor ([8735a0c](https://github.com/Fabio286/antares/commit/8735a0c5f9e5b6b3bcaadf37ce158aa7beae2c48))
|
||||||
|
* **PostgreSQL:** procedures management ([3dde1c1](https://github.com/Fabio286/antares/commit/3dde1c109e23342d94362626ef7350dc123ea859))
|
||||||
|
* **PostgreSQL:** support of arrays in table settings ([d0b3e1b](https://github.com/Fabio286/antares/commit/d0b3e1b1b8be9d2c038d70e16d4478671315de8f))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* cell edit doesn't properly use primary or unique index to update if both present, closes [#51](https://github.com/Fabio286/antares/issues/51) ([55932fe](https://github.com/Fabio286/antares/commit/55932fe11583bd5ff48f82b8408965adba4f5071))
|
||||||
|
* deletion of rows from query results ([c20bff7](https://github.com/Fabio286/antares/commit/c20bff7bcbe340ac99ebcacaba3359edd61c068a))
|
||||||
|
* no foreign key select when cell value is NULL, closes [#50](https://github.com/Fabio286/antares/issues/50) ([9f5ec02](https://github.com/Fabio286/antares/commit/9f5ec0276c92904975fdaea34b4c845c92bfe8d4))
|
||||||
|
* wrong datetime conversion when updating a row without an unique key ([d374372](https://github.com/Fabio286/antares/commit/d374372e208318d7e50b258a8041145bdf7992c5))
|
||||||
|
* **PostgreSQL:** issue with selected schema different than public ([49a4e1c](https://github.com/Fabio286/antares/commit/49a4e1cb7b24642641265d5830d3fee370cceeb4))
|
||||||
|
* **UI:** white readonly inputs with dark theme ([bb5f446](https://github.com/Fabio286/antares/commit/bb5f44681f87aacf2cd2f60a6d958c5732289790))
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
* **UI:** improved setting modal rendering ([be816e8](https://github.com/Fabio286/antares/commit/be816e85888b4f3d26cbb9caac0adbc4dde0ea94))
|
||||||
|
|
||||||
|
### [0.1.1](https://github.com/Fabio286/antares/compare/v0.1.0...v0.1.1) (2021-04-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* scratchpad to save persistent notes ([e349dd5](https://github.com/Fabio286/antares/commit/e349dd5eaba608591257f2799b830805e4936c27))
|
||||||
|
* **PostgreSQL:** foreign keys management ([fe4c8e1](https://github.com/Fabio286/antares/commit/fe4c8e12b39dd3cdfc233f07e3fe2ff0676252b0))
|
||||||
|
* **PostgreSQL:** indexes management ([9ca03f4](https://github.com/Fabio286/antares/commit/9ca03f462560b634970a19d3d97b878d60509acc))
|
||||||
|
* **PostgreSQL:** table fields edit ([e3f259c](https://github.com/Fabio286/antares/commit/e3f259c6e8327d71bd7dd0a9c33d957dc6ca1fb8))
|
||||||
|
* **PostgreSQL:** tables addition ([feef5e3](https://github.com/Fabio286/antares/commit/feef5e30eec915cbb219223cc428bd4e98d2e9c5))
|
||||||
|
* **PostgreSQL:** unique keys management ([614e0d3](https://github.com/Fabio286/antares/commit/614e0d32758c13b59139d349d4682a5bafc3ca88))
|
||||||
|
* **PostgreSQL:** views management ([99f7511](https://github.com/Fabio286/antares/commit/99f7511c4d5fab4030b30d5134cd03248167faea))
|
||||||
|
* **UI:** light theme ([2806976](https://github.com/Fabio286/antares/commit/280697698ea5fae6d54326970c823878888c196c))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **UI:** editor theme preview not properly loaded in some cases ([c981244](https://github.com/Fabio286/antares/commit/c981244d7aa93ca18ca2de44bf8df06f253b9d20))
|
||||||
|
* fields of ref. table not automatically loaded in foreign keys modal ([e7401cc](https://github.com/Fabio286/antares/commit/e7401cc96e76e00100a88eea9f40541fd8027adb))
|
||||||
|
* hide update tab for Windows Store distributions ([dcb135d](https://github.com/Fabio286/antares/commit/dcb135dd015b8f8c6cfb44021211bb8cf3089192))
|
||||||
|
|
||||||
|
## [0.1.0](https://github.com/Fabio286/antares/compare/v0.0.20...v0.1.0) (2021-03-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **PostgreSQL:** database in connection parameters ([9645702](https://github.com/Fabio286/antares/commit/964570247ff5b7b8317419730eec5bed4f0f0580))
|
||||||
|
* **PostgreSQL:** edit array and text search fields ([fc65114](https://github.com/Fabio286/antares/commit/fc651149b95399c52d2d63e946731e9c1b0303a9))
|
||||||
|
* **PostgreSQL:** insert and edit blob fields ([1f80a64](https://github.com/Fabio286/antares/commit/1f80a64fe1400baacca26f1a762c5aeb4ef6350d))
|
||||||
|
* **PostgreSQL:** partial postgre implementation ([d892fa6](https://github.com/Fabio286/antares/commit/d892fa6fb3e86fbb96887d8eb67319ae855260a1))
|
||||||
|
* **PostgreSQL:** support to microseconds ([d465e18](https://github.com/Fabio286/antares/commit/d465e18dba8ea3aa00726e33f9b1f70ca4c0683c))
|
||||||
|
* **UI:** support to boolean fields ([ffb1712](https://github.com/Fabio286/antares/commit/ffb1712a593d1421793011e48a17369b884ea3c0))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update or delete rows with more than one primary key ([22a8c25](https://github.com/Fabio286/antares/commit/22a8c25717a4d4b285855426098a3a2846ce7448))
|
||||||
|
* **MySQL:** handle NEWDECIMAL data type ([a1c6be3](https://github.com/Fabio286/antares/commit/a1c6be372b570cf13e89ef7ecf9b7a7c033a9293))
|
||||||
|
* **PostgreSQL:** issue getting foreign keys informations ([db47b40](https://github.com/Fabio286/antares/commit/db47b4040a5282a6ac0711b1926c4c2ac867999e))
|
||||||
|
* remove last char from datetime and time if is a dot ([e89911b](https://github.com/Fabio286/antares/commit/e89911b1851c19813d4acf2c79adfbc2ac7c1112))
|
||||||
|
* **PostgreSQL:** single quote escape ([9f6a183](https://github.com/Fabio286/antares/commit/9f6a183d9b293dfe9ad9f3759f2375f05f37db8e))
|
||||||
|
* **PostgreSQL:** various issues in query results ([fccfe92](https://github.com/Fabio286/antares/commit/fccfe92453325cd54c0331cc5670af0a56822c5b))
|
||||||
|
* schema content not loaded if selected with right click ([8a6c59f](https://github.com/Fabio286/antares/commit/8a6c59f7ce7d051315b04cea38a96e4739b5b9d3))
|
||||||
|
|
||||||
### [0.0.20](https://github.com/Fabio286/antares/compare/v0.0.19...v0.0.20) (2021-03-13)
|
### [0.0.20](https://github.com/Fabio286/antares/compare/v0.0.19...v0.0.20) (2021-03-13)
|
||||||
|
|
||||||
|
|
||||||
|
54
README.md
@@ -1,27 +1,32 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="800" src="https://raw.githubusercontent.com/Fabio286/antares/master/docs/screen-alpha.png">
|
<img width="800" src="https://raw.githubusercontent.com/Fabio286/antares/master/docs/gh-logo.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# Antares SQL Client
|
# Antares SQL Client
|
||||||
|
|
||||||
 [](https://travis-ci.com/Fabio286/antares)  
|
 [](https://actions-badge.atrox.dev/fabio286/antares/goto)   [](https://snapcraft.io/antares) [](https://snapcraft.io/antares) [](https://twitter.com/AntaresSQL) [](https://www.treedom.net/en/user/fabio-di-stasio/event/antares-for-the-planet)
|
||||||
|
|
||||||
Antares is an SQL client based on [Electron.js](https://github.com/electron/electron) and [Vue.js](https://github.com/vuejs/vue) that aims to become a useful tool, especially for developers.
|
Antares is an SQL client based on [Electron.js](https://github.com/electron/electron) and [Vue.js](https://github.com/vuejs/vue) that aims to become a useful tool, especially for developers.
|
||||||
My target is to support as many databases as possible, and all major operating systems, including the ARM versions.
|
My target is to support as many databases as possible, and all major operating systems, including the ARM versions.
|
||||||
|
|
||||||
**At the moment this application is an alpha, it lacks many features** and supports only MySQL.
|
**At the moment this application is in development state, many features will come in future updates**, and supports only MySQL/MariaDB and PostgreSQL (partially).
|
||||||
Most of its current features might be enough for basic MySQL use, so give it a chance and send me your feedback, I would really appreciate it.
|
Many of its current features are enough to have a pleasant user experience with MySQL/MariaDB, and basic functionalites with PostgreSQL, so give it a chance and send me your feedback, I would really appreciate it.
|
||||||
I'm actively working on it (yes, i'm a lone dev), hoping to provide cool features and fixes as soon as possible.
|
I'm actively working on it, hoping to provide cool features and fixes as soon as possible.
|
||||||
|
|
||||||
🔗 If you are curious to try this early state of Antares you can download and install the [latest release](https://github.com/Fabio286/antares/releases).
|
🔗 If you are curious to try Antares you can download and install the [latest release](https://github.com/Fabio286/antares/releases/latest).
|
||||||
👁 To stay tuned for new releases watch this repo on **Release only** channel.
|
👁 To stay tuned for new releases [follow Antares SQL](https://twitter.com/AntaresSQL) on Twitter.
|
||||||
🌟 Don't forget to **leave a star** if you appreciate this project.
|
🌟 Don't forget to **leave a star** if you appreciate this project.
|
||||||
|
|
||||||
## Philosophy
|
## Philosophy
|
||||||
|
|
||||||
Why am I developing an SQL client when there are a lot of them on the market?
|
Why am I developing an SQL client when there are a lot of them on the market?
|
||||||
The main goal is to develop a totally free, full featured, cross platform and open source alternative, empowered by JavaScript's ecosystem.
|
The main goal is to develop a totally free, full featured, cross platform and open source alternative, empowered by JavaScript's ecosystem.
|
||||||
An application created with minimalism and semplicity in mind, with features in the right places, not hundreds of tiny buttons or submenu.
|
A modern application created with minimalism and semplicity in mind, with features in the right places, not hundreds of tiny buttons, tabs or submenu.
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
[](https://snapcraft.io/antares) [](https://aur.archlinux.org/packages/antares-sql/) [](https://www.microsoft.com/p/antares-sql-client/9nhtb9sq51r1?cid=storebadge&ocid=badge&rtc=1&activetab=pivot:overviewtab)
|
||||||
|
🚀 **[Other Downloads](https://github.com/Fabio286/antares/releases/latest)**
|
||||||
|
|
||||||
## How to contribute
|
## How to contribute
|
||||||
|
|
||||||
@@ -36,17 +41,17 @@ An application created with minimalism and semplicity in mind, with features in
|
|||||||
- Fake table data filler.
|
- Fake table data filler.
|
||||||
- Run queries on multiple tabs.
|
- Run queries on multiple tabs.
|
||||||
- Query suggestions and auto complete.
|
- Query suggestions and auto complete.
|
||||||
- Native dark theme.
|
- Dark and light theme.
|
||||||
|
- Scratchpad.
|
||||||
- Multi language.
|
- Multi language.
|
||||||
- Secure password storage.
|
- Secure password storage.
|
||||||
- Auto updates.
|
|
||||||
|
|
||||||
## Coming soon
|
## Coming soon
|
||||||
|
|
||||||
This is a roadmap with major features will come in near future.
|
This is a roadmap with major features will come in near future.
|
||||||
|
|
||||||
- Support for other databases.
|
- Support for other databases.
|
||||||
- Database tools (variables, process list...).
|
- Database tools.
|
||||||
- SSH tunnel support.
|
- SSH tunnel support.
|
||||||
- Users management (add/edit/delete).
|
- Users management (add/edit/delete).
|
||||||
- UI/UX improvements.
|
- UI/UX improvements.
|
||||||
@@ -55,25 +60,13 @@ This is a roadmap with major features will come in near future.
|
|||||||
- More keyboard shortcuts.
|
- More keyboard shortcuts.
|
||||||
- Query logs console.
|
- Query logs console.
|
||||||
- Import/export and migration.
|
- Import/export and migration.
|
||||||
- Light theme.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### **Linux**
|
|
||||||
|
|
||||||
With KDE may need necessary installation of the additional `gnome-keyring` package.
|
|
||||||
Depending on your distribution, you will need to run the following command:
|
|
||||||
|
|
||||||
- Debian/Ubuntu: `sudo apt-get install gnome-keyring`
|
|
||||||
- Red Hat-based: `sudo yum install gnome-keyring`
|
|
||||||
- Arch Linux: `sudo pacman -S gnome-keyring`
|
|
||||||
|
|
||||||
## Currently supported
|
## Currently supported
|
||||||
|
|
||||||
### Databases
|
### Databases
|
||||||
|
|
||||||
- [x] MySQL/MariaDB
|
- [x] MySQL/MariaDB
|
||||||
- [ ] PostgreSQL
|
- [x] PostgreSQL (partially, work in progress)
|
||||||
- [ ] SQLite
|
- [ ] SQLite
|
||||||
- [ ] MSSQL
|
- [ ] MSSQL
|
||||||
- [ ] OracleDB
|
- [ ] OracleDB
|
||||||
@@ -85,20 +78,21 @@ Depending on your distribution, you will need to run the following command:
|
|||||||
|
|
||||||
- [x] Windows
|
- [x] Windows
|
||||||
- [x] Linux
|
- [x] Linux
|
||||||
- [x] MacOS (i need feedbacks)
|
- [x] MacOS (not tested due lack of hardware)
|
||||||
|
|
||||||
#### • ARM
|
#### • ARM
|
||||||
|
|
||||||
- [ ] Windows
|
- [ ] Windows
|
||||||
- [ ] Linux
|
- [x] Linux
|
||||||
- [ ] MacOS
|
- [ ] MacOS
|
||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
|
|
||||||
**Italian Translation** (46%) / [Giuseppe Gigliotti](https://github.com/ReverbOD) [[#20](https://github.com/Fabio286/antares/pull/20)]
|
**Italian Translation** / [Giuseppe Gigliotti](https://github.com/ReverbOD) [[#20](https://github.com/Fabio286/antares/pull/20)]
|
||||||
**Arabic Translation** (45%) / [Mohd-PH](https://github.com/Mohd-PH) [[#29](https://github.com/Fabio286/antares/pull/29)]
|
**Arabic Translation** / [Mohd-PH](https://github.com/Mohd-PH) [[#29](https://github.com/Fabio286/antares/pull/29)]
|
||||||
**Spanish Translation** (46%) / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)]
|
**Spanish Translation** / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)]
|
||||||
**French Translation** (100%) / [MrAnyx](https://github.com/MrAnyx) [[#44](https://github.com/Fabio286/antares/pull/44)]
|
**French Translation** / [MrAnyx](https://github.com/MrAnyx) [[#44](https://github.com/Fabio286/antares/pull/44)]
|
||||||
|
**Portugues (Brasil)** / [Daniel Eduardo](https://github.com/daeleduardo) [[#54](https://github.com/Fabio286/antares/pull/54)]
|
||||||
|
|
||||||
## Reviews
|
## Reviews
|
||||||
|
|
||||||
|
BIN
build/appx/LargeTile.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
build/appx/SmallTile.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
build/appx/Square150x150Logo.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
build/appx/Square44x44Logo.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
build/appx/StoreLogo.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
build/appx/Wide310x150Logo.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
build/icon.icns
BIN
build/icon.ico
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 50 KiB |
77
docs/aur-badge.svg
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
style="isolation:isolate" viewBox="0 0 182 56" width="182px" height="56px">
|
||||||
|
<defs>
|
||||||
|
<clipPath id="_clipPath_tR1uglJ1Zei76xP861DY1TsjAiQWS9qF">
|
||||||
|
<rect width="182" height="56" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<g clip-path="url(#_clipPath_tR1uglJ1Zei76xP861DY1TsjAiQWS9qF)">
|
||||||
|
<path
|
||||||
|
d="M 2.5 0.5 L 180.5 0.5 C 181.604 0.5 182.5 1.396 182.5 2.5 L 182.5 54.5 C 182.5 55.604 181.604 56.5 180.5 56.5 L 2.5 56.5 C 1.396 56.5 0.5 55.604 0.5 54.5 L 0.5 2.5 C 0.5 1.396 1.396 0.5 2.5 0.5 Z"
|
||||||
|
style="stroke:none;fill:#252525;stroke-miterlimit:10;" />
|
||||||
|
<path
|
||||||
|
d="M 2.5 0.5 L 180.5 0.5 C 181.604 0.5 182.5 1.396 182.5 2.5 L 182.5 54.5 C 182.5 55.604 181.604 56.5 180.5 56.5 L 2.5 56.5 C 1.396 56.5 0.5 55.604 0.5 54.5 L 0.5 2.5 C 0.5 1.396 1.396 0.5 2.5 0.5 Z"
|
||||||
|
style="fill:none;stroke:#CDCDCD;stroke-width:1;stroke-miterlimit:2;" />
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path
|
||||||
|
d=" M 60.898 13.777 C 58.555 13.774 56.61 14.254 55.858 14.516 L 55.083 18.697 C 55.081 18.712 58.937 17.669 60.635 17.73 C 63.447 17.831 63.706 18.805 63.656 20.119 C 63.704 20.196 62.931 18.931 60.498 18.889 C 57.43 18.836 53.098 19.976 53.104 24.608 C 53.022 29.818 56.997 31.351 59.704 31.379 C 62.138 31.335 63.279 30.458 63.904 29.988 C 64.726 29.129 65.665 28.265 66.561 27.229 C 65.714 28.77 64.978 29.835 64.213 30.651 L 64.213 31.339 L 67.913 30.716 L 67.938 20.66 C 67.901 19.237 68.754 13.791 60.898 13.777 Z M 60.367 22.533 C 61.9 22.554 63.659 23.31 63.662 25.129 C 63.669 26.784 61.589 27.674 60.235 27.66 C 58.881 27.646 57.085 26.596 57.077 24.982 C 57.103 23.54 58.771 22.496 60.367 22.533 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(255,255,255)" />
|
||||||
|
<path
|
||||||
|
d=" M 70.378 14.707 L 70.352 31.36 L 74.662 30.529 L 74.67 21.087 C 74.671 19.681 76.679 18.039 79.198 18.065 C 79.733 17.097 80.738 14.625 80.983 14.062 C 75.354 14.049 75.282 15.68 74.303 16.483 C 74.293 14.952 74.3 14.033 74.3 14.033 L 70.378 14.707 L 70.378 14.707 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(255,255,255)" />
|
||||||
|
<path
|
||||||
|
d=" M 94.632 16.893 C 94.591 16.873 92.385 14.312 87.949 14.292 C 83.795 14.223 79.135 15.834 79.061 22.8 C 79.097 28.925 83.537 31.318 87.973 31.365 C 92.72 31.414 94.609 28.396 94.722 28.322 C 94.156 27.83 92.034 25.728 92.034 25.728 C 92.034 25.728 90.709 27.615 88.138 27.639 C 85.566 27.664 83.331 25.651 83.299 22.844 C 83.266 20.036 85.354 18.515 88.157 18.392 C 90.584 18.392 91.984 19.959 91.984 19.959 L 94.632 16.893 L 94.632 16.893 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(255,255,255)" />
|
||||||
|
<path
|
||||||
|
d=" M 100.065 8.879 L 95.996 9.835 L 96.026 31.526 L 100.034 30.802 L 100.08 20.595 C 100.089 19.524 101.628 17.88 104.2 17.933 C 106.658 17.958 107.207 19.571 107.201 19.775 L 107.272 31.592 L 111.224 30.894 L 111.239 18.363 C 111.265 17.157 108.598 14.61 104.311 14.592 C 102.273 14.596 101.145 15.057 100.571 15.397 C 99.588 16.156 98.466 16.883 97.362 17.811 C 98.382 16.501 99.239 15.595 100.075 14.921 L 100.065 8.879 L 100.065 8.879 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(255,255,255)" />
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path
|
||||||
|
d=" M 114.673 9.441 L 116.508 8.982 L 116.595 30.85 L 114.73 31.168 L 114.673 9.441 L 114.673 9.441 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(23,147,209)" />
|
||||||
|
<path
|
||||||
|
d=" M 119.663 15.968 L 121.271 15.252 L 121.285 30.932 L 119.731 31.253 L 119.663 15.968 L 119.663 15.968 Z M 119.28 10.314 L 120.577 9.255 L 121.655 10.454 L 120.357 11.54 L 119.28 10.314 L 119.28 10.314 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(23,147,209)" />
|
||||||
|
<path
|
||||||
|
d=" M 124.296 15.682 L 126.131 15.308 L 126.14 18.586 C 126.14 18.727 127.148 14.924 132.008 15.009 C 136.727 15.035 137.499 18.688 137.473 19.507 L 137.531 31.034 L 135.922 31.384 L 135.913 19.998 C 135.932 19.665 135.178 16.853 131.843 16.843 C 128.509 16.833 126.199 19.265 126.203 20.818 L 126.229 30.848 L 124.365 31.335 L 124.296 15.682 L 124.296 15.682 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(23,147,209)" />
|
||||||
|
<path
|
||||||
|
d=" M 153.547 31.117 L 151.711 31.492 L 151.703 28.214 C 151.703 28.073 150.694 31.876 145.835 31.791 C 141.116 31.765 140.344 28.112 140.37 27.293 L 140.311 15.765 L 142.261 15.372 L 142.292 26.758 C 142.292 27.069 142.665 29.947 145.999 29.957 C 149.334 29.967 151.669 27.949 151.686 24.911 L 151.662 15.928 L 153.477 15.464 L 153.547 31.117 L 153.547 31.117 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(23,147,209)" />
|
||||||
|
<path
|
||||||
|
d=" M 157.144 15.553 L 155.857 16.56 L 160.792 23.018 L 155.529 30.478 L 156.894 31.492 L 161.841 24.563 L 166.948 31.656 L 168.211 30.649 L 162.738 23.065 L 167.104 16.933 L 165.762 15.797 L 161.785 21.472 L 157.144 15.553 L 157.144 15.553 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(23,147,209)" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
d=" M 33.112 3.879 C 30.965 9.143 29.67 12.587 27.279 17.695 C 28.745 19.248 30.544 21.058 33.466 23.101 C 30.325 21.809 28.182 20.511 26.581 19.164 C 23.521 25.549 18.728 34.643 9 52.121 C 16.645 47.707 22.572 44.986 28.095 43.948 C 27.858 42.928 27.723 41.824 27.733 40.673 L 27.742 40.428 C 27.863 35.53 30.411 31.763 33.43 32.019 C 36.448 32.274 38.794 36.455 38.673 41.353 C 38.65 42.275 38.546 43.162 38.364 43.984 C 43.828 45.053 49.691 47.767 57.233 52.121 C 55.746 49.383 54.419 46.915 53.151 44.565 C 51.154 43.017 49.072 41.003 44.823 38.822 C 47.743 39.581 49.834 40.456 51.464 41.435 C 38.575 17.439 37.532 14.251 33.112 3.879 Z "
|
||||||
|
fill-rule="evenodd" fill="rgb(23,147,209)" />
|
||||||
|
<g>
|
||||||
|
<path
|
||||||
|
d=" M 170.614 30.156 L 170.614 28.802 L 170.109 28.802 L 170.109 28.621 L 171.325 28.621 L 171.325 28.802 L 170.817 28.802 L 170.817 30.156 L 170.614 30.156 Z "
|
||||||
|
fill="rgb(23,147,209)" />
|
||||||
|
<path
|
||||||
|
d=" M 171.536 30.156 L 171.536 28.621 L 171.842 28.621 L 172.205 29.708 C 172.238 29.809 172.263 29.884 172.278 29.935 C 172.295 29.879 172.323 29.797 172.36 29.689 L 172.727 28.621 L 173 28.621 L 173 30.156 L 172.804 30.156 L 172.804 28.871 L 172.358 30.156 L 172.175 30.156 L 171.732 28.849 L 171.732 30.156 L 171.536 30.156 Z "
|
||||||
|
fill="rgb(23,147,209)" />
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path
|
||||||
|
d=" M 57.471 47.815 L 57.471 46.493 L 56.977 46.493 L 56.977 46.316 L 58.166 46.316 L 58.166 46.493 L 57.67 46.493 L 57.67 47.815 L 57.471 47.815 Z "
|
||||||
|
fill="rgb(23,147,209)" />
|
||||||
|
<path
|
||||||
|
d=" M 58.372 47.815 L 58.372 46.316 L 58.671 46.316 L 59.026 47.377 C 59.059 47.476 59.083 47.55 59.098 47.599 C 59.115 47.545 59.141 47.465 59.177 47.359 L 59.536 46.316 L 59.803 46.316 L 59.803 47.815 L 59.612 47.815 L 59.612 46.56 L 59.176 47.815 L 58.997 47.815 L 58.564 46.539 L 58.564 47.815 L 58.372 47.815"
|
||||||
|
fill="rgb(23,147,209)" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g clip-path="url(#_clipPath_NvFIpNfWUS6M4fZAtfyVzggsKR3URDoi)"><text transform="matrix(1,0,0,1,87.023,43.899)"
|
||||||
|
style="font-family:'Open Sans';font-weight:700;font-size:11px;font-style:normal;fill:#ffffff;stroke:none;">user
|
||||||
|
repository</text></g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="_clipPath_NvFIpNfWUS6M4fZAtfyVzggsKR3URDoi">
|
||||||
|
<rect x="0" y="0" width="86" height="14.98" transform="matrix(1,0,0,1,87,32.142)" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 7.5 KiB |
BIN
docs/gh-logo.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
docs/logo.png
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 172 KiB |
112
package.json
@@ -1,20 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "antares",
|
"name": "antares",
|
||||||
"productName": "Antares",
|
"productName": "Antares",
|
||||||
"version": "0.0.20",
|
"version": "0.1.11",
|
||||||
"description": "A cross-platform easy to use SQL client.",
|
"description": "A cross-platform easy to use SQL client.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "https://github.com/Fabio286/antares.git",
|
"repository": "https://github.com/Fabio286/antares.git",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env NODE_ENV=development electron-webpack dev",
|
"dev": "cross-env NODE_ENV=development electron-webpack dev",
|
||||||
"compile": "electron-webpack",
|
"compile": "electron-webpack",
|
||||||
"build": "cross-env NODE_ENV=production npm run compile && electron-builder",
|
"build": "cross-env NODE_ENV=production npm run compile",
|
||||||
|
"build:local": "npm run build && electron-builder",
|
||||||
|
"build:appx": "npm run build:local -- --win appx",
|
||||||
"release": "standard-version",
|
"release": "standard-version",
|
||||||
"release:pre": "npm run release -- --prerelease alpha",
|
"release:pre": "npm run release -- --prerelease alpha",
|
||||||
"release:snap": "npm run build -- --linux snap && snapcraft upload --release=edge ./dist/Antares-${npm_package_version}-linux_amd64.snap",
|
|
||||||
"test": "npm run lint",
|
"test": "npm run lint",
|
||||||
"lint": "eslint . --ext .js,.vue && stylelint \"./src/**/*.{css,scss,sass,vue}\"",
|
"lint": "eslint . --ext .js,.vue && stylelint \"./src/**/*.{css,scss,sass,vue}\"",
|
||||||
"lint:fix": "eslint . --ext .js,.vue --fix && stylelint \"./src/**/*.{css,scss,sass,vue}\" --fix"
|
"lint:fix": "eslint . --ext .js,.vue --fix && stylelint \"./src/**/*.{css,scss,sass,vue}\" --fix",
|
||||||
|
"postinstall": "electron-builder install-app-deps"
|
||||||
},
|
},
|
||||||
"author": "Fabio Di Stasio <fabio286@gmail.com>",
|
"author": "Fabio Di Stasio <fabio286@gmail.com>",
|
||||||
"build": {
|
"build": {
|
||||||
@@ -26,6 +28,44 @@
|
|||||||
"portable"
|
"portable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"mac": {
|
||||||
|
"target": {
|
||||||
|
"target": "default",
|
||||||
|
"arch": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"target": [
|
||||||
|
{
|
||||||
|
"target": "deb",
|
||||||
|
"arch": "x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "AppImage",
|
||||||
|
"arch": [
|
||||||
|
"x64",
|
||||||
|
"armv7l",
|
||||||
|
"arm64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"category": "Development"
|
||||||
|
},
|
||||||
|
"appImage": {
|
||||||
|
"license": "./LICENSE",
|
||||||
|
"category": "Development"
|
||||||
|
},
|
||||||
|
"portable": {
|
||||||
|
"artifactName": "${productName}-${version}-portable.exe"
|
||||||
|
},
|
||||||
|
"appx": {
|
||||||
|
"displayName": "Antares SQL Client",
|
||||||
|
"identityName": "62514FabioDiStasio.AntaresSQLClient",
|
||||||
|
"publisher": "CN=1A2729ED-865C-41D2-9038-39AE2A63AA52",
|
||||||
|
"applicationId": "FabioDiStasio.AntaresSQLClient"
|
||||||
|
},
|
||||||
"dmg": {
|
"dmg": {
|
||||||
"contents": [
|
"contents": [
|
||||||
{
|
{
|
||||||
@@ -39,20 +79,6 @@
|
|||||||
"path": "/Applications"
|
"path": "/Applications"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"target": [
|
|
||||||
"deb",
|
|
||||||
"AppImage"
|
|
||||||
],
|
|
||||||
"category": "Development"
|
|
||||||
},
|
|
||||||
"appImage": {
|
|
||||||
"license": "./LICENSE",
|
|
||||||
"category": "Development"
|
|
||||||
},
|
|
||||||
"portable": {
|
|
||||||
"artifactName": "${productName}-${version}-portable.exe"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electronWebpack": {
|
"electronWebpack": {
|
||||||
@@ -61,46 +87,48 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@electron/remote": "^1.1.0",
|
||||||
"@mdi/font": "^5.9.55",
|
"@mdi/font": "^5.9.55",
|
||||||
"ace-builds": "^1.4.12",
|
"ace-builds": "^1.4.12",
|
||||||
"electron-log": "^4.3.0",
|
"electron-log": "^4.3.5",
|
||||||
"electron-store": "^7.0.0",
|
"electron-store": "^8.0.0",
|
||||||
"electron-updater": "^4.3.5",
|
"electron-updater": "^4.3.9",
|
||||||
"faker": "^5.3.1",
|
"faker": "^5.5.3",
|
||||||
"keytar": "^7.3.0",
|
"marked": "^2.0.5",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"mssql": "^6.2.3",
|
|
||||||
"mysql2": "^2.2.5",
|
"mysql2": "^2.2.5",
|
||||||
"pg": "^8.5.1",
|
"pg": "^8.5.1",
|
||||||
|
"pgsql-ast-parser": "^7.2.1",
|
||||||
"source-map-support": "^0.5.16",
|
"source-map-support": "^0.5.16",
|
||||||
"spectre.css": "^0.5.9",
|
"spectre.css": "^0.5.9",
|
||||||
|
"sql-formatter": "^4.0.2",
|
||||||
"v-mask": "^2.2.4",
|
"v-mask": "^2.2.4",
|
||||||
"vue-i18n": "^8.22.4",
|
"vue-i18n": "^8.24.4",
|
||||||
"vuedraggable": "^2.24.3",
|
"vuedraggable": "^2.24.3",
|
||||||
"vuex": "^3.6.0"
|
"vuex": "^3.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^10.1.0",
|
"@babel/eslint-parser": "^7.14.3",
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"electron": "^11.3.0",
|
"electron": "^13.0.0",
|
||||||
"electron-builder": "^22.9.1",
|
"electron-builder": "22.10.5",
|
||||||
"electron-devtools-installer": "^3.1.1",
|
"electron-devtools-installer": "^3.2.0",
|
||||||
"electron-webpack": "^2.8.2",
|
"electron-webpack": "^2.8.2",
|
||||||
"electron-webpack-vue": "^2.4.0",
|
"electron-webpack-vue": "^2.4.0",
|
||||||
"eslint": "^7.20.0",
|
"eslint": "^7.27.0",
|
||||||
"eslint-config-standard": "^16.0.2",
|
"eslint-config-standard": "^16.0.3",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.23.3",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-promise": "^4.3.1",
|
"eslint-plugin-promise": "^5.1.0",
|
||||||
"eslint-plugin-vue": "^7.6.0",
|
"eslint-plugin-vue": "^7.10.0",
|
||||||
"node-sass": "^5.0.0",
|
"sass": "^1.34.0",
|
||||||
"sass-loader": "^10.1.1",
|
"sass-loader": "^10.2.0",
|
||||||
"standard-version": "^9.1.0",
|
"standard-version": "^9.3.0",
|
||||||
"stylelint": "^13.9.0",
|
"stylelint": "^13.13.1",
|
||||||
"stylelint-config-standard": "^20.0.0",
|
"stylelint-config-standard": "^22.0.0",
|
||||||
"stylelint-scss": "^3.19.0",
|
"stylelint-scss": "^3.19.0",
|
||||||
"vue": "^2.6.12",
|
"vue": "^2.6.13",
|
||||||
"vue-template-compiler": "^2.6.12",
|
"vue-template-compiler": "^2.6.13",
|
||||||
"webpack": "^4.46.0"
|
"webpack": "^4.46.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,9 @@ confinement: strict
|
|||||||
architectures:
|
architectures:
|
||||||
- build-on: amd64
|
- build-on: amd64
|
||||||
compression: lzo
|
compression: lzo
|
||||||
|
layout:
|
||||||
|
/etc/nsswitch.conf:
|
||||||
|
bind-file: $SNAP/etc/nsswitch.conf
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
antares:
|
antares:
|
||||||
@@ -71,11 +74,28 @@ parts:
|
|||||||
cleanup:
|
cleanup:
|
||||||
after: [antares]
|
after: [antares]
|
||||||
plugin: nil
|
plugin: nil
|
||||||
build-snaps: [ gnome-3-28-1804 ]
|
build-snaps: [gnome-3-28-1804]
|
||||||
override-prime: |
|
override-prime: |
|
||||||
set -eux
|
set -eux
|
||||||
cd /snap/gnome-3-28-1804/current
|
cd /snap/gnome-3-28-1804/current
|
||||||
find . -type f,l -exec rm -f $SNAPCRAFT_PRIME/{} \;
|
find . -type f,l -exec rm -f $SNAPCRAFT_PRIME/{} \;
|
||||||
|
|
||||||
|
mdns-lookup:
|
||||||
|
# Make resolution of ".local" host names (Zero-Conf/mDNS/DNS-SD)
|
||||||
|
# working: Take the original nsswitch.conf file from the base
|
||||||
|
# Snap and add "mdns4_minimal [NOTFOUND=return]" to its "hosts:" line
|
||||||
|
# Also install corresponding mdns4_minimal plug-in
|
||||||
|
# See: https://forum.snapcraft.io/t/no-mdns-support-in-snaps-should-core-have-a-modified-nsswitch-conf/
|
||||||
|
plugin: nil
|
||||||
|
stage-packages:
|
||||||
|
- libnss-mdns
|
||||||
|
override-prime: |
|
||||||
|
set -eux
|
||||||
|
sed -Ee 's/^\s*hosts:(\s+)files/hosts:\1files mdns4_minimal \[NOTFOUND=return\]/' /snap/core18/current/etc/nsswitch.conf > $SNAPCRAFT_STAGE/etc/nsswitch.conf
|
||||||
|
snapcraftctl prime
|
||||||
|
prime:
|
||||||
|
- lib/$SNAPCRAFT_ARCH_TRIPLET/libnss_mdns4_minimal*
|
||||||
|
- etc/nsswitch.conf
|
||||||
|
|
||||||
apps:
|
apps:
|
||||||
antares:
|
antares:
|
||||||
@@ -93,4 +113,4 @@ apps:
|
|||||||
- opengl
|
- opengl
|
||||||
- pulseaudio
|
- pulseaudio
|
||||||
- removable-media
|
- removable-media
|
||||||
- unity7
|
- unity7
|
||||||
|
69
src/common/customizations/defaults.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
module.exports = {
|
||||||
|
// Defaults
|
||||||
|
defaultPort: null,
|
||||||
|
defaultUser: null,
|
||||||
|
defaultDatabase: null,
|
||||||
|
// Core
|
||||||
|
database: false,
|
||||||
|
collations: false,
|
||||||
|
engines: false,
|
||||||
|
// Tools
|
||||||
|
processesList: false,
|
||||||
|
usersManagement: false,
|
||||||
|
variables: false,
|
||||||
|
// Structure
|
||||||
|
schemas: false,
|
||||||
|
tables: false,
|
||||||
|
views: false,
|
||||||
|
triggers: false,
|
||||||
|
triggerFunctions: false,
|
||||||
|
routines: false,
|
||||||
|
functions: false,
|
||||||
|
schedulers: false,
|
||||||
|
// Settings
|
||||||
|
tableAdd: false,
|
||||||
|
viewAdd: false,
|
||||||
|
triggerAdd: false,
|
||||||
|
triggerFunctionAdd: false,
|
||||||
|
routineAdd: false,
|
||||||
|
functionAdd: false,
|
||||||
|
schedulerAdd: false,
|
||||||
|
databaseEdit: false,
|
||||||
|
schemaEdit: false,
|
||||||
|
tableSettings: false,
|
||||||
|
viewSettings: false,
|
||||||
|
triggerSettings: false,
|
||||||
|
triggerFunctionSettings: false,
|
||||||
|
routineSettings: false,
|
||||||
|
functionSettings: false,
|
||||||
|
schedulerSettings: false,
|
||||||
|
indexes: false,
|
||||||
|
foreigns: false,
|
||||||
|
sortableFields: false,
|
||||||
|
unsigned: false,
|
||||||
|
nullable: false,
|
||||||
|
zerofill: false,
|
||||||
|
autoIncrement: false,
|
||||||
|
comment: false,
|
||||||
|
collation: false,
|
||||||
|
definer: false,
|
||||||
|
onUpdate: false,
|
||||||
|
tableArray: false,
|
||||||
|
viewAlgorithm: false,
|
||||||
|
viewSqlSecurity: false,
|
||||||
|
viewUpdateOption: false,
|
||||||
|
procedureDeterministic: false,
|
||||||
|
procedureDataAccess: false,
|
||||||
|
procedureSql: false,
|
||||||
|
procedureContext: false,
|
||||||
|
procedureLanguage: false,
|
||||||
|
functionDeterministic: false,
|
||||||
|
functionDataAccess: false,
|
||||||
|
functionSql: false,
|
||||||
|
functionContext: false,
|
||||||
|
functionLanguage: false,
|
||||||
|
triggerMiltipleEvents: false,
|
||||||
|
triggerUpdateColumns: false,
|
||||||
|
parametersLength: false,
|
||||||
|
languages: false
|
||||||
|
};
|
5
src/common/customizations/index.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
maria: require('./mysql'),
|
||||||
|
mysql: require('./mysql'),
|
||||||
|
pg: require('./postgresql')
|
||||||
|
};
|
58
src/common/customizations/mysql.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
const defaults = require('./defaults');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
...defaults,
|
||||||
|
// Defaults
|
||||||
|
defaultPort: 3306,
|
||||||
|
defaultUser: 'root',
|
||||||
|
defaultDatabase: null,
|
||||||
|
// Core
|
||||||
|
collations: true,
|
||||||
|
engines: true,
|
||||||
|
// Tools
|
||||||
|
processesList: true,
|
||||||
|
// Structure
|
||||||
|
schemas: true,
|
||||||
|
tables: true,
|
||||||
|
views: true,
|
||||||
|
triggers: true,
|
||||||
|
routines: true,
|
||||||
|
functions: true,
|
||||||
|
schedulers: true,
|
||||||
|
// Settings
|
||||||
|
tableAdd: true,
|
||||||
|
viewAdd: true,
|
||||||
|
triggerAdd: true,
|
||||||
|
routineAdd: true,
|
||||||
|
functionAdd: true,
|
||||||
|
schedulerAdd: true,
|
||||||
|
schemaEdit: true,
|
||||||
|
tableSettings: true,
|
||||||
|
viewSettings: true,
|
||||||
|
triggerSettings: true,
|
||||||
|
routineSettings: true,
|
||||||
|
functionSettings: true,
|
||||||
|
schedulerSettings: true,
|
||||||
|
indexes: true,
|
||||||
|
foreigns: true,
|
||||||
|
sortableFields: true,
|
||||||
|
unsigned: true,
|
||||||
|
nullable: true,
|
||||||
|
zerofill: true,
|
||||||
|
autoIncrement: true,
|
||||||
|
comment: true,
|
||||||
|
collation: true,
|
||||||
|
definer: true,
|
||||||
|
onUpdate: true,
|
||||||
|
viewAlgorithm: true,
|
||||||
|
viewSqlSecurity: true,
|
||||||
|
viewUpdateOption: true,
|
||||||
|
procedureDeterministic: true,
|
||||||
|
procedureDataAccess: true,
|
||||||
|
procedureSql: 'BEGIN\r\n\r\nEND',
|
||||||
|
procedureContext: true,
|
||||||
|
functionDeterministic: true,
|
||||||
|
functionDataAccess: true,
|
||||||
|
functionSql: 'BEGIN\r\n\r\nEND',
|
||||||
|
parametersLength: true
|
||||||
|
};
|
42
src/common/customizations/postgresql.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
const defaults = require('./defaults');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
...defaults,
|
||||||
|
// Defaults
|
||||||
|
defaultPort: 5432,
|
||||||
|
defaultUser: 'postgres',
|
||||||
|
defaultDatabase: 'postgres',
|
||||||
|
// Core
|
||||||
|
database: true,
|
||||||
|
// Tools
|
||||||
|
processesList: true,
|
||||||
|
// Structure
|
||||||
|
tables: true,
|
||||||
|
views: true,
|
||||||
|
triggers: false,
|
||||||
|
routines: true,
|
||||||
|
functions: true,
|
||||||
|
// Settings
|
||||||
|
tableAdd: true,
|
||||||
|
viewAdd: true,
|
||||||
|
triggerAdd: false,
|
||||||
|
routineAdd: true,
|
||||||
|
functionAdd: true,
|
||||||
|
databaseEdit: false,
|
||||||
|
tableSettings: true,
|
||||||
|
viewSettings: true,
|
||||||
|
triggerSettings: false,
|
||||||
|
routineSettings: true,
|
||||||
|
functionSettings: true,
|
||||||
|
indexes: true,
|
||||||
|
foreigns: true,
|
||||||
|
nullable: true,
|
||||||
|
tableArray: true,
|
||||||
|
procedureSql: '$BODY$\r\n\r\n$BODY$',
|
||||||
|
procedureContext: true,
|
||||||
|
procedureLanguage: true,
|
||||||
|
functionSql: '$BODY$\r\n\r\n$BODY$',
|
||||||
|
functionContext: true,
|
||||||
|
functionLanguage: true,
|
||||||
|
languages: ['sql', 'plpgsql', 'c', 'internal']
|
||||||
|
};
|
@@ -4,7 +4,7 @@ module.exports = [
|
|||||||
types: [
|
types: [
|
||||||
{
|
{
|
||||||
name: 'TINYINT',
|
name: 'TINYINT',
|
||||||
length: true,
|
length: 4,
|
||||||
collation: false,
|
collation: false,
|
||||||
unsigned: true,
|
unsigned: true,
|
||||||
zerofill: true
|
zerofill: true
|
||||||
@@ -277,13 +277,6 @@ module.exports = [
|
|||||||
{
|
{
|
||||||
group: 'other',
|
group: 'other',
|
||||||
types: [
|
types: [
|
||||||
{
|
|
||||||
name: 'UNKNOWN',
|
|
||||||
length: false,
|
|
||||||
collation: false,
|
|
||||||
unsigned: false,
|
|
||||||
zerofill: false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'ENUM',
|
name: 'ENUM',
|
||||||
length: true,
|
length: true,
|
||||||
@@ -299,5 +292,17 @@ module.exports = [
|
|||||||
zerofill: false
|
zerofill: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'unknown',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'UNKNOWN',
|
||||||
|
length: false,
|
||||||
|
collation: false,
|
||||||
|
unsigned: false,
|
||||||
|
zerofill: false
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
292
src/common/data-types/postgresql.js
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
group: 'integer',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'SMALLINT',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'INTEGER',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'BIGINT',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'DECIMAL',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'NUMERIC',
|
||||||
|
length: true,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'SMALLSERIAL',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'SERIAL',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'BIGSERIAL',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'float',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'REAL',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'DOUBLE PRECISION',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'monetary',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'money',
|
||||||
|
length: false,
|
||||||
|
unsigned: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'string',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'CHARACTER VARYING',
|
||||||
|
length: true,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CHARACTER',
|
||||||
|
length: true,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'TEXT',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '"CHAR"',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'NAME',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'binary',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'BYTEA',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'time',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'TIMESTAMP WITHOUT TIME ZONE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'TIMESTAMP WITH TIME ZONE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'DATE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'TIME WITHOUT TIME ZONE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'TIME WITH TIME ZONE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'INTERVAL',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'boolean',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'BOOLEAN',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'geometric',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'POINT',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'LINE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'LSEG',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'BOX',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'PATH',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'POLYGON',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CIRCLE',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'network',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'CIDR',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'INET',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'MACADDR',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'MACADDR8',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'bit',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'BIT',
|
||||||
|
length: true,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'BIT VARYING',
|
||||||
|
length: true,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'text search',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'TSVECTOR',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'TSQUERY',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'uuid',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'UUID',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'xml',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'XML',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: 'json',
|
||||||
|
types: [
|
||||||
|
{
|
||||||
|
name: 'JSON',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'JSONB',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'JSONPATH',
|
||||||
|
length: false,
|
||||||
|
unsigned: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
@@ -1 +0,0 @@
|
|||||||
module.exports = [];
|
|
@@ -1,13 +1,82 @@
|
|||||||
export const TEXT = ['CHAR', 'VARCHAR'];
|
export const TEXT = [
|
||||||
export const LONG_TEXT = ['TEXT', 'MEDIUMTEXT', 'LONGTEXT'];
|
'CHAR',
|
||||||
|
'VARCHAR',
|
||||||
|
'CHARACTER',
|
||||||
|
'CHARACTER VARYING'
|
||||||
|
];
|
||||||
|
export const LONG_TEXT = [
|
||||||
|
'TEXT',
|
||||||
|
'MEDIUMTEXT',
|
||||||
|
'LONGTEXT'
|
||||||
|
];
|
||||||
|
|
||||||
export const NUMBER = ['INT', 'TINYINT', 'SMALLINT', 'MEDIUMINT', 'BIGINT', 'DECIMAL', 'BOOL'];
|
export const ARRAY = [
|
||||||
export const FLOAT = ['FLOAT', 'DOUBLE'];
|
'ARRAY',
|
||||||
|
'ANYARRAY'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const TEXT_SEARCH = [
|
||||||
|
'TSVECTOR',
|
||||||
|
'TSQUERY'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const NUMBER = [
|
||||||
|
'INT',
|
||||||
|
'TINYINT',
|
||||||
|
'SMALLINT',
|
||||||
|
'MEDIUMINT',
|
||||||
|
'BIGINT',
|
||||||
|
'DECIMAL',
|
||||||
|
'NUMERIC',
|
||||||
|
'INTEGER',
|
||||||
|
'SMALLSERIAL',
|
||||||
|
'SERIAL',
|
||||||
|
'BIGSERIAL',
|
||||||
|
'OID',
|
||||||
|
'XID'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const FLOAT = [
|
||||||
|
'FLOAT',
|
||||||
|
'DOUBLE',
|
||||||
|
'REAL',
|
||||||
|
'DOUBLE PRECISION',
|
||||||
|
'MONEY'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const BOOLEAN = [
|
||||||
|
'BOOL',
|
||||||
|
'BOOLEAN'
|
||||||
|
];
|
||||||
|
|
||||||
export const DATE = ['DATE'];
|
export const DATE = ['DATE'];
|
||||||
export const TIME = ['TIME'];
|
export const TIME = [
|
||||||
export const DATETIME = ['DATETIME', 'TIMESTAMP'];
|
'TIME',
|
||||||
|
'TIME WITH TIME ZONE'
|
||||||
|
];
|
||||||
|
|
||||||
export const BLOB = ['BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB'];
|
export const DATETIME = [
|
||||||
|
'DATETIME',
|
||||||
|
'TIMESTAMP',
|
||||||
|
'TIMESTAMP WITHOUT TIME ZONE',
|
||||||
|
'TIMESTAMP WITH TIME ZONE'
|
||||||
|
];
|
||||||
|
|
||||||
export const BIT = ['BIT'];
|
// Used to check datetime fields only
|
||||||
|
export const HAS_TIMEZONE = [
|
||||||
|
'TIMESTAMP WITH TIME ZONE',
|
||||||
|
'TIME WITH TIME ZONE'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const BLOB = [
|
||||||
|
'BLOB',
|
||||||
|
'TINYBLOB',
|
||||||
|
'MEDIUMBLOB',
|
||||||
|
'LONGBLOB',
|
||||||
|
'BYTEA'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const BIT = [
|
||||||
|
'BIT',
|
||||||
|
'BIT VARYING'
|
||||||
|
];
|
||||||
|
5
src/common/index-types/postgresql.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = [
|
||||||
|
'PRIMARY',
|
||||||
|
'INDEX',
|
||||||
|
'UNIQUE'
|
||||||
|
];
|
@@ -12,7 +12,7 @@ const regex = new RegExp(pattern);
|
|||||||
function sqlEscaper (string) {
|
function sqlEscaper (string) {
|
||||||
return string.replace(regex, char => {
|
return string.replace(regex, char => {
|
||||||
const m = ['\\0', '\\x08', '\\x09', '\\x1a', '\\n', '\\r', '\'', '\"', '\\', '\\\\', '%'];
|
const m = ['\\0', '\\x08', '\\x09', '\\x1a', '\\n', '\\r', '\'', '\"', '\\', '\\\\', '%'];
|
||||||
const r = ['\\\\0', '\\\\b', '\\\\t', '\\\\z', '\\\\n', '\\\\r', '\\\'', '\\\"', '\\\\', '\\\\\\\\', '\\%'];
|
const r = ['\\\\0', '\\\\b', '\\\\t', '\\\\z', '\\\\n', '\\\\r', '\\\'', '\\\"', '\\\\', '\\\\\\\\', '\%'];
|
||||||
return r[m.indexOf(char)] || char;
|
return r[m.indexOf(char)] || char;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
import { app, BrowserWindow, nativeImage } from 'electron';
|
import { app, BrowserWindow, nativeImage } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import crypto from 'crypto';
|
|
||||||
import { format as formatUrl } from 'url';
|
import { format as formatUrl } from 'url';
|
||||||
import keytar from 'keytar';
|
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
|
||||||
import ipcHandlers from './ipc-handlers';
|
import ipcHandlers from './ipc-handlers';
|
||||||
@@ -31,6 +29,7 @@ async function createMainWindow () {
|
|||||||
icon: nativeImage.createFromDataURL(icon.default),
|
icon: nativeImage.createFromDataURL(icon.default),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
'web-security': false,
|
'web-security': false,
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
spellcheck: false
|
spellcheck: false
|
||||||
@@ -39,26 +38,25 @@ async function createMainWindow () {
|
|||||||
backgroundColor: '#1d1d1d'
|
backgroundColor: '#1d1d1d'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isDevelopment) {
|
try {
|
||||||
await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);
|
if (isDevelopment) {
|
||||||
|
await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);
|
||||||
|
|
||||||
const { default: installExtension, VUEJS_DEVTOOLS } = require('electron-devtools-installer');
|
const { default: installExtension, VUEJS_DEVTOOLS } = require('electron-devtools-installer');
|
||||||
window.webContents.openDevTools();
|
|
||||||
|
|
||||||
installExtension(VUEJS_DEVTOOLS)
|
const toolName = await installExtension(VUEJS_DEVTOOLS);
|
||||||
.then(name => {
|
console.log(toolName, 'installed');
|
||||||
console.log(name, 'installed');
|
}
|
||||||
})
|
else {
|
||||||
.catch(err => {
|
await window.loadURL(formatUrl({
|
||||||
console.log(err);
|
pathname: path.join(__dirname, 'index.html'),
|
||||||
});
|
protocol: 'file',
|
||||||
|
slashes: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
catch (err) {
|
||||||
await window.loadURL(formatUrl({
|
console.log(err);
|
||||||
pathname: path.join(__dirname, 'index.html'),
|
|
||||||
protocol: 'file',
|
|
||||||
slashes: true
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.on('closed', () => {
|
window.on('closed', () => {
|
||||||
@@ -78,6 +76,8 @@ async function createMainWindow () {
|
|||||||
if (!gotTheLock)
|
if (!gotTheLock)
|
||||||
app.quit();
|
app.quit();
|
||||||
else {
|
else {
|
||||||
|
require('@electron/remote/main').initialize();
|
||||||
|
|
||||||
// Initialize ipcHandlers
|
// Initialize ipcHandlers
|
||||||
ipcHandlers();
|
ipcHandlers();
|
||||||
|
|
||||||
@@ -88,26 +88,19 @@ else {
|
|||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('activate', () => {
|
app.on('activate', async () => {
|
||||||
// on macOS it is common to re-create a window even after all windows have been closed
|
// on macOS it is common to re-create a window even after all windows have been closed
|
||||||
if (mainWindow === null)
|
if (mainWindow === null) {
|
||||||
mainWindow = createMainWindow();
|
mainWindow = await createMainWindow();
|
||||||
|
if (isDevelopment)
|
||||||
|
mainWindow.webContents.openDevTools();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// create main BrowserWindow when electron is ready
|
// create main BrowserWindow when electron is ready
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
try {
|
mainWindow = await createMainWindow();
|
||||||
let key = await keytar.getPassword('antares', 'user');
|
if (isDevelopment)
|
||||||
|
mainWindow.webContents.openDevTools();
|
||||||
if (!key) {
|
|
||||||
key = crypto.randomBytes(16).toString('hex');
|
|
||||||
keytar.setPassword('antares', 'user', key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow = createMainWindow();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import keytar from 'keytar';
|
|
||||||
import { app, ipcMain } from 'electron';
|
import { app, ipcMain } from 'electron';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
@@ -7,14 +6,7 @@ export default () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('get-key', async event => {
|
ipcMain.on('get-key', async event => {
|
||||||
let key = false;
|
const key = false;
|
||||||
|
|
||||||
try {
|
|
||||||
key = await keytar.getPassword('antares', 'user');
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
event.returnValue = key;
|
event.returnValue = key;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -8,9 +8,13 @@ export default connections => {
|
|||||||
host: conn.host,
|
host: conn.host,
|
||||||
port: +conn.port,
|
port: +conn.port,
|
||||||
user: conn.user,
|
user: conn.user,
|
||||||
password: conn.password
|
password: conn.password,
|
||||||
|
application_name: 'Antares SQL'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (conn.database)
|
||||||
|
params.database = conn.database;
|
||||||
|
|
||||||
if (conn.ssl) {
|
if (conn.ssl) {
|
||||||
params.ssl = {
|
params.ssl = {
|
||||||
key: conn.key ? fs.readFileSync(conn.key) : null,
|
key: conn.key ? fs.readFileSync(conn.key) : null,
|
||||||
@@ -47,9 +51,13 @@ export default connections => {
|
|||||||
host: conn.host,
|
host: conn.host,
|
||||||
port: +conn.port,
|
port: +conn.port,
|
||||||
user: conn.user,
|
user: conn.user,
|
||||||
password: conn.password
|
password: conn.password,
|
||||||
|
application_name: 'Antares SQL'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (conn.database)
|
||||||
|
params.database = conn.database;
|
||||||
|
|
||||||
if (conn.ssl) {
|
if (conn.ssl) {
|
||||||
params.ssl = {
|
params.ssl = {
|
||||||
key: conn.key ? fs.readFileSync(conn.key) : null,
|
key: conn.key ? fs.readFileSync(conn.key) : null,
|
||||||
@@ -59,13 +67,13 @@ export default connections => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const connection = ClientsFactory.getConnection({
|
|
||||||
client: conn.client,
|
|
||||||
params,
|
|
||||||
poolSize: 1
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const connection = ClientsFactory.getConnection({
|
||||||
|
client: conn.client,
|
||||||
|
params,
|
||||||
|
poolSize: 5
|
||||||
|
});
|
||||||
|
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
|
|
||||||
const structure = await connection.getStructure(new Set());
|
const structure = await connection.getStructure(new Set());
|
||||||
|
@@ -7,7 +7,7 @@ import functions from './functions';
|
|||||||
import schedulers from './schedulers';
|
import schedulers from './schedulers';
|
||||||
import updates from './updates';
|
import updates from './updates';
|
||||||
import application from './application';
|
import application from './application';
|
||||||
import database from './database';
|
import schema from './schema';
|
||||||
import users from './users';
|
import users from './users';
|
||||||
|
|
||||||
const connections = {};
|
const connections = {};
|
||||||
@@ -20,7 +20,7 @@ export default () => {
|
|||||||
routines(connections);
|
routines(connections);
|
||||||
functions(connections);
|
functions(connections);
|
||||||
schedulers(connections);
|
schedulers(connections);
|
||||||
database(connections);
|
schema(connections);
|
||||||
users(connections);
|
users(connections);
|
||||||
updates();
|
updates();
|
||||||
application();
|
application();
|
||||||
|
@@ -2,10 +2,9 @@
|
|||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
|
|
||||||
export default connections => {
|
export default connections => {
|
||||||
ipcMain.handle('create-database', async (event, params) => {
|
ipcMain.handle('create-schema', async (event, params) => {
|
||||||
try {
|
try {
|
||||||
const query = `CREATE DATABASE \`${params.name}\` COLLATE ${params.collation}`;
|
await connections[params.uid].createSchema(params);
|
||||||
await connections[params.uid].raw(query);
|
|
||||||
|
|
||||||
return { status: 'success' };
|
return { status: 'success' };
|
||||||
}
|
}
|
||||||
@@ -14,10 +13,9 @@ export default connections => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('update-database', async (event, params) => {
|
ipcMain.handle('update-schema', async (event, params) => {
|
||||||
try {
|
try {
|
||||||
const query = `ALTER DATABASE \`${params.name}\` COLLATE ${params.collation}`;
|
await connections[params.uid].alterSchema(params);
|
||||||
await connections[params.uid].raw(query);
|
|
||||||
|
|
||||||
return { status: 'success' };
|
return { status: 'success' };
|
||||||
}
|
}
|
||||||
@@ -26,10 +24,9 @@ export default connections => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('delete-database', async (event, params) => {
|
ipcMain.handle('delete-schema', async (event, params) => {
|
||||||
try {
|
try {
|
||||||
const query = `DROP DATABASE \`${params.database}\``;
|
await connections[params.uid].dropSchema(params);
|
||||||
await connections[params.uid].raw(query);
|
|
||||||
|
|
||||||
return { status: 'success' };
|
return { status: 'success' };
|
||||||
}
|
}
|
||||||
@@ -38,10 +35,9 @@ export default connections => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('get-database-collation', async (event, params) => { // TODO: move to mysql class
|
ipcMain.handle('get-schema-collation', async (event, params) => {
|
||||||
try {
|
try {
|
||||||
const query = `SELECT \`DEFAULT_COLLATION_NAME\` FROM \`information_schema\`.\`SCHEMATA\` WHERE \`SCHEMA_NAME\`='${params.database}'`;
|
const collation = await connections[params.uid].getDatabaseCollation(params);
|
||||||
const collation = await connections[params.uid].raw(query);
|
|
||||||
|
|
||||||
return { status: 'success', response: collation.rows.length ? collation.rows[0].DEFAULT_COLLATION_NAME : '' };
|
return { status: 'success', response: collation.rows.length ? collation.rows[0].DEFAULT_COLLATION_NAME : '' };
|
||||||
}
|
}
|
||||||
@@ -132,7 +128,7 @@ export default connections => {
|
|||||||
if (!query) return;
|
if (!query) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await connections[uid].raw(query, { nest: true, details: true });
|
const result = await connections[uid].raw(query, { nest: true, details: true, schema });
|
||||||
|
|
||||||
return { status: 'success', response: result };
|
return { status: 'success', response: result };
|
||||||
}
|
}
|
@@ -2,7 +2,7 @@ import { ipcMain } from 'electron';
|
|||||||
import faker from 'faker';
|
import faker from 'faker';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { sqlEscaper } from 'common/libs/sqlEscaper';
|
import { sqlEscaper } from 'common/libs/sqlEscaper';
|
||||||
import { TEXT, LONG_TEXT, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
export default (connections) => {
|
export default (connections) => {
|
||||||
@@ -16,13 +16,15 @@ export default (connections) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('get-table-data', async (event, { uid, schema, table, sortParams }) => {
|
ipcMain.handle('get-table-data', async (event, { uid, schema, table, limit, page, sortParams }) => {
|
||||||
try {
|
try {
|
||||||
|
const offset = (page - 1) * limit;
|
||||||
const query = connections[uid]
|
const query = connections[uid]
|
||||||
.select('*')
|
.select('*')
|
||||||
.schema(schema)
|
.schema(schema)
|
||||||
.from(table)
|
.from(table)
|
||||||
.limit(1000);
|
.limit(limit)
|
||||||
|
.offset(offset);
|
||||||
|
|
||||||
if (sortParams && sortParams.field && sortParams.dir)
|
if (sortParams && sortParams.field && sortParams.dir)
|
||||||
query.orderBy({ [sortParams.field]: sortParams.dir.toUpperCase() });
|
query.orderBy({ [sortParams.field]: sortParams.dir.toUpperCase() });
|
||||||
@@ -59,23 +61,58 @@ export default (connections) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('update-table-cell', async (event, params) => {
|
ipcMain.handle('update-table-cell', async (event, params) => {
|
||||||
try {
|
delete params.row._id;
|
||||||
|
|
||||||
|
try { // TODO: move to client classes
|
||||||
let escapedParam;
|
let escapedParam;
|
||||||
let reload = false;
|
let reload = false;
|
||||||
const id = typeof params.id === 'number' ? params.id : `"${params.id}"`;
|
const id = typeof params.id === 'number' ? params.id : `"${params.id}"`;
|
||||||
|
|
||||||
if ([...NUMBER, ...FLOAT].includes(params.type))
|
if ([...NUMBER, ...FLOAT].includes(params.type))
|
||||||
escapedParam = params.content;
|
escapedParam = params.content;
|
||||||
else if ([...TEXT, ...LONG_TEXT].includes(params.type))
|
else if ([...TEXT, ...LONG_TEXT].includes(params.type)) {
|
||||||
escapedParam = `"${sqlEscaper(params.content)}"`;
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
escapedParam = `"${sqlEscaper(params.content)}"`;
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = `'${params.content.replaceAll('\'', '\'\'')}'`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ARRAY.includes(params.type))
|
||||||
|
escapedParam = `'${params.content}'`;
|
||||||
|
else if (TEXT_SEARCH.includes(params.type))
|
||||||
|
escapedParam = `'${params.content.replaceAll('\'', '\'\'')}'`;
|
||||||
else if (BLOB.includes(params.type)) {
|
else if (BLOB.includes(params.type)) {
|
||||||
if (params.content) {
|
if (params.content) {
|
||||||
const fileBlob = fs.readFileSync(params.content);
|
let fileBlob;
|
||||||
escapedParam = `0x${fileBlob.toString('hex')}`;
|
|
||||||
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
fileBlob = fs.readFileSync(params.content);
|
||||||
|
escapedParam = `0x${fileBlob.toString('hex')}`;
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
fileBlob = fs.readFileSync(params.content);
|
||||||
|
escapedParam = `decode('${fileBlob.toString('hex')}', 'hex')`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
reload = true;
|
reload = true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
escapedParam = '""';
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
escapedParam = '\'\'';
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = 'decode(\'\', \'hex\')';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ([...BIT].includes(params.type)) {
|
else if ([...BIT].includes(params.type)) {
|
||||||
escapedParam = `b'${sqlEscaper(params.content)}'`;
|
escapedParam = `b'${sqlEscaper(params.content)}'`;
|
||||||
@@ -84,32 +121,33 @@ export default (connections) => {
|
|||||||
else if (params.content === null)
|
else if (params.content === null)
|
||||||
escapedParam = 'NULL';
|
escapedParam = 'NULL';
|
||||||
else
|
else
|
||||||
escapedParam = `"${sqlEscaper(params.content)}"`;
|
escapedParam = `'${sqlEscaper(params.content)}'`;
|
||||||
|
|
||||||
if (params.primary) {
|
if (params.primary) { // TODO: handle multiple primary
|
||||||
await connections[params.uid]
|
await connections[params.uid]
|
||||||
.update({ [params.field]: `= ${escapedParam}` })
|
.update({ [params.field]: `= ${escapedParam}` })
|
||||||
.schema(params.schema)
|
.schema(params.schema)
|
||||||
.from(params.table)
|
.from(params.table)
|
||||||
.where({ [params.primary]: `= ${id}` })
|
.where({ [params.primary]: `= ${id}` })
|
||||||
|
.limit(1)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const { row } = params;
|
const { orgRow } = params;
|
||||||
reload = true;
|
reload = true;
|
||||||
|
|
||||||
for (const key in row) {
|
for (const key in orgRow) {
|
||||||
if (typeof row[key] === 'string')
|
if (typeof orgRow[key] === 'string')
|
||||||
row[key] = `'${row[key]}'`;
|
orgRow[key] = `'${orgRow[key]}'`;
|
||||||
|
|
||||||
row[key] = `= ${row[key]}`;
|
orgRow[key] = `= ${orgRow[key]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
await connections[params.uid]
|
await connections[params.uid]
|
||||||
.schema(params.schema)
|
.schema(params.schema)
|
||||||
.update({ [params.field]: `= ${escapedParam}` })
|
.update({ [params.field]: `= ${escapedParam}` })
|
||||||
.from(params.table)
|
.from(params.table)
|
||||||
.where(row)
|
.where(orgRow)
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
@@ -123,9 +161,13 @@ export default (connections) => {
|
|||||||
|
|
||||||
ipcMain.handle('delete-table-rows', async (event, params) => {
|
ipcMain.handle('delete-table-rows', async (event, params) => {
|
||||||
if (params.primary) {
|
if (params.primary) {
|
||||||
const idString = params.rows.map(row => typeof row[params.primary] === 'string'
|
const idString = params.rows.map(row => {
|
||||||
? `"${row[params.primary]}"`
|
const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary;
|
||||||
: row[params.primary]).join(',');
|
|
||||||
|
return typeof row[fieldName] === 'string'
|
||||||
|
? `"${row[fieldName]}"`
|
||||||
|
: row[fieldName];
|
||||||
|
}).join(',');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await connections[params.uid]
|
const result = await connections[params.uid]
|
||||||
@@ -167,7 +209,7 @@ export default (connections) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('insert-table-rows', async (event, params) => {
|
ipcMain.handle('insert-table-rows', async (event, params) => {
|
||||||
try {
|
try { // TODO: move to client classes
|
||||||
const insertObj = {};
|
const insertObj = {};
|
||||||
for (const key in params.row) {
|
for (const key in params.row) {
|
||||||
const type = params.fields[key];
|
const type = params.fields[key];
|
||||||
@@ -176,19 +218,46 @@ export default (connections) => {
|
|||||||
if (params.row[key] === null)
|
if (params.row[key] === null)
|
||||||
escapedParam = 'NULL';
|
escapedParam = 'NULL';
|
||||||
else if ([...NUMBER, ...FLOAT].includes(type))
|
else if ([...NUMBER, ...FLOAT].includes(type))
|
||||||
escapedParam = params.row[key];
|
escapedParam = +params.row[key];
|
||||||
else if ([...TEXT, ...LONG_TEXT].includes(type))
|
else if ([...TEXT, ...LONG_TEXT].includes(type)) {
|
||||||
escapedParam = `"${sqlEscaper(params.row[key])}"`;
|
switch (connections[params.uid]._client) {
|
||||||
else if (BLOB.includes(type)) {
|
case 'mysql':
|
||||||
if (params.row[key]) {
|
case 'maria':
|
||||||
const fileBlob = fs.readFileSync(params.row[key]);
|
escapedParam = `"${sqlEscaper(params.row[key].value)}"`;
|
||||||
escapedParam = `0x${fileBlob.toString('hex')}`;
|
break;
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = `'${params.row[key].value.replaceAll('\'', '\'\'')}'`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (BLOB.includes(type)) {
|
||||||
|
if (params.row[key].value) {
|
||||||
|
let fileBlob;
|
||||||
|
|
||||||
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
fileBlob = fs.readFileSync(params.row[key].value);
|
||||||
|
escapedParam = `0x${fileBlob.toString('hex')}`;
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
fileBlob = fs.readFileSync(params.row[key].value);
|
||||||
|
escapedParam = `decode('${fileBlob.toString('hex')}', 'hex')`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
escapedParam = '""';
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = 'decode(\'\', \'hex\')';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
escapedParam = '""';
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
escapedParam = `"${sqlEscaper(params.row[key])}"`;
|
|
||||||
|
|
||||||
insertObj[key] = escapedParam;
|
insertObj[key] = escapedParam;
|
||||||
}
|
}
|
||||||
@@ -209,7 +278,7 @@ export default (connections) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('insert-table-fake-rows', async (event, params) => {
|
ipcMain.handle('insert-table-fake-rows', async (event, params) => {
|
||||||
try {
|
try { // TODO: move to client classes
|
||||||
const rows = [];
|
const rows = [];
|
||||||
|
|
||||||
for (let i = 0; i < +params.repeat; i++) {
|
for (let i = 0; i < +params.repeat; i++) {
|
||||||
@@ -224,20 +293,49 @@ export default (connections) => {
|
|||||||
escapedParam = 'NULL';
|
escapedParam = 'NULL';
|
||||||
else if ([...NUMBER, ...FLOAT].includes(type))
|
else if ([...NUMBER, ...FLOAT].includes(type))
|
||||||
escapedParam = params.row[key].value;
|
escapedParam = params.row[key].value;
|
||||||
else if ([...TEXT, ...LONG_TEXT].includes(type))
|
else if ([...TEXT, ...LONG_TEXT].includes(type)) {
|
||||||
escapedParam = `"${sqlEscaper(params.row[key].value)}"`;
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
escapedParam = `"${sqlEscaper(params.row[key].value)}"`;
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = `'${params.row[key].value.replaceAll('\'', '\'\'')}'`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (BLOB.includes(type)) {
|
else if (BLOB.includes(type)) {
|
||||||
if (params.row[key].value) {
|
if (params.row[key].value) {
|
||||||
const fileBlob = fs.readFileSync(params.row[key].value);
|
let fileBlob;
|
||||||
escapedParam = `0x${fileBlob.toString('hex')}`;
|
|
||||||
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
fileBlob = fs.readFileSync(params.row[key].value);
|
||||||
|
escapedParam = `0x${fileBlob.toString('hex')}`;
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
fileBlob = fs.readFileSync(params.row[key].value);
|
||||||
|
escapedParam = `decode('${fileBlob.toString('hex')}', 'hex')`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (connections[params.uid]._client) {
|
||||||
|
case 'mysql':
|
||||||
|
case 'maria':
|
||||||
|
escapedParam = '""';
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
escapedParam = 'decode(\'\', \'hex\')';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
escapedParam = '""';
|
|
||||||
}
|
}
|
||||||
else if (BIT.includes(type))
|
else if (BIT.includes(type))
|
||||||
escapedParam = `b'${sqlEscaper(params.row[key].value)}'`;
|
escapedParam = `b'${sqlEscaper(params.row[key].value)}'`;
|
||||||
else
|
else
|
||||||
escapedParam = `"${sqlEscaper(params.row[key].value)}"`;
|
escapedParam = `'${sqlEscaper(params.row[key].value)}'`;
|
||||||
|
|
||||||
insertObj[key] = escapedParam;
|
insertObj[key] = escapedParam;
|
||||||
}
|
}
|
||||||
@@ -261,10 +359,10 @@ export default (connections) => {
|
|||||||
if (typeof fakeValue === 'string') {
|
if (typeof fakeValue === 'string') {
|
||||||
if (params.row[key].length)
|
if (params.row[key].length)
|
||||||
fakeValue = fakeValue.substr(0, params.row[key].length);
|
fakeValue = fakeValue.substr(0, params.row[key].length);
|
||||||
fakeValue = `"${sqlEscaper(fakeValue)}"`;
|
fakeValue = `'${sqlEscaper(fakeValue)}'`;
|
||||||
}
|
}
|
||||||
else if ([...DATE, ...DATETIME].includes(type))
|
else if ([...DATE, ...DATETIME].includes(type))
|
||||||
fakeValue = `"${moment(fakeValue).format('YYYY-MM-DD HH:mm:ss.SSSSSS')}"`;
|
fakeValue = `'${moment(fakeValue).format('YYYY-MM-DD HH:mm:ss.SSSSSS')}'`;
|
||||||
|
|
||||||
insertObj[key] = fakeValue;
|
insertObj[key] = fakeValue;
|
||||||
}
|
}
|
||||||
@@ -289,13 +387,13 @@ export default (connections) => {
|
|||||||
ipcMain.handle('get-foreign-list', async (event, { uid, schema, table, column, description }) => {
|
ipcMain.handle('get-foreign-list', async (event, { uid, schema, table, column, description }) => {
|
||||||
try {
|
try {
|
||||||
const query = connections[uid]
|
const query = connections[uid]
|
||||||
.select(`${column} AS foreignColumn`)
|
.select(`${column} AS foreign_column`)
|
||||||
.schema(schema)
|
.schema(schema)
|
||||||
.from(table)
|
.from(table)
|
||||||
.orderBy('foreignColumn ASC');
|
.orderBy('foreign_column ASC');
|
||||||
|
|
||||||
if (description)
|
if (description)
|
||||||
query.select(`LEFT(${description}, 20) AS foreignDescription`);
|
query.select(`LEFT(${description}, 20) AS foreign_description`);
|
||||||
|
|
||||||
const results = await query.run();
|
const results = await query.run();
|
||||||
|
|
||||||
|
@@ -9,10 +9,13 @@ autoUpdater.allowPrerelease = persistentStore.get('allow_prerelease', true);
|
|||||||
export default () => {
|
export default () => {
|
||||||
ipcMain.on('check-for-updates', event => {
|
ipcMain.on('check-for-updates', event => {
|
||||||
mainWindow = event;
|
mainWindow = event;
|
||||||
|
if (process.windowsStore)
|
||||||
autoUpdater.checkForUpdatesAndNotify().catch(() => {
|
mainWindow.reply('no-auto-update');
|
||||||
mainWindow.reply('check-failed');
|
else {
|
||||||
});
|
autoUpdater.checkForUpdatesAndNotify().catch(() => {
|
||||||
|
mainWindow.reply('check-failed');
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('restart-to-update', () => {
|
ipcMain.on('restart-to-update', () => {
|
||||||
|
@@ -26,6 +26,7 @@ export class AntaresCore {
|
|||||||
groupBy: [],
|
groupBy: [],
|
||||||
orderBy: [],
|
orderBy: [],
|
||||||
limit: [],
|
limit: [],
|
||||||
|
offset: [],
|
||||||
join: [],
|
join: [],
|
||||||
update: [],
|
update: [],
|
||||||
insert: [],
|
insert: [],
|
||||||
@@ -109,6 +110,11 @@ export class AntaresCore {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offset (...args) {
|
||||||
|
this._query.offset = args;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String | Array} args field = value
|
* @param {String | Array} args field = value
|
||||||
* @returns
|
* @returns
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { MySQLClient } from './clients/MySQLClient';
|
import { MySQLClient } from './clients/MySQLClient';
|
||||||
|
import { PostgreSQLClient } from './clients/PostgreSQLClient';
|
||||||
|
|
||||||
export class ClientsFactory {
|
export class ClientsFactory {
|
||||||
/**
|
/**
|
||||||
@@ -20,8 +21,10 @@ export class ClientsFactory {
|
|||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'maria':
|
case 'maria':
|
||||||
return new MySQLClient(args);
|
return new MySQLClient(args);
|
||||||
|
case 'pg':
|
||||||
|
return new PostgreSQLClient(args);
|
||||||
default:
|
default:
|
||||||
return new Error(`Unknown database client: ${args.client}`);
|
throw new Error(`Unknown database client: ${args.client}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import mysql from 'mysql2';
|
import mysql from 'mysql2/promise';
|
||||||
import { AntaresCore } from '../AntaresCore';
|
import { AntaresCore } from '../AntaresCore';
|
||||||
import dataTypes from 'common/data-types/mysql';
|
import dataTypes from 'common/data-types/mysql';
|
||||||
|
|
||||||
@@ -7,6 +7,8 @@ export class MySQLClient extends AntaresCore {
|
|||||||
constructor (args) {
|
constructor (args) {
|
||||||
super(args);
|
super(args);
|
||||||
|
|
||||||
|
this._schema = null;
|
||||||
|
|
||||||
this.types = {
|
this.types = {
|
||||||
0: 'DECIMAL',
|
0: 'DECIMAL',
|
||||||
1: 'TINYINT',
|
1: 'TINYINT',
|
||||||
@@ -100,10 +102,22 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async connect () {
|
async connect () {
|
||||||
|
delete this._params.application_name;
|
||||||
|
|
||||||
if (!this._poolSize)
|
if (!this._poolSize)
|
||||||
this._connection = mysql.createConnection(this._params);
|
this._connection = await mysql.createConnection(this._params);
|
||||||
else
|
else {
|
||||||
this._connection = mysql.createPool({ ...this._params, connectionLimit: this._poolSize });
|
this._connection = mysql.createPool({
|
||||||
|
...this._params,
|
||||||
|
connectionLimit: this._poolSize,
|
||||||
|
typeCast: (field, next) => {
|
||||||
|
if (field.type === 'DATETIME')
|
||||||
|
return field.string();
|
||||||
|
else
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,6 +134,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
use (schema) {
|
use (schema) {
|
||||||
|
this._schema = schema;
|
||||||
return this.raw(`USE \`${schema}\``);
|
return this.raw(`USE \`${schema}\``);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,29 +305,78 @@ export class MySQLClient extends AntaresCore {
|
|||||||
.select('*')
|
.select('*')
|
||||||
.schema('information_schema')
|
.schema('information_schema')
|
||||||
.from('COLUMNS')
|
.from('COLUMNS')
|
||||||
.where({ TABLE_SCHEMA: `= '${schema}'`, TABLE_NAME: `= '${table}'` })
|
.where({ TABLE_SCHEMA: `= '${this._schema || schema}'`, TABLE_NAME: `= '${table}'` })
|
||||||
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
const { rows: fields } = await this.raw(`SHOW CREATE TABLE \`${this._schema || schema}\`.\`${table}\``);
|
||||||
|
|
||||||
|
const remappedFields = fields.map(row => {
|
||||||
|
let n = 0;
|
||||||
|
return row['Create Table']
|
||||||
|
.split('')
|
||||||
|
.reduce((acc, curr) => {
|
||||||
|
if (curr === ')') n--;
|
||||||
|
if (n !== 0) acc += curr;
|
||||||
|
if (curr === '(') n++;
|
||||||
|
return acc;
|
||||||
|
}, '')
|
||||||
|
.replaceAll('\n', '')
|
||||||
|
.split(',')
|
||||||
|
.map(f => {
|
||||||
|
try {
|
||||||
|
const fieldArr = f.trim().split(' ');
|
||||||
|
const nameAndType = fieldArr.slice(0, 2);
|
||||||
|
if (nameAndType[0].charAt(0) !== '`') return false;
|
||||||
|
|
||||||
|
const details = fieldArr.slice(2).join(' ');
|
||||||
|
let defaultValue = null;
|
||||||
|
if (details.includes('DEFAULT'))
|
||||||
|
defaultValue = details.match(/(?<=DEFAULT ).*?$/gs)[0].split(' COMMENT')[0];
|
||||||
|
|
||||||
|
const typeAndLength = nameAndType[1].replace(')', '').split('(');
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: nameAndType[0].replaceAll('`', ''),
|
||||||
|
type: typeAndLength[0].toUpperCase(),
|
||||||
|
length: typeAndLength[1] ? typeAndLength[1] : null,
|
||||||
|
default: defaultValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(Boolean)
|
||||||
|
.reduce((acc, curr) => {
|
||||||
|
acc[curr.name] = curr;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
})[0];
|
||||||
|
|
||||||
return rows.map(field => {
|
return rows.map(field => {
|
||||||
let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/);
|
let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/);
|
||||||
numLength = numLength ? +numLength.pop() : null;
|
numLength = numLength ? +numLength.pop() : null;
|
||||||
|
const enumValues = /(enum|set)/.test(field.COLUMN_TYPE)
|
||||||
|
? field.COLUMN_TYPE.match(/\(([^)]+)\)/)[0].slice(1, -1)
|
||||||
|
: null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: field.COLUMN_NAME,
|
name: field.COLUMN_NAME,
|
||||||
key: field.COLUMN_KEY.toLowerCase(),
|
key: field.COLUMN_KEY.toLowerCase(),
|
||||||
type: field.DATA_TYPE.toUpperCase(),
|
type: remappedFields[field.COLUMN_NAME].type,
|
||||||
schema: field.TABLE_SCHEMA,
|
schema: field.TABLE_SCHEMA,
|
||||||
table: field.TABLE_NAME,
|
table: field.TABLE_NAME,
|
||||||
numPrecision: field.NUMERIC_PRECISION,
|
numPrecision: field.NUMERIC_PRECISION,
|
||||||
numLength,
|
numLength,
|
||||||
|
enumValues,
|
||||||
datePrecision: field.DATETIME_PRECISION,
|
datePrecision: field.DATETIME_PRECISION,
|
||||||
charLength: field.CHARACTER_MAXIMUM_LENGTH,
|
charLength: field.CHARACTER_MAXIMUM_LENGTH,
|
||||||
nullable: field.IS_NULLABLE.includes('YES'),
|
nullable: field.IS_NULLABLE.includes('YES'),
|
||||||
unsigned: field.COLUMN_TYPE.includes('unsigned'),
|
unsigned: field.COLUMN_TYPE.includes('unsigned'),
|
||||||
zerofill: field.COLUMN_TYPE.includes('zerofill'),
|
zerofill: field.COLUMN_TYPE.includes('zerofill'),
|
||||||
order: field.ORDINAL_POSITION,
|
order: field.ORDINAL_POSITION,
|
||||||
default: field.COLUMN_DEFAULT,
|
default: remappedFields[field.COLUMN_NAME].default,
|
||||||
charset: field.CHARACTER_SET_NAME,
|
charset: field.CHARACTER_SET_NAME,
|
||||||
collation: field.COLLATION_NAME,
|
collation: field.COLLATION_NAME,
|
||||||
autoIncrement: field.EXTRA.includes('auto_increment'),
|
autoIncrement: field.EXTRA.includes('auto_increment'),
|
||||||
@@ -404,6 +468,44 @@ export class MySQLClient extends AntaresCore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CREATE DATABASE
|
||||||
|
*
|
||||||
|
* @returns {Array.<Object>} parameters
|
||||||
|
* @memberof MySQLClient
|
||||||
|
*/
|
||||||
|
async createSchema (params) {
|
||||||
|
return await this.raw(`CREATE DATABASE \`${params.name}\` COLLATE ${params.collation}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ALTER DATABASE
|
||||||
|
*
|
||||||
|
* @returns {Array.<Object>} parameters
|
||||||
|
* @memberof MySQLClient
|
||||||
|
*/
|
||||||
|
async alterSchema (params) {
|
||||||
|
return await this.raw(`ALTER DATABASE \`${params.name}\` COLLATE ${params.collation}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DROP DATABASE
|
||||||
|
*
|
||||||
|
* @returns {Array.<Object>} parameters
|
||||||
|
* @memberof MySQLClient
|
||||||
|
*/
|
||||||
|
async dropSchema (params) {
|
||||||
|
return await this.raw(`DROP DATABASE \`${params.database}\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Array.<Object>} parameters
|
||||||
|
* @memberof MySQLClient
|
||||||
|
*/
|
||||||
|
async getDatabaseCollation (params) {
|
||||||
|
return await this.raw(`SELECT \`DEFAULT_COLLATION_NAME\` FROM \`information_schema\`.\`SCHEMATA\` WHERE \`SCHEMA_NAME\`='${params.database}'`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SHOW CREATE VIEW
|
* SHOW CREATE VIEW
|
||||||
*
|
*
|
||||||
@@ -433,7 +535,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async dropView (params) {
|
async dropView (params) {
|
||||||
const sql = `DROP VIEW \`${params.view}\``;
|
const sql = `DROP VIEW \`${this._schema}\`.\`${params.view}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,10 +547,10 @@ export class MySQLClient extends AntaresCore {
|
|||||||
*/
|
*/
|
||||||
async alterView (params) {
|
async alterView (params) {
|
||||||
const { view } = params;
|
const { view } = params;
|
||||||
let sql = `ALTER ALGORITHM = ${view.algorithm}${view.definer ? ` DEFINER=${view.definer}` : ''} SQL SECURITY ${view.security} VIEW \`${view.oldName}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`;
|
let sql = `ALTER ALGORITHM = ${view.algorithm}${view.definer ? ` DEFINER=${view.definer}` : ''} SQL SECURITY ${view.security} VIEW \`${this._schema}\`.\`${view.oldName}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`;
|
||||||
|
|
||||||
if (view.name !== view.oldName)
|
if (view.name !== view.oldName)
|
||||||
sql += `; RENAME TABLE \`${view.oldName}\` TO \`${view.name}\``;
|
sql += `; RENAME TABLE \`${this._schema}\`.\`${view.oldName}\` TO \`${this._schema}\`.\`${view.name}\``;
|
||||||
|
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
@@ -460,7 +562,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async createView (view) {
|
async createView (view) {
|
||||||
const sql = `CREATE ALGORITHM = ${view.algorithm} ${view.definer ? `DEFINER=${view.definer} ` : ''}SQL SECURITY ${view.security} VIEW \`${view.name}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`;
|
const sql = `CREATE ALGORITHM = ${view.algorithm} ${view.definer ? `DEFINER=${view.definer} ` : ''}SQL SECURITY ${view.security} VIEW \`${this._schema}\`.\`${view.name}\` AS ${view.sql} ${view.updateOption ? `WITH ${view.updateOption} CHECK OPTION` : ''}`;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +595,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async dropTrigger (params) {
|
async dropTrigger (params) {
|
||||||
const sql = `DROP TRIGGER \`${params.trigger}\``;
|
const sql = `DROP TRIGGER \`${this._schema}\`.\`${params.trigger}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +628,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async createTrigger (trigger) {
|
async createTrigger (trigger) {
|
||||||
const sql = `CREATE ${trigger.definer ? `DEFINER=${trigger.definer} ` : ''}TRIGGER \`${trigger.name}\` ${trigger.event1} ${trigger.event2} ON \`${trigger.table}\` FOR EACH ROW ${trigger.sql}`;
|
const sql = `CREATE ${trigger.definer ? `DEFINER=${trigger.definer} ` : ''}TRIGGER \`${this._schema}\`.\`${trigger.name}\` ${trigger.event1} ${trigger.event2} ON \`${trigger.table}\` FOR EACH ROW ${trigger.sql}`;
|
||||||
return await this.raw(sql, { split: false });
|
return await this.raw(sql, { split: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +642,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
const sql = `SHOW CREATE PROCEDURE \`${schema}\`.\`${routine}\``;
|
const sql = `SHOW CREATE PROCEDURE \`${schema}\`.\`${routine}\``;
|
||||||
const results = await this.raw(sql);
|
const results = await this.raw(sql);
|
||||||
|
|
||||||
return results.rows.map(row => {
|
return results.rows.map(async row => {
|
||||||
if (!row['Create Procedure']) {
|
if (!row['Create Procedure']) {
|
||||||
return {
|
return {
|
||||||
definer: null,
|
definer: null,
|
||||||
@@ -554,22 +656,23 @@ export class MySQLClient extends AntaresCore {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const parameters = row['Create Procedure']
|
const sql = `SELECT *
|
||||||
.match(/(\([^()]*(?:(?:\([^()]*\))[^()]*)*\)\s*)/s)[0]
|
FROM information_schema.parameters
|
||||||
.replaceAll('\r', '')
|
WHERE SPECIFIC_NAME = '${routine}'
|
||||||
.replaceAll('\t', '')
|
AND SPECIFIC_SCHEMA = '${schema}'
|
||||||
.slice(1, -1)
|
ORDER BY ORDINAL_POSITION
|
||||||
.split(',')
|
`;
|
||||||
.map(el => {
|
|
||||||
const param = el.split(' ');
|
const results = await this.raw(sql);
|
||||||
const type = param[2] ? param[2].replace(')', '').split('(') : ['', null];
|
|
||||||
return {
|
const parameters = results.rows.map(row => {
|
||||||
name: param[1] ? param[1].replaceAll('`', '') : '',
|
return {
|
||||||
type: type[0].replaceAll('\n', ''),
|
name: row.PARAMETER_NAME,
|
||||||
length: +type[1] ? +type[1].replace(/\D/g, '') : '',
|
type: row.DATA_TYPE.toUpperCase(),
|
||||||
context: param[0] ? param[0].replace('\n', '') : ''
|
length: row.NUMERIC_PRECISION || row.DATETIME_PRECISION || row.CHARACTER_MAXIMUM_LENGTH || '',
|
||||||
};
|
context: row.PARAMETER_MODE
|
||||||
}).filter(el => el.name);
|
};
|
||||||
|
});
|
||||||
|
|
||||||
let dataAccess = 'CONTAINS SQL';
|
let dataAccess = 'CONTAINS SQL';
|
||||||
if (row['Create Procedure'].includes('NO SQL'))
|
if (row['Create Procedure'].includes('NO SQL'))
|
||||||
@@ -599,7 +702,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async dropRoutine (params) {
|
async dropRoutine (params) {
|
||||||
const sql = `DROP PROCEDURE \`${params.routine}\``;
|
const sql = `DROP PROCEDURE \`${this._schema}\`.\`${params.routine}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,7 +742,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
}, []).join(',')
|
}, []).join(',')
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const sql = `CREATE ${routine.definer ? `DEFINER=${routine.definer} ` : ''}PROCEDURE \`${routine.name}\`(${parameters})
|
const sql = `CREATE ${routine.definer ? `DEFINER=${routine.definer} ` : ''}PROCEDURE \`${this._schema}\`.\`${routine.name}\`(${parameters})
|
||||||
LANGUAGE SQL
|
LANGUAGE SQL
|
||||||
${routine.deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'}
|
${routine.deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'}
|
||||||
${routine.dataAccess}
|
${routine.dataAccess}
|
||||||
@@ -660,7 +763,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
const sql = `SHOW CREATE FUNCTION \`${schema}\`.\`${func}\``;
|
const sql = `SHOW CREATE FUNCTION \`${schema}\`.\`${func}\``;
|
||||||
const results = await this.raw(sql);
|
const results = await this.raw(sql);
|
||||||
|
|
||||||
return results.rows.map(row => {
|
return results.rows.map(async row => {
|
||||||
if (!row['Create Function']) {
|
if (!row['Create Function']) {
|
||||||
return {
|
return {
|
||||||
definer: null,
|
definer: null,
|
||||||
@@ -676,22 +779,23 @@ export class MySQLClient extends AntaresCore {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const parameters = row['Create Function']
|
const sql = `SELECT *
|
||||||
.match(/(\([^()]*(?:(?:\([^()]*\))[^()]*)*\)\s*)/s)[0]
|
FROM information_schema.parameters
|
||||||
.replaceAll('\r', '')
|
WHERE SPECIFIC_NAME = '${func}'
|
||||||
.replaceAll('\t', '')
|
AND SPECIFIC_SCHEMA = '${schema}'
|
||||||
.slice(1, -1)
|
ORDER BY ORDINAL_POSITION
|
||||||
.split(',')
|
`;
|
||||||
.map(el => {
|
|
||||||
const param = el.split(' ');
|
|
||||||
const type = param[1] ? param[1].replace(')', '').split('(') : ['', null];
|
|
||||||
|
|
||||||
return {
|
const results = await this.raw(sql);
|
||||||
name: param[0] ? param[0].replaceAll('`', '') : '',
|
|
||||||
type: type[0],
|
const parameters = results.rows.filter(row => row.PARAMETER_MODE).map(row => {
|
||||||
length: +type[1] ? +type[1].replace(/\D/g, '') : ''
|
return {
|
||||||
};
|
name: row.PARAMETER_NAME,
|
||||||
}).filter(el => el.name);
|
type: row.DATA_TYPE.toUpperCase(),
|
||||||
|
length: row.NUMERIC_PRECISION || row.DATETIME_PRECISION || row.CHARACTER_MAXIMUM_LENGTH || '',
|
||||||
|
context: row.PARAMETER_MODE
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
let dataAccess = 'CONTAINS SQL';
|
let dataAccess = 'CONTAINS SQL';
|
||||||
if (row['Create Function'].includes('NO SQL'))
|
if (row['Create Function'].includes('NO SQL'))
|
||||||
@@ -725,7 +829,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async dropFunction (params) {
|
async dropFunction (params) {
|
||||||
const sql = `DROP FUNCTION \`${params.func}\``;
|
const sql = `DROP FUNCTION \`${this._schema}\`.\`${params.func}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,13 +867,15 @@ export class MySQLClient extends AntaresCore {
|
|||||||
return acc;
|
return acc;
|
||||||
}, []).join(',');
|
}, []).join(',');
|
||||||
|
|
||||||
const sql = `CREATE ${func.definer ? `DEFINER=${func.definer} ` : ''}FUNCTION \`${func.name}\`(${parameters}) RETURNS ${func.returns}${func.returnsLength ? `(${func.returnsLength})` : ''}
|
const body = func.returns ? func.sql : 'BEGIN\n RETURN 0;\nEND';
|
||||||
|
|
||||||
|
const sql = `CREATE ${func.definer ? `DEFINER=${func.definer} ` : ''}FUNCTION \`${this._schema}\`.\`${func.name}\`(${parameters}) RETURNS ${func.returns || 'SMALLINT'}${func.returnsLength ? `(${func.returnsLength})` : ''}
|
||||||
LANGUAGE SQL
|
LANGUAGE SQL
|
||||||
${func.deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'}
|
${func.deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC'}
|
||||||
${func.dataAccess}
|
${func.dataAccess}
|
||||||
SQL SECURITY ${func.security}
|
SQL SECURITY ${func.security}
|
||||||
COMMENT '${func.comment}'
|
COMMENT '${func.comment}'
|
||||||
${func.sql}`;
|
${body}`;
|
||||||
|
|
||||||
return await this.raw(sql, { split: false });
|
return await this.raw(sql, { split: false });
|
||||||
}
|
}
|
||||||
@@ -815,7 +921,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async dropEvent (params) {
|
async dropEvent (params) {
|
||||||
const sql = `DROP EVENT \`${params.scheduler}\``;
|
const sql = `DROP EVENT \`${this._schema}\`.\`${params.scheduler}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,13 +937,13 @@ export class MySQLClient extends AntaresCore {
|
|||||||
if (scheduler.execution === 'EVERY' && scheduler.every[0].includes('-'))
|
if (scheduler.execution === 'EVERY' && scheduler.every[0].includes('-'))
|
||||||
scheduler.every[0] = `'${scheduler.every[0]}'`;
|
scheduler.every[0] = `'${scheduler.every[0]}'`;
|
||||||
|
|
||||||
const sql = `ALTER ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${scheduler.oldName}\`
|
const sql = `ALTER ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${this._schema}\`.\`${scheduler.oldName}\`
|
||||||
ON SCHEDULE
|
ON SCHEDULE
|
||||||
${scheduler.execution === 'EVERY'
|
${scheduler.execution === 'EVERY'
|
||||||
? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
|
? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
|
||||||
: `AT '${scheduler.at}'`}
|
: `AT '${scheduler.at}'`}
|
||||||
ON COMPLETION${!scheduler.preserve ? ' NOT' : ''} PRESERVE
|
ON COMPLETION${!scheduler.preserve ? ' NOT' : ''} PRESERVE
|
||||||
${scheduler.name !== scheduler.oldName ? `RENAME TO \`${scheduler.name}\`` : ''}
|
${scheduler.name !== scheduler.oldName ? `RENAME TO \`${this._schema}\`.\`${scheduler.name}\`` : ''}
|
||||||
${scheduler.state}
|
${scheduler.state}
|
||||||
COMMENT '${scheduler.comment}'
|
COMMENT '${scheduler.comment}'
|
||||||
DO ${scheduler.sql}`;
|
DO ${scheduler.sql}`;
|
||||||
@@ -852,7 +958,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async createEvent (scheduler) {
|
async createEvent (scheduler) {
|
||||||
const sql = `CREATE ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${scheduler.name}\`
|
const sql = `CREATE ${scheduler.definer ? ` DEFINER=${scheduler.definer}` : ''} EVENT \`${this._schema}\`.\`${scheduler.name}\`
|
||||||
ON SCHEDULE
|
ON SCHEDULE
|
||||||
${scheduler.execution === 'EVERY'
|
${scheduler.execution === 'EVERY'
|
||||||
? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
|
? `EVERY ${scheduler.every.join(' ')}${scheduler.starts ? ` STARTS '${scheduler.starts}'` : ''}${scheduler.ends ? ` ENDS '${scheduler.ends}'` : ''}`
|
||||||
@@ -989,7 +1095,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
engine
|
engine
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
const sql = `CREATE TABLE \`${name}\` (\`${name}_ID\` INT NULL) COMMENT='${comment}', COLLATE='${collation}', ENGINE=${engine}`;
|
const sql = `CREATE TABLE \`${this._schema}\`.\`${name}\` (\`${name}_ID\` INT NULL) COMMENT='${comment}', COLLATE='${collation}', ENGINE=${engine}`;
|
||||||
|
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
@@ -1011,7 +1117,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
options
|
options
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
let sql = `ALTER TABLE \`${table}\` `;
|
let sql = `ALTER TABLE \`${this._schema || params.options.schema}\`.\`${table}\` `;
|
||||||
const alterColumns = [];
|
const alterColumns = [];
|
||||||
|
|
||||||
// OPTIONS
|
// OPTIONS
|
||||||
@@ -1023,7 +1129,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
// ADD FIELDS
|
// ADD FIELDS
|
||||||
additions.forEach(addition => {
|
additions.forEach(addition => {
|
||||||
const typeInfo = this._getTypeInfo(addition.type);
|
const typeInfo = this._getTypeInfo(addition.type);
|
||||||
const length = typeInfo.length ? addition.numLength || addition.charLength || addition.datePrecision : false;
|
const length = typeInfo.length ? addition.enumValues || addition.numLength || addition.charLength || addition.datePrecision : false;
|
||||||
|
|
||||||
alterColumns.push(`ADD COLUMN \`${addition.name}\`
|
alterColumns.push(`ADD COLUMN \`${addition.name}\`
|
||||||
${addition.type.toUpperCase()}${length ? `(${length})` : ''}
|
${addition.type.toUpperCase()}${length ? `(${length})` : ''}
|
||||||
@@ -1061,7 +1167,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
// CHANGE FIELDS
|
// CHANGE FIELDS
|
||||||
changes.forEach(change => {
|
changes.forEach(change => {
|
||||||
const typeInfo = this._getTypeInfo(change.type);
|
const typeInfo = this._getTypeInfo(change.type);
|
||||||
const length = typeInfo.length ? change.numLength || change.charLength || change.datePrecision : false;
|
const length = typeInfo.length ? change.enumValues || change.numLength || change.charLength || change.datePrecision : false;
|
||||||
|
|
||||||
alterColumns.push(`CHANGE COLUMN \`${change.orgName}\` \`${change.name}\`
|
alterColumns.push(`CHANGE COLUMN \`${change.orgName}\` \`${change.name}\`
|
||||||
${change.type.toUpperCase()}${length ? `(${length})` : ''}
|
${change.type.toUpperCase()}${length ? `(${length})` : ''}
|
||||||
@@ -1123,7 +1229,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
sql += alterColumns.join(', ');
|
sql += alterColumns.join(', ');
|
||||||
|
|
||||||
// RENAME
|
// RENAME
|
||||||
if (options.name) sql += `; RENAME TABLE \`${table}\` TO \`${options.name}\``;
|
if (options.name) sql += `; RENAME TABLE \`${this._schema}\`.\`${table}\` TO \`${this._schema}\`.\`${options.name}\``;
|
||||||
|
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1241,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async truncateTable (params) {
|
async truncateTable (params) {
|
||||||
const sql = `TRUNCATE TABLE \`${params.table}\``;
|
const sql = `TRUNCATE TABLE \`${this._schema}\`.\`${params.table}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1146,7 +1252,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async dropTable (params) {
|
async dropTable (params) {
|
||||||
const sql = `DROP TABLE \`${params.table}\``;
|
const sql = `DROP TABLE \`${this._schema}\`.\`${params.table}\``;
|
||||||
return await this.raw(sql);
|
return await this.raw(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,7 +1307,10 @@ export class MySQLClient extends AntaresCore {
|
|||||||
// LIMIT
|
// LIMIT
|
||||||
const limitRaw = this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : '';
|
const limitRaw = this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : '';
|
||||||
|
|
||||||
return `${selectRaw}${updateRaw ? 'UPDATE' : ''}${insertRaw ? 'INSERT ' : ''}${this._query.delete ? 'DELETE ' : ''}${fromRaw}${updateRaw}${whereRaw}${groupByRaw}${orderByRaw}${limitRaw}${insertRaw}`;
|
// OFFSET
|
||||||
|
const offsetRaw = this._query.offset.length ? `OFFSET ${this._query.offset.join(', ')} ` : '';
|
||||||
|
|
||||||
|
return `${selectRaw}${updateRaw ? 'UPDATE' : ''}${insertRaw ? 'INSERT ' : ''}${this._query.delete ? 'DELETE ' : ''}${fromRaw}${updateRaw}${whereRaw}${groupByRaw}${orderByRaw}${limitRaw}${offsetRaw}${insertRaw}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1214,18 +1323,24 @@ export class MySQLClient extends AntaresCore {
|
|||||||
* @memberof MySQLClient
|
* @memberof MySQLClient
|
||||||
*/
|
*/
|
||||||
async raw (sql, args) {
|
async raw (sql, args) {
|
||||||
|
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
nest: false,
|
nest: false,
|
||||||
details: false,
|
details: false,
|
||||||
split: true,
|
split: true,
|
||||||
...args
|
...args
|
||||||
};
|
};
|
||||||
|
|
||||||
const nestTables = args.nest ? '.' : false;
|
const nestTables = args.nest ? '.' : false;
|
||||||
const resultsArr = [];
|
const resultsArr = [];
|
||||||
let paramsArr = [];
|
let paramsArr = [];
|
||||||
const queries = args.split ? sql.split(';') : [sql];
|
const queries = args.split ? sql.split(/((?:[^;'"]*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*')[^;'"]*)+)|;/gm) : [sql];
|
||||||
|
const isPool = typeof this._connection.getConnection === 'function';
|
||||||
|
const connection = isPool ? await this._connection.getConnection() : this._connection;
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder
|
if (args.schema)
|
||||||
|
await connection.query(`USE \`${args.schema}\``);
|
||||||
|
|
||||||
for (const query of queries) {
|
for (const query of queries) {
|
||||||
if (!query) continue;
|
if (!query) continue;
|
||||||
@@ -1234,87 +1349,87 @@ export class MySQLClient extends AntaresCore {
|
|||||||
let keysArr = [];
|
let keysArr = [];
|
||||||
|
|
||||||
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
|
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
|
||||||
this._connection.query({ sql: query, nestTables }, async (err, response, fields) => {
|
connection.query({ sql: query, nestTables }).then(async ([response, fields]) => {
|
||||||
timeStop = new Date();
|
timeStop = new Date();
|
||||||
const queryResult = response;
|
const queryResult = response;
|
||||||
|
|
||||||
if (err)
|
let remappedFields = fields
|
||||||
reject(err);
|
? fields.map(field => {
|
||||||
else {
|
if (!field || Array.isArray(field))
|
||||||
let remappedFields = fields
|
return false;
|
||||||
? fields.map(field => {
|
|
||||||
if (!field || Array.isArray(field))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const type = this._getType(field);
|
const type = this._getType(field);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: field.orgName,
|
||||||
|
alias: field.name,
|
||||||
|
orgName: field.orgName,
|
||||||
|
schema: field.schema,
|
||||||
|
table: field.table,
|
||||||
|
tableAlias: field.table,
|
||||||
|
orgTable: field.orgTable,
|
||||||
|
type: type.name,
|
||||||
|
length: type.length
|
||||||
|
};
|
||||||
|
}).filter(Boolean)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
if (args.details) {
|
||||||
|
let cachedTable;
|
||||||
|
|
||||||
|
if (remappedFields.length) {
|
||||||
|
paramsArr = remappedFields.map(field => {
|
||||||
|
if (field.orgTable) cachedTable = field.orgTable;// Needed for some queries on information_schema
|
||||||
return {
|
return {
|
||||||
name: field.orgName,
|
table: field.orgTable || cachedTable,
|
||||||
alias: field.name,
|
schema: field.schema || 'INFORMATION_SCHEMA'
|
||||||
orgName: field.orgName,
|
|
||||||
schema: field.schema,
|
|
||||||
table: field.table,
|
|
||||||
tableAlias: field.table,
|
|
||||||
orgTable: field.orgTable,
|
|
||||||
type: type.name,
|
|
||||||
length: type.length
|
|
||||||
};
|
};
|
||||||
}).filter(Boolean)
|
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
|
||||||
: [];
|
|
||||||
|
|
||||||
if (args.details) {
|
for (const paramObj of paramsArr) {
|
||||||
let cachedTable;
|
if (!paramObj.table || !paramObj.schema) continue;
|
||||||
|
|
||||||
if (remappedFields.length) {
|
try { // Column details
|
||||||
paramsArr = remappedFields.map(field => {
|
const response = await this.getTableColumns(paramObj);
|
||||||
if (field.orgTable) cachedTable = field.orgTable;// Needed for some queries on information_schema
|
remappedFields = remappedFields.map(field => {
|
||||||
return {
|
const detailedField = response.find(f => f.name === field.name);
|
||||||
table: field.orgTable || cachedTable,
|
if (detailedField && field.orgTable === paramObj.table && field.schema === paramObj.schema)
|
||||||
schema: field.schema || 'INFORMATION_SCHEMA'
|
field = { ...field, ...detailedField };
|
||||||
};
|
return field;
|
||||||
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
|
});
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (isPool) connection.release();
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
|
||||||
for (const paramObj of paramsArr) {
|
try { // Key usage (foreign keys)
|
||||||
if (!paramObj.table || !paramObj.schema) continue;
|
const response = await this.getKeyUsage(paramObj);
|
||||||
|
keysArr = keysArr ? [...keysArr, ...response] : response;
|
||||||
try { // Column details
|
}
|
||||||
const response = await this.getTableColumns(paramObj);
|
catch (err) {
|
||||||
remappedFields = remappedFields.map(field => {
|
if (isPool) connection.release();
|
||||||
const detailedField = response.find(f => f.name === field.name);
|
reject(err);
|
||||||
if (detailedField && field.orgTable === paramObj.table && field.schema === paramObj.schema && detailedField.name === field.orgName)
|
|
||||||
field = { ...detailedField, ...field };
|
|
||||||
return field;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
try { // Key usage (foreign keys)
|
|
||||||
const response = await this.getKeyUsage(paramObj);
|
|
||||||
keysArr = keysArr ? [...keysArr, ...response] : response;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve({
|
|
||||||
duration: timeStop - timeStart,
|
|
||||||
rows: Array.isArray(queryResult) ? queryResult.some(el => Array.isArray(el)) ? [] : queryResult : false,
|
|
||||||
report: !Array.isArray(queryResult) ? queryResult : false,
|
|
||||||
fields: remappedFields,
|
|
||||||
keys: keysArr
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
resolve({
|
||||||
|
duration: timeStop - timeStart,
|
||||||
|
rows: Array.isArray(queryResult) ? queryResult.some(el => Array.isArray(el)) ? [] : queryResult : false,
|
||||||
|
report: !Array.isArray(queryResult) ? queryResult : false,
|
||||||
|
fields: remappedFields,
|
||||||
|
keys: keysArr
|
||||||
|
});
|
||||||
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
|
|
||||||
resultsArr.push({ rows, report, fields, keys, duration });
|
resultsArr.push({ rows, report, fields, keys, duration });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPool) connection.release();
|
||||||
|
|
||||||
return resultsArr.length === 1 ? resultsArr[0] : resultsArr;
|
return resultsArr.length === 1 ? resultsArr[0] : resultsArr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1309
src/main/libs/clients/PostgreSQLClient.js
Normal file
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="wrapper">
|
<div id="wrapper" :class="`theme-${applicationTheme}`">
|
||||||
<TheTitleBar />
|
<TheTitleBar />
|
||||||
<div id="window-content">
|
<div id="window-content">
|
||||||
<TheSettingBar />
|
<TheSettingBar />
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<TheFooter />
|
<TheFooter />
|
||||||
<TheNotificationsBoard />
|
<TheNotificationsBoard />
|
||||||
<ModalNewConnection v-if="isNewConnModal" />
|
<ModalNewConnection v-if="isNewConnModal" />
|
||||||
|
<TheScratchpad v-if="isScratchpad" />
|
||||||
<ModalSettings v-if="isSettingModal" />
|
<ModalSettings v-if="isSettingModal" />
|
||||||
<ModalDiscardChanges v-if="isUnsavedDiscardModal" />
|
<ModalDiscardChanges v-if="isUnsavedDiscardModal" />
|
||||||
</div>
|
</div>
|
||||||
@@ -24,7 +25,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
import { ipcRenderer, remote } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
|
import { Menu, getCurrentWindow } from '@electron/remote';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
@@ -37,6 +39,7 @@ export default {
|
|||||||
Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'),
|
Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'),
|
||||||
ModalNewConnection: () => import(/* webpackChunkName: "ModalNewConnection" */'@/components/ModalNewConnection'),
|
ModalNewConnection: () => import(/* webpackChunkName: "ModalNewConnection" */'@/components/ModalNewConnection'),
|
||||||
ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings'),
|
ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings'),
|
||||||
|
TheScratchpad: () => import(/* webpackChunkName: "TheScratchpad" */'@/components/TheScratchpad'),
|
||||||
ModalDiscardChanges: () => import(/* webpackChunkName: "ModalDiscardChanges" */'@/components/ModalDiscardChanges')
|
ModalDiscardChanges: () => import(/* webpackChunkName: "ModalDiscardChanges" */'@/components/ModalDiscardChanges')
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -48,14 +51,15 @@ export default {
|
|||||||
isNewConnModal: 'application/isNewModal',
|
isNewConnModal: 'application/isNewModal',
|
||||||
isEditModal: 'application/isEditModal',
|
isEditModal: 'application/isEditModal',
|
||||||
isSettingModal: 'application/isSettingModal',
|
isSettingModal: 'application/isSettingModal',
|
||||||
|
isScratchpad: 'application/isScratchpad',
|
||||||
connections: 'connections/getConnections',
|
connections: 'connections/getConnections',
|
||||||
|
applicationTheme: 'settings/getApplicationTheme',
|
||||||
isUnsavedDiscardModal: 'workspaces/isUnsavedDiscardModal'
|
isUnsavedDiscardModal: 'workspaces/isUnsavedDiscardModal'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
ipcRenderer.send('check-for-updates');
|
ipcRenderer.send('check-for-updates');
|
||||||
|
this.checkVersionUpdate();
|
||||||
const Menu = remote.Menu;
|
|
||||||
|
|
||||||
const InputMenu = Menu.buildFromTemplate([
|
const InputMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
@@ -87,7 +91,7 @@ export default {
|
|||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
if (node.nodeName.match(/^(input|textarea)$/i) || node.isContentEditable) {
|
if (node.nodeName.match(/^(input|textarea)$/i) || node.isContentEditable) {
|
||||||
InputMenu.popup(remote.getCurrentWindow());
|
InputMenu.popup(getCurrentWindow());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = node.parentNode;
|
node = node.parentNode;
|
||||||
@@ -96,7 +100,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
showNewConnModal: 'application/showNewConnModal'
|
showNewConnModal: 'application/showNewConnModal',
|
||||||
|
checkVersionUpdate: 'application/checkVersionUpdate'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -71,7 +71,6 @@ export default {
|
|||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.context {
|
.context {
|
||||||
display: flex;
|
display: flex;
|
||||||
color: $body-font-color;
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
z-index: 400;
|
z-index: 400;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -87,7 +86,6 @@ export default {
|
|||||||
.context-container {
|
.context-container {
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
box-shadow: 0 0 2px 0 #000;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: #1d1d1d;
|
background: #1d1d1d;
|
||||||
border-radius: 0.1rem;
|
border-radius: 0.1rem;
|
||||||
@@ -111,14 +109,10 @@ export default {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
background: #1d1d1d;
|
|
||||||
box-shadow: 0 0 2px 0 #000;
|
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $primary-color;
|
|
||||||
|
|
||||||
.context-submenu {
|
.context-submenu {
|
||||||
display: block;
|
display: block;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
|
@@ -22,6 +22,7 @@ export default {
|
|||||||
editorClass: { type: String, default: '' },
|
editorClass: { type: String, default: '' },
|
||||||
autoFocus: { type: Boolean, default: false },
|
autoFocus: { type: Boolean, default: false },
|
||||||
readOnly: { type: Boolean, default: false },
|
readOnly: { type: Boolean, default: false },
|
||||||
|
showLineNumbers: { type: Boolean, default: true },
|
||||||
height: { type: Number, default: 200 }
|
height: { type: Number, default: 200 }
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -68,10 +69,12 @@ export default {
|
|||||||
this.editor = ace.edit(`editor-${this.id}`, {
|
this.editor = ace.edit(`editor-${this.id}`, {
|
||||||
mode: `ace/mode/${this.mode}`,
|
mode: `ace/mode/${this.mode}`,
|
||||||
theme: `ace/theme/${this.editorTheme}`,
|
theme: `ace/theme/${this.editorTheme}`,
|
||||||
value: this.value,
|
value: this.value || '',
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
printMargin: false,
|
printMargin: false,
|
||||||
readOnly: this.readOnly
|
readOnly: this.readOnly,
|
||||||
|
showLineNumbers: this.showLineNumbers,
|
||||||
|
showGutter: this.showLineNumbers
|
||||||
});
|
});
|
||||||
|
|
||||||
this.editor.setOptions({
|
this.editor.setOptions({
|
||||||
@@ -102,8 +105,6 @@ export default {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.editor-wrapper {
|
.editor-wrapper {
|
||||||
border-bottom: 1px solid #444;
|
|
||||||
|
|
||||||
.editor {
|
.editor {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -113,17 +114,4 @@ export default {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 17px;
|
width: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
|
|
||||||
background-color: #c9561a99;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_line-hover {
|
|
||||||
background-color: #c9571a33;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight {
|
|
||||||
color: #e0d00c;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -63,13 +63,11 @@ export default {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.file-uploader {
|
.file-uploader {
|
||||||
border: 0.05rem solid $bg-color-light;
|
|
||||||
border-radius: 0.1rem;
|
border-radius: 0.1rem;
|
||||||
height: 1.8rem;
|
height: 1.8rem;
|
||||||
line-height: 1.2rem;
|
line-height: 1.2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: $bg-color-gray;
|
|
||||||
transition: background 0.2s, border 0.2s, box-shadow 0.2s, color 0.2s;
|
transition: background 0.2s, border 0.2s, box-shadow 0.2s, color 0.2s;
|
||||||
position: relative;
|
position: relative;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
@@ -80,8 +78,6 @@ export default {
|
|||||||
|
|
||||||
.file-uploader-message {
|
.file-uploader-message {
|
||||||
display: flex;
|
display: flex;
|
||||||
border-right: 0.05rem solid $bg-color-light;
|
|
||||||
background-color: $bg-color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-uploader-input {
|
.file-uploader-input {
|
||||||
@@ -105,7 +101,6 @@ export default {
|
|||||||
:disabled {
|
:disabled {
|
||||||
.file-uploader {
|
.file-uploader {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
background-color: #151515;
|
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,6 +66,21 @@
|
|||||||
:type="inputProps().type"
|
:type="inputProps().type"
|
||||||
:disabled="!isChecked"
|
:disabled="!isChecked"
|
||||||
>
|
>
|
||||||
|
<select
|
||||||
|
v-else-if="enumArray"
|
||||||
|
v-model="selectedValue"
|
||||||
|
class="form-select"
|
||||||
|
:disabled="!isChecked"
|
||||||
|
@change="onChange"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="val in enumArray"
|
||||||
|
:key="val"
|
||||||
|
:value="val"
|
||||||
|
>
|
||||||
|
{{ val }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
<input
|
<input
|
||||||
v-else
|
v-else
|
||||||
ref="formInput"
|
ref="formInput"
|
||||||
@@ -121,7 +136,8 @@ export default {
|
|||||||
selectedMethod: '',
|
selectedMethod: '',
|
||||||
selectedValue: '',
|
selectedValue: '',
|
||||||
debounceTimeout: null,
|
debounceTimeout: null,
|
||||||
methodParams: {}
|
methodParams: {},
|
||||||
|
enumArray: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -150,8 +166,14 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
fieldObj () {
|
fieldObj () {
|
||||||
if (this.fieldObj)
|
if (this.fieldObj) {
|
||||||
this.selectedValue = this.fieldObj.value;
|
if (Array.isArray(this.fieldObj.value)) {
|
||||||
|
this.enumArray = this.fieldObj.value;
|
||||||
|
this.selectedValue = this.fieldObj.value[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.selectedValue = this.fieldObj.value;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
selectedGroup () {
|
selectedGroup () {
|
||||||
if (this.fakerMethods.length)
|
if (this.fakerMethods.length)
|
||||||
|
@@ -11,11 +11,11 @@
|
|||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
v-for="row in foreignList"
|
v-for="row in foreignList"
|
||||||
:key="row.foreignColumn"
|
:key="row.foreign_column"
|
||||||
:value="row.foreignColumn"
|
:value="row.foreign_column"
|
||||||
:selected="row.foreignColumn === value"
|
:selected="row.foreign_column === value"
|
||||||
>
|
>
|
||||||
{{ row.foreignColumn }} {{ 'foreignDescription' in row ? ` - ${row.foreignDescription}` : '' | cutText }}
|
{{ row.foreign_column }} {{ 'foreign_description' in row ? ` - ${row.foreign_description}` : '' | cutText }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</template>
|
</template>
|
||||||
@@ -51,11 +51,12 @@ export default {
|
|||||||
}),
|
}),
|
||||||
isValidDefault () {
|
isValidDefault () {
|
||||||
if (!this.foreignList.length) return true;
|
if (!this.foreignList.length) return true;
|
||||||
return this.foreignList.some(foreign => foreign.foreignColumn.toString() === this.value.toString());
|
if (this.value === null) return false;
|
||||||
|
return this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created () {
|
async created () {
|
||||||
let firstTextField;
|
let foreignDesc;
|
||||||
const params = {
|
const params = {
|
||||||
uid: this.selectedWorkspace,
|
uid: this.selectedWorkspace,
|
||||||
schema: this.keyUsage.refSchema,
|
schema: this.keyUsage.refSchema,
|
||||||
@@ -64,8 +65,10 @@ export default {
|
|||||||
|
|
||||||
try { // Field data
|
try { // Field data
|
||||||
const { status, response } = await Tables.getTableColumns(params);
|
const { status, response } = await Tables.getTableColumns(params);
|
||||||
if (status === 'success')
|
if (status === 'success') {
|
||||||
firstTextField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type)).name || false;
|
const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type) && field.name !== this.keyUsage.refField);
|
||||||
|
foreignDesc = textField ? textField.name : false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
this.addNotification({ status: 'error', message: response });
|
this.addNotification({ status: 'error', message: response });
|
||||||
}
|
}
|
||||||
@@ -77,7 +80,7 @@ export default {
|
|||||||
const { status, response } = await Tables.getForeignList({
|
const { status, response } = await Tables.getForeignList({
|
||||||
...params,
|
...params,
|
||||||
column: this.keyUsage.refField,
|
column: this.keyUsage.refField,
|
||||||
description: firstTextField
|
description: foreignDesc
|
||||||
});
|
});
|
||||||
|
|
||||||
if (status === 'success')
|
if (status === 'success')
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<form class="form-horizontal">
|
<form class="form-horizontal">
|
||||||
<div
|
<div
|
||||||
v-for="(parameter, i) in localRoutine.parameters"
|
v-for="(parameter, i) in inParameters"
|
||||||
:key="parameter._id"
|
:key="parameter._id"
|
||||||
class="form-group"
|
class="form-group"
|
||||||
>
|
>
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input
|
<input
|
||||||
:ref="i === 0 ? 'firstInput' : ''"
|
:ref="i === 0 ? 'firstInput' : ''"
|
||||||
v-model="values[parameter.name]"
|
v-model="values[`${i}-${parameter.name}`]"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
type="text"
|
type="text"
|
||||||
>
|
>
|
||||||
<span class="input-group-addon field-type" :class="`type-${parameter.type.toLowerCase()}`">
|
<span class="input-group-addon field-type" :class="typeClass(parameter.type)">
|
||||||
{{ parameter.type }} {{ parameter.length | wrapNumber }}
|
{{ parameter.type }} {{ parameter.length | wrapNumber }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { NUMBER, FLOAT } from 'common/fieldTypes';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -57,13 +58,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
localRoutine: Object
|
localRoutine: Object,
|
||||||
|
client: String
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
values: {}
|
values: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
inParameters () {
|
||||||
|
return this.localRoutine.parameters.filter(param => param.context === 'IN');
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
window.addEventListener('keydown', this.onKey);
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
|
||||||
@@ -75,9 +82,29 @@ export default {
|
|||||||
window.removeEventListener('keydown', this.onKey);
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
typeClass (type) {
|
||||||
|
if (type)
|
||||||
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
runRoutine () {
|
runRoutine () {
|
||||||
const valArr = Object.keys(this.values).reduce((acc, curr) => {
|
const valArr = Object.keys(this.values).reduce((acc, curr, i) => {
|
||||||
const value = isNaN(this.values[curr]) ? `"${this.values[curr]}"` : this.values[curr];
|
let qc;
|
||||||
|
switch (this.client) {
|
||||||
|
case 'maria':
|
||||||
|
case 'mysql':
|
||||||
|
qc = '"';
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
qc = '\'';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qc = '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
const param = this.localRoutine.parameters.find(param => `${i}-${param.name}` === curr);
|
||||||
|
|
||||||
|
const value = [...NUMBER, ...FLOAT].includes(param.type) ? this.values[curr] : `${qc}${this.values[curr]}${qc}`;
|
||||||
acc.push(value);
|
acc.push(value);
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
@@ -59,15 +59,15 @@
|
|||||||
<option value="maria">
|
<option value="maria">
|
||||||
MariaDB
|
MariaDB
|
||||||
</option>
|
</option>
|
||||||
|
<option value="pg">
|
||||||
|
PostgreSQL
|
||||||
|
</option>
|
||||||
<!-- <option value="mssql">
|
<!-- <option value="mssql">
|
||||||
Microsoft SQL
|
Microsoft SQL
|
||||||
</option>
|
</option>
|
||||||
<option value="pg">
|
<option value="oracledb">
|
||||||
PostgreSQL
|
Oracle DB
|
||||||
</option>
|
</option> -->
|
||||||
<option value="oracledb">
|
|
||||||
Oracle DB
|
|
||||||
</option> -->
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,6 +97,18 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="customizations.database" class="form-group">
|
||||||
|
<div class="col-4 col-sm-12">
|
||||||
|
<label class="form-label">{{ $t('word.database') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-8 col-sm-12">
|
||||||
|
<input
|
||||||
|
v-model="localConnection.database"
|
||||||
|
class="form-input"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-4 col-sm-12">
|
<div class="col-4 col-sm-12">
|
||||||
<label class="form-label">{{ $t('word.user') }}</label>
|
<label class="form-label">{{ $t('word.user') }}</label>
|
||||||
@@ -247,6 +259,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions } from 'vuex';
|
import { mapActions } from 'vuex';
|
||||||
|
import customizations from 'common/customizations';
|
||||||
import Connection from '@/ipc-api/Connection';
|
import Connection from '@/ipc-api/Connection';
|
||||||
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
||||||
import BaseToast from '@/components/BaseToast';
|
import BaseToast from '@/components/BaseToast';
|
||||||
@@ -274,6 +287,11 @@ export default {
|
|||||||
selectedTab: 'general'
|
selectedTab: 'general'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
customizations () {
|
||||||
|
return customizations[this.connection.client];
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
this.localConnection = Object.assign({}, this.connection);
|
this.localConnection = Object.assign({}, this.connection);
|
||||||
window.addEventListener('keydown', this.onKey);
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<div class="modal-header pl-2">
|
<div class="modal-header pl-2">
|
||||||
<div class="modal-title h6">
|
<div class="modal-title h6">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<i class="mdi mdi-24px mdi-database-edit mr-1" /> {{ $t('message.editDatabase') }}
|
<i class="mdi mdi-24px mdi-database-edit mr-1" /> {{ $t('message.editSchema') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
|
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
class="form-input"
|
class="form-input"
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
:placeholder="$t('message.databaseName')"
|
:placeholder="$t('message.schemaName')"
|
||||||
readonly
|
readonly
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer text-light">
|
<div class="modal-footer text-light">
|
||||||
<button class="btn btn-primary mr-2" @click.stop="updateDatabase">
|
<button class="btn btn-primary mr-2" @click.stop="updateSchema">
|
||||||
{{ $t('word.update') }}
|
{{ $t('word.update') }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-link" @click.stop="closeModal">
|
<button class="btn btn-link" @click.stop="closeModal">
|
||||||
@@ -66,10 +66,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
import Database from '@/ipc-api/Database';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalEditDatabase',
|
name: 'ModalEditSchema',
|
||||||
props: {
|
props: {
|
||||||
selectedDatabase: String
|
selectedDatabase: String
|
||||||
},
|
},
|
||||||
@@ -98,7 +98,7 @@ export default {
|
|||||||
async created () {
|
async created () {
|
||||||
let actualCollation;
|
let actualCollation;
|
||||||
try {
|
try {
|
||||||
const { status, response } = await Database.getDatabaseCollation({ uid: this.selectedWorkspace, database: this.selectedDatabase });
|
const { status, response } = await Schema.getDatabaseCollation({ uid: this.selectedWorkspace, database: this.selectedDatabase });
|
||||||
|
|
||||||
if (status === 'success')
|
if (status === 'success')
|
||||||
actualCollation = response;
|
actualCollation = response;
|
||||||
@@ -130,10 +130,10 @@ export default {
|
|||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification'
|
addNotification: 'notifications/addNotification'
|
||||||
}),
|
}),
|
||||||
async updateDatabase () {
|
async updateSchema () {
|
||||||
if (this.database.collation !== this.database.prevCollation) {
|
if (this.database.collation !== this.database.prevCollation) {
|
||||||
try {
|
try {
|
||||||
const { status, response } = await Database.updateDatabase({
|
const { status, response } = await Schema.updateSchema({
|
||||||
uid: this.selectedWorkspace,
|
uid: this.selectedWorkspace,
|
||||||
...this.database
|
...this.database
|
||||||
});
|
});
|
@@ -34,7 +34,7 @@
|
|||||||
:field-obj="localRow[field.name]"
|
:field-obj="localRow[field.name]"
|
||||||
:value.sync="localRow[field.name]"
|
:value.sync="localRow[field.name]"
|
||||||
>
|
>
|
||||||
<span class="input-group-addon field-type" :class="`type-${field.type.toLowerCase()}`">
|
<span class="input-group-addon field-type" :class="typeClass(field.type)">
|
||||||
{{ field.type }} {{ fieldLength(field) | wrapNumber }}
|
{{ field.type }} {{ fieldLength(field) | wrapNumber }}
|
||||||
</span>
|
</span>
|
||||||
<label class="form-checkbox ml-3" :title="$t('word.insert')">
|
<label class="form-checkbox ml-3" :title="$t('word.insert')">
|
||||||
@@ -250,10 +250,15 @@ export default {
|
|||||||
if (field.default === 'NULL') fieldDefault = null;
|
if (field.default === 'NULL') fieldDefault = null;
|
||||||
else {
|
else {
|
||||||
if ([...NUMBER, ...FLOAT].includes(field.type))
|
if ([...NUMBER, ...FLOAT].includes(field.type))
|
||||||
fieldDefault = +field.default;
|
fieldDefault = Number.isNaN(+field.default) ? null : +field.default;
|
||||||
|
|
||||||
if ([...TEXT, ...LONG_TEXT].includes(field.type))
|
if ([...TEXT, ...LONG_TEXT].includes(field.type)) {
|
||||||
fieldDefault = field.default ? field.default.substring(1, field.default.length - 1) : '';
|
fieldDefault = field.default
|
||||||
|
? field.default.includes('\'')
|
||||||
|
? field.default.split('\'')[1]
|
||||||
|
: field.default
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
if ([...TIME, ...DATE].includes(field.type))
|
if ([...TIME, ...DATE].includes(field.type))
|
||||||
fieldDefault = field.default;
|
fieldDefault = field.default;
|
||||||
@@ -269,6 +274,9 @@ export default {
|
|||||||
fieldDefault = moment().format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
|
fieldDefault = moment().format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (field.enumValues)
|
||||||
|
fieldDefault = field.enumValues.replaceAll('\'', '').split(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
rowObj[field.name] = { value: fieldDefault };
|
rowObj[field.name] = { value: fieldDefault };
|
||||||
@@ -286,6 +294,11 @@ export default {
|
|||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification'
|
addNotification: 'notifications/addNotification'
|
||||||
}),
|
}),
|
||||||
|
typeClass (type) {
|
||||||
|
if (type)
|
||||||
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
async insertRows () {
|
async insertRows () {
|
||||||
this.isInserting = true;
|
this.isInserting = true;
|
||||||
const rowToInsert = this.localRow;
|
const rowToInsert = this.localRow;
|
||||||
|
@@ -63,12 +63,12 @@
|
|||||||
<option value="maria">
|
<option value="maria">
|
||||||
MariaDB
|
MariaDB
|
||||||
</option>
|
</option>
|
||||||
|
<option value="pg">
|
||||||
|
PostgreSQL
|
||||||
|
</option>
|
||||||
<!-- <option value="mssql">
|
<!-- <option value="mssql">
|
||||||
Microsoft SQL
|
Microsoft SQL
|
||||||
</option>
|
</option>
|
||||||
<option value="pg">
|
|
||||||
PostgreSQL
|
|
||||||
</option>
|
|
||||||
<option value="oracledb">
|
<option value="oracledb">
|
||||||
Oracle DB
|
Oracle DB
|
||||||
</option> -->
|
</option> -->
|
||||||
@@ -101,6 +101,18 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="customizations.database" class="form-group">
|
||||||
|
<div class="col-4 col-sm-12">
|
||||||
|
<label class="form-label">{{ $t('word.database') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-8 col-sm-12">
|
||||||
|
<input
|
||||||
|
v-model="connection.database"
|
||||||
|
class="form-input"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-4 col-sm-12">
|
<div class="col-4 col-sm-12">
|
||||||
<label class="form-label">{{ $t('word.user') }}</label>
|
<label class="form-label">{{ $t('word.user') }}</label>
|
||||||
@@ -251,6 +263,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapActions } from 'vuex';
|
import { mapActions } from 'vuex';
|
||||||
|
import customizations from 'common/customizations';
|
||||||
import Connection from '@/ipc-api/Connection';
|
import Connection from '@/ipc-api/Connection';
|
||||||
import { uidGen } from 'common/libs/uidGen';
|
import { uidGen } from 'common/libs/uidGen';
|
||||||
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
import ModalAskCredentials from '@/components/ModalAskCredentials';
|
||||||
@@ -270,8 +283,9 @@ export default {
|
|||||||
name: '',
|
name: '',
|
||||||
client: 'mysql',
|
client: 'mysql',
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: '3306',
|
database: null,
|
||||||
user: 'root',
|
port: null,
|
||||||
|
user: null,
|
||||||
password: '',
|
password: '',
|
||||||
ask: false,
|
ask: false,
|
||||||
uid: uidGen('C'),
|
uid: uidGen('C'),
|
||||||
@@ -291,7 +305,13 @@ export default {
|
|||||||
selectedTab: 'general'
|
selectedTab: 'general'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
customizations () {
|
||||||
|
return customizations[this.connection.client];
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
|
this.setDefaults();
|
||||||
window.addEventListener('keydown', this.onKey);
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -307,20 +327,9 @@ export default {
|
|||||||
addConnection: 'connections/addConnection'
|
addConnection: 'connections/addConnection'
|
||||||
}),
|
}),
|
||||||
setDefaults () {
|
setDefaults () {
|
||||||
switch (this.connection.client) {
|
this.connection.user = this.customizations.defaultUser;
|
||||||
case 'mysql':
|
this.connection.port = this.customizations.defaultPort;
|
||||||
this.connection.port = '3306';
|
this.connection.database = this.customizations.defaultDatabase;
|
||||||
break;
|
|
||||||
case 'mssql':
|
|
||||||
this.connection.port = '1433';
|
|
||||||
break;
|
|
||||||
case 'pg':
|
|
||||||
this.connection.port = '5432';
|
|
||||||
break;
|
|
||||||
case 'oracledb':
|
|
||||||
this.connection.port = '1521';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async startTest () {
|
async startTest () {
|
||||||
this.isTesting = true;
|
this.isTesting = true;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
>
|
>
|
||||||
<template :slot="'header'">
|
<template :slot="'header'">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<i class="mdi mdi-24px mdi-plus mr-1" /> {{ $t('message.createNewRoutine') }}
|
<i class="mdi mdi-24px mdi-plus mr-1" /> {{ $t('message.createNewFunction') }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div :slot="'body'">
|
<div :slot="'body'">
|
||||||
@@ -25,7 +25,19 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.languages" class="form-group">
|
||||||
|
<label class="form-label col-4">
|
||||||
|
{{ $t('word.language') }}
|
||||||
|
</label>
|
||||||
|
<div class="column">
|
||||||
|
<select v-model="localFunction.language" class="form-select">
|
||||||
|
<option v-for="language in customizations.languages" :key="language">
|
||||||
|
{{ language }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="customizations.definer" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.definer') }}
|
{{ $t('word.definer') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -53,42 +65,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
|
||||||
{{ $t('word.returns') }}
|
|
||||||
</label>
|
|
||||||
<div class="column">
|
|
||||||
<div class="input-group">
|
|
||||||
<select
|
|
||||||
v-model="localFunction.returns"
|
|
||||||
class="form-select text-uppercase"
|
|
||||||
style="width: 0;"
|
|
||||||
>
|
|
||||||
<optgroup
|
|
||||||
v-for="group in workspace.dataTypes"
|
|
||||||
:key="group.group"
|
|
||||||
:label="group.group"
|
|
||||||
>
|
|
||||||
<option
|
|
||||||
v-for="type in group.types"
|
|
||||||
:key="type.name"
|
|
||||||
:selected="localFunction.returns === type.name"
|
|
||||||
:value="type.name"
|
|
||||||
>
|
|
||||||
{{ type.name }}
|
|
||||||
</option>
|
|
||||||
</optgroup>
|
|
||||||
</select>
|
|
||||||
<input
|
|
||||||
v-model="localFunction.returnsLength"
|
|
||||||
class="form-input"
|
|
||||||
type="number"
|
|
||||||
min="0"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -111,7 +88,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.functionDataAccess" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('message.dataAccess') }}
|
{{ $t('message.dataAccess') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -124,7 +101,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.functionDeterministic" class="form-group">
|
||||||
<div class="col-4" />
|
<div class="col-4" />
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<label class="form-checkbox form-inline">
|
<label class="form-checkbox form-inline">
|
||||||
@@ -152,11 +129,12 @@ export default {
|
|||||||
return {
|
return {
|
||||||
localFunction: {
|
localFunction: {
|
||||||
definer: '',
|
definer: '',
|
||||||
sql: 'BEGIN\r\n RETURN NULL;\r\nEND',
|
sql: '',
|
||||||
parameters: [],
|
parameters: [],
|
||||||
name: '',
|
name: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
returns: 'INT',
|
language: null,
|
||||||
|
returns: null,
|
||||||
returnsLength: 10,
|
returnsLength: 10,
|
||||||
security: 'DEFINER',
|
security: 'DEFINER',
|
||||||
deterministic: false,
|
deterministic: false,
|
||||||
@@ -168,9 +146,17 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.workspace.customizations;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
if (this.customizations.languages)
|
||||||
|
this.localFunction.language = this.customizations.languages[0];
|
||||||
|
|
||||||
|
if (this.customizations.procedureSql)
|
||||||
|
this.localFunction.sql = this.customizations.procedureSql;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.firstInput.focus();
|
this.$refs.firstInput.focus();
|
||||||
}, 20);
|
}, 20);
|
||||||
|
@@ -25,7 +25,19 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.languages" class="form-group">
|
||||||
|
<label class="form-label col-4">
|
||||||
|
{{ $t('word.language') }}
|
||||||
|
</label>
|
||||||
|
<div class="column">
|
||||||
|
<select v-model="localRoutine.language" class="form-select">
|
||||||
|
<option v-for="language in customizations.languages" :key="language">
|
||||||
|
{{ language }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="customizations.definer" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.definer') }}
|
{{ $t('word.definer') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -53,7 +65,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -76,7 +88,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('message.dataAccess') }}
|
{{ $t('message.dataAccess') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -89,7 +101,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.procedureDeterministic" class="form-group">
|
||||||
<div class="col-4" />
|
<div class="col-4" />
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<label class="form-checkbox form-inline">
|
<label class="form-checkbox form-inline">
|
||||||
@@ -117,10 +129,11 @@ export default {
|
|||||||
return {
|
return {
|
||||||
localRoutine: {
|
localRoutine: {
|
||||||
definer: '',
|
definer: '',
|
||||||
sql: 'BEGIN\r\n\r\nEND',
|
sql: '',
|
||||||
parameters: [],
|
parameters: [],
|
||||||
name: '',
|
name: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
|
language: null,
|
||||||
security: 'DEFINER',
|
security: 'DEFINER',
|
||||||
deterministic: false,
|
deterministic: false,
|
||||||
dataAccess: 'CONTAINS SQL'
|
dataAccess: 'CONTAINS SQL'
|
||||||
@@ -131,9 +144,17 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.workspace.customizations;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
if (this.customizations.languages)
|
||||||
|
this.localRoutine.language = this.customizations.languages[0];
|
||||||
|
|
||||||
|
if (this.customizations.procedureSql)
|
||||||
|
this.localRoutine.sql = this.customizations.procedureSql;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.firstInput.focus();
|
this.$refs.firstInput.focus();
|
||||||
}, 20);
|
}, 20);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<div class="modal-header pl-2">
|
<div class="modal-header pl-2">
|
||||||
<div class="modal-title h6">
|
<div class="modal-title h6">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<i class="mdi mdi-24px mdi-database-plus mr-1" /> {{ $t('message.createNewDatabase') }}
|
<i class="mdi mdi-24px mdi-database-plus mr-1" /> {{ $t('message.createNewSchema') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
|
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
class="form-input"
|
class="form-input"
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
:placeholder="$t('message.databaseName')"
|
:placeholder="$t('message.schemaName')"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.collations" class="form-group">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<label class="form-label">{{ $t('word.collation') }}</label>
|
<label class="form-label">{{ $t('word.collation') }}</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,7 +49,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer text-light">
|
<div class="modal-footer text-light">
|
||||||
<button class="btn btn-primary mr-2" @click.stop="createDatabase">
|
<button
|
||||||
|
class="btn btn-primary mr-2"
|
||||||
|
:class="{'loading': isLoading}"
|
||||||
|
@click.stop="createSchema"
|
||||||
|
>
|
||||||
{{ $t('word.add') }}
|
{{ $t('word.add') }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-link" @click.stop="closeModal">
|
<button class="btn btn-link" @click.stop="closeModal">
|
||||||
@@ -62,12 +66,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
import Database from '@/ipc-api/Database';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalNewDatabase',
|
name: 'ModalNewSchema',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
isLoading: false,
|
||||||
database: {
|
database: {
|
||||||
name: '',
|
name: '',
|
||||||
collation: ''
|
collation: ''
|
||||||
@@ -83,8 +88,11 @@ export default {
|
|||||||
collations () {
|
collations () {
|
||||||
return this.getWorkspace(this.selectedWorkspace).collations;
|
return this.getWorkspace(this.selectedWorkspace).collations;
|
||||||
},
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.getWorkspace(this.selectedWorkspace).customizations;
|
||||||
|
},
|
||||||
defaultCollation () {
|
defaultCollation () {
|
||||||
return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value || '';
|
return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server') ? this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value : '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@@ -101,9 +109,10 @@ export default {
|
|||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification'
|
addNotification: 'notifications/addNotification'
|
||||||
}),
|
}),
|
||||||
async createDatabase () {
|
async createSchema () {
|
||||||
|
this.isLoading = true;
|
||||||
try {
|
try {
|
||||||
const { status, response } = await Database.createDatabase({
|
const { status, response } = await Schema.createSchema({
|
||||||
uid: this.selectedWorkspace,
|
uid: this.selectedWorkspace,
|
||||||
...this.database
|
...this.database
|
||||||
});
|
});
|
||||||
@@ -118,6 +127,7 @@ export default {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
this.addNotification({ status: 'error', message: err.stack });
|
this.addNotification({ status: 'error', message: err.stack });
|
||||||
}
|
}
|
||||||
|
this.isLoading = false;
|
||||||
},
|
},
|
||||||
closeModal () {
|
closeModal () {
|
||||||
this.$emit('close');
|
this.$emit('close');
|
@@ -25,7 +25,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.collations" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.collation') }}
|
{{ $t('word.collation') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.engines" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.engine') }}
|
{{ $t('word.engine') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -103,10 +103,14 @@ export default {
|
|||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
||||||
}),
|
}),
|
||||||
defaultCollation () {
|
defaultCollation () {
|
||||||
return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value || '';
|
if (this.workspace.customizations.collations)
|
||||||
|
return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value || '';
|
||||||
|
return '';
|
||||||
},
|
},
|
||||||
defaultEngine () {
|
defaultEngine () {
|
||||||
return this.workspace.engines.find(engine => engine.isDefault).name;
|
if (this.workspace.customizations.engines)
|
||||||
|
return this.workspace.engines.find(engine => engine.isDefault).name;
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
@@ -69,7 +69,7 @@
|
|||||||
:disabled="fieldsToExclude.includes(field.name)"
|
:disabled="fieldsToExclude.includes(field.name)"
|
||||||
:tabindex="key+1"
|
:tabindex="key+1"
|
||||||
>
|
>
|
||||||
<span class="input-group-addon" :class="`type-${field.type.toLowerCase()}`">
|
<span class="input-group-addon" :class="typeCLass(field.type)">
|
||||||
{{ field.type }} {{ fieldLength(field) | wrapNumber }}
|
{{ field.type }} {{ fieldLength(field) | wrapNumber }}
|
||||||
</span>
|
</span>
|
||||||
<label class="form-checkbox ml-3" :title="$t('word.insert')">
|
<label class="form-checkbox ml-3" :title="$t('word.insert')">
|
||||||
@@ -222,6 +222,11 @@ export default {
|
|||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification'
|
addNotification: 'notifications/addNotification'
|
||||||
}),
|
}),
|
||||||
|
typeClass (type) {
|
||||||
|
if (type)
|
||||||
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
async insertRows () {
|
async insertRows () {
|
||||||
this.isInserting = true;
|
this.isInserting = true;
|
||||||
const rowToInsert = this.localRow;
|
const rowToInsert = this.localRow;
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6">
|
<div class="column col-6">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.definer" class="form-group">
|
||||||
<label class="form-label">{{ $t('word.definer') }}</label>
|
<label class="form-label">{{ $t('word.definer') }}</label>
|
||||||
<select v-model="localView.definer" class="form-select">
|
<select v-model="localView.definer" class="form-select">
|
||||||
<option value="">
|
<option value="">
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-4">
|
<div class="column col-4">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.viewSqlSecurity" class="form-group">
|
||||||
<label class="form-label">{{ $t('message.sqlSecurity') }}</label>
|
<label class="form-label">{{ $t('message.sqlSecurity') }}</label>
|
||||||
<label class="form-radio">
|
<label class="form-radio">
|
||||||
<input
|
<input
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-4">
|
<div class="column col-4">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.viewAlgorithm" class="form-group">
|
||||||
<label class="form-label">{{ $t('word.algorithm') }}</label>
|
<label class="form-label">{{ $t('word.algorithm') }}</label>
|
||||||
<label class="form-radio">
|
<label class="form-radio">
|
||||||
<input
|
<input
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-4">
|
<div class="column col-4">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.viewUpdateOption" class="form-group">
|
||||||
<label class="form-label">{{ $t('message.updateOption') }}</label>
|
<label class="form-label">{{ $t('message.updateOption') }}</label>
|
||||||
<label class="form-radio">
|
<label class="form-radio">
|
||||||
<input
|
<input
|
||||||
|
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
import Database from '@/ipc-api/Database';
|
import Schema from '@/ipc-api/Schema';
|
||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
||||||
import ProcessesListRow from '@/components/ProcessesListRow';
|
import ProcessesListRow from '@/components/ProcessesListRow';
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ export default {
|
|||||||
this.results = [];
|
this.results = [];
|
||||||
|
|
||||||
try { // Table data
|
try { // Table data
|
||||||
const { status, response } = await Database.getProcesses(this.connection.uid);
|
const { status, response } = await Schema.getProcesses(this.connection.uid);
|
||||||
|
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
this.results = response;
|
this.results = response;
|
||||||
|
@@ -30,12 +30,20 @@
|
|||||||
<a class="c-hand">{{ $t('word.themes') }}</a>
|
<a class="c-hand">{{ $t('word.themes') }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
|
v-if="updateStatus !== 'disabled'"
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
:class="{'active': selectedTab === 'update'}"
|
:class="{'active': selectedTab === 'update'}"
|
||||||
@click="selectTab('update')"
|
@click="selectTab('update')"
|
||||||
>
|
>
|
||||||
<a class="c-hand" :class="{'badge badge-update': hasUpdates}">{{ $t('word.update') }}</a>
|
<a class="c-hand" :class="{'badge badge-update': hasUpdates}">{{ $t('word.update') }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li
|
||||||
|
class="tab-item"
|
||||||
|
:class="{'active': selectedTab === 'changelog'}"
|
||||||
|
@click="selectTab('changelog')"
|
||||||
|
>
|
||||||
|
<a class="c-hand">{{ $t('word.changelog') }}</a>
|
||||||
|
</li>
|
||||||
<li
|
<li
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
:class="{'active': selectedTab === 'about'}"
|
:class="{'active': selectedTab === 'about'}"
|
||||||
@@ -45,7 +53,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="selectedTab === 'general'" class="panel-body py-4">
|
<div v-show="selectedTab === 'general'" class="panel-body py-4">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form class="form-horizontal columns">
|
<form class="form-horizontal columns">
|
||||||
<div class="column col-12 h6 text-uppercase mb-1">
|
<div class="column col-12 h6 text-uppercase mb-1">
|
||||||
@@ -75,6 +83,27 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-6 col-sm-12">
|
||||||
|
<label class="form-label">
|
||||||
|
{{ $t('message.dataTabPageSize') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-sm-12">
|
||||||
|
<select
|
||||||
|
v-model="localPageSize"
|
||||||
|
class="form-select"
|
||||||
|
@change="changePageSize(+localPageSize)"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="size in pageSizes"
|
||||||
|
:key="size"
|
||||||
|
>
|
||||||
|
{{ size }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-6 col-sm-12">
|
<div class="col-6 col-sm-12">
|
||||||
<label class="form-label">
|
<label class="form-label">
|
||||||
@@ -133,26 +162,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedTab === 'themes'" class="panel-body py-4">
|
<div v-show="selectedTab === 'themes'" class="panel-body py-4">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-12 h6 text-uppercase mb-2">
|
<div class="column col-12 h6 text-uppercase mb-2">
|
||||||
{{ $t('message.applicationTheme') }}
|
{{ $t('message.applicationTheme') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6 c-hand theme-block" :class="{'selected': applicationTheme === 'dark'}">
|
<div
|
||||||
|
class="column col-6 c-hand theme-block"
|
||||||
|
:class="{'selected': applicationTheme === 'dark'}"
|
||||||
|
@click="changeApplicationTheme('dark')"
|
||||||
|
>
|
||||||
<img :src="require('@/images/dark.png').default" class="img-responsive img-fit-cover s-rounded">
|
<img :src="require('@/images/dark.png').default" class="img-responsive img-fit-cover s-rounded">
|
||||||
<div class="theme-name">
|
<div class="theme-name text-light">
|
||||||
<i class="mdi mdi-moon-waning-crescent mdi-48px" />
|
<i class="mdi mdi-moon-waning-crescent mdi-48px" />
|
||||||
<div class="h6 mt-4">
|
<div class="h6 mt-4">
|
||||||
{{ $t('word.dark') }}
|
{{ $t('word.dark') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6 theme-block disabled" :class="{'selected': applicationTheme === 'light'}">
|
<div
|
||||||
<div class="theme-name">
|
class="column col-6 c-hand theme-block"
|
||||||
|
:class="{'selected': applicationTheme === 'light'}"
|
||||||
|
@click="changeApplicationTheme('light')"
|
||||||
|
>
|
||||||
|
<img :src="require('@/images/light.png').default" class="img-responsive img-fit-cover s-rounded">
|
||||||
|
<div class="theme-name text-dark">
|
||||||
<i class="mdi mdi-white-balance-sunny mdi-48px" />
|
<i class="mdi mdi-white-balance-sunny mdi-48px" />
|
||||||
<div class="h6 mt-4">
|
<div class="h6 mt-4">
|
||||||
{{ $t('word.light') }} (Coming)
|
{{ $t('word.light') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -185,8 +223,9 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-12">
|
<div class="column col-12">
|
||||||
<QueryEditor
|
<BaseTextEditor
|
||||||
:value="exampleQuery"
|
:value="exampleQuery"
|
||||||
|
mode="sql"
|
||||||
:workspace="workspace"
|
:workspace="workspace"
|
||||||
:read-only="true"
|
:read-only="true"
|
||||||
:height="270"
|
:height="270"
|
||||||
@@ -196,17 +235,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedTab === 'update'" class="panel-body py-4">
|
<div v-show="selectedTab === 'update'" class="panel-body py-4">
|
||||||
<ModalSettingsUpdate />
|
<ModalSettingsUpdate />
|
||||||
</div>
|
</div>
|
||||||
|
<div v-show="selectedTab === 'changelog'" class="panel-body py-4">
|
||||||
|
<ModalSettingsChangelog />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedTab === 'about'" class="panel-body py-4">
|
<div v-show="selectedTab === 'about'" class="panel-body py-4">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<img :src="require('@/images/logo.svg').default" width="128">
|
<img :src="require('@/images/logo.svg').default" width="128">
|
||||||
<h4>{{ appName }}</h4>
|
<h4>{{ appName }}</h4>
|
||||||
<p>
|
<p>
|
||||||
{{ $t('word.version') }} {{ appVersion }}<br>
|
{{ $t('word.version') }} {{ appVersion }}<br>
|
||||||
<a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares')">GitHub</a> | <a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares/blob/master/CHANGELOG.md')">CHANGELOG</a><br>
|
<a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares')"><i class="mdi mdi-github d-inline" /> GitHub</a> • <a class="c-hand" @click="openOutside('https://twitter.com/AntaresSQL')"><i class="mdi mdi-twitter d-inline" /> Twitter</a> • <a class="c-hand" @click="openOutside('https://antares-sql.app/')"><i class="mdi mdi-web d-inline" /> Website</a><br>
|
||||||
<small>{{ $t('word.author') }} <a class="c-hand" @click="openOutside('https://github.com/Fabio286')">Fabio Di Stasio</a></small><br>
|
<small>{{ $t('word.author') }} <a class="c-hand" @click="openOutside('https://github.com/Fabio286')">Fabio Di Stasio</a></small><br>
|
||||||
<small>{{ $t('message.madeWithJS') }}</small>
|
<small>{{ $t('message.madeWithJS') }}</small>
|
||||||
</p>
|
</p>
|
||||||
@@ -222,21 +264,25 @@
|
|||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
import localesNames from '@/i18n/supported-locales';
|
import localesNames from '@/i18n/supported-locales';
|
||||||
import ModalSettingsUpdate from '@/components/ModalSettingsUpdate';
|
import ModalSettingsUpdate from '@/components/ModalSettingsUpdate';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import ModalSettingsChangelog from '@/components/ModalSettingsChangelog';
|
||||||
|
import BaseTextEditor from '@/components/BaseTextEditor';
|
||||||
const { shell } = require('electron');
|
const { shell } = require('electron');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ModalSettings',
|
name: 'ModalSettings',
|
||||||
components: {
|
components: {
|
||||||
ModalSettingsUpdate,
|
ModalSettingsUpdate,
|
||||||
QueryEditor
|
ModalSettingsChangelog,
|
||||||
|
BaseTextEditor
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
localLocale: null,
|
localLocale: null,
|
||||||
|
localPageSize: null,
|
||||||
localTimeout: null,
|
localTimeout: null,
|
||||||
localEditorTheme: null,
|
localEditorTheme: null,
|
||||||
selectedTab: 'general',
|
selectedTab: 'general',
|
||||||
|
pageSizes: [40, 100, 250, 500, 1000],
|
||||||
editorThemes: [
|
editorThemes: [
|
||||||
{
|
{
|
||||||
group: this.$t('word.light'),
|
group: this.$t('word.light'),
|
||||||
@@ -294,6 +340,7 @@ export default {
|
|||||||
appVersion: 'application/appVersion',
|
appVersion: 'application/appVersion',
|
||||||
selectedSettingTab: 'application/selectedSettingTab',
|
selectedSettingTab: 'application/selectedSettingTab',
|
||||||
selectedLocale: 'settings/getLocale',
|
selectedLocale: 'settings/getLocale',
|
||||||
|
pageSize: 'settings/getDataTabLimit',
|
||||||
selectedAutoComplete: 'settings/getAutoComplete',
|
selectedAutoComplete: 'settings/getAutoComplete',
|
||||||
selectedLineWrap: 'settings/getLineWrap',
|
selectedLineWrap: 'settings/getLineWrap',
|
||||||
notificationsTimeout: 'settings/getNotificationsTimeout',
|
notificationsTimeout: 'settings/getNotificationsTimeout',
|
||||||
@@ -336,6 +383,7 @@ ORDER BY
|
|||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.localLocale = this.selectedLocale;
|
this.localLocale = this.selectedLocale;
|
||||||
|
this.localPageSize = this.pageSize;
|
||||||
this.localTimeout = this.notificationsTimeout;
|
this.localTimeout = this.notificationsTimeout;
|
||||||
this.localEditorTheme = this.editorTheme;
|
this.localEditorTheme = this.editorTheme;
|
||||||
this.selectedTab = this.selectedSettingTab;
|
this.selectedTab = this.selectedSettingTab;
|
||||||
@@ -348,8 +396,10 @@ ORDER BY
|
|||||||
...mapActions({
|
...mapActions({
|
||||||
closeModal: 'application/hideSettingModal',
|
closeModal: 'application/hideSettingModal',
|
||||||
changeLocale: 'settings/changeLocale',
|
changeLocale: 'settings/changeLocale',
|
||||||
|
changePageSize: 'settings/changePageSize',
|
||||||
changeAutoComplete: 'settings/changeAutoComplete',
|
changeAutoComplete: 'settings/changeAutoComplete',
|
||||||
changeLineWrap: 'settings/changeLineWrap',
|
changeLineWrap: 'settings/changeLineWrap',
|
||||||
|
changeApplicationTheme: 'settings/changeApplicationTheme',
|
||||||
changeEditorTheme: 'settings/changeEditorTheme',
|
changeEditorTheme: 'settings/changeEditorTheme',
|
||||||
updateNotificationsTimeout: 'settings/updateNotificationsTimeout'
|
updateNotificationsTimeout: 'settings/updateNotificationsTimeout'
|
||||||
}),
|
}),
|
||||||
@@ -382,54 +432,59 @@ ORDER BY
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
#settings {
|
#settings {
|
||||||
.modal-body {
|
.modal-container {
|
||||||
overflow: hidden;
|
position: absolute;
|
||||||
|
top: 17.5vh;
|
||||||
|
|
||||||
.panel-body {
|
.modal-body {
|
||||||
height: calc(70vh - 70px);
|
overflow: hidden;
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
.theme-block {
|
.panel-body {
|
||||||
position: relative;
|
min-height: calc(25vh - 70px);
|
||||||
text-align: center;
|
max-height: 65vh;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
&.selected {
|
.theme-block {
|
||||||
img {
|
position: relative;
|
||||||
box-shadow: 0 0 0 3px $primary-color;
|
text-align: center;
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
img {
|
||||||
|
box-shadow: 0 0 0 3px $primary-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme-name {
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
top: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
cursor: not-allowed;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-name {
|
|
||||||
position: absolute;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
top: 0;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
text-shadow: 0 0 8px #000;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.badge::after {
|
.badge::after {
|
||||||
background: #32b643;
|
background: #32b643;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-update::after {
|
.badge-update::after {
|
||||||
bottom: initial;
|
bottom: initial;
|
||||||
background: $primary-color;
|
background: $primary-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-label {
|
.form-label {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
82
src/renderer/components/ModalSettingsChangelog.vue
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<template>
|
||||||
|
<div class="p-relative">
|
||||||
|
<BaseLoader v-if="isLoading" />
|
||||||
|
<div
|
||||||
|
id="changelog"
|
||||||
|
class="container"
|
||||||
|
v-html="changelog"
|
||||||
|
/>
|
||||||
|
<div v-if="isError" class="empty">
|
||||||
|
<div class="empty-icon">
|
||||||
|
<i class="mdi mdi-48px mdi-alert-outline" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapGetters } from 'vuex';
|
||||||
|
import marked from 'marked';
|
||||||
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ModalSettingsChangelog',
|
||||||
|
components: {
|
||||||
|
BaseLoader
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
changelog: '',
|
||||||
|
isLoading: true,
|
||||||
|
error: '',
|
||||||
|
isError: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters({ appVersion: 'application/appVersion' })
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.getChangelog();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getChangelog () {
|
||||||
|
try {
|
||||||
|
const apiRes = await fetch(`https://api.github.com/repos/Fabio286/antares/releases/tags/v${this.appVersion}`, {
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
|
|
||||||
|
const { body } = await apiRes.json();
|
||||||
|
const markdown = body.substr(0, body.indexOf('### Download'));
|
||||||
|
const renderer = {
|
||||||
|
link (href, title, text) {
|
||||||
|
return text;
|
||||||
|
},
|
||||||
|
listitem (text) {
|
||||||
|
return `<li>${text.replace(/ *\([^)]*\) */g, '')}</li>`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
marked.use({ renderer });
|
||||||
|
|
||||||
|
this.changelog = marked(markdown);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.error = err.message;
|
||||||
|
this.isError = true;
|
||||||
|
}
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
#changelog {
|
||||||
|
h3 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -92,9 +92,3 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.empty {
|
|
||||||
color: $body-font-color;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@@ -126,9 +126,13 @@ export default {
|
|||||||
return 'sql';
|
return 'sql';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
cursorPosition () {
|
||||||
|
return this.editor.session.doc.positionToIndex(this.editor.getCursorPosition());
|
||||||
|
},
|
||||||
lastWord () {
|
lastWord () {
|
||||||
const words = this.value.split(' ');
|
const charsBefore = this.value.slice(0, this.cursorPosition);
|
||||||
return words[words.length - 1];
|
const words = charsBefore.replaceAll('\n', ' ').split(' ').filter(Boolean);
|
||||||
|
return words.pop();
|
||||||
},
|
},
|
||||||
isLastWordATable () {
|
isLastWordATable () {
|
||||||
return /\w+\.\w*/gm.test(this.lastWord);
|
return /\w+\.\w*/gm.test(this.lastWord);
|
||||||
@@ -209,7 +213,7 @@ export default {
|
|||||||
if (['insertstring', 'backspace', 'del'].includes(e.command.name)) {
|
if (['insertstring', 'backspace', 'del'].includes(e.command.name)) {
|
||||||
if (this.isLastWordATable || e.args === '.') {
|
if (this.isLastWordATable || e.args === '.') {
|
||||||
if (e.args !== ' ') {
|
if (e.args !== ' ') {
|
||||||
const table = this.tables.find(t => t.name === this.lastWord.split('.').pop());
|
const table = this.tables.find(t => t.name === this.lastWord.split('.').pop().trim());
|
||||||
|
|
||||||
if (table) {
|
if (table) {
|
||||||
const params = {
|
const params = {
|
||||||
@@ -312,19 +316,6 @@ export default {
|
|||||||
width: 17px;
|
width: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
|
|
||||||
background-color: #c9561a99;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_line-hover {
|
|
||||||
background-color: #c9571a33;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight {
|
|
||||||
color: #e0d00c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ace_gutter-cell.ace_breakpoint {
|
.ace_gutter-cell.ace_breakpoint {
|
||||||
&::before {
|
&::before {
|
||||||
content: '\F0403';
|
content: '\F0403';
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
<div class="footer-right-elements">
|
<div class="footer-right-elements">
|
||||||
<ul class="footer-elements">
|
<ul class="footer-elements">
|
||||||
<li class="footer-element footer-link" @click="openOutside('https://github.com/sponsors/Fabio286')">
|
<li class="footer-element footer-link" @click="openOutside('https://www.treedom.net/en/user/fabio-di-stasio/event/antares-for-the-planet')">
|
||||||
<i class="mdi mdi-18px mdi-coffee mr-1" />
|
<i class="mdi mdi-18px mdi-tree mr-1" />
|
||||||
<small>{{ $t('word.donate') }}</small>
|
<small>{{ $t('message.plantATree') }}</small>
|
||||||
</li>
|
</li>
|
||||||
<li class="footer-element footer-link" @click="openOutside('https://github.com/Fabio286/antares/issues')">
|
<li class="footer-element footer-link" @click="openOutside('https://github.com/Fabio286/antares/issues')">
|
||||||
<i class="mdi mdi-18px mdi-bug" />
|
<i class="mdi mdi-18px mdi-bug" />
|
||||||
@@ -64,13 +64,11 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: $primary-color;
|
|
||||||
padding: 0 0.2rem;
|
padding: 0 0.2rem;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
box-shadow: 0 0 1px 0 #000;
|
|
||||||
|
|
||||||
.footer-elements {
|
.footer-elements {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@@ -88,10 +86,6 @@ export default {
|
|||||||
&.footer-link {
|
&.footer-link {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: rgba($color: #fff, $alpha: 0.1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
75
src/renderer/components/TheScratchpad.vue
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<ConfirmModal
|
||||||
|
:confirm-text="$t('word.update')"
|
||||||
|
:cancel-text="$t('word.close')"
|
||||||
|
size="large"
|
||||||
|
:hide-footer="true"
|
||||||
|
@hide="hideScratchpad"
|
||||||
|
>
|
||||||
|
<template :slot="'header'">
|
||||||
|
<div class="d-flex">
|
||||||
|
<i class="mdi mdi-24px mdi-notebook-edit-outline mr-1" /> {{ $t('word.scratchpad') }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div :slot="'body'">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<TextEditor
|
||||||
|
:value.sync="localNotes"
|
||||||
|
editor-class="textarea-editor"
|
||||||
|
mode="markdown"
|
||||||
|
:auto-focus="true"
|
||||||
|
:show-line-numbers="false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<small class="text-gray">{{ $t('message.markdownSupported') }}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ConfirmModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
|
import TextEditor from '@/components/BaseTextEditor';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'TheScratchpad',
|
||||||
|
components: {
|
||||||
|
ConfirmModal,
|
||||||
|
TextEditor
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
localNotes: '',
|
||||||
|
debounceTimeout: null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
|
notes: 'scratchpad/getNotes'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
localNotes () {
|
||||||
|
clearTimeout(this.debounceTimeout);
|
||||||
|
|
||||||
|
this.debounceTimeout = setTimeout(() => {
|
||||||
|
this.changeNotes(this.localNotes);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.localNotes = this.notes;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
hideScratchpad: 'application/hideScratchpad',
|
||||||
|
changeNotes: 'scratchpad/changeNotes'
|
||||||
|
}),
|
||||||
|
hideModal () {
|
||||||
|
this.$emit('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@@ -19,7 +19,7 @@
|
|||||||
@contextmenu.prevent="contextMenu($event, connection)"
|
@contextmenu.prevent="contextMenu($event, connection)"
|
||||||
@mouseover.self="tooltipPosition"
|
@mouseover.self="tooltipPosition"
|
||||||
>
|
>
|
||||||
<i class="settingbar-element-icon dbi" :class="`dbi-${connection.client} ${connected.includes(connection.uid) ? 'badge' : ''}`" />
|
<i class="settingbar-element-icon dbi" :class="`dbi-${connection.client} ${getStatusBadge(connection.uid)}`" />
|
||||||
<span class="ex-tooltip-content">{{ getConnectionName(connection.uid) }}</span>
|
<span class="ex-tooltip-content">{{ getConnectionName(connection.uid) }}</span>
|
||||||
</li>
|
</li>
|
||||||
</draggable>
|
</draggable>
|
||||||
@@ -36,6 +36,10 @@
|
|||||||
|
|
||||||
<div class="settingbar-bottom-elements">
|
<div class="settingbar-bottom-elements">
|
||||||
<ul class="settingbar-elements">
|
<ul class="settingbar-elements">
|
||||||
|
<li class="settingbar-element btn btn-link ex-tooltip" @click="showScratchpad">
|
||||||
|
<i class="settingbar-element-icon mdi mdi-24px mdi-notebook-edit-outline text-light" />
|
||||||
|
<span class="ex-tooltip-content">{{ $t('word.scratchpad') }}</span>
|
||||||
|
</li>
|
||||||
<li class="settingbar-element btn btn-link ex-tooltip" @click="showSettingModal('general')">
|
<li class="settingbar-element btn btn-link ex-tooltip" @click="showSettingModal('general')">
|
||||||
<i class="settingbar-element-icon mdi mdi-24px mdi-cog text-light" :class="{' badge badge-update': hasUpdates}" />
|
<i class="settingbar-element-icon mdi mdi-24px mdi-cog text-light" :class="{' badge badge-update': hasUpdates}" />
|
||||||
<span class="ex-tooltip-content">{{ $t('word.settings') }}</span>
|
<span class="ex-tooltip-content">{{ $t('word.settings') }}</span>
|
||||||
@@ -69,7 +73,7 @@ export default {
|
|||||||
...mapGetters({
|
...mapGetters({
|
||||||
getConnections: 'connections/getConnections',
|
getConnections: 'connections/getConnections',
|
||||||
getConnectionName: 'connections/getConnectionName',
|
getConnectionName: 'connections/getConnectionName',
|
||||||
connected: 'workspaces/getConnected',
|
getWorkspace: 'workspaces/getWorkspace',
|
||||||
selectedWorkspace: 'workspaces/getSelected',
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
updateStatus: 'application/getUpdateStatus'
|
updateStatus: 'application/getUpdateStatus'
|
||||||
}),
|
}),
|
||||||
@@ -90,6 +94,7 @@ export default {
|
|||||||
updateConnections: 'connections/updateConnections',
|
updateConnections: 'connections/updateConnections',
|
||||||
showNewConnModal: 'application/showNewConnModal',
|
showNewConnModal: 'application/showNewConnModal',
|
||||||
showSettingModal: 'application/showSettingModal',
|
showSettingModal: 'application/showSettingModal',
|
||||||
|
showScratchpad: 'application/showScratchpad',
|
||||||
selectWorkspace: 'workspaces/selectWorkspace'
|
selectWorkspace: 'workspaces/selectWorkspace'
|
||||||
}),
|
}),
|
||||||
contextMenu (event, connection) {
|
contextMenu (event, connection) {
|
||||||
@@ -104,6 +109,22 @@ export default {
|
|||||||
const el = e.target;
|
const el = e.target;
|
||||||
const fromTop = window.pageYOffset + el.getBoundingClientRect().top - (el.offsetHeight / 4);
|
const fromTop = window.pageYOffset + el.getBoundingClientRect().top - (el.offsetHeight / 4);
|
||||||
el.querySelector('.ex-tooltip-content').style.top = `${fromTop}px`;
|
el.querySelector('.ex-tooltip-content').style.top = `${fromTop}px`;
|
||||||
|
},
|
||||||
|
getStatusBadge (uid) {
|
||||||
|
if (this.getWorkspace(uid)) {
|
||||||
|
const status = this.getWorkspace(uid).connection_status;
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 'connected':
|
||||||
|
return 'badge badge-connected';
|
||||||
|
case 'connecting':
|
||||||
|
return 'badge badge-connecting';
|
||||||
|
case 'failed':
|
||||||
|
return 'badge badge-failed';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -117,9 +138,7 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: $bg-color-light;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-shadow: 0 0 1px 0 #000;
|
|
||||||
z-index: 9;
|
z-index: 9;
|
||||||
|
|
||||||
.settingbar-top-elements {
|
.settingbar-top-elements {
|
||||||
@@ -134,7 +153,6 @@ export default {
|
|||||||
|
|
||||||
.settingbar-bottom-elements {
|
.settingbar-bottom-elements {
|
||||||
padding-top: 0.5rem;
|
padding-top: 0.5rem;
|
||||||
background: $bg-color-light;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +180,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.selected {
|
&.selected {
|
||||||
border-left-color: $body-font-color;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,12 +188,10 @@ export default {
|
|||||||
bottom: -10px;
|
bottom: -10px;
|
||||||
right: 0;
|
right: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: $success-color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.badge-update::after {
|
&.badge-update::after {
|
||||||
bottom: initial;
|
bottom: initial;
|
||||||
background: $primary-color;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,15 +37,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { remote, ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
|
import { getCurrentWindow } from '@electron/remote';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TheTitleBar',
|
name: 'TheTitleBar',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
w: remote.getCurrentWindow(),
|
w: getCurrentWindow(),
|
||||||
isMaximized: remote.getCurrentWindow().isMaximized(),
|
isMaximized: getCurrentWindow().isMaximized(),
|
||||||
isDevelopment: process.env.NODE_ENV === 'development'
|
isDevelopment: process.env.NODE_ENV === 'development'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -102,12 +103,10 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background: $bg-color-light;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: $titlebar-height;
|
height: $titlebar-height;
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
box-shadow: 0 0 1px 0 #000;
|
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
|
|
||||||
.titlebar-resizer {
|
.titlebar-resizer {
|
||||||
@@ -134,7 +133,7 @@ export default {
|
|||||||
|
|
||||||
.titlebar-logo {
|
.titlebar-logo {
|
||||||
height: $titlebar-height;
|
height: $titlebar-height;
|
||||||
padding: 0 0.4rem;
|
padding: 0.3rem 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.titlebar-element {
|
.titlebar-element {
|
||||||
@@ -149,11 +148,6 @@ export default {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
background: rgba($color: #fff, $alpha: 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.close-button:hover {
|
|
||||||
background: red;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-show="isSelected" class="workspace column columns col-gapless">
|
<div v-show="isSelected" class="workspace column columns col-gapless">
|
||||||
<WorkspaceExploreBar :connection="connection" :is-selected="isSelected" />
|
<WorkspaceExploreBar :connection="connection" :is-selected="isSelected" />
|
||||||
<div v-if="workspace.connected" class="workspace-tabs column columns col-gapless">
|
<div v-if="workspace.connection_status === 'connected'" class="workspace-tabs column columns col-gapless">
|
||||||
<ul
|
<ul
|
||||||
id="tabWrap"
|
id="tabWrap"
|
||||||
ref="tabWrap"
|
ref="tabWrap"
|
||||||
@@ -16,19 +16,27 @@
|
|||||||
<i class="mdi mdi-24px mdi-tools" />
|
<i class="mdi mdi-24px mdi-tools" />
|
||||||
</a>
|
</a>
|
||||||
<ul class="menu text-left text-uppercase">
|
<ul class="menu text-left text-uppercase">
|
||||||
<li class="menu-item">
|
<li v-if="workspace.customizations.processesList" class="menu-item">
|
||||||
<a class="c-hand p-vcentered" @click="showProcessesModal">
|
<a class="c-hand p-vcentered" @click="showProcessesModal">
|
||||||
<i class="mdi mdi-memory mr-1 tool-icon" />
|
<i class="mdi mdi-memory mr-1 tool-icon" />
|
||||||
<span>{{ $t('message.processesList') }}</span>
|
<span>{{ $t('message.processesList') }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="menu-item" title="Coming...">
|
<li
|
||||||
|
v-if="workspace.customizations.variables"
|
||||||
|
class="menu-item"
|
||||||
|
title="Coming..."
|
||||||
|
>
|
||||||
<a class="c-hand p-vcentered disabled">
|
<a class="c-hand p-vcentered disabled">
|
||||||
<i class="mdi mdi-shape mr-1 tool-icon" />
|
<i class="mdi mdi-shape mr-1 tool-icon" />
|
||||||
<span>{{ $t('word.variables') }}</span>
|
<span>{{ $t('word.variables') }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="menu-item" title="Coming...">
|
<li
|
||||||
|
v-if="workspace.customizations.usersManagement"
|
||||||
|
class="menu-item"
|
||||||
|
title="Coming..."
|
||||||
|
>
|
||||||
<a class="c-hand p-vcentered disabled">
|
<a class="c-hand p-vcentered disabled">
|
||||||
<i class="mdi mdi-account-group mr-1 tool-icon" />
|
<i class="mdi mdi-account-group mr-1 tool-icon" />
|
||||||
<span>{{ $t('message.manageUsers') }}</span>
|
<span>{{ $t('message.manageUsers') }}</span>
|
||||||
@@ -37,7 +45,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
v-if="schemaChild"
|
v-if="schemaChild && isSettingSupported"
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
:class="{'active': selectedTab === 'prop'}"
|
:class="{'active': selectedTab === 'prop'}"
|
||||||
@click="selectTab({uid: workspace.uid, tab: 'prop'})"
|
@click="selectTab({uid: workspace.uid, tab: 'prop'})"
|
||||||
@@ -194,6 +202,15 @@ export default {
|
|||||||
isSelected () {
|
isSelected () {
|
||||||
return this.selectedWorkspace === this.connection.uid;
|
return this.selectedWorkspace === this.connection.uid;
|
||||||
},
|
},
|
||||||
|
isSettingSupported () {
|
||||||
|
if (this.workspace.breadcrumbs.table && this.workspace.customizations.tableSettings) return true;
|
||||||
|
if (this.workspace.breadcrumbs.view && this.workspace.customizations.viewSettings) return true;
|
||||||
|
if (this.workspace.breadcrumbs.trigger && this.workspace.customizations.triggerSettings) return true;
|
||||||
|
if (this.workspace.breadcrumbs.procedure && this.workspace.customizations.routineSettings) return true;
|
||||||
|
if (this.workspace.breadcrumbs.function && this.workspace.customizations.functionSettings) return true;
|
||||||
|
if (this.workspace.breadcrumbs.scheduler && this.workspace.customizations.schedulerSettings) return true;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
selectedTab () {
|
selectedTab () {
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
@@ -287,7 +304,6 @@ export default {
|
|||||||
height: calc(100vh - #{$excluding-size});
|
height: calc(100vh - #{$excluding-size});
|
||||||
|
|
||||||
.tab-block {
|
.tab-block {
|
||||||
background: $bg-color-light;
|
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
@@ -307,7 +323,6 @@ export default {
|
|||||||
|
|
||||||
> a {
|
> a {
|
||||||
padding: 0.2rem 0.8rem;
|
padding: 0.2rem 0.8rem;
|
||||||
color: $body-font-color;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -338,7 +353,6 @@ export default {
|
|||||||
|
|
||||||
&.tools-dropdown {
|
&.tools-dropdown {
|
||||||
.tab-link:focus {
|
.tab-link:focus {
|
||||||
color: $primary-color;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@@ -357,11 +371,6 @@ export default {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $primary-color;
|
|
||||||
background: $bg-color-gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tool-icon {
|
.tool-icon {
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -397,11 +406,9 @@ export default {
|
|||||||
.th {
|
.th {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
background: $bg-color;
|
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-bottom-width: 2px;
|
border-bottom-width: 2px;
|
||||||
border-color: $bg-color-light;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 0.7rem;
|
font-size: 0.7rem;
|
||||||
@@ -416,7 +423,6 @@ export default {
|
|||||||
.td {
|
.td {
|
||||||
border-right: 1px solid;
|
border-right: 1px solid;
|
||||||
border-bottom: 1px solid;
|
border-bottom: 1px solid;
|
||||||
border-color: $bg-color-light;
|
|
||||||
padding: 0 0.4rem;
|
padding: 0 0.4rem;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
@@ -426,8 +432,6 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
box-shadow: inset 0 0 0 1px $body-font-color;
|
|
||||||
background: rgba($color: #000, $alpha: 0.3);
|
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-12 empty text-light">
|
<div class="column col-12 empty">
|
||||||
<div class="empty-icon">
|
<div class="empty-icon">
|
||||||
<i class="mdi mdi-48px mdi-power-plug-off" />
|
<i class="mdi mdi-48px mdi-power-plug-off" />
|
||||||
</div>
|
</div>
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
>
|
>
|
||||||
<div class="workspace-explorebar-header">
|
<div class="workspace-explorebar-header">
|
||||||
<span class="workspace-explorebar-title">{{ connectionName }}</span>
|
<span class="workspace-explorebar-title">{{ connectionName }}</span>
|
||||||
<span v-if="workspace.connected" class="workspace-explorebar-tools">
|
<span v-if="workspace.connection_status === 'connected'" class="workspace-explorebar-tools">
|
||||||
<i
|
<i
|
||||||
class="mdi mdi-18px mdi-database-plus c-hand mr-2"
|
class="mdi mdi-18px mdi-database-plus c-hand mr-2"
|
||||||
:title="$t('message.createNewDatabase')"
|
:title="$t('message.createNewSchema')"
|
||||||
@click="showNewDBModal"
|
@click="showNewDBModal"
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="workspace-explorebar-search">
|
<div class="workspace-explorebar-search">
|
||||||
<div v-if="workspace.connected" class="has-icon-right">
|
<div v-if="workspace.connection_status === 'connected'" class="has-icon-right">
|
||||||
<input
|
<input
|
||||||
v-model="searchTerm"
|
v-model="searchTerm"
|
||||||
class="form-input input-sm"
|
class="form-input input-sm"
|
||||||
@@ -39,23 +39,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<WorkspaceConnectPanel
|
<WorkspaceConnectPanel
|
||||||
v-if="!workspace.connected"
|
v-if="workspace.connection_status !== 'connected'"
|
||||||
class="workspace-explorebar-body"
|
class="workspace-explorebar-body"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
/>
|
/>
|
||||||
<div v-else class="workspace-explorebar-body">
|
<div v-else class="workspace-explorebar-body">
|
||||||
<WorkspaceExploreBarDatabase
|
<WorkspaceExploreBarSchema
|
||||||
v-for="db of workspace.structure"
|
v-for="db of workspace.structure"
|
||||||
:key="db.name"
|
:key="db.name"
|
||||||
:database="db"
|
:database="db"
|
||||||
:connection="connection"
|
:connection="connection"
|
||||||
@show-database-context="openDatabaseContext"
|
@show-schema-context="openSchemaContext"
|
||||||
@show-table-context="openTableContext"
|
@show-table-context="openTableContext"
|
||||||
@show-misc-context="openMiscContext"
|
@show-misc-context="openMiscContext"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ModalNewDatabase
|
<ModalNewSchema
|
||||||
v-if="isNewDBModal"
|
v-if="isNewDBModal"
|
||||||
@close="hideNewDBModal"
|
@close="hideNewDBModal"
|
||||||
@reload="refresh"
|
@reload="refresh"
|
||||||
@@ -137,11 +137,11 @@ import Functions from '@/ipc-api/Functions';
|
|||||||
import Schedulers from '@/ipc-api/Schedulers';
|
import Schedulers from '@/ipc-api/Schedulers';
|
||||||
|
|
||||||
import WorkspaceConnectPanel from '@/components/WorkspaceConnectPanel';
|
import WorkspaceConnectPanel from '@/components/WorkspaceConnectPanel';
|
||||||
import WorkspaceExploreBarDatabase from '@/components/WorkspaceExploreBarDatabase';
|
import WorkspaceExploreBarSchema from '@/components/WorkspaceExploreBarSchema';
|
||||||
import DatabaseContext from '@/components/WorkspaceExploreBarDatabaseContext';
|
import DatabaseContext from '@/components/WorkspaceExploreBarSchemaContext';
|
||||||
import TableContext from '@/components/WorkspaceExploreBarTableContext';
|
import TableContext from '@/components/WorkspaceExploreBarTableContext';
|
||||||
import MiscContext from '@/components/WorkspaceExploreBarMiscContext';
|
import MiscContext from '@/components/WorkspaceExploreBarMiscContext';
|
||||||
import ModalNewDatabase from '@/components/ModalNewDatabase';
|
import ModalNewSchema from '@/components/ModalNewSchema';
|
||||||
import ModalNewTable from '@/components/ModalNewTable';
|
import ModalNewTable from '@/components/ModalNewTable';
|
||||||
import ModalNewView from '@/components/ModalNewView';
|
import ModalNewView from '@/components/ModalNewView';
|
||||||
import ModalNewTrigger from '@/components/ModalNewTrigger';
|
import ModalNewTrigger from '@/components/ModalNewTrigger';
|
||||||
@@ -153,11 +153,11 @@ export default {
|
|||||||
name: 'WorkspaceExploreBar',
|
name: 'WorkspaceExploreBar',
|
||||||
components: {
|
components: {
|
||||||
WorkspaceConnectPanel,
|
WorkspaceConnectPanel,
|
||||||
WorkspaceExploreBarDatabase,
|
WorkspaceExploreBarSchema,
|
||||||
DatabaseContext,
|
DatabaseContext,
|
||||||
TableContext,
|
TableContext,
|
||||||
MiscContext,
|
MiscContext,
|
||||||
ModalNewDatabase,
|
ModalNewSchema,
|
||||||
ModalNewTable,
|
ModalNewTable,
|
||||||
ModalNewView,
|
ModalNewView,
|
||||||
ModalNewTrigger,
|
ModalNewTrigger,
|
||||||
@@ -299,8 +299,8 @@ export default {
|
|||||||
else
|
else
|
||||||
this.addNotification({ status: 'error', message: response });
|
this.addNotification({ status: 'error', message: response });
|
||||||
},
|
},
|
||||||
openDatabaseContext (payload) {
|
openSchemaContext (payload) {
|
||||||
this.selectedDatabase = payload.database;
|
this.selectedDatabase = payload.schema;
|
||||||
this.databaseContextEvent = payload.event;
|
this.databaseContextEvent = payload.event;
|
||||||
this.isDatabaseContext = true;
|
this.isDatabaseContext = true;
|
||||||
},
|
},
|
||||||
@@ -460,8 +460,6 @@ export default {
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
background: $bg-color-gray;
|
|
||||||
box-shadow: 0 0 1px 0 #000;
|
|
||||||
z-index: 8;
|
z-index: 8;
|
||||||
flex: initial;
|
flex: initial;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
<ModalAskParameters
|
<ModalAskParameters
|
||||||
v-if="isAskingParameters"
|
v-if="isAskingParameters"
|
||||||
:local-routine="localElement"
|
:local-routine="localElement"
|
||||||
|
:client="workspace.client"
|
||||||
@confirm="runElement"
|
@confirm="runElement"
|
||||||
@close="hideAskParamsModal"
|
@close="hideAskParamsModal"
|
||||||
/>
|
/>
|
||||||
@@ -205,13 +206,13 @@ export default {
|
|||||||
case 'maria':
|
case 'maria':
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'pg':
|
case 'pg':
|
||||||
sql = `CALL \`${this.localElement.name}\` (${params.join(',')})`;
|
sql = `CALL ${this.localElement.name}(${params.join(',')})`;
|
||||||
break;
|
break;
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
sql = `EXEC ${this.localElement.name} ${params.join(',')}`;
|
sql = `EXEC ${this.localElement.name} ${params.join(',')}`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sql = `CALL \`${this.localElement.name}\` (${params.join(',')})`;
|
sql = `CALL \`${this.localElement.name}\`(${params.join(',')})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.newTab({ uid: this.workspace.uid, content: sql, autorun: true });
|
this.newTab({ uid: this.workspace.uid, content: sql, autorun: true });
|
||||||
@@ -247,9 +248,11 @@ export default {
|
|||||||
switch (this.workspace.client) { // TODO: move in a better place
|
switch (this.workspace.client) { // TODO: move in a better place
|
||||||
case 'maria':
|
case 'maria':
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'pg':
|
|
||||||
sql = `SELECT \`${this.localElement.name}\` (${params.join(',')})`;
|
sql = `SELECT \`${this.localElement.name}\` (${params.join(',')})`;
|
||||||
break;
|
break;
|
||||||
|
case 'pg':
|
||||||
|
sql = `SELECT ${this.localElement.name}(${params.join(',')})`;
|
||||||
|
break;
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
sql = `SELECT ${this.localElement.name} ${params.join(',')}`;
|
sql = `SELECT ${this.localElement.name} ${params.join(',')}`;
|
||||||
break;
|
break;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
class="accordion-header database-name"
|
class="accordion-header database-name"
|
||||||
:class="{'text-bold': breadcrumbs.schema === database.name}"
|
:class="{'text-bold': breadcrumbs.schema === database.name}"
|
||||||
@click="selectSchema(database.name)"
|
@click="selectSchema(database.name)"
|
||||||
@contextmenu.prevent="showDatabaseContext($event, database.name)"
|
@contextmenu.prevent="showSchemaContext($event, database.name)"
|
||||||
>
|
>
|
||||||
<div v-if="isLoading" class="icon loading" />
|
<div v-if="isLoading" class="icon loading" />
|
||||||
<i v-else class="icon mdi mdi-18px mdi-chevron-right" />
|
<i v-else class="icon mdi mdi-18px mdi-chevron-right" />
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="filteredTriggers.length" class="database-misc">
|
<div v-if="filteredTriggers.length && customizations.triggers" class="database-misc">
|
||||||
<details class="accordion">
|
<details class="accordion">
|
||||||
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.trigger}">
|
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.trigger}">
|
||||||
<i class="misc-icon mdi mdi-18px mdi-folder-cog mr-1" />
|
<i class="misc-icon mdi mdi-18px mdi-folder-cog mr-1" />
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="filteredProcedures.length" class="database-misc">
|
<div v-if="filteredProcedures.length && customizations.routines" class="database-misc">
|
||||||
<details class="accordion">
|
<details class="accordion">
|
||||||
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.procedure}">
|
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.procedure}">
|
||||||
<i class="misc-icon mdi mdi-18px mdi-folder-sync mr-1" />
|
<i class="misc-icon mdi mdi-18px mdi-folder-sync mr-1" />
|
||||||
@@ -75,8 +75,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<ul class="menu menu-nav pt-0">
|
<ul class="menu menu-nav pt-0">
|
||||||
<li
|
<li
|
||||||
v-for="procedure of filteredProcedures"
|
v-for="(procedure, i) of filteredProcedures"
|
||||||
:key="procedure.name"
|
:key="`${procedure.name}-${i}`"
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.procedure === procedure.name}"
|
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.procedure === procedure.name}"
|
||||||
@click="setBreadcrumbs({schema: database.name, procedure: procedure.name})"
|
@click="setBreadcrumbs({schema: database.name, procedure: procedure.name})"
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="filteredFunctions.length" class="database-misc">
|
<div v-if="filteredFunctions.length && customizations.functions" class="database-misc">
|
||||||
<details class="accordion">
|
<details class="accordion">
|
||||||
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.function}">
|
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.function}">
|
||||||
<i class="misc-icon mdi mdi-18px mdi-folder-move mr-1" />
|
<i class="misc-icon mdi mdi-18px mdi-folder-move mr-1" />
|
||||||
@@ -103,8 +103,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<ul class="menu menu-nav pt-0">
|
<ul class="menu menu-nav pt-0">
|
||||||
<li
|
<li
|
||||||
v-for="func of filteredFunctions"
|
v-for="(func, i) of filteredFunctions"
|
||||||
:key="func.name"
|
:key="`${func.name}-${i}`"
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
|
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
|
||||||
@click="setBreadcrumbs({schema: database.name, function: func.name})"
|
@click="setBreadcrumbs({schema: database.name, function: func.name})"
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="filteredSchedulers.length" class="database-misc">
|
<div v-if="filteredSchedulers.length && customizations.schedulers" class="database-misc">
|
||||||
<details class="accordion">
|
<details class="accordion">
|
||||||
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.scheduler}">
|
<summary class="accordion-header misc-name" :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.scheduler}">
|
||||||
<i class="misc-icon mdi mdi-18px mdi-folder-clock mr-1" />
|
<i class="misc-icon mdi mdi-18px mdi-folder-clock mr-1" />
|
||||||
@@ -157,7 +157,7 @@ import { mapActions, mapGetters } from 'vuex';
|
|||||||
import { formatBytes } from 'common/libs/formatBytes';
|
import { formatBytes } from 'common/libs/formatBytes';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarDatabase',
|
name: 'WorkspaceExploreBarSchema',
|
||||||
props: {
|
props: {
|
||||||
database: Object,
|
database: Object,
|
||||||
connection: Object
|
connection: Object
|
||||||
@@ -171,7 +171,8 @@ export default {
|
|||||||
...mapGetters({
|
...mapGetters({
|
||||||
getLoadedSchemas: 'workspaces/getLoadedSchemas',
|
getLoadedSchemas: 'workspaces/getLoadedSchemas',
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
getWorkspace: 'workspaces/getWorkspace',
|
||||||
getSearchTerm: 'workspaces/getSearchTerm'
|
getSearchTerm: 'workspaces/getSearchTerm',
|
||||||
|
applicationTheme: 'settings/getApplicationTheme'
|
||||||
}),
|
}),
|
||||||
searchTerm () {
|
searchTerm () {
|
||||||
return this.getSearchTerm(this.connection.uid);
|
return this.getSearchTerm(this.connection.uid);
|
||||||
@@ -194,6 +195,9 @@ export default {
|
|||||||
breadcrumbs () {
|
breadcrumbs () {
|
||||||
return this.getWorkspace(this.connection.uid).breadcrumbs;
|
return this.getWorkspace(this.connection.uid).breadcrumbs;
|
||||||
},
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.getWorkspace(this.connection.uid).customizations;
|
||||||
|
},
|
||||||
loadedSchemas () {
|
loadedSchemas () {
|
||||||
return this.getLoadedSchemas(this.connection.uid);
|
return this.getLoadedSchemas(this.connection.uid);
|
||||||
},
|
},
|
||||||
@@ -222,9 +226,9 @@ export default {
|
|||||||
|
|
||||||
this.changeBreadcrumbs({ schema, table: null });
|
this.changeBreadcrumbs({ schema, table: null });
|
||||||
},
|
},
|
||||||
showDatabaseContext (event, database) {
|
showSchemaContext (event, schema) {
|
||||||
this.changeBreadcrumbs({ schema: database, table: null });
|
this.selectSchema(schema);
|
||||||
this.$emit('show-database-context', { event, database });
|
this.$emit('show-schema-context', { event, schema });
|
||||||
},
|
},
|
||||||
showTableContext (event, table) {
|
showTableContext (event, table) {
|
||||||
this.setBreadcrumbs({ schema: this.database.name, [table.type]: table.name });
|
this.setBreadcrumbs({ schema: this.database.name, [table.type]: table.name });
|
||||||
@@ -236,7 +240,10 @@ export default {
|
|||||||
},
|
},
|
||||||
piePercentage (val) {
|
piePercentage (val) {
|
||||||
const perc = val / this.maxSize * 100;
|
const perc = val / this.maxSize * 100;
|
||||||
return { background: `conic-gradient(lime ${perc}%, white 0)` };
|
if (this.applicationTheme === 'dark')
|
||||||
|
return { background: `conic-gradient(lime ${perc}%, white 0)` };
|
||||||
|
else
|
||||||
|
return { background: `conic-gradient(teal ${perc}%, silver 0)` };
|
||||||
},
|
},
|
||||||
setBreadcrumbs (payload) {
|
setBreadcrumbs (payload) {
|
||||||
if (this.breadcrumbs.schema === payload.schema && this.breadcrumbs.table === payload.table) return;
|
if (this.breadcrumbs.schema === payload.schema && this.breadcrumbs.table === payload.table) return;
|
||||||
@@ -259,7 +266,6 @@ export default {
|
|||||||
.database-name {
|
.database-name {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
background: $bg-color-gray;
|
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,26 +311,15 @@ export default {
|
|||||||
.database-name,
|
.database-name,
|
||||||
.misc-name {
|
.misc-name {
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $body-font-color;
|
|
||||||
background: $bg-color-light;
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a.table-name {
|
|
||||||
&:hover {
|
|
||||||
color: inherit;
|
|
||||||
background: inherit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $body-font-color;
|
|
||||||
background: rgba($color: #fff, $alpha: 0.05);
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -7,27 +7,55 @@
|
|||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-plus text-light pr-1" /> {{ $t('word.add') }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-plus text-light pr-1" /> {{ $t('word.add') }}</span>
|
||||||
<i class="mdi mdi-18px mdi-chevron-right text-light pl-1" />
|
<i class="mdi mdi-18px mdi-chevron-right text-light pl-1" />
|
||||||
<div class="context-submenu">
|
<div class="context-submenu">
|
||||||
<div class="context-element" @click="showCreateTableModal">
|
<div
|
||||||
|
v-if="workspace.customizations.tableAdd"
|
||||||
|
class="context-element"
|
||||||
|
@click="showCreateTableModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-table text-light pr-1" /> {{ $t('word.table') }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-table text-light pr-1" /> {{ $t('word.table') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showCreateViewModal">
|
<div
|
||||||
|
v-if="workspace.customizations.viewAdd"
|
||||||
|
class="context-element"
|
||||||
|
@click="showCreateViewModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-table-eye text-light pr-1" /> {{ $t('word.view') }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-table-eye text-light pr-1" /> {{ $t('word.view') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showCreateTriggerModal">
|
<div
|
||||||
|
v-if="workspace.customizations.triggerAdd"
|
||||||
|
class="context-element"
|
||||||
|
@click="showCreateTriggerModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-table-cog text-light pr-1" /> {{ $tc('word.trigger', 1) }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-table-cog text-light pr-1" /> {{ $tc('word.trigger', 1) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showCreateRoutineModal">
|
<div
|
||||||
|
v-if="workspace.customizations.routineAdd"
|
||||||
|
class="context-element"
|
||||||
|
@click="showCreateRoutineModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-sync-circle pr-1" /> {{ $tc('word.storedRoutine', 1) }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-sync-circle pr-1" /> {{ $tc('word.storedRoutine', 1) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showCreateFunctionModal">
|
<div
|
||||||
|
v-if="workspace.customizations.functionAdd"
|
||||||
|
class="context-element"
|
||||||
|
@click="showCreateFunctionModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-arrow-right-bold-box pr-1" /> {{ $tc('word.function', 1) }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-arrow-right-bold-box pr-1" /> {{ $tc('word.function', 1) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showCreateSchedulerModal">
|
<div
|
||||||
|
v-if="workspace.customizations.schedulerAdd"
|
||||||
|
class="context-element"
|
||||||
|
@click="showCreateSchedulerModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-calendar-clock text-light pr-1" /> {{ $tc('word.scheduler', 1) }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-calendar-clock text-light pr-1" /> {{ $tc('word.scheduler', 1) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showEditModal">
|
<div
|
||||||
|
v-if="workspace.customizations.schemaEdit"
|
||||||
|
class="context-element"
|
||||||
|
@click="showEditModal"
|
||||||
|
>
|
||||||
<span class="d-flex"><i class="mdi mdi-18px mdi-database-edit text-light pr-1" /> {{ $t('word.edit') }}</span>
|
<span class="d-flex"><i class="mdi mdi-18px mdi-database-edit text-light pr-1" /> {{ $t('word.edit') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click="showDeleteModal">
|
<div class="context-element" @click="showDeleteModal">
|
||||||
@@ -36,12 +64,12 @@
|
|||||||
|
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
v-if="isDeleteModal"
|
v-if="isDeleteModal"
|
||||||
@confirm="deleteDatabase"
|
@confirm="deleteSchema"
|
||||||
@hide="hideDeleteModal"
|
@hide="hideDeleteModal"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<i class="mdi mdi-24px mdi-database-remove mr-1" /> {{ $t('message.deleteDatabase') }}
|
<i class="mdi mdi-24px mdi-database-remove mr-1" /> {{ $t('message.deleteSchema') }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
@@ -50,7 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ConfirmModal>
|
</ConfirmModal>
|
||||||
<ModalEditDatabase
|
<ModalEditSchema
|
||||||
v-if="isEditModal"
|
v-if="isEditModal"
|
||||||
:selected-database="selectedDatabase"
|
:selected-database="selectedDatabase"
|
||||||
@close="hideEditModal"
|
@close="hideEditModal"
|
||||||
@@ -62,15 +90,15 @@
|
|||||||
import { mapGetters, mapActions } from 'vuex';
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import ModalEditDatabase from '@/components/ModalEditDatabase';
|
import ModalEditSchema from '@/components/ModalEditSchema';
|
||||||
import Database from '@/ipc-api/Database';
|
import Schema from '@/ipc-api/Schema';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceExploreBarDatabaseContext',
|
name: 'WorkspaceExploreBarSchemaContext',
|
||||||
components: {
|
components: {
|
||||||
BaseContextMenu,
|
BaseContextMenu,
|
||||||
ConfirmModal,
|
ConfirmModal,
|
||||||
ModalEditDatabase
|
ModalEditSchema
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
contextEvent: MouseEvent,
|
contextEvent: MouseEvent,
|
||||||
@@ -130,9 +158,9 @@ export default {
|
|||||||
closeContext () {
|
closeContext () {
|
||||||
this.$emit('close-context');
|
this.$emit('close-context');
|
||||||
},
|
},
|
||||||
async deleteDatabase () {
|
async deleteSchema () {
|
||||||
try {
|
try {
|
||||||
const { status, response } = await Database.deleteDatabase({
|
const { status, response } = await Schema.deleteSchema({
|
||||||
uid: this.selectedWorkspace,
|
uid: this.selectedWorkspace,
|
||||||
database: this.selectedDatabase
|
database: this.selectedDatabase
|
||||||
});
|
});
|
@@ -2,6 +2,7 @@
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
:confirm-text="$t('word.confirm')"
|
:confirm-text="$t('word.confirm')"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
class="options-modal"
|
||||||
@confirm="confirmForeignsChange"
|
@confirm="confirmForeignsChange"
|
||||||
@hide="$emit('hide')"
|
@hide="$emit('hide')"
|
||||||
>
|
>
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
v-for="foreign in foreignProxy"
|
v-for="foreign in foreignProxy"
|
||||||
:key="foreign._id"
|
:key="foreign._id"
|
||||||
class="tile tile-centered c-hand mb-1 p-1"
|
class="tile tile-centered c-hand mb-1 p-1"
|
||||||
:class="{'selected-foreign': selectedForeignID === foreign._id}"
|
:class="{'selected-element': selectedForeignID === foreign._id}"
|
||||||
@click="selectForeign($event, foreign._id)"
|
@click="selectForeign($event, foreign._id)"
|
||||||
>
|
>
|
||||||
<div class="tile-icon">
|
<div class="tile-icon">
|
||||||
@@ -268,8 +269,10 @@ export default {
|
|||||||
this.$emit('foreigns-update', this.foreignProxy);
|
this.$emit('foreigns-update', this.foreignProxy);
|
||||||
},
|
},
|
||||||
selectForeign (event, id) {
|
selectForeign (event, id) {
|
||||||
if (this.selectedForeignID !== id && !event.target.classList.contains('remove-field'))
|
if (this.selectedForeignID !== id && !event.target.classList.contains('remove-field')) {
|
||||||
this.selectedForeignID = id;
|
this.selectedForeignID = id;
|
||||||
|
this.getRefFields();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getModalInnerHeight () {
|
getModalInnerHeight () {
|
||||||
const modalBody = document.querySelector('.modal-body');
|
const modalBody = document.querySelector('.modal-body');
|
||||||
@@ -369,23 +372,16 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $bg-color-light;
|
|
||||||
|
|
||||||
.tile-action {
|
.tile-action {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selected-foreign {
|
&.selected-element {
|
||||||
background: $bg-color-light;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-col {
|
|
||||||
border-left: 2px solid $bg-color-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fields-list {
|
.fields-list {
|
||||||
max-height: 80px;
|
max-height: 80px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@@ -26,7 +26,19 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.languages" class="form-group">
|
||||||
|
<label class="form-label col-4">
|
||||||
|
{{ $t('word.language') }}
|
||||||
|
</label>
|
||||||
|
<div class="column">
|
||||||
|
<select v-model="optionsProxy.language" class="form-select">
|
||||||
|
<option v-for="language in customizations.languages" :key="language">
|
||||||
|
{{ language }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="customizations.definer" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.definer') }}
|
{{ $t('word.definer') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -65,6 +77,12 @@
|
|||||||
class="form-select text-uppercase"
|
class="form-select text-uppercase"
|
||||||
style="width: 0;"
|
style="width: 0;"
|
||||||
>
|
>
|
||||||
|
<option v-if="localOptions.returns === 'VOID'">
|
||||||
|
VOID
|
||||||
|
</option>
|
||||||
|
<option v-if="!isInDataTypes">
|
||||||
|
{{ localOptions.returns }}
|
||||||
|
</option>
|
||||||
<optgroup
|
<optgroup
|
||||||
v-for="group in workspace.dataTypes"
|
v-for="group in workspace.dataTypes"
|
||||||
:key="group.group"
|
:key="group.group"
|
||||||
@@ -81,6 +99,7 @@
|
|||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<input
|
<input
|
||||||
|
v-if="customizations.parametersLength"
|
||||||
v-model="optionsProxy.returnsLength"
|
v-model="optionsProxy.returnsLength"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
type="number"
|
type="number"
|
||||||
@@ -89,7 +108,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -112,7 +131,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.functionDataAccess" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('message.dataAccess') }}
|
{{ $t('message.dataAccess') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -125,7 +144,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.functionDeterministic" class="form-group">
|
||||||
<div class="col-4" />
|
<div class="col-4" />
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<label class="form-checkbox form-inline">
|
<label class="form-checkbox form-inline">
|
||||||
@@ -159,6 +178,19 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
isTableNameValid () {
|
isTableNameValid () {
|
||||||
return this.optionsProxy.name !== '';
|
return this.optionsProxy.name !== '';
|
||||||
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.workspace.customizations;
|
||||||
|
},
|
||||||
|
isInDataTypes () {
|
||||||
|
let typeNames = [];
|
||||||
|
for (const group of this.workspace.dataTypes) {
|
||||||
|
typeNames = group.types.reduce((acc, curr) => {
|
||||||
|
acc.push(curr.name);
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
return typeNames.includes(this.localOptions.returns);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
:confirm-text="$t('word.confirm')"
|
:confirm-text="$t('word.confirm')"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
class="options-modal"
|
||||||
@confirm="confirmParametersChange"
|
@confirm="confirmParametersChange"
|
||||||
@hide="$emit('hide')"
|
@hide="$emit('hide')"
|
||||||
>
|
>
|
||||||
@@ -36,19 +37,19 @@
|
|||||||
v-for="param in parametersProxy"
|
v-for="param in parametersProxy"
|
||||||
:key="param._id"
|
:key="param._id"
|
||||||
class="tile tile-centered c-hand mb-1 p-1"
|
class="tile tile-centered c-hand mb-1 p-1"
|
||||||
:class="{'selected-param': selectedParam === param._id}"
|
:class="{'selected-element': selectedParam === param._id}"
|
||||||
@click="selectParameter($event, param._id)"
|
@click="selectParameter($event, param._id)"
|
||||||
>
|
>
|
||||||
<div class="tile-icon">
|
<div class="tile-icon">
|
||||||
<div>
|
<div>
|
||||||
<i class="mdi mdi-hexagon mdi-24px" :class="`type-${param.type.toLowerCase()}`" />
|
<i class="mdi mdi-hexagon mdi-24px" :class="typeClass(param.type)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tile-content">
|
<div class="tile-content">
|
||||||
<div class="tile-title">
|
<div class="tile-title">
|
||||||
{{ param.name }}
|
{{ param.name }}
|
||||||
</div>
|
</div>
|
||||||
<small class="tile-subtitle text-gray">{{ param.type }}{{ param.length ? `(${param.length})` : '' }}</small>
|
<small class="tile-subtitle text-gray">{{ param.type }}{{ param.length ? `(${param.length})` : '' }} · {{ param.context }}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="tile-action">
|
<div class="tile-action">
|
||||||
<button
|
<button
|
||||||
@@ -105,7 +106,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.parametersLength" class="form-group">
|
||||||
<label class="form-label col-3">
|
<label class="form-label col-3">
|
||||||
{{ $t('word.length') }}
|
{{ $t('word.length') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -118,6 +119,37 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="customizations.functionContext" class="form-group">
|
||||||
|
<label class="form-label col-3">
|
||||||
|
{{ $t('word.context') }}
|
||||||
|
</label>
|
||||||
|
<div class="column">
|
||||||
|
<label class="form-radio">
|
||||||
|
<input
|
||||||
|
v-model="selectedParamObj.context"
|
||||||
|
type="radio"
|
||||||
|
name="context"
|
||||||
|
value="IN"
|
||||||
|
> <i class="form-icon" /> IN
|
||||||
|
</label>
|
||||||
|
<label class="form-radio">
|
||||||
|
<input
|
||||||
|
v-model="selectedParamObj.context"
|
||||||
|
type="radio"
|
||||||
|
value="OUT"
|
||||||
|
name="context"
|
||||||
|
> <i class="form-icon" /> OUT
|
||||||
|
</label>
|
||||||
|
<label class="form-radio">
|
||||||
|
<input
|
||||||
|
v-model="selectedParamObj.context"
|
||||||
|
type="radio"
|
||||||
|
value="INOUT"
|
||||||
|
name="context"
|
||||||
|
> <i class="form-icon" /> INOUT
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div v-if="!parametersProxy.length" class="empty">
|
<div v-if="!parametersProxy.length" class="empty">
|
||||||
<div class="empty-icon">
|
<div class="empty-icon">
|
||||||
@@ -167,6 +199,9 @@ export default {
|
|||||||
},
|
},
|
||||||
isChanged () {
|
isChanged () {
|
||||||
return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy);
|
return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy);
|
||||||
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.workspace.customizations;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -183,6 +218,11 @@ export default {
|
|||||||
window.removeEventListener('resize', this.getModalInnerHeight);
|
window.removeEventListener('resize', this.getModalInnerHeight);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
typeClass (type) {
|
||||||
|
if (type)
|
||||||
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
confirmParametersChange () {
|
confirmParametersChange () {
|
||||||
this.$emit('parameters-update', this.parametersProxy);
|
this.$emit('parameters-update', this.parametersProxy);
|
||||||
},
|
},
|
||||||
@@ -244,23 +284,16 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $bg-color-light;
|
|
||||||
|
|
||||||
.tile-action {
|
.tile-action {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selected-param {
|
&.selected-element {
|
||||||
background: $bg-color-light;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-col {
|
|
||||||
border-left: 2px solid $bg-color-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fields-list {
|
.fields-list {
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
:confirm-text="$t('word.confirm')"
|
:confirm-text="$t('word.confirm')"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
class="options-modal"
|
||||||
@confirm="confirmIndexesChange"
|
@confirm="confirmIndexesChange"
|
||||||
@hide="$emit('hide')"
|
@hide="$emit('hide')"
|
||||||
>
|
>
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
v-for="index in indexesProxy"
|
v-for="index in indexesProxy"
|
||||||
:key="index._id"
|
:key="index._id"
|
||||||
class="tile tile-centered c-hand mb-1 p-1"
|
class="tile tile-centered c-hand mb-1 p-1"
|
||||||
:class="{'selected-index': selectedIndexID === index._id}"
|
:class="{'selected-element': selectedIndexID === index._id}"
|
||||||
@click="selectIndex($event, index._id)"
|
@click="selectIndex($event, index._id)"
|
||||||
>
|
>
|
||||||
<div class="tile-icon">
|
<div class="tile-icon">
|
||||||
@@ -256,23 +257,16 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $bg-color-light;
|
|
||||||
|
|
||||||
.tile-action {
|
.tile-action {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selected-index {
|
&.selected-element {
|
||||||
background: $bg-color-light;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-col {
|
|
||||||
border-left: 2px solid $bg-color-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fields-list {
|
.fields-list {
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.autoIncrement" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.autoIncrement') }}
|
{{ $t('word.autoIncrement') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.collations" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.collation') }}
|
{{ $t('word.collation') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.engines" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.engine') }}
|
{{ $t('word.engine') }}
|
||||||
</label>
|
</label>
|
||||||
|
@@ -26,7 +26,19 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.languages" class="form-group">
|
||||||
|
<label class="form-label col-4">
|
||||||
|
{{ $t('word.language') }}
|
||||||
|
</label>
|
||||||
|
<div class="column">
|
||||||
|
<select v-model="optionsProxy.language" class="form-select">
|
||||||
|
<option v-for="language in customizations.languages" :key="language">
|
||||||
|
{{ language }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="customizations.definer" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.definer') }}
|
{{ $t('word.definer') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -54,7 +66,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.comment" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -77,7 +89,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.procedureDataAccess" class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('message.dataAccess') }}
|
{{ $t('message.dataAccess') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -90,7 +102,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.procedureDeterministic" class="form-group">
|
||||||
<div class="col-4" />
|
<div class="col-4" />
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<label class="form-checkbox form-inline">
|
<label class="form-checkbox form-inline">
|
||||||
@@ -124,6 +136,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
isTableNameValid () {
|
isTableNameValid () {
|
||||||
return this.optionsProxy.name !== '';
|
return this.optionsProxy.name !== '';
|
||||||
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.workspace.customizations;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
:confirm-text="$t('word.confirm')"
|
:confirm-text="$t('word.confirm')"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
class="options-modal"
|
||||||
@confirm="confirmParametersChange"
|
@confirm="confirmParametersChange"
|
||||||
@hide="$emit('hide')"
|
@hide="$emit('hide')"
|
||||||
>
|
>
|
||||||
@@ -36,12 +37,12 @@
|
|||||||
v-for="param in parametersProxy"
|
v-for="param in parametersProxy"
|
||||||
:key="param._id"
|
:key="param._id"
|
||||||
class="tile tile-centered c-hand mb-1 p-1"
|
class="tile tile-centered c-hand mb-1 p-1"
|
||||||
:class="{'selected-param': selectedParam === param._id}"
|
:class="{'selected-element': selectedParam === param._id}"
|
||||||
@click="selectParameter($event, param._id)"
|
@click="selectParameter($event, param._id)"
|
||||||
>
|
>
|
||||||
<div class="tile-icon">
|
<div class="tile-icon">
|
||||||
<div>
|
<div>
|
||||||
<i class="mdi mdi-hexagon mdi-24px" :class="`type-${param.type.toLowerCase()}`" />
|
<i class="mdi mdi-hexagon mdi-24px" :class="typeClass(param.type)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tile-content">
|
<div class="tile-content">
|
||||||
@@ -105,7 +106,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.parametersLength" class="form-group">
|
||||||
<label class="form-label col-3">
|
<label class="form-label col-3">
|
||||||
{{ $t('word.length') }}
|
{{ $t('word.length') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -118,7 +119,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div v-if="customizations.procedureContext" class="form-group">
|
||||||
<label class="form-label col-3">
|
<label class="form-label col-3">
|
||||||
{{ $t('word.context') }}
|
{{ $t('word.context') }}
|
||||||
</label>
|
</label>
|
||||||
@@ -198,6 +199,9 @@ export default {
|
|||||||
},
|
},
|
||||||
isChanged () {
|
isChanged () {
|
||||||
return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy);
|
return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy);
|
||||||
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.workspace.customizations;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -214,6 +218,11 @@ export default {
|
|||||||
window.removeEventListener('resize', this.getModalInnerHeight);
|
window.removeEventListener('resize', this.getModalInnerHeight);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
typeClass (type) {
|
||||||
|
if (type)
|
||||||
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
confirmParametersChange () {
|
confirmParametersChange () {
|
||||||
this.$emit('parameters-update', this.parametersProxy);
|
this.$emit('parameters-update', this.parametersProxy);
|
||||||
},
|
},
|
||||||
@@ -229,10 +238,10 @@ export default {
|
|||||||
addParameter () {
|
addParameter () {
|
||||||
this.parametersProxy = [...this.parametersProxy, {
|
this.parametersProxy = [...this.parametersProxy, {
|
||||||
_id: uidGen(),
|
_id: uidGen(),
|
||||||
name: `Param${this.i++}`,
|
name: `param${this.i++}`,
|
||||||
type: 'INT',
|
type: this.workspace.dataTypes[0].types[0].name,
|
||||||
context: 'IN',
|
context: 'IN',
|
||||||
length: 10
|
length: ''
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (this.parametersProxy.length === 1)
|
if (this.parametersProxy.length === 1)
|
||||||
@@ -275,23 +284,16 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: $bg-color-light;
|
|
||||||
|
|
||||||
.tile-action {
|
.tile-action {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selected-param {
|
&.selected-element {
|
||||||
background: $bg-color-light;
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-col {
|
|
||||||
border-left: 2px solid $bg-color-light;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fields-list {
|
.fields-list {
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
:disabled="!isChanged"
|
:disabled="!isChanged"
|
||||||
:class="{'loading':isSaving}"
|
:class="{'loading':isSaving}"
|
||||||
|
title="CTRL+S"
|
||||||
@click="saveChanges"
|
@click="saveChanges"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.save') }}</span>
|
<span>{{ $t('word.save') }}</span>
|
||||||
@@ -68,6 +69,7 @@
|
|||||||
@remove-field="removeField"
|
@remove-field="removeField"
|
||||||
@add-new-index="addNewIndex"
|
@add-new-index="addNewIndex"
|
||||||
@add-to-index="addToIndex"
|
@add-to-index="addToIndex"
|
||||||
|
@rename-field="renameField"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<WorkspacePropsOptionsModal
|
<WorkspacePropsOptionsModal
|
||||||
@@ -149,6 +151,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
getWorkspace: 'workspaces/getWorkspace',
|
||||||
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
@@ -162,7 +165,7 @@ export default {
|
|||||||
return this.getDatabaseVariable(this.connection.uid, 'default_storage_engine').value || '';
|
return this.getDatabaseVariable(this.connection.uid, 'default_storage_engine').value || '';
|
||||||
},
|
},
|
||||||
isSelected () {
|
isSelected () {
|
||||||
return this.workspace.selected_tab === 'prop';
|
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.table;
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
@@ -199,6 +202,12 @@ export default {
|
|||||||
this.setUnsavedChanges(val);
|
this.setUnsavedChanges(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
@@ -224,6 +233,20 @@ export default {
|
|||||||
const { status, response } = await Tables.getTableColumns(params);
|
const { status, response } = await Tables.getTableColumns(params);
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
this.originalFields = response.map(field => {
|
this.originalFields = response.map(field => {
|
||||||
|
if (field.autoIncrement)
|
||||||
|
field.defaultType = 'autoincrement';
|
||||||
|
else if (field.default === null)
|
||||||
|
field.defaultType = 'noval';
|
||||||
|
else if (field.default === 'NULL')
|
||||||
|
field.defaultType = 'null';
|
||||||
|
else if (isNaN(+field.default) && field.default.charAt(0) !== '\'')
|
||||||
|
field.defaultType = 'expression';
|
||||||
|
else {
|
||||||
|
field.defaultType = 'custom';
|
||||||
|
if (isNaN(+field.default) && !field.default.includes('\''))
|
||||||
|
field.default = `'${field.default}'`;
|
||||||
|
}
|
||||||
|
|
||||||
return { ...field, _id: uidGen() };
|
return { ...field, _id: uidGen() };
|
||||||
});
|
});
|
||||||
this.localFields = JSON.parse(JSON.stringify(this.originalFields));
|
this.localFields = JSON.parse(JSON.stringify(this.originalFields));
|
||||||
@@ -433,11 +456,11 @@ export default {
|
|||||||
_id: uidGen(),
|
_id: uidGen(),
|
||||||
name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`,
|
name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`,
|
||||||
key: '',
|
key: '',
|
||||||
type: 'int',
|
type: this.workspace.dataTypes[0].types[0].name,
|
||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
table: this.table,
|
table: this.table,
|
||||||
numPrecision: null,
|
numPrecision: null,
|
||||||
numLength: 11,
|
numLength: this.workspace.dataTypes[0].types[0].length,
|
||||||
datePrecision: null,
|
datePrecision: null,
|
||||||
charLength: null,
|
charLength: null,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
@@ -457,6 +480,20 @@ export default {
|
|||||||
scrollable.scrollTop = scrollable.scrollHeight + 30;
|
scrollable.scrollTop = scrollable.scrollHeight + 30;
|
||||||
}, 20);
|
}, 20);
|
||||||
},
|
},
|
||||||
|
renameField (payload) {
|
||||||
|
this.localIndexes = this.localIndexes.map(index => {
|
||||||
|
const fi = index.fields.findIndex(field => field === payload.old);
|
||||||
|
if (fi !== -1)
|
||||||
|
index.fields[fi] = payload.new;
|
||||||
|
return index;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.localKeyUsage = this.localKeyUsage.map(key => {
|
||||||
|
if (key.field === payload.old)
|
||||||
|
key.field = payload.new;
|
||||||
|
return key;
|
||||||
|
});
|
||||||
|
},
|
||||||
removeField (uid) {
|
removeField (uid) {
|
||||||
this.localFields = this.localFields.filter(field => field._id !== uid);
|
this.localFields = this.localFields.filter(field => field._id !== uid);
|
||||||
},
|
},
|
||||||
@@ -504,6 +541,15 @@ export default {
|
|||||||
},
|
},
|
||||||
foreignsUpdate (foreigns) {
|
foreignsUpdate (foreigns) {
|
||||||
this.localKeyUsage = foreigns;
|
this.localKeyUsage = foreigns;
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
if (this.isSelected) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
||||||
|
if (this.isChanged)
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
:disabled="!isChanged"
|
:disabled="!isChanged"
|
||||||
:class="{'loading':isSaving}"
|
:class="{'loading':isSaving}"
|
||||||
|
title="CTRL+S"
|
||||||
@click="saveChanges"
|
@click="saveChanges"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.save') }}</span>
|
<span>{{ $t('word.save') }}</span>
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
<BaseLoader v-if="isLoading" />
|
<BaseLoader v-if="isLoading" />
|
||||||
<label class="form-label ml-2">{{ $t('message.functionBody') }}</label>
|
<label class="form-label ml-2">{{ $t('message.functionBody') }}</label>
|
||||||
<QueryEditor
|
<QueryEditor
|
||||||
v-if="isSelected"
|
v-show="isSelected"
|
||||||
ref="queryEditor"
|
ref="queryEditor"
|
||||||
:value.sync="localFunction.sql"
|
:value.sync="localFunction.sql"
|
||||||
:workspace="workspace"
|
:workspace="workspace"
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
<ModalAskParameters
|
<ModalAskParameters
|
||||||
v-if="isAskingParameters"
|
v-if="isAskingParameters"
|
||||||
:local-routine="localFunction"
|
:local-routine="localFunction"
|
||||||
|
:client="workspace.client"
|
||||||
@confirm="runFunction"
|
@confirm="runFunction"
|
||||||
@close="hideAskParamsModal"
|
@close="hideAskParamsModal"
|
||||||
/>
|
/>
|
||||||
@@ -119,13 +121,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
getWorkspace: 'workspaces/getWorkspace'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
isSelected () {
|
isSelected () {
|
||||||
return this.workspace.selected_tab === 'prop';
|
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.function;
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
@@ -170,6 +173,12 @@ export default {
|
|||||||
destroyed () {
|
destroyed () {
|
||||||
window.removeEventListener('resize', this.resizeQueryEditor);
|
window.removeEventListener('resize', this.resizeQueryEditor);
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
@@ -280,9 +289,11 @@ export default {
|
|||||||
switch (this.connection.client) { // TODO: move in a better place
|
switch (this.connection.client) { // TODO: move in a better place
|
||||||
case 'maria':
|
case 'maria':
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'pg':
|
|
||||||
sql = `SELECT \`${this.originalFunction.name}\` (${params.join(',')})`;
|
sql = `SELECT \`${this.originalFunction.name}\` (${params.join(',')})`;
|
||||||
break;
|
break;
|
||||||
|
case 'pg':
|
||||||
|
sql = `SELECT ${this.originalFunction.name}(${params.join(',')})`;
|
||||||
|
break;
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
sql = `SELECT ${this.originalFunction.name} ${params.join(',')}`;
|
sql = `SELECT ${this.originalFunction.name} ${params.join(',')}`;
|
||||||
break;
|
break;
|
||||||
@@ -309,6 +320,15 @@ export default {
|
|||||||
},
|
},
|
||||||
hideAskParamsModal () {
|
hideAskParamsModal () {
|
||||||
this.isAskingParameters = false;
|
this.isAskingParameters = false;
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
if (this.isSelected) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
||||||
|
if (this.isChanged)
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
:disabled="!isChanged"
|
:disabled="!isChanged"
|
||||||
:class="{'loading':isSaving}"
|
:class="{'loading':isSaving}"
|
||||||
|
title="CTRL+S"
|
||||||
@click="saveChanges"
|
@click="saveChanges"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.save') }}</span>
|
<span>{{ $t('word.save') }}</span>
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
<ModalAskParameters
|
<ModalAskParameters
|
||||||
v-if="isAskingParameters"
|
v-if="isAskingParameters"
|
||||||
:local-routine="localRoutine"
|
:local-routine="localRoutine"
|
||||||
|
:client="workspace.client"
|
||||||
@confirm="runRoutine"
|
@confirm="runRoutine"
|
||||||
@close="hideAskParamsModal"
|
@close="hideAskParamsModal"
|
||||||
/>
|
/>
|
||||||
@@ -120,13 +122,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
getWorkspace: 'workspaces/getWorkspace'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
isSelected () {
|
isSelected () {
|
||||||
return this.workspace.selected_tab === 'prop';
|
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.routine;
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
@@ -171,6 +174,12 @@ export default {
|
|||||||
destroyed () {
|
destroyed () {
|
||||||
window.removeEventListener('resize', this.resizeQueryEditor);
|
window.removeEventListener('resize', this.resizeQueryEditor);
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
@@ -281,13 +290,13 @@ export default {
|
|||||||
case 'maria':
|
case 'maria':
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
case 'pg':
|
case 'pg':
|
||||||
sql = `CALL \`${this.originalRoutine.name}\` (${params.join(',')})`;
|
sql = `CALL ${this.originalRoutine.name}(${params.join(',')})`;
|
||||||
break;
|
break;
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
sql = `EXEC ${this.originalRoutine.name} ${params.join(',')}`;
|
sql = `EXEC ${this.originalRoutine.name} ${params.join(',')}`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sql = `CALL \`${this.originalRoutine.name}\` (${params.join(',')})`;
|
sql = `CALL \`${this.originalRoutine.name}\`(${params.join(',')})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.newTab({ uid: this.connection.uid, content: sql, autorun: true });
|
this.newTab({ uid: this.connection.uid, content: sql, autorun: true });
|
||||||
@@ -309,6 +318,15 @@ export default {
|
|||||||
},
|
},
|
||||||
hideAskParamsModal () {
|
hideAskParamsModal () {
|
||||||
this.isAskingParameters = false;
|
this.isAskingParameters = false;
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
if (this.isSelected) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
||||||
|
if (this.isChanged)
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
:disabled="!isChanged"
|
:disabled="!isChanged"
|
||||||
:class="{'loading':isSaving}"
|
:class="{'loading':isSaving}"
|
||||||
|
title="CTRL+S"
|
||||||
@click="saveChanges"
|
@click="saveChanges"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.save') }}</span>
|
<span>{{ $t('word.save') }}</span>
|
||||||
@@ -169,13 +170,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
getWorkspace: 'workspaces/getWorkspace'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
isSelected () {
|
isSelected () {
|
||||||
return this.workspace.selected_tab === 'prop';
|
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.scheduler;
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
@@ -220,6 +222,12 @@ export default {
|
|||||||
destroyed () {
|
destroyed () {
|
||||||
window.removeEventListener('resize', this.resizeQueryEditor);
|
window.removeEventListener('resize', this.resizeQueryEditor);
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
@@ -310,6 +318,15 @@ export default {
|
|||||||
},
|
},
|
||||||
timingUpdate (options) {
|
timingUpdate (options) {
|
||||||
this.localScheduler = options;
|
this.localScheduler = options;
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
if (this.isSelected) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
||||||
|
if (this.isChanged)
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
:disabled="!isChanged"
|
:disabled="!isChanged"
|
||||||
:class="{'loading':isSaving}"
|
:class="{'loading':isSaving}"
|
||||||
|
title="CTRL+S"
|
||||||
@click="saveChanges"
|
@click="saveChanges"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.save') }}</span>
|
<span>{{ $t('word.save') }}</span>
|
||||||
@@ -140,13 +141,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
getWorkspace: 'workspaces/getWorkspace'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
isSelected () {
|
isSelected () {
|
||||||
return this.workspace.selected_tab === 'prop';
|
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.trigger;
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
@@ -191,6 +193,12 @@ export default {
|
|||||||
destroyed () {
|
destroyed () {
|
||||||
window.removeEventListener('resize', this.resizeQueryEditor);
|
window.removeEventListener('resize', this.resizeQueryEditor);
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
@@ -274,6 +282,15 @@ export default {
|
|||||||
this.editorHeight = size;
|
this.editorHeight = size;
|
||||||
this.$refs.queryEditor.editor.resize();
|
this.$refs.queryEditor.editor.resize();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
if (this.isSelected) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
||||||
|
if (this.isChanged)
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
:disabled="!isChanged"
|
:disabled="!isChanged"
|
||||||
:class="{'loading':isSaving}"
|
:class="{'loading':isSaving}"
|
||||||
|
title="CTRL+S"
|
||||||
@click="saveChanges"
|
@click="saveChanges"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.save') }}</span>
|
<span>{{ $t('word.save') }}</span>
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-auto">
|
<div class="column col-auto">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.definer" class="form-group">
|
||||||
<label class="form-label">{{ $t('word.definer') }}</label>
|
<label class="form-label">{{ $t('word.definer') }}</label>
|
||||||
<select
|
<select
|
||||||
v-if="workspace.users.length"
|
v-if="workspace.users.length"
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-auto mr-2">
|
<div class="column col-auto mr-2">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.viewSqlSecurity" class="form-group">
|
||||||
<label class="form-label">{{ $t('message.sqlSecurity') }}</label>
|
<label class="form-label">{{ $t('message.sqlSecurity') }}</label>
|
||||||
<label class="form-radio">
|
<label class="form-radio">
|
||||||
<input
|
<input
|
||||||
@@ -91,7 +92,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-auto mr-2">
|
<div class="column col-auto mr-2">
|
||||||
<div class="form-group">
|
<div v-if="workspace.customizations.viewAlgorithm" class="form-group">
|
||||||
<label class="form-label">{{ $t('word.algorithm') }}</label>
|
<label class="form-label">{{ $t('word.algorithm') }}</label>
|
||||||
<label class="form-radio">
|
<label class="form-radio">
|
||||||
<input
|
<input
|
||||||
@@ -122,7 +123,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-auto mr-2">
|
<div v-if="workspace.customizations.viewUpdateOption" class="column col-auto mr-2">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">{{ $t('message.updateOption') }}</label>
|
<label class="form-label">{{ $t('message.updateOption') }}</label>
|
||||||
<label class="form-radio">
|
<label class="form-radio">
|
||||||
@@ -201,13 +202,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
getWorkspace: 'workspaces/getWorkspace'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
isSelected () {
|
isSelected () {
|
||||||
return this.workspace.selected_tab === 'prop';
|
return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.view;
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
@@ -245,6 +247,12 @@ export default {
|
|||||||
destroyed () {
|
destroyed () {
|
||||||
window.removeEventListener('resize', this.resizeQueryEditor);
|
window.removeEventListener('resize', this.resizeQueryEditor);
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
@@ -327,6 +335,15 @@ export default {
|
|||||||
this.editorHeight = size;
|
this.editorHeight = size;
|
||||||
this.$refs.queryEditor.editor.resize();
|
this.$refs.queryEditor.editor.resize();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
if (this.isSelected) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.ctrlKey && e.keyCode === 83) { // CTRL + S
|
||||||
|
if (this.isChanged)
|
||||||
|
this.saveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -42,6 +42,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="customizations.tableArray" class="th">
|
||||||
|
<div class="column-resizable">
|
||||||
|
<div class="table-column-title">
|
||||||
|
{{ $t('word.array') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="th">
|
<div class="th">
|
||||||
<div class="column-resizable">
|
<div class="column-resizable">
|
||||||
<div class="table-column-title">
|
<div class="table-column-title">
|
||||||
@@ -49,21 +56,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="th">
|
<div v-if="customizations.unsigned" class="th">
|
||||||
<div class="column-resizable">
|
<div class="column-resizable">
|
||||||
<div class="table-column-title">
|
<div class="table-column-title">
|
||||||
{{ $t('word.unsigned') }}
|
{{ $t('word.unsigned') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="th">
|
<div v-if="customizations.nullable" class="th">
|
||||||
<div class="column-resizable">
|
<div class="column-resizable">
|
||||||
<div class="table-column-title">
|
<div class="table-column-title">
|
||||||
{{ $t('message.allowNull') }}
|
{{ $t('message.allowNull') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="th">
|
<div v-if="customizations.zerofill" class="th">
|
||||||
<div class="column-resizable">
|
<div class="column-resizable">
|
||||||
<div class="table-column-title">
|
<div class="table-column-title">
|
||||||
{{ $t('message.zeroFill') }}
|
{{ $t('message.zeroFill') }}
|
||||||
@@ -77,14 +84,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="th">
|
<div v-if="customizations.comment" class="th">
|
||||||
<div class="column-resizable">
|
<div class="column-resizable">
|
||||||
<div class="table-column-title">
|
<div class="table-column-title">
|
||||||
{{ $t('word.comment') }}
|
{{ $t('word.comment') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="th">
|
<div v-if="customizations.collation" class="th">
|
||||||
<div class="column-resizable min-100">
|
<div class="column-resizable min-100">
|
||||||
<div class="table-column-title">
|
<div class="table-column-title">
|
||||||
{{ $t('word.collation') }}
|
{{ $t('word.collation') }}
|
||||||
@@ -106,7 +113,9 @@
|
|||||||
:indexes="getIndexes(row.name)"
|
:indexes="getIndexes(row.name)"
|
||||||
:foreigns="getForeigns(row.name)"
|
:foreigns="getForeigns(row.name)"
|
||||||
:data-types="dataTypes"
|
:data-types="dataTypes"
|
||||||
|
:customizations="customizations"
|
||||||
@contextmenu="contextMenu"
|
@contextmenu="contextMenu"
|
||||||
|
@rename-field="$emit('rename-field', $event)"
|
||||||
/>
|
/>
|
||||||
</draggable>
|
</draggable>
|
||||||
</div>
|
</div>
|
||||||
@@ -154,6 +163,9 @@ export default {
|
|||||||
workspaceSchema () {
|
workspaceSchema () {
|
||||||
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
||||||
},
|
},
|
||||||
|
customizations () {
|
||||||
|
return this.getWorkspace(this.connUid).customizations;
|
||||||
|
},
|
||||||
dataTypes () {
|
dataTypes () {
|
||||||
return this.getWorkspace(this.connUid).dataTypes;
|
return this.getWorkspace(this.connUid).dataTypes;
|
||||||
},
|
},
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tr" @contextmenu.prevent="$emit('contextmenu', $event, localRow._id)">
|
<div class="tr" @contextmenu.prevent="$emit('contextmenu', $event, localRow._id)">
|
||||||
<div class="td" tabindex="0">
|
<div class="td" tabindex="0">
|
||||||
<div class="row-draggable">
|
<div :class="customizations.sortableFields ? 'row-draggable' : 'text-center'">
|
||||||
<i class="mdi mdi-drag-horizontal row-draggable-icon" />
|
<i v-if="customizations.sortableFields" class="mdi mdi-drag-horizontal row-draggable-icon" />
|
||||||
{{ localRow.order }}
|
{{ localRow.order }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<span
|
<span
|
||||||
v-if="!isInlineEditor.type"
|
v-if="!isInlineEditor.type"
|
||||||
class="cell-content text-left"
|
class="cell-content text-left"
|
||||||
:class="`type-${lowerCase(localRow.type)}`"
|
:class="typeClass(localRow.type)"
|
||||||
@click="editON($event, localRow.type.toUpperCase(), 'type')"
|
@click="editON($event, localRow.type.toUpperCase(), 'type')"
|
||||||
>
|
>
|
||||||
{{ localRow.type }}
|
{{ localRow.type }}
|
||||||
@@ -60,6 +60,9 @@
|
|||||||
class="form-select editable-field small-select text-uppercase"
|
class="form-select editable-field small-select text-uppercase"
|
||||||
@blur="editOFF"
|
@blur="editOFF"
|
||||||
>
|
>
|
||||||
|
<option v-if="!isInDataTypes">
|
||||||
|
{{ row.type }}
|
||||||
|
</option>
|
||||||
<optgroup
|
<optgroup
|
||||||
v-for="group in dataTypes"
|
v-for="group in dataTypes"
|
||||||
:key="group.group"
|
:key="group.group"
|
||||||
@@ -68,7 +71,7 @@
|
|||||||
<option
|
<option
|
||||||
v-for="type in group.types"
|
v-for="type in group.types"
|
||||||
:key="type.name"
|
:key="type.name"
|
||||||
:selected="localRow.type.toUpperCase() === type.name"
|
:selected="localRow.type === type.name"
|
||||||
:value="type.name"
|
:value="type.name"
|
||||||
>
|
>
|
||||||
{{ type.name }}
|
{{ type.name }}
|
||||||
@@ -76,6 +79,16 @@
|
|||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="customizations.tableArray"
|
||||||
|
class="td"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<label class="form-checkbox">
|
||||||
|
<input v-model="localRow.isArray" type="checkbox">
|
||||||
|
<i class="form-icon" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="td type-int" tabindex="0">
|
<div class="td type-int" tabindex="0">
|
||||||
<template v-if="fieldType.length">
|
<template v-if="fieldType.length">
|
||||||
<span
|
<span
|
||||||
@@ -83,8 +96,22 @@
|
|||||||
class="cell-content"
|
class="cell-content"
|
||||||
@dblclick="editON($event, localLength, 'length')"
|
@dblclick="editON($event, localLength, 'length')"
|
||||||
>
|
>
|
||||||
{{ localLength }}
|
<span v-if="localRow.enumValues">
|
||||||
|
{{ localRow.enumValues }}
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{ localLength }}
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<input
|
||||||
|
v-else-if="localRow.enumValues"
|
||||||
|
ref="editField"
|
||||||
|
v-model="editingContent"
|
||||||
|
type="text"
|
||||||
|
autofocus
|
||||||
|
class="editable-field px-2"
|
||||||
|
@blur="editOFF"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
v-else
|
v-else
|
||||||
ref="editField"
|
ref="editField"
|
||||||
@@ -96,7 +123,11 @@
|
|||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="td" tabindex="0">
|
<div
|
||||||
|
v-if="customizations.unsigned"
|
||||||
|
class="td"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
<label class="form-checkbox">
|
<label class="form-checkbox">
|
||||||
<input
|
<input
|
||||||
v-model="localRow.unsigned"
|
v-model="localRow.unsigned"
|
||||||
@@ -106,7 +137,11 @@
|
|||||||
<i class="form-icon" />
|
<i class="form-icon" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="td" tabindex="0">
|
<div
|
||||||
|
v-if="customizations.nullable"
|
||||||
|
class="td"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
<label class="form-checkbox">
|
<label class="form-checkbox">
|
||||||
<input
|
<input
|
||||||
v-model="localRow.nullable"
|
v-model="localRow.nullable"
|
||||||
@@ -116,7 +151,11 @@
|
|||||||
<i class="form-icon" />
|
<i class="form-icon" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="td" tabindex="0">
|
<div
|
||||||
|
v-if="customizations.zerofill"
|
||||||
|
class="td"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
<label class="form-checkbox">
|
<label class="form-checkbox">
|
||||||
<input
|
<input
|
||||||
v-model="localRow.zerofill"
|
v-model="localRow.zerofill"
|
||||||
@@ -131,7 +170,11 @@
|
|||||||
{{ fieldDefault }}
|
{{ fieldDefault }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="td type-varchar" tabindex="0">
|
<div
|
||||||
|
v-if="customizations.comment"
|
||||||
|
class="td type-varchar"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
v-if="!isInlineEditor.comment"
|
v-if="!isInlineEditor.comment"
|
||||||
class="cell-content"
|
class="cell-content"
|
||||||
@@ -149,7 +192,11 @@
|
|||||||
@blur="editOFF"
|
@blur="editOFF"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="td" tabindex="0">
|
<div
|
||||||
|
v-if="customizations.collation"
|
||||||
|
class="td"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
<template v-if="fieldType.collation">
|
<template v-if="fieldType.collation">
|
||||||
<span
|
<span
|
||||||
v-if="!isInlineEditor.collation"
|
v-if="!isInlineEditor.collation"
|
||||||
@@ -220,7 +267,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div v-if="customizations.nullable" class="mb-2">
|
||||||
<label class="form-radio form-inline">
|
<label class="form-radio form-inline">
|
||||||
<input
|
<input
|
||||||
v-model="defaultValue.type"
|
v-model="defaultValue.type"
|
||||||
@@ -230,7 +277,7 @@
|
|||||||
><i class="form-icon" /> NULL
|
><i class="form-icon" /> NULL
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2">
|
<div v-if="customizations.autoIncrement" class="mb-2">
|
||||||
<label class="form-radio form-inline">
|
<label class="form-radio form-inline">
|
||||||
<input
|
<input
|
||||||
v-model="defaultValue.type"
|
v-model="defaultValue.type"
|
||||||
@@ -261,7 +308,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div v-if="customizations.onUpdate">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label col-4">
|
<label class="form-label col-4">
|
||||||
{{ $t('message.onUpdate') }}
|
{{ $t('message.onUpdate') }}
|
||||||
@@ -294,7 +341,8 @@ export default {
|
|||||||
row: Object,
|
row: Object,
|
||||||
dataTypes: Array,
|
dataTypes: Array,
|
||||||
indexes: Array,
|
indexes: Array,
|
||||||
foreigns: Array
|
foreigns: Array,
|
||||||
|
customizations: Object
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -343,6 +391,18 @@ export default {
|
|||||||
},
|
},
|
||||||
isNullable () {
|
isNullable () {
|
||||||
return !this.indexes.some(index => ['PRIMARY'].includes(index.type));
|
return !this.indexes.some(index => ['PRIMARY'].includes(index.type));
|
||||||
|
},
|
||||||
|
isInDataTypes () {
|
||||||
|
let typeNames = [];
|
||||||
|
for (const group of this.dataTypes) {
|
||||||
|
const groupTypeNames = group.types.reduce((acc, curr) => {
|
||||||
|
acc.push(curr.name);
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
typeNames = [...groupTypeNames, ...typeNames];
|
||||||
|
}
|
||||||
|
return typeNames.includes(this.row.type);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -378,10 +438,10 @@ export default {
|
|||||||
return 'UNKNOWN ' + key;
|
return 'UNKNOWN ' + key;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lowerCase (val) {
|
typeClass (type) {
|
||||||
if (val)
|
if (type)
|
||||||
return val.toLowerCase();
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
return val;
|
return '';
|
||||||
},
|
},
|
||||||
initLocalRow () {
|
initLocalRow () {
|
||||||
Object.keys(this.localRow).forEach(key => {
|
Object.keys(this.localRow).forEach(key => {
|
||||||
@@ -389,40 +449,35 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.defaultValue.onUpdate = this.localRow.onUpdate;
|
this.defaultValue.onUpdate = this.localRow.onUpdate;
|
||||||
|
this.defaultValue.type = this.localRow.defaultType;
|
||||||
if (this.localRow.autoIncrement)
|
if (this.defaultValue.type === 'custom') {
|
||||||
this.defaultValue.type = 'autoincrement';
|
this.defaultValue.custom = this.localRow.default
|
||||||
else if (this.localRow.default === null)
|
? this.localRow.default.includes('\'')
|
||||||
this.defaultValue.type = 'noval';
|
? this.localRow.default.split('\'')[1]
|
||||||
else if (this.localRow.default === 'NULL')
|
: this.localRow.default
|
||||||
this.defaultValue.type = 'null';
|
: '';
|
||||||
else if (this.localRow.default.match(/^'.*'$/g)) {
|
|
||||||
this.defaultValue.type = 'custom';
|
|
||||||
this.defaultValue.custom = this.localRow.default.replace(/(^')|('$)/g, '');
|
|
||||||
}
|
}
|
||||||
else if (!isNaN(this.localRow.default.replace(/[:.-\s]/g, ''))) {
|
if (this.defaultValue.type === 'expression')
|
||||||
this.defaultValue.type = 'custom';
|
|
||||||
this.defaultValue.custom = this.localRow.default;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.defaultValue.type = 'expression';
|
|
||||||
this.defaultValue.expression = this.localRow.default;
|
this.defaultValue.expression = this.localRow.default;
|
||||||
}
|
|
||||||
},
|
|
||||||
updateRow () {
|
|
||||||
this.$emit('input', this.localRow);
|
|
||||||
},
|
},
|
||||||
editON (event, content, field) {
|
editON (event, content, field) {
|
||||||
if (field === 'length') {
|
if (field === 'length') {
|
||||||
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.editingField = 'numLength';
|
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.editingField = 'numLength';
|
||||||
if (['string', 'other'].includes(this.fieldType.group)) this.editingField = 'charLength';
|
else if (['string', 'unknown'].includes(this.fieldType.group)) this.editingField = 'charLength';
|
||||||
if (['time'].includes(this.fieldType.group)) this.editingField = 'datePrecision';
|
else if (['other'].includes(this.fieldType.group)) this.editingField = 'enumValues';
|
||||||
|
else if (['time'].includes(this.fieldType.group)) this.editingField = 'datePrecision';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.editingField = field;
|
this.editingField = field;
|
||||||
|
|
||||||
this.editingContent = content;
|
if (this.localRow.enumValues && field === 'length') {
|
||||||
this.originalContent = content;
|
this.editingContent = this.localRow.enumValues;
|
||||||
|
this.originalContent = this.localRow.enumValues;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.editingContent = content;
|
||||||
|
this.originalContent = content;
|
||||||
|
}
|
||||||
|
|
||||||
const obj = { [field]: true };
|
const obj = { [field]: true };
|
||||||
this.isInlineEditor = { ...this.isInlineEditor, ...obj };
|
this.isInlineEditor = { ...this.isInlineEditor, ...obj };
|
||||||
@@ -438,17 +493,22 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
editOFF () {
|
editOFF () {
|
||||||
|
if (this.editingField === 'name')
|
||||||
|
this.$emit('rename-field', { old: this.localRow[this.editingField], new: this.editingContent });
|
||||||
|
|
||||||
this.localRow[this.editingField] = this.editingContent;
|
this.localRow[this.editingField] = this.editingContent;
|
||||||
|
|
||||||
if (this.editingField === 'type' && this.editingContent !== this.originalContent) {
|
if (this.editingField === 'type' && this.editingContent !== this.originalContent) {
|
||||||
this.localRow.numLength = null;
|
this.localRow.numLength = null;
|
||||||
this.localRow.charLength = null;
|
this.localRow.charLength = null;
|
||||||
this.localRow.datePrecision = null;
|
this.localRow.datePrecision = null;
|
||||||
|
this.localRow.enumValues = '';
|
||||||
|
|
||||||
if (this.fieldType.length) {
|
if (this.fieldType.length) {
|
||||||
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.localRow.numLength = 11;
|
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.localRow.numLength = 11;
|
||||||
if (['string', 'other'].includes(this.fieldType.group)) this.localRow.charLength = 15;
|
if (['string'].includes(this.fieldType.group)) this.localRow.charLength = 15;
|
||||||
if (['time'].includes(this.fieldType.group)) this.localRow.datePrecision = 0;
|
if (['time'].includes(this.fieldType.group)) this.localRow.datePrecision = 0;
|
||||||
|
if (['other'].includes(this.fieldType.group)) this.localRow.enumValues = '\'valA\',\'valB\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.fieldType.collation)
|
if (!this.fieldType.collation)
|
||||||
@@ -460,8 +520,7 @@ export default {
|
|||||||
if (!this.fieldType.zerofill)
|
if (!this.fieldType.zerofill)
|
||||||
this.localRow.zerofill = false;
|
this.localRow.zerofill = false;
|
||||||
}
|
}
|
||||||
|
else if (this.editingField === 'default') {
|
||||||
if (this.editingField === 'default') {
|
|
||||||
switch (this.defaultValue.type) {
|
switch (this.defaultValue.type) {
|
||||||
case 'autoincrement':
|
case 'autoincrement':
|
||||||
this.localRow.autoIncrement = true;
|
this.localRow.autoIncrement = true;
|
||||||
@@ -476,7 +535,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
case 'custom':
|
case 'custom':
|
||||||
this.localRow.autoIncrement = false;
|
this.localRow.autoIncrement = false;
|
||||||
this.localRow.default = `'${this.defaultValue.custom}'`;
|
this.localRow.default = Number.isNaN(+this.defaultValue.custom) ? `'${this.defaultValue.custom}'` : this.defaultValue.custom;
|
||||||
break;
|
break;
|
||||||
case 'expression':
|
case 'expression':
|
||||||
this.localRow.autoIncrement = false;
|
this.localRow.autoIncrement = false;
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-show="isSelected" class="workspace-query-tab column col-12 columns col-gapless">
|
<div
|
||||||
|
v-show="isSelected"
|
||||||
|
class="workspace-query-tab column col-12 columns col-gapless no-outline"
|
||||||
|
tabindex="0"
|
||||||
|
@keydown.116="runQuery(query)"
|
||||||
|
@keydown.ctrl.87="clear"
|
||||||
|
@keydown.ctrl.119="beautify"
|
||||||
|
>
|
||||||
<div class="workspace-query-runner column col-12">
|
<div class="workspace-query-runner column col-12">
|
||||||
<QueryEditor
|
<QueryEditor
|
||||||
v-show="isSelected"
|
v-show="isSelected"
|
||||||
@@ -24,6 +31,43 @@
|
|||||||
<span>{{ $t('word.run') }}</span>
|
<span>{{ $t('word.run') }}</span>
|
||||||
<i class="mdi mdi-24px mdi-play" />
|
<i class="mdi mdi-24px mdi-play" />
|
||||||
</button>
|
</button>
|
||||||
|
<div class="dropdown export-dropdown pr-2">
|
||||||
|
<button
|
||||||
|
:disabled="!results.length || isQuering"
|
||||||
|
class="btn btn-dark btn-sm dropdown-toggle mr-0 pr-0"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<span>{{ $t('word.export') }}</span>
|
||||||
|
<i class="mdi mdi-24px mdi-file-export ml-1" />
|
||||||
|
<i class="mdi mdi-24px mdi-menu-down" />
|
||||||
|
</button>
|
||||||
|
<ul class="menu text-left">
|
||||||
|
<li class="menu-item">
|
||||||
|
<a class="c-hand" @click="downloadTable('json')">JSON</a>
|
||||||
|
</li>
|
||||||
|
<li class="menu-item">
|
||||||
|
<a class="c-hand" @click="downloadTable('csv')">CSV</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="btn btn-dark btn-sm"
|
||||||
|
:disabled="!query || isQuering"
|
||||||
|
title="CTRL+F8"
|
||||||
|
@click="beautify()"
|
||||||
|
>
|
||||||
|
<span>{{ $t('word.format') }}</span>
|
||||||
|
<i class="mdi mdi-24px mdi-brush pl-1" />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-link btn-sm"
|
||||||
|
:disabled="!query || isQuering"
|
||||||
|
title="CTRL+W"
|
||||||
|
@click="clear()"
|
||||||
|
>
|
||||||
|
<span>{{ $t('word.clear') }}</span>
|
||||||
|
<i class="mdi mdi-24px mdi-delete-sweep pl-1" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="workspace-query-info">
|
<div class="workspace-query-info">
|
||||||
<div
|
<div
|
||||||
@@ -68,7 +112,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Database from '@/ipc-api/Database';
|
import { format } from 'sql-formatter';
|
||||||
|
import Schema from '@/ipc-api/Schema';
|
||||||
import QueryEditor from '@/components/QueryEditor';
|
import QueryEditor from '@/components/QueryEditor';
|
||||||
import BaseLoader from '@/components/BaseLoader';
|
import BaseLoader from '@/components/BaseLoader';
|
||||||
import WorkspaceQueryTable from '@/components/WorkspaceQueryTable';
|
import WorkspaceQueryTable from '@/components/WorkspaceQueryTable';
|
||||||
@@ -150,7 +195,7 @@ export default {
|
|||||||
query
|
query
|
||||||
};
|
};
|
||||||
|
|
||||||
const { status, response } = await Database.rawQuery(params);
|
const { status, response } = await Schema.rawQuery(params);
|
||||||
|
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
this.results = Array.isArray(response) ? response : [response];
|
this.results = Array.isArray(response) ? response : [response];
|
||||||
@@ -192,12 +237,36 @@ export default {
|
|||||||
if (this.$refs.queryEditor)
|
if (this.$refs.queryEditor)
|
||||||
this.$refs.queryEditor.editor.resize();
|
this.$refs.queryEditor.editor.resize();
|
||||||
},
|
},
|
||||||
onKey (e) {
|
beautify () {
|
||||||
if (this.isSelected && this.isWorkspaceSelected) {
|
if (this.$refs.queryEditor) {
|
||||||
e.stopPropagation();
|
let language = 'sql';
|
||||||
if (e.key === 'F5')
|
|
||||||
this.runQuery(this.query);
|
switch (this.workspace.client) {
|
||||||
|
case 'mysql':
|
||||||
|
language = 'mysql';
|
||||||
|
break;
|
||||||
|
case 'maria':
|
||||||
|
language = 'mariadb';
|
||||||
|
break;
|
||||||
|
case 'pg':
|
||||||
|
language = 'postgresql';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formattedQuery = format(this.query, {
|
||||||
|
language,
|
||||||
|
uppercase: true
|
||||||
|
});
|
||||||
|
this.$refs.queryEditor.editor.session.setValue(formattedQuery);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
clear () {
|
||||||
|
if (this.$refs.queryEditor)
|
||||||
|
this.$refs.queryEditor.editor.session.setValue('');
|
||||||
|
this.clearTabData();
|
||||||
|
},
|
||||||
|
downloadTable (format) {
|
||||||
|
this.$refs.queryTable.downloadTable(format, `${this.tab.type}-${this.tab.index}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -232,7 +301,6 @@ export default {
|
|||||||
.btn {
|
.btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
color: $body-font-color;
|
|
||||||
margin-right: 0.4rem;
|
margin-right: 0.4rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,4 +320,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.export-dropdown {
|
||||||
|
.menu {
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
ref="tableWrapper"
|
ref="tableWrapper"
|
||||||
class="vscroll"
|
class="vscroll no-outline"
|
||||||
|
tabindex="0"
|
||||||
:style="{'height': resultsSize+'px'}"
|
:style="{'height': resultsSize+'px'}"
|
||||||
|
@keyup.46="showDeleteConfirmModal"
|
||||||
>
|
>
|
||||||
<TableContext
|
<TableContext
|
||||||
v-if="isContext"
|
v-if="isContext"
|
||||||
:context-event="contextEvent"
|
:context-event="contextEvent"
|
||||||
:selected-rows="selectedRows"
|
:selected-rows="selectedRows"
|
||||||
@delete-selected="deleteSelected"
|
@show-delete-modal="showDeleteConfirmModal"
|
||||||
@set-null="setNull"
|
@set-null="setNull"
|
||||||
@close-context="isContext = false"
|
@close-context="closeContext"
|
||||||
/>
|
/>
|
||||||
<ul v-if="resultsWithRows.length > 1" class="tab tab-block result-tabs">
|
<ul v-if="resultsWithRows.length > 1" class="tab tab-block result-tabs">
|
||||||
<li
|
<li
|
||||||
@@ -75,6 +77,23 @@
|
|||||||
</template>
|
</template>
|
||||||
</BaseVirtualScroll>
|
</BaseVirtualScroll>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
v-if="isDeleteConfirmModal"
|
||||||
|
@confirm="deleteSelected"
|
||||||
|
@hide="hideDeleteConfirmModal"
|
||||||
|
>
|
||||||
|
<template :slot="'header'">
|
||||||
|
<div class="d-flex">
|
||||||
|
<i class="mdi mdi-24px mdi-delete mr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div :slot="'body'">
|
||||||
|
<div class="mb-2">
|
||||||
|
{{ $tc('message.confirmToDeleteRows', selectedRows.length) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ConfirmModal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -85,14 +104,17 @@ import { TEXT, LONG_TEXT, BLOB } from 'common/fieldTypes';
|
|||||||
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
|
||||||
import WorkspaceQueryTableRow from '@/components/WorkspaceQueryTableRow';
|
import WorkspaceQueryTableRow from '@/components/WorkspaceQueryTableRow';
|
||||||
import TableContext from '@/components/WorkspaceQueryTableContext';
|
import TableContext from '@/components/WorkspaceQueryTableContext';
|
||||||
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import { mapActions, mapGetters } from 'vuex';
|
import { mapActions, mapGetters } from 'vuex';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceQueryTable',
|
name: 'WorkspaceQueryTable',
|
||||||
components: {
|
components: {
|
||||||
BaseVirtualScroll,
|
BaseVirtualScroll,
|
||||||
WorkspaceQueryTableRow,
|
WorkspaceQueryTableRow,
|
||||||
TableContext
|
TableContext,
|
||||||
|
ConfirmModal
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
results: Array,
|
results: Array,
|
||||||
@@ -105,6 +127,7 @@ export default {
|
|||||||
resultsSize: 1000,
|
resultsSize: 1000,
|
||||||
localResults: [],
|
localResults: [],
|
||||||
isContext: false,
|
isContext: false,
|
||||||
|
isDeleteConfirmModal: false,
|
||||||
contextEvent: null,
|
contextEvent: null,
|
||||||
selectedCell: null,
|
selectedCell: null,
|
||||||
selectedRows: [],
|
selectedRows: [],
|
||||||
@@ -116,19 +139,26 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
getWorkspace: 'workspaces/getWorkspace'
|
getWorkspace: 'workspaces/getWorkspace',
|
||||||
|
pageSize: 'settings/getDataTabLimit'
|
||||||
}),
|
}),
|
||||||
workspaceSchema () {
|
workspaceSchema () {
|
||||||
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
return this.getWorkspace(this.connUid).breadcrumbs.schema;
|
||||||
},
|
},
|
||||||
primaryField () {
|
primaryField () {
|
||||||
return this.fields.filter(field => ['pri', 'uni'].includes(field.key))[0] || false;
|
const primaryFields = this.fields.filter(field => field.key === 'pri');
|
||||||
|
const uniqueFields = this.fields.filter(field => field.key === 'uni');
|
||||||
|
|
||||||
|
if ((primaryFields.length > 1 || !primaryFields.length) && (uniqueFields.length > 1 || !uniqueFields.length))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return primaryFields[0] || uniqueFields[0];
|
||||||
},
|
},
|
||||||
isSortable () {
|
isSortable () {
|
||||||
return this.fields.every(field => field.name);
|
return this.fields.every(field => field.name);
|
||||||
},
|
},
|
||||||
isHardSort () {
|
isHardSort () {
|
||||||
return this.mode === 'table' && this.localResults.length === 1000;
|
return this.mode === 'table' && this.localResults.length === this.pageSize;
|
||||||
},
|
},
|
||||||
sortedResults () {
|
sortedResults () {
|
||||||
if (this.currentSort && !this.isHardSort) {
|
if (this.currentSort && !this.isHardSort) {
|
||||||
@@ -289,20 +319,43 @@ export default {
|
|||||||
this.resizeResults();
|
this.resizeResults();
|
||||||
},
|
},
|
||||||
updateField (payload, row) {
|
updateField (payload, row) {
|
||||||
const localRow = Object.assign({}, row);
|
const orgRow = this.localResults.find(lr => lr._id === row._id);
|
||||||
delete localRow._id;
|
|
||||||
|
Object.keys(orgRow).forEach(key => { // remap the row
|
||||||
|
if (orgRow[key] instanceof Date && moment(orgRow[key]).isValid()) { // if datetime
|
||||||
|
let datePrecision = '';
|
||||||
|
const precision = this.fields.find(field => field.name === key).datePrecision;
|
||||||
|
for (let i = 0; i < precision; i++)
|
||||||
|
datePrecision += i === 0 ? '.S' : 'S';
|
||||||
|
|
||||||
|
orgRow[key] = moment(orgRow[key]).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
primary: this.primaryField.name,
|
primary: this.primaryField.name,
|
||||||
schema: this.getSchema(this.resultsetIndex),
|
schema: this.getSchema(this.resultsetIndex),
|
||||||
table: this.getTable(this.resultsetIndex),
|
table: this.getTable(this.resultsetIndex),
|
||||||
id: this.getPrimaryValue(localRow),
|
id: this.getPrimaryValue(orgRow),
|
||||||
localRow,
|
row,
|
||||||
|
orgRow,
|
||||||
...payload
|
...payload
|
||||||
};
|
};
|
||||||
this.$emit('update-field', params);
|
this.$emit('update-field', params);
|
||||||
},
|
},
|
||||||
|
closeContext () {
|
||||||
|
this.isContext = false;
|
||||||
|
},
|
||||||
|
showDeleteConfirmModal (e) {
|
||||||
|
if (e && e.path && ['INPUT', 'TEXTAREA', 'SELECT'].includes(e.path[0].tagName))
|
||||||
|
return;
|
||||||
|
this.isDeleteConfirmModal = true;
|
||||||
|
},
|
||||||
|
hideDeleteConfirmModal () {
|
||||||
|
this.isDeleteConfirmModal = false;
|
||||||
|
},
|
||||||
deleteSelected () {
|
deleteSelected () {
|
||||||
|
this.closeContext();
|
||||||
const rows = this.localResults.filter(row => this.selectedRows.includes(row._id)).map(row => {
|
const rows = this.localResults.filter(row => this.selectedRows.includes(row._id)).map(row => {
|
||||||
delete row._id;
|
delete row._id;
|
||||||
return row;
|
return row;
|
||||||
@@ -318,7 +371,6 @@ export default {
|
|||||||
},
|
},
|
||||||
setNull () {
|
setNull () {
|
||||||
const row = this.localResults.find(row => this.selectedRows.includes(row._id));
|
const row = this.localResults.find(row => this.selectedRows.includes(row._id));
|
||||||
delete row._id;
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
primary: this.primaryField.name,
|
primary: this.primaryField.name,
|
||||||
@@ -326,6 +378,7 @@ export default {
|
|||||||
table: this.getTable(this.resultsetIndex),
|
table: this.getTable(this.resultsetIndex),
|
||||||
id: this.getPrimaryValue(row),
|
id: this.getPrimaryValue(row),
|
||||||
row,
|
row,
|
||||||
|
orgRow: row,
|
||||||
field: this.selectedCell.field,
|
field: this.selectedCell.field,
|
||||||
content: null
|
content: null
|
||||||
};
|
};
|
||||||
@@ -355,15 +408,15 @@ export default {
|
|||||||
this.selectedRows.push(row);
|
this.selectedRows.push(row);
|
||||||
else {
|
else {
|
||||||
const lastID = this.selectedRows.slice(-1)[0];
|
const lastID = this.selectedRows.slice(-1)[0];
|
||||||
const lastIndex = this.localResults.findIndex(el => el._id === lastID);
|
const lastIndex = this.sortedResults.findIndex(el => el._id === lastID);
|
||||||
const clickedIndex = this.localResults.findIndex(el => el._id === row);
|
const clickedIndex = this.sortedResults.findIndex(el => el._id === row);
|
||||||
if (lastIndex > clickedIndex) {
|
if (lastIndex > clickedIndex) {
|
||||||
for (let i = clickedIndex; i < lastIndex; i++)
|
for (let i = clickedIndex; i < lastIndex; i++)
|
||||||
this.selectedRows.push(this.localResults[i]._id);
|
this.selectedRows.push(this.sortedResults[i]._id);
|
||||||
}
|
}
|
||||||
else if (lastIndex < clickedIndex) {
|
else if (lastIndex < clickedIndex) {
|
||||||
for (let i = clickedIndex; i > lastIndex; i--)
|
for (let i = clickedIndex; i > lastIndex; i--)
|
||||||
this.selectedRows.push(this.localResults[i]._id);
|
this.selectedRows.push(this.sortedResults[i]._id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,6 +435,8 @@ export default {
|
|||||||
sort (field) {
|
sort (field) {
|
||||||
if (!this.isSortable) return;
|
if (!this.isSortable) return;
|
||||||
|
|
||||||
|
this.selectedRows = [];
|
||||||
|
|
||||||
if (this.mode === 'query')
|
if (this.mode === 'query')
|
||||||
field = `${this.getTable(this.resultsetIndex)}.${field}`;
|
field = `${this.getTable(this.resultsetIndex)}.${field}`;
|
||||||
|
|
||||||
|
@@ -17,61 +17,30 @@
|
|||||||
<i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
<i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ConfirmModal
|
|
||||||
v-if="isConfirmModal"
|
|
||||||
@confirm="deleteRows"
|
|
||||||
@hide="hideConfirmModal"
|
|
||||||
>
|
|
||||||
<template :slot="'header'">
|
|
||||||
<div class="d-flex">
|
|
||||||
<i class="mdi mdi-24px mdi-delete mr-1" /> {{ $tc('message.deleteRows', selectedRows.length) }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div :slot="'body'">
|
|
||||||
<div class="mb-2">
|
|
||||||
{{ $tc('message.confirmToDeleteRows', selectedRows.length) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ConfirmModal>
|
|
||||||
</BaseContextMenu>
|
</BaseContextMenu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseContextMenu from '@/components/BaseContextMenu';
|
import BaseContextMenu from '@/components/BaseContextMenu';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WorkspaceQueryTableContext',
|
name: 'WorkspaceQueryTableContext',
|
||||||
components: {
|
components: {
|
||||||
BaseContextMenu,
|
BaseContextMenu
|
||||||
ConfirmModal
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
contextEvent: MouseEvent,
|
contextEvent: MouseEvent,
|
||||||
selectedRows: Array
|
selectedRows: Array
|
||||||
},
|
},
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
isConfirmModal: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showConfirmModal () {
|
showConfirmModal () {
|
||||||
this.isConfirmModal = true;
|
this.$emit('show-delete-modal');
|
||||||
},
|
|
||||||
hideConfirmModal () {
|
|
||||||
this.isConfirmModal = false;
|
|
||||||
},
|
},
|
||||||
closeContext () {
|
closeContext () {
|
||||||
this.$emit('close-context');
|
this.$emit('close-context');
|
||||||
},
|
},
|
||||||
deleteRows () {
|
|
||||||
this.$emit('delete-selected');
|
|
||||||
this.closeContext();
|
|
||||||
},
|
|
||||||
setNull () {
|
setNull () {
|
||||||
this.$emit('set-null');
|
this.$emit('set-null');
|
||||||
this.closeContext();
|
this.closeContext();
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
<span
|
<span
|
||||||
v-if="!isInlineEditor[cKey]"
|
v-if="!isInlineEditor[cKey]"
|
||||||
class="cell-content px-2"
|
class="cell-content px-2"
|
||||||
:class="`${isNull(col)} type-${fields[cKey].type.toLowerCase()}`"
|
:class="`${isNull(col)} ${typeClass(fields[cKey].type)}`"
|
||||||
@dblclick="editON($event, col, cKey)"
|
@dblclick="editON($event, col, cKey)"
|
||||||
>{{ col | typeFormat(fields[cKey].type.toLowerCase(), fields[cKey].length) | cutText }}</span>
|
>{{ col | typeFormat(fields[cKey].type.toLowerCase(), fields[cKey].length) | cutText }}</span>
|
||||||
<ForeignKeySelect
|
<ForeignKeySelect
|
||||||
@@ -34,6 +34,25 @@
|
|||||||
class="editable-field px-2"
|
class="editable-field px-2"
|
||||||
@blur="editOFF"
|
@blur="editOFF"
|
||||||
>
|
>
|
||||||
|
<select
|
||||||
|
v-else-if="inputProps.type === 'boolean'"
|
||||||
|
v-model="editingContent"
|
||||||
|
class="form-select small-select editable-field"
|
||||||
|
@blur="editOFF"
|
||||||
|
>
|
||||||
|
<option>true</option>
|
||||||
|
<option>false</option>
|
||||||
|
</select>
|
||||||
|
<select
|
||||||
|
v-else-if="enumArray"
|
||||||
|
v-model="editingContent"
|
||||||
|
class="form-select small-select editable-field"
|
||||||
|
@blur="editOFF"
|
||||||
|
>
|
||||||
|
<option v-for="value in enumArray" :key="value">
|
||||||
|
{{ value }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
<input
|
<input
|
||||||
v-else
|
v-else
|
||||||
ref="editField"
|
ref="editField"
|
||||||
@@ -173,7 +192,7 @@ import { mimeFromHex } from 'common/libs/mimeFromHex';
|
|||||||
import { formatBytes } from 'common/libs/formatBytes';
|
import { formatBytes } from 'common/libs/formatBytes';
|
||||||
import { bufferToBase64 } from 'common/libs/bufferToBase64';
|
import { bufferToBase64 } from 'common/libs/bufferToBase64';
|
||||||
import hexToBinary from 'common/libs/hexToBinary';
|
import hexToBinary from 'common/libs/hexToBinary';
|
||||||
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BOOLEAN, DATE, TIME, DATETIME, BLOB, BIT, HAS_TIMEZONE } from 'common/fieldTypes';
|
||||||
import { VueMaskDirective } from 'v-mask';
|
import { VueMaskDirective } from 'v-mask';
|
||||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||||
import TextEditor from '@/components/BaseTextEditor';
|
import TextEditor from '@/components/BaseTextEditor';
|
||||||
@@ -204,6 +223,9 @@ export default {
|
|||||||
return moment(val).isValid() ? moment(val).format('YYYY-MM-DD') : val;
|
return moment(val).isValid() ? moment(val).format('YYYY-MM-DD') : val;
|
||||||
|
|
||||||
if (DATETIME.includes(type)) {
|
if (DATETIME.includes(type)) {
|
||||||
|
if (typeof val === 'string')
|
||||||
|
return val;
|
||||||
|
|
||||||
let datePrecision = '';
|
let datePrecision = '';
|
||||||
for (let i = 0; i < precision; i++)
|
for (let i = 0; i < precision; i++)
|
||||||
datePrecision += i === 0 ? '.S' : 'S';
|
datePrecision += i === 0 ? '.S' : 'S';
|
||||||
@@ -225,6 +247,12 @@ export default {
|
|||||||
return hexToBinary(hex);
|
return hexToBinary(hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ARRAY.includes(type)) {
|
||||||
|
if (Array.isArray(val))
|
||||||
|
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -268,6 +296,9 @@ export default {
|
|||||||
for (let i = 0; i < precision; i++)
|
for (let i = 0; i < precision; i++)
|
||||||
timeMask += i === 0 ? '.#' : '#';
|
timeMask += i === 0 ? '.#' : '#';
|
||||||
|
|
||||||
|
if (HAS_TIMEZONE.includes(this.editingType))
|
||||||
|
timeMask += 'X##';
|
||||||
|
|
||||||
return { type: 'text', mask: timeMask };
|
return { type: 'text', mask: timeMask };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,14 +312,17 @@ export default {
|
|||||||
for (let i = 0; i < precision; i++)
|
for (let i = 0; i < precision; i++)
|
||||||
datetimeMask += i === 0 ? '.#' : '#';
|
datetimeMask += i === 0 ? '.#' : '#';
|
||||||
|
|
||||||
|
if (HAS_TIMEZONE.includes(this.editingType))
|
||||||
|
datetimeMask += 'X##';
|
||||||
|
|
||||||
return { type: 'text', mask: datetimeMask };
|
return { type: 'text', mask: datetimeMask };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BLOB.includes(this.editingType))
|
if (BLOB.includes(this.editingType))
|
||||||
return { type: 'file', mask: false };
|
return { type: 'file', mask: false };
|
||||||
|
|
||||||
if (BIT.includes(this.editingType))
|
if (BOOLEAN.includes(this.editingType))
|
||||||
return { type: 'text', mask: false };
|
return { type: 'boolean', mask: false };
|
||||||
|
|
||||||
return { type: 'text', mask: false };
|
return { type: 'text', mask: false };
|
||||||
},
|
},
|
||||||
@@ -312,6 +346,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
enumArray () {
|
||||||
|
if (this.fields[this.editingField].enumValues)
|
||||||
|
return this.fields[this.editingField].enumValues.replaceAll('\'', '').split(',');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -331,6 +370,11 @@ export default {
|
|||||||
isNull (value) {
|
isNull (value) {
|
||||||
return value === null ? ' is-null' : '';
|
return value === null ? ' is-null' : '';
|
||||||
},
|
},
|
||||||
|
typeClass (type) {
|
||||||
|
if (type)
|
||||||
|
return `type-${type.toLowerCase().replaceAll(' ', '_').replaceAll('"', '')}`;
|
||||||
|
return '';
|
||||||
|
},
|
||||||
bufferToBase64 (val) {
|
bufferToBase64 (val) {
|
||||||
return bufferToBase64(val);
|
return bufferToBase64(val);
|
||||||
},
|
},
|
||||||
@@ -345,7 +389,7 @@ export default {
|
|||||||
this.editingField = field;
|
this.editingField = field;
|
||||||
this.editingLength = this.fields[field].length;
|
this.editingLength = this.fields[field].length;
|
||||||
|
|
||||||
if (LONG_TEXT.includes(type)) {
|
if ([...LONG_TEXT, ...ARRAY, ...TEXT_SEARCH].includes(type)) {
|
||||||
this.isTextareaEditor = true;
|
this.isTextareaEditor = true;
|
||||||
this.editingContent = this.$options.filters.typeFormat(content, type);
|
this.editingContent = this.$options.filters.typeFormat(content, type);
|
||||||
return;
|
return;
|
||||||
@@ -389,7 +433,13 @@ export default {
|
|||||||
this.isInlineEditor[this.editingField] = false;
|
this.isInlineEditor[this.editingField] = false;
|
||||||
let content;
|
let content;
|
||||||
if (!BLOB.includes(this.editingType)) {
|
if (!BLOB.includes(this.editingType)) {
|
||||||
|
if ([...DATETIME, ...TIME].includes(this.editingType)) {
|
||||||
|
if (this.editingContent.substring(this.editingContent.length - 1) === '.')
|
||||||
|
this.editingContent = this.editingContent.slice(0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.editingContent === this.$options.filters.typeFormat(this.originalContent, this.editingType, this.editingLength)) return;// If not changed
|
if (this.editingContent === this.$options.filters.typeFormat(this.originalContent, this.editingType, this.editingLength)) return;// If not changed
|
||||||
|
|
||||||
content = this.editingContent;
|
content = this.editingContent;
|
||||||
}
|
}
|
||||||
else { // Handle file upload
|
else { // Handle file upload
|
||||||
|
@@ -32,6 +32,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button
|
||||||
|
class="btn btn-dark btn-sm mr-0"
|
||||||
|
:disabled="isQuering || page === 1"
|
||||||
|
title="CTRL+ᐊ"
|
||||||
|
@click="pageChange('prev')"
|
||||||
|
>
|
||||||
|
<i class="mdi mdi-24px mdi-skip-previous" />
|
||||||
|
</button>
|
||||||
|
<div class="btn btn-dark btn-sm mr-0 text-bold c-auto px-2">
|
||||||
|
{{ page }}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="btn btn-dark btn-sm mr-0"
|
||||||
|
:disabled="isQuering || (results.length && results[0].rows.length < limit)"
|
||||||
|
title="CTRL+ᐅ"
|
||||||
|
@click="pageChange('next')"
|
||||||
|
>
|
||||||
|
<i class="mdi mdi-24px mdi-skip-next" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider-vert py-3" />
|
||||||
|
|
||||||
<button
|
<button
|
||||||
v-if="isTable"
|
v-if="isTable"
|
||||||
@@ -74,7 +97,7 @@
|
|||||||
<div v-if="results.length && results[0].rows">
|
<div v-if="results.length && results[0].rows">
|
||||||
{{ $t('word.results') }}: <b>{{ results[0].rows.length.toLocaleString() }}</b>
|
{{ $t('word.results') }}: <b>{{ results[0].rows.length.toLocaleString() }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="results.length && results[0].rows && tableInfo && results[0].rows.length < tableInfo.rows">
|
<div v-if="hasApproximately || page > 1">
|
||||||
{{ $t('word.total') }}: <b>{{ tableInfo.rows.toLocaleString() }}</b> <small>({{ $t('word.approximately') }})</small>
|
{{ $t('word.total') }}: <b>{{ tableInfo.rows.toLocaleString() }}</b> <small>({{ $t('word.approximately') }})</small>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="workspace.breadcrumbs.database">
|
<div v-if="workspace.breadcrumbs.database">
|
||||||
@@ -149,13 +172,15 @@ export default {
|
|||||||
isFakerModal: false,
|
isFakerModal: false,
|
||||||
autorefreshTimer: 0,
|
autorefreshTimer: 0,
|
||||||
refreshInterval: null,
|
refreshInterval: null,
|
||||||
sortParams: {}
|
sortParams: {},
|
||||||
|
page: 1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
getWorkspace: 'workspaces/getWorkspace',
|
getWorkspace: 'workspaces/getWorkspace',
|
||||||
selectedWorkspace: 'workspaces/getSelected'
|
selectedWorkspace: 'workspaces/getSelected',
|
||||||
|
limit: 'settings/getDataTabLimit'
|
||||||
}),
|
}),
|
||||||
workspace () {
|
workspace () {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
@@ -179,6 +204,13 @@ export default {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
return { rows: 0 };
|
return { rows: 0 };
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
hasApproximately () {
|
||||||
|
return this.results.length &&
|
||||||
|
this.results[0].rows &&
|
||||||
|
this.tableInfo &&
|
||||||
|
this.results[0].rows.length === this.limit &&
|
||||||
|
this.results[0].rows.length < this.tableInfo.rows;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -190,6 +222,9 @@ export default {
|
|||||||
this.$refs.queryTable.resetSort();
|
this.$refs.queryTable.resetSort();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
page () {
|
||||||
|
this.getTableData();
|
||||||
|
},
|
||||||
isSelected (val) {
|
isSelected (val) {
|
||||||
if (val && this.lastTable !== this.table) {
|
if (val && this.lastTable !== this.table) {
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
@@ -221,6 +256,8 @@ export default {
|
|||||||
uid: this.connection.uid,
|
uid: this.connection.uid,
|
||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
table: this.workspace.breadcrumbs.table || this.workspace.breadcrumbs.view,
|
table: this.workspace.breadcrumbs.table || this.workspace.breadcrumbs.view,
|
||||||
|
limit: this.limit,
|
||||||
|
page: this.page,
|
||||||
sortParams
|
sortParams
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -248,6 +285,14 @@ export default {
|
|||||||
this.sortParams = sortParams;
|
this.sortParams = sortParams;
|
||||||
this.getTableData(sortParams);
|
this.getTableData(sortParams);
|
||||||
},
|
},
|
||||||
|
pageChange (direction) {
|
||||||
|
if (this.isQuering) return;
|
||||||
|
|
||||||
|
if (direction === 'next' && (this.results.length && this.results[0].rows.length === this.limit))
|
||||||
|
this.page++;
|
||||||
|
else if (direction === 'prev' && this.page > 1)
|
||||||
|
this.page--;
|
||||||
|
},
|
||||||
showAddModal () {
|
showAddModal () {
|
||||||
this.isAddModal = true;
|
this.isAddModal = true;
|
||||||
},
|
},
|
||||||
@@ -266,6 +311,13 @@ export default {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (e.key === 'F5')
|
if (e.key === 'F5')
|
||||||
this.reloadTable();
|
this.reloadTable();
|
||||||
|
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
if (e.key === 'ArrowRight')
|
||||||
|
this.pageChange('next');
|
||||||
|
if (e.key === 'ArrowLeft')
|
||||||
|
this.pageChange('prev');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setRefreshInterval () {
|
setRefreshInterval () {
|
||||||
@@ -289,10 +341,6 @@ export default {
|
|||||||
.export-dropdown {
|
.export-dropdown {
|
||||||
.menu {
|
.menu {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
|
|
||||||
.menu-item a:hover {
|
|
||||||
background: $bg-color-gray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -100,7 +100,12 @@ module.exports = {
|
|||||||
paste: 'Paste',
|
paste: 'Paste',
|
||||||
tools: 'Tools',
|
tools: 'Tools',
|
||||||
variables: 'Variables',
|
variables: 'Variables',
|
||||||
processes: 'Processes'
|
processes: 'Processes',
|
||||||
|
database: 'Database',
|
||||||
|
scratchpad: 'Scratchpad',
|
||||||
|
array: 'Array',
|
||||||
|
changelog: 'Changelog',
|
||||||
|
format: 'Format'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
appWelcome: 'Welcome to Antares SQL Client!',
|
appWelcome: 'Welcome to Antares SQL Client!',
|
||||||
@@ -199,7 +204,14 @@ module.exports = {
|
|||||||
setNull: 'Set NULL',
|
setNull: 'Set NULL',
|
||||||
processesList: 'Processes list',
|
processesList: 'Processes list',
|
||||||
processInfo: 'Process info',
|
processInfo: 'Process info',
|
||||||
manageUsers: 'Manage users'
|
manageUsers: 'Manage users',
|
||||||
|
createNewSchema: 'Create new schema',
|
||||||
|
schemaName: 'Schema name',
|
||||||
|
editSchema: 'Edit schema',
|
||||||
|
deleteSchema: 'Delete schema',
|
||||||
|
markdownSupported: 'Markdown supported',
|
||||||
|
plantATree: 'Plant a Tree',
|
||||||
|
dataTabPageSize: 'DATA tab page size'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: 'Address',
|
address: 'Address',
|
||||||
|
@@ -9,7 +9,8 @@ const i18n = new VueI18n({
|
|||||||
'it-IT': require('./it-IT'),
|
'it-IT': require('./it-IT'),
|
||||||
'ar-SA': require('./ar-SA'),
|
'ar-SA': require('./ar-SA'),
|
||||||
'es-ES': require('./es-ES'),
|
'es-ES': require('./es-ES'),
|
||||||
'fr-FR': require('./fr-FR')
|
'fr-FR': require('./fr-FR'),
|
||||||
|
'pt-BR': require('./pt-BR')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
@@ -39,7 +39,73 @@ module.exports = {
|
|||||||
data: 'Dati',
|
data: 'Dati',
|
||||||
properties: 'Proprietà',
|
properties: 'Proprietà',
|
||||||
insert: 'Inserisci',
|
insert: 'Inserisci',
|
||||||
connecting: 'Connessione in corso'
|
connecting: 'Connessione in corso',
|
||||||
|
name: 'Nome',
|
||||||
|
collation: 'Confronto',
|
||||||
|
clear: 'Scarta',
|
||||||
|
options: 'Opzioni',
|
||||||
|
autoRefresh: 'Auto-aggiorna',
|
||||||
|
indexes: 'Indici',
|
||||||
|
foreignKeys: 'Chiavi esterne',
|
||||||
|
length: 'Lunghezza',
|
||||||
|
unsigned: 'Senza segno',
|
||||||
|
default: 'Default',
|
||||||
|
comment: 'Commento',
|
||||||
|
key: 'Chiave | Chiavi',
|
||||||
|
order: 'Ordine',
|
||||||
|
expression: 'Espressione',
|
||||||
|
autoIncrement: 'Auto Incremento',
|
||||||
|
engine: 'Motore',
|
||||||
|
field: 'Campo | Campi',
|
||||||
|
approximately: 'Approssimativamente',
|
||||||
|
total: 'Totali',
|
||||||
|
table: 'Tabella',
|
||||||
|
discard: 'Scarta',
|
||||||
|
stay: 'Resta',
|
||||||
|
author: 'Autore',
|
||||||
|
light: 'Chiaro',
|
||||||
|
dark: 'Scuro',
|
||||||
|
autoCompletion: 'Auto Completamento',
|
||||||
|
application: 'Applicazione',
|
||||||
|
editor: 'Editor',
|
||||||
|
view: 'Vista',
|
||||||
|
definer: 'Definer',
|
||||||
|
algorithm: 'Algoritmo',
|
||||||
|
trigger: 'Trigger | Triggers',
|
||||||
|
storedRoutine: 'Stored routine | Stored routines',
|
||||||
|
scheduler: 'Scheduler | Schedulers',
|
||||||
|
event: 'Evento',
|
||||||
|
parameters: 'Parametri',
|
||||||
|
function: 'Funzione | Funzioni',
|
||||||
|
deterministic: 'Deterministico',
|
||||||
|
context: 'Contesto',
|
||||||
|
export: 'Esporta',
|
||||||
|
returns: 'Ritorna',
|
||||||
|
timing: 'Temporizzazione',
|
||||||
|
state: 'Stato',
|
||||||
|
execution: 'Esecuzione',
|
||||||
|
starts: 'Inizia',
|
||||||
|
ends: 'Finisce',
|
||||||
|
ssl: 'SSL',
|
||||||
|
privateKey: 'Chiave privata',
|
||||||
|
certificate: 'Certificato',
|
||||||
|
caCertificate: 'Certificato CA',
|
||||||
|
ciphers: 'Ciphers',
|
||||||
|
upload: 'Carica',
|
||||||
|
browse: 'Sfoglia',
|
||||||
|
faker: 'Faker',
|
||||||
|
content: 'Contenuto',
|
||||||
|
cut: 'Taglia',
|
||||||
|
copy: 'Copia',
|
||||||
|
paste: 'Incolla',
|
||||||
|
tools: 'Strumenti',
|
||||||
|
variables: 'Variabili',
|
||||||
|
processes: 'Processi',
|
||||||
|
database: 'Database',
|
||||||
|
scratchpad: 'Blocco appunti',
|
||||||
|
array: 'Array',
|
||||||
|
changelog: 'Changelog',
|
||||||
|
format: 'Formatta'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
appWelcome: 'Benvenuto in Antares SQL Client!',
|
appWelcome: 'Benvenuto in Antares SQL Client!',
|
||||||
@@ -71,6 +137,243 @@ module.exports = {
|
|||||||
addNewRow: 'Aggiungi nuova riga',
|
addNewRow: 'Aggiungi nuova riga',
|
||||||
numberOfInserts: 'Numero di insert',
|
numberOfInserts: 'Numero di insert',
|
||||||
openNewTab: 'Apri nuova scheda',
|
openNewTab: 'Apri nuova scheda',
|
||||||
affectedRows: 'Righe interessate'
|
affectedRows: 'Righe interessate',
|
||||||
|
createNewDatabase: 'Crea nuovo database',
|
||||||
|
databaseName: 'Nome database',
|
||||||
|
serverDefault: 'Default del server',
|
||||||
|
deleteDatabase: 'Cancella database',
|
||||||
|
editDatabase: 'Modifica database',
|
||||||
|
clearChanges: 'Scarta modifiche',
|
||||||
|
addNewField: 'Aggiungi nuovo campo',
|
||||||
|
manageIndexes: 'Gestisci indici',
|
||||||
|
manageForeignKeys: 'Gestisci chiavi esterne',
|
||||||
|
allowNull: 'Permetti NULL',
|
||||||
|
zeroFill: 'Riempimento con zero',
|
||||||
|
customValue: 'Varore personalizzato',
|
||||||
|
onUpdate: 'All\'aggiornamento',
|
||||||
|
deleteField: 'Cancella campo',
|
||||||
|
createNewIndex: 'Crea nuovo indice',
|
||||||
|
addToIndex: 'Aggiungi a indice',
|
||||||
|
createNewTable: 'Crea nuova tabella',
|
||||||
|
emptyTable: 'Svuota tabella',
|
||||||
|
deleteTable: 'Cancella tabella',
|
||||||
|
emptyCorfirm: 'Confermi di voler svuotare',
|
||||||
|
unsavedChanges: 'Modifiche non salvate',
|
||||||
|
discardUnsavedChanges: 'Hai modifiche non salvate. Lasciando questa scheda le modifiche saranno scartate.',
|
||||||
|
thereAreNoIndexes: 'Non ci sono indici',
|
||||||
|
thereAreNoForeign: 'Non ci sono chiavi esterne',
|
||||||
|
createNewForeign: 'Crea nuova chiave esterna',
|
||||||
|
referenceTable: 'Tabella di rif.',
|
||||||
|
referenceField: 'Campo di rif.',
|
||||||
|
foreignFields: 'Campi esterni',
|
||||||
|
invalidDefault: 'Default non valido',
|
||||||
|
onDelete: 'All\'eliminazione',
|
||||||
|
applicationTheme: 'Tema applicazione',
|
||||||
|
editorTheme: 'Tema editor',
|
||||||
|
wrapLongLines: 'A capo righe lunghe',
|
||||||
|
selectStatement: 'Dichiarazione select',
|
||||||
|
triggerStatement: 'Dichiarazione trigger',
|
||||||
|
sqlSecurity: 'Sicurezza SQL',
|
||||||
|
updateOption: 'Update option',
|
||||||
|
deleteView: 'Elimina vista',
|
||||||
|
createNewView: 'Crea nuova vista',
|
||||||
|
deleteTrigger: 'Elimina trigger',
|
||||||
|
createNewTrigger: 'Crea nuovo trigger',
|
||||||
|
currentUser: 'Utente attuale',
|
||||||
|
routineBody: 'Corpo della routine',
|
||||||
|
dataAccess: 'Accesso dati',
|
||||||
|
thereAreNoParameters: 'Non ci sono parametri',
|
||||||
|
createNewParameter: 'Crea nuovo parametro',
|
||||||
|
createNewRoutine: 'Crea nuova stored routine',
|
||||||
|
deleteRoutine: 'Elimina stored routine',
|
||||||
|
functionBody: 'Corpo della funzione',
|
||||||
|
createNewFunction: 'Crea nuova funzione',
|
||||||
|
deleteFunction: 'Elimina funzione',
|
||||||
|
schedulerBody: 'Corpo dello scheduler',
|
||||||
|
createNewScheduler: 'Crea nuovo scheduler',
|
||||||
|
deleteScheduler: 'Elimina scheduler',
|
||||||
|
preserveOnCompletion: 'Preserva al completamento',
|
||||||
|
enableSsl: 'Abilita SSL',
|
||||||
|
manualValue: 'Valore manuale',
|
||||||
|
tableFiller: 'Riempitore Tabella',
|
||||||
|
fakeDataLanguage: 'Lingua dati falsi',
|
||||||
|
searchForElements: 'Cerca elementi',
|
||||||
|
selectAll: 'Seleziona tutto',
|
||||||
|
queryDuration: 'Durata query',
|
||||||
|
includeBetaUpdates: 'Includi aggiornamenti beta',
|
||||||
|
setNull: 'Imposta NULL',
|
||||||
|
processesList: 'Lista processi',
|
||||||
|
processInfo: 'Info processo',
|
||||||
|
manageUsers: 'Gestisci utenti',
|
||||||
|
createNewSchema: 'Crea nuovo schema',
|
||||||
|
schemaName: 'Nome schema',
|
||||||
|
editSchema: 'Modifica schema',
|
||||||
|
deleteSchema: 'Elimina schema',
|
||||||
|
markdownSupported: 'Markdown supportato',
|
||||||
|
plantATree: 'Pianta un albero'
|
||||||
|
},
|
||||||
|
faker: {
|
||||||
|
address: 'Indirizzo',
|
||||||
|
commerce: 'Commercio',
|
||||||
|
company: 'Compagnia',
|
||||||
|
database: 'Database',
|
||||||
|
date: 'Data',
|
||||||
|
finance: 'Finanza',
|
||||||
|
git: 'Git',
|
||||||
|
hacker: 'Hacker',
|
||||||
|
internet: 'Internet',
|
||||||
|
lorem: 'Lorem',
|
||||||
|
name: 'Nome',
|
||||||
|
music: 'Musica',
|
||||||
|
phone: 'Telefono',
|
||||||
|
random: 'Casuale',
|
||||||
|
system: 'Sistema',
|
||||||
|
time: 'Tempo',
|
||||||
|
vehicle: 'Veicolo',
|
||||||
|
zipCode: 'Codice zip',
|
||||||
|
zipCodeByState: 'Codice zip per stato',
|
||||||
|
city: 'Città',
|
||||||
|
cityPrefix: 'Prefisso città',
|
||||||
|
citySuffix: 'Suffisso città',
|
||||||
|
streetName: 'Nome strada',
|
||||||
|
streetAddress: 'Indirizzo strada',
|
||||||
|
streetSuffix: 'Suffisso strada',
|
||||||
|
streetPrefix: 'Prefisso strada',
|
||||||
|
secondaryAddress: 'Indirizzo secondario',
|
||||||
|
county: 'Contea',
|
||||||
|
country: 'Nazione',
|
||||||
|
countryCode: 'Codice nazione',
|
||||||
|
state: 'Stato',
|
||||||
|
stateAbbr: 'Abbreviazione stato',
|
||||||
|
latitude: 'Latitudine',
|
||||||
|
longitude: 'Longitudine',
|
||||||
|
direction: 'Direzione',
|
||||||
|
cardinalDirection: 'Direzione cardinale',
|
||||||
|
ordinalDirection: 'Direzione ordinale',
|
||||||
|
nearbyGPSCoordinate: 'Coordinate GPS vicine',
|
||||||
|
timeZone: 'Time zone',
|
||||||
|
color: 'Colore',
|
||||||
|
department: 'Dipartimento',
|
||||||
|
productName: 'Nome prodotto',
|
||||||
|
price: 'Prezzo',
|
||||||
|
productAdjective: 'Aggettivo prodotto',
|
||||||
|
productMaterial: 'Materiale prodotto',
|
||||||
|
product: 'Prodotto',
|
||||||
|
productDescription: 'Descrizione prodotto',
|
||||||
|
suffixes: 'Suffissi',
|
||||||
|
companyName: 'Nome compagnia',
|
||||||
|
companySuffix: 'Suffisso compagnia',
|
||||||
|
catchPhrase: 'Slogan',
|
||||||
|
bs: 'BS',
|
||||||
|
catchPhraseAdjective: 'Aggettivo slogan',
|
||||||
|
catchPhraseDescriptor: 'Descrittore slogan',
|
||||||
|
catchPhraseNoun: 'Sostantivo slogan',
|
||||||
|
bsAdjective: 'Aggettivo BS',
|
||||||
|
bsBuzz: 'Buzz BS',
|
||||||
|
bsNoun: 'Sostantivo BS',
|
||||||
|
column: 'Colonna',
|
||||||
|
type: 'Tipo',
|
||||||
|
collation: 'Confronto',
|
||||||
|
engine: 'Motore',
|
||||||
|
past: 'Passato',
|
||||||
|
future: 'Futuro',
|
||||||
|
between: 'Tra',
|
||||||
|
recent: 'Recente',
|
||||||
|
soon: 'Presto',
|
||||||
|
month: 'Mese',
|
||||||
|
weekday: 'Giorno della settimana',
|
||||||
|
account: 'Account',
|
||||||
|
accountName: 'Nome account',
|
||||||
|
routingNumber: 'Numero di instradamento',
|
||||||
|
mask: 'Maschera',
|
||||||
|
amount: 'Ammontare',
|
||||||
|
transactionType: 'Tipo transazione',
|
||||||
|
currencyCode: 'Codice valuta',
|
||||||
|
currencyName: 'Nome valuta',
|
||||||
|
currencySymbol: 'Simbolo valuta',
|
||||||
|
bitcoinAddress: 'Indirizzo Bitcoin',
|
||||||
|
litecoinAddress: 'Indirizzo Litecoin',
|
||||||
|
creditCardNumber: 'Numero carta di credito',
|
||||||
|
creditCardCVV: 'CVV carta di credito',
|
||||||
|
ethereumAddress: 'Indirizzo Ethereum',
|
||||||
|
iban: 'Iban',
|
||||||
|
bic: 'Bic',
|
||||||
|
transactionDescription: 'Descrizione transazione',
|
||||||
|
branch: 'Ramo',
|
||||||
|
commitEntry: 'Commit entry',
|
||||||
|
commitMessage: 'Messaggio di commit',
|
||||||
|
commitSha: 'SHA del commit',
|
||||||
|
shortSha: 'SHA breve',
|
||||||
|
abbreviation: 'Abbreviazione',
|
||||||
|
adjective: 'Aggettivo',
|
||||||
|
noun: 'Sostantivo',
|
||||||
|
verb: 'Verbo',
|
||||||
|
ingverb: 'Ingverb',
|
||||||
|
phrase: 'Frase',
|
||||||
|
avatar: 'Avatar',
|
||||||
|
email: 'Email',
|
||||||
|
exampleEmail: 'Email di esempio',
|
||||||
|
userName: 'Username',
|
||||||
|
protocol: 'Protocollo',
|
||||||
|
url: 'Url',
|
||||||
|
domainName: 'Nome dominio',
|
||||||
|
domainSuffix: 'Suffisso dominio',
|
||||||
|
domainWord: 'Parola dominio',
|
||||||
|
ip: 'Ip',
|
||||||
|
ipv6: 'Ipv6',
|
||||||
|
userAgent: 'User agent',
|
||||||
|
mac: 'Mac',
|
||||||
|
password: 'Password',
|
||||||
|
word: 'Parola',
|
||||||
|
words: 'Parole',
|
||||||
|
sentence: 'Sentenza',
|
||||||
|
slug: 'Slug',
|
||||||
|
sentences: 'Sentenze',
|
||||||
|
paragraph: 'Paragrafo',
|
||||||
|
paragraphs: 'Paragrafi',
|
||||||
|
text: 'Testo',
|
||||||
|
lines: 'Righe',
|
||||||
|
genre: 'Genere',
|
||||||
|
firstName: 'Nome',
|
||||||
|
lastName: 'Cognome',
|
||||||
|
middleName: 'Secondo nome',
|
||||||
|
findName: 'Nome completo',
|
||||||
|
jobTitle: 'Titolo di lavoro',
|
||||||
|
gender: 'Genere',
|
||||||
|
prefix: 'Prefisso',
|
||||||
|
suffix: 'Suffisso',
|
||||||
|
title: 'Titolo',
|
||||||
|
jobDescriptor: 'Descrittore del lavoro',
|
||||||
|
jobArea: 'Area di lavoro',
|
||||||
|
jobType: 'Tipo di lavoro',
|
||||||
|
phoneNumber: 'Numero di telefono',
|
||||||
|
phoneNumberFormat: 'Formato numeri di telefono',
|
||||||
|
phoneFormats: 'Formati di telefono',
|
||||||
|
number: 'Numero',
|
||||||
|
float: 'Float',
|
||||||
|
arrayElement: 'Elemento array',
|
||||||
|
arrayElements: 'Elementi array',
|
||||||
|
objectElement: 'Elemento object',
|
||||||
|
uuid: 'Uuid',
|
||||||
|
boolean: 'Booleano',
|
||||||
|
image: 'Immagine',
|
||||||
|
locale: 'Localizzazione',
|
||||||
|
alpha: 'Alfabetico',
|
||||||
|
alphaNumeric: 'Alfanumerico',
|
||||||
|
hexaDecimal: 'Esadecimale',
|
||||||
|
fileName: 'Nome file',
|
||||||
|
commonFileName: 'Nome file comune',
|
||||||
|
mimeType: 'Mime type',
|
||||||
|
commonFileType: 'Tipo file comune',
|
||||||
|
commonFileExt: 'Estensione file comune',
|
||||||
|
fileType: 'Tipo file',
|
||||||
|
fileExt: 'Estensione file',
|
||||||
|
directoryPath: 'Percorso directory',
|
||||||
|
filePath: 'Percorso file',
|
||||||
|
semver: 'Semver',
|
||||||
|
manufacturer: 'Produttore',
|
||||||
|
model: 'Modello',
|
||||||
|
fuel: 'Carburante',
|
||||||
|
vin: 'Vin'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|