1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Compare commits

..

112 Commits

Author SHA1 Message Date
2c7c97852f chore(release): 0.4.3 2022-01-30 12:39:54 +01:00
48ebf23bd1 feat(MySQL): spatial fields support (#165)
* feat: POINT field support

* feat(MySQL): support to LINESTRING, POLYGON and GEOMETRY fields

* refactor: removed links from map attribution

* feat(MySQL): support to MULTIPOINT, MULTILINESTRING, MULTIPOLYGON and GEOMCOLLECTION fields

* test: temporary fix on Windows tests
2022-01-30 11:45:24 +01:00
64deedc5ad test: temporary skip tests on WIndows 2022-01-30 11:44:01 +01:00
9f033fb994 fix: indexes and foreign keys not cleared after deletion of related field, closes #182 2022-01-28 23:57:53 +01:00
401cb49687 refactor: improved temporary fix to Windows 7 style frame 2022-01-28 09:19:49 +01:00
1356011ba3 fix(Windows): temporary fix to Windows 7 style frame on app startup, closes #169 2022-01-27 23:40:03 +01:00
0cfd7938ee fix: scale on numeric fields that doesn't support it 2022-01-27 09:12:01 +01:00
745b55a942 chore: update dependencies 2022-01-25 09:08:45 +01:00
eef7c1dcec perf: support of scale in field's length setting 2022-01-22 12:29:49 +01:00
aa8fc545d7 Rename zh_CN.js to zh-CN.js 2022-01-20 09:02:20 +01:00
a780c7e0ff Merge pull request #179 from Fabio286/all-contributors/add-goYou
docs: add goYou as a contributor for translation
2022-01-20 08:56:33 +01:00
allcontributors[bot]
9a1bb0599f docs: update .all-contributorsrc [skip ci] 2022-01-20 07:56:07 +00:00
allcontributors[bot]
d847870f67 docs: update README.md [skip ci] 2022-01-20 07:56:06 +00:00
cd24371576 Merge pull request #177 from goYou/master
feat: add Simplified Chinese translation
2022-01-20 08:54:56 +01:00
goYou
6ef565cf07 feat: add Simplified Chinese translation 2022-01-20 01:50:18 +08:00
46b45c8ab6 fix(PostgreSQL): schema different than public not automatically selected, closes #172 2022-01-17 09:15:18 +01:00
f28531a225 build: resolved dependency conflicts 2022-01-16 11:50:35 +01:00
8fb1f0803e fix: cell copy returns "undefined" in some conditions, closes #170 2022-01-14 18:37:37 +01:00
020ce36312 chore(release): 0.4.2 2022-01-10 08:50:00 +01:00
b4545b178f feat(UI): textarea autofocus selecting a query tab, closes #166 2022-01-09 12:28:01 +01:00
d9a3eab015 perf(MySQL): support to ANSI_QUOTES sql_mode, closes #158 2022-01-05 18:23:31 +01:00
2ab49c218d Merge pull request #164 from toriphes/feat/keep-window-state
feat: keep window state
2021-12-28 19:30:51 +01:00
Giulio Ganci
8f9385d508 feat: save window state
open the main window in the last used position of the screen
2021-12-28 17:12:10 +01:00
0c002918eb feat(PostgreSQL): ability to cancel queries 2021-12-26 21:13:02 +01:00
3d56ec7b49 Merge pull request #157 from Fabio286/dependabot/npm_and_yarn/eslint-plugin-promise-6.0.0
build(deps-dev): bump eslint-plugin-promise from 5.2.0 to 6.0.0
2021-12-24 18:04:58 +01:00
48c3e6afc4 perf: hash for foreign key default names 2021-12-23 11:47:17 +01:00
dependabot[bot]
50a5c8fe1e build(deps-dev): bump eslint-plugin-promise from 5.2.0 to 6.0.0
Bumps [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) from 5.2.0 to 6.0.0.
- [Release notes](https://github.com/xjamundx/eslint-plugin-promise/releases)
- [Changelog](https://github.com/xjamundx/eslint-plugin-promise/blob/development/CHANGELOG.md)
- [Commits](https://github.com/xjamundx/eslint-plugin-promise/commits)

---
updated-dependencies:
- dependency-name: eslint-plugin-promise
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-20 19:03:06 +00:00
b0d1f115c9 ci: update actions/checkout to v2 2021-12-20 09:27:36 +01:00
a59f77f618 feat(MySQL): ability to cancel queries 2021-12-19 11:59:09 +01:00
e7a1858091 fix(SQLite): exception with some fields 2021-12-16 09:16:15 +01:00
648a51efe8 Merge pull request #154 from Fabio286/all-contributors/add-wenj91
docs: add wenj91 as a contributor for code
2021-12-14 09:49:24 +01:00
38962c4807 Merge pull request #153 from wenj91/master
[TypeError: Cannot read properties of undefined (reading 'type') #152] bugfix
2021-12-14 09:48:58 +01:00
allcontributors[bot]
43e4cdd4cf docs: update .all-contributorsrc [skip ci] 2021-12-14 08:48:00 +00:00
allcontributors[bot]
91046c1ac1 docs: update README.md [skip ci] 2021-12-14 08:47:59 +00:00
文杰
63f8b9b6a1 Merge branch 'Fabio286:master' into master 2021-12-14 09:40:42 +08:00
文杰
ed476d9b5c Merge pull request #1 from wenj91:152-bugfix
[TypeError: Cannot read properties of undefined (reading 'type') #152] bugfix
2021-12-14 09:40:02 +08:00
文杰
f41d8c0480 [TypeError: Cannot read properties of undefined (reading 'type') #152] bugfix 2021-12-14 01:37:59 +00:00
e3b54a8be1 Merge pull request #151 from datlechin/master
Update vi-VN translation
2021-12-13 08:08:30 +01:00
Ngo Quoc Dat
c2c0394624 Update vi-VN translation 2021-12-13 08:48:07 +07:00
8a6f5eac59 chore(release): 0.4.1 2021-12-11 10:28:29 +01:00
a5fdcc1a85 feat: language format detection for text fields 2021-12-10 23:30:03 +01:00
1df21da47c refactor: moved to new vue slots API 2021-12-10 17:34:44 +01:00
8da0224876 fix(MySQL): wrong datetime fields default in table filler in some cases 2021-12-09 18:26:59 +01:00
359e14a9eb fix(MySQL): wrong value for fields "on update" in some conditions 2021-12-09 12:22:38 +01:00
813aa320d9 perf(UI): avoid columns size change when editing cells or scrolling results 2021-12-08 11:19:10 +01:00
aaa5549609 fix: cell disappear on edit in one column tables 2021-12-08 10:37:23 +01:00
35cb7e1dc4 fix: select all rows with ctrl+a when editing a cell 2021-12-08 10:09:01 +01:00
992a033cb2 fix: false positive with Windows Defender 2021-12-01 09:23:40 +01:00
5267b37eaf chore: updated appx icons 2021-11-28 16:28:54 +01:00
8fe30d8b6d ci: run tests before build 2021-11-25 21:37:48 +01:00
37ccb6b00d test: basic e2e tests 2021-11-25 18:34:33 +01:00
e8af2d24a8 perf(UI): disable save button in table creation when no fields are added 2021-11-25 17:23:46 +01:00
d7f1aa97af fix(SQLite): update rows with a text primary key 2021-11-25 16:25:40 +01:00
c46224635a chore(release): 0.4.0 2021-11-24 17:27:51 +01:00
cc99491fe4 fix(UI): notifications timeout anomalies 2021-11-24 16:59:07 +01:00
fe8435531e Merge pull request #143 from Fabio286/feat/read-only-mode-on-connections
feat: read-only mode
2021-11-24 14:41:31 +01:00
5d48fe08c7 feat(PostgreSQL): read-only mode 2021-11-24 14:24:52 +01:00
4437d44486 feat(MySQL): read-only mode 2021-11-24 13:04:14 +01:00
9fe3680bbb perf: update italian traslation 2021-11-24 09:52:10 +01:00
da1947e4ef fix(UI): hide tools menu if no tools available 2021-11-24 09:19:42 +01:00
37a848df9d Merge pull request #142 from Fabio286/dependabot/npm_and_yarn/electron-16.0.1
build(deps-dev): bump electron from 15.3.2 to 16.0.1
2021-11-23 17:38:21 +01:00
dependabot[bot]
9816965e18 build(deps-dev): bump electron from 15.3.2 to 16.0.1
Bumps [electron](https://github.com/electron/electron) from 15.3.2 to 16.0.1.
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md)
- [Commits](https://github.com/electron/electron/compare/v15.3.2...v16.0.1)

---
updated-dependencies:
- dependency-name: electron
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-22 19:05:55 +00:00
98165cacaa fix(SQLite): hide schema creation 2021-11-19 16:50:15 +01:00
7ad3096b4e chore: update README.md 2021-11-19 16:14:11 +01:00
7d345cf795 Merge pull request #141 from Fabio286/feat/sqlite-implementation
feat:sqlite implementation
2021-11-19 16:11:00 +01:00
f40e9c592e feat(SQLite): triggers management 2021-11-19 15:36:07 +01:00
7671c585f5 feat(SQLite): views management 2021-11-19 13:13:35 +01:00
93b4a7063b perf(SQLite): improvements in field length detection 2021-11-18 19:43:08 +01:00
3efeb45c46 feat(SQLite): tables management 2021-11-18 11:36:46 +01:00
3fc227d2de feat(SQLite): readonly mode 2021-11-16 13:21:33 +01:00
604b371920 feat(SQLite): cell update in data tabs 2021-11-16 12:56:03 +01:00
fd321beece feat(SQLite): keys support 2021-11-16 12:27:51 +01:00
9fe4e6b9e3 Merge pull request #140 from Fabio286/all-contributors/add-kilianstallz
docs: add kilianstallz as a contributor for code
2021-11-15 22:38:24 +01:00
allcontributors[bot]
57bf90481b docs: update .all-contributorsrc [skip ci] 2021-11-15 21:37:49 +00:00
allcontributors[bot]
6062a32c1c docs: update README.md [skip ci] 2021-11-15 21:37:48 +00:00
94c899eb82 perf(SQLite): improvements in data visualization 2021-11-15 18:09:34 +01:00
44a4ca75bd Merge pull request #139 from kilianstallz/kilianstallz-patch-table-rows
Hotfix quote style on delete-table-rows handler
2021-11-15 17:01:10 +01:00
Kilian Stallinger
c8e1605b08 Hotfix quote style on delete-table-rows handler
Use single quote as intended for ID in delete query.
2021-11-15 16:21:09 +01:00
60e5556a3e chore(release): 0.3.9 2021-11-14 10:51:45 +01:00
f2fcc98839 feat(SQLite): table data visualization 2021-11-13 23:00:53 +01:00
c54438d6d3 feat(SQLite): connection add/edit masks 2021-11-13 11:34:30 +01:00
b3f10220b3 build: transparent background for appx icon 2021-11-12 13:12:05 +01:00
d19f475fc2 perf(UI): improved function and routine parameters modals 2021-11-12 12:22:39 +01:00
795db96319 Merge pull request #135 from Fabio286/dependabot/npm_and_yarn/marked-4.0.0
build(deps): bump marked from 3.0.8 to 4.0.0
2021-11-10 12:00:20 +01:00
b5fee79e90 refactor: minor changes to support marked 4.0.0 2021-11-10 11:48:06 +01:00
dependabot[bot]
5532ddbda9 build(deps): bump marked from 3.0.8 to 4.0.0
Bumps [marked](https://github.com/markedjs/marked) from 3.0.8 to 4.0.0.
- [Release notes](https://github.com/markedjs/marked/releases)
- [Changelog](https://github.com/markedjs/marked/blob/master/.releaserc.json)
- [Commits](https://github.com/markedjs/marked/compare/v3.0.8...v4.0.0)

---
updated-dependencies:
- dependency-name: marked
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-08 19:06:33 +00:00
3369d3dc2d refactor: prefix to internal rows id 2021-11-08 15:12:37 +01:00
fd25f881f9 feat: schema size in explore bar 2021-11-06 16:36:54 +01:00
5ca3a22dc5 feat(MySQL): enable/disable schedulers from contextual menu 2021-11-06 12:21:33 +01:00
5c668249cf feat(MySQL): scheduler status indicator in explore bar 2021-11-05 18:23:02 +01:00
39b9a59143 fix(PostgreSQL): bigint fetched as string instead of number, closes #134 2021-11-05 11:41:12 +01:00
534659f9ae feat(PostgreSQL): enable/disable triggers from contextual menu 2021-11-04 21:54:42 +01:00
c00fd1381f fix: temporary solution on MacOS for unsigned app updates 2021-11-03 14:46:13 +01:00
17c6686163 Merge pull request #133 from Fabio286/dependabot/npm_and_yarn/webpack-dev-server-4.4.0
build(deps-dev): bump webpack-dev-server from 3.11.2 to 4.4.0
2021-11-02 22:23:56 +01:00
bc0c5a76ba refactor: minor changes to support webpack-dev-server 4.4.0 2021-11-02 22:23:10 +01:00
2b16c0ece4 Merge pull request #132 from Fabio286/dependabot/npm_and_yarn/sass-loader-12.3.0
build(deps-dev): bump sass-loader from 10.2.0 to 12.3.0
2021-11-02 22:02:07 +01:00
dependabot[bot]
ba1416dce2 build(deps-dev): bump webpack-dev-server from 3.11.2 to 4.4.0
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.11.2 to 4.4.0.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.11.2...v4.4.0)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 20:55:42 +00:00
13adf0a767 Merge pull request #131 from Fabio286/dependabot/npm_and_yarn/eslint-plugin-vue-8.0.3
build(deps-dev): bump eslint-plugin-vue from 7.20.0 to 8.0.3
2021-11-02 21:52:38 +01:00
cacab55f55 refactor: minor changes to support eslint-plugin-vue 8 2021-11-02 21:51:53 +01:00
dependabot[bot]
3189d625e3 build(deps-dev): bump sass-loader from 10.2.0 to 12.3.0
Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 10.2.0 to 12.3.0.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v10.2.0...v12.3.0)

---
updated-dependencies:
- dependency-name: sass-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 19:07:14 +00:00
dependabot[bot]
f71ed39b88 build(deps-dev): bump eslint-plugin-vue from 7.20.0 to 8.0.3
Bumps [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) from 7.20.0 to 8.0.3.
- [Release notes](https://github.com/vuejs/eslint-plugin-vue/releases)
- [Commits](https://github.com/vuejs/eslint-plugin-vue/compare/v7.20.0...v8.0.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-vue
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 19:05:26 +00:00
729aa9781a chore: update README.md and CONTRIBUTING.md 2021-10-31 16:07:53 +01:00
cd1ebacf89 Merge pull request #126 from toriphes/master
feat: added macos basic shortcusts and menu
2021-10-31 15:24:56 +01:00
a08074b446 Merge branch 'master' of https://github.com/Fabio286/antares into pr/toriphes/126 2021-10-31 15:14:49 +01:00
0cd182546b build: electron-webpack replacement (#130)
* some changes

* improvements and dedicated webpeck configs for render and main

* added debugging setup

* vscode main process debug config

* vue3 devtools
2021-10-31 10:36:45 +01:00
89fdd210ca fix: row selection problems after a deletion fail, closes #128 2021-10-29 22:43:22 +02:00
Giulio Ganci
e2cf6e8c21 Merge branch 'Fabio286:master' into master 2021-10-29 12:43:00 +02:00
Giulio Ganci
430490ad93 feat: added macos basic shortcusts and menu 2021-10-24 13:02:37 +02:00
Giulio Ganci
a35566f273 feat(UI): double click on the title bar will toggle window fullscreen size 2021-10-24 13:00:36 +02:00
3679121c25 Merge pull request #125 from toriphes/master
MacOS improvements
2021-10-24 10:32:46 +02:00
Giulio Ganci
7657d05edf feat(UI): improved topbar look&feel on MacOS 2021-10-23 18:15:32 +02:00
Giulio Ganci
1ddf8f0dbe fix: copy&paste and basic usability on macOS 2021-10-23 17:56:42 +02:00
119 changed files with 4333 additions and 1131 deletions

145
.all-contributorsrc Normal file
View File

@@ -0,0 +1,145 @@
{
"projectName": "antares",
"projectOwner": "Fabio286",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"commitConvention": "angular",
"contributors": [
{
"login": "Fabio286",
"name": "Fabio Di Stasio",
"avatar_url": "https://avatars.githubusercontent.com/u/31471771?v=4",
"profile": "https://fabiodistasio.it/",
"contributions": [
"code",
"translation",
"doc"
]
},
{
"login": "toriphes",
"name": "Giulio Ganci",
"avatar_url": "https://avatars.githubusercontent.com/u/4192159?v=4",
"profile": "https://www.linkedin.com/in/giulioganci/",
"contributions": [
"code"
]
},
{
"login": "digitalgopnik",
"name": "Christian Ratz",
"avatar_url": "https://avatars.githubusercontent.com/u/2630316?v=4",
"profile": "https://christianratz.de/",
"contributions": [
"code",
"translation"
]
},
{
"login": "reverb6821",
"name": "Giuseppe Gigliotti",
"avatar_url": "https://avatars.githubusercontent.com/u/55198803?v=4",
"profile": "https://reverb6821.github.io/",
"contributions": [
"translation"
]
},
{
"login": "Mohd-PH",
"name": "Mohd-PH",
"avatar_url": "https://avatars.githubusercontent.com/u/9362157?v=4",
"profile": "https://github.com/Mohd-PH",
"contributions": [
"translation"
]
},
{
"login": "hongkfui",
"name": "hongkfui",
"avatar_url": "https://avatars.githubusercontent.com/u/37477191?v=4",
"profile": "https://github.com/hongkfui",
"contributions": [
"translation"
]
},
{
"login": "MrAnyx",
"name": "Robin",
"avatar_url": "https://avatars.githubusercontent.com/u/44176707?v=4",
"profile": "https://github.com/MrAnyx",
"contributions": [
"translation"
]
},
{
"login": "daeleduardo",
"name": "Daniel Eduardo",
"avatar_url": "https://avatars.githubusercontent.com/u/8599078?v=4",
"profile": "https://github.com/daeleduardo",
"contributions": [
"translation"
]
},
{
"login": "datlechin",
"name": "Ngô Quốc Đạt",
"avatar_url": "https://avatars.githubusercontent.com/u/56961917?v=4",
"profile": "https://ngoquocdat.com/",
"contributions": [
"translation"
]
},
{
"login": "IsamuSugi",
"name": "Isamu Sugiura",
"avatar_url": "https://avatars.githubusercontent.com/u/7746658?v=4",
"profile": "https://github.com/IsamuSugi",
"contributions": [
"translation"
]
},
{
"login": "Occhioverde",
"name": "Riccardo Sacchetto",
"avatar_url": "https://avatars.githubusercontent.com/u/18429412?v=4",
"profile": "http://rsacchetto.nexxontech.it/",
"contributions": [
"platform"
]
},
{
"login": "kilianstallz",
"name": "Kilian Stallinger",
"avatar_url": "https://avatars.githubusercontent.com/u/5290318?v=4",
"profile": "https://kilianstallinger.com",
"contributions": [
"code"
]
},
{
"login": "wenj91",
"name": "文杰",
"avatar_url": "https://avatars.githubusercontent.com/u/12549338?v=4",
"profile": "https://github.com/wenj91",
"contributions": [
"code"
]
},
{
"login": "goYou",
"name": "goYou",
"avatar_url": "https://avatars.githubusercontent.com/u/62732795?v=4",
"profile": "https://github.com/goYou",
"contributions": [
"translation"
]
}
],
"contributorsPerLine": 7,
"skipCi": true
}

View File

@@ -1,4 +1,4 @@
/node_modules node_modules
/assets/vendor assets
/out out
/dist dist

View File

@@ -45,7 +45,9 @@
"no-console": "off", "no-console": "off",
"no-undef": "off", "no-undef": "off",
"vue/no-side-effects-in-computed-properties": "off", "vue/no-side-effects-in-computed-properties": "off",
"vue/multi-word-component-names": "off",
"vue/require-default-prop": "off", "vue/require-default-prop": "off",
"vue/comment-directive": "off",
"vue/no-v-html": "off", "vue/no-v-html": "off",
"vue/html-indent": [ "vue/html-indent": [
"error", "error",
@@ -60,10 +62,11 @@
"vue/max-attributes-per-line": [ "vue/max-attributes-per-line": [
"error", "error",
{ {
"singleline": 2, "singleline": {
"max": 2
},
"multiline": { "multiline": {
"max": 1, "max": 1
"allowFirstLine": false
} }
} }
] ]

View File

@@ -12,12 +12,18 @@ jobs:
steps: steps:
- name: Check out Git repository - name: Check out Git repository
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn - name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 14 node-version: 14
- name: Install dependencies
run: npm i
- name: Run tests
run: npm run test
- name: Build/release Electron app - name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1 uses: samuelmeuli/action-electron-builder@v1

View File

@@ -12,12 +12,18 @@ jobs:
steps: steps:
- name: Check out Git repository - name: Check out Git repository
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn - name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 14 node-version: 14
- name: Install dependencies
run: npm i
- name: Run tests
run: npm run test
- name: Build/release Electron app - name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1 uses: samuelmeuli/action-electron-builder@v1

View File

@@ -12,13 +12,19 @@ jobs:
steps: steps:
- name: Check out Git repository - name: Check out Git repository
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn - name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 14 node-version: 14
- name: Install dependencies
run: npm i
- name: Run tests
run: npm run test
- name: Build/release Electron app - name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1 uses: samuelmeuli/action-electron-builder@v1
with: with:

7
.gitignore vendored
View File

@@ -1,9 +1,8 @@
.DS_Store .DS_Store
dist/ dist
node_modules/ build
node_modules
thumbs.db thumbs.db
.idea/
.vscode
NOTES.md NOTES.md
*.txt *.txt
package-lock.json package-lock.json

2
.nvmrc
View File

@@ -1 +1 @@
v14.18.1 v16.13.0

29
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceFolder}",
"name": "Electron: Main",
"port": 9222,
"protocol": "inspector",
"request": "attach",
"sourceMaps": true,
"type": "node",
"timeout": 1000000
},
{
"name": "Electron: Renderer",
"port": 9223,
"request": "attach",
"sourceMaps": true,
"type": "chrome",
"webRoot": "${workspaceFolder}"
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": ["Electron: Main", "Electron: Renderer"]
}
]
}

11
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"conventionalCommits.scopes": [
"UI",
"core",
"MySQL",
"PostgreSQL",
"SQLite",
"Windows"
],
"svg.preview.background": "transparent"
}

View File

@@ -2,6 +2,128 @@
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.4.3](https://github.com/Fabio286/antares/compare/v0.4.2...v0.4.3) (2022-01-30)
### Features
* add Simplified Chinese translation ([6ef565c](https://github.com/Fabio286/antares/commit/6ef565cf078cb3f5b7bcdc226894cddeb6239db9))
* **MySQL:** spatial fields support ([#165](https://github.com/Fabio286/antares/issues/165)) ([48ebf23](https://github.com/Fabio286/antares/commit/48ebf23bd1574408f429f2e1200ce878352007f6))
### Bug Fixes
* cell copy returns "undefined" in some conditions, closes [#170](https://github.com/Fabio286/antares/issues/170) ([8fb1f08](https://github.com/Fabio286/antares/commit/8fb1f0803efd9df0b66521e73bb6e1a229cf9691))
* indexes and foreign keys not cleared after deletion of related field, closes [#182](https://github.com/Fabio286/antares/issues/182) ([9f033fb](https://github.com/Fabio286/antares/commit/9f033fb994916b4fb165e81e55e86127ca817791))
* **PostgreSQL:** schema different than public not automatically selected, closes [#172](https://github.com/Fabio286/antares/issues/172) ([46b45c8](https://github.com/Fabio286/antares/commit/46b45c8ab64fb6837a532c4f8342167e4fd794bb))
* scale on numeric fields that doesn't support it ([0cfd793](https://github.com/Fabio286/antares/commit/0cfd7938ee7d607dbad66ae452d0200223a6bab2))
* **Windows:** temporary fix to Windows 7 style frame on app startup, closes [#169](https://github.com/Fabio286/antares/issues/169) ([1356011](https://github.com/Fabio286/antares/commit/1356011ba3b7dd72e12cb252a8787ce48a364fd4))
### Improvements
* support of scale in field's length setting ([eef7c1d](https://github.com/Fabio286/antares/commit/eef7c1dcecc6593ab0e69ed678187a57fe0a4fb6))
### [0.4.2](https://github.com/Fabio286/antares/compare/v0.4.1...v0.4.2) (2022-01-10)
### Features
* **MySQL:** ability to cancel queries ([a59f77f](https://github.com/Fabio286/antares/commit/a59f77f618aea6156fc80fb832d3efcb9848411f))
* **PostgreSQL:** ability to cancel queries ([0c00291](https://github.com/Fabio286/antares/commit/0c002918eb0226f6b3f21ed62117495f86396fb1))
* save window state ([8f9385d](https://github.com/Fabio286/antares/commit/8f9385d50815635d091758ecd5d00884e3297ca0))
* **UI:** textarea autofocus selecting a query tab, closes [#166](https://github.com/Fabio286/antares/issues/166) ([b4545b1](https://github.com/Fabio286/antares/commit/b4545b178f795712c781a3f4fc35eec31b5ad902))
### Bug Fixes
* **SQLite:** exception with some fields ([e7a1858](https://github.com/Fabio286/antares/commit/e7a18580915e7739bfa97948c6a0c4fc90a7e78a))
### Improvements
* hash for foreign key default names ([48c3e6a](https://github.com/Fabio286/antares/commit/48c3e6afc43c51f70a16703f1a71194f43da7a3e))
* **MySQL:** support to ANSI_QUOTES sql_mode, closes [#158](https://github.com/Fabio286/antares/issues/158) ([d9a3eab](https://github.com/Fabio286/antares/commit/d9a3eab015302e9f23112f659658073ab3242191))
### [0.4.1](https://github.com/Fabio286/antares/compare/v0.4.0...v0.4.1) (2021-12-11)
### Features
* language format detection for text fields ([a5fdcc1](https://github.com/Fabio286/antares/commit/a5fdcc1a85aa188ff1b9a15b1a768aced026f360))
### Bug Fixes
* cell disappear on edit in one column tables ([aaa5549](https://github.com/Fabio286/antares/commit/aaa5549609664665bd4513632d621cb249b379c1))
* false positive with Windows Defender ([992a033](https://github.com/Fabio286/antares/commit/992a033cb2bede3d1eb52e19482d810f6692de1e))
* **MySQL:** wrong datetime fields default in table filler in some cases ([8da0224](https://github.com/Fabio286/antares/commit/8da022487650039b7f34a9c86a7bd9045eba65e2))
* **MySQL:** wrong value for fields "on update" in some conditions ([359e14a](https://github.com/Fabio286/antares/commit/359e14a9ebd48f86069ba7762fe00a7056f52d47))
* select all rows with ctrl+a when editing a cell ([35cb7e1](https://github.com/Fabio286/antares/commit/35cb7e1dc48d3a74e9d106cb1a37f454c1b4a4d1))
* **SQLite:** update rows with a text primary key ([d7f1aa9](https://github.com/Fabio286/antares/commit/d7f1aa97af32a4c51fc7022498bd47e15fa08430))
### Improvements
* **UI:** avoid columns size change when editing cells or scrolling results ([813aa32](https://github.com/Fabio286/antares/commit/813aa320d9ab799efea38a7110b7c0bdf7549123))
* **UI:** disable save button in table creation when no fields are added ([e8af2d2](https://github.com/Fabio286/antares/commit/e8af2d24a869f7667c069936648808952d2062ab))
## [0.4.0](https://github.com/Fabio286/antares/compare/v0.3.9...v0.4.0) (2021-11-24)
### Features
* **MySQL:** read-only mode ([4437d44](https://github.com/Fabio286/antares/commit/4437d44486c4f20b0bec4bf89d56016b08e36e79))
* **PostgreSQL:** read-only mode ([5d48fe0](https://github.com/Fabio286/antares/commit/5d48fe08c77755ed18b3f7a9ea834268e317e7ef))
* **SQLite:** cell update in data tabs ([604b371](https://github.com/Fabio286/antares/commit/604b3719204f7473ce4846624f08f8be9eec8b8f))
* **SQLite:** connection add/edit masks ([c54438d](https://github.com/Fabio286/antares/commit/c54438d6d3bad38bc76dfcd61f58929fe30279cb))
* **SQLite:** keys support ([fd321be](https://github.com/Fabio286/antares/commit/fd321beece075d3ad23fdd8541f9beb5727045a5))
* **SQLite:** readonly mode ([3fc227d](https://github.com/Fabio286/antares/commit/3fc227d2de53aae115226ad3c965bfb6e9f3eca6))
* **SQLite:** table data visualization ([f2fcc98](https://github.com/Fabio286/antares/commit/f2fcc9883972402eab4d51ef2a9796638dde2d3d))
* **SQLite:** tables management ([3efeb45](https://github.com/Fabio286/antares/commit/3efeb45c460f178b794de72367f8d542fd8ddd56))
* **SQLite:** triggers management ([f40e9c5](https://github.com/Fabio286/antares/commit/f40e9c592eeffd204aba21a0a0767a0c523fca49))
* **SQLite:** views management ([7671c58](https://github.com/Fabio286/antares/commit/7671c585f5f8049bd863db190d4fc60d8f0c6c66))
### Bug Fixes
* **SQLite:** hide schema creation ([98165ca](https://github.com/Fabio286/antares/commit/98165cacaa158c85ead0490d3caf579e2a17319f))
* **UI:** hide tools menu if no tools available ([da1947e](https://github.com/Fabio286/antares/commit/da1947e4efa7f0a26d6a231fadf750be055fbdd5))
* **UI:** notifications timeout anomalies ([cc99491](https://github.com/Fabio286/antares/commit/cc99491fe4a15812368f6c928b8c7801d7b255aa))
### Improvements
* **SQLite:** improvements in data visualization ([94c899e](https://github.com/Fabio286/antares/commit/94c899eb8288b41a5962ac3d24365227e1f9f485))
* **SQLite:** improvements in field length detection ([93b4a70](https://github.com/Fabio286/antares/commit/93b4a7063beeb5a7001cb06a74f05b23105212f5))
* update italian traslation ([9fe3680](https://github.com/Fabio286/antares/commit/9fe3680bbb17c192cffa85348e68794ab49beb81))
### [0.3.9](https://github.com/Fabio286/antares/compare/v0.3.8...v0.3.9) (2021-11-14)
### Features
* added macos basic shortcusts and menu ([430490a](https://github.com/Fabio286/antares/commit/430490ad93f3148962ced1f13a5330c79cd86b3b))
* **MySQL:** enable/disable schedulers from contextual menu ([5ca3a22](https://github.com/Fabio286/antares/commit/5ca3a22dc538b27a4bf6402f1288c4b9f5bc5a90))
* **MySQL:** scheduler status indicator in explore bar ([5c66824](https://github.com/Fabio286/antares/commit/5c668249cf102cd9d601f9f7b4943c7155775217))
* **PostgreSQL:** enable/disable triggers from contextual menu ([534659f](https://github.com/Fabio286/antares/commit/534659f9aee12eb5ac477f91bfe5d764387dc17e))
* schema size in explore bar ([fd25f88](https://github.com/Fabio286/antares/commit/fd25f881f95779709156cbad93a41d6b391f1a45))
* **UI:** double click on the title bar will toggle window fullscreen size ([a35566f](https://github.com/Fabio286/antares/commit/a35566f273322602abe434b8bd30817ba8885900))
* **UI:** improved topbar look&feel on MacOS ([7657d05](https://github.com/Fabio286/antares/commit/7657d05edfbeaed6a14eb337fc562da5126e6ba0))
### Bug Fixes
* copy&paste and basic usability on macOS ([1ddf8f0](https://github.com/Fabio286/antares/commit/1ddf8f0dbe22f94d6bffddf70636706d2d142ecf))
* **PostgreSQL:** bigint fetched as string instead of number, closes [#134](https://github.com/Fabio286/antares/issues/134) ([39b9a59](https://github.com/Fabio286/antares/commit/39b9a59143b457a96f0711a3b8588c92dd80e28d))
* row selection problems after a deletion fail, closes [#128](https://github.com/Fabio286/antares/issues/128) ([89fdd21](https://github.com/Fabio286/antares/commit/89fdd210ca48fc9ae399b195ea796c8523619627))
* temporary solution on MacOS for unsigned app updates ([c00fd13](https://github.com/Fabio286/antares/commit/c00fd1381f451ba7aace7047b28b904ddcaf18f0))
### Improvements
* **UI:** improved function and routine parameters modals ([d19f475](https://github.com/Fabio286/antares/commit/d19f475fc28c0367ada569cb634769fa618b48b4))
### [0.3.8](https://github.com/Fabio286/antares/compare/v0.3.7...v0.3.8) (2021-10-23) ### [0.3.8](https://github.com/Fabio286/antares/compare/v0.3.7...v0.3.8) (2021-10-23)

View File

@@ -57,8 +57,8 @@ The command to build Antares SQL locally is `npm run build:local`.
- **PascalCase** for file names (with .vue extension) and including components inside others (`<MyComponent/>`). - **PascalCase** for file names (with .vue extension) and including components inside others (`<MyComponent/>`).
- "**Base**" prefix for [base component names](https://vuejs.org/v2/style-guide/#Base-component-names-strongly-recommended). - "**Base**" prefix for [base component names](https://vuejs.org/v2/style-guide/#Base-component-names-strongly-recommended).
- "**The**" prefix for [single-instance component names](https://vuejs.org/v2/style-guide/#Single-instance-component-names-strongly-recommended). - "**The**" prefix for [single-instance component names](https://vuejs.org/v2/style-guide/#Single-instance-component-names-strongly-recommended).
- [Tightly coupled component names ](https://vuejs.org/v2/style-guide/#Tightly-coupled-component-names-strongly-recommended). - [Tightly coupled component names](https://vuejs.org/v2/style-guide/#Tightly-coupled-component-names-strongly-recommended).
- [Order of words in component names](https://vuejs.org/v2/style-guide/#Order-of-words-in-component-names-strongly-recommended). - [Order of words in component names](https://vuejs.org/v2/style-guide/#Order-of-words-in-component-names-strongly-recommended).
- **kebab-case** in templates for property and event names. - **kebab-case** in templates for property and event names.
@@ -74,15 +74,21 @@ The project includes [ESlint](https://eslint.org/) and [StyleLint](https://style
Alternatively you can launch following commands to lint the project. Alternatively you can launch following commands to lint the project.
Check if all the style rules have been followed: Check if all the style rules have been followed:
```console ```console
npm run lint npm run lint
``` ```
Apply style rules globally if possible: Apply style rules globally if possible:
```console ```console
npm run lint:fix npm run lint:fix
``` ```
### Other recommendations
Please, use if possible **template literals** to compose strings and **avoid unnecessary dependencies**.
### Commits ### Commits
The commit style adopted for this project is [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). The commit style adopted for this project is [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
@@ -91,30 +97,11 @@ For Visual Studio Code users may be useful [Conventional Commits](https://market
## Debug ## Debug
**Dev mode**: **Debug mode**:
```console ```console
npm run dev npm run debug
``` ```
**Visual Studio Code:** After running the debug mode Antares will listen on port 9222 (main process) for a debugger.
On **Visual Studio Code** just launch "*Electron: Main*" configurations after running Antares in debug mode.
``` json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Electron in debugger",
"autoAttachChildProcesses": true,
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-webpack",
"runtimeArgs": [
"dev"
],
"env": {},
"console": "integratedTerminal",
}
]
}
```

View File

@@ -1,6 +1,9 @@
<!-- markdownlint-disable -->
<p align="center"> <p align="center">
<img width="800" src="https://raw.githubusercontent.com/Fabio286/antares/master/docs/gh-logo.png"> <img width="800" src="https://raw.githubusercontent.com/Fabio286/antares/master/docs/gh-logo.png">
</p> </p>
<!-- markdownlint-restore -->
# Antares SQL Client # Antares SQL Client
@@ -9,7 +12,7 @@
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.
Our target is to support as many databases as possible, and all major operating systems, including the ARM versions. Our target is to support as many databases as possible, and all major operating systems, including the ARM versions.
**At the moment this application is in development state, many features will come in future updates**, and supports only MySQL/MariaDB and PostgreSQL. **At the moment this application is in development state, many features will come in future updates**, and supports only MySQL/MariaDB, PostgreSQL and SQLite.
At the moment, however, there are all the features necessary to have a pleasant database management experience, so give it a chance and send us your feedback, we would really appreciate it. At the moment, however, there are all the features necessary to have a pleasant database management experience, so give it a chance and send us your feedback, we would really appreciate it.
We are actively working on it, hoping to provide new cool features, improvements and fixes as soon as possible. We are actively working on it, hoping to provide new cool features, improvements and fixes as soon as possible.
@@ -65,12 +68,12 @@ On macOS you can run `.dmg` distribution following [this guide](https://support.
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.
- Database tools. - Database tools.
- Users management (add/edit/delete). - Users management (add/edit/delete).
- More context menu shortcuts. - More context menu shortcuts.
- More keyboard shortcuts. - More keyboard shortcuts.
- Import/export and migration. - Import/export and migration.
- Support for other databases.
- Apple Silicon distribution - Apple Silicon distribution
## Currently supported ## Currently supported
@@ -79,7 +82,7 @@ This is a roadmap with major features will come in near future.
- [x] MySQL/MariaDB - [x] MySQL/MariaDB
- [x] PostgreSQL - [x] PostgreSQL
- [ ] SQLite - [x] SQLite
- [ ] MSSQL - [ ] MSSQL
- [ ] OracleDB - [ ] OracleDB
- [ ] More... - [ ] More...
@@ -104,13 +107,37 @@ This is a roadmap with major features will come in near future.
- 📖 [Contributors Guide](https://github.com/Fabio286/antares/wiki/Contributors-Guide) - 📖 [Contributors Guide](https://github.com/Fabio286/antares/wiki/Contributors-Guide)
- 🚧 [Project Board](https://github.com/users/Fabio286/projects/1) - 🚧 [Project Board](https://github.com/users/Fabio286/projects/1)
## Translations ## Contributors ✨
**Italian** / [Giuseppe Gigliotti](https://github.com/ReverbOD) [[#20](https://github.com/Fabio286/antares/pull/20)] Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
**Arabic** (needs updates) / [Mohd-PH](https://github.com/Mohd-PH) [[#29](https://github.com/Fabio286/antares/pull/29)]
**Spanish** (needs updates) / [hongkfui](https://github.com/hongkfui) [[#32](https://github.com/Fabio286/antares/pull/32)] <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
**French** (needs updates) / [MrAnyx](https://github.com/MrAnyx) [[#44](https://github.com/Fabio286/antares/pull/44)] <!-- prettier-ignore-start -->
**Portugues (Brasil)** / [Daniel Eduardo](https://github.com/daeleduardo) [[#54](https://github.com/Fabio286/antares/pull/54)] <!-- markdownlint-disable -->
**Deutsch (Deutschland)** / [Christian Ratz](https://github.com/digitalgopnik) [[#74](https://github.com/Fabio286/antares/pull/74)] <table>
**Vietnamese** / [Ngô Quốc Đạt](https://github.com/datlechin) [[#111](https://github.com/Fabio286/antares/pull/111)] <tr>
**Japanese** / [Isamu Sugiura](https://github.com/IsamuSugi) [[#115](https://github.com/Fabio286/antares/pull/115)] <td align="center"><a href="https://fabiodistasio.it/"><img src="https://avatars.githubusercontent.com/u/31471771?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fabio Di Stasio</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=Fabio286" title="Code">💻</a> <a href="#translation-Fabio286" title="Translation">🌍</a> <a href="https://github.com/Fabio286/antares/commits?author=Fabio286" title="Documentation">📖</a></td>
<td align="center"><a href="https://www.linkedin.com/in/giulioganci/"><img src="https://avatars.githubusercontent.com/u/4192159?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Giulio Ganci</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=toriphes" title="Code">💻</a></td>
<td align="center"><a href="https://christianratz.de/"><img src="https://avatars.githubusercontent.com/u/2630316?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Christian Ratz</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=digitalgopnik" title="Code">💻</a> <a href="#translation-digitalgopnik" title="Translation">🌍</a></td>
<td align="center"><a href="https://reverb6821.github.io/"><img src="https://avatars.githubusercontent.com/u/55198803?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Giuseppe Gigliotti</b></sub></a><br /><a href="#translation-reverb6821" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/Mohd-PH"><img src="https://avatars.githubusercontent.com/u/9362157?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mohd-PH</b></sub></a><br /><a href="#translation-Mohd-PH" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/hongkfui"><img src="https://avatars.githubusercontent.com/u/37477191?v=4?s=100" width="100px;" alt=""/><br /><sub><b>hongkfui</b></sub></a><br /><a href="#translation-hongkfui" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/MrAnyx"><img src="https://avatars.githubusercontent.com/u/44176707?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Robin</b></sub></a><br /><a href="#translation-MrAnyx" title="Translation">🌍</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/daeleduardo"><img src="https://avatars.githubusercontent.com/u/8599078?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Eduardo</b></sub></a><br /><a href="#translation-daeleduardo" title="Translation">🌍</a></td>
<td align="center"><a href="https://ngoquocdat.com/"><img src="https://avatars.githubusercontent.com/u/56961917?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ngô Quốc Đạt</b></sub></a><br /><a href="#translation-datlechin" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/IsamuSugi"><img src="https://avatars.githubusercontent.com/u/7746658?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Isamu Sugiura</b></sub></a><br /><a href="#translation-IsamuSugi" title="Translation">🌍</a></td>
<td align="center"><a href="http://rsacchetto.nexxontech.it/"><img src="https://avatars.githubusercontent.com/u/18429412?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Riccardo Sacchetto</b></sub></a><br /><a href="#platform-Occhioverde" title="Packaging/porting to new platform">📦</a></td>
<td align="center"><a href="https://kilianstallinger.com"><img src="https://avatars.githubusercontent.com/u/5290318?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kilian Stallinger</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=kilianstallz" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/wenj91"><img src="https://avatars.githubusercontent.com/u/12549338?v=4?s=100" width="100px;" alt=""/><br /><sub><b>文杰</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=wenj91" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/goYou"><img src="https://avatars.githubusercontent.com/u/62732795?v=4?s=100" width="100px;" alt=""/><br /><sub><b>goYou</b></sub></a><br /><a href="#translation-goYou" title="Translation">🌍</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
assets/appx/StoreLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -1,5 +0,0 @@
{
"include": [
"./src/renderer/**/*"
]
}

View File

@@ -1,27 +1,46 @@
{ {
"name": "antares", "name": "antares",
"productName": "Antares", "productName": "Antares",
"version": "0.3.8", "version": "0.4.3",
"description": "A cross-platform easy to use SQL client.", "description": "A modern, fast and productivity driven SQL client with a focus in UX.",
"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", "debug": "npm run rebuild:electron && npm run debug-runner",
"compile": "electron-webpack", "debug-runner": "node scripts/devRunner.js --remote-debug",
"compile": "npm run compile:main && npm run compile:renderer",
"compile:main": "webpack --mode=production --config webpack.main.config.js",
"compile:renderer": "webpack --mode=production --config webpack.renderer.config.js",
"build": "cross-env NODE_ENV=production npm run compile", "build": "cross-env NODE_ENV=production npm run compile",
"build:local": "npm run build && electron-builder", "build:local": "npm run build && electron-builder",
"build:appx": "npm run build:local -- --win appx", "build:appx": "npm run build:local -- --win appx",
"rebuild:electron": "npm run postinstall",
"release": "standard-version", "release": "standard-version",
"release:pre": "npm run release -- --prerelease alpha", "release:pre": "npm run release -- --prerelease alpha",
"test": "npm run lint", "postinstall": "electron-builder install-app-deps",
"test": "npm run compile && node tests/app.spec.js",
"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" "contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate"
}, },
"author": "Fabio Di Stasio <fabio286@gmail.com>", "author": "Fabio Di Stasio <fabio286@gmail.com>",
"main": "./dist/main.js",
"build": { "build": {
"appId": "com.fabio286.antares", "appId": "com.fabio286.antares",
"artifactName": "${productName}-${version}-${os}_${arch}.${ext}", "artifactName": "${productName}-${version}-${os}_${arch}.${ext}",
"asar": true,
"buildDependenciesFromSource": true,
"directories": {
"output": "build",
"buildResources": "assets"
},
"asarUnpack": "**\\*.{node,dll}",
"files": [
"dist/**/*",
"node_modules",
"package.json"
],
"win": { "win": {
"target": [ "target": [
"nsis", "nsis",
@@ -32,7 +51,8 @@
"target": { "target": {
"target": "default", "target": "default",
"arch": [ "arch": [
"x64" "x64",
"arm64"
] ]
} }
}, },
@@ -61,7 +81,9 @@
"artifactName": "${productName}-${version}-portable.exe" "artifactName": "${productName}-${version}-portable.exe"
}, },
"appx": { "appx": {
"displayName": "Antares SQL Client", "displayName": "Antares SQL",
"backgroundColor": "transparent",
"showNameOnTiles": true,
"identityName": "62514FabioDiStasio.AntaresSQLClient", "identityName": "62514FabioDiStasio.AntaresSQLClient",
"publisher": "CN=1A2729ED-865C-41D2-9038-39AE2A63AA52", "publisher": "CN=1A2729ED-865C-41D2-9038-39AE2A63AA52",
"applicationId": "FabioDiStasio.AntaresSQLClient" "applicationId": "FabioDiStasio.AntaresSQLClient"
@@ -81,20 +103,20 @@
] ]
} }
}, },
"electronWebpack": {
"renderer": {
"webpackConfig": "webpack.config.js"
}
},
"dependencies": { "dependencies": {
"@electron/remote": "^2.0.1", "@electron/remote": "^2.0.1",
"@mdi/font": "^6.1.95", "@mdi/font": "^6.1.95",
"@turf/helpers": "^6.5.0",
"@vscode/vscode-languagedetection": "^1.0.21",
"ace-builds": "^1.4.13", "ace-builds": "^1.4.13",
"better-sqlite3": "^7.4.4",
"electron-log": "^4.4.1", "electron-log": "^4.4.1",
"electron-store": "^8.0.1", "electron-store": "^8.0.1",
"electron-updater": "^4.3.9", "electron-updater": "^4.6.1",
"electron-window-state": "^5.0.3",
"faker": "^5.5.3", "faker": "^5.5.3",
"marked": "^3.0.4", "leaflet": "^1.7.1",
"marked": "^4.0.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"mysql2": "^2.3.2", "mysql2": "^2.3.2",
"pg": "^8.7.1", "pg": "^8.7.1",
@@ -110,28 +132,41 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.15.7", "@babel/eslint-parser": "^7.15.7",
"@babel/preset-env": "^7.15.8",
"all-contributors-cli": "^6.20.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"chalk": "^4.1.2",
"clean-webpack-plugin": "^4.0.0",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"electron": "^15.3.0", "css-loader": "^6.5.0",
"electron-builder": "^22.13.1", "electron": "^16.0.8",
"electron-builder": "^22.14.11",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"electron-webpack": "^2.8.2",
"electron-webpack-vue": "^2.4.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.24.2", "eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0", "eslint-plugin-promise": "^5.2.0",
"eslint-plugin-vue": "^7.18.0", "eslint-plugin-vue": "^8.0.3",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "~2.4.5",
"node-loader": "^2.0.0",
"playwright": "^1.18.1",
"progress-webpack-plugin": "^1.0.12",
"sass": "^1.42.1", "sass": "^1.42.1",
"sass-loader": "^10.2.0", "sass-loader": "^12.3.0",
"standard-version": "^9.3.1", "standard-version": "^9.3.1",
"style-loader": "^3.3.1",
"stylelint": "^13.13.1", "stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0", "stylelint-config-standard": "^22.0.0",
"stylelint-scss": "^3.21.0", "stylelint-scss": "^3.21.0",
"tree-kill": "^1.2.2",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-loader": "^15.9.8", "vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.14", "vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0" "webpack": "^5.60.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0"
} }
} }

131
scripts/devRunner.js Normal file
View File

@@ -0,0 +1,131 @@
process.env.NODE_ENV = 'development';
// process.env.ELECTRON_ENABLE_LOGGING = true
const chalk = require('chalk');
const electron = require('electron');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const kill = require('tree-kill');
const path = require('path');
const { spawn } = require('child_process');
const mainConfig = require('../webpack.main.config');
const rendererConfig = require('../webpack.renderer.config');
// const workersConfig = require('../webpack.workers.config');
let electronProcess = null;
let manualRestart = null;
const remoteDebugging = process.argv.includes('--remote-debug');
if (remoteDebugging) {
// disable dvtools open in electron
process.env.RENDERER_REMOTE_DEBUGGING = true;
}
async function killElectron (pid) {
return new Promise((resolve, reject) => {
if (pid) {
kill(pid, 'SIGKILL', err => {
if (err) reject(err);
resolve();
});
}
else
resolve();
});
}
async function restartElectron () {
console.log(chalk.gray('\nStarting electron...'));
const { pid } = electronProcess || {};
await killElectron(pid);
electronProcess = spawn(electron, [
path.join(__dirname, '../dist/main.js'),
// '--enable-logging', // Enable to show logs from all electron processes
remoteDebugging ? '--inspect=9222' : '',
remoteDebugging ? '--remote-debugging-port=9223' : ''
]);
electronProcess.stdout.on('data', data => {
console.log(chalk.white(data.toString()));
});
electronProcess.stderr.on('data', data => {
console.error(chalk.red(data.toString()));
});
electronProcess.on('exit', (code, signal) => {
if (!manualRestart) process.exit(0);
});
}
function startMain () {
const webpackSetup = webpack(mainConfig);
webpackSetup.compilers.forEach((compiler) => {
const { name } = compiler;
switch (name) {
case 'workers':
compiler.hooks.afterEmit.tap('afterEmit', async () => {
console.log(chalk.gray(`\nCompiled ${name} script!`));
console.log(
chalk.gray(`\nWatching file changes for ${name} script...`)
);
});
break;
case 'main':
default:
compiler.hooks.afterEmit.tap('afterEmit', async () => {
console.log(chalk.gray(`\nCompiled ${name} script!`));
manualRestart = true;
await restartElectron();
setTimeout(() => {
manualRestart = false;
}, 2500);
console.log(
chalk.gray(`\nWatching file changes for ${name} script...`)
);
});
break;
}
});
webpackSetup.watch({ aggregateTimeout: 500 }, err => {
if (err) console.error(chalk.red(err));
});
}
function startRenderer (callback) {
const compiler = webpack(rendererConfig);
const { name } = compiler;
compiler.hooks.afterEmit.tap('afterEmit', () => {
console.log(chalk.gray(`\nCompiled ${name} script!`));
console.log(chalk.gray(`\nWatching file changes for ${name} script...`));
});
const server = new WebpackDevServer(compiler, {
hot: true,
port: 9080,
client: {
overlay: true,
logging: 'warn'
}
});
server.startCallback(err => {
if (err) console.error(chalk.red(err));
callback();
});
}
startRenderer(startMain);

View File

@@ -8,6 +8,10 @@ module.exports = {
collations: false, collations: false,
engines: false, engines: false,
connectionSchema: false, connectionSchema: false,
sslConnection: false,
sshConnection: false,
fileConnection: false,
cancelQueries: false,
// Tools // Tools
processesList: false, processesList: false,
usersManagement: false, usersManagement: false,
@@ -33,7 +37,11 @@ module.exports = {
schedulerAdd: false, schedulerAdd: false,
databaseEdit: false, databaseEdit: false,
schemaEdit: false, schemaEdit: false,
schemaDrop: false,
tableSettings: false, tableSettings: false,
tableOptions: false,
tableArray: false,
tableRealCount: false,
viewSettings: false, viewSettings: false,
triggerSettings: false, triggerSettings: false,
triggerFunctionSettings: false, triggerFunctionSettings: false,
@@ -45,14 +53,13 @@ module.exports = {
sortableFields: false, sortableFields: false,
unsigned: false, unsigned: false,
nullable: false, nullable: false,
nullablePrimary: false,
zerofill: false, zerofill: false,
tableOptions: false,
autoIncrement: false, autoIncrement: false,
comment: false, comment: false,
collation: false, collation: false,
definer: false, definer: false,
onUpdate: false, onUpdate: false,
tableArray: false,
viewAlgorithm: false, viewAlgorithm: false,
viewSqlSecurity: false, viewSqlSecurity: false,
viewUpdateOption: false, viewUpdateOption: false,
@@ -72,8 +79,10 @@ module.exports = {
triggerTableInName: false, triggerTableInName: false,
triggerUpdateColumns: false, triggerUpdateColumns: false,
triggerOnlyRename: false, triggerOnlyRename: false,
triggerEnableDisable: false,
triggerFunctionSql: false, triggerFunctionSql: false,
triggerFunctionlanguages: false, triggerFunctionlanguages: false,
parametersLength: false, parametersLength: false,
languages: false languages: false,
readOnlyMode: false
}; };

View File

@@ -1,5 +1,6 @@
module.exports = { module.exports = {
maria: require('./mysql'), maria: require('./mysql'),
mysql: require('./mysql'), mysql: require('./mysql'),
pg: require('./postgresql') pg: require('./postgresql'),
sqlite: require('./sqlite')
}; };

View File

@@ -10,6 +10,9 @@ module.exports = {
connectionSchema: true, connectionSchema: true,
collations: true, collations: true,
engines: true, engines: true,
sslConnection: true,
sshConnection: true,
cancelQueries: true,
// Tools // Tools
processesList: true, processesList: true,
// Structure // Structure
@@ -30,6 +33,7 @@ module.exports = {
functionAdd: true, functionAdd: true,
schedulerAdd: true, schedulerAdd: true,
schemaEdit: true, schemaEdit: true,
schemaDrop: true,
tableSettings: true, tableSettings: true,
viewSettings: true, viewSettings: true,
triggerSettings: true, triggerSettings: true,
@@ -59,5 +63,6 @@ module.exports = {
functionDeterministic: true, functionDeterministic: true,
functionDataAccess: true, functionDataAccess: true,
functionSql: 'BEGIN\r\n\r\nEND', functionSql: 'BEGIN\r\n\r\nEND',
parametersLength: true parametersLength: true,
readOnlyMode: true
}; };

View File

@@ -8,9 +8,13 @@ module.exports = {
defaultDatabase: 'postgres', defaultDatabase: 'postgres',
// Core // Core
database: true, database: true,
sslConnection: true,
sshConnection: true,
cancelQueries: true,
// Tools // Tools
processesList: true, processesList: true,
// Structure // Structure
schemas: true,
tables: true, tables: true,
views: true, views: true,
triggers: true, triggers: true,
@@ -26,6 +30,7 @@ module.exports = {
triggerFunctionAdd: true, triggerFunctionAdd: true,
routineAdd: true, routineAdd: true,
functionAdd: true, functionAdd: true,
schemaDrop: true,
databaseEdit: false, databaseEdit: false,
tableSettings: true, tableSettings: true,
viewSettings: true, viewSettings: true,
@@ -50,5 +55,7 @@ module.exports = {
triggerMultipleEvents: true, triggerMultipleEvents: true,
triggerTableInName: true, triggerTableInName: true,
triggerOnlyRename: false, triggerOnlyRename: false,
languages: ['sql', 'plpgsql', 'c', 'internal'] triggerEnableDisable: true,
languages: ['sql', 'plpgsql', 'c', 'internal'],
readOnlyMode: true
}; };

View File

@@ -0,0 +1,27 @@
module.exports = {
// Core
fileConnection: true,
// Structure
schemas: false,
tables: true,
views: true,
triggers: true,
// Settings
elementsWrapper: '"',
stringsWrapper: '\'',
tableAdd: true,
viewAdd: true,
triggerAdd: true,
schemaEdit: false,
tableSettings: true,
tableRealCount: true,
viewSettings: true,
triggerSettings: true,
indexes: true,
foreigns: true,
sortableFields: true,
nullable: true,
nullablePrimary: true,
triggerSql: 'BEGIN\r\n\r\nEND',
readOnlyMode: true
};

View File

@@ -66,6 +66,7 @@ module.exports = [
{ {
name: 'DECIMAL', name: 'DECIMAL',
length: true, length: true,
scale: true,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
@@ -218,56 +219,56 @@ module.exports = [
types: [ types: [
{ {
name: 'POINT', name: 'POINT',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'LINESTRING', name: 'LINESTRING',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'POLYGON', name: 'POLYGON',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'GEOMETRY', name: 'GEOMETRY',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'MULTIPOINT', name: 'MULTIPOINT',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'MULTILINESTRING', name: 'MULTILINESTRING',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'MULTIPOLYGON', name: 'MULTIPOLYGON',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false
}, },
{ {
name: 'GEOMETRYCOLLECTION', name: 'GEOMCOLLECTION',
length: true, length: false,
collation: false, collation: false,
unsigned: false, unsigned: false,
zerofill: false zerofill: false

View File

@@ -22,11 +22,6 @@ module.exports = [
length: false, length: false,
unsigned: true unsigned: true
}, },
{
name: 'NUMERIC',
length: true,
unsigned: true
},
{ {
name: 'SMALLSERIAL', name: 'SMALLSERIAL',
length: false, length: false,
@@ -52,6 +47,12 @@ module.exports = [
length: false, length: false,
unsigned: true unsigned: true
}, },
{
name: 'NUMERIC',
length: true,
unsigned: true,
scale: true
},
{ {
name: 'DOUBLE PRECISION', name: 'DOUBLE PRECISION',
length: false, length: false,

View File

@@ -0,0 +1,137 @@
module.exports = [
{
group: 'integer',
types: [
{
name: 'INT',
length: true,
collation: false,
unsigned: true,
zerofill: true
},
{
name: 'INTEGER',
length: true,
collation: false,
unsigned: true,
zerofill: true
},
{
name: 'BIGINT',
length: true,
collation: false,
unsigned: true,
zerofill: true
},
{
name: 'NUMERIC',
length: true,
collation: false,
unsigned: true,
zerofill: true
},
{
name: 'BOOLEAN',
length: false,
collation: false,
unsigned: true,
zerofill: true
}
]
},
{
group: 'float',
types: [
{
name: 'FLOAT',
length: true,
collation: false,
unsigned: false,
zerofill: false
},
{
name: 'REAL',
length: true,
collation: false,
unsigned: false,
zerofill: false
}
]
},
{
group: 'string',
types: [
{
name: 'CHAR',
length: true,
collation: true,
unsigned: false,
zerofill: false
},
{
name: 'VARCHAR',
length: true,
collation: true,
unsigned: false,
zerofill: false
},
{
name: 'TEXT',
length: true,
collation: true,
unsigned: false,
zerofill: false
}
]
},
{
group: 'binary',
types: [
{
name: 'BLOB',
length: true,
collation: false,
unsigned: false,
zerofill: false
}
]
},
{
group: 'time',
types: [
{
name: 'DATE',
length: false,
collation: false,
unsigned: false,
zerofill: false
},
{
name: 'TIME',
length: true,
collation: false,
unsigned: false,
zerofill: false
},
{
name: 'DATETIME',
length: true,
collation: false,
unsigned: false,
zerofill: false
}
]
},
{
group: 'other',
types: [
{
name: 'NONE',
length: false,
collation: false,
unsigned: false,
zerofill: false
}
]
}
];

View File

@@ -8,7 +8,9 @@ export const TEXT = [
export const LONG_TEXT = [ export const LONG_TEXT = [
'TEXT', 'TEXT',
'MEDIUMTEXT', 'MEDIUMTEXT',
'LONGTEXT' 'LONGTEXT',
'JSON',
'VARBINARY'
]; ];
export const ARRAY = [ export const ARRAY = [
@@ -82,3 +84,24 @@ export const BIT = [
'BIT', 'BIT',
'BIT VARYING' 'BIT VARYING'
]; ];
export const SPATIAL = [
'POINT',
'LINESTRING',
'POLYGON',
'GEOMETRY',
'MULTIPOINT',
'MULTILINESTRING',
'MULTIPOLYGON',
'GEOMCOLLECTION',
'GEOMETRYCOLLECTION'
];
// Used to check multi spatial fields only
export const IS_MULTI_SPATIAL = [
'MULTIPOINT',
'MULTILINESTRING',
'MULTIPOLYGON',
'GEOMCOLLECTION',
'GEOMETRYCOLLECTION'
];

View File

@@ -0,0 +1,5 @@
module.exports = [
'PRIMARY',
'INDEX',
'UNIQUE'
];

View File

@@ -0,0 +1,10 @@
/**
*
* @param {any[]} array
* @returns {number}
*/
export function getArrayDepth (array) {
return Array.isArray(array)
? 1 + Math.max(0, ...array.map(getArrayDepth))
: 0;
}

View File

@@ -1,133 +0,0 @@
'use strict';
import { app, BrowserWindow, /* session, */ nativeImage, Menu } from 'electron';
import * as path from 'path';
import Store from 'electron-store';
import * as remoteMain from '@electron/remote/main';
import ipcHandlers from './ipc-handlers';
// remoteMain.initialize();
Store.initRenderer();
const isDevelopment = process.env.NODE_ENV !== 'production';
const gotTheLock = app.requestSingleInstanceLock();
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
// global reference to mainWindow (necessary to prevent window from being garbage collected)
let mainWindow;
async function createMainWindow () {
const icon = require('../renderer/images/logo-32.png');
const window = new BrowserWindow({
width: 1024,
height: 800,
minWidth: 900,
minHeight: 550,
title: 'Antares',
autoHideMenuBar: true,
icon: nativeImage.createFromDataURL(icon.default),
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
'web-security': false,
spellcheck: false
},
frame: false,
backgroundColor: '#1d1d1d'
});
remoteMain.enable(window.webContents);
try {
if (isDevelopment) { //
await window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);
// const { default: installExtension, VUEJS3_DEVTOOLS } = require('electron-devtools-installer');
// const oldDevToolsID = session.defaultSession.getAllExtensions().find(ext => ext.name === 'Vue.js devtools').id;
// session.defaultSession.removeExtension(oldDevToolsID);
// const toolName = await installExtension(VUEJS3_DEVTOOLS);
// console.log(toolName, 'installed');
}
else await window.loadURL(new URL(`file:///${path.join(__dirname, 'index.html')}`).href);
}
catch (err) {
console.log(err);
}
window.on('closed', () => {
mainWindow = null;
});
window.webContents.on('devtools-opened', () => {
window.focus();
setImmediate(() => {
window.focus();
});
});
return window;
}
if (!gotTheLock) app.quit();
else {
require('@electron/remote/main').initialize();
// Initialize ipcHandlers
ipcHandlers();
// quit application when all windows are closed
app.on('window-all-closed', () => {
// on macOS it is common for applications to stay open until the user explicitly quits
if (process.platform !== 'darwin') app.quit();
});
app.on('activate', async () => {
// on macOS it is common to re-create a window even after all windows have been closed
if (mainWindow === null) {
mainWindow = await createMainWindow();
if (isDevelopment) mainWindow.webContents.openDevTools();
}
});
// create main BrowserWindow when electron is ready
app.on('ready', async () => {
mainWindow = await createMainWindow();
createAppMenu();
if (isDevelopment) mainWindow.webContents.openDevTools();
process.on('uncaughtException', (error) => {
mainWindow.webContents.send('unhandled-exception', error);
});
process.on('unhandledRejection', (error) => {
mainWindow.webContents.send('unhandled-exception', error);
});
});
}
function createAppMenu () {
let menu = null;
if (process.platform === 'darwin') {
menu = Menu.buildFromTemplate([
{
label: app.name,
submenu: [
{
role: 'about'
},
{ type: 'separator' },
{
role: 'quit'
}
]
}
]);
}
Menu.setApplicationMenu(menu);
}

View File

@@ -9,12 +9,16 @@ export default connections => {
port: +conn.port, port: +conn.port,
user: conn.user, user: conn.user,
password: conn.password, password: conn.password,
application_name: 'Antares SQL' application_name: 'Antares SQL',
readonly: conn.readonly
}; };
if (conn.database) if (conn.database)
params.database = conn.database; params.database = conn.database;
if (conn.databasePath)
params.databasePath = conn.databasePath;
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,
@@ -48,7 +52,7 @@ export default connections => {
return { status: 'success' }; return { status: 'success' };
} }
catch (err) { catch (err) {
return { status: 'error', response: err }; return { status: 'error', response: err.toString() };
} }
}); });
@@ -62,12 +66,16 @@ export default connections => {
port: +conn.port, port: +conn.port,
user: conn.user, user: conn.user,
password: conn.password, password: conn.password,
application_name: 'Antares SQL' application_name: 'Antares SQL',
readonly: conn.readonly
}; };
if (conn.database) if (conn.database)
params.database = conn.database; params.database = conn.database;
if (conn.databasePath)
params.databasePath = conn.databasePath;
if (conn.schema) if (conn.schema)
params.schema = conn.schema; params.schema = conn.schema;

View File

@@ -40,4 +40,17 @@ export default (connections) => {
return { status: 'error', response: err.toString() }; return { status: 'error', response: err.toString() };
} }
}); });
ipcMain.handle('toggle-scheduler', async (event, params) => {
try {
if (!params.enabled)
await connections[params.uid].enableEvent({ ...params });
else
await connections[params.uid].disableEvent({ ...params });
return { status: 'success' };
}
catch (err) {
return { status: 'error', response: err.toString() };
}
});
}; };

View File

@@ -135,7 +135,7 @@ export default connections => {
} }
}); });
ipcMain.handle('raw-query', async (event, { uid, query, schema }) => { ipcMain.handle('raw-query', async (event, { uid, query, schema, tabUid }) => {
if (!query) return; if (!query) return;
try { try {
@@ -143,6 +143,7 @@ export default connections => {
nest: true, nest: true,
details: true, details: true,
schema, schema,
tabUid,
comments: false comments: false
}); });
@@ -152,4 +153,16 @@ export default connections => {
return { status: 'error', response: err.toString() }; return { status: 'error', response: err.toString() };
} }
}); });
ipcMain.handle('kill-tab-query', async (event, { uid, tabUid }) => {
if (!tabUid) return;
try {
await connections[uid].killTabQuery(tabUid);
return { status: 'success' };
}
catch (err) {
return { status: 'error', response: err.toString() };
}
});
}; };

View File

@@ -3,6 +3,7 @@ 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, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes'; import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
import * as customizations from 'common/customizations';
import fs from 'fs'; import fs from 'fs';
export default (connections) => { export default (connections) => {
@@ -84,12 +85,13 @@ export default (connections) => {
}); });
ipcMain.handle('update-table-cell', async (event, params) => { ipcMain.handle('update-table-cell', async (event, params) => {
delete params.row._id; delete params.row._antares_id;
const { stringsWrapper: sw } = customizations[connections[params.uid]._client];
try { // TODO: move to client classes 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 : `${sw}${params.id}${sw}`;
if ([...NUMBER, ...FLOAT].includes(params.type)) if ([...NUMBER, ...FLOAT].includes(params.type))
escapedParam = params.content; escapedParam = params.content;
@@ -102,6 +104,9 @@ export default (connections) => {
case 'pg': case 'pg':
escapedParam = `'${params.content.replaceAll('\'', '\'\'')}'`; escapedParam = `'${params.content.replaceAll('\'', '\'\'')}'`;
break; break;
case 'sqlite':
escapedParam = `'${params.content.replaceAll('\'', '\'\'')}'`;
break;
} }
} }
else if (ARRAY.includes(params.type)) else if (ARRAY.includes(params.type))
@@ -122,6 +127,10 @@ export default (connections) => {
fileBlob = fs.readFileSync(params.content); fileBlob = fs.readFileSync(params.content);
escapedParam = `decode('${fileBlob.toString('hex')}', 'hex')`; escapedParam = `decode('${fileBlob.toString('hex')}', 'hex')`;
break; break;
case 'sqlite':
fileBlob = fs.readFileSync(params.content);
escapedParam = `X'${fileBlob.toString('hex')}'`;
break;
} }
reload = true; reload = true;
} }
@@ -134,6 +143,9 @@ export default (connections) => {
case 'pg': case 'pg':
escapedParam = 'decode(\'\', \'hex\')'; escapedParam = 'decode(\'\', \'hex\')';
break; break;
case 'sqlite':
escapedParam = 'X\'\'';
break;
} }
} }
} }
@@ -188,7 +200,7 @@ export default (connections) => {
const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary; const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary;
return typeof row[fieldName] === 'string' return typeof row[fieldName] === 'string'
? `"${row[fieldName]}"` ? `'${row[fieldName]}'`
: row[fieldName]; : row[fieldName];
}).join(','); }).join(',');

View File

@@ -40,4 +40,17 @@ export default (connections) => {
return { status: 'error', response: err.toString() }; return { status: 'error', response: err.toString() };
} }
}); });
ipcMain.handle('toggle-trigger', async (event, params) => {
try {
if (!params.enabled)
await connections[params.uid].enableTrigger(params);
else
await connections[params.uid].disableTrigger(params);
return { status: 'success' };
}
catch (err) {
return { status: 'error', response: err.toString() };
}
});
}; };

View File

@@ -2,6 +2,7 @@ import { ipcMain } from 'electron';
import { autoUpdater } from 'electron-updater'; import { autoUpdater } from 'electron-updater';
import Store from 'electron-store'; import Store from 'electron-store';
const persistentStore = new Store({ name: 'settings' }); const persistentStore = new Store({ name: 'settings' });
const isMacOS = process.platform === 'darwin';
let mainWindow; let mainWindow;
autoUpdater.allowPrerelease = persistentStore.get('allow_prerelease', true); autoUpdater.allowPrerelease = persistentStore.get('allow_prerelease', true);
@@ -11,6 +12,9 @@ export default () => {
mainWindow = event; mainWindow = event;
if (process.windowsStore || (process.platform === 'linux' && !process.env.APPIMAGE)) if (process.windowsStore || (process.platform === 'linux' && !process.env.APPIMAGE))
mainWindow.reply('no-auto-update'); mainWindow.reply('no-auto-update');
else if (isMacOS) { // Temporary solution on MacOS for unsigned app updates
autoUpdater.autoDownload = false;
}
else { else {
autoUpdater.checkForUpdatesAndNotify().catch(() => { autoUpdater.checkForUpdatesAndNotify().catch(() => {
mainWindow.reply('check-failed'); mainWindow.reply('check-failed');
@@ -28,7 +32,10 @@ export default () => {
}); });
autoUpdater.on('update-available', () => { autoUpdater.on('update-available', () => {
mainWindow.reply('update-available'); if (isMacOS)
mainWindow.reply('link-to-download');
else
mainWindow.reply('update-available');
}); });
autoUpdater.on('update-not-available', () => { autoUpdater.on('update-not-available', () => {

View File

@@ -1,6 +1,7 @@
'use strict'; 'use strict';
import { MySQLClient } from './clients/MySQLClient'; import { MySQLClient } from './clients/MySQLClient';
import { PostgreSQLClient } from './clients/PostgreSQLClient'; import { PostgreSQLClient } from './clients/PostgreSQLClient';
import { SQLiteClient } from './clients/SQLiteClient';
const queryLogger = sql => { const queryLogger = sql => {
// Remove comments, newlines and multiple spaces // Remove comments, newlines and multiple spaces
@@ -37,6 +38,8 @@ export class ClientsFactory {
return new MySQLClient(args); return new MySQLClient(args);
case 'pg': case 'pg':
return new PostgreSQLClient(args); return new PostgreSQLClient(args);
case 'sqlite':
return new SQLiteClient(args);
default: default:
throw new Error(`Unknown database client: ${args.client}`); throw new Error(`Unknown database client: ${args.client}`);
} }

View File

@@ -9,6 +9,7 @@ export class MySQLClient extends AntaresCore {
super(args); super(args);
this._schema = null; this._schema = null;
this._runningConnections = new Map();
this.types = { this.types = {
0: 'DECIMAL', 0: 'DECIMAL',
@@ -133,8 +134,20 @@ export class MySQLClient extends AntaresCore {
} }
} }
if (!this._poolSize) if (!this._poolSize) {
this._connection = await mysql.createConnection(dbConfig); this._connection = await mysql.createConnection(dbConfig);
// ANSI_QUOTES check
const res = await this.getVariable('sql_mode', 'global');
const sqlMode = res?.value.split(',');
const hasAnsiQuotes = sqlMode.includes('ANSI_QUOTES');
if (this._params.readonly)
await this.raw('SET SESSION TRANSACTION READ ONLY');
if (hasAnsiQuotes)
await this.raw(`SET SESSION sql_mode = "${sqlMode.filter(m => m !== 'ANSI_QUOTES').join(',')}"`);
}
else { else {
this._connection = mysql.createPool({ this._connection = mysql.createPool({
...dbConfig, ...dbConfig,
@@ -146,6 +159,22 @@ export class MySQLClient extends AntaresCore {
return next(); return next();
} }
}); });
// ANSI_QUOTES check
const res = await this.getVariable('sql_mode', 'global');
const sqlMode = res?.value.split(',');
const hasAnsiQuotes = sqlMode.includes('ANSI_QUOTES');
if (hasAnsiQuotes)
await this._connection.query(`SET SESSION sql_mode = "${sqlMode.filter(m => m !== 'ANSI_QUOTES').join(',')}"`);
this._connection.on('connection', connection => {
if (this._params.readonly)
connection.query('SET SESSION TRANSACTION READ ONLY');
if (hasAnsiQuotes)
connection.query(`SET SESSION sql_mode = "${sqlMode.filter(m => m !== 'ANSI_QUOTES').join(',')}"`);
});
} }
} }
@@ -187,6 +216,7 @@ export class MySQLClient extends AntaresCore {
const tablesArr = []; const tablesArr = [];
const triggersArr = []; const triggersArr = [];
let schemaSize = 0;
for (const db of filteredDatabases) { for (const db of filteredDatabases) {
if (!schemas.has(db.Database)) continue; if (!schemas.has(db.Database)) continue;
@@ -224,6 +254,9 @@ export class MySQLClient extends AntaresCore {
break; break;
} }
const tableSize = table.Data_length + table.Index_length;
schemaSize += tableSize;
return { return {
name: table.Name, name: table.Name,
type: tableType, type: tableType,
@@ -232,7 +265,7 @@ export class MySQLClient extends AntaresCore {
updated: table.Update_time, updated: table.Update_time,
engine: table.Engine, engine: table.Engine,
comment: table.Comment, comment: table.Comment,
size: table.Data_length + table.Index_length, size: tableSize,
autoIncrement: table.Auto_increment, autoIncrement: table.Auto_increment,
collation: table.Collation collation: table.Collation
}; };
@@ -276,7 +309,7 @@ export class MySQLClient extends AntaresCore {
body: scheduler.EVENT_BODY, body: scheduler.EVENT_BODY,
starts: scheduler.STARTS, starts: scheduler.STARTS,
ends: scheduler.ENDS, ends: scheduler.ENDS,
status: scheduler.STATUS, enabled: scheduler.STATUS === 'ENABLED',
executeAt: scheduler.EXECUTE_AT, executeAt: scheduler.EXECUTE_AT,
intervalField: scheduler.INTERVAL_FIELD, intervalField: scheduler.INTERVAL_FIELD,
intervalValue: scheduler.INTERVAL_VALUE, intervalValue: scheduler.INTERVAL_VALUE,
@@ -309,6 +342,7 @@ export class MySQLClient extends AntaresCore {
return { return {
name: db.Database, name: db.Database,
size: schemaSize,
tables: remappedTables, tables: remappedTables,
functions: remappedFunctions, functions: remappedFunctions,
procedures: remappedProcedures, procedures: remappedProcedures,
@@ -319,6 +353,7 @@ export class MySQLClient extends AntaresCore {
else { else {
return { return {
name: db.Database, name: db.Database,
size: 0,
tables: [], tables: [],
functions: [], functions: [],
procedures: [], procedures: [],
@@ -400,7 +435,7 @@ export class MySQLClient extends AntaresCore {
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() : field.NUMERIC_PRECISION || null;
const enumValues = /(enum|set)/.test(field.COLUMN_TYPE) const enumValues = /(enum|set)/.test(field.COLUMN_TYPE)
? field.COLUMN_TYPE.match(/\(([^)]+)\)/)[0].slice(1, -1) ? field.COLUMN_TYPE.match(/\(([^)]+)\)/)[0].slice(1, -1)
: null; : null;
@@ -408,10 +443,13 @@ export class MySQLClient extends AntaresCore {
return { return {
name: field.COLUMN_NAME, name: field.COLUMN_NAME,
key: field.COLUMN_KEY.toLowerCase(), key: field.COLUMN_KEY.toLowerCase(),
type: remappedFields ? remappedFields[field.COLUMN_NAME].type : field.DATA_TYPE, type: (remappedFields && remappedFields[field.COLUMN_NAME])
? remappedFields[field.COLUMN_NAME].type
: field.DATA_TYPE.toUpperCase(),
schema: field.TABLE_SCHEMA, schema: field.TABLE_SCHEMA,
table: field.TABLE_NAME, table: field.TABLE_NAME,
numPrecision: field.NUMERIC_PRECISION, numPrecision: field.NUMERIC_PRECISION,
numScale: field.NUMERIC_SCALE,
numLength, numLength,
enumValues, enumValues,
datePrecision: field.DATETIME_PRECISION, datePrecision: field.DATETIME_PRECISION,
@@ -420,11 +458,13 @@ export class MySQLClient extends AntaresCore {
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: remappedFields ? remappedFields[field.COLUMN_NAME].default : field.COLUMN_DEFAULT, default: (remappedFields && remappedFields[field.COLUMN_NAME]) ? remappedFields[field.COLUMN_NAME].default : field.COLUMN_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'),
onUpdate: field.EXTRA.toLowerCase().includes('on update') ? field.EXTRA.replace('on update', '') : '', onUpdate: field.EXTRA.toLowerCase().includes('on update')
? field.EXTRA.substr(field.EXTRA.indexOf('on update') + 9, field.EXTRA.length).trim()
: '',
comment: field.COLUMN_COMMENT comment: field.COLUMN_COMMENT
}; };
}); });
@@ -565,7 +605,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* CREATE DATABASE * CREATE DATABASE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createSchema (params) { async createSchema (params) {
@@ -575,7 +615,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER DATABASE * ALTER DATABASE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterSchema (params) { async alterSchema (params) {
@@ -585,7 +625,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP DATABASE * DROP DATABASE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropSchema (params) { async dropSchema (params) {
@@ -625,7 +665,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP VIEW * DROP VIEW
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropView (params) { async dropView (params) {
@@ -636,7 +676,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER VIEW * ALTER VIEW
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterView (params) { async alterView (params) {
@@ -657,7 +697,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* CREATE VIEW * CREATE VIEW
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createView (params) { async createView (params) {
@@ -690,7 +730,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP TRIGGER * DROP TRIGGER
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropTrigger (params) { async dropTrigger (params) {
@@ -701,7 +741,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER TRIGGER * ALTER TRIGGER
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterTrigger (params) { async alterTrigger (params) {
@@ -723,7 +763,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* CREATE TRIGGER * CREATE TRIGGER
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createTrigger (params) { async createTrigger (params) {
@@ -797,7 +837,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP PROCEDURE * DROP PROCEDURE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropRoutine (params) { async dropRoutine (params) {
@@ -808,7 +848,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER PROCEDURE * ALTER PROCEDURE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterRoutine (params) { async alterRoutine (params) {
@@ -830,7 +870,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* CREATE PROCEDURE * CREATE PROCEDURE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createRoutine (params) { async createRoutine (params) {
@@ -924,7 +964,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP FUNCTION * DROP FUNCTION
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropFunction (params) { async dropFunction (params) {
@@ -935,7 +975,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER FUNCTION * ALTER FUNCTION
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterFunction (params) { async alterFunction (params) {
@@ -957,7 +997,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* CREATE FUNCTION * CREATE FUNCTION
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createFunction (params) { async createFunction (params) {
@@ -1018,7 +1058,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP EVENT * DROP EVENT
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropEvent (params) { async dropEvent (params) {
@@ -1029,7 +1069,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER EVENT * ALTER EVENT
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterEvent (params) { async alterEvent (params) {
@@ -1055,7 +1095,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* CREATE EVENT * CREATE EVENT
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createEvent (params) { async createEvent (params) {
@@ -1072,6 +1112,16 @@ export class MySQLClient extends AntaresCore {
return await this.raw(sql, { split: false }); return await this.raw(sql, { split: false });
} }
async enableEvent ({ schema, scheduler }) {
const sql = `ALTER EVENT \`${schema}\`.\`${scheduler}\` ENABLE`;
return await this.raw(sql, { split: false });
}
async disableEvent ({ schema, scheduler }) {
const sql = `ALTER EVENT \`${schema}\`.\`${scheduler}\` DISABLE`;
return await this.raw(sql, { split: false });
}
/** /**
* SHOW COLLATION * SHOW COLLATION
* *
@@ -1111,6 +1161,26 @@ export class MySQLClient extends AntaresCore {
}); });
} }
/**
* SHOW VARIABLES LIKE %variable%
*
* @param {String} variable
* @param {'global'|'session'|null} level
* @returns {Object} variable
* @memberof MySQLClient
*/
async getVariable (variable, level) {
const sql = `SHOW${level ? ' ' + level.toUpperCase() : ''} VARIABLES LIKE '%${variable}%'`;
const results = await this.raw(sql);
if (results.rows.length) {
return {
name: results.rows[0].Variable_name,
value: results.rows[0].Value
};
}
}
/** /**
* SHOW ENGINES * SHOW ENGINES
* *
@@ -1182,14 +1252,30 @@ export class MySQLClient extends AntaresCore {
}); });
} }
/**
*
* @param {number} id
* @returns {Promise<null>}
*/
async killProcess (id) { async killProcess (id) {
return await this.raw(`KILL ${id}`); return await this.raw(`KILL ${id}`);
} }
/**
*
* @param {string} tabUid
* @returns {Promise<null>}
*/
async killTabQuery (tabUid) {
const id = this._runningConnections.get(tabUid);
if (id)
return await this.killProcess(id);
}
/** /**
* CREATE TABLE * CREATE TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createTable (params) { async createTable (params) {
@@ -1212,7 +1298,7 @@ export class MySQLClient extends AntaresCore {
const length = typeInfo.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false; const length = typeInfo.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false;
newColumns.push(`\`${field.name}\` newColumns.push(`\`${field.name}\`
${field.type.toUpperCase()}${length ? `(${length})` : ''} ${field.type.toUpperCase()}${length ? `(${length}${field.numScale ? `,${field.numScale}` : ''})` : ''}
${field.unsigned ? 'UNSIGNED' : ''} ${field.unsigned ? 'UNSIGNED' : ''}
${field.zerofill ? 'ZEROFILL' : ''} ${field.zerofill ? 'ZEROFILL' : ''}
${field.nullable ? 'NULL' : 'NOT NULL'} ${field.nullable ? 'NULL' : 'NOT NULL'}
@@ -1251,7 +1337,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* ALTER TABLE * ALTER TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterTable (params) { async alterTable (params) {
@@ -1281,7 +1367,7 @@ export class MySQLClient extends AntaresCore {
const length = typeInfo.length ? addition.enumValues || 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}${addition.numScale ? `,${addition.numScale}` : ''})` : ''}
${addition.unsigned ? 'UNSIGNED' : ''} ${addition.unsigned ? 'UNSIGNED' : ''}
${addition.zerofill ? 'ZEROFILL' : ''} ${addition.zerofill ? 'ZEROFILL' : ''}
${addition.nullable ? 'NULL' : 'NOT NULL'} ${addition.nullable ? 'NULL' : 'NOT NULL'}
@@ -1319,7 +1405,7 @@ export class MySQLClient extends AntaresCore {
const length = typeInfo.length ? change.enumValues || 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}${change.numScale ? `,${change.numScale}` : ''})` : ''}
${change.unsigned ? 'UNSIGNED' : ''} ${change.unsigned ? 'UNSIGNED' : ''}
${change.zerofill ? 'ZEROFILL' : ''} ${change.zerofill ? 'ZEROFILL' : ''}
${change.nullable ? 'NULL' : 'NOT NULL'} ${change.nullable ? 'NULL' : 'NOT NULL'}
@@ -1386,7 +1472,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DUPLICATE TABLE * DUPLICATE TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async duplicateTable (params) { async duplicateTable (params) {
@@ -1397,7 +1483,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* TRUNCATE TABLE * TRUNCATE TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async truncateTable (params) { async truncateTable (params) {
@@ -1408,7 +1494,7 @@ export class MySQLClient extends AntaresCore {
/** /**
* DROP TABLE * DROP TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropTable (params) { async dropTable (params) {
@@ -1507,6 +1593,9 @@ export class MySQLClient extends AntaresCore {
const isPool = typeof this._connection.getConnection === 'function'; const isPool = typeof this._connection.getConnection === 'function';
const connection = isPool ? await this._connection.getConnection() : this._connection; const connection = isPool ? await this._connection.getConnection() : this._connection;
if (args.tabUid && isPool)
this._runningConnections.set(args.tabUid, connection.connection.connectionId);
if (args.schema) if (args.schema)
await connection.query(`USE \`${args.schema}\``); await connection.query(`USE \`${args.schema}\``);
@@ -1567,7 +1656,10 @@ export class MySQLClient extends AntaresCore {
}); });
} }
catch (err) { catch (err) {
if (isPool) connection.release(); if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
reject(err); reject(err);
} }
@@ -1576,7 +1668,10 @@ export class MySQLClient extends AntaresCore {
keysArr = keysArr ? [...keysArr, ...response] : response; keysArr = keysArr ? [...keysArr, ...response] : response;
} }
catch (err) { catch (err) {
if (isPool) connection.release(); if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
reject(err); reject(err);
} }
} }
@@ -1591,7 +1686,10 @@ export class MySQLClient extends AntaresCore {
keys: keysArr keys: keysArr
}); });
}).catch((err) => { }).catch((err) => {
if (isPool) connection.release(); if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
reject(err); reject(err);
}); });
}); });
@@ -1599,7 +1697,10 @@ export class MySQLClient extends AntaresCore {
resultsArr.push({ rows, report, fields, keys, duration }); resultsArr.push({ rows, report, fields, keys, duration });
} }
if (isPool) connection.release(); if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
return resultsArr.length === 1 ? resultsArr[0] : resultsArr; return resultsArr.length === 1 ? resultsArr[0] : resultsArr;
} }

View File

@@ -9,6 +9,7 @@ function pgToString (value) {
return value.toString(); return value.toString();
} }
types.setTypeParser(20, a => parseInt(a));// bigint string to number
types.setTypeParser(1082, pgToString); // date types.setTypeParser(1082, pgToString); // date
types.setTypeParser(1083, pgToString); // time types.setTypeParser(1083, pgToString); // time
types.setTypeParser(1114, pgToString); // timestamp types.setTypeParser(1114, pgToString); // timestamp
@@ -20,6 +21,7 @@ export class PostgreSQLClient extends AntaresCore {
super(args); super(args);
this._schema = null; this._schema = null;
this._runningConnections = new Map();
this.types = {}; this.types = {};
for (const key in types.builtins) for (const key in types.builtins)
@@ -104,10 +106,19 @@ export class PostgreSQLClient extends AntaresCore {
const client = new Client(dbConfig); const client = new Client(dbConfig);
await client.connect(); await client.connect();
this._connection = client; this._connection = client;
if (this._params.readonly)
await this.raw('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
} }
else { else {
const pool = new Pool({ ...dbConfig, max: this._poolSize }); const pool = new Pool({ ...dbConfig, max: this._poolSize });
this._connection = pool; this._connection = pool;
if (this._params.readonly) {
this._connection.on('connect', connection => {
connection.query('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
});
}
} }
} }
@@ -120,15 +131,23 @@ export class PostgreSQLClient extends AntaresCore {
} }
/** /**
* Executes an "USE" query * Executes an 'SET search_path TO "${schema}"' query
* *
* @param {String} schema * @param {String} schema
* @param {Object?} connection optional
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
use (schema) { use (schema, connection) {
this._schema = schema; this._schema = schema;
if (schema)
return this.raw(`SET search_path TO "${schema}"`); if (schema) {
const sql = `SET search_path TO "${schema}"`;
if (connection === undefined)
return this.raw(sql);
else
return connection.query(sql);
}
} }
/** /**
@@ -143,6 +162,7 @@ export class PostgreSQLClient extends AntaresCore {
const tablesArr = []; const tablesArr = [];
const triggersArr = []; const triggersArr = [];
let schemaSize = 0;
for (const db of databases) { for (const db of databases) {
if (!schemas.has(db.database)) continue; if (!schemas.has(db.database)) continue;
@@ -168,19 +188,20 @@ export class PostgreSQLClient extends AntaresCore {
} }
let { rows: triggers } = await this.raw(` let { rows: triggers } = await this.raw(`
SELECT event_object_schema AS table_schema, SELECT
event_object_table AS table_name, pg_class.relname AS table_name,
trigger_schema, pg_trigger.tgname AS trigger_name,
trigger_name, pg_namespace.nspname AS trigger_schema,
string_agg(event_manipulation, ',') AS event, (pg_trigger.tgenabled != 'D')::bool AS enabled
action_timing AS activation, FROM pg_trigger
action_condition AS condition, JOIN pg_class ON pg_trigger.tgrelid = pg_class.oid
action_statement AS definition JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
FROM information_schema.triggers JOIN information_schema.triggers ON information_schema.triggers.trigger_schema = pg_namespace.nspname
AND information_schema.triggers.event_object_table = pg_class.relname
AND information_schema.triggers.trigger_name = pg_trigger.tgname
WHERE trigger_schema = '${db.database}' WHERE trigger_schema = '${db.database}'
GROUP BY 1,2,3,4,6,7,8 GROUP BY 1, 2, 3, 4
ORDER BY table_schema, ORDER BY table_name
table_name
`); `);
if (triggers.length) { if (triggers.length) {
@@ -196,11 +217,14 @@ export class PostgreSQLClient extends AntaresCore {
if (schemas.has(db.database)) { if (schemas.has(db.database)) {
// TABLES // TABLES
const remappedTables = tablesArr.filter(table => table.Db === db.database).map(table => { const remappedTables = tablesArr.filter(table => table.Db === db.database).map(table => {
const tableSize = +table.data_length + table.index_length;
schemaSize += tableSize;
return { return {
name: table.table_name, name: table.table_name,
type: table.table_type === 'VIEW' ? 'view' : 'table', type: table.table_type === 'VIEW' ? 'view' : 'table',
rows: table.reltuples, rows: table.reltuples,
size: +table.data_length + +table.index_length, size: tableSize,
collation: table.Collation, collation: table.Collation,
comment: table.comment, comment: table.comment,
engine: '' engine: ''
@@ -239,17 +263,16 @@ export class PostgreSQLClient extends AntaresCore {
return { return {
name: `${trigger.table_name}.${trigger.trigger_name}`, name: `${trigger.table_name}.${trigger.trigger_name}`,
orgName: trigger.trigger_name, orgName: trigger.trigger_name,
timing: trigger.activation,
definer: '', definer: '',
definition: trigger.definition,
event: trigger.event,
table: trigger.table_name, table: trigger.table_name,
sqlMode: '' sqlMode: '',
enabled: trigger.enabled
}; };
}); });
return { return {
name: db.database, name: db.database,
size: schemaSize,
tables: remappedTables, tables: remappedTables,
functions: remappedFunctions, functions: remappedFunctions,
procedures: remappedProcedures, procedures: remappedProcedures,
@@ -261,6 +284,7 @@ export class PostgreSQLClient extends AntaresCore {
else { else {
return { return {
name: db.database, name: db.database,
size: 0,
tables: [], tables: [],
functions: [], functions: [],
procedures: [], procedures: [],
@@ -302,6 +326,7 @@ export class PostgreSQLClient extends AntaresCore {
isArray, isArray,
schema: field.table_schema, schema: field.table_schema,
table: field.table_name, table: field.table_name,
numScale: field.numeric_scale,
numPrecision: field.numeric_precision, numPrecision: field.numeric_precision,
datePrecision: field.datetime_precision, datePrecision: field.datetime_precision,
charLength: field.character_maximum_length, charLength: field.character_maximum_length,
@@ -500,7 +525,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* CREATE SCHEMA * CREATE SCHEMA
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async createSchema (params) { async createSchema (params) {
@@ -510,7 +535,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* ALTER DATABASE * ALTER DATABASE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async alterSchema (params) { async alterSchema (params) {
@@ -520,7 +545,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* DROP DATABASE * DROP DATABASE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof MySQLClient * @memberof MySQLClient
*/ */
async dropSchema (params) { async dropSchema (params) {
@@ -552,7 +577,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* DROP VIEW * DROP VIEW
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async dropView (params) { async dropView (params) {
@@ -563,7 +588,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* ALTER VIEW * ALTER VIEW
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async alterView (params) { async alterView (params) {
@@ -579,7 +604,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* CREATE VIEW * CREATE VIEW
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async createView (params) { async createView (params) {
@@ -597,19 +622,25 @@ export class PostgreSQLClient extends AntaresCore {
const [table, triggerName] = trigger.split('.'); const [table, triggerName] = trigger.split('.');
const results = await this.raw(` const results = await this.raw(`
SELECT event_object_schema AS table_schema, SELECT
event_object_table AS table_name, information_schema.triggers.event_object_schema AS table_schema,
trigger_schema, information_schema.triggers.event_object_table AS table_name,
trigger_name, information_schema.triggers.trigger_schema,
string_agg(event_manipulation, ',') AS event, information_schema.triggers.trigger_name,
string_agg(event_manipulation, ',') AS EVENT,
action_timing AS activation, action_timing AS activation,
action_condition AS condition, action_condition AS condition,
action_statement AS definition action_statement AS definition,
FROM information_schema.triggers (pg_trigger.tgenabled != 'D')::bool AS enabled
FROM pg_trigger
JOIN pg_class ON pg_trigger.tgrelid = pg_class.oid
JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
JOIN information_schema.triggers ON pg_namespace.nspname = information_schema.triggers.trigger_schema
AND pg_class.relname = information_schema.triggers.event_object_table
WHERE trigger_schema = '${schema}' WHERE trigger_schema = '${schema}'
AND trigger_name = '${triggerName}' AND trigger_name = '${triggerName}'
AND event_object_table = '${table}' AND event_object_table = '${table}'
GROUP BY 1,2,3,4,6,7,8 GROUP BY 1,2,3,4,6,7,8,9
ORDER BY table_schema, ORDER BY table_schema,
table_name table_name
`); `);
@@ -619,7 +650,7 @@ export class PostgreSQLClient extends AntaresCore {
sql: row.definition, sql: row.definition,
name: row.trigger_name, name: row.trigger_name,
table: row.table_name, table: row.table_name,
event: row.event.split(','), event: [...new Set(row.event.split(','))],
activation: row.activation activation: row.activation
}; };
})[0]; })[0];
@@ -628,7 +659,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* DROP TRIGGER * DROP TRIGGER
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async dropTrigger (params) { async dropTrigger (params) {
@@ -640,7 +671,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* ALTER TRIGGER * ALTER TRIGGER
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async alterTrigger (params) { async alterTrigger (params) {
@@ -662,7 +693,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* CREATE TRIGGER * CREATE TRIGGER
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async createTrigger (params) { async createTrigger (params) {
@@ -671,6 +702,18 @@ export class PostgreSQLClient extends AntaresCore {
return await this.raw(sql, { split: false }); return await this.raw(sql, { split: false });
} }
async enableTrigger ({ schema, trigger }) {
const [table, triggerName] = trigger.split('.');
const sql = `ALTER TABLE "${schema}"."${table}" ENABLE TRIGGER "${triggerName}"`;
return await this.raw(sql, { split: false });
}
async disableTrigger ({ schema, trigger }) {
const [table, triggerName] = trigger.split('.');
const sql = `ALTER TABLE "${schema}"."${table}" DISABLE TRIGGER "${triggerName}"`;
return await this.raw(sql, { split: false });
}
/** /**
* SHOW CREATE PROCEDURE * SHOW CREATE PROCEDURE
* *
@@ -1055,14 +1098,30 @@ export class PostgreSQLClient extends AntaresCore {
}); });
} }
/**
*
* @param {number} id
* @returns {Promise<null>}
*/
async killProcess (id) { async killProcess (id) {
return await this.raw(`SELECT pg_terminate_backend(${id})`); return await this.raw(`SELECT pg_terminate_backend(${id})`);
} }
/**
*
* @param {string} tabUid
* @returns {Promise<null>}
*/
async killTabQuery (tabUid) {
const id = this._runningConnections.get(tabUid);
if (id)
return await this.raw(`SELECT pg_cancel_backend(${id})`);
}
/** /**
* CREATE TABLE * CREATE TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async createTable (params) { async createTable (params) {
@@ -1086,7 +1145,7 @@ export class PostgreSQLClient extends AntaresCore {
const length = typeInfo.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false; const length = typeInfo.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false;
newColumns.push(`"${field.name}" newColumns.push(`"${field.name}"
${field.type.toUpperCase()}${length ? `(${length})` : ''} ${field.type.toUpperCase()}${length ? `(${length}${field.numScale !== null ? `,${field.numScale}` : ''})` : ''}
${field.unsigned ? 'UNSIGNED' : ''} ${field.unsigned ? 'UNSIGNED' : ''}
${field.zerofill ? 'ZEROFILL' : ''} ${field.zerofill ? 'ZEROFILL' : ''}
${field.nullable ? 'NULL' : 'NOT NULL'} ${field.nullable ? 'NULL' : 'NOT NULL'}
@@ -1120,7 +1179,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* ALTER TABLE * ALTER TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async alterTable (params) { async alterTable (params) {
@@ -1150,7 +1209,7 @@ export class PostgreSQLClient extends AntaresCore {
const length = typeInfo.length ? addition.numLength || addition.charLength || addition.datePrecision : false; const length = typeInfo.length ? 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.isArray ? '[]' : ''} ${addition.type.toUpperCase()}${length ? `(${length}${addition.numScale !== null ? `,${addition.numScale}` : ''})` : ''}${addition.isArray ? '[]' : ''}
${addition.unsigned ? 'UNSIGNED' : ''} ${addition.unsigned ? 'UNSIGNED' : ''}
${addition.zerofill ? 'ZEROFILL' : ''} ${addition.zerofill ? 'ZEROFILL' : ''}
${addition.nullable ? 'NULL' : 'NOT NULL'} ${addition.nullable ? 'NULL' : 'NOT NULL'}
@@ -1196,7 +1255,7 @@ export class PostgreSQLClient extends AntaresCore {
localType = change.type.toLowerCase(); localType = change.type.toLowerCase();
} }
alterColumns.push(`ALTER COLUMN "${change.name}" TYPE ${localType}${length ? `(${length})` : ''}${change.isArray ? '[]' : ''} USING "${change.name}"::${localType}`); alterColumns.push(`ALTER COLUMN "${change.name}" TYPE ${localType}${length ? `(${length}${change.numScale ? `,${change.numScale}` : ''})` : ''}${change.isArray ? '[]' : ''} USING "${change.name}"::${localType}`);
alterColumns.push(`ALTER COLUMN "${change.name}" ${change.nullable ? 'DROP NOT NULL' : 'SET NOT NULL'}`); alterColumns.push(`ALTER COLUMN "${change.name}" ${change.nullable ? 'DROP NOT NULL' : 'SET NOT NULL'}`);
alterColumns.push(`ALTER COLUMN "${change.name}" ${change.default ? `SET DEFAULT ${change.default}` : 'DROP DEFAULT'}`); alterColumns.push(`ALTER COLUMN "${change.name}" ${change.default ? `SET DEFAULT ${change.default}` : 'DROP DEFAULT'}`);
@@ -1266,7 +1325,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* DUPLICATE TABLE * DUPLICATE TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async duplicateTable (params) { async duplicateTable (params) {
@@ -1277,7 +1336,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* TRUNCATE TABLE * TRUNCATE TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async truncateTable (params) { async truncateTable (params) {
@@ -1288,7 +1347,7 @@ export class PostgreSQLClient extends AntaresCore {
/** /**
* DROP TABLE * DROP TABLE
* *
* @returns {Array.<Object>} parameters * @returns {Promise<null>}
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
async dropTable (params) { async dropTable (params) {
@@ -1363,6 +1422,8 @@ export class PostgreSQLClient extends AntaresCore {
* @memberof PostgreSQLClient * @memberof PostgreSQLClient
*/ */
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,
@@ -1371,9 +1432,6 @@ export class PostgreSQLClient extends AntaresCore {
...args ...args
}; };
if (args.schema && args.schema !== 'public')
await this.use(args.schema);
if (!args.comments) if (!args.comments)
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
@@ -1385,7 +1443,14 @@ export class PostgreSQLClient extends AntaresCore {
.map(q => q.trim()) .map(q => q.trim())
: [sql]; : [sql];
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder const isPool = this._connection instanceof Pool;
const connection = isPool ? await this._connection.connect() : this._connection;
if (args.tabUid && isPool)
this._runningConnections.set(args.tabUid, connection.processID);
if (args.schema && args.schema !== 'public')
await this.use(args.schema, connection);
for (const query of queries) { for (const query of queries) {
if (!query) continue; if (!query) continue;
@@ -1395,15 +1460,12 @@ export class PostgreSQLClient 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({ (async () => {
rowMode: args.nest ? 'array' : null, try {
text: query const res = await connection.query({ rowMode: args.nest ? 'array' : null, text: query });
}, async (err, res) => {
timeStop = new Date(); timeStop = new Date();
if (err)
reject(err);
else {
let ast; let ast;
try { try {
@@ -1492,6 +1554,10 @@ export class PostgreSQLClient extends AntaresCore {
}); });
} }
catch (err) { catch (err) {
if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
reject(err); reject(err);
} }
@@ -1500,6 +1566,10 @@ export class PostgreSQLClient extends AntaresCore {
keysArr = keysArr ? [...keysArr, ...response] : response; keysArr = keysArr ? [...keysArr, ...response] : response;
} }
catch (err) { catch (err) {
if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
reject(err); reject(err);
} }
} }
@@ -1514,12 +1584,24 @@ export class PostgreSQLClient extends AntaresCore {
keys: keysArr keys: keysArr
}); });
} }
}); catch (err) {
if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
reject(err);
}
})();
}); });
resultsArr.push({ rows, report, fields, keys, duration }); resultsArr.push({ rows, report, fields, keys, duration });
} }
if (isPool) {
connection.release();
this._runningConnections.delete(args.tabUid);
}
return resultsArr.length === 1 ? resultsArr[0] : resultsArr; return resultsArr.length === 1 ? resultsArr[0] : resultsArr;
} }
} }

View File

@@ -0,0 +1,806 @@
'use strict';
import sqlite from 'better-sqlite3';
import { AntaresCore } from '../AntaresCore';
import dataTypes from 'common/data-types/sqlite';
import { NUMBER, FLOAT, TIME, DATETIME } from 'common/fieldTypes';
export class SQLiteClient extends AntaresCore {
constructor (args) {
super(args);
this._schema = null;
}
_getTypeInfo (type) {
return dataTypes
.reduce((acc, group) => [...acc, ...group.types], [])
.filter(_type => _type.name === type.toUpperCase())[0];
}
/**
* @memberof SQLiteClient
*/
async connect () {
this._connection = sqlite(this._params.databasePath, {
fileMustExist: true,
readonly: this._params.readonly
});
}
/**
* @memberof SQLiteClient
*/
destroy () {}
/**
* Executes an USE query
*
* @memberof SQLiteClient
*/
use () {}
/**
* @param {Array} schemas list
* @returns {Array.<Object>} databases scructure
* @memberof SQLiteClient
*/
async getStructure (schemas) {
const { rows: databases } = await this.raw('SELECT * FROM pragma_database_list');
const filteredDatabases = databases;
const tablesArr = [];
const triggersArr = [];
let schemaSize = 0;
for (const db of filteredDatabases) {
if (!schemas.has(db.name)) continue;
let { rows: tables } = await this.raw(`
SELECT *
FROM "${db.name}".sqlite_master
WHERE type IN ('table', 'view')
AND name NOT LIKE 'sqlite_%'
ORDER BY name
`);
if (tables.length) {
tables = tables.map(table => {
table.Db = db.name;
return table;
});
tablesArr.push(...tables);
}
let { rows: triggers } = await this.raw(`SELECT * FROM "${db.name}".sqlite_master WHERE type='trigger'`);
if (triggers.length) {
triggers = triggers.map(trigger => {
trigger.Db = db.name;
return trigger;
});
triggersArr.push(...triggers);
}
}
return filteredDatabases.map(db => {
if (schemas.has(db.name)) {
// TABLES
const remappedTables = tablesArr.filter(table => table.Db === db.name).map(table => {
const tableSize = 0;
schemaSize += tableSize;
return {
name: table.name,
type: table.type,
rows: false,
size: false
};
});
// TRIGGERS
const remappedTriggers = triggersArr.filter(trigger => trigger.Db === db.name).map(trigger => {
return {
name: trigger.name,
table: trigger.tbl_name
};
});
return {
name: db.name,
size: schemaSize,
tables: remappedTables,
functions: [],
procedures: [],
triggers: remappedTriggers,
schedulers: []
};
}
else {
return {
name: db.name,
size: 0,
tables: [],
functions: [],
procedures: [],
triggers: [],
schedulers: []
};
}
});
}
/**
* @param {Object} params
* @param {String} params.schema
* @param {String} params.table
* @returns {Object} table scructure
* @memberof SQLiteClient
*/
async getTableColumns ({ schema, table }) {
const { rows: fields } = await this.raw(`SELECT * FROM "${schema}".pragma_table_info('${table}')`);
return fields.map(field => {
const [type, length] = field.type.includes('(')
? field.type.replace(')', '').split('(').map(el => {
if (!isNaN(el)) el = +el;
return el;
})
: [field.type, null];
return {
name: field.name,
key: null,
type: type.trim(),
schema: schema,
table: table,
numPrecision: [...NUMBER, ...FLOAT].includes(type) ? length : null,
datePrecision: null,
charLength: ![...NUMBER, ...FLOAT].includes(type) ? length : null,
nullable: !field.notnull,
unsigned: null,
zerofill: null,
order: field.cid + 1,
default: field.dflt_value,
charset: null,
collation: null,
autoIncrement: false,
onUpdate: null,
comment: ''
};
});
}
/**
* @param {Object} params
* @param {String} params.schema
* @param {String} params.table
* @returns {Object} table row count
* @memberof SQLiteClient
*/
async getTableApproximateCount ({ schema, table }) {
const { rows } = await this.raw(`SELECT COUNT(*) AS count FROM "${schema}"."${table}"`);
return rows.length ? rows[0].count : 0;
}
/**
* @param {Object} params
* @param {String} params.schema
* @param {String} params.table
* @returns {Object} table options
* @memberof SQLiteClient
*/
async getTableOptions ({ schema, table }) {
return { name: table };
}
/**
* @param {Object} params
* @param {String} params.schema
* @param {String} params.table
* @returns {Object} table indexes
* @memberof SQLiteClient
*/
async getTableIndexes ({ schema, table }) {
const remappedIndexes = [];
const { rows: primaryKeys } = await this.raw(`SELECT * FROM "${schema}".pragma_table_info('${table}') WHERE pk != 0`);
for (const key of primaryKeys) {
remappedIndexes.push({
name: 'PRIMARY',
column: key.name,
indexType: null,
type: 'PRIMARY',
cardinality: null,
comment: '',
indexComment: ''
});
}
const { rows: indexes } = await this.raw(`SELECT * FROM "${schema}".pragma_index_list('${table}');`);
for (const index of indexes) {
const { rows: details } = await this.raw(`SELECT * FROM "${schema}".pragma_index_info('${index.name}');`);
for (const detail of details) {
remappedIndexes.push({
name: index.name,
column: detail.name,
indexType: null,
type: index.unique === 1 ? 'UNIQUE' : 'INDEX',
cardinality: null,
comment: '',
indexComment: ''
});
}
}
return remappedIndexes;
}
/**
* @param {Object} params
* @param {String} params.schema
* @param {String} params.table
* @returns {Object} table key usage
* @memberof SQLiteClient
*/
async getKeyUsage ({ schema, table }) {
const { rows } = await this.raw(`SELECT * FROM "${schema}".pragma_foreign_key_list('${table}');`);
return rows.map(field => {
return {
schema: schema,
table: table,
field: field.from,
position: field.id + 1,
constraintPosition: null,
constraintName: field.id,
refSchema: schema,
refTable: field.table,
refField: field.to,
onUpdate: field.on_update,
onDelete: field.on_delete
};
});
}
async getUsers () {}
/**
* SHOW CREATE VIEW
*
* @returns {Array.<Object>} view informations
* @memberof SQLiteClient
*/
async getViewInformations ({ schema, view }) {
const sql = `SELECT "sql" FROM "${schema}".sqlite_master WHERE "type"='view' AND name='${view}'`;
const results = await this.raw(sql);
return results.rows.map(row => {
return {
sql: row.sql.match(/(?<=AS ).*?$/gs)[0],
name: view
};
})[0];
}
/**
* DROP VIEW
*
* @returns {Array.<Object>} parameters
* @memberof SQLiteClient
*/
async dropView (params) {
const sql = `DROP VIEW "${params.schema}"."${params.view}"`;
return await this.raw(sql);
}
/**
* ALTER VIEW
*
* @returns {Array.<Object>} parameters
* @memberof SQLiteClient
*/
async alterView (params) {
const { view } = params;
try {
await this.dropView({ schema: view.schema, view: view.oldName });
await this.createView(view);
}
catch (err) {
return Promise.reject(err);
}
}
/**
* CREATE VIEW
*
* @returns {Array.<Object>} parameters
* @memberof SQLiteClient
*/
async createView (params) {
const sql = `CREATE VIEW "${params.schema}"."${params.name}" AS ${params.sql}`;
return await this.raw(sql);
}
/**
* SHOW CREATE TRIGGER
*
* @returns {Array.<Object>} view informations
* @memberof SQLiteClient
*/
async getTriggerInformations ({ schema, trigger }) {
const sql = `SELECT "sql" FROM "${schema}".sqlite_master WHERE "type"='trigger' AND name='${trigger}'`;
const results = await this.raw(sql);
return results.rows.map(row => {
return {
sql: row.sql.match(/(BEGIN|begin)(.*)(END|end)/gs)[0],
name: trigger,
table: row.sql.match(/(?<=ON `).*?(?=`)/gs)[0],
activation: row.sql.match(/(BEFORE|AFTER)/gs)[0],
event: row.sql.match(/(INSERT|UPDATE|DELETE)/gs)[0]
};
})[0];
}
/**
* DROP TRIGGER
*
* @returns {Array.<Object>} parameters
* @memberof SQLiteClient
*/
async dropTrigger (params) {
const sql = `DROP TRIGGER \`${params.schema}\`.\`${params.trigger}\``;
return await this.raw(sql);
}
/**
* ALTER TRIGGER
*
* @returns {Array.<Object>} parameters
* @memberof SQLiteClient
*/
async alterTrigger (params) {
const { trigger } = params;
const tempTrigger = Object.assign({}, trigger);
tempTrigger.name = `Antares_${tempTrigger.name}_tmp`;
try {
await this.createTrigger(tempTrigger);
await this.dropTrigger({ schema: trigger.schema, trigger: tempTrigger.name });
await this.dropTrigger({ schema: trigger.schema, trigger: trigger.oldName });
await this.createTrigger(trigger);
}
catch (err) {
return Promise.reject(err);
}
}
/**
* CREATE TRIGGER
*
* @returns {Array.<Object>} parameters
* @memberof SQLiteClient
*/
async createTrigger (params) {
const sql = `CREATE ${params.definer ? `DEFINER=${params.definer} ` : ''}TRIGGER \`${params.schema}\`.\`${params.name}\` ${params.activation} ${params.event} ON \`${params.table}\` FOR EACH ROW ${params.sql}`;
return await this.raw(sql, { split: false });
}
/**
* SHOW COLLATION
*
* @returns {Array.<Object>} collations list
* @memberof SQLiteClient
*/
async getCollations () {
return [];
}
/**
* SHOW VARIABLES
*
* @returns {Array.<Object>} variables list
* @memberof SQLiteClient
*/
async getVariables () {
return [];
}
/**
* SHOW ENGINES
*
* @returns {Array.<Object>} engines list
* @memberof SQLiteClient
*/
async getEngines () {
return {
name: 'SQLite',
support: 'YES',
comment: '',
isDefault: true
};
}
/**
* SHOW VARIABLES LIKE '%vers%'
*
* @returns {Array.<Object>} version parameters
* @memberof SQLiteClient
*/
async getVersion () {
const os = require('os');
const sql = 'SELECT sqlite_version() AS version';
const { rows } = await this.raw(sql);
return {
number: rows[0].version,
name: 'SQLite',
arch: process.arch,
os: `${os.type()} ${os.release()}`
};
}
async getProcesses () {}
async killProcess () {}
/**
* CREATE TABLE
*
* @returns {Promise<null>}
* @memberof SQLiteClient
*/
async createTable (params) {
const {
schema,
fields,
foreigns,
indexes,
options
} = params;
const newColumns = [];
const newIndexes = [];
const manageIndexes = [];
const newForeigns = [];
let sql = `CREATE TABLE "${schema}"."${options.name}"`;
// ADD FIELDS
fields.forEach(field => {
const typeInfo = this._getTypeInfo(field.type);
const length = typeInfo?.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false;
newColumns.push(`"${field.name}"
${field.type.toUpperCase()}${length && length !== true ? `(${length})` : ''}
${field.unsigned ? 'UNSIGNED' : ''}
${field.nullable ? 'NULL' : 'NOT NULL'}
${field.autoIncrement ? 'AUTO_INCREMENT' : ''}
${field.default ? `DEFAULT ${field.default}` : ''}
${field.onUpdate ? `ON UPDATE ${field.onUpdate}` : ''}`);
});
// ADD INDEX
indexes.forEach(index => {
const fields = index.fields.map(field => `"${field}"`).join(',');
const type = index.type;
if (type === 'PRIMARY')
newIndexes.push(`PRIMARY KEY (${fields})`);
else
manageIndexes.push(`CREATE ${type === 'UNIQUE' ? type : ''} INDEX "${index.name}" ON "${options.name}" (${fields})`);
});
// ADD FOREIGN KEYS
foreigns.forEach(foreign => {
newForeigns.push(`CONSTRAINT "${foreign.constraintName}" FOREIGN KEY ("${foreign.field}") REFERENCES "${foreign.refTable}" ("${foreign.refField}") ON UPDATE ${foreign.onUpdate} ON DELETE ${foreign.onDelete}`);
});
sql = `${sql} (${[...newColumns, ...newIndexes, ...newForeigns].join(', ')})`;
if (manageIndexes.length) sql = `${sql}; ${manageIndexes.join(';')}`;
return await this.raw(sql);
}
/**
* ALTER TABLE
*
* @returns {Promise<null>}
* @memberof SQLiteClient
*/
async alterTable (params) {
try {
await this.raw('BEGIN TRANSACTION');
await this.raw('PRAGMA foreign_keys = 0');
const tmpName = `Antares_${params.table}_tmp`;
await this.raw(`CREATE TABLE "${tmpName}" AS SELECT * FROM "${params.table}"`);
await this.dropTable(params);
const createTableParams = {
schema: params.schema,
fields: params.tableStructure.fields,
foreigns: params.tableStructure.foreigns,
indexes: params.tableStructure.indexes.filter(index => !index.name.includes('sqlite_autoindex')),
options: { name: params.tableStructure.name }
};
await this.createTable(createTableParams);
const insertFields = createTableParams.fields
.filter(field => {
return (
params.additions.every(add => add.name !== field.name) &&
params.deletions.every(del => del.name !== field.name)
);
})
.reduce((acc, curr) => {
acc.push(`"${curr.name}"`);
return acc;
}, []);
const selectFields = insertFields.map(field => {
const renamedField = params.changes.find(change => `"${change.name}"` === field);
if (renamedField)
return `"${renamedField.orgName}"`;
return field;
});
await this.raw(`INSERT INTO "${createTableParams.options.name}" (${insertFields.join(',')}) SELECT ${selectFields.join(',')} FROM "${tmpName}"`);
await this.dropTable({ schema: params.schema, table: tmpName });
await this.raw('PRAGMA foreign_keys = 1');
await this.raw('COMMIT');
}
catch (err) {
await this.raw('ROLLBACK');
return Promise.reject(err);
}
}
/**
* DUPLICATE TABLE
*
* @returns {Promise<null>}
* @memberof SQLiteClient
*/
async duplicateTable (params) { // TODO: retrive table informations and create a copy
const sql = `CREATE TABLE "${params.schema}"."${params.table}_copy" AS SELECT * FROM "${params.schema}"."${params.table}"`;
return await this.raw(sql);
}
/**
* TRUNCATE TABLE
*
* @returns {Promise<null>}
* @memberof SQLiteClient
*/
async truncateTable (params) {
const sql = `DELETE FROM "${params.schema}"."${params.table}"`;
return await this.raw(sql);
}
/**
* DROP TABLE
*
* @returns {Promise<null>}
* @memberof SQLiteClient
*/
async dropTable (params) {
const sql = `DROP TABLE "${params.schema}"."${params.table}"`;
return await this.raw(sql);
}
/**
* @returns {String} SQL string
* @memberof SQLiteClient
*/
getSQL () {
// SELECT
const selectArray = this._query.select.reduce(this._reducer, []);
let selectRaw = '';
if (selectArray.length)
selectRaw = selectArray.length ? `SELECT ${selectArray.join(', ')} ` : 'SELECT * ';
// FROM
let fromRaw = '';
if (!this._query.update.length && !Object.keys(this._query.insert).length && !!this._query.from)
fromRaw = 'FROM';
else if (Object.keys(this._query.insert).length)
fromRaw = 'INTO';
fromRaw += this._query.from ? ` ${this._query.schema ? `"${this._query.schema}".` : ''}"${this._query.from}" ` : '';
// WHERE
const whereArray = this._query.where
.reduce(this._reducer, [])
?.map(clausole => clausole.replace('= null', 'IS NULL'));
const whereRaw = whereArray.length ? `WHERE ${whereArray.join(' AND ')} ` : '';
// UPDATE
const updateArray = this._query.update.reduce(this._reducer, []);
const updateRaw = updateArray.length ? `SET ${updateArray.join(', ')} ` : '';
// INSERT
let insertRaw = '';
if (this._query.insert.length) {
const fieldsList = Object.keys(this._query.insert[0]);
const rowsList = this._query.insert.map(el => `(${Object.values(el).join(', ')})`);
insertRaw = `(${fieldsList.join(', ')}) VALUES ${rowsList.join(', ')} `;
}
// GROUP BY
const groupByArray = this._query.groupBy.reduce(this._reducer, []);
const groupByRaw = groupByArray.length ? `GROUP BY ${groupByArray.join(', ')} ` : '';
// ORDER BY
const orderByArray = this._query.orderBy.reduce(this._reducer, []);
const orderByRaw = orderByArray.length ? `ORDER BY ${orderByArray.join(', ')} ` : '';
// LIMIT
const limitRaw = this._query.limit.length ? `LIMIT ${this._query.limit.join(', ')} ` : '';
// 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}`;
}
/**
* @param {string} sql raw SQL query
* @param {object} args
* @param {boolean} args.nest
* @param {boolean} args.details
* @param {boolean} args.split
* @returns {Promise}
* @memberof SQLiteClient
*/
async raw (sql, args) {
if (process.env.NODE_ENV === 'development') this._logger(sql);// TODO: replace BLOB content with a placeholder
args = {
nest: false,
details: false,
split: true,
comments: true,
...args
};
if (!args.comments)
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
const resultsArr = [];
let paramsArr = [];
const queries = args.split
? sql.split(/((?:[^;'"]*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*')[^;'"]*)+)|;/gm)
.filter(Boolean)
.map(q => q.trim())
: [sql];
const connection = this._connection;
for (const query of queries) {
if (!query) continue;
const timeStart = new Date();
let timeStop;
const keysArr = [];
const { rows, report, fields, keys, duration } = await new Promise((resolve, reject) => {
(async () => {
let queryResult;
let affectedRows;
let fields;
const detectedTypes = {};
try {
const stmt = connection.prepare(query);
if (stmt.reader) {
queryResult = stmt.all();
fields = stmt.columns();
if (queryResult.length) {
fields.forEach(field => {
detectedTypes[field.name] = typeof queryResult[0][field.name];
});
}
}
else {
const info = queryResult = stmt.run();
affectedRows = info.changes;
}
}
catch (err) {
reject(err);
}
timeStop = new Date();
let remappedFields = fields
? fields.map(field => {
let [parsedType, length] = field.type?.includes('(')
? field.type.replace(')', '').split('(').map(el => {
if (!isNaN(el))
el = +el;
else
el = el.trim();
return el;
})
: [field.type, null];
if ([...TIME, ...DATETIME].includes(parsedType)) {
const firstNotNull = queryResult.find(res => res[field.name] !== null);
if (firstNotNull && firstNotNull[field.name].includes('.'))
length = firstNotNull[field.name].split('.').pop().length;
}
return {
name: field.name,
alias: field.name,
orgName: field.column,
schema: field.database,
table: field.table,
tableAlias: field.table,
orgTable: field.table,
type: field.type !== null ? parsedType : detectedTypes[field.name],
length
};
}).filter(Boolean)
: [];
if (args.details) {
paramsArr = remappedFields.map(field => {
return {
table: field.table,
schema: field.schema
};
}).filter((val, i, arr) => arr.findIndex(el => el.schema === val.schema && el.table === val.table) === i);
for (const paramObj of paramsArr) {
if (!paramObj.table || !paramObj.schema) continue;
try {
const indexes = await this.getTableIndexes(paramObj);
remappedFields = remappedFields.map(field => {
// const detailedField = columns.find(f => f.name === field.name);
const fieldIndex = indexes.find(i => i.column === field.name);
if (field.table === paramObj.table && field.schema === paramObj.schema) {
// if (detailedField) {
// const length = detailedField.numPrecision || detailedField.charLength || detailedField.datePrecision || null;
// field = { ...field, ...detailedField, length };
// }
if (fieldIndex) {
const key = fieldIndex.type === 'PRIMARY' ? 'pri' : fieldIndex.type === 'UNIQUE' ? 'uni' : 'mul';
field = { ...field, key };
};
}
return field;
});
}
catch (err) {
reject(err);
}
}
}
resolve({
duration: timeStop - timeStart,
rows: Array.isArray(queryResult) ? queryResult.some(el => Array.isArray(el)) ? [] : queryResult : false,
report: affectedRows !== undefined ? { affectedRows } : null,
fields: remappedFields,
keys: keysArr
});
})();
});
resultsArr.push({ rows, report, fields, keys, duration });
}
return resultsArr.length === 1 ? resultsArr[0] : resultsArr;
}
}

177
src/main/main.js Normal file
View File

@@ -0,0 +1,177 @@
'use strict';
import { app, BrowserWindow, /* session, */ nativeImage, Menu } from 'electron';
import * as path from 'path';
import Store from 'electron-store';
import * as windowStateKeeper from 'electron-window-state';
import * as remoteMain from '@electron/remote/main';
import ipcHandlers from './ipc-handlers';
// remoteMain.initialize();
Store.initRenderer();
const isDevelopment = process.env.NODE_ENV !== 'production';
const isMacOS = process.platform === 'darwin';
const isWindows = process.platform === 'win32';
const gotTheLock = app.requestSingleInstanceLock();
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
// global reference to mainWindow (necessary to prevent window from being garbage collected)
let mainWindow;
let mainWindowState;
async function createMainWindow () {
const icon = require('../renderer/images/logo-32.png');
const window = new BrowserWindow({
width: mainWindowState.width,
height: mainWindowState.height,
x: mainWindowState.x,
y: mainWindowState.y,
minWidth: 900,
minHeight: 550,
title: 'Antares SQL',
autoHideMenuBar: true,
show: !isWindows, // Temporary workaround to https://github.com/electron/electron/issues/30024
icon: nativeImage.createFromDataURL(icon.default),
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
'web-security': false,
spellcheck: false
},
frame: false,
titleBarStyle: isMacOS ? 'hidden' : 'default',
trafficLightPosition: isMacOS ? { x: 10, y: 8 } : undefined,
backgroundColor: '#1d1d1d'
});
mainWindowState.manage(window);
window.on('moved', saveWindowState);
remoteMain.enable(window.webContents);
try {
if (isDevelopment) {
const { default: installExtension, VUEJS3_DEVTOOLS } = require('electron-devtools-installer');
const options = {
loadExtensionOptions: { allowFileAccess: true }
};
try {
const name = await installExtension(VUEJS3_DEVTOOLS, options);
console.log(`Added Extension: ${name}`);
}
catch (err) {
console.log('An error occurred: ', err);
}
await window.loadURL('http://localhost:9080');
}
else {
const indexPath = path.resolve(__dirname, 'index.html');
await window.loadFile(indexPath);
}
}
catch (err) {
console.log(err);
}
window.on('closed', () => {
window.removeListener('moved', saveWindowState);
mainWindow = null;
});
return window;
}
if (!gotTheLock) app.quit();
else {
require('@electron/remote/main').initialize();
// Initialize ipcHandlers
ipcHandlers();
// quit application when all windows are closed
app.on('window-all-closed', () => {
// on macOS it is common for applications to stay open until the user explicitly quits
if (isMacOS) app.quit();
});
app.on('activate', async () => {
// on macOS it is common to re-create a window even after all windows have been closed
if (mainWindow === null)
mainWindow = await createMainWindow();
});
// create main BrowserWindow when electron is ready
app.on('ready', async () => {
mainWindowState = windowStateKeeper({
defaultWidth: 1024,
defaultHeight: 800
});
mainWindow = await createMainWindow();
createAppMenu();
if (isWindows) // Temporary workaround to https://github.com/electron/electron/issues/30024
mainWindow.show();
// if (isDevelopment)
// mainWindow.webContents.openDevTools();
process.on('uncaughtException', error => {
mainWindow.webContents.send('unhandled-exception', error);
});
process.on('unhandledRejection', error => {
mainWindow.webContents.send('unhandled-exception', error);
});
});
}
function createAppMenu () {
let menu = null;
if (isMacOS) {
menu = Menu.buildFromTemplate([
{
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{
label: 'Check for Updates...',
click: (_menuItem, win) => win.webContents.send('open-updates-preferences')
},
{
label: 'Preferences',
click: (_menuItem, win) => win.webContents.send('toggle-preferences'),
accelerator: 'CmdOrCtrl+,'
},
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideOthers' },
{ type: 'separator' },
{ role: 'quit' }
]
},
{
role: 'editMenu'
},
{
role: 'viewMenu'
},
{
role: 'windowMenu'
}
]);
}
Menu.setApplicationMenu(menu);
}
function saveWindowState () {
mainWindowState.saveState(mainWindow);
}

View File

@@ -0,0 +1,108 @@
<template>
<div id="map" class="map" />
</template>
<script>
import L from 'leaflet';
import {
point,
lineString,
polygon
} from '@turf/helpers';
import { getArrayDepth } from 'common/libs/getArrayDepth';
export default {
name: 'BaseMap',
props: {
points: [Object, Array],
isMultiSpatial: Boolean
},
data () {
return {
map: null,
markers: [],
center: null
};
},
mounted () {
if (this.isMultiSpatial) {
for (const element of this.points)
this.markers.push(this.getMarkers(element));
}
else {
this.markers = this.getMarkers(this.points);
if (!Array.isArray(this.points))
this.center = [this.points.y, this.points.x];
}
this.map = L.map('map', {
center: this.center || [0, 0],
zoom: 15,
minZoom: 1,
attributionControl: false
});
L.control.attribution({ prefix: '<b>Leaflet</b>' }).addTo(this.map);
const geoJsonObj = L.geoJSON(this.markers, {
style: function () {
return {
weight: 2,
fillColor: '#ff7800',
color: '#ff7800',
opacity: 0.8,
fillOpacity: 0.4
};
},
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {
radius: 7,
weight: 2,
fillColor: '#ff7800',
color: '#ff7800',
opacity: 0.8,
fillOpacity: 0.4
});
}
}).addTo(this.map);
const southWest = L.latLng(-90, -180);
const northEast = L.latLng(90, 180);
const bounds = L.latLngBounds(southWest, northEast);
this.map.setMaxBounds(bounds);
if (!this.center) this.map.fitBounds(geoJsonObj.getBounds());
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <b>OpenStreetMap</b>'
}).addTo(this.map);
},
methods: {
getMarkers (points) {
if (Array.isArray(points)) {
if (getArrayDepth(points) === 1)
return lineString(points.reduce((acc, curr) => [...acc, [curr.x, curr.y]], []));
else
return polygon(points.map(arr => arr.reduce((acc, curr) => [...acc, [curr.x, curr.y]], [])));
}
else
return point([points.x, points.y]);
}
}
};
</script>
<style lang="scss">
.map{
height: 400px;
}
.marker-icon{
display: flex;
justify-content: center;
align-items: center;
background: $primary-color;
border-radius: 50%;
box-shadow: 0 0 5px 1px darken($body-font-color-dark, 40%);
}
</style>

View File

@@ -89,7 +89,7 @@
:type="inputProps().type" :type="inputProps().type"
:disabled="!isChecked" :disabled="!isChecked"
> >
<template v-if="methodData && 'params' in methodData" class="columns"> <template v-if="methodData && 'params' in methodData">
<input <input
v-for="(option, key) in methodData.params" v-for="(option, key) in methodData.params"
:key="key" :key="key"

View File

@@ -6,18 +6,18 @@
@confirm="runRoutine" @confirm="runRoutine"
@hide="closeModal" @hide="closeModal"
> >
<template slot="header"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-play mr-1" /> <i class="mdi mdi-24px mdi-play mr-1" />
<span class="cut-text">{{ $t('word.parameters') }}: {{ localRoutine.name }}</span> <span class="cut-text">{{ $t('word.parameters') }}: {{ localRoutine.name }}</span>
</div> </div>
</template> </template>
<div slot="body"> <template #body>
<div class="content"> <div class="content">
<form class="form-horizontal"> <form class="form-horizontal">
<div <div
v-for="(parameter, i) in inParameters" v-for="(parameter, i) in inParameters"
:key="parameter._id" :key="parameter._antares_id"
class="form-group" class="form-group"
> >
<div class="col-4"> <div class="col-4">
@@ -43,7 +43,7 @@
</div> </div>
</form> </form>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>

View File

@@ -5,16 +5,16 @@
@confirm="$emit('confirm')" @confirm="$emit('confirm')"
@hide="$emit('close')" @hide="$emit('close')"
> >
<template slot="header"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-content-save-alert mr-1" /> {{ $t('message.unsavedChanges') }} <i class="mdi mdi-24px mdi-content-save-alert mr-1" /> {{ $t('message.unsavedChanges') }}
</div> </div>
</template> </template>
<div slot="body"> <template #body>
<div> <div>
{{ $t('message.discardUnsavedChanges') }} {{ $t('message.discardUnsavedChanges') }}
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>

View File

@@ -41,7 +41,7 @@
<label class="form-checkbox ml-3" :title="$t('word.insert')"> <label class="form-checkbox ml-3" :title="$t('word.insert')">
<input <input
type="checkbox" type="checkbox"
:checked="!field.autoIncrement" :checked="!fieldsToExclude.includes(field.name)"
@change.prevent="toggleFields($event, field)" @change.prevent="toggleFields($event, field)"
><i class="form-icon" /> ><i class="form-icon" />
</label> </label>
@@ -264,7 +264,7 @@ export default {
else if (BIT.includes(field.type)) else if (BIT.includes(field.type))
fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', ''); fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', '');
else if (DATETIME.includes(field.type)) { else if (DATETIME.includes(field.type)) {
if (field.default && ['current_timestamp', 'now()'].includes(field.default.toLowerCase())) { if (field.default && ['current_timestamp', 'now()'].some(term => field.default.toLowerCase().includes(term))) {
let datePrecision = ''; let datePrecision = '';
for (let i = 0; i < field.datePrecision; i++) for (let i = 0; i < field.datePrecision; i++)
datePrecision += i === 0 ? '.S' : 'S'; datePrecision += i === 0 ? '.S' : 'S';
@@ -281,7 +281,7 @@ export default {
rowObj[field.name] = { value: fieldDefault }; rowObj[field.name] = { value: fieldDefault };
if (field.autoIncrement)// Disable by default auto increment fields if (field.autoIncrement || !!field.onUpdate)// Disable by default auto increment or "on update" fields
this.fieldsToExclude = [...this.fieldsToExclude, field.name]; this.fieldsToExclude = [...this.fieldsToExclude, field.name];
} }

View File

@@ -253,6 +253,7 @@ export default {
font-size: 100%; font-size: 100%;
// color: $primary-color; // color: $primary-color;
opacity: 0.8; opacity: 0.8;
font-weight: 600;
} }
.tile-subtitle { .tile-subtitle {

View File

@@ -22,12 +22,12 @@
:hide-footer="true" :hide-footer="true"
@hide="hideInfoModal" @hide="hideInfoModal"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-information-outline mr-1" /> {{ $t('message.processInfo') }} <i class="mdi mdi-24px mdi-information-outline mr-1" /> {{ $t('message.processInfo') }}
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div> <div>
<div> <div>
<TextEditor <TextEditor
@@ -38,7 +38,7 @@
/> />
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</div> </div>
</template> </template>

View File

@@ -184,7 +184,7 @@
:class="{'selected': applicationTheme === 'dark'}" :class="{'selected': applicationTheme === 'dark'}"
@click="changeApplicationTheme('dark')" @click="changeApplicationTheme('dark')"
> >
<img :src="require('@/images/dark.png').default" class="img-responsive img-fit-cover s-rounded"> <img src="../images/dark.png" class="img-responsive img-fit-cover s-rounded">
<div class="theme-name text-light"> <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">
@@ -197,7 +197,7 @@
:class="{'selected': applicationTheme === 'light'}" :class="{'selected': applicationTheme === 'light'}"
@click="changeApplicationTheme('light')" @click="changeApplicationTheme('light')"
> >
<img :src="require('@/images/light.png').default" class="img-responsive img-fit-cover s-rounded"> <img src="../images/light.png" class="img-responsive img-fit-cover s-rounded">
<div class="theme-name text-dark"> <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">
@@ -280,7 +280,7 @@
<div v-show="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="../images/logo.svg" width="128">
<h4>{{ appName }}</h4> <h4>{{ appName }}</h4>
<p> <p>
{{ $t('word.version') }} {{ appVersion }}<br> {{ $t('word.version') }} {{ appVersion }}<br>
@@ -396,7 +396,7 @@ export default {
return locales; return locales;
}, },
hasUpdates () { hasUpdates () {
return ['available', 'downloading', 'downloaded'].includes(this.updateStatus); return ['available', 'downloading', 'downloaded', 'link'].includes(this.updateStatus);
}, },
workspace () { workspace () {
return this.getWorkspace(this.selectedWorkspace); return this.getWorkspace(this.selectedWorkspace);

View File

@@ -16,7 +16,7 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import marked from 'marked'; import { marked } from 'marked';
import BaseLoader from '@/components/BaseLoader'; import BaseLoader from '@/components/BaseLoader';
export default { export default {

View File

@@ -29,12 +29,19 @@
{{ $t('message.checkForUpdates') }} {{ $t('message.checkForUpdates') }}
</button> </button>
<button <button
v-if="updateStatus === 'downloaded'" v-else-if="updateStatus === 'downloaded'"
class="btn btn-primary" class="btn btn-primary"
@click="restartToUpdate" @click="restartToUpdate"
> >
{{ $t('message.restartToInstall') }} {{ $t('message.restartToInstall') }}
</button> </button>
<button
v-else-if="updateStatus === 'link'"
class="btn btn-primary"
@click="openOutside('https://antares-sql.app/download.html')"
>
{{ $t('message.goToDownloadPage') }}
</button>
</div> </div>
<div class="form-group mt-4"> <div class="form-group mt-4">
<label class="form-switch d-inline-block disabled" @click.prevent="toggleAllowPrerelease"> <label class="form-switch d-inline-block disabled" @click.prevent="toggleAllowPrerelease">
@@ -47,7 +54,7 @@
<script> <script>
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from 'vuex';
import { ipcRenderer } from 'electron'; import { ipcRenderer, shell } from 'electron';
export default { export default {
name: 'ModalSettingsUpdate', name: 'ModalSettingsUpdate',
@@ -71,6 +78,8 @@ export default {
return this.$t('message.downloadingUpdate'); return this.$t('message.downloadingUpdate');
case 'downloaded': case 'downloaded':
return this.$t('message.updateDownloaded'); return this.$t('message.updateDownloaded');
case 'link':
return this.$t('message.updateAvailable');
default: default:
return this.updateStatus; return this.updateStatus;
} }
@@ -80,6 +89,9 @@ export default {
...mapActions({ ...mapActions({
changeAllowPrerelease: 'settings/changeAllowPrerelease' changeAllowPrerelease: 'settings/changeAllowPrerelease'
}), }),
openOutside (link) {
shell.openExternal(link);
},
checkForUpdates () { checkForUpdates () {
ipcRenderer.send('check-for-updates'); ipcRenderer.send('check-for-updates');
}, },

View File

@@ -15,16 +15,16 @@
@confirm="confirmDeleteConnection" @confirm="confirmDeleteConnection"
@hide="hideConfirmModal" @hide="hideConfirmModal"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-server-remove mr-1" /> {{ $t('message.deleteConnection') }} <i class="mdi mdi-24px mdi-server-remove mr-1" /> {{ $t('message.deleteConnection') }}
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="mb-2"> <div class="mb-2">
{{ $t('message.deleteCorfirm') }} <b>{{ connectionName }}</b>? {{ $t('message.deleteCorfirm') }} <b>{{ connectionName }}</b>?
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</BaseContextMenu> </BaseContextMenu>
</template> </template>

View File

@@ -40,15 +40,13 @@ export default {
} }
}, },
watch: { watch: {
notifications: { 'notifications.length': function (val) {
deep: true, if (val > 0) {
handler: function (notification) { const nUid = this.notifications[0].uid;
if (notification.length) { this.timeouts[nUid] = setTimeout(() => {
this.timeouts[notification[0].uid] = setTimeout(() => { this.removeNotification(nUid);
this.removeNotification(notification[0].uid); delete this.timeouts[nUid];
delete this.timeouts[notification.uid]; }, this.notificationsTimeout * 1000);
}, this.notificationsTimeout * 1000);
}
} }
} }
}, },
@@ -63,11 +61,14 @@ export default {
} }
}, },
rearmTimeouts () { rearmTimeouts () {
const delay = 50;
let i = this.notifications.length * delay;
for (const notification of this.notifications) { for (const notification of this.notifications) {
this.timeouts[notification.uid] = setTimeout(() => { this.timeouts[notification.uid] = setTimeout(() => {
this.removeNotification(notification.uid); this.removeNotification(notification.uid);
delete this.timeouts[notification.uid]; delete this.timeouts[notification.uid];
}, this.notificationsTimeout * 1000); }, (this.notificationsTimeout * 1000) + i);
i = i > delay ? i - delay : 0;
} }
} }
} }

View File

@@ -6,12 +6,12 @@
:hide-footer="true" :hide-footer="true"
@hide="hideScratchpad" @hide="hideScratchpad"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-notebook-edit-outline mr-1" /> {{ $t('word.scratchpad') }} <i class="mdi mdi-24px mdi-notebook-edit-outline mr-1" /> {{ $t('word.scratchpad') }}
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div> <div>
<div> <div>
<TextEditor <TextEditor
@@ -24,7 +24,7 @@
</div> </div>
<small class="text-gray">{{ $t('message.markdownSupported') }}</small> <small class="text-gray">{{ $t('message.markdownSupported') }}</small>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>

View File

@@ -92,7 +92,7 @@ export default {
} }
}, },
hasUpdates () { hasUpdates () {
return ['available', 'downloading', 'downloaded'].includes(this.updateStatus); return ['available', 'downloading', 'downloaded', 'link'].includes(this.updateStatus);
} }
}, },
methods: { methods: {
@@ -200,7 +200,7 @@ export default {
} }
&::before { &::before {
content: ''; content: "";
height: 0; height: 0;
width: 3px; width: 3px;
transition: height 0.2s; transition: height 0.2s;

View File

@@ -1,8 +1,12 @@
<template> <template>
<div id="titlebar"> <div id="titlebar" @dblclick="toggleFullScreen">
<div class="titlebar-resizer" /> <div class="titlebar-resizer" />
<div class="titlebar-elements"> <div class="titlebar-elements">
<img class="titlebar-logo" :src="require('@/images/logo.svg').default"> <img
v-if="!isMacOS"
class="titlebar-logo"
src="@/images/logo.svg"
>
</div> </div>
<div class="titlebar-elements titlebar-title"> <div class="titlebar-elements titlebar-title">
{{ windowTitle }} {{ windowTitle }}
@@ -22,14 +26,26 @@
> >
<i class="mdi mdi-24px mdi-refresh" /> <i class="mdi mdi-24px mdi-refresh" />
</div> </div>
<div class="titlebar-element" @click="minimizeApp"> <div
v-if="!isMacOS"
class="titlebar-element"
@click="minimizeApp"
>
<i class="mdi mdi-24px mdi-minus" /> <i class="mdi mdi-24px mdi-minus" />
</div> </div>
<div class="titlebar-element" @click="toggleFullScreen"> <div
v-if="!isMacOS"
class="titlebar-element"
@click="toggleFullScreen"
>
<i v-if="isMaximized" class="mdi mdi-24px mdi-fullscreen-exit" /> <i v-if="isMaximized" class="mdi mdi-24px mdi-fullscreen-exit" />
<i v-else class="mdi mdi-24px mdi-fullscreen" /> <i v-else class="mdi mdi-24px mdi-fullscreen" />
</div> </div>
<div class="titlebar-element close-button" @click="closeApp"> <div
v-if="!isMacOS"
class="titlebar-element close-button"
@click="closeApp"
>
<i class="mdi mdi-24px mdi-close" /> <i class="mdi mdi-24px mdi-close" />
</div> </div>
</div> </div>
@@ -47,7 +63,8 @@ export default {
return { return {
w: getCurrentWindow(), w: getCurrentWindow(),
isMaximized: getCurrentWindow().isMaximized(), isMaximized: getCurrentWindow().isMaximized(),
isDevelopment: process.env.NODE_ENV === 'development' isDevelopment: process.env.NODE_ENV === 'development',
isMacOS: process.platform === 'darwin'
}; };
}, },
computed: { computed: {

View File

@@ -18,7 +18,6 @@
<li <li
v-for="(tab, i) of draggableTabs" v-for="(tab, i) of draggableTabs"
:key="i" :key="i"
:ref="selectedTab === tab.uid ? 'tab-selected' : ''"
class="tab-item tab-draggable" class="tab-item tab-draggable"
draggable="true" draggable="true"
:class="{'active': selectedTab === tab.uid}" :class="{'active': selectedTab === tab.uid}"
@@ -256,52 +255,59 @@
</span> </span>
</a> </a>
</li> </li>
<li slot="header" class="tab-item dropdown tools-dropdown"> <template #header>
<a <li
class="tab-link workspace-tools-link dropdown-toggle" v-if="workspace.customizations.processesList"
tabindex="0" class="tab-item dropdown tools-dropdown"
:title="$t('word.tools')"
> >
<i class="mdi mdi-24px mdi-tools" /> <a
</a> class="tab-link workspace-tools-link dropdown-toggle"
<ul class="menu text-left text-uppercase"> tabindex="0"
<li v-if="workspace.customizations.processesList" class="menu-item"> :title="$t('word.tools')"
<a class="c-hand p-vcentered" @click="showProcessesModal">
<i class="mdi mdi-memory mr-1 tool-icon" />
<span>{{ $t('message.processesList') }}</span>
</a>
</li>
<li
v-if="workspace.customizations.variables"
class="menu-item"
title="Coming..."
> >
<a class="c-hand p-vcentered disabled"> <i class="mdi mdi-24px mdi-tools" />
<i class="mdi mdi-shape mr-1 tool-icon" /> </a>
<span>{{ $t('word.variables') }}</span> <ul v-if="hasTools" class="menu text-left text-uppercase">
</a> <li class="menu-item">
</li> <a class="c-hand p-vcentered" @click="showProcessesModal">
<li <i class="mdi mdi-memory mr-1 tool-icon" />
v-if="workspace.customizations.usersManagement" <span>{{ $t('message.processesList') }}</span>
class="menu-item" </a>
title="Coming..." </li>
<li
v-if="workspace.customizations.variables"
class="menu-item"
title="Coming..."
>
<a class="c-hand p-vcentered disabled">
<i class="mdi mdi-shape mr-1 tool-icon" />
<span>{{ $t('word.variables') }}</span>
</a>
</li>
<li
v-if="workspace.customizations.usersManagement"
class="menu-item"
title="Coming..."
>
<a class="c-hand p-vcentered disabled">
<i class="mdi mdi-account-group mr-1 tool-icon" />
<span>{{ $t('message.manageUsers') }}</span>
</a>
</li>
</ul>
</li>
</template>
<template #footer>
<li class="tab-item">
<a
class="tab-add"
:title="$t('message.openNewTab')"
@click="addQueryTab"
> >
<a class="c-hand p-vcentered disabled"> <i class="mdi mdi-24px mdi-plus" />
<i class="mdi mdi-account-group mr-1 tool-icon" /> </a>
<span>{{ $t('message.manageUsers') }}</span> </li>
</a> </template>
</li>
</ul>
</li>
<li slot="footer" class="tab-item">
<a
class="tab-add"
:title="$t('message.openNewTab')"
@click="addQueryTab"
>
<i class="mdi mdi-24px mdi-plus" />
</a>
</li>
</Draggable> </Draggable>
<WorkspaceEmptyState v-if="!workspace.tabs.length" @new-tab="addQueryTab" /> <WorkspaceEmptyState v-if="!workspace.tabs.length" @new-tab="addQueryTab" />
<template v-for="tab of workspace.tabs"> <template v-for="tab of workspace.tabs">
@@ -561,7 +567,7 @@ export default {
return this.workspace ? this.workspace.selectedTab : null; return this.workspace ? this.workspace.selectedTab : null;
}, },
queryTabs () { queryTabs () {
return this.workspace.tabs.filter(tab => tab.type === 'query'); return this.workspace ? this.workspace.tabs.filter(tab => tab.type === 'query') : [];
}, },
schemaChild () { schemaChild () {
for (const key in this.workspace.breadcrumbs) { for (const key in this.workspace.breadcrumbs) {
@@ -569,19 +575,20 @@ export default {
if (this.workspace.breadcrumbs[key]) return this.workspace.breadcrumbs[key]; if (this.workspace.breadcrumbs[key]) return this.workspace.breadcrumbs[key];
} }
return false; return false;
},
hasTools () {
return this.workspace.customizations.processesList ||
this.workspace.customizations.usersManagement ||
this.workspace.customizations.variables;
} }
}, },
watch: { watch: {
selectedTab (newVal, oldVal) { queryTabs: function (newVal, oldVal) {
if (newVal !== oldVal) { if (newVal.length > oldVal.length) {
setTimeout(() => { setTimeout(() => {
const element = this.$refs['tab-selected'] ? this.$refs['tab-selected'][0] : null; const scroller = this.$refs.tabWrap;
if (element) { if (scroller) scroller.$el.scrollLeft = scroller.$el.scrollWidth;
element.setAttribute('tabindex', '-1'); }, 0);
element.focus();
element.removeAttribute('tabindex');
}
}, 50);
} }
} }
}, },

View File

@@ -11,6 +11,7 @@
<a class="tab-link">{{ $t('word.general') }}</a> <a class="tab-link">{{ $t('word.general') }}</a>
</li> </li>
<li <li
v-if="customizations.sslConnection"
class="tab-item c-hand" class="tab-item c-hand"
:class="{'active': selectedTab === 'ssl'}" :class="{'active': selectedTab === 'ssl'}"
@click="selectTab('ssl')" @click="selectTab('ssl')"
@@ -18,6 +19,7 @@
<a class="tab-link">{{ $t('word.ssl') }}</a> <a class="tab-link">{{ $t('word.ssl') }}</a>
</li> </li>
<li <li
v-if="customizations.sshConnection"
class="tab-item c-hand" class="tab-item c-hand"
:class="{'active': selectedTab === 'ssh'}" :class="{'active': selectedTab === 'ssh'}"
@click="selectTab('ssh')" @click="selectTab('ssh')"
@@ -49,25 +51,17 @@
</div> </div>
<div class="column col-8 col-sm-12"> <div class="column col-8 col-sm-12">
<select v-model="connection.client" class="form-select"> <select v-model="connection.client" class="form-select">
<option value="mysql"> <option
MySQL v-for="client in clients"
:key="client.slug"
:value="client.slug"
>
{{ client.name }}
</option> </option>
<option value="maria">
MariaDB
</option>
<option value="pg">
PostgreSQL
</option>
<!-- <option value="mssql">
Microsoft SQL
</option>
<option value="oracledb">
Oracle DB
</option> -->
</select> </select>
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.hostName') }}/IP</label> <label class="form-label">{{ $t('word.hostName') }}/IP</label>
</div> </div>
@@ -79,7 +73,20 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.database') }}</label>
</div>
<div class="column col-8 col-sm-12">
<BaseUploadInput
:value="connection.databasePath"
:message="$t('word.browse')"
@clear="pathClear('databasePath')"
@change="pathSelection($event, 'databasePath')"
/>
</div>
</div>
<div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.port') }}</label> <label class="form-label">{{ $t('word.port') }}</label>
</div> </div>
@@ -105,7 +112,7 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.user') }}</label> <label class="form-label">{{ $t('word.user') }}</label>
</div> </div>
@@ -118,7 +125,7 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.password') }}</label> <label class="form-label">{{ $t('word.password') }}</label>
</div> </div>
@@ -144,7 +151,15 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="customizations.readOnlyMode" class="form-group columns">
<div class="column col-4 col-sm-12" />
<div class="column col-8 col-sm-12">
<label class="form-checkbox form-inline">
<input v-model="connection.readonly" type="checkbox"><i class="form-icon" /> {{ $t('message.readOnlyMode') }}
</label>
</div>
</div>
<div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12" /> <div class="column col-4 col-sm-12" />
<div class="column col-8 col-sm-12"> <div class="column col-8 col-sm-12">
<label class="form-checkbox form-inline"> <label class="form-checkbox form-inline">
@@ -369,15 +384,23 @@ export default {
}, },
data () { data () {
return { return {
clients: [
{ name: 'MySQL', slug: 'mysql' },
{ name: 'MariaDB', slug: 'maria' },
{ name: 'PostgreSQL', slug: 'pg' },
{ name: 'SQLite', slug: 'sqlite' }
],
connection: { connection: {
name: '', name: '',
client: 'mysql', client: 'mysql',
host: '127.0.0.1', host: '127.0.0.1',
database: null, database: null,
databasePath: '',
port: null, port: null,
user: null, user: null,
password: '', password: '',
ask: false, ask: false,
readonly: false,
uid: uidGen('C'), uid: uidGen('C'),
ssl: false, ssl: false,
cert: '', cert: '',

View File

@@ -11,6 +11,7 @@
<a class="tab-link">{{ $t('word.general') }}</a> <a class="tab-link">{{ $t('word.general') }}</a>
</li> </li>
<li <li
v-if="customizations.sslConnection"
class="tab-item c-hand" class="tab-item c-hand"
:class="{'active': selectedTab === 'ssl'}" :class="{'active': selectedTab === 'ssl'}"
@click="selectTab('ssl')" @click="selectTab('ssl')"
@@ -18,6 +19,7 @@
<a class="tab-link">{{ $t('word.ssl') }}</a> <a class="tab-link">{{ $t('word.ssl') }}</a>
</li> </li>
<li <li
v-if="customizations.sshConnection"
class="tab-item c-hand" class="tab-item c-hand"
:class="{'active': selectedTab === 'ssh'}" :class="{'active': selectedTab === 'ssh'}"
@click="selectTab('ssh')" @click="selectTab('ssh')"
@@ -49,19 +51,17 @@
</div> </div>
<div class="column col-8 col-sm-12"> <div class="column col-8 col-sm-12">
<select v-model="localConnection.client" class="form-select"> <select v-model="localConnection.client" class="form-select">
<option value="mysql"> <option
MySQL v-for="client in clients"
</option> :key="client.slug"
<option value="maria"> :value="client.slug"
MariaDB >
</option> {{ client.name }}
<option value="pg">
PostgreSQL
</option> </option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.hostName') }}/IP</label> <label class="form-label">{{ $t('word.hostName') }}/IP</label>
</div> </div>
@@ -73,7 +73,20 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.database') }}</label>
</div>
<div class="column col-8 col-sm-12">
<BaseUploadInput
:value="localConnection.databasePath"
:message="$t('word.browse')"
@clear="pathClear('databasePath')"
@change="pathSelection($event, 'databasePath')"
/>
</div>
</div>
<div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.port') }}</label> <label class="form-label">{{ $t('word.port') }}</label>
</div> </div>
@@ -99,7 +112,7 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.user') }}</label> <label class="form-label">{{ $t('word.user') }}</label>
</div> </div>
@@ -112,7 +125,7 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12"> <div class="column col-4 col-sm-12">
<label class="form-label">{{ $t('word.password') }}</label> <label class="form-label">{{ $t('word.password') }}</label>
</div> </div>
@@ -138,7 +151,15 @@
> >
</div> </div>
</div> </div>
<div class="form-group columns"> <div v-if="customizations.readOnlyMode" class="form-group columns">
<div class="column col-4 col-sm-12" />
<div class="column col-8 col-sm-12">
<label class="form-checkbox form-inline">
<input v-model="localConnection.readonly" type="checkbox"><i class="form-icon" /> {{ $t('message.readOnlyMode') }}
</label>
</div>
</div>
<div v-if="!customizations.fileConnection" class="form-group columns">
<div class="column col-4 col-sm-12" /> <div class="column col-4 col-sm-12" />
<div class="column col-8 col-sm-12"> <div class="column col-8 col-sm-12">
<label class="form-checkbox form-inline"> <label class="form-checkbox form-inline">
@@ -374,6 +395,12 @@ export default {
}, },
data () { data () {
return { return {
clients: [
{ name: 'MySQL', slug: 'mysql' },
{ name: 'MariaDB', slug: 'maria' },
{ name: 'PostgreSQL', slug: 'pg' },
{ name: 'SQLite', slug: 'sqlite' }
],
isConnecting: false, isConnecting: false,
isTesting: false, isTesting: false,
isAsking: false, isAsking: false,
@@ -383,7 +410,7 @@ export default {
}, },
computed: { computed: {
customizations () { customizations () {
return customizations[this.connection.client]; return customizations[this.localConnection.client];
}, },
isBusy () { isBusy () {
return this.isConnecting || this.isTesting; return this.isConnecting || this.isTesting;

View File

@@ -1,7 +1,16 @@
<template> <template>
<div class="column col-12 empty"> <div class="column col-12 empty">
<div class="empty-icon"> <div class="empty-icon">
<img :src="require(`@/images/logo-${applicationTheme}.svg`).default" width="200"> <img
v-if="applicationTheme === 'dark'"
src="../images/logo-dark.svg"
width="200"
>
<img
v-if="applicationTheme === 'light'"
src="../images/logo-light.svg"
width="200"
>
</div> </div>
<p class="h6 empty-subtitle"> <p class="h6 empty-subtitle">
{{ $t('message.noOpenTabs') }} {{ $t('message.noOpenTabs') }}

View File

@@ -13,6 +13,7 @@
<span class="workspace-explorebar-title">{{ connectionName }}</span> <span class="workspace-explorebar-title">{{ connectionName }}</span>
<span v-if="workspace.connectionStatus === 'connected'" class="workspace-explorebar-tools"> <span v-if="workspace.connectionStatus === 'connected'" class="workspace-explorebar-tools">
<i <i
v-if="customizations.schemas"
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.createNewSchema')" :title="$t('message.createNewSchema')"
@click="showNewDBModal" @click="showNewDBModal"

View File

@@ -10,6 +10,30 @@
> >
<span class="d-flex"><i class="mdi mdi-18px mdi-play text-light pr-1" /> {{ $t('word.run') }}</span> <span class="d-flex"><i class="mdi mdi-18px mdi-play text-light pr-1" /> {{ $t('word.run') }}</span>
</div> </div>
<div
v-if="selectedMisc.type === 'trigger' && customizations.triggerEnableDisable"
class="context-element"
@click="toggleTrigger"
>
<span v-if="!selectedMisc.enabled" class="d-flex">
<i class="mdi mdi-18px mdi-play text-light pr-1" /> {{ $t('word.enable') }}
</span>
<span v-else class="d-flex">
<i class="mdi mdi-18px mdi-pause text-light pr-1" /> {{ $t('word.disable') }}
</span>
</div>
<div
v-if="selectedMisc.type === 'scheduler'"
class="context-element"
@click="toggleScheduler"
>
<span v-if="!selectedMisc.enabled" class="d-flex">
<i class="mdi mdi-18px mdi-play text-light pr-1" /> {{ $t('word.enable') }}
</span>
<span v-else class="d-flex">
<i class="mdi mdi-18px mdi-pause text-light pr-1" /> {{ $t('word.disable') }}
</span>
</div>
<div class="context-element" @click="showDeleteModal"> <div class="context-element" @click="showDeleteModal">
<span class="d-flex"><i class="mdi mdi-18px mdi-table-remove text-light pr-1" /> {{ $t('word.delete') }}</span> <span class="d-flex"><i class="mdi mdi-18px mdi-table-remove text-light pr-1" /> {{ $t('word.delete') }}</span>
</div> </div>
@@ -18,17 +42,17 @@
@confirm="deleteMisc" @confirm="deleteMisc"
@hide="hideDeleteModal" @hide="hideDeleteModal"
> >
<template slot="header"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-delete mr-1" /> <i class="mdi mdi-24px mdi-delete mr-1" />
<span class="cut-text">{{ deleteMessage }}</span> <span class="cut-text">{{ deleteMessage }}</span>
</div> </div>
</template> </template>
<div slot="body"> <template #body>
<div class="mb-2"> <div class="mb-2">
{{ $t('message.deleteCorfirm') }} "<b>{{ selectedMisc.name }}</b>"? {{ $t('message.deleteCorfirm') }} "<b>{{ selectedMisc.name }}</b>"?
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
<ModalAskParameters <ModalAskParameters
v-if="isAskingParameters" v-if="isAskingParameters"
@@ -78,6 +102,9 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.selectedWorkspace); return this.getWorkspace(this.selectedWorkspace);
}, },
customizations () {
return this.getWorkspace(this.selectedWorkspace).customizations;
},
deleteMessage () { deleteMessage () {
switch (this.selectedMisc.type) { switch (this.selectedMisc.type) {
case 'trigger': case 'trigger':
@@ -98,6 +125,8 @@ export default {
...mapActions({ ...mapActions({
addNotification: 'notifications/addNotification', addNotification: 'notifications/addNotification',
changeBreadcrumbs: 'workspaces/changeBreadcrumbs', changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
addLoadingElement: 'workspaces/addLoadingElement',
removeLoadingElement: 'workspaces/removeLoadingElement',
removeTabs: 'workspaces/removeTabs', removeTabs: 'workspaces/removeTabs',
newTab: 'workspaces/newTab' newTab: 'workspaces/newTab'
}), }),
@@ -273,6 +302,68 @@ export default {
this.newTab({ uid: this.workspace.uid, content: sql, type: 'query', autorun: true }); this.newTab({ uid: this.workspace.uid, content: sql, type: 'query', autorun: true });
this.closeContext(); this.closeContext();
},
async toggleTrigger () {
this.addLoadingElement({
name: this.selectedMisc.name,
schema: this.selectedSchema,
type: 'trigger'
});
try {
const { status, response } = await Triggers.toggleTrigger({
uid: this.selectedWorkspace,
schema: this.selectedSchema,
trigger: this.selectedMisc.name,
enabled: this.selectedMisc.enabled
});
if (status !== 'success')
this.addNotification({ status: 'error', message: response });
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
}
this.removeLoadingElement({
name: this.selectedMisc.name,
schema: this.selectedSchema,
type: 'trigger'
});
this.closeContext();
this.$emit('reload');
},
async toggleScheduler () {
this.addLoadingElement({
name: this.selectedMisc.name,
schema: this.selectedSchema,
type: 'scheduler'
});
try {
const { status, response } = await Schedulers.toggleScheduler({
uid: this.selectedWorkspace,
schema: this.selectedSchema,
scheduler: this.selectedMisc.name,
enabled: this.selectedMisc.enabled
});
if (status !== 'success')
this.addNotification({ status: 'error', message: response });
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
}
this.removeLoadingElement({
name: this.selectedMisc.name,
schema: this.selectedSchema,
type: 'scheduler'
});
this.closeContext();
this.$emit('reload');
} }
} }
}; };

View File

@@ -9,7 +9,16 @@
<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" />
<i class="database-icon mdi mdi-18px mdi-database mr-1" /> <i class="database-icon mdi mdi-18px mdi-database mr-1" />
<span>{{ database.name }}</span> <div class="">
<span>{{ database.name }}</span>
<div
v-if="database.size"
class="schema-size tooltip tooltip-left mr-1"
:data-tooltip="formatBytes(database.size)"
>
<i class="mdi mdi-information-outline pr-2" />
</div>
</div>
</summary> </summary>
<div class="accordion-body"> <div class="accordion-body">
<div class="database-tables"> <div class="database-tables">
@@ -34,7 +43,7 @@
<span v-html="highlightWord(table.name)" /> <span v-html="highlightWord(table.name)" />
</a> </a>
<div <div
v-if="table.type === 'table'" v-if="table.type === 'table' && table.size !== false"
class="table-size tooltip tooltip-left mr-1" class="table-size tooltip tooltip-left mr-1"
:data-tooltip="formatBytes(table.size)" :data-tooltip="formatBytes(table.size)"
> >
@@ -68,9 +77,17 @@
@contextmenu.prevent="showMiscContext($event, {...trigger, type: 'trigger'})" @contextmenu.prevent="showMiscContext($event, {...trigger, type: 'trigger'})"
> >
<a class="table-name"> <a class="table-name">
<i class="table-icon mdi mdi-table-cog mdi-18px mr-1" /> <div v-if="checkLoadingStatus(trigger.name, 'trigger')" class="icon loading mr-1" />
<i v-else class="table-icon mdi mdi-table-cog mdi-18px mr-1" />
<span v-html="highlightWord(trigger.name)" /> <span v-html="highlightWord(trigger.name)" />
</a> </a>
<div
v-if="trigger.enabled === false"
class="tooltip tooltip-left disabled-indicator"
:data-tooltip="$t('word.disabled')"
>
<i class="table-icon mdi mdi-pause mdi-18px mr-1" />
</div>
</li> </li>
</ul> </ul>
</div> </div>
@@ -204,9 +221,17 @@
@contextmenu.prevent="showMiscContext($event, {...scheduler, type: 'scheduler'})" @contextmenu.prevent="showMiscContext($event, {...scheduler, type: 'scheduler'})"
> >
<a class="table-name"> <a class="table-name">
<i class="table-icon mdi mdi-calendar-clock mdi-18px mr-1" /> <div v-if="checkLoadingStatus(scheduler.name, 'scheduler')" class="icon loading mr-1" />
<i v-else class="table-icon mdi mdi-calendar-clock mdi-18px mr-1" />
<span v-html="highlightWord(scheduler.name)" /> <span v-html="highlightWord(scheduler.name)" />
</a> </a>
<div
v-if="scheduler.enabled === false"
class="tooltip tooltip-left disabled-indicator"
:data-tooltip="$t('word.disabled')"
>
<i class="table-icon mdi mdi-pause mdi-18px mr-1" />
</div>
</li> </li>
</ul> </ul>
</div> </div>
@@ -426,6 +451,11 @@ export default {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 2; z-index: 2;
.schema-size {
visibility: hidden;
width: 22.5px;
}
} }
.database-name, .database-name,
@@ -471,6 +501,10 @@ export default {
.misc-name { .misc-name {
&:hover { &:hover {
border-radius: $border-radius; border-radius: $border-radius;
.schema-size {
visibility: visible;
}
} }
} }
@@ -500,7 +534,9 @@ export default {
} }
} }
.table-size { .schema-size,
.table-size,
.disabled-indicator {
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;

View File

@@ -65,7 +65,11 @@
> >
<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
v-if="workspace.customizations.schemaDrop"
class="context-element"
@click="showDeleteModal"
>
<span class="d-flex"><i class="mdi mdi-18px mdi-database-remove text-light pr-1" /> {{ $t('word.delete') }}</span> <span class="d-flex"><i class="mdi mdi-18px mdi-database-remove text-light pr-1" /> {{ $t('word.delete') }}</span>
</div> </div>
@@ -74,17 +78,17 @@
@confirm="deleteSchema" @confirm="deleteSchema"
@hide="hideDeleteModal" @hide="hideDeleteModal"
> >
<template slot="header"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-database-remove mr-1" /> <i class="mdi mdi-24px mdi-database-remove mr-1" />
<span class="cut-text">{{ $t('message.deleteSchema') }}</span> <span class="cut-text">{{ $t('message.deleteSchema') }}</span>
</div> </div>
</template> </template>
<div slot="body"> <template #body>
<div class="mb-2"> <div class="mb-2">
{{ $t('message.deleteCorfirm') }} "<b>{{ selectedSchema }}</b>"? {{ $t('message.deleteCorfirm') }} "<b>{{ selectedSchema }}</b>"?
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
<ModalEditSchema <ModalEditSchema
v-if="isEditModal" v-if="isEditModal"

View File

@@ -40,33 +40,33 @@
@confirm="emptyTable" @confirm="emptyTable"
@hide="hideEmptyModal" @hide="hideEmptyModal"
> >
<template slot="header"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-table-off mr-1" /> <span class="cut-text">{{ $t('message.emptyTable') }}</span> <i class="mdi mdi-24px mdi-table-off mr-1" /> <span class="cut-text">{{ $t('message.emptyTable') }}</span>
</div> </div>
</template> </template>
<div slot="body"> <template #body>
<div class="mb-2"> <div class="mb-2">
{{ $t('message.emptyCorfirm') }} "<b>{{ selectedTable.name }}</b>"? {{ $t('message.emptyCorfirm') }} "<b>{{ selectedTable.name }}</b>"?
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
<ConfirmModal <ConfirmModal
v-if="isDeleteModal" v-if="isDeleteModal"
@confirm="deleteTable" @confirm="deleteTable"
@hide="hideDeleteModal" @hide="hideDeleteModal"
> >
<template slot="header"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-table-remove mr-1" /> <i class="mdi mdi-24px mdi-table-remove mr-1" />
<span class="cut-text">{{ selectedTable.type === 'table' ? $t('message.deleteTable') : $t('message.deleteView') }}</span> <span class="cut-text">{{ selectedTable.type === 'table' ? $t('message.deleteTable') : $t('message.deleteView') }}</span>
</div> </div>
</template> </template>
<div slot="body"> <template #body>
<div class="mb-2"> <div class="mb-2">
{{ $t('message.deleteCorfirm') }} "<b>{{ selectedTable.name }}</b>"? {{ $t('message.deleteCorfirm') }} "<b>{{ selectedTable.name }}</b>"?
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</BaseContextMenu> </BaseContextMenu>
</template> </template>

View File

@@ -5,7 +5,7 @@
<div class="workspace-query-buttons"> <div class="workspace-query-buttons">
<button <button
class="btn btn-primary btn-sm" class="btn btn-primary btn-sm"
:disabled="!isChanged" :disabled="!isChanged || !isValid"
:class="{'loading':isSaving}" :class="{'loading':isSaving}"
title="CTRL+S" title="CTRL+S"
@click="saveChanges" @click="saveChanges"
@@ -242,6 +242,9 @@ export default {
JSON.stringify(this.originalKeyUsage) !== JSON.stringify(this.localKeyUsage) || JSON.stringify(this.originalKeyUsage) !== JSON.stringify(this.localKeyUsage) ||
JSON.stringify(this.originalIndexes) !== JSON.stringify(this.localIndexes) || JSON.stringify(this.originalIndexes) !== JSON.stringify(this.localIndexes) ||
JSON.stringify(this.tableOptions) !== JSON.stringify(this.localOptions); JSON.stringify(this.tableOptions) !== JSON.stringify(this.localOptions);
},
isValid () {
return !!this.localFields.length && !!this.localOptions.name.trim().length;
} }
}, },
watch: { watch: {
@@ -287,7 +290,7 @@ export default {
changeBreadcrumbs: 'workspaces/changeBreadcrumbs' changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
}), }),
async saveChanges () { async saveChanges () {
if (this.isSaving) return; if (this.isSaving || !this.isValid) return;
this.isSaving = true; this.isSaving = true;
const params = { const params = {
@@ -344,7 +347,7 @@ export default {
}, },
addField () { addField () {
this.localFields.push({ this.localFields.push({
_id: uidGen(), _antares_id: uidGen(),
name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`, name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`,
key: '', key: '',
type: this.workspace.dataTypes[0].types[0].name, type: this.workspace.dataTypes[0].types[0].name,
@@ -385,8 +388,8 @@ export default {
}); });
}, },
duplicateField (uid) { duplicateField (uid) {
const fieldToClone = Object.assign({}, this.localFields.find(field => field._id === uid)); const fieldToClone = Object.assign({}, this.localFields.find(field => field._antares_id === uid));
fieldToClone._id = uidGen(); fieldToClone._antares_id = uidGen();
fieldToClone.name = `${fieldToClone.name}_copy`; fieldToClone.name = `${fieldToClone.name}_copy`;
fieldToClone.order = this.localFields.length + 1; fieldToClone.order = this.localFields.length + 1;
this.localFields = [...this.localFields, fieldToClone]; this.localFields = [...this.localFields, fieldToClone];
@@ -397,11 +400,11 @@ export default {
}, 20); }, 20);
}, },
removeField (uid) { removeField (uid) {
this.localFields = this.localFields.filter(field => field._id !== uid); this.localFields = this.localFields.filter(field => field._antares_id !== uid);
}, },
addNewIndex (payload) { addNewIndex (payload) {
this.localIndexes = [...this.localIndexes, { this.localIndexes = [...this.localIndexes, {
_id: uidGen(), _antares_id: uidGen(),
name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field, name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field,
fields: [payload.field], fields: [payload.field],
type: payload.index, type: payload.index,
@@ -413,7 +416,7 @@ export default {
}, },
addToIndex (payload) { addToIndex (payload) {
this.localIndexes = this.localIndexes.map(index => { this.localIndexes = this.localIndexes.map(index => {
if (index._id === payload.index) index.fields.push(payload.field); if (index._antares_id === payload.index) index.fields.push(payload.field);
return index; return index;
}); });
}, },

View File

@@ -373,7 +373,7 @@ export default {
this.originalFunction = response; this.originalFunction = response;
this.originalFunction.parameters = [...this.originalFunction.parameters.map(param => { this.originalFunction.parameters = [...this.originalFunction.parameters.map(param => {
param._id = uidGen(); param._antares_id = uidGen();
return param; return param;
})]; })];

View File

@@ -6,13 +6,13 @@
@confirm="confirmParametersChange" @confirm="confirmParametersChange"
@hide="$emit('hide')" @hide="$emit('hide')"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-dots-horizontal mr-1" /> <i class="mdi mdi-24px mdi-dots-horizontal mr-1" />
<span class="cut-text">{{ $t('word.parameters') }} "{{ func }}"</span> <span class="cut-text">{{ $t('word.parameters') }} "{{ func }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="columns col-gapless"> <div class="columns col-gapless">
<div class="column col-5"> <div class="column col-5">
<div class="panel" :style="{ height: modalInnerHeight + 'px'}"> <div class="panel" :style="{ height: modalInnerHeight + 'px'}">
@@ -36,10 +36,10 @@
<div ref="parametersPanel" class="panel-body p-0 pr-1"> <div ref="parametersPanel" class="panel-body p-0 pr-1">
<div <div
v-for="param in parametersProxy" v-for="param in parametersProxy"
:key="param._id" :key="param._antares_id"
class="tile tile-centered c-hand mb-1 p-1" class="tile tile-centered c-hand mb-1 p-1"
:class="{'selected-element': selectedParam === param._id}" :class="{'selected-element': selectedParam === param._antares_id}"
@click="selectParameter($event, param._id)" @click="selectParameter($event, param._antares_id)"
> >
<div class="tile-icon"> <div class="tile-icon">
<div> <div>
@@ -56,7 +56,7 @@
<button <button
class="btn btn-link remove-field p-0 mr-2" class="btn btn-link remove-field p-0 mr-2"
:title="$t('word.delete')" :title="$t('word.delete')"
@click.prevent="removeParameter(param._id)" @click.prevent="removeParameter(param._antares_id)"
> >
<i class="mdi mdi-close" /> <i class="mdi mdi-close" />
</button> </button>
@@ -167,7 +167,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>
@@ -196,7 +196,7 @@ export default {
}, },
computed: { computed: {
selectedParamObj () { selectedParamObj () {
return this.parametersProxy.find(param => param._id === this.selectedParam); return this.parametersProxy.find(param => param._antares_id === this.selectedParam);
}, },
isChanged () { isChanged () {
return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy); return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy);
@@ -237,10 +237,11 @@ export default {
this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom)); this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom));
}, },
addParameter () { addParameter () {
const newUid = uidGen();
this.parametersProxy = [...this.parametersProxy, { this.parametersProxy = [...this.parametersProxy, {
_id: uidGen(), _antares_id: newUid,
name: `Param${this.i++}`, name: `param${this.i++}`,
type: 'INT', type: this.workspace.dataTypes[0].types[0].name,
context: 'IN', context: 'IN',
length: '' length: ''
}]; }];
@@ -250,12 +251,13 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60; this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60;
this.selectedParam = newUid;
}, 20); }, 20);
}, },
removeParameter (uid) { removeParameter (uid) {
this.parametersProxy = this.parametersProxy.filter(param => param._id !== uid); this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid);
if (this.selectedParam === name && this.parametersProxy.length) if (this.parametersProxy.length && this.selectedParam === uid)
this.resetSelectedID(); this.resetSelectedID();
}, },
clearChanges () { clearChanges () {
@@ -266,7 +268,7 @@ export default {
this.resetSelectedID(); this.resetSelectedID();
}, },
resetSelectedID () { resetSelectedID () {
this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._id : ''; this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._antares_id : '';
} }
} }
}; };

View File

@@ -318,7 +318,7 @@ export default {
this.originalRoutine = response; this.originalRoutine = response;
this.originalRoutine.parameters = [...this.originalRoutine.parameters.map(param => { this.originalRoutine.parameters = [...this.originalRoutine.parameters.map(param => {
param._id = uidGen(); param._antares_id = uidGen();
return param; return param;
})]; })];

View File

@@ -6,13 +6,13 @@
@confirm="confirmParametersChange" @confirm="confirmParametersChange"
@hide="$emit('hide')" @hide="$emit('hide')"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-dots-horizontal mr-1" /> <i class="mdi mdi-24px mdi-dots-horizontal mr-1" />
<span class="cut-text">{{ $t('word.parameters') }} "{{ routine }}"</span> <span class="cut-text">{{ $t('word.parameters') }} "{{ routine }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="columns col-gapless"> <div class="columns col-gapless">
<div class="column col-5"> <div class="column col-5">
<div class="panel" :style="{ height: modalInnerHeight + 'px'}"> <div class="panel" :style="{ height: modalInnerHeight + 'px'}">
@@ -36,10 +36,10 @@
<div ref="parametersPanel" class="panel-body p-0 pr-1"> <div ref="parametersPanel" class="panel-body p-0 pr-1">
<div <div
v-for="param in parametersProxy" v-for="param in parametersProxy"
:key="param._id" :key="param._antares_id"
class="tile tile-centered c-hand mb-1 p-1" class="tile tile-centered c-hand mb-1 p-1"
:class="{'selected-element': selectedParam === param._id}" :class="{'selected-element': selectedParam === param._antares_id}"
@click="selectParameter($event, param._id)" @click="selectParameter($event, param._antares_id)"
> >
<div class="tile-icon"> <div class="tile-icon">
<div> <div>
@@ -56,7 +56,7 @@
<button <button
class="btn btn-link remove-field p-0 mr-2" class="btn btn-link remove-field p-0 mr-2"
:title="$t('word.delete')" :title="$t('word.delete')"
@click.prevent="removeParameter(param._id)" @click.prevent="removeParameter(param._antares_id)"
> >
<i class="mdi mdi-close" /> <i class="mdi mdi-close" />
</button> </button>
@@ -167,7 +167,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>
@@ -196,7 +196,7 @@ export default {
}, },
computed: { computed: {
selectedParamObj () { selectedParamObj () {
return this.parametersProxy.find(param => param._id === this.selectedParam); return this.parametersProxy.find(param => param._antares_id === this.selectedParam);
}, },
isChanged () { isChanged () {
return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy); return JSON.stringify(this.localParameters) !== JSON.stringify(this.parametersProxy);
@@ -237,8 +237,9 @@ export default {
this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom)); this.modalInnerHeight = modalBody.clientHeight - (parseFloat(getComputedStyle(modalBody).paddingTop) + parseFloat(getComputedStyle(modalBody).paddingBottom));
}, },
addParameter () { addParameter () {
const newUid = uidGen();
this.parametersProxy = [...this.parametersProxy, { this.parametersProxy = [...this.parametersProxy, {
_id: uidGen(), _antares_id: newUid,
name: `param${this.i++}`, name: `param${this.i++}`,
type: this.workspace.dataTypes[0].types[0].name, type: this.workspace.dataTypes[0].types[0].name,
context: 'IN', context: 'IN',
@@ -250,12 +251,13 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60; this.$refs.parametersPanel.scrollTop = this.$refs.parametersPanel.scrollHeight + 60;
this.selectedParam = newUid;
}, 20); }, 20);
}, },
removeParameter (uid) { removeParameter (uid) {
this.parametersProxy = this.parametersProxy.filter(param => param._id !== uid); this.parametersProxy = this.parametersProxy.filter(param => param._antares_id !== uid);
if (this.selectedParam === name && this.parametersProxy.length) if (this.parametersProxy.length && this.selectedParam === uid)
this.resetSelectedID(); this.resetSelectedID();
}, },
clearChanges () { clearChanges () {
@@ -266,7 +268,7 @@ export default {
this.resetSelectedID(); this.resetSelectedID();
}, },
resetSelectedID () { resetSelectedID () {
this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._id : ''; this.selectedParam = this.parametersProxy.length ? this.parametersProxy[0]._antares_id : '';
} }
} }
}; };

View File

@@ -5,13 +5,13 @@
@confirm="confirmOptionsChange" @confirm="confirmOptionsChange"
@hide="$emit('hide')" @hide="$emit('hide')"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-timer mr-1" /> <i class="mdi mdi-24px mdi-timer mr-1" />
<span class="cut-text">{{ $t('word.timing') }} "{{ localOptions.name }}"</span> <span class="cut-text">{{ $t('word.timing') }} "{{ localOptions.name }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-group"> <div class="form-group">
<label class="form-label col-4"> <label class="form-label col-4">
@@ -133,7 +133,7 @@
</div> </div>
</div> </div>
</form> </form>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>

View File

@@ -342,7 +342,7 @@ export default {
field.default = `'${field.default}'`; field.default = `'${field.default}'`;
} }
return { ...field, _id: uidGen() }; return { ...field, _antares_id: uidGen() };
}); });
this.localFields = JSON.parse(JSON.stringify(this.originalFields)); this.localFields = JSON.parse(JSON.stringify(this.originalFields));
} }
@@ -365,7 +365,7 @@ export default {
this.originalIndexes = Object.keys(indexesObj).map(index => { this.originalIndexes = Object.keys(indexesObj).map(index => {
return { return {
_id: uidGen(), _antares_id: uidGen(),
name: index, name: index,
fields: indexesObj[index].map(field => field.column), fields: indexesObj[index].map(field => field.column),
type: indexesObj[index][0].type, type: indexesObj[index][0].type,
@@ -391,7 +391,7 @@ export default {
if (status === 'success') { if (status === 'success') {
this.originalKeyUsage = response.map(foreign => { this.originalKeyUsage = response.map(foreign => {
return { return {
_id: uidGen(), _antares_id: uidGen(),
...foreign ...foreign
}; };
}); });
@@ -411,25 +411,25 @@ export default {
this.isSaving = true; this.isSaving = true;
// FIELDS // FIELDS
const originalIDs = this.originalFields.reduce((acc, curr) => [...acc, curr._id], []); const originalIDs = this.originalFields.reduce((acc, curr) => [...acc, curr._antares_id], []);
const localIDs = this.localFields.reduce((acc, curr) => [...acc, curr._id], []); const localIDs = this.localFields.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Fields Additions // Fields Additions
const additions = this.localFields.filter((field, i) => !originalIDs.includes(field._id)).map(field => { const additions = this.localFields.filter((field, i) => !originalIDs.includes(field._antares_id)).map(field => {
const lI = this.localFields.findIndex(localField => localField._id === field._id); const lI = this.localFields.findIndex(localField => localField._antares_id === field._antares_id);
const after = lI > 0 ? this.localFields[lI - 1].name : false; const after = lI > 0 ? this.localFields[lI - 1].name : false;
return { ...field, after }; return { ...field, after };
}); });
// Fields Deletions // Fields Deletions
const deletions = this.originalFields.filter(field => !localIDs.includes(field._id)); const deletions = this.originalFields.filter(field => !localIDs.includes(field._antares_id));
// Fields Changes // Fields Changes
const changes = []; const changes = [];
this.originalFields.forEach((originalField, oI) => { this.originalFields.forEach((originalField, oI) => {
const lI = this.localFields.findIndex(localField => localField._id === originalField._id); const lI = this.localFields.findIndex(localField => localField._antares_id === originalField._antares_id);
const originalSibling = oI > 0 ? this.originalFields[oI - 1]._id : false; const originalSibling = oI > 0 ? this.originalFields[oI - 1]._antares_id : false;
const localSibling = lI > 0 ? this.localFields[lI - 1]._id : false; const localSibling = lI > 0 ? this.localFields[lI - 1]._antares_id : false;
const after = lI > 0 ? this.localFields[lI - 1].name : false; const after = lI > 0 ? this.localFields[lI - 1].name : false;
const orgName = originalField.name; const orgName = originalField.name;
@@ -450,15 +450,15 @@ export default {
changes: [], changes: [],
deletions: [] deletions: []
}; };
const originalIndexIDs = this.originalIndexes.reduce((acc, curr) => [...acc, curr._id], []); const originalIndexIDs = this.originalIndexes.reduce((acc, curr) => [...acc, curr._antares_id], []);
const localIndexIDs = this.localIndexes.reduce((acc, curr) => [...acc, curr._id], []); const localIndexIDs = this.localIndexes.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Index Additions // Index Additions
indexChanges.additions = this.localIndexes.filter(index => !originalIndexIDs.includes(index._id)); indexChanges.additions = this.localIndexes.filter(index => !originalIndexIDs.includes(index._antares_id));
// Index Changes // Index Changes
this.originalIndexes.forEach(originalIndex => { this.originalIndexes.forEach(originalIndex => {
const lI = this.localIndexes.findIndex(localIndex => localIndex._id === originalIndex._id); const lI = this.localIndexes.findIndex(localIndex => localIndex._antares_id === originalIndex._antares_id);
if (JSON.stringify(originalIndex) !== JSON.stringify(this.localIndexes[lI])) { if (JSON.stringify(originalIndex) !== JSON.stringify(this.localIndexes[lI])) {
if (this.localIndexes[lI]) { if (this.localIndexes[lI]) {
indexChanges.changes.push({ indexChanges.changes.push({
@@ -471,7 +471,7 @@ export default {
}); });
// Index Deletions // Index Deletions
indexChanges.deletions = this.originalIndexes.filter(index => !localIndexIDs.includes(index._id)); indexChanges.deletions = this.originalIndexes.filter(index => !localIndexIDs.includes(index._antares_id));
// FOREIGN KEYS // FOREIGN KEYS
const foreignChanges = { const foreignChanges = {
@@ -479,15 +479,15 @@ export default {
changes: [], changes: [],
deletions: [] deletions: []
}; };
const originalForeignIDs = this.originalKeyUsage.reduce((acc, curr) => [...acc, curr._id], []); const originalForeignIDs = this.originalKeyUsage.reduce((acc, curr) => [...acc, curr._antares_id], []);
const localForeignIDs = this.localKeyUsage.reduce((acc, curr) => [...acc, curr._id], []); const localForeignIDs = this.localKeyUsage.reduce((acc, curr) => [...acc, curr._antares_id], []);
// Foreigns Additions // Foreigns Additions
foreignChanges.additions = this.localKeyUsage.filter(foreign => !originalForeignIDs.includes(foreign._id)); foreignChanges.additions = this.localKeyUsage.filter(foreign => !originalForeignIDs.includes(foreign._antares_id));
// Foreigns Changes // Foreigns Changes
this.originalKeyUsage.forEach(originalForeign => { this.originalKeyUsage.forEach(originalForeign => {
const lI = this.localKeyUsage.findIndex(localForeign => localForeign._id === originalForeign._id); const lI = this.localKeyUsage.findIndex(localForeign => localForeign._antares_id === originalForeign._antares_id);
if (JSON.stringify(originalForeign) !== JSON.stringify(this.localKeyUsage[lI])) { if (JSON.stringify(originalForeign) !== JSON.stringify(this.localKeyUsage[lI])) {
if (this.localKeyUsage[lI]) { if (this.localKeyUsage[lI]) {
foreignChanges.changes.push({ foreignChanges.changes.push({
@@ -499,13 +499,19 @@ export default {
}); });
// Foreigns Deletions // Foreigns Deletions
foreignChanges.deletions = this.originalKeyUsage.filter(foreign => !localForeignIDs.includes(foreign._id)); foreignChanges.deletions = this.originalKeyUsage.filter(foreign => !localForeignIDs.includes(foreign._antares_id));
// ALTER // ALTER
const params = { const params = {
uid: this.connection.uid, uid: this.connection.uid,
schema: this.schema, schema: this.schema,
table: this.table, table: this.table,
tableStructure: {
name: this.localOptions.name,
fields: this.localFields,
foreigns: this.localKeyUsage,
indexes: this.localIndexes
},
additions, additions,
changes, changes,
deletions, deletions,
@@ -555,7 +561,7 @@ export default {
}, },
addField () { addField () {
this.localFields.push({ this.localFields.push({
_id: uidGen(), _antares_id: uidGen(),
name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`, name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`,
key: '', key: '',
type: this.workspace.dataTypes[0].types[0].name, type: this.workspace.dataTypes[0].types[0].name,
@@ -597,8 +603,8 @@ export default {
}); });
}, },
duplicateField (uid) { duplicateField (uid) {
const fieldToClone = Object.assign({}, this.localFields.find(field => field._id === uid)); const fieldToClone = Object.assign({}, this.localFields.find(field => field._antares_id === uid));
fieldToClone._id = uidGen(); fieldToClone._antares_id = uidGen();
fieldToClone.name = `${fieldToClone.name}_copy`; fieldToClone.name = `${fieldToClone.name}_copy`;
fieldToClone.order = this.localFields.length + 1; fieldToClone.order = this.localFields.length + 1;
this.localFields = [...this.localFields, fieldToClone]; this.localFields = [...this.localFields, fieldToClone];
@@ -609,11 +615,19 @@ export default {
}, 20); }, 20);
}, },
removeField (uid) { removeField (uid) {
this.localFields = this.localFields.filter(field => field._id !== uid); this.localFields = this.localFields.filter(field => field._antares_id !== uid);
this.localKeyUsage = this.localKeyUsage.filter(fk =>// Clear foreign keys
this.localFields.some(field => field.name === fk.field)
);
this.localIndexes = this.localIndexes.filter(index =>// Clear indexes
this.localFields.some(field =>
index.fields.includes(field.name)
)
);
}, },
addNewIndex (payload) { addNewIndex (payload) {
this.localIndexes = [...this.localIndexes, { this.localIndexes = [...this.localIndexes, {
_id: uidGen(), _antares_id: uidGen(),
name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field, name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field,
fields: [payload.field], fields: [payload.field],
type: payload.index, type: payload.index,
@@ -625,7 +639,7 @@ export default {
}, },
addToIndex (payload) { addToIndex (payload) {
this.localIndexes = this.localIndexes.map(index => { this.localIndexes = this.localIndexes.map(index => {
if (index._id === payload.index) index.fields.push(payload.field); if (index._antares_id === payload.index) index.fields.push(payload.field);
return index; return index;
}); });
}, },

View File

@@ -27,7 +27,7 @@
:key="index.name" :key="index.name"
class="context-element" class="context-element"
:class="{'disabled': index.fields.includes(selectedField.name)}" :class="{'disabled': index.fields.includes(selectedField.name)}"
@click="addToIndex(index._id)" @click="addToIndex(index._antares_id)"
> >
<span class="d-flex"><i class="mdi mdi-18px mdi-key column-key pr-1" :class="`key-${index.type}`" /> {{ index.name }}</span> <span class="d-flex"><i class="mdi mdi-18px mdi-key column-key pr-1" :class="`key-${index.type}`" /> {{ index.name }}</span>
</div> </div>

View File

@@ -109,7 +109,7 @@
> >
<TableRow <TableRow
v-for="row in fields" v-for="row in fields"
:key="row._id" :key="row._antares_id"
:row="row" :row="row"
:indexes="getIndexes(row.name)" :indexes="getIndexes(row.name)"
:foreigns="getForeigns(row.name)" :foreigns="getForeigns(row.name)"
@@ -217,15 +217,15 @@ export default {
this.resizeResults(); this.resizeResults();
}, },
contextMenu (event, uid) { contextMenu (event, uid) {
this.selectedField = this.fields.find(field => field._id === uid); this.selectedField = this.fields.find(field => field._antares_id === uid);
this.contextEvent = event; this.contextEvent = event;
this.isContext = true; this.isContext = true;
}, },
duplicateField () { duplicateField () {
this.$emit('duplicate-field', this.selectedField._id); this.$emit('duplicate-field', this.selectedField._antares_id);
}, },
removeField () { removeField () {
this.$emit('remove-field', this.selectedField._id); this.$emit('remove-field', this.selectedField._antares_id);
}, },
getIndexes (field) { getIndexes (field) {
return this.indexes.reduce((acc, curr) => { return this.indexes.reduce((acc, curr) => {

View File

@@ -6,13 +6,13 @@
@confirm="confirmForeignsChange" @confirm="confirmForeignsChange"
@hide="$emit('hide')" @hide="$emit('hide')"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-key-link mr-1" /> <i class="mdi mdi-24px mdi-key-link mr-1" />
<span class="cut-text">{{ $t('word.foreignKeys') }} "{{ table }}"</span> <span class="cut-text">{{ $t('word.foreignKeys') }} "{{ table }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="columns col-gapless"> <div class="columns col-gapless">
<div class="column col-5"> <div class="column col-5">
<div class="panel" :style="{ height: modalInnerHeight + 'px'}"> <div class="panel" :style="{ height: modalInnerHeight + 'px'}">
@@ -36,10 +36,10 @@
<div ref="indexesPanel" class="panel-body p-0 pr-1"> <div ref="indexesPanel" class="panel-body p-0 pr-1">
<div <div
v-for="foreign in foreignProxy" v-for="foreign in foreignProxy"
:key="foreign._id" :key="foreign._antares_id"
class="tile tile-centered c-hand mb-1 p-1" class="tile tile-centered c-hand mb-1 p-1"
:class="{'selected-element': selectedForeignID === foreign._id}" :class="{'selected-element': selectedForeignID === foreign._antares_id}"
@click="selectForeign($event, foreign._id)" @click="selectForeign($event, foreign._antares_id)"
> >
<div class="tile-icon"> <div class="tile-icon">
<div> <div>
@@ -68,7 +68,7 @@
<button <button
class="btn btn-link remove-field p-0 mr-2" class="btn btn-link remove-field p-0 mr-2"
:title="$t('word.delete')" :title="$t('word.delete')"
@click.prevent="removeIndex(foreign._id)" @click.prevent="removeIndex(foreign._antares_id)"
> >
<i class="mdi mdi-close" /> <i class="mdi mdi-close" />
</button> </button>
@@ -197,7 +197,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>
@@ -238,7 +238,7 @@ export default {
}, },
computed: { computed: {
selectedForeignObj () { selectedForeignObj () {
return this.foreignProxy.find(foreign => foreign._id === this.selectedForeignID); return this.foreignProxy.find(foreign => foreign._antares_id === this.selectedForeignID);
}, },
isChanged () { isChanged () {
return JSON.stringify(this.localKeyUsage) !== JSON.stringify(this.foreignProxy); return JSON.stringify(this.localKeyUsage) !== JSON.stringify(this.foreignProxy);
@@ -288,8 +288,8 @@ export default {
}, },
addForeign () { addForeign () {
this.foreignProxy = [...this.foreignProxy, { this.foreignProxy = [...this.foreignProxy, {
_id: uidGen(), _antares_id: uidGen(),
constraintName: `FK_${this.foreignProxy.length + 1}`, constraintName: `FK_${uidGen()}`,
refSchema: this.schema, refSchema: this.schema,
table: this.table, table: this.table,
refTable: '', refTable: '',
@@ -307,19 +307,19 @@ export default {
}, 20); }, 20);
}, },
removeIndex (id) { removeIndex (id) {
this.foreignProxy = this.foreignProxy.filter(foreign => foreign._id !== id); this.foreignProxy = this.foreignProxy.filter(foreign => foreign._antares_id !== id);
if (this.selectedForeignID === id && this.foreignProxy.length) if (this.selectedForeignID === id && this.foreignProxy.length)
this.resetSelectedID(); this.resetSelectedID();
}, },
clearChanges () { clearChanges () {
this.foreignProxy = JSON.parse(JSON.stringify(this.localKeyUsage)); this.foreignProxy = JSON.parse(JSON.stringify(this.localKeyUsage));
if (!this.foreignProxy.some(foreign => foreign._id === this.selectedForeignID)) if (!this.foreignProxy.some(foreign => foreign._antares_id === this.selectedForeignID))
this.resetSelectedID(); this.resetSelectedID();
}, },
toggleField (field) { toggleField (field) {
this.foreignProxy = this.foreignProxy.map(foreign => { this.foreignProxy = this.foreignProxy.map(foreign => {
if (foreign._id === this.selectedForeignID) if (foreign._antares_id === this.selectedForeignID)
foreign.field = field; foreign.field = field;
return foreign; return foreign;
@@ -327,14 +327,14 @@ export default {
}, },
toggleRefField (field) { toggleRefField (field) {
this.foreignProxy = this.foreignProxy.map(foreign => { this.foreignProxy = this.foreignProxy.map(foreign => {
if (foreign._id === this.selectedForeignID) if (foreign._antares_id === this.selectedForeignID)
foreign.refField = field; foreign.refField = field;
return foreign; return foreign;
}); });
}, },
resetSelectedID () { resetSelectedID () {
this.selectedForeignID = this.foreignProxy.length ? this.foreignProxy[0]._id : ''; this.selectedForeignID = this.foreignProxy.length ? this.foreignProxy[0]._antares_id : '';
}, },
async getRefFields () { async getRefFields () {
if (!this.selectedForeignObj.refTable) return; if (!this.selectedForeignObj.refTable) return;

View File

@@ -6,13 +6,13 @@
@confirm="confirmIndexesChange" @confirm="confirmIndexesChange"
@hide="$emit('hide')" @hide="$emit('hide')"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-key mdi-rotate-45 mr-1" /> <i class="mdi mdi-24px mdi-key mdi-rotate-45 mr-1" />
<span class="cut-text">{{ $t('word.indexes') }} "{{ table }}"</span> <span class="cut-text">{{ $t('word.indexes') }} "{{ table }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="columns col-gapless"> <div class="columns col-gapless">
<div class="column col-5"> <div class="column col-5">
<div class="panel" :style="{ height: modalInnerHeight + 'px'}"> <div class="panel" :style="{ height: modalInnerHeight + 'px'}">
@@ -36,10 +36,10 @@
<div ref="indexesPanel" class="panel-body p-0 pr-1"> <div ref="indexesPanel" class="panel-body p-0 pr-1">
<div <div
v-for="index in indexesProxy" v-for="index in indexesProxy"
:key="index._id" :key="index._antares_id"
class="tile tile-centered c-hand mb-1 p-1" class="tile tile-centered c-hand mb-1 p-1"
:class="{'selected-element': selectedIndexID === index._id}" :class="{'selected-element': selectedIndexID === index._antares_id}"
@click="selectIndex($event, index._id)" @click="selectIndex($event, index._antares_id)"
> >
<div class="tile-icon"> <div class="tile-icon">
<div> <div>
@@ -56,7 +56,7 @@
<button <button
class="btn btn-link remove-field p-0 mr-2" class="btn btn-link remove-field p-0 mr-2"
:title="$t('word.delete')" :title="$t('word.delete')"
@click.prevent="removeIndex(index._id)" @click.prevent="removeIndex(index._antares_id)"
> >
<i class="mdi mdi-close" /> <i class="mdi mdi-close" />
</button> </button>
@@ -133,7 +133,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</template> </template>
@@ -163,7 +163,7 @@ export default {
}, },
computed: { computed: {
selectedIndexObj () { selectedIndexObj () {
return this.indexesProxy.find(index => index._id === this.selectedIndexID); return this.indexesProxy.find(index => index._antares_id === this.selectedIndexID);
}, },
isChanged () { isChanged () {
return JSON.stringify(this.localIndexes) !== JSON.stringify(this.indexesProxy); return JSON.stringify(this.localIndexes) !== JSON.stringify(this.indexesProxy);
@@ -200,7 +200,7 @@ export default {
}, },
addIndex () { addIndex () {
this.indexesProxy = [...this.indexesProxy, { this.indexesProxy = [...this.indexesProxy, {
_id: uidGen(), _antares_id: uidGen(),
name: 'NEW_INDEX', name: 'NEW_INDEX',
fields: [], fields: [],
type: 'INDEX', type: 'INDEX',
@@ -218,19 +218,19 @@ export default {
}, 20); }, 20);
}, },
removeIndex (id) { removeIndex (id) {
this.indexesProxy = this.indexesProxy.filter(index => index._id !== id); this.indexesProxy = this.indexesProxy.filter(index => index._antares_id !== id);
if (this.selectedIndexID === id && this.indexesProxy.length) if (this.selectedIndexID === id && this.indexesProxy.length)
this.resetSelectedID(); this.resetSelectedID();
}, },
clearChanges () { clearChanges () {
this.indexesProxy = JSON.parse(JSON.stringify(this.localIndexes)); this.indexesProxy = JSON.parse(JSON.stringify(this.localIndexes));
if (!this.indexesProxy.some(index => index._id === this.selectedIndexID)) if (!this.indexesProxy.some(index => index._antares_id === this.selectedIndexID))
this.resetSelectedID(); this.resetSelectedID();
}, },
toggleField (field) { toggleField (field) {
this.indexesProxy = this.indexesProxy.map(index => { this.indexesProxy = this.indexesProxy.map(index => {
if (index._id === this.selectedIndexID) { if (index._antares_id === this.selectedIndexID) {
if (index.fields.includes(field)) if (index.fields.includes(field))
index.fields = index.fields.filter(f => f !== field); index.fields = index.fields.filter(f => f !== field);
else else
@@ -240,7 +240,7 @@ export default {
}); });
}, },
resetSelectedID () { resetSelectedID () {
this.selectedIndexID = this.indexesProxy.length ? this.indexesProxy[0]._id : ''; this.selectedIndexID = this.indexesProxy.length ? this.indexesProxy[0]._antares_id : '';
} }
} }
}; };

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="tr" @contextmenu.prevent="$emit('contextmenu', $event, localRow._id)"> <div class="tr" @contextmenu.prevent="$emit('contextmenu', $event, localRow._antares_id)">
<div class="td p-0" tabindex="0"> <div class="td p-0" tabindex="0">
<div :class="customizations.sortableFields ? 'row-draggable' : 'text-center'"> <div :class="customizations.sortableFields ? 'row-draggable' : 'text-center'">
<i v-if="customizations.sortableFields" class="mdi mdi-drag-horizontal row-draggable-icon" /> <i v-if="customizations.sortableFields" class="mdi mdi-drag-horizontal row-draggable-icon" />
@@ -99,6 +99,9 @@
<span v-if="localRow.enumValues"> <span v-if="localRow.enumValues">
{{ localRow.enumValues }} {{ localRow.enumValues }}
</span> </span>
<span v-else-if="localRow.numScale">
{{ localLength }}, {{ localRow.numScale }}
</span>
<span v-else> <span v-else>
{{ localLength }} {{ localLength }}
</span> </span>
@@ -112,6 +115,16 @@
class="editable-field form-input input-sm px-1" class="editable-field form-input input-sm px-1"
@blur="editOFF" @blur="editOFF"
> >
<input
v-else-if="fieldType.scale"
ref="editField"
v-model="editingContent"
type="text"
autofocus
class="editable-field form-input input-sm px-1"
@keypress="checkLengthScale"
@blur="editOFF"
>
<input <input
v-else v-else
ref="editField" ref="editField"
@@ -230,13 +243,13 @@
@confirm="editOFF" @confirm="editOFF"
@hide="hideDefaultModal" @hide="hideDefaultModal"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-edit mr-1" /> <i class="mdi mdi-24px mdi-playlist-edit mr-1" />
<span class="cut-text">{{ $t('word.default') }} "{{ row.name }}"</span> <span class="cut-text">{{ $t('word.default') }} "{{ row.name }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="mb-2"> <div class="mb-2">
<label class="form-radio form-inline"> <label class="form-radio form-inline">
@@ -324,7 +337,7 @@
</div> </div>
</div> </div>
</form> </form>
</div> </template>
</ConfirmModal> </ConfirmModal>
</div> </div>
</template> </template>
@@ -367,7 +380,8 @@ export default {
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace'
}), }),
localLength () { localLength () {
return this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0; const localLength = this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
return localLength === true ? null : localLength;
}, },
fieldType () { fieldType () {
const fieldType = this.dataTypes.reduce((acc, group) => [...acc, ...group.types], []).filter(type => const fieldType = this.dataTypes.reduce((acc, group) => [...acc, ...group.types], []).filter(type =>
@@ -391,7 +405,7 @@ export default {
return this.indexes.some(index => ['PRIMARY', 'UNIQUE'].includes(index.type)); return this.indexes.some(index => ['PRIMARY', 'UNIQUE'].includes(index.type));
}, },
isNullable () { isNullable () {
return !this.indexes.some(index => ['PRIMARY'].includes(index.type)); return this.customizations.nullablePrimary || !this.indexes.some(index => ['PRIMARY'].includes(index.type));
}, },
isInDataTypes () { isInDataTypes () {
let typeNames = []; let typeNames = [];
@@ -479,6 +493,11 @@ export default {
this.editingContent = this.localRow.enumValues; this.editingContent = this.localRow.enumValues;
this.originalContent = this.localRow.enumValues; this.originalContent = this.localRow.enumValues;
} }
else if (this.fieldType.scale && field === 'length') {
const scale = this.localRow.numScale !== null ? this.localRow.numScale : 0;
this.editingContent = `${content}, ${scale}`;
this.originalContent = `${content}, ${scale}`;
}
else { else {
this.editingContent = content; this.editingContent = content;
this.originalContent = content; this.originalContent = content;
@@ -501,10 +520,17 @@ export default {
if (this.editingField === 'name') if (this.editingField === 'name')
this.$emit('rename-field', { old: this.localRow[this.editingField], new: this.editingContent }); this.$emit('rename-field', { old: this.localRow[this.editingField], new: this.editingContent });
this.localRow[this.editingField] = this.editingContent; if (this.editingField === 'numLength' && this.fieldType.scale) {
const [length, scale] = this.editingContent.split(',');
this.localRow.numLength = +length;
this.localRow.numScale = scale ? +scale : null;
}
else
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.numScale = null;
this.localRow.charLength = null; this.localRow.charLength = null;
this.localRow.datePrecision = null; this.localRow.datePrecision = null;
this.localRow.enumValues = ''; this.localRow.enumValues = '';
@@ -559,6 +585,15 @@ export default {
this.originalContent = null; this.originalContent = null;
this.editingField = null; this.editingField = null;
}, },
checkLengthScale (e) {
e = (e) || window.event;
const charCode = (e.which) ? e.which : e.keyCode;
if (((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode !== 44) || (charCode === 44 && e.target.value.includes(',')))
e.preventDefault();
else
return true;
},
hideDefaultModal () { hideDefaultModal () {
this.isDefaultModal = false; this.isDefaultModal = false;
} }

View File

@@ -238,7 +238,7 @@ export default {
this.originalFunction = response; this.originalFunction = response;
this.originalFunction.parameters = [...this.originalFunction.parameters.map(param => { this.originalFunction.parameters = [...this.originalFunction.parameters.map(param => {
param._id = uidGen(); param._antares_id = uidGen();
return param; return param;
})]; })];

View File

@@ -4,6 +4,7 @@
class="workspace-query-tab column col-12 columns col-gapless no-outline p-0" class="workspace-query-tab column col-12 columns col-gapless no-outline p-0"
tabindex="0" tabindex="0"
@keydown.116="runQuery(query)" @keydown.116="runQuery(query)"
@keydown.75="killTabQuery"
@keydown.ctrl.alt.87="clear" @keydown.ctrl.alt.87="clear"
@keydown.ctrl.66="beautify" @keydown.ctrl.66="beautify"
@keydown.ctrl.71="openHistoryModal" @keydown.ctrl.71="openHistoryModal"
@@ -22,16 +23,29 @@
<div ref="resizer" class="query-area-resizer" /> <div ref="resizer" class="query-area-resizer" />
<div class="workspace-query-runner-footer"> <div class="workspace-query-runner-footer">
<div class="workspace-query-buttons"> <div class="workspace-query-buttons">
<button <div @mouseenter="setCancelButtonVisibility(true)" @mouseleave="setCancelButtonVisibility(false)">
class="btn btn-primary btn-sm" <button
:class="{'loading':isQuering}" v-if="showCancel && isQuering"
:disabled="!query" class="btn btn-primary btn-sm cancellable"
title="F5" :disabled="!query"
@click="runQuery(query)" :title="$t('word.cancel')"
> @click="killTabQuery()"
<i class="mdi mdi-24px mdi-play pr-1" /> >
<span>{{ $t('word.run') }}</span> <i class="mdi mdi-24px mdi-window-close" />
</button> <span class="d-invisible pr-1">{{ $t('word.run') }}</span>
</button>
<button
v-else
class="btn btn-primary btn-sm"
:class="{'loading':isQuering}"
:disabled="!query"
title="F5"
@click="runQuery(query)"
>
<i class="mdi mdi-24px mdi-play pr-1" />
<span>{{ $t('word.run') }}</span>
</button>
</div>
<button <button
class="btn btn-link btn-sm mr-0" class="btn btn-link btn-sm mr-0"
:disabled="!query || isQuering" :disabled="!query || isQuering"
@@ -93,7 +107,7 @@
<div v-if="resultsCount"> <div v-if="resultsCount">
{{ $t('word.results') }}: <b>{{ resultsCount.toLocaleString() }}</b> {{ $t('word.results') }}: <b>{{ resultsCount.toLocaleString() }}</b>
</div> </div>
<div v-if="affectedCount"> <div v-if="affectedCount !== null">
{{ $t('message.affectedRows') }}: <b>{{ affectedCount }}</b> {{ $t('message.affectedRows') }}: <b>{{ affectedCount }}</b>
</div> </div>
<div class="input-group" :title="$t('word.schema')"> <div class="input-group" :title="$t('word.schema')">
@@ -110,7 +124,7 @@
</div> </div>
</div> </div>
</div> </div>
<WorkspaceTabQueryEmptyState v-if="!results.length && !isQuering" /> <WorkspaceTabQueryEmptyState v-if="!results.length && !isQuering" :customizations="workspace.customizations" />
<div class="workspace-query-results p-relative column col-12"> <div class="workspace-query-results p-relative column col-12">
<BaseLoader v-if="isQuering" /> <BaseLoader v-if="isQuering" />
<WorkspaceTabQueryTable <WorkspaceTabQueryTable
@@ -166,11 +180,13 @@ export default {
query: '', query: '',
lastQuery: '', lastQuery: '',
isQuering: false, isQuering: false,
isCancelling: false,
showCancel: false,
results: [], results: [],
selectedSchema: null, selectedSchema: null,
resultsCount: 0, resultsCount: 0,
durationsCount: 0, durationsCount: 0,
affectedCount: 0, affectedCount: null,
editorHeight: 200, editorHeight: 200,
isHistoryOpen: false isHistoryOpen: false
}; };
@@ -202,8 +218,13 @@ export default {
}, },
watch: { watch: {
isSelected (val) { isSelected (val) {
if (val) if (val) {
this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` }); this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` });
setTimeout(() => {
if (this.$refs.queryEditor)
this.$refs.queryEditor.editor.focus();
}, 0);
}
}, },
selectedSchema () { selectedSchema () {
this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` }); this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` });
@@ -248,6 +269,7 @@ export default {
const params = { const params = {
uid: this.connection.uid, uid: this.connection.uid,
schema: this.selectedSchema, schema: this.selectedSchema,
tabUid: this.tab.uid,
query query
}; };
@@ -255,9 +277,14 @@ export default {
if (status === 'success') { if (status === 'success') {
this.results = Array.isArray(response) ? response : [response]; this.results = Array.isArray(response) ? response : [response];
this.resultsCount += this.results.reduce((acc, curr) => acc + (curr.rows ? curr.rows.length : 0), 0); this.resultsCount = this.results.reduce((acc, curr) => acc + (curr.rows ? curr.rows.length : 0), 0);
this.durationsCount += this.results.reduce((acc, curr) => acc + curr.duration, 0); this.durationsCount = this.results.reduce((acc, curr) => acc + curr.duration, 0);
this.affectedCount += this.results.reduce((acc, curr) => acc + (curr.report ? curr.report.affectedRows : 0), 0); this.affectedCount = this.results
.filter(result => result.report !== null)
.reduce((acc, curr) => {
if (acc === null) acc = 0;
return acc + (curr.report ? curr.report.affectedRows : 0);
}, null);
this.updateTabContent({ this.updateTabContent({
uid: this.connection.uid, uid: this.connection.uid,
@@ -278,6 +305,29 @@ export default {
this.isQuering = false; this.isQuering = false;
this.lastQuery = query; this.lastQuery = query;
}, },
async killTabQuery () {
if (this.isCancelling) return;
this.isCancelling = true;
try {
const params = {
uid: this.connection.uid,
tabUid: this.tab.uid
};
await Schema.killTabQuery(params);
}
catch (err) {
this.addNotification({ status: 'error', message: err.stack });
}
this.isCancelling = false;
},
setCancelButtonVisibility (val) {
if (this.workspace.customizations.cancelQueries)
this.showCancel = val;
},
reloadTable () { reloadTable () {
this.runQuery(this.lastQuery); this.runQuery(this.lastQuery);
}, },
@@ -285,7 +335,7 @@ export default {
this.results = []; this.results = [];
this.resultsCount = 0; this.resultsCount = 0;
this.durationsCount = 0; this.durationsCount = 0;
this.affectedCount = 0; this.affectedCount = null;
}, },
resize (e) { resize (e) {
const el = this.$refs.queryEditor.$el; const el = this.$refs.queryEditor.$el;

View File

@@ -5,6 +5,9 @@
<div class="mb-4"> <div class="mb-4">
{{ $t('message.runQuery') }} {{ $t('message.runQuery') }}
</div> </div>
<div v-if="customizations.cancelQueries" class="mb-4">
{{ $t('message.killQuery') }}
</div>
<div class="mb-4"> <div class="mb-4">
{{ $t('word.format') }} {{ $t('word.format') }}
</div> </div>
@@ -25,6 +28,9 @@
<div class="mb-4"> <div class="mb-4">
<code>F5</code> <code>F5</code>
</div> </div>
<div v-if="customizations.cancelQueries" class="mb-4">
<code>CTRL</code> + <code>K</code>
</div>
<div class="mb-4"> <div class="mb-4">
<code>CTRL</code> + <code>B</code> <code>CTRL</code> + <code>B</code>
</div> </div>
@@ -47,7 +53,10 @@
<script> <script>
export default { export default {
name: 'WorkspaceTabQueryEmptyState' name: 'WorkspaceTabQueryEmptyState',
props: {
customizations: Object
}
}; };
</script> </script>

View File

@@ -5,7 +5,7 @@
tabindex="0" tabindex="0"
:style="{'height': resultsSize+'px'}" :style="{'height': resultsSize+'px'}"
@keyup.46="showDeleteConfirmModal" @keyup.46="showDeleteConfirmModal"
@keydown.ctrl.65="selectAllRows" @keydown.ctrl.65="selectAllRows($event)"
@keydown.esc="deselectRows" @keydown.esc="deselectRows"
> >
<TableContext <TableContext
@@ -53,6 +53,7 @@
class="mdi sort-icon" class="mdi sort-icon"
:class="currentSortDir === 'asc' ? 'mdi-sort-ascending':'mdi-sort-descending'" :class="currentSortDir === 'asc' ? 'mdi-sort-ascending':'mdi-sort-descending'"
/> />
<i v-else class="mdi sort-icon mdi-minus d-invisible" />
</div> </div>
</div> </div>
</div> </div>
@@ -62,7 +63,7 @@
v-if="resultsWithRows[resultsetIndex] && resultsWithRows[resultsetIndex].rows" v-if="resultsWithRows[resultsetIndex] && resultsWithRows[resultsetIndex].rows"
ref="resultTable" ref="resultTable"
:items="sortedResults" :items="sortedResults"
:item-height="22" :item-height="rowHeight"
class="tbody" class="tbody"
:visible-height="resultsSize" :visible-height="resultsSize"
:scroll-element="scrollElement" :scroll-element="scrollElement"
@@ -70,13 +71,14 @@
<template slot-scope="{ items }"> <template slot-scope="{ items }">
<WorkspaceTabQueryTableRow <WorkspaceTabQueryTableRow
v-for="row in items" v-for="row in items"
:key="row._id" :key="row._antares_id"
:item-height="rowHeight"
:row="row" :row="row"
:fields="fieldsObj" :fields="fieldsObj"
:key-usage="keyUsage" :key-usage="keyUsage"
:element-type="elementType" :element-type="elementType"
:class="{'selected': selectedRows.includes(row._id)}" :class="{'selected': selectedRows.includes(row._antares_id)}"
@select-row="selectRow($event, row._id)" @select-row="selectRow($event, row._antares_id)"
@update-field="updateField($event, row)" @update-field="updateField($event, row)"
@contextmenu="contextMenu" @contextmenu="contextMenu"
/> />
@@ -89,17 +91,17 @@
@confirm="deleteSelected" @confirm="deleteSelected"
@hide="hideDeleteConfirmModal" @hide="hideDeleteConfirmModal"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-delete mr-1" /> <i class="mdi mdi-24px mdi-delete mr-1" />
<span class="cut-text">{{ $tc('message.deleteRows', selectedRows.length) }}</span> <span class="cut-text">{{ $tc('message.deleteRows', selectedRows.length) }}</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="mb-2"> <div class="mb-2">
{{ $tc('message.confirmToDeleteRows', selectedRows.length) }} {{ $tc('message.confirmToDeleteRows', selectedRows.length) }}
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</div> </div>
</template> </template>
@@ -142,7 +144,8 @@ export default {
currentSort: '', currentSort: '',
currentSortDir: 'asc', currentSortDir: 'asc',
resultsetIndex: 0, resultsetIndex: 0,
scrollElement: null scrollElement: null,
rowHeight: 23
}; };
}, },
computed: { computed: {
@@ -196,7 +199,7 @@ export default {
if (this.sortedResults.length) { if (this.sortedResults.length) {
const fieldsObj = {}; const fieldsObj = {};
for (const key in this.sortedResults[0]) { for (const key in this.sortedResults[0]) {
if (key === '_id') continue; if (key === '_antares_id') continue;
const fieldObj = this.fields.find(field => { const fieldObj = this.fields.find(field => {
let fieldNames = [ let fieldNames = [
@@ -242,6 +245,11 @@ export default {
if (this.$refs.tableWrapper) if (this.$refs.tableWrapper)
this.scrollElement = this.$refs.tableWrapper; this.scrollElement = this.$refs.tableWrapper;
document.querySelectorAll('.column-resizable').forEach(element => {
if (element.clientWidth !== 0)
element.style.width = element.clientWidth + 'px';
});
}, },
mounted () { mounted () {
window.addEventListener('resize', this.resizeResults); window.addEventListener('resize', this.resizeResults);
@@ -272,6 +280,7 @@ export default {
fieldLength (field) { fieldLength (field) {
if ([...BLOB, ...LONG_TEXT].includes(field.type)) return null; if ([...BLOB, ...LONG_TEXT].includes(field.type)) return null;
else if (TEXT.includes(field.type)) return field.charLength; else if (TEXT.includes(field.type)) return field.charLength;
else if (field.numScale) return `${field.numPrecision}, ${field.numScale}`;
return field.length; return field.length;
}, },
keyName (key) { keyName (key) {
@@ -310,7 +319,7 @@ export default {
setLocalResults () { setLocalResults () {
this.localResults = this.resultsWithRows[this.resultsetIndex] && this.resultsWithRows[this.resultsetIndex].rows this.localResults = this.resultsWithRows[this.resultsetIndex] && this.resultsWithRows[this.resultsetIndex].rows
? this.resultsWithRows[this.resultsetIndex].rows.map(item => { ? this.resultsWithRows[this.resultsetIndex].rows.map(item => {
return { ...item, _id: uidGen() }; return { ...item, _antares_id: uidGen() };
}) })
: []; : [];
}, },
@@ -330,7 +339,7 @@ export default {
this.resizeResults(); this.resizeResults();
}, },
updateField (payload, row) { updateField (payload, row) {
const orgRow = this.localResults.find(lr => lr._id === row._id); const orgRow = this.localResults.find(lr => lr._antares_id === row._antares_id);
Object.keys(orgRow).forEach(key => { // remap the row Object.keys(orgRow).forEach(key => { // remap the row
if (orgRow[key] instanceof Date && moment(orgRow[key]).isValid()) { // if datetime if (orgRow[key] instanceof Date && moment(orgRow[key]).isValid()) { // if datetime
@@ -367,8 +376,8 @@ export default {
}, },
deleteSelected () { deleteSelected () {
this.closeContext(); this.closeContext();
const rows = this.localResults.filter(row => this.selectedRows.includes(row._id)).map(row => { const rows = JSON.parse(JSON.stringify(this.localResults)).filter(row => this.selectedRows.includes(row._antares_id)).map(row => {
delete row._id; delete row._antares_id;
return row; return row;
}); });
@@ -381,7 +390,7 @@ export default {
this.$emit('delete-selected', params); this.$emit('delete-selected', params);
}, },
setNull () { setNull () {
const row = this.localResults.find(row => this.selectedRows.includes(row._id)); const row = this.localResults.find(row => this.selectedRows.includes(row._antares_id));
const params = { const params = {
primary: this.primaryField.name, primary: this.primaryField.name,
@@ -396,19 +405,22 @@ export default {
this.$emit('update-field', params); this.$emit('update-field', params);
}, },
copyCell () { copyCell () {
const row = this.localResults.find(row => this.selectedRows.includes(row._id)); const row = this.localResults.find(row => this.selectedRows.includes(row._antares_id));
const cellName = Object.keys(row).find(prop => [ const cellName = Object.keys(row).find(prop => [
this.selectedCell.field, this.selectedCell.field,
this.selectedCell.orgField,
`${this.fields[0].table}.${this.selectedCell.field}`, `${this.fields[0].table}.${this.selectedCell.field}`,
`${this.fields[0].tableAlias}.${this.selectedCell.field}` `${this.fields[0].tableAlias}.${this.selectedCell.field}`
].includes(prop)); ].includes(prop));
const valueToCopy = row[cellName]; let valueToCopy = row[cellName];
if (typeof valueToCopy === 'object')
valueToCopy = JSON.stringify(valueToCopy);
navigator.clipboard.writeText(valueToCopy); navigator.clipboard.writeText(valueToCopy);
}, },
copyRow () { copyRow () {
const row = this.localResults.find(row => this.selectedRows.includes(row._id)); const row = this.localResults.find(row => this.selectedRows.includes(row._antares_id));
const rowToCopy = JSON.parse(JSON.stringify(row)); const rowToCopy = JSON.parse(JSON.stringify(row));
delete rowToCopy._id; delete rowToCopy._antares_id;
navigator.clipboard.writeText(JSON.stringify(rowToCopy)); navigator.clipboard.writeText(JSON.stringify(rowToCopy));
}, },
applyUpdate (params) { applyUpdate (params) {
@@ -435,24 +447,26 @@ 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.sortedResults.findIndex(el => el._id === lastID); const lastIndex = this.sortedResults.findIndex(el => el._antares_id === lastID);
const clickedIndex = this.sortedResults.findIndex(el => el._id === row); const clickedIndex = this.sortedResults.findIndex(el => el._antares_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.sortedResults[i]._id); this.selectedRows.push(this.sortedResults[i]._antares_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.sortedResults[i]._id); this.selectedRows.push(this.sortedResults[i]._antares_id);
} }
} }
} }
else else
this.selectedRows = [row]; this.selectedRows = [row];
}, },
selectAllRows () { selectAllRows (e) {
if (e.target.classList.contains('editable-field')) return;
this.selectedRows = this.localResults.reduce((acc, curr) => { this.selectedRows = this.localResults.reduce((acc, curr) => {
acc.push(curr._id); acc.push(curr._antares_id);
return acc; return acc;
}, []); }, []);
}, },
@@ -501,7 +515,7 @@ export default {
if (!this.sortedResults) return; if (!this.sortedResults) return;
const rows = JSON.parse(JSON.stringify(this.sortedResults)).map(row => { const rows = JSON.parse(JSON.stringify(this.sortedResults)).map(row => {
delete row._id; delete row._antares_id;
return row; return row;
}); });

View File

@@ -61,8 +61,6 @@ export default {
selectedRows: Array, selectedRows: Array,
selectedCell: Object selectedCell: Object
}, },
computed: {
},
methods: { methods: {
showConfirmModal () { showConfirmModal () {
this.$emit('show-delete-modal'); this.$emit('show-delete-modal');

View File

@@ -1,14 +1,18 @@
<template> <template>
<div class="tr" @click="selectRow($event, row._id)"> <div
class="tr"
:style="{height: itemHeight+'px'}"
@click="selectRow($event, row._antares_id)"
>
<div <div
v-for="(col, cKey) in row" v-for="(col, cKey) in row"
v-show="cKey !== '_id'" v-show="cKey !== '_antares_id'"
:key="cKey" :key="cKey"
class="td p-0" class="td p-0"
tabindex="0" tabindex="0"
@contextmenu.prevent="openContext($event, { id: row._id, field: cKey })" @contextmenu.prevent="openContext($event, { id: row._antares_id, orgField: cKey })"
> >
<template v-if="cKey !== '_id'"> <template v-if="cKey !== '_antares_id'">
<span <span
v-if="!isInlineEditor[cKey] && fields[cKey]" v-if="!isInlineEditor[cKey] && fields[cKey]"
class="cell-content" class="cell-content"
@@ -72,12 +76,12 @@
@confirm="editOFF" @confirm="editOFF"
@hide="hideEditorModal" @hide="hideEditorModal"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-edit mr-1" /> <span class="cut-text">{{ $t('word.edit') }} "{{ editingField }}"</span> <i class="mdi mdi-24px mdi-playlist-edit mr-1" /> <span class="cut-text">{{ $t('word.edit') }} "{{ editingField }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="mb-2"> <div class="mb-2">
<div> <div>
<TextEditor <TextEditor
@@ -96,23 +100,12 @@
v-model="editorMode" v-model="editorMode"
class="form-select select-sm" class="form-select select-sm"
> >
<option value="text"> <option
TEXT v-for="language in availableLanguages"
</option> :key="language.slug"
<option value="html"> :value="language.slug"
HTML >
</option> {{ language.name }}
<option value="xml">
XML
</option>
<option value="json">
JSON
</option>
<option value="svg">
SVG
</option>
<option value="yaml">
YAML
</option> </option>
</select> </select>
</div> </div>
@@ -128,7 +121,22 @@
</div> </div>
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal>
<ConfirmModal
v-if="isMapModal"
:hide-footer="true"
size="medium"
@hide="hideEditorModal"
>
<template #header>
<div class="d-flex">
<i class="mdi mdi-24px mdi-map mr-1" /> <span class="cut-text">"{{ editingField }}"</span>
</div>
</template>
<template #body>
<BaseMap :points="editingContent" :is-multi-spatial="isMultiSpatial" />
</template>
</ConfirmModal> </ConfirmModal>
<ConfirmModal <ConfirmModal
v-if="isBlobEditor" v-if="isBlobEditor"
@@ -136,13 +144,13 @@
@confirm="editOFF" @confirm="editOFF"
@hide="hideEditorModal" @hide="hideEditorModal"
> >
<template :slot="'header'"> <template #header>
<div class="d-flex"> <div class="d-flex">
<i class="mdi mdi-24px mdi-playlist-edit mr-1" /> <i class="mdi mdi-24px mdi-playlist-edit mr-1" />
<span class="cut-text">{{ $t('word.edit') }} "{{ editingField }}"</span> <span class="cut-text">{{ $t('word.edit') }} "{{ editingField }}"</span>
</div> </div>
</template> </template>
<div :slot="'body'"> <template #body>
<div class="mb-2"> <div class="mb-2">
<transition name="jump-down"> <transition name="jump-down">
<div v-if="contentInfo.size"> <div v-if="contentInfo.size">
@@ -182,21 +190,39 @@
> >
</div> </div>
</div> </div>
</div> </template>
</ConfirmModal> </ConfirmModal>
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment'; import moment from 'moment';
import { ModelOperations } from '@vscode/vscode-languagedetection';
import { mimeFromHex } from 'common/libs/mimeFromHex'; import { mimeFromHex } from 'common/libs/mimeFromHex';
import { formatBytes } from 'common/libs/formatBytes'; import { formatBytes } from 'common/libs/formatBytes';
import { 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, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BOOLEAN, DATE, TIME, DATETIME, BLOB, BIT, HAS_TIMEZONE } from 'common/fieldTypes'; import {
TEXT,
LONG_TEXT,
ARRAY,
TEXT_SEARCH,
NUMBER,
FLOAT,
BOOLEAN,
DATE,
TIME,
DATETIME,
BLOB,
BIT,
HAS_TIMEZONE,
SPATIAL,
IS_MULTI_SPATIAL
} 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';
import BaseMap from '@/components/BaseMap';
import ForeignKeySelect from '@/components/ForeignKeySelect'; import ForeignKeySelect from '@/components/ForeignKeySelect';
export default { export default {
@@ -204,7 +230,8 @@ export default {
components: { components: {
ConfirmModal, ConfirmModal,
TextEditor, TextEditor,
ForeignKeySelect ForeignKeySelect,
BaseMap
}, },
directives: { directives: {
mask: VueMaskDirective mask: VueMaskDirective
@@ -254,13 +281,17 @@ export default {
return val; return val;
} }
return val; if (SPATIAL.includes(type))
return val;
return typeof val === 'object' ? JSON.stringify(val) : val;
} }
}, },
props: { props: {
row: Object, row: Object,
fields: Object, fields: Object,
keyUsage: Array, keyUsage: Array,
itemHeight: Number,
elementType: { type: String, default: 'table' } elementType: { type: String, default: 'table' }
}, },
data () { data () {
@@ -268,6 +299,8 @@ export default {
isInlineEditor: {}, isInlineEditor: {},
isTextareaEditor: false, isTextareaEditor: false,
isBlobEditor: false, isBlobEditor: false,
isMapModal: false,
isMultiSpatial: false,
willBeDeleted: false, willBeDeleted: false,
originalContent: null, originalContent: null,
editingContent: null, editingContent: null,
@@ -280,7 +313,17 @@ export default {
mime: '', mime: '',
size: null size: null
}, },
fileToUpload: null fileToUpload: null,
availableLanguages: [
{ name: 'TEXT', slug: 'text', id: 'text' },
{ name: 'HTML', slug: 'html', id: 'html' },
{ name: 'XML', slug: 'xml', id: 'xml' },
{ name: 'JSON', slug: 'json', id: 'json' },
{ name: 'SVG', slug: 'svg', id: 'svg' },
{ name: 'INI', slug: 'ini', id: 'ini' },
{ name: 'MARKDOWN', slug: 'markdown', id: 'md' },
{ name: 'YAML', slug: 'yaml', id: 'yaml' }
]
}; };
}, },
computed: { computed: {
@@ -326,6 +369,9 @@ export default {
if (BOOLEAN.includes(this.editingType)) if (BOOLEAN.includes(this.editingType))
return { type: 'boolean', mask: false }; return { type: 'boolean', mask: false };
if (SPATIAL.includes(this.editingType))
return { type: 'map', mask: false };
return { type: 'text', mask: false }; return { type: 'text', mask: false };
}, },
isImage () { isImage () {
@@ -362,6 +408,21 @@ export default {
Object.keys(this.fields).forEach(field => { Object.keys(this.fields).forEach(field => {
this.isInlineEditor[field.name] = false; this.isInlineEditor[field.name] = false;
}); });
},
isTextareaEditor (val) {
if (val) {
const modelOperations = new ModelOperations();
(async () => {
const detected = await modelOperations.runModel(this.editingContent);
const filteredLanguages = detected.filter(dLang =>
this.availableLanguages.some(aLang => aLang.id === dLang.languageId) &&
dLang.confidence > 0.1
);
if (filteredLanguages.length)
this.editorMode = this.availableLanguages.find(lang => lang.id === filteredLanguages[0].languageId).slug;
})();
}
} }
}, },
methods: { methods: {
@@ -383,7 +444,7 @@ export default {
return bufferToBase64(val); return bufferToBase64(val);
}, },
editON (event, content, field) { editON (event, content, field) {
if (!this.isEditable) return; if (!this.isEditable || this.editingType === 'none') return;
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
@@ -399,6 +460,15 @@ export default {
return; return;
} }
if (SPATIAL.includes(type)) {
if (content) {
this.isMultiSpatial = IS_MULTI_SPATIAL.includes(type);
this.isMapModal = true;
this.editingContent = this.$options.filters.typeFormat(content, type);
}
return;
}
if (BLOB.includes(type)) { if (BLOB.includes(type)) {
this.isBlobEditor = true; this.isBlobEditor = true;
this.editingContent = content || ''; this.editingContent = content || '';
@@ -470,6 +540,8 @@ export default {
hideEditorModal () { hideEditorModal () {
this.isTextareaEditor = false; this.isTextareaEditor = false;
this.isBlobEditor = false; this.isBlobEditor = false;
this.isMapModal = false;
this.isMultiSpatial = false;
}, },
downloadFile () { downloadFile () {
const downloadLink = document.createElement('a'); const downloadLink = document.createElement('a');
@@ -506,7 +578,7 @@ export default {
return this.keyUsage.find(key => key.field === keyName); return this.keyUsage.find(key => key.field === keyName);
}, },
openContext (event, payload) { openContext (event, payload) {
payload.field = this.fields[payload.field].name;// Ensures field name only payload.field = this.fields[payload.orgField].name;// Ensures field name only
payload.isEditable = this.isEditable; payload.isEditable = this.isEditable;
this.$emit('contextmenu', event, payload); this.$emit('contextmenu', event, payload);
}, },

View File

@@ -120,7 +120,12 @@
{{ $t('word.results') }}: <b>{{ results[0].rows.length | localeString }}</b> {{ $t('word.results') }}: <b>{{ results[0].rows.length | localeString }}</b>
</div> </div>
<div v-if="hasApproximately || (page > 1 && approximateCount)"> <div v-if="hasApproximately || (page > 1 && approximateCount)">
{{ $t('word.total') }}: <b :title="$t('word.approximately')"> {{ approximateCount | localeString }}</b> {{ $t('word.total') }}: <b
:title="!customizations.tableRealCount ? $t('word.approximately') : ''"
>
<span v-if="!customizations.tableRealCount"></span>
{{ approximateCount | localeString }}
</b>
</div> </div>
<div class="d-flex" :title="$t('word.schema')"> <div class="d-flex" :title="$t('word.schema')">
<i class="mdi mdi-18px mdi-database mr-1" /><b>{{ schema }}</b> <i class="mdi mdi-18px mdi-database mr-1" /><b>{{ schema }}</b>
@@ -231,6 +236,9 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
customizations () {
return this.workspace.customizations;
},
isTable () { isTable () {
return !!this.workspace.breadcrumbs.table; return !!this.workspace.breadcrumbs.table;
}, },

View File

@@ -121,7 +121,10 @@ module.exports = {
history: 'History', history: 'History',
select: 'Select', select: 'Select',
passphrase: 'Passphrase', passphrase: 'Passphrase',
filter: 'Filter' filter: 'Filter',
disabled: 'Disabled',
enable: 'Enable',
disable: 'Disable'
}, },
message: { message: {
appWelcome: 'Welcome to Antares SQL Client!', appWelcome: 'Welcome to Antares SQL Client!',
@@ -246,7 +249,10 @@ module.exports = {
thereIsNoQueriesYet: 'There is no queries yet', thereIsNoQueriesYet: 'There is no queries yet',
searchForQueries: 'Search for queries', searchForQueries: 'Search for queries',
killProcess: 'Kill process', killProcess: 'Kill process',
closeTab: 'Close tab' closeTab: 'Close tab',
goToDownloadPage: 'Go to download page',
readOnlyMode: 'Read-only mode',
killQuery: 'Kill query'
}, },
faker: { faker: {
address: 'Address', address: 'Address',

View File

@@ -13,7 +13,8 @@ const i18n = new VueI18n({
'pt-BR': require('./pt-BR'), 'pt-BR': require('./pt-BR'),
'de-DE': require('./de-DE'), 'de-DE': require('./de-DE'),
'vi-VN': require('./vi-VN'), 'vi-VN': require('./vi-VN'),
'ja-JP': require('./ja-JP') 'ja-JP': require('./ja-JP'),
'zh-CN': require('./zh-CN')
} }
}); });
export default i18n; export default i18n;

View File

@@ -121,7 +121,10 @@ module.exports = {
history: 'Cronologia', history: 'Cronologia',
select: 'Seleziona', select: 'Seleziona',
passphrase: 'Passphrase', passphrase: 'Passphrase',
filter: 'Filtra' filter: 'Filtra',
disabled: 'Disabilitato',
enable: 'Abilita',
disable: 'Disabilita'
}, },
message: { message: {
appWelcome: 'Benvenuto in Antares SQL Client!', appWelcome: 'Benvenuto in Antares SQL Client!',
@@ -233,7 +236,22 @@ module.exports = {
duplicateTable: 'Duplica tabella', duplicateTable: 'Duplica tabella',
noOpenTabs: 'Non ci sono tab aperte, naviga nella barra sinistra o:', noOpenTabs: 'Non ci sono tab aperte, naviga nella barra sinistra o:',
noSchema: 'Nessuno schema', noSchema: 'Nessuno schema',
restorePreviourSession: 'Ripristina sessione precedente' restorePreviourSession: 'Ripristina sessione precedente',
runQuery: 'Esegui query',
thereAreNoTableFields: 'Non ci sono campi della tabella',
newTable: 'Nuova tabella',
newView: 'Nuova vista',
newTrigger: 'Nuovo trigger',
newRoutine: 'Nuova routine',
newFunction: 'Nuova funzione',
newScheduler: 'Nuovo scheduler',
newTriggerFunction: 'Nuova funzione di trigger',
thereIsNoQueriesYet: 'Non ci sono ancora query',
searchForQueries: 'Cerca query',
killProcess: 'Uccidi processo',
closeTab: 'Chiudi tab',
goToDownloadPage: 'Vai alla pagina di download',
readOnlyMode: 'Modalità sola lettura'
}, },
faker: { faker: {
address: 'Indirizzo', address: 'Indirizzo',

View File

@@ -7,5 +7,6 @@ export default {
'pt-BR': 'Português (Brasil)', 'pt-BR': 'Português (Brasil)',
'de-DE': 'Deutsch (Deutschland)', 'de-DE': 'Deutsch (Deutschland)',
'vi-VN': 'Tiếng Việt', 'vi-VN': 'Tiếng Việt',
'ja-JP': '日本語' 'ja-JP': '日本語',
'zh-CN': '简体中文'
}; };

View File

@@ -1,413 +1,420 @@
module.exports = { module.exports = {
word: { word: {
edit: 'Chỉnh sửa', edit: 'Chỉnh sửa',
save: 'Lưu', save: 'Lưu',
close: 'Đóng', close: 'Đóng',
delete: 'Xoá', delete: 'Xoá',
confirm: 'Xác nhận', confirm: 'Xác nhận',
cancel: 'Huỷ', cancel: 'Huỷ',
send: 'Gửi', send: 'Gửi',
connectionName: 'Tên kết nối', connectionName: 'Tên kết nối',
client: 'Client', client: 'Client',
hostName: 'Tên máy chủ', hostName: 'Tên máy chủ',
port: 'Cổng', port: 'Cổng',
user: 'Người dùng', user: 'Người dùng',
password: 'Mật khẩu', password: 'Mật khẩu',
credentials: 'Thông tin xác thực', credentials: 'Thông tin xác thực',
connect: 'Kết nối', connect: 'Kết nối',
connected: 'Đã kết nối', connected: 'Đã kết nối',
disconnect: 'Ngắt kết nối', disconnect: 'Ngắt kết nối',
disconnected: 'Đã ngắt kết nối', disconnected: 'Đã ngắt kết nối',
refresh: 'Làm mới', refresh: 'Làm mới',
settings: 'Cài đặt', settings: 'Cài đặt',
general: 'Chung', general: 'Chung',
themes: 'Giao diện', themes: 'Giao diện',
update: 'Cập nhật', update: 'Cập nhật',
about: 'Giới thiệu', about: 'Giới thiệu',
language: 'Ngôn ngữ', language: 'Ngôn ngữ',
version: 'Phiên bản', version: 'Phiên bản',
donate: 'Ủng hộ', donate: 'Ủng hộ',
run: 'Chạy', run: 'Chạy',
schema: 'Schema', schema: 'Schema',
results: 'Kết quả', results: 'Kết quả',
size: 'Kích thước', size: 'Kích thước',
seconds: 'Giây', seconds: 'Giây',
type: 'Kiểu', type: 'Kiểu',
mimeType: 'Mime-Type', mimeType: 'Mime-Type',
download: 'Tải xuống', download: 'Tải xuống',
add: 'Thêm', add: 'Thêm',
data: 'Dữ liệu', data: 'Dữ liệu',
properties: 'Thuộc tính', properties: 'Thuộc tính',
insert: 'Nhập', insert: 'Nhập',
connecting: 'Đang kết nối', connecting: 'Đang kết nối',
name: 'Tên', name: 'Tên',
collation: 'Đối chiếu', collation: 'Đối chiếu',
clear: 'Xoá', clear: 'Xoá',
options: 'Tuỳ chọn', options: 'Tuỳ chọn',
autoRefresh: 'Tự động làm mới', autoRefresh: 'Tự động làm mới',
indexes: 'Index', indexes: 'Index',
foreignKeys: 'Khoá ngoại', foreignKeys: 'Khoá ngoại',
length: 'Độ dài', length: 'Độ dài',
unsigned: 'Unsigned', unsigned: 'Unsigned',
default: 'Mặc định', default: 'Mặc định',
comment: 'Nhận xét', comment: 'Nhận xét',
key: 'Khoá | Khoá', key: 'Khoá | Khoá',
order: 'Sắp xếp', order: 'Sắp xếp',
expression: 'Biểu hiện', expression: 'Biểu hiện',
autoIncrement: 'Tự động tăng', autoIncrement: 'Tự động tăng',
engine: 'Engine', engine: 'Engine',
field: 'Trường | Trường', field: 'Trường | Trường',
approximately: 'Khoảng', approximately: 'Khoảng',
total: 'Toàn bộ', total: 'Toàn bộ',
table: 'Bảng', table: 'Bảng',
discard: 'Bỏ', discard: 'Bỏ',
stay: 'Ở lại', stay: 'Ở lại',
author: 'Tác giả', author: 'Tác giả',
light: 'Sáng', light: 'Sáng',
dark: 'Tối', dark: 'Tối',
autoCompletion: 'Tự động hoàn thành', autoCompletion: 'Tự động hoàn thành',
application: 'Ứng dụng', application: 'Ứng dụng',
editor: 'Người chỉnh sửa', editor: 'Người chỉnh sửa',
view: 'Xem', view: 'Xem',
definer: 'Định nghĩa', definer: 'Định nghĩa',
algorithm: 'Thuật toán', algorithm: 'Thuật toán',
trigger: 'Kích hoạt | Kích hoạt', trigger: 'Kích hoạt | Kích hoạt',
storedRoutine: 'Quy trình đã lưu | Quy trình đã lưu', storedRoutine: 'Quy trình đã lưu | Quy trình đã lưu',
scheduler: 'Lập lịch trình | Lập lịch trình', scheduler: 'Lập lịch trình | Lập lịch trình',
event: 'Sự kiện', event: 'Sự kiện',
parameters: 'Tham số', parameters: 'Tham số',
function: 'Chức năng | Chức năng', function: 'Chức năng | Chức năng',
deterministic: 'Xác định', deterministic: 'Xác định',
context: 'Context', context: 'Context',
export: 'Xuất', export: 'Xuất',
returns: 'Returns', returns: 'Returns',
timing: 'Thời gian', timing: 'Thời gian',
state: 'Trạng thái', state: 'Trạng thái',
execution: 'Thực thi', execution: 'Thực thi',
starts: 'Bắt đầu', starts: 'Bắt đầu',
ends: 'Kết thúc', ends: 'Kết thúc',
ssl: 'SSL', ssl: 'SSL',
privateKey: 'Mã khoá riêng tư', privateKey: 'Mã khoá riêng tư',
certificate: 'Chứng chỉ', certificate: 'Chứng chỉ',
caCertificate: 'Chứng chỉ CA', caCertificate: 'Chứng chỉ CA',
ciphers: 'Ciphers', ciphers: 'Ciphers',
upload: 'Tải lên', upload: 'Tải lên',
browse: 'Duyệt', browse: 'Duyệt',
faker: 'Faker', faker: 'Faker',
content: 'Nội dung', content: 'Nội dung',
cut: 'Cắt', cut: 'Cắt',
copy: 'Sao chép', copy: 'Sao chép',
paste: 'Dán', paste: 'Dán',
tools: 'Công cụ', tools: 'Công cụ',
variables: 'Biến', variables: 'Biến',
processes: 'Quá trình', processes: 'Quá trình',
database: 'Cơ sở dữ liệu', database: 'Cơ sở dữ liệu',
scratchpad: 'Scratchpad', scratchpad: 'Scratchpad',
array: 'Mảng', array: 'Mảng',
changelog: 'Nhật ký thay đổi', changelog: 'Nhật ký thay đổi',
format: 'Định dạng', format: 'Định dạng',
sshTunnel: 'SSH tunnel', sshTunnel: 'SSH tunnel',
structure: 'Structure', structure: 'Structure',
small: 'Nhỏ', small: 'Nhỏ',
medium: 'Vừa', medium: 'Vừa',
large: 'Lớn', large: 'Lớn',
row: 'Hàng | Hàng', row: 'Hàng | Hàng',
cell: 'Ô | Ô', cell: 'Ô | Ô',
triggerFunction: 'Trigger function | Trigger functions', triggerFunction: 'Trigger function | Trigger functions',
all: 'Tất cả', all: 'Tất cả',
duplicate: 'Bản sao', duplicate: 'Bản sao',
routine: 'Routine', routine: 'Routine',
new: 'Mới', new: 'Mới',
history: 'Lịch sử', history: 'Lịch sử',
select: 'Chọn', select: 'Chọn',
passphrase: 'Cụm mật khẩu' passphrase: 'Cụm mật khẩu',
}, filter: 'Bộ lọc',
message: { disabled: 'Đã tắt',
appWelcome: 'Chào bạn đến với Antares SQL Client!', enable: 'Bật',
appFirstStep: 'Bước đầu tiên: tạo một kết nối tới cơ sở dữ liệu.', disable: 'Tắt'
addConnection: 'Thêm kết nối', },
createConnection: 'Tạo kết nối', message: {
createNewConnection: 'Tạo kết nối mới', appWelcome: 'Chào bạn đến với Antares SQL Client!',
askCredentials: 'Yêu cầu thông tin đăng nhập', appFirstStep: 'Bước đầu tiên: tạo một kết nối tới cơ sở dữ liệu.',
testConnection: 'Chạy thử kết nối', addConnection: 'Thêm kết nối',
editConnection: 'Sửa kết nối', createConnection: 'Tạo kết nối',
deleteConnection: 'Xoá kết nối', createNewConnection: 'Tạo kết nối mới',
deleteCorfirm: 'Bạn có xác nhận việc hủy bỏ', askCredentials: 'Yêu cầu thông tin đăng nhập',
connectionSuccessfullyMade: 'Kết nối được thực hiện thành công!', testConnection: 'Chạy thử kết nối',
madeWithJS: 'Được tạo bằng 💛 và JavaScript!', editConnection: 'Sửa kết nối',
checkForUpdates: 'Kiểm tra cập nhật', deleteConnection: 'Xoá kết nối',
noUpdatesAvailable: 'Không có bản cập nhật nào', deleteCorfirm: 'Bạn có xác nhận việc hủy bỏ',
checkingForUpdate: 'Đang kiểm tra cập nhật', connectionSuccessfullyMade: 'Kết nối được thực hiện thành công!',
checkFailure: 'Kiểm tra thất bại, vui lòng thử lại sau', madeWithJS: 'Được tạo bằng 💛 và JavaScript!',
updateAvailable: 'Cập nhật có sẵn', checkForUpdates: 'Kiểm tra cập nhật',
downloadingUpdate: 'Đang tải bản cập nhật', noUpdatesAvailable: 'Không có bản cập nhật nào',
updateDownloaded: 'Đã tải bản cập nht', checkingForUpdate: 'Đang kiểm tra cập nht',
restartToInstall: 'Khởi động lại Antares để cài đặt', checkFailure: 'Kiểm tra thất bại, vui lòng thử lại sau',
unableEditFieldWithoutPrimary: 'Không thể chỉnh sửa trường mà không có khóa chính trong kết quả', updateAvailable: 'Cập nhật có sẵn',
editCell: 'Sửa ô', downloadingUpdate: 'Đang tải bản cập nhật',
deleteRows: 'Xoá hàng | Xoá {count} hàng', updateDownloaded: 'Đã tải bản cập nhạt',
confirmToDeleteRows: 'Bạn có xác nhận xóa một hàng không? | Bạn có xác nhận xóa {count} hàng không?', restartToInstall: 'Khởi động lại Antares để cài đặt',
notificationsTimeout: 'Thông báo hết giờ', unableEditFieldWithoutPrimary: 'Không thể chỉnh sửa trường mà không có khóa chính trong kết quả',
uploadFile: 'Tải lên tệp', editCell: 'Sửa ô',
addNewRow: 'Thêm hàng mới', deleteRows: 'Xoá hàng | Xoá {count} hàng',
numberOfInserts: 'Số lần nhập', confirmToDeleteRows: 'Bạn có xác nhận xóa một hàng không? | Bạn có xác nhận xóa {count} hàng không?',
openNewTab: 'Mở trong tab mới', notificationsTimeout: 'Thông báo hết giờ',
affectedRows: 'Các hàng bị ảnh hưởng', uploadFile: 'Tải lên tệp',
createNewDatabase: 'Tạo Cơ sở dữ liệu mới', addNewRow: 'Thêm hàng mới',
databaseName: 'Tên cơ sở dữ liệu', numberOfInserts: 'Số lần nhập',
serverDefault: 'Máy chủ mặc định', openNewTab: 'Mở trong tab mới',
deleteDatabase: 'Xoá cơ sở dữ liệu', affectedRows: 'Các hàng bị ảnh hưởng',
editDatabase: 'Sửa cơ sở dữ liệu', createNewDatabase: 'Tạo Cơ sở dữ liệu mới',
clearChanges: 'Xóa các thay đổi', databaseName: 'Tên cơ sở dữ liệu',
addNewField: 'Thêm trường mới', serverDefault: 'Máy chủ mặc định',
manageIndexes: 'Quản lý index', deleteDatabase: 'Xoá cơ sở dữ liệu',
manageForeignKeys: 'Quản lý khoá ngoại', editDatabase: 'Sửa cơ sở dữ liệu',
allowNull: 'Cho phép NULL', clearChanges: 'Xóa các thay đổi',
zeroFill: 'Không điền', addNewField: 'Thêm trường mới',
customValue: 'Tuỳ chỉnh giá trị', manageIndexes: 'Quản lý index',
onUpdate: 'Đang cập nhật', manageForeignKeys: 'Quản lý khoá ngoại',
deleteField: 'Xoá trường', allowNull: 'Cho phép NULL',
createNewIndex: 'Tạo index mới', zeroFill: 'Không điền',
addToIndex: 'Thêm vào index', customValue: 'Tuỳ chỉnh giá trị',
createNewTable: 'Tạo bảng mới', onUpdate: 'Đang cập nhật',
emptyTable: 'Bảng trng', deleteField: 'Xoá trường',
deleteTable: 'Xoá bảng', createNewIndex: 'Tạo index mới',
emptyCorfirm: 'Bạn có xác nhận để làm trống không', addToIndex: 'Thêm vào index',
unsavedChanges: 'Chưa lưu lại thay đổi', createNewTable: 'Tạo bảng mới',
discardUnsavedChanges: 'Bạn có một số thay đổi chưa được lưu. Đóng tab này, những thay đổi này sẽ bị huỷ bỏ.', emptyTable: 'Bảng trống',
thereAreNoIndexes: 'Không có index', deleteTable: 'Xoá bảng',
thereAreNoForeign: 'Không có khoá ngoại', emptyCorfirm: 'Bạn có xác nhận để làm trống không',
createNewForeign: 'Tạo khoá ngoại mới', unsavedChanges: 'Chưa lưu lại thay đổi',
referenceTable: 'Tham khảo bảng', discardUnsavedChanges: 'Bạn có một số thay đổi chưa được lưu. Đóng tab này, những thay đổi này sẽ bị huỷ bỏ.',
referenceField: 'Tham khảo trường', thereAreNoIndexes: 'Không có index',
foreignFields: 'Trường ngoại', thereAreNoForeign: 'Không có khoá ngoại',
invalidDefault: 'Mặc định không hợp lệ', createNewForeign: 'Tạo khoá ngoại mới',
onDelete: 'Đang xoá', referenceTable: 'Tham khảo bảng',
applicationTheme: 'Chủ đề ứng dụng', referenceField: 'Tham khảo trường',
editorTheme: 'Trình chỉnh sửa chủ đề', foreignFields: 'Trường ngoại',
wrapLongLines: 'Wrap long lines', invalidDefault: 'Mặc định không hợp lệ',
selectStatement: 'Chọn câu lệnh', onDelete: 'Đang xoá',
triggerStatement: 'Kích hoạt câu lệnh', applicationTheme: 'Chủ đề ứng dụng',
sqlSecurity: 'Bảo mật SQL', editorTheme: 'Trình chỉnh sửa chủ đề',
updateOption: 'Cập nhật tuỳ chọn', wrapLongLines: 'Wrap long lines',
deleteView: 'Xóa chế độ xem', selectStatement: 'Chọn câu lệnh',
createNewView: 'Tạo chế độ xem mới', triggerStatement: 'Kích hoạt câu lệnh',
deleteTrigger: 'Xóa trình kích hoạt', sqlSecurity: 'Bảo mật SQL',
createNewTrigger: 'Tạo trình kích hoạt mới', updateOption: 'Cập nhật tuỳ chọn',
currentUser: 'Người dùng hiện tại', deleteView: 'Xóa chế độ xem',
routineBody: 'Body quy trình', createNewView: 'Tạo chế độ xem mới',
dataAccess: 'Truy cập dữ liệu', deleteTrigger: 'Xóa trình kích hoạt',
thereAreNoParameters: 'Không có tham số', createNewTrigger: 'Tạo trình kích hoạt mới',
createNewParameter: 'Tạo tham số mới', currentUser: 'Người dùng hiện tại',
createNewRoutine: 'Tạo quy trình lưu trữ mới', routineBody: 'Body quy trình',
deleteRoutine: 'Xoá quy trình lưu trữ', dataAccess: 'Truy cập dữ liệu',
functionBody: 'Body chức năng', thereAreNoParameters: 'Không có tham số',
createNewFunction: 'Tạo chức năng mới', createNewParameter: 'Tạo tham số mới',
deleteFunction: 'Xoá chức năng', createNewRoutine: 'Tạo quy trình lưu trữ mới',
schedulerBody: 'Body trình lập lịch', deleteRoutine: 'Xoá quy trình lưu trữ',
createNewScheduler: 'Tạo lịch trình mới', functionBody: 'Body chức năng',
deleteScheduler: 'Xóa trình lên lịch', createNewFunction: 'Tạo chức năng mới',
preserveOnCompletion: 'Bảo tồn khi hoàn thành', deleteFunction: 'Xoá chức năng',
enableSsl: 'Bật SSL', schedulerBody: 'Body trình lập lịch',
manualValue: 'Giá trị thủ công', createNewScheduler: 'Tạo lịch trình mới',
tableFiller: 'Bộ lọc bảng', deleteScheduler: 'Xóa trình lên lịch',
fakeDataLanguage: 'Ngôn ngữ dữ liệu giả mạo', preserveOnCompletion: 'Bảo tồn khi hoàn thành',
searchForElements: 'Tìm kiếm yếu tố', enableSsl: 'Bật SSL',
selectAll: 'Chọn tất cả', manualValue: 'Giá trị thủ công',
queryDuration: 'Thời lượng truy vấn', tableFiller: 'Bộ lọc bảng',
includeBetaUpdates: 'Bao gồm các bản cập nhật beta', fakeDataLanguage: 'Ngôn ngữ dữ liệu giả mạo',
setNull: 'Đặt NULL', searchForElements: 'Tìm kiếm yếu tố',
processesList: 'Danh sách quy trình', selectAll: 'Chọn tất cả',
processInfo: 'Thông tin quá trình', queryDuration: 'Thời lượng truy vấn',
manageUsers: 'Quản lý người dùng', includeBetaUpdates: 'Bao gồm các bản cập nhật beta',
createNewSchema: 'Tạo schema mới', setNull: 'Đặt NULL',
schemaName: 'Tên schema', processesList: 'Danh sách quy trình',
editSchema: 'Sửa schema', processInfo: 'Thông tin quá trình',
deleteSchema: 'Xoá schema', manageUsers: 'Quản lý người dùng',
markdownSupported: 'Hỗ trợ Markdown', createNewSchema: 'Tạo schema mới',
plantATree: 'Trồng cây', schemaName: 'Tên schema',
dataTabPageSize: 'Kích thước trang tab DATA', editSchema: 'Sửa schema',
enableSsh: 'Bật SSH', deleteSchema: 'Xoá schema',
pageNumber: 'Số trang', markdownSupported: 'Hỗ trợ Markdown',
duplicateTable: 'Sao chép bản', plantATree: 'Trồng cây',
noOpenTabs: 'Không có tab nào đang mở, điều hướng trên thanh bên trái hoặc:', dataTabPageSize: 'Kích thước trang tab DATA',
noSchema: 'Không có schema', enableSsh: 'Bật SSH',
restorePreviourSession: 'Khôi phục phiên trước', pageNumber: 'Số trang',
runQuery: 'Chạy truy vấn', duplicateTable: 'Sao chép bản',
thereAreNoTableFields: 'Không có trường bảng', noOpenTabs: 'Không có tab nào đang mở, điều hướng trên thanh bên trái hoặc:',
newTable: 'Bảng mới', noSchema: 'Không có schema',
newView: 'Chế độ xem mới', restorePreviourSession: 'Khôi phục phiên trước',
newTrigger: 'Trình kích hoạt mới', runQuery: 'Chạy truy vấn',
newRoutine: 'Quy trình mới', thereAreNoTableFields: 'Không có trường bảng',
newFunction: 'Chức năng mới', newTable: 'Bảng mới',
newScheduler: 'Bộ lập lịch mới', newView: 'Chế độ xem mới',
newTriggerFunction: 'Chức năng kích hoạt mới', newTrigger: 'Trình kích hoạt mới',
thereIsNoQueriesYet: 'Không có truy vấn nào', newRoutine: 'Quy trình mới',
searchForQueries: 'Tìm kiếm truy vấn', newFunction: 'Chức năng mới',
killProcess: 'Huỷ quá trình' newScheduler: 'Bộ lập lịch mới',
}, newTriggerFunction: 'Chức năng kích hoạt mới',
faker: { thereIsNoQueriesYet: 'Không có truy vấn nào',
address: 'Địa chỉ', searchForQueries: 'Tìm kiếm truy vấn',
commerce: 'Thương mại', killProcess: 'Huỷ quá trình',
company: 'ng ty', closeTab: 'Đóng tab',
database: 'Cơ sở dữ liệu', goToDownloadPage: 'Tới trang tải về',
date: 'Ngày', readOnlyMode: 'Chế độ chỉ đọc'
finance: 'Tài chánh', },
git: 'Git', faker: {
hacker: 'Tin tặc', address: 'Địa chỉ',
internet: 'Mạng Internet', commerce: 'Thương mại',
lorem: 'Lorem', company: 'Công ty',
name: 'Tên', database: 'Cơ sở dữ liệu',
music: 'Âm nhạc', date: 'Ngày',
phone: 'Số điện thoại', finance: 'Tài chánh',
random: 'Ngẫu nhiên', git: 'Git',
system: 'Hệ thống', hacker: 'Tin tặc',
time: 'Thời gian', internet: 'Mạng Internet',
vehicle: 'Phương tiện giao thông', lorem: 'Lorem',
zipCode: 'Mã Bưu Chính', name: 'Tên',
zipCodeByState: 'Mã Bưu Chính theo tiểu bang', music: 'Âm nhạc',
city: 'Thành phố', phone: 'Số điện thoại',
cityPrefix: 'Tiền tố thành phố', random: 'Ngẫu nhiên',
citySuffix: 'Hậu tố thành phố', system: 'Hệ thống',
streetName: 'Tên đường', time: 'Thời gian',
streetAddress: 'Địa chỉ đường', vehicle: 'Phương tiện giao thông',
streetSuffix: 'Hậu tố đường', zipCode: 'Mã Bưu Chính',
streetPrefix: 'Tiền tố đường', zipCodeByState: 'Mã Bưu Chính theo tiểu bang',
secondaryAddress: 'Địa chỉ ph', city: 'Thành ph',
county: 'Quận', cityPrefix: 'Tiền tố thành phố',
country: 'Quốc gia', citySuffix: 'Hậu tố thành phố',
countryCode: 'Mã quốc gia', streetName: 'Tên đường',
state: 'Tiểu bang', streetAddress: 'Địa chỉ đường',
stateAbbr: 'Viết tắt của tiểu bang', streetSuffix: 'Hậu tố đường',
latitude: 'Vĩ độ', streetPrefix: 'Tiền tố đường',
longitude: 'Kinh độ', secondaryAddress: 'Địa chỉ phụ',
direction: 'Hướng', county: 'Quận',
cardinalDirection: 'Hướng cốt yếu', country: 'Quốc gia',
ordinalDirection: 'Hướng thứ tự', countryCode: 'Mã quốc gia',
nearbyGPSCoordinate: 'Tọa độ GPS lân cận', state: 'Tiểu bang',
timeZone: 'Múi giờ', stateAbbr: 'Viết tắt của tiểu bang',
color: 'Màu', latitude: 'Vĩ độ',
department: 'Phòng', longitude: 'Kinh độ',
productName: 'Tên sản phẩm', direction: 'Hướng',
price: 'Giá', cardinalDirection: 'Hướng cốt yếu',
productAdjective: 'Tính từ sản phẩm', ordinalDirection: 'Hướng thứ tự',
productMaterial: 'Chất liệu sản phẩm', nearbyGPSCoordinate: 'Tọa độ GPS lân cận',
product: 'Sản phẩm', timeZone: 'Múi giờ',
productDescription: 'Mô tả sản phẩm', color: 'Màu',
suffixes: 'Hậu tố', department: 'Phòng',
companyName: 'Tên công ty', productName: 'Tên sản phẩm',
companySuffix: 'Hậu tố công ty', price: 'Giá',
catchPhrase: 'Khẩu hiệu', productAdjective: 'Tính từ sản phẩm',
bs: 'BS', productMaterial: 'Chất liệu sản phẩm',
catchPhraseAdjective: 'Bắt cụm từ tính từ', product: 'Sản phẩm',
catchPhraseDescriptor: 'Bắt bộ mô tả cụm từ', productDescription: 'Mô tả sản phẩm',
catchPhraseNoun: 'Bắt cụm từ danh t', suffixes: 'Hậu t',
bsAdjective: 'BS tính t', companyName: 'Tên công ty',
bsBuzz: 'BS buzz', companySuffix: 'Hậu tố công ty',
bsNoun: 'BS danh từ', catchPhrase: 'Khẩu hiệu',
column: 'Cột', bs: 'BS',
type: 'Loại', catchPhraseAdjective: 'Bắt cụm từ tính từ',
collation: 'Đối chiếu', catchPhraseDescriptor: 'Bắt bộ mô tả cụm từ',
engine: 'Engine', catchPhraseNoun: 'Bắt cụm từ danh từ',
past: 'Quá khứ', bsAdjective: 'BS tính từ',
future: 'Tương lai', bsBuzz: 'BS buzz',
between: 'Giữa', bsNoun: 'BS danh từ',
recent: 'Gần đây', column: 'Cột',
soon: 'Sớm', type: 'Loại',
month: 'Tháng', collation: 'Đối chiếu',
weekday: 'Ngày trong tuần', engine: 'Engine',
account: 'Tài khoản', past: 'Quá khứ',
accountName: 'Tên tài khoản', future: 'Tương lai',
routingNumber: 'Số định tuyến', between: 'Giữa',
mask: 'Mặt nạ', recent: 'Gần đây',
amount: 'Số tiền', soon: 'Sớm',
transactionType: 'Loại giao dịch', month: 'Tháng',
currencyCode: 'Mã tiền tệ', weekday: 'Ngày trong tuần',
currencyName: 'Tên tiền tệ', account: 'Tài khoản',
currencySymbol: 'Ký hiệu tiền tệ', accountName: 'Tên tài khoản',
bitcoinAddress: 'Địa chỉ Bitcoin', routingNumber: 'Số định tuyến',
litecoinAddress: 'Địa chỉ Litecoin', mask: 'Mặt nạ',
creditCardNumber: 'Số thẻ tín dụng', amount: 'Số tiền',
creditCardCVV: 'CVV thẻ tín dụng', transactionType: 'Loại giao dịch',
ethereumAddress: 'Địa chỉ Ethereum', currencyCode: 'Mã tiền tệ',
iban: 'Iban', currencyName: 'Tên tiền tệ',
bic: 'Bic', currencySymbol: 'Ký hiệu tiền tệ',
transactionDescription: 'Mô tả giao dịch', bitcoinAddress: 'Địa chỉ Bitcoin',
branch: 'Nhánh', litecoinAddress: 'Địa chỉ Litecoin',
commitEntry: 'Nhập cam kết', creditCardNumber: 'Số thẻ tín dụng',
commitMessage: 'Thông báo cam kết', creditCardCVV: 'CVV thẻ tín dụng',
commitSha: 'Cam kết SHA', ethereumAddress: 'Địa chỉ Ethereum',
shortSha: 'SHA ngắn', iban: 'Iban',
abbreviation: 'Viết tắt', bic: 'Bic',
adjective: 'Tính từ', transactionDescription: 'Mô tả giao dịch',
noun: 'Danh từ', branch: 'Nhánh',
verb: 'Động từ', commitEntry: 'Nhập cam kết',
ingverb: 'Động từ ing', commitMessage: 'Thông báo cam kết',
phrase: 'Cm từ', commitSha: 'Cam kết SHA',
avatar: 'Ảnh đại diện', shortSha: 'SHA ngắn',
email: 'Email', abbreviation: 'Viết tắt',
exampleEmail: 'Email ví dụ', adjective: 'Tính từ',
userName: 'Tên người dùng', noun: 'Danh từ',
protocol: 'Giao thức', verb: 'Động từ',
url: 'Url', ingverb: 'Động từ ing',
domainName: 'Tên miền', phrase: 'Cụm từ',
domainSuffix: 'Hậu tố miền', avatar: 'Ảnh đại diện',
domainWord: 'Từ miền', email: 'Email',
ip: 'Ip', exampleEmail: 'Email ví dụ',
ipv6: 'Ipv6', userName: 'Tên người dùng',
userAgent: 'User agent', protocol: 'Giao thức',
mac: 'Mac', url: 'Url',
password: 'Mật khẩu', domainName: 'Tên miền',
word: 'Từ', domainSuffix: 'Hậu tố miền',
words: 'Từ', domainWord: 'Từ miền',
sentence: 'Câu', ip: 'Ip',
slug: 'Slug', ipv6: 'Ipv6',
sentences: 'Câu', userAgent: 'User agent',
paragraph: 'Đoạn văn', mac: 'Mac',
paragraphs: 'Đoạn văn', password: 'Mật khẩu',
text: 'Văn bản', word: 'Từ',
lines: 'Dòng', words: 'Từ',
genre: 'Thể loại', sentence: 'Câu',
firstName: 'Tên', slug: 'Slug',
lastName: 'Họ', sentences: 'Câu',
middleName: 'Tên đệm', paragraph: 'Đoạn văn',
findName: 'Tên đầy đủ', paragraphs: 'Đoạn văn',
jobTitle: 'Chức vụ', text: 'Văn bản',
gender: 'Giới tính', lines: 'Dòng',
prefix: 'Tiền tố', genre: 'Thể loại',
suffix: 'Hậu tố', firstName: 'Tên',
title: 'Tiêu đề', lastName: 'Họ',
jobDescriptor: 'Mô tả công việc', middleName: 'Tên đệm',
jobArea: 'Lĩnh vực việc làm', findName: 'Tên đầy đủ',
jobType: 'Loại công việc', jobTitle: 'Chức vụ',
phoneNumber: 'Số điện thoại', gender: 'Giới tính',
phoneNumberFormat: 'Định dạng số điện thoại', prefix: 'Tiền tố',
phoneFormats: 'Định dạng điện thoại', suffix: 'Hậu tố',
number: 'Số', title: 'Tiêu đề',
float: 'Float', jobDescriptor: 'Mô tả công việc',
arrayElement: 'Phân tử array', jobArea: 'Lĩnh vực việc làm',
arrayElements: 'Phân tử array', jobType: 'Loại công việc',
objectElement: 'Phần tử object', phoneNumber: 'Số điện thoại',
uuid: 'Uuid', phoneNumberFormat: 'Định dạng số điện thoại',
boolean: 'Boolean', phoneFormats: 'Định dạng điện thoại',
image: 'Hình ảnh', number: 'Số',
locale: 'Ngôn ngữ', float: 'Float',
alpha: 'Alpha', arrayElement: 'Phân tử array',
alphaNumeric: 'Chữ và số', arrayElements: 'Phân tử array',
hexaDecimal: 'Hệ thập lục phân', objectElement: 'Phần tử object',
fileName: 'File name', uuid: 'Uuid',
commonFileName: 'Tên tệp chung', boolean: 'Boolean',
mimeType: 'Kiểu mine', image: 'Hình ảnh',
commonFileType: 'Loại tệp chung', locale: 'Ngôn ng',
commonFileExt: 'Phần mở rộng tệp chung', alpha: 'Alpha',
fileType: 'Loại tệp', alphaNumeric: 'Chữ và số',
fileExt: 'Phần mở rộng tệp', hexaDecimal: 'Hệ thập lục phân',
directoryPath: 'Đường dẫn thư mục', fileName: 'File name',
filePath: 'Đường dẫn tệp', commonFileName: 'Tên tệp chung',
semver: 'Semver', mimeType: 'Kiểu mine',
manufacturer: 'Manufacturer', commonFileType: 'Loại tệp chung',
model: 'Model', commonFileExt: 'Phần mở rộng tệp chung',
fuel: 'Fuel', fileType: 'Loại tệp',
vin: 'Vin' fileExt: 'Phần mở rộng tệp',
} directoryPath: 'Đường dẫn thư mục',
}; filePath: 'Đường dẫn tệp',
semver: 'Semver',
manufacturer: 'Manufacturer',
model: 'Model',
fuel: 'Fuel',
vin: 'Vin'
}
};

421
src/renderer/i18n/zh-CN.js Normal file
View File

@@ -0,0 +1,421 @@
module.exports = {
word: {
edit: '编辑',
save: '保存',
close: '关闭',
delete: '删除',
confirm: '确定',
cancel: '取消',
send: '发送',
connectionName: '连接名称',
client: 'Client',
hostName: '主机名',
port: '端口',
user: '用户',
password: '密码',
credentials: '凭据',
connect: '连接',
connected: '已连接',
disconnect: '断开连接',
disconnected: '已断开',
refresh: '刷新',
settings: '设置',
general: '一般',
themes: '主题',
update: '更新',
about: '关于',
language: '语言',
version: '版本',
donate: '捐赠',
run: '运行',
schema: 'schema',
results: '结果',
size: '尺寸',
seconds: '秒',
type: '类型',
mimeType: 'MIME类型',
download: '下载',
add: '新增',
data: '数据',
properties: '属性',
insert: '插入',
connecting: '连接中',
name: '名称',
collation: '排序规则',
clear: '清除',
options: '选项',
autoRefresh: '自动刷新',
indexes: '索引',
foreignKeys: '外键',
length: '长度',
unsigned: '无符号',
default: '默认',
comment: '注释',
key: '键',
order: 'Order',
expression: '表达式',
autoIncrement: '自动增量',
engine: 'Engine',
field: '字段',
approximately: '大约',
total: '总计',
table: '表',
discard: '弃置',
stay: '等待',
author: '作者',
light: 'Light',
dark: 'Dark',
autoCompletion: '自动完成',
application: '应用程序',
editor: '编辑器',
view: '视图',
definer: '定义者',
algorithm: 'Algorithm',
trigger: '触发器',
storedRoutine: '存储例程',
scheduler: '调度器',
event: '事件',
parameters: '参数',
function: '函数',
deterministic: 'Deterministic',
context: '上下文',
export: '导出',
returns: '返回',
timing: '定时器',
state: '状态',
execution: '执行',
starts: '开始',
ends: '结束',
ssl: 'SSL',
privateKey: '私钥',
certificate: '证书',
caCertificate: 'CA 证书',
ciphers: 'Ciphers',
upload: '上传',
browse: '浏览',
faker: 'Faker',
content: '内容',
cut: '剪切',
copy: '复制',
paste: '粘贴',
tools: '工具',
variables: '变量',
processes: '进程',
database: '数据库',
scratchpad: 'Scratchpad',
array: '数组',
changelog: '更改日志',
format: '格式',
sshTunnel: 'SSH 隧道',
structure: '结构',
small: '小',
medium: '中',
large: '大',
row: '行',
cell: '单元格',
triggerFunction: '触发函数',
all: '全部',
duplicate: '重复',
routine: '例程',
new: 'New',
history: '历史记录',
select: '选择',
passphrase: '密码',
filter: '过滤器',
disabled: '禁用',
enable: '启用',
disable: '是否禁用'
},
message: {
appWelcome: '欢迎来到Antares SQL Client!',
appFirstStep: '你的第一步: 创建一个新的数据库连接.',
addConnection: '添加连接',
createConnection: '创建连接',
createNewConnection: '创建新的连接',
askCredentials: '询问凭证',
testConnection: '测试连接',
editConnection: '编辑连接',
deleteConnection: '删除连接',
deleteCorfirm: '您是否确认取消',
connectionSuccessfullyMade: '连接成功建立!',
madeWithJS: '用💛和JavaScript制造!',
checkForUpdates: '检查更新',
noUpdatesAvailable: '没有可用的更新',
checkingForUpdate: '正在检查更新',
checkFailure: '检查失败,请稍后再试',
updateAvailable: '可用的更新',
downloadingUpdate: '正在下载更新',
updateDownloaded: '更新已下载',
restartToInstall: '重启Antares完成更新',
unableEditFieldWithoutPrimary: '无法编辑一个在结果集中没有主键的字段',
editCell: '编辑单元格',
deleteRows: '删除行 | 删除{count}行',
confirmToDeleteRows: '你是否确认要删除一行? | 您是否确认要删除{count}行?',
notificationsTimeout: '通知超时',
uploadFile: '上传文件',
addNewRow: '添加新行',
numberOfInserts: '插入的数量',
openNewTab: '打开一个新标签',
affectedRows: '受影响的行',
createNewDatabase: '创建新的数据库',
databaseName: '数据库名称',
serverDefault: '默认服务器',
deleteDatabase: '删除数据库',
editDatabase: '编辑数据库',
clearChanges: '清除变化',
addNewField: '添加新字段',
manageIndexes: '管理索引',
manageForeignKeys: '管理外键',
allowNull: '允许NULL',
zeroFill: '填充零',
customValue: '自定义值',
onUpdate: '在更新时',
deleteField: '删除字段',
createNewIndex: '创建新的索引',
addToIndex: '添加到索引',
createNewTable: '创建新表',
emptyTable: '清空表',
deleteTable: '删除表',
emptyCorfirm: '你是否确认清空',
unsavedChanges: '未保存的更改',
discardUnsavedChanges: '你有一些未保存的修改。关闭这个标签,这些变化将被丢弃.',
thereAreNoIndexes: '没有索引',
thereAreNoForeign: '没有外键',
createNewForeign: '创建新的外键',
referenceTable: '参考表',
referenceField: '参考字段',
foreignFields: '外键字段',
invalidDefault: '无效的默认值',
onDelete: '在删除时',
applicationTheme: '应用主题',
editorTheme: '编辑器主题',
wrapLongLines: '超出换行显示',
selectStatement: '选择语句',
triggerStatement: '触发器语句',
sqlSecurity: 'SQL安全',
updateOption: '更新选项',
deleteView: '删除视图',
createNewView: '创建新视图',
deleteTrigger: '删除触发器',
createNewTrigger: '创建新的触发器',
currentUser: '当前用户',
routineBody: '例程主体',
dataAccess: '数据访问',
thereAreNoParameters: '没有参数',
createNewParameter: '创建新参数',
createNewRoutine: '创建新的例程',
deleteRoutine: '删除例程',
functionBody: '函数体',
createNewFunction: '创建新函数',
deleteFunction: '删除函数',
schedulerBody: '调度器主体',
createNewScheduler: '创建新的调度器',
deleteScheduler: '删除调度器',
preserveOnCompletion: '完成时保存',
enableSsl: '启用SSL',
manualValue: '手动值',
tableFiller: '表填充器',
fakeDataLanguage: '伪造的数据语言',
searchForElements: '搜索元素',
selectAll: '选择所有',
queryDuration: '查询时间',
includeBetaUpdates: '包括测试版更新',
setNull: '设置NULL',
processesList: '进程列表',
processInfo: '进程信息',
manageUsers: '管理用户',
createNewSchema: '创建新模式',
schemaName: '模式名称',
editSchema: '编辑模式',
deleteSchema: '删除模式',
markdownSupported: '支持Markdown',
plantATree: '种植一棵树',
dataTabPageSize: '数据标签的页面大小',
enableSsh: '启用SSH',
pageNumber: '页数',
duplicateTable: '重复的表格',
noOpenTabs: '没有打开的标签,在左栏导航或:',
noSchema: '没有模式',
restorePreviourSession: '恢复以前的会话',
runQuery: '运行查询',
thereAreNoTableFields: '没有表的字段',
newTable: '新表',
newView: '新视图',
newTrigger: '新触发器',
newRoutine: '新例程',
newFunction: '新函数',
newScheduler: '新调度器',
newTriggerFunction: '新触发函数',
thereIsNoQueriesYet: '还没有查询',
searchForQueries: '搜索查询',
killProcess: '杀死进程',
closeTab: '关闭标签',
goToDownloadPage: '跳转到下载页面',
readOnlyMode: '只读模式',
killQuery: '停止查询'
},
faker: {
address: '地址',
commerce: '商业',
company: '公司',
database: '数据库',
date: '日期',
finance: '财务',
git: 'Git',
hacker: '黑客',
internet: '互联网',
lorem: 'Lorem',
name: '姓名',
music: '音乐',
phone: '电话',
random: '随机',
system: '系统',
time: '时间',
vehicle: '车辆',
zipCode: '邮政编码',
zipCodeByState: '按州的邮编',
city: '城市',
cityPrefix: '城市前缀',
citySuffix: '城市后缀',
streetName: '街道名称',
streetAddress: '街道地址',
streetSuffix: '街道前缀',
streetPrefix: '街道后缀',
secondaryAddress: '次要地址',
county: '县',
country: '国家',
countryCode: '国家代码',
state: '州',
stateAbbr: '州的缩写',
latitude: '纬度',
longitude: '经度',
direction: '方向',
cardinalDirection: 'Cardinal direction',
ordinalDirection: 'Ordinal direction',
nearbyGPSCoordinate: '附近的GPS坐标',
timeZone: '时区',
color: '颜色',
department: '部门',
productName: '产品名称',
price: '价格',
productAdjective: '产品形容词',
productMaterial: '产品材料',
product: '产品',
productDescription: '产品描述',
suffixes: '后缀',
companyName: '公司名称',
companySuffix: '公司后缀',
catchPhrase: 'Catch phrase',
bs: 'BS',
catchPhraseAdjective: 'Catch phrase adjective',
catchPhraseDescriptor: 'Catch phrase descriptor',
catchPhraseNoun: 'Catch phrase noun',
bsAdjective: 'BS adjective',
bsBuzz: 'BS buzz',
bsNoun: 'BS noun',
column: '列',
type: '类型',
collation: '校对',
engine: 'Engine',
past: '过去',
future: '未来',
between: '之间',
recent: '最近',
soon: '很快',
month: '月',
weekday: '工作日',
account: '账户',
accountName: '账户名称',
routingNumber: '路由号码',
mask: '掩码',
amount: '金额',
transactionType: '交易类型',
currencyCode: '货币代码',
currencyName: '货币名称',
currencySymbol: '货币符号',
bitcoinAddress: '比特币地址',
litecoinAddress: '莱特币地址',
creditCardNumber: '信用卡号码',
creditCardCVV: '信用卡CVV',
ethereumAddress: '以太坊地址',
iban: 'Iban',
bic: 'Bic',
transactionDescription: '交易描述',
branch: '分支',
commitEntry: '提交条目',
commitMessage: '提交信息',
commitSha: '提交 SHA',
shortSha: 'Short SHA',
abbreviation: '缩写',
adjective: '形容词',
noun: '名词',
verb: '动词',
ingverb: 'Ingverb',
phrase: '短语',
avatar: '头像',
email: '电子邮箱',
exampleEmail: '电子邮件例子',
userName: '用户名',
protocol: '协议',
url: 'Url',
domainName: 'Domin name',
domainSuffix: '域名后缀',
domainWord: 'Domain word',
ip: 'Ip',
ipv6: 'Ipv6',
userAgent: 'User agent',
mac: 'Mac',
password: '密码',
word: 'Word',
words: 'Words',
sentence: '句子',
slug: 'Slug',
sentences: '句子',
paragraph: '段落',
paragraphs: '段落',
text: '文本',
lines: '行',
genre: 'Genre',
firstName: '名',
lastName: '姓氏',
middleName: '中间名',
findName: '全名',
jobTitle: '职位名称',
gender: '性别',
prefix: '前缀',
suffix: '后缀',
title: '标题',
jobDescriptor: '工作描述',
jobArea: '工作领域',
jobType: '工作类型',
phoneNumber: '电话号码',
phoneNumberFormat: '电话号码格式',
phoneFormats: '电话格式',
number: 'Number',
float: 'Float',
arrayElement: '数组元素',
arrayElements: '数组元素',
objectElement: '对象元素',
uuid: 'Uuid',
boolean: 'Boolean',
image: 'Image',
locale: 'Locale',
alpha: 'Alpha',
alphaNumeric: 'Alphanumeric',
hexaDecimal: 'Hexadecimal',
fileName: '文件名',
commonFileName: '普通文件名',
mimeType: 'MIME类型',
commonFileType: '常见的文件类型',
commonFileExt: '常见的文件扩展名',
fileType: '文件类型',
fileExt: '文件扩展名',
directoryPath: '目录路径',
filePath: '文件路径',
semver: 'Semver',
manufacturer: '制造商',
model: '型号',
fuel: 'Fuel',
vin: 'Vin'
}
};

Some files were not shown because too many files have changed in this diff Show More