mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
82 Commits
all-contri
...
v0.7.29-be
Author | SHA1 | Date | |
---|---|---|---|
010147b553 | |||
da8cc39157 | |||
37d44c95ee | |||
4df4c6197d | |||
|
0506b653d7 | ||
5fd9fe48a2 | |||
b6a7124f33 | |||
|
5855ab0921 | ||
c2b602785a | |||
97279742e9 | |||
6cb21ff792 | |||
72bacdeabf | |||
c434855879 | |||
ba0ffcc6f5 | |||
8e7965a0f9 | |||
4aab84fbd5 | |||
|
74e97e660d | ||
|
f5d236b521 | ||
|
e794d207ad | ||
f99a3cc054 | |||
59f7d3c670 | |||
8f2daa0f1c | |||
141d5bb69c | |||
171b6f924a | |||
f7419d8e9c | |||
5b1cd70e25 | |||
3e223b475e | |||
4a38656b7e | |||
25b7ae57c6 | |||
4b5718e9b7 | |||
780d83deaa | |||
e952f9f5f8 | |||
49f1a8ef2e | |||
121aa21a6d | |||
cb25963a67 | |||
3a47607a5f | |||
7494ff6fcf | |||
838491bfd4 | |||
0b9898f3e7 | |||
a973ec3c60 | |||
d0c50f17ca | |||
b4cdd58973 | |||
9947479fdc | |||
4a1697d633 | |||
b7dfd5cb8c | |||
0ec9d3cfc1 | |||
|
4f615b26cf | ||
|
86a1e05197 | ||
3fa9873d20 | |||
37a160a03f | |||
2385a8207c | |||
|
243984e697 | ||
d1bb50b2bb | |||
8501fa2e81 | |||
25123e34ef | |||
bd4502ee47 | |||
b2f9d475a2 | |||
|
93de974b09 | ||
|
949bf4cbcb | ||
|
bb3c87b2cf | ||
40bf9a040a | |||
|
978b55fdb1 | ||
|
098d4e96d6 | ||
957cb9e1a5 | |||
09c274a724 | |||
9bcd874e80 | |||
ece2ee05cc | |||
058fc2fc0b | |||
33bbc0e7e6 | |||
23c59b4d4e | |||
6600197b82 | |||
33203aeb04 | |||
f4f385589f | |||
0565ae1204 | |||
258fbc81f7 | |||
8d8650fbe7 | |||
af2812f2b0 | |||
099a71a189 | |||
e7efb9c616 | |||
|
c1e58eb695 | ||
|
f7204dc0ae | ||
|
6b56c60b68 |
@@ -275,6 +275,24 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "penguinlab",
|
||||
"name": "Naoki Ishikawa",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/10959317?v=4",
|
||||
"profile": "https://github.com/penguinlab",
|
||||
"contributions": [
|
||||
"translation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "mangas",
|
||||
"name": "Filipe Azevedo",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1640325?v=4",
|
||||
"profile": "https://fazevedo.dev",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
8
.github/workflows/build-beta.yml
vendored
8
.github/workflows/build-beta.yml
vendored
@@ -19,17 +19,19 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: beta
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm i
|
||||
run: |
|
||||
npm i
|
||||
npm install "dmg-license" --save-optional
|
||||
|
||||
- name: "Build"
|
||||
run: npm run build
|
||||
|
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -25,17 +25,19 @@ jobs:
|
||||
exit 0
|
||||
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm i
|
||||
run: |
|
||||
npm i
|
||||
npm install "dmg-license" --save-optional
|
||||
|
||||
- name: "Build"
|
||||
run: npm run build
|
||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
|
@@ -8,12 +8,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
run: npm run build -- --arm64 --linux deb AppImage
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-build
|
||||
retention-days: 3
|
||||
|
6
.github/workflows/create-artifact-linux.yml
vendored
6
.github/workflows/create-artifact-linux.yml
vendored
@@ -8,10 +8,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
run: npm run build
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-build
|
||||
retention-days: 3
|
||||
|
12
.github/workflows/create-artifact-macos.yml
vendored
12
.github/workflows/create-artifact-macos.yml
vendored
@@ -8,20 +8,21 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: npm install & build
|
||||
run: |
|
||||
npm install
|
||||
npm install "dmg-license" --save-optional
|
||||
npm run build
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-build
|
||||
retention-days: 3
|
||||
@@ -38,17 +39,18 @@ jobs:
|
||||
ref: beta
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: npm install & build
|
||||
run: |
|
||||
npm install
|
||||
npm install "dmg-license" --save-optional
|
||||
npm run build
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-build-beta
|
||||
retention-days: 3
|
||||
|
@@ -11,7 +11,7 @@ jobs:
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.8'
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install pipx
|
||||
uses: CfirTsabari/actions-pipx@v1
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 20
|
||||
|
||||
# - name: Delete old package-lock.json
|
||||
# run: rm package-lock.json
|
||||
|
4
.github/workflows/test-builds.yml
vendored
4
.github/workflows/test-builds.yml
vendored
@@ -17,12 +17,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: develop
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
11
.github/workflows/test-e2e-win.yml
vendored
11
.github/workflows/test-e2e-win.yml
vendored
@@ -1,9 +1,10 @@
|
||||
name: Test end-to-end
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
workflow_dispatch: {}
|
||||
# push:
|
||||
# branches:
|
||||
# - develop
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@@ -15,10 +16,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
151
CHANGELOG.md
151
CHANGELOG.md
@@ -2,6 +2,157 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.7.29-beta.0](https://github.com/antares-sql/antares/compare/v0.7.28...v0.7.29-beta.0) (2024-09-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* cancel button when waiting to connect database, closes [#830](https://github.com/antares-sql/antares/issues/830) ([b6a7124](https://github.com/antares-sql/antares/commit/b6a7124f33397a2ae7da654b5867f6982ac5810e))
|
||||
* update czech translation ([0506b65](https://github.com/antares-sql/antares/commit/0506b653d74d8cd5e848bc2ec4d29d4b0247c880))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* mismatch between table field columns and results with duplicate fields, fixes [#848](https://github.com/antares-sql/antares/issues/848) ([da8cc39](https://github.com/antares-sql/antares/commit/da8cc39157a4b507d3d377ee1e888b8f8a52b7c5))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* **UI:** hide edit/delete functions in readonly mode ([37d44c9](https://github.com/antares-sql/antares/commit/37d44c95ee559f3ee1345e91fca5e2c1e86c5fbf))
|
||||
|
||||
### [0.7.28](https://github.com/antares-sql/antares/compare/v0.7.28-beta.0...v0.7.28) (2024-08-20)
|
||||
|
||||
### [0.7.28-beta.0](https://github.com/antares-sql/antares/compare/v0.7.27...v0.7.28-beta.0) (2024-08-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add missing Dutch strings ([e794d20](https://github.com/antares-sql/antares/commit/e794d207ad75e0f5380f57df579912893e5edb6a))
|
||||
* **translation:** Add more faker translations ([74e97e6](https://github.com/antares-sql/antares/commit/74e97e660df089ed8273565942118e112f6b3220))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* disabled column sort during loadings ([72bacde](https://github.com/antares-sql/antares/commit/72bacdeabf833880482a839c4735505573d33bdc))
|
||||
* html tags searching in history or saved queries, fixes [#847](https://github.com/antares-sql/antares/issues/847) ([6cb21ff](https://github.com/antares-sql/antares/commit/6cb21ff7926c74469b421c47b434612b3894b4c2))
|
||||
* **PostgreSQL:** issue exporting tables with primary keys ([c434855](https://github.com/antares-sql/antares/commit/c434855879de16f83e17784e38e931decdd94873))
|
||||
* **PostgreSQL:** wrong export formato of JSON fields ([8e7965a](https://github.com/antares-sql/antares/commit/8e7965a0f94a17ed73d5c8913f66e4e9cf0b11c7))
|
||||
* **translation:** Spelling error ([f5d236b](https://github.com/antares-sql/antares/commit/f5d236b521a3534754de0b1031513f8eb83b3cc0))
|
||||
* wrong password message importing app data ([ba0ffcc](https://github.com/antares-sql/antares/commit/ba0ffcc6f56c5506c1768c05d43bb07f7b090a68))
|
||||
|
||||
### [0.7.27](https://github.com/antares-sql/antares/compare/v0.7.26...v0.7.27) (2024-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* issue with new console and languages different than english, fixes [#837](https://github.com/antares-sql/antares/issues/837) ([59f7d3c](https://github.com/antares-sql/antares/commit/59f7d3c67083ac7e32bd29c9b7e6e044f2060c2f))
|
||||
|
||||
### [0.7.26](https://github.com/antares-sql/antares/compare/v0.7.26-beta.1...v0.7.26) (2024-07-15)
|
||||
|
||||
### [0.7.26-beta.1](https://github.com/antares-sql/antares/compare/v0.7.26-beta.0...v0.7.26-beta.1) (2024-07-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* custom SVG icons for connections, closes [#663](https://github.com/antares-sql/antares/issues/663) ([171b6f9](https://github.com/antares-sql/antares/commit/171b6f924acc7d7696f4f850a704af0baf616b87))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* table name in column list on export as SQL features, fixes [#822](https://github.com/antares-sql/antares/issues/822) ([f7419d8](https://github.com/antares-sql/antares/commit/f7419d8e9c4fe8ea80dbf9b2612ff44a66f50365))
|
||||
|
||||
### [0.7.26-beta.0](https://github.com/antares-sql/antares/compare/v0.7.25...v0.7.26-beta.0) (2024-07-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* in-app debug console, closes [#824](https://github.com/antares-sql/antares/issues/824) ([3e223b4](https://github.com/antares-sql/antares/commit/3e223b475ea57b24a6782feeabecad9c5596e271))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **PostgreSQL:** issue with ssl enabled and connection strings, fixes [#786](https://github.com/antares-sql/antares/issues/786) ([4a38656](https://github.com/antares-sql/antares/commit/4a38656b7e1094d3a9df28ce263c272f2014adb7))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* **UI:** improved all connections modal, closes [#761](https://github.com/antares-sql/antares/issues/761) ([25b7ae5](https://github.com/antares-sql/antares/commit/25b7ae57c6a4be9e825dddc7a52a49b67e03771b))
|
||||
|
||||
### [0.7.25](https://github.com/antares-sql/antares/compare/v0.7.25-beta.2...v0.7.25) (2024-06-19)
|
||||
|
||||
### [0.7.25-beta.2](https://github.com/antares-sql/antares/compare/v0.7.25-beta.1...v0.7.25-beta.2) (2024-06-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **PostgreSQL:** support to materialized views, closes [#804](https://github.com/antares-sql/antares/issues/804) ([0b9898f](https://github.com/antares-sql/antares/commit/0b9898f3e714d2cb24d100f55dd3858a644de162))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* **UI:** views grouped in folders ([a973ec3](https://github.com/antares-sql/antares/commit/a973ec3c60398cb16685a4f991c43ec4ee74c986))
|
||||
|
||||
### [0.7.25-beta.1](https://github.com/antares-sql/antares/compare/v0.7.25-beta.0...v0.7.25-beta.1) (2024-06-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* issue switching table after using a filter, fixes[#691](https://github.com/antares-sql/antares/issues/691) ([4a1697d](https://github.com/antares-sql/antares/commit/4a1697d63351b9990efff5804b95d92ac2fc9783))
|
||||
|
||||
### [0.7.25-beta.0](https://github.com/antares-sql/antares/compare/v0.7.24...v0.7.25-beta.0) (2024-05-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update japanese translation ([bb3c87b](https://github.com/antares-sql/antares/commit/bb3c87b2cf6fa38e3cfb68317c02aa350aae7887))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* missing resizebars on mouse over ([25123e3](https://github.com/antares-sql/antares/commit/25123e34ef860d8bf019c496097e68e0101c9ab9))
|
||||
* **PostgreSQL:** unable to search for databases, fixes [#798](https://github.com/antares-sql/antares/issues/798) ([d1bb50b](https://github.com/antares-sql/antares/commit/d1bb50b2bb48d3445080990c28fdc656cf27a6d3))
|
||||
|
||||
### [0.7.24](https://github.com/antares-sql/antares/compare/v0.7.24-beta.1...v0.7.24) (2024-05-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* missing accent color change ([09c274a](https://github.com/antares-sql/antares/commit/09c274a724b5020efc650aaf7eecb2404343a6fc))
|
||||
|
||||
### [0.7.24-beta.1](https://github.com/antares-sql/antares/compare/v0.7.24-beta.0...v0.7.24-beta.1) (2024-04-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* accent color based on folder color, closes [#762](https://github.com/antares-sql/antares/issues/762) ([058fc2f](https://github.com/antares-sql/antares/commit/058fc2fc0b34cde5aa19233a4a999ef3624dae71))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **PostgreSQL:** better handle connection errors, should fix [#794](https://github.com/antares-sql/antares/issues/794) ([33bbc0e](https://github.com/antares-sql/antares/commit/33bbc0e7e6be370c944e979a34ab2cb19562d1e3))
|
||||
* **PostgreSQL:** issue with similar tabs on differend databases ([23c59b4](https://github.com/antares-sql/antares/commit/23c59b4d4e8f250acad75f54d157c7c162e1c4f8))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* **UI:** hide "insert row" button in read-only mode, closes [#695](https://github.com/antares-sql/antares/issues/695) ([6600197](https://github.com/antares-sql/antares/commit/6600197b8286ced4c79378883594d21e69a83d8c))
|
||||
* **UI:** improvements on light theme ([ece2ee0](https://github.com/antares-sql/antares/commit/ece2ee05cc90a58c1926e882e3ccf4f057f02d68))
|
||||
|
||||
### [0.7.24-beta.0](https://github.com/antares-sql/antares/compare/v0.7.23...v0.7.24-beta.0) (2024-04-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add shortcut open,save, and save as file ([6b56c60](https://github.com/antares-sql/antares/commit/6b56c60b68647bc7182548a137cccc3413e3fbd5))
|
||||
* add translation for open,save, and save as file ([f7204dc](https://github.com/antares-sql/antares/commit/f7204dc0ae721534eaefbde097d1c26c1d72ad41))
|
||||
* open,save, and save as file in query tab ([c1e58eb](https://github.com/antares-sql/antares/commit/c1e58eb695de78fbf1d2b26c608692f0962373df))
|
||||
* unsaved file reminder closing file tabs ([8d8650f](https://github.com/antares-sql/antares/commit/8d8650fbe76c79fd66be857d049b3baaa9ab1f9f))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **translation:** missing translation for "Open notes" shortcut ([0565ae1](https://github.com/antares-sql/antares/commit/0565ae12042901b9d67fe3e0ea269562ec444994))
|
||||
|
||||
### [0.7.23](https://github.com/antares-sql/antares/compare/v0.7.23-beta.1...v0.7.23) (2024-04-07)
|
||||
|
||||
### [0.7.23-beta.1](https://github.com/antares-sql/antares/compare/v0.7.23-beta.0...v0.7.23-beta.1) (2024-04-02)
|
||||
|
@@ -150,6 +150,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bagusindrayana"><img src="https://avatars.githubusercontent.com/u/36830534?v=4?s=100" width="100px;" alt="Bagus Indrayana"/><br /><sub><b>Bagus Indrayana</b></sub></a><br /><a href="https://github.com/antares-sql/antares/commits?author=bagusindrayana" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/penguinlab"><img src="https://avatars.githubusercontent.com/u/10959317?v=4?s=100" width="100px;" alt="Naoki Ishikawa"/><br /><sub><b>Naoki Ishikawa</b></sub></a><br /><a href="#translation-penguinlab" title="Translation">🌍</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://fazevedo.dev"><img src="https://avatars.githubusercontent.com/u/1640325?v=4?s=100" width="100px;" alt="Filipe Azevedo"/><br /><sub><b>Filipe Azevedo</b></sub></a><br /><a href="https://github.com/antares-sql/antares/commits?author=mangas" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
10750
package-lock.json
generated
10750
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "antares",
|
||||
"productName": "Antares",
|
||||
"version": "0.7.23",
|
||||
"version": "0.7.29-beta.0",
|
||||
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/antares-sql/antares.git",
|
||||
@@ -119,7 +119,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/remote": "~2.0.1",
|
||||
"@electron/remote": "~2.1.2",
|
||||
"@fabio286/ssh2-promise": "~1.0.4-b",
|
||||
"@faker-js/faker": "~6.1.2",
|
||||
"@jamescoyle/vue-icon": "~0.1.2",
|
||||
@@ -127,10 +127,11 @@
|
||||
"@turf/helpers": "~6.5.0",
|
||||
"@vue/compiler-sfc": "~3.2.33",
|
||||
"@vueuse/core": "~10.4.1",
|
||||
"ace-builds": "~1.24.1",
|
||||
"ace-builds": "~1.34.1",
|
||||
"babel-loader": "~8.2.3",
|
||||
"better-sqlite3": "~9.4.1",
|
||||
"better-sqlite3": "~10.0.0",
|
||||
"chalk": "~4.1.2",
|
||||
"cpu-features": "^0.0.10",
|
||||
"cross-env": "~7.0.2",
|
||||
"css-loader": "~6.5.0",
|
||||
"electron-log": "~5.0.1",
|
||||
@@ -146,10 +147,10 @@
|
||||
"marked": "~12.0.0",
|
||||
"mini-css-extract-plugin": "~2.4.5",
|
||||
"moment": "~2.30.1",
|
||||
"mysql2": "~3.9.1",
|
||||
"node-firebird": "~1.1.4",
|
||||
"mysql2": "~3.9.7",
|
||||
"node-firebird": "~1.1.8",
|
||||
"node-loader": "~2.0.0",
|
||||
"pg": "~8.11.3",
|
||||
"pg": "~8.11.5",
|
||||
"pg-connection-string": "~2.5.0",
|
||||
"pg-query-stream": "~4.2.3",
|
||||
"pgsql-ast-parser": "~7.2.1",
|
||||
@@ -169,11 +170,11 @@
|
||||
"typescript": "~4.6.3",
|
||||
"unzip-crx-3": "~0.2.0",
|
||||
"v-mask": "~2.3.0",
|
||||
"vue": "~3.4.19",
|
||||
"vue-i18n": "~9.2.2",
|
||||
"vue": "~3.4.27",
|
||||
"vue-i18n": "~9.13.1",
|
||||
"vue-loader": "~16.8.3",
|
||||
"vuedraggable": "~4.1.0",
|
||||
"webpack": "~5.72.0",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "~4.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -192,8 +193,8 @@
|
||||
"@typescript-eslint/eslint-plugin": "~5.18.0",
|
||||
"@typescript-eslint/parser": "~5.18.0",
|
||||
"all-contributors-cli": "~6.20.0",
|
||||
"electron": "~26.6.9",
|
||||
"electron-builder": "~24.6.4",
|
||||
"electron": "~30.0.8",
|
||||
"electron-builder": "~24.13.3",
|
||||
"eslint": "~7.32.0",
|
||||
"eslint-config-standard": "~16.0.3",
|
||||
"eslint-plugin-import": "~2.24.2",
|
||||
|
@@ -31,6 +31,7 @@ export const customizations: Customizations = {
|
||||
schemas: true,
|
||||
tables: true,
|
||||
views: true,
|
||||
materializedViews: true,
|
||||
triggers: true,
|
||||
triggerFunctions: true,
|
||||
routines: true,
|
||||
@@ -42,6 +43,7 @@ export const customizations: Customizations = {
|
||||
tableDuplicate: true,
|
||||
tableDdl: true,
|
||||
viewAdd: true,
|
||||
materializedViewAdd: true,
|
||||
triggerAdd: true,
|
||||
triggerFunctionAdd: true,
|
||||
routineAdd: true,
|
||||
@@ -52,6 +54,7 @@ export const customizations: Customizations = {
|
||||
databaseEdit: false,
|
||||
tableSettings: true,
|
||||
viewSettings: true,
|
||||
materializedViewSettings: true,
|
||||
triggerSettings: true,
|
||||
triggerFunctionSettings: true,
|
||||
routineSettings: true,
|
||||
|
@@ -18,7 +18,7 @@ export type Importer = MySQLImporter | PostgreSQLImporter
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface IpcResponse<T = any> {
|
||||
status: 'success' | 'error';
|
||||
status: 'success' | 'error' | 'abort';
|
||||
response?: T;
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,7 @@ export interface Customizations {
|
||||
schemas?: boolean;
|
||||
tables?: boolean;
|
||||
views?: boolean;
|
||||
materializedViews?: boolean;
|
||||
triggers?: boolean;
|
||||
triggerFunctions?: boolean;
|
||||
routines?: boolean;
|
||||
@@ -45,6 +46,8 @@ export interface Customizations {
|
||||
tableDdl?: boolean;
|
||||
viewAdd?: boolean;
|
||||
viewSettings?: boolean;
|
||||
materializedViewAdd?: boolean;
|
||||
materializedViewSettings?: boolean;
|
||||
triggerAdd?: boolean;
|
||||
triggerFunctionAdd?: boolean;
|
||||
routineAdd?: boolean;
|
||||
|
@@ -40,7 +40,7 @@ export const objectToGeoJSON = (val: any) => {
|
||||
export const escapeAndQuote = (val: string, client: ClientCode) => {
|
||||
const { stringsWrapper: sw } = customizations[client];
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const CHARS_TO_ESCAPE = /[\0\b\t\n\r\x1a"'\\]/g;
|
||||
const CHARS_TO_ESCAPE = sw === '"' ? /[\0\b\t\n\r\x1a"'\\]/g : /[\0\b\t\n\r\x1a'\\]/g;
|
||||
const CHARS_ESCAPE_MAP: Record<string, string> = {
|
||||
'\0': '\\0',
|
||||
'\b': '\\b',
|
||||
@@ -48,10 +48,13 @@ export const escapeAndQuote = (val: string, client: ClientCode) => {
|
||||
'\n': '\\n',
|
||||
'\r': '\\r',
|
||||
'\x1a': '\\Z',
|
||||
'"': '\\"',
|
||||
'\'': '\\\'',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
|
||||
if (sw === '"')
|
||||
CHARS_ESCAPE_MAP['"'] = '\\"';
|
||||
|
||||
let chunkIndex = CHARS_TO_ESCAPE.lastIndex = 0;
|
||||
let escapedVal = '';
|
||||
let match;
|
||||
@@ -97,10 +100,19 @@ export const valueToSqlString = (args: {
|
||||
}
|
||||
else if ('isArray' in field && field.isArray) {
|
||||
let localVal;
|
||||
if (Array.isArray(val))
|
||||
localVal = JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
|
||||
else
|
||||
localVal = typeof val === 'string' ? val.replaceAll('[', '{').replaceAll(']', '}') : '';
|
||||
if (Array.isArray(val)) {
|
||||
localVal = JSON
|
||||
.stringify(val)
|
||||
.replaceAll('[', '{')
|
||||
.replaceAll(']', '}');
|
||||
}
|
||||
else {
|
||||
localVal = typeof val === 'string'
|
||||
? val
|
||||
.replaceAll('[', '{')
|
||||
.replaceAll(']', '}')
|
||||
: '';
|
||||
}
|
||||
parsedValue = `'${localVal}'`;
|
||||
}
|
||||
else if (TEXT_SEARCH.includes(field.type))
|
||||
@@ -163,7 +175,7 @@ export const jsonToSqlInsert = (args: {
|
||||
const sqlInsertAfter = options && options.sqlInsertAfter ? options.sqlInsertAfter : 1;
|
||||
const sqlInsertDivider = options && options.sqlInsertDivider ? options.sqlInsertDivider : 'rows';
|
||||
const { elementsWrapper: ew } = customizations[client];
|
||||
const fieldNames = Object.keys(json[0]).map(key => `${ew}${key}${ew}`);
|
||||
const fieldNames = Object.keys(json[0]).map(key => `${ew}${key.split('.').pop()}${ew}`);
|
||||
let insertStmt = `INSERT INTO ${ew}${table}${ew} (${fieldNames.join(', ')}) VALUES `;
|
||||
let insertsString = '';
|
||||
let queryLength = 0;
|
||||
|
@@ -6,6 +6,9 @@ export const shortcutEvents: Record<string, { l18n: string; l18nParam?: string |
|
||||
'kill-query': { l18n: 'database.killQuery', context: 'tab' },
|
||||
'query-history': { l18n: 'database.queryHistory', context: 'tab' },
|
||||
'clear-query': { l18n: 'database.clearQuery', context: 'tab' },
|
||||
// 'save-file': { l18n: 'application.saveFile', context: 'tab' },
|
||||
'open-file': { l18n: 'application.openFile', context: 'tab' },
|
||||
'save-file-as': { l18n: 'application.saveFileAs', context: 'tab' },
|
||||
'next-tab': { l18n: 'application.nextTab' },
|
||||
'prev-tab': { l18n: 'application.previousTab' },
|
||||
'open-all-connections': { l18n: 'application.openAllConnections' },
|
||||
@@ -16,7 +19,7 @@ export const shortcutEvents: Record<string, { l18n: string; l18nParam?: string |
|
||||
'save-content': { l18n: 'application.saveContent' },
|
||||
'create-connection': { l18n: 'connection.createNewConnection' },
|
||||
'open-settings': { l18n: 'application.openSettings' },
|
||||
'open-scratchpad': { l18n: 'application.openScratchpad' }
|
||||
'open-scratchpad': { l18n: 'application.openNotes' }
|
||||
};
|
||||
|
||||
interface ShortcutRecord {
|
||||
@@ -119,6 +122,21 @@ const shortcuts: ShortcutRecord[] = [
|
||||
event: 'toggle-console',
|
||||
keys: ['CommandOrControl+`'],
|
||||
os: ['darwin', 'linux', 'win32']
|
||||
},
|
||||
// {
|
||||
// event: 'save-file',
|
||||
// keys: ['CommandOrControl+S'],
|
||||
// os: ['darwin', 'linux', 'win32']
|
||||
// },
|
||||
{
|
||||
event: 'open-file',
|
||||
keys: ['CommandOrControl+O'],
|
||||
os: ['darwin', 'linux', 'win32']
|
||||
},
|
||||
{
|
||||
event: 'save-file-as',
|
||||
keys: ['Shift+CommandOrControl+S'],
|
||||
os: ['darwin', 'linux', 'win32']
|
||||
}
|
||||
];
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { app, dialog, ipcMain, safeStorage } from 'electron';
|
||||
import * as Store from 'electron-store';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { validateSender } from '../libs/misc/validateSender';
|
||||
import { ShortcutRegister } from '../libs/ShortcutRegister';
|
||||
@@ -52,6 +53,11 @@ export default () => {
|
||||
return dialog.showOpenDialog(options);
|
||||
});
|
||||
|
||||
ipcMain.handle('show-save-dialog', (event, options) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
return dialog.showSaveDialog(options);
|
||||
});
|
||||
|
||||
ipcMain.handle('get-download-dir-path', (event) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
return app.getPath('downloads');
|
||||
@@ -80,4 +86,26 @@ export default () => {
|
||||
const shortCutRegister = ShortcutRegister.getInstance();
|
||||
shortCutRegister.unregister();
|
||||
});
|
||||
|
||||
ipcMain.handle('read-file', (event, { filePath, encoding }) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
try {
|
||||
const content = fs.readFileSync(filePath, encoding);
|
||||
return content;
|
||||
}
|
||||
catch (error) {
|
||||
return { status: 'error', response: error.toString() };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('write-file', (event, filePath, content) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
try {
|
||||
fs.writeFileSync(filePath, content, 'utf-8');
|
||||
return { status: 'success' };
|
||||
}
|
||||
catch (error) {
|
||||
return { status: 'error', response: error.toString() };
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@@ -5,11 +5,21 @@ import { SslOptions } from 'mysql2';
|
||||
|
||||
import { ClientsFactory } from '../libs/ClientsFactory';
|
||||
import { validateSender } from '../libs/misc/validateSender';
|
||||
const isAborting: Record<string, boolean> = {};
|
||||
|
||||
export default (connections: Record<string, antares.Client>) => {
|
||||
ipcMain.handle('test-connection', async (event, conn: antares.ConnectionParams) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
let isLocalAborted = false;
|
||||
const abortChecker = setInterval(() => { // Intercepts abort request
|
||||
if (isAborting[conn.uid]) {
|
||||
isAborting[conn.uid] = false;
|
||||
isLocalAborted = true;
|
||||
clearInterval(abortChecker);
|
||||
}
|
||||
}, 50);
|
||||
|
||||
const params = {
|
||||
host: conn.host,
|
||||
port: +conn.port,
|
||||
@@ -65,19 +75,27 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
client: conn.client,
|
||||
params
|
||||
});
|
||||
await connection.connect();
|
||||
|
||||
if (conn.client === 'firebird')
|
||||
connection.raw('SELECT rdb$get_context(\'SYSTEM\', \'DB_NAME\') FROM rdb$database');
|
||||
else
|
||||
await connection.select('1+1').run();
|
||||
await connection.connect();
|
||||
if (isLocalAborted) {
|
||||
connection.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
await connection.ping();
|
||||
|
||||
connection.destroy();
|
||||
clearInterval(abortChecker);
|
||||
|
||||
return { status: 'success' };
|
||||
}
|
||||
catch (err) {
|
||||
clearInterval(abortChecker);
|
||||
|
||||
if (!isLocalAborted)
|
||||
return { status: 'error', response: err.toString() };
|
||||
else
|
||||
return { status: 'abort', response: 'Connection aborted' };
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,6 +106,15 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
ipcMain.handle('connect', async (event, conn: antares.ConnectionParams) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
let isLocalAborted = false;
|
||||
const abortChecker = setInterval(() => { // Intercepts abort request
|
||||
if (isAborting[conn.uid]) {
|
||||
isAborting[conn.uid] = false;
|
||||
isLocalAborted = true;
|
||||
clearInterval(abortChecker);
|
||||
}
|
||||
}, 50);
|
||||
|
||||
const params = {
|
||||
host: conn.host,
|
||||
port: +conn.port,
|
||||
@@ -150,18 +177,36 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
});
|
||||
|
||||
await connection.connect();
|
||||
if (isLocalAborted) {
|
||||
connection.destroy();
|
||||
return { status: 'abort', response: 'Connection aborted' };
|
||||
}
|
||||
|
||||
const structure = await connection.getStructure(new Set());
|
||||
if (isLocalAborted) {
|
||||
connection.destroy();
|
||||
return { status: 'abort', response: 'Connection aborted' };
|
||||
}
|
||||
|
||||
connections[conn.uid] = connection;
|
||||
clearInterval(abortChecker);
|
||||
|
||||
return { status: 'success', response: structure };
|
||||
}
|
||||
catch (err) {
|
||||
clearInterval(abortChecker);
|
||||
|
||||
if (!isLocalAborted)
|
||||
return { status: 'error', response: err.toString() };
|
||||
else
|
||||
return { status: 'abort', response: 'Connection aborted' };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('abort-connection', (event, uid) => {
|
||||
isAborting[uid] = true;
|
||||
});
|
||||
|
||||
ipcMain.handle('disconnect', (event, uid) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
|
@@ -251,7 +251,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
setTimeout(() => { // Ensures that writing thread has finished
|
||||
exporter?.terminate();
|
||||
exporter = null;
|
||||
}, 2000);
|
||||
}, 500);
|
||||
resolve({ status: 'success', response: payload });
|
||||
break;
|
||||
case 'cancel':
|
||||
|
@@ -51,4 +51,52 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
return { status: 'error', response: err.toString() };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('get-materialized-view-informations', async (event, params) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
try {
|
||||
const result = await connections[params.uid].getMaterializedViewInformations(params);
|
||||
return { status: 'success', response: result };
|
||||
}
|
||||
catch (err) {
|
||||
return { status: 'error', response: err.toString() };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('drop-materialized-view', async (event, params) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
try {
|
||||
await connections[params.uid].dropMaterializedView(params);
|
||||
return { status: 'success' };
|
||||
}
|
||||
catch (err) {
|
||||
return { status: 'error', response: err.toString() };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('alter-materialized-view', async (event, params) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
try {
|
||||
await connections[params.uid].alterView(params);
|
||||
return { status: 'success' };
|
||||
}
|
||||
catch (err) {
|
||||
return { status: 'error', response: err.toString() };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('create-materialized-view', async (event, params) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
|
||||
try {
|
||||
await connections[params.uid].createMaterializedView(params);
|
||||
return { status: 'success' };
|
||||
}
|
||||
catch (err) {
|
||||
return { status: 'error', response: err.toString() };
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@@ -234,6 +234,18 @@ export abstract class BaseClient {
|
||||
throw new Error('Method "getVariables" not implemented');
|
||||
}
|
||||
|
||||
getMaterializedViewInformations (...args: any) {
|
||||
throw new Error('Method "getMaterializedViewInformations" not implemented');
|
||||
}
|
||||
|
||||
dropMaterializedView (...args: any) {
|
||||
throw new Error('Method "dropMaterializedView" not implemented');
|
||||
}
|
||||
|
||||
createMaterializedView (...args: any) {
|
||||
throw new Error('Method "createMaterializedView" not implemented');
|
||||
}
|
||||
|
||||
getEventInformations (...args: any) {
|
||||
throw new Error('Method "getEventInformations" not implemented');
|
||||
}
|
||||
|
@@ -109,6 +109,10 @@ export class FirebirdSQLClient extends BaseClient {
|
||||
return firebird.pool(this._poolSize, { ...this._params, blobAsText: true });
|
||||
}
|
||||
|
||||
ping () {
|
||||
return this.raw('SELECT rdb$get_context(\'SYSTEM\', \'DB_NAME\') FROM rdb$database');
|
||||
}
|
||||
|
||||
destroy () {
|
||||
if (this._poolSize)
|
||||
return (this._connection as firebird.ConnectionPool).destroy();
|
||||
|
@@ -214,6 +214,10 @@ export class MySQLClient extends BaseClient {
|
||||
}
|
||||
}
|
||||
|
||||
ping () {
|
||||
return this.select('1+1').run();
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this._connection.end();
|
||||
clearInterval(this._keepaliveTimer);
|
||||
|
@@ -210,6 +210,10 @@ export class PostgreSQLClient extends BaseClient {
|
||||
if (this._params.readonly)
|
||||
await connection.query('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
|
||||
|
||||
connection.on('error', err => { // Intercepts errors and converts to rejections
|
||||
Promise.reject(err);
|
||||
});
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
@@ -239,6 +243,10 @@ export class PostgreSQLClient extends BaseClient {
|
||||
return connection;
|
||||
}
|
||||
|
||||
ping () {
|
||||
return this.select('1+1').run();
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this._connection.end();
|
||||
clearInterval(this._keepaliveTimer);
|
||||
@@ -331,6 +339,19 @@ export class PostgreSQLClient extends BaseClient {
|
||||
ORDER BY table_name
|
||||
`);
|
||||
|
||||
let { rows: matViews } = await this.raw<antares.QueryResult<ShowTableResult>>(`
|
||||
SELECT schemaname AS schema_name,
|
||||
matviewname AS table_name,
|
||||
matviewowner AS owner,
|
||||
ispopulated AS is_populated,
|
||||
definition,
|
||||
'materializedview' AS table_type
|
||||
FROM pg_matviews
|
||||
WHERE schemaname = '${db.database}'
|
||||
ORDER BY schema_name,
|
||||
table_name;
|
||||
`);
|
||||
|
||||
if (tables.length) {
|
||||
tables = tables.map(table => {
|
||||
table.Db = db.database;
|
||||
@@ -339,6 +360,14 @@ export class PostgreSQLClient extends BaseClient {
|
||||
tablesArr.push(...tables);
|
||||
}
|
||||
|
||||
if (matViews.length) {
|
||||
matViews = matViews.map(view => {
|
||||
view.Db = db.database;
|
||||
return view;
|
||||
});
|
||||
tablesArr.push(...matViews);
|
||||
}
|
||||
|
||||
let { rows: triggers } = await this.raw<antares.QueryResult<ShowTriggersResult>>(`
|
||||
SELECT
|
||||
pg_class.relname AS table_name,
|
||||
@@ -374,7 +403,11 @@ export class PostgreSQLClient extends BaseClient {
|
||||
|
||||
return {
|
||||
name: table.table_name,
|
||||
type: table.table_type === 'VIEW' ? 'view' : 'table',
|
||||
type: table.table_type === 'VIEW'
|
||||
? 'view'
|
||||
: table.table_type === 'materializedview'
|
||||
? 'materializedview'
|
||||
: 'table',
|
||||
rows: table.reltuples,
|
||||
size: tableSize,
|
||||
collation: table.Collation,
|
||||
@@ -562,7 +595,7 @@ export class PostgreSQLClient extends BaseClient {
|
||||
}
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
if (schema !== 'public')
|
||||
// if (schema !== 'public')
|
||||
await this.use(schema);
|
||||
|
||||
const { rows } = await this.raw<antares.QueryResult<ShowIntexesResult>>(`WITH ndx_list AS (
|
||||
@@ -607,35 +640,7 @@ export class PostgreSQLClient extends BaseClient {
|
||||
}, {} as {table: string; schema: string}[]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
async getTableDll ({ schema, table }: { schema: string; table: string }) {
|
||||
// const { rows } = await this.raw<antares.QueryResult<{'ddl'?: string}>>(`
|
||||
// SELECT
|
||||
// 'CREATE TABLE ' || relname || E'\n(\n' ||
|
||||
// array_to_string(
|
||||
// array_agg(' ' || column_name || ' ' || type || ' '|| not_null)
|
||||
// , E',\n'
|
||||
// ) || E'\n);\n' AS ddl
|
||||
// FROM (
|
||||
// SELECT
|
||||
// a.attname AS column_name
|
||||
// , pg_catalog.format_type(a.atttypid, a.atttypmod) AS type
|
||||
// , CASE WHEN a.attnotnull THEN 'NOT NULL' ELSE 'NULL' END AS not_null
|
||||
// , c.relname
|
||||
// FROM pg_attribute a, pg_class c, pg_type t
|
||||
// WHERE a.attnum > 0
|
||||
// AND a.attrelid = c.oid
|
||||
// AND a.atttypid = t.oid
|
||||
// AND c.relname = '${table}'
|
||||
// ORDER BY a.attnum
|
||||
// ) AS tabledefinition
|
||||
// GROUP BY relname
|
||||
// `);
|
||||
|
||||
// if (rows.length)
|
||||
// return rows[0].ddl;
|
||||
// else return '';
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
interface SequenceRecord {
|
||||
sequence_catalog: string;
|
||||
@@ -677,6 +682,34 @@ export class PostgreSQLClient extends BaseClient {
|
||||
|
||||
if (!rows.length) return '';
|
||||
|
||||
const indexes = await this.getTableIndexes({ schema, table });
|
||||
const primaryKey = indexes
|
||||
.filter(i => i.type === 'PRIMARY')
|
||||
.reduce((acc, cur) => {
|
||||
if (!Object.keys(acc).length) {
|
||||
cur.column = `"${cur.column}"`;
|
||||
acc = cur;
|
||||
}
|
||||
else
|
||||
acc.column += `, "${cur.column}"`;
|
||||
return acc;
|
||||
}, {} as { name: string; column: string; type: string});
|
||||
|
||||
const remappedIndexes = indexes
|
||||
.filter(i => i.type !== 'PRIMARY')
|
||||
.reduce((acc, cur) => {
|
||||
const existingIndex = acc.findIndex(i => i.name === cur.name);
|
||||
|
||||
if (existingIndex >= 0)
|
||||
acc[existingIndex].column += `, "${cur.column}"`;
|
||||
else {
|
||||
cur.column = `"${cur.column}"`;
|
||||
acc.push(cur);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, [] as { name: string; column: string; type: string}[]);
|
||||
|
||||
for (const column of rows) {
|
||||
let fieldType = column.data_type;
|
||||
if (fieldType === 'USER-DEFINED') fieldType = `"${schema}".${column.udt_name}`;
|
||||
@@ -704,6 +737,9 @@ export class PostgreSQLClient extends BaseClient {
|
||||
columnsSql.push(columnArr.join(' '));
|
||||
}
|
||||
|
||||
if (primaryKey)
|
||||
columnsSql.push(`CONSTRAINT "${primaryKey.name}" PRIMARY KEY (${primaryKey.column})`);
|
||||
|
||||
// Table sequences
|
||||
for (let sequence of sequences) {
|
||||
if (sequence.includes('.')) sequence = sequence.split('.')[1];
|
||||
@@ -720,25 +756,22 @@ export class PostgreSQLClient extends BaseClient {
|
||||
INCREMENT BY ${rows[0].increment}
|
||||
MINVALUE ${rows[0].minimum_value}
|
||||
MAXVALUE ${rows[0].maximum_value}
|
||||
CACHE 1;\n`;
|
||||
CACHE 1;\n\n`;
|
||||
}
|
||||
}
|
||||
|
||||
// Table create
|
||||
createSql += `\nCREATE TABLE "${schema}"."${table}"(
|
||||
createSql += `CREATE TABLE "${schema}"."${table}"(
|
||||
${columnsSql.join(',\n ')}
|
||||
);\n`;
|
||||
|
||||
// Table indexes
|
||||
createSql += '\n';
|
||||
const { rows: indexes } = await this.select('*')
|
||||
.schema('pg_catalog')
|
||||
.from('pg_indexes')
|
||||
.where({ schemaname: `= '${schema}'`, tablename: `= '${table}'` })
|
||||
.run<{indexdef: string}>();
|
||||
|
||||
for (const index of indexes)
|
||||
createSql += `${index.indexdef};\n`;
|
||||
for (const index of remappedIndexes) {
|
||||
if (index.type !== 'PRIMARY')
|
||||
createSql += `CREATE ${index.type}${index.type === 'UNIQUE' ? ' INDEX' : ''} "${index.name}" ON "${schema}"."${table}" (${index.column});\n`;
|
||||
}
|
||||
|
||||
return createSql;
|
||||
}
|
||||
@@ -1052,11 +1085,32 @@ export class PostgreSQLClient extends BaseClient {
|
||||
})[0];
|
||||
}
|
||||
|
||||
async getMaterializedViewInformations ({ schema, view }: { schema: string; view: string }) {
|
||||
const sql = `SELECT "definition" FROM "pg_matviews" WHERE "matviewname"='${view}' AND "schemaname"='${schema}'`;
|
||||
const results = await this.raw(sql);
|
||||
|
||||
return results.rows.map(row => {
|
||||
return {
|
||||
algorithm: '',
|
||||
definer: '',
|
||||
security: '',
|
||||
updateOption: '',
|
||||
sql: row.definition,
|
||||
name: view
|
||||
};
|
||||
})[0];
|
||||
}
|
||||
|
||||
async dropView (params: { schema: string; view: string }) {
|
||||
const sql = `DROP VIEW "${params.schema}"."${params.view}"`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async dropMaterializedView (params: { schema: string; view: string }) {
|
||||
const sql = `DROP MATERIALIZED VIEW "${params.schema}"."${params.view}"`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async alterView ({ view }: { view: antares.AlterViewParams }) {
|
||||
let sql = `CREATE OR REPLACE VIEW "${view.schema}"."${view.oldName}" AS ${view.sql}`;
|
||||
|
||||
@@ -1066,11 +1120,25 @@ export class PostgreSQLClient extends BaseClient {
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async alterMaterializedView ({ view }: { view: antares.AlterViewParams }) {
|
||||
let sql = `CREATE OR REPLACE MATERIALIZED VIEW "${view.schema}"."${view.oldName}" AS ${view.sql}`;
|
||||
|
||||
if (view.name !== view.oldName)
|
||||
sql += `; ALTER VIEW "${view.schema}"."${view.oldName}" RENAME TO "${view.name}"`;
|
||||
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async createView (params: antares.CreateViewParams) {
|
||||
const sql = `CREATE VIEW "${params.schema}"."${params.name}" AS ${params.sql}`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async createMaterializedView (params: antares.CreateViewParams) {
|
||||
const sql = `CREATE MATERIALIZED VIEW "${params.schema}"."${params.name}" AS ${params.sql}`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
async getTriggerInformations ({ schema, trigger }: { schema: string; trigger: string }) {
|
||||
const [table, triggerName] = trigger.split('.');
|
||||
|
||||
|
@@ -35,6 +35,10 @@ export class SQLiteClient extends BaseClient {
|
||||
});
|
||||
}
|
||||
|
||||
ping () {
|
||||
return this.select('1+1').run();
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this._connection.close();
|
||||
}
|
||||
|
@@ -336,7 +336,8 @@ CREATE TABLE \`${view.Name}\`(
|
||||
const connection = await this._client.getConnection();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const stream = (connection as any).connection.query(sql).stream();
|
||||
const dispose = () => connection.end();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const dispose = () => (connection as any).release();
|
||||
|
||||
stream.on('end', dispose);
|
||||
stream.on('error', dispose);
|
||||
|
@@ -39,115 +39,7 @@ SET row_security = off;\n\n\n`;
|
||||
}
|
||||
|
||||
async getCreateTable (tableName: string) {
|
||||
/* eslint-disable camelcase */
|
||||
interface SequenceRecord {
|
||||
sequence_catalog: string;
|
||||
sequence_schema: string;
|
||||
sequence_name: string;
|
||||
data_type: string;
|
||||
numeric_precision: number;
|
||||
numeric_precision_radix: number;
|
||||
numeric_scale: number;
|
||||
start_value: string;
|
||||
minimum_value: string;
|
||||
maximum_value: string;
|
||||
increment: string;
|
||||
cycle_option: string;
|
||||
}
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
let createSql = '';
|
||||
const sequences = [];
|
||||
const columnsSql = [];
|
||||
const arrayTypes: Record<string, string> = {
|
||||
_int2: 'smallint',
|
||||
_int4: 'integer',
|
||||
_int8: 'bigint',
|
||||
_float4: 'real',
|
||||
_float8: 'double precision',
|
||||
_char: '"char"',
|
||||
_varchar: 'character varying'
|
||||
};
|
||||
|
||||
// Table columns
|
||||
const { rows } = await this._client.raw(`
|
||||
SELECT *
|
||||
FROM "information_schema"."columns"
|
||||
WHERE "table_schema" = '${this.schemaName}'
|
||||
AND "table_name" = '${tableName}'
|
||||
ORDER BY "ordinal_position" ASC
|
||||
`, { schema: 'information_schema' });
|
||||
|
||||
if (!rows.length) return '';
|
||||
|
||||
for (const column of rows) {
|
||||
let fieldType = column.data_type;
|
||||
if (fieldType === 'USER-DEFINED') fieldType = `"${this.schemaName}".${column.udt_name}`;
|
||||
else if (fieldType === 'ARRAY') {
|
||||
if (Object.keys(arrayTypes).includes(fieldType))
|
||||
fieldType = arrayTypes[column.udt_name] + '[]';
|
||||
else
|
||||
fieldType = column.udt_name.replaceAll('_', '') + '[]';
|
||||
}
|
||||
|
||||
const columnArr = [
|
||||
`"${column.column_name}"`,
|
||||
`${fieldType}${column.character_maximum_length ? `(${column.character_maximum_length})` : ''}`
|
||||
];
|
||||
|
||||
if (column.column_default) {
|
||||
columnArr.push(`DEFAULT ${column.column_default}`);
|
||||
if (column.column_default.includes('nextval')) {
|
||||
const sequenceName = column.column_default.split('\'')[1];
|
||||
sequences.push(sequenceName);
|
||||
}
|
||||
}
|
||||
if (column.is_nullable === 'NO') columnArr.push('NOT NULL');
|
||||
|
||||
columnsSql.push(columnArr.join(' '));
|
||||
}
|
||||
|
||||
// Table sequences
|
||||
for (let sequence of sequences) {
|
||||
if (sequence.includes('.')) sequence = sequence.split('.')[1];
|
||||
|
||||
const { rows } = await this._client
|
||||
.select('*')
|
||||
.schema('information_schema')
|
||||
.from('sequences')
|
||||
.where({ sequence_schema: `= '${this.schemaName}'`, sequence_name: `= '${sequence}'` })
|
||||
.run<SequenceRecord>();
|
||||
|
||||
if (rows.length) {
|
||||
createSql += `CREATE SEQUENCE "${this.schemaName}"."${sequence}"
|
||||
START WITH ${rows[0].start_value}
|
||||
INCREMENT BY ${rows[0].increment}
|
||||
MINVALUE ${rows[0].minimum_value}
|
||||
MAXVALUE ${rows[0].maximum_value}
|
||||
CACHE 1;\n`;
|
||||
|
||||
// createSql += `\nALTER TABLE "${sequence}" OWNER TO ${this._client._params.user};\n\n`;
|
||||
}
|
||||
}
|
||||
|
||||
// Table create
|
||||
createSql += `\nCREATE TABLE "${this.schemaName}"."${tableName}"(
|
||||
${columnsSql.join(',\n ')}
|
||||
);\n`;
|
||||
|
||||
// createSql += `\nALTER TABLE "${tableName}" OWNER TO ${this._client._params.user};\n\n`;
|
||||
|
||||
// Table indexes
|
||||
createSql += '\n';
|
||||
const { rows: indexes } = await this._client
|
||||
.select('*')
|
||||
.schema('pg_catalog')
|
||||
.from('pg_indexes')
|
||||
.where({ schemaname: `= '${this.schemaName}'`, tablename: `= '${tableName}'` })
|
||||
.run<{indexdef: string}>();
|
||||
|
||||
for (const index of indexes)
|
||||
createSql += `${index.indexdef};\n`;
|
||||
const createSql = await this._client.getTableDll({ schema: this.schemaName, table: tableName });
|
||||
|
||||
// Table foreigns
|
||||
const { rows: foreigns } = await this._client.raw(`
|
||||
|
@@ -10,10 +10,8 @@
|
||||
:key="connection.uid"
|
||||
:connection="connection"
|
||||
/>
|
||||
<div class="connection-panel-wrapper p-relative">
|
||||
<WorkspaceAddConnectionPanel v-if="selectedWorkspace === 'NEW'" />
|
||||
</div>
|
||||
</div>
|
||||
<TheFooter />
|
||||
<TheNotificationsBoard />
|
||||
<TheScratchpad v-if="isScratchpad" />
|
||||
@@ -48,6 +46,8 @@ import { useSchemaExportStore } from '@/stores/schemaExport';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
import { useConsoleStore } from './stores/console';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const TheTitleBar = defineAsyncComponent(() => import(/* webpackChunkName: "TheTitleBar" */'@/components/TheTitleBar.vue'));
|
||||
@@ -80,6 +80,8 @@ const schemaExportStore = useSchemaExportStore();
|
||||
const { hideExportModal } = schemaExportStore;
|
||||
const { isExportModal: isExportSchemaModal } = storeToRefs(schemaExportStore);
|
||||
|
||||
const consoleStore = useConsoleStore();
|
||||
|
||||
const isAllConnectionsModal: Ref<boolean> = ref(false);
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
@@ -152,6 +154,60 @@ onMounted(() => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Console messages
|
||||
const oldLog = console.log;
|
||||
const oldWarn = console.warn;
|
||||
const oldInfo = console.info;
|
||||
const oldError = console.error;
|
||||
|
||||
console.log = function (...args) {
|
||||
consoleStore.putLog('debug', {
|
||||
level: 'log',
|
||||
process: 'renderer',
|
||||
message: args.join(' '),
|
||||
date: new Date()
|
||||
});
|
||||
oldLog.apply(this, args);
|
||||
};
|
||||
|
||||
console.info = function (...args) {
|
||||
consoleStore.putLog('debug', {
|
||||
level: 'info',
|
||||
process: 'renderer',
|
||||
message: args.join(' '),
|
||||
date: new Date()
|
||||
});
|
||||
oldInfo.apply(this, args);
|
||||
};
|
||||
|
||||
console.warn = function (...args) {
|
||||
consoleStore.putLog('debug', {
|
||||
level: 'warn',
|
||||
process: 'renderer',
|
||||
message: args.join(' '),
|
||||
date: new Date()
|
||||
});
|
||||
oldWarn.apply(this, args);
|
||||
};
|
||||
|
||||
console.error = function (...args) {
|
||||
consoleStore.putLog('debug', {
|
||||
level: 'error',
|
||||
process: 'renderer',
|
||||
message: args.join(' '),
|
||||
date: new Date()
|
||||
});
|
||||
oldError.apply(this, args);
|
||||
};
|
||||
|
||||
window.addEventListener('unhandledrejection', (event) => {
|
||||
console.error(event.reason);
|
||||
});
|
||||
|
||||
window.addEventListener('error', (event) => {
|
||||
console.error(event.error, '| File name:', event.filename.split('/').pop().split('?')[0]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@@ -1,11 +1,19 @@
|
||||
<template>
|
||||
<SvgIcon
|
||||
v-if="type === 'mdi'"
|
||||
:type="type"
|
||||
:path="iconPath"
|
||||
:size="size"
|
||||
:rotate="rotate"
|
||||
:class="iconFlip"
|
||||
/>
|
||||
<svg
|
||||
v-else
|
||||
:width="size"
|
||||
:height="size"
|
||||
:viewBox="`0 0 ${size} ${size}`"
|
||||
v-html="iconPath"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -13,6 +21,10 @@ import SvgIcon from '@jamescoyle/vue-icon';
|
||||
import * as Icons from '@mdi/js';
|
||||
import { computed, PropType } from 'vue';
|
||||
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
|
||||
const { getIconByUid } = useConnectionsStore();
|
||||
|
||||
const props = defineProps({
|
||||
iconName: {
|
||||
type: String,
|
||||
@@ -23,7 +35,7 @@ const props = defineProps({
|
||||
default: 48
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
type: String as PropType<'mdi' | 'custom'>,
|
||||
default: () => 'mdi'
|
||||
},
|
||||
flip: {
|
||||
@@ -37,7 +49,18 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const iconPath = computed(() => {
|
||||
if (props.type === 'mdi')
|
||||
return (Icons as {[k:string]: string})[props.iconName];
|
||||
else if (props.type === 'custom') {
|
||||
const base64 = getIconByUid(props.iconName)?.base64;
|
||||
const svgString = Buffer
|
||||
.from(base64, 'base64')
|
||||
.toString('utf-8')
|
||||
.replaceAll(/width="[^"]*"|height="[^"]*"/g, '');
|
||||
|
||||
return svgString;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
const iconFlip = computed(() => {
|
||||
|
@@ -99,7 +99,7 @@ onMounted(() => {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 5px 1px darken($body-font-color-dark, 40%);
|
||||
}
|
||||
|
@@ -365,7 +365,11 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
const handleWheelEvent = (e) => {
|
||||
try {
|
||||
if (!e.target.className.includes('select__')) deactivate();
|
||||
}
|
||||
catch (_) {
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
285
src/renderer/components/DebugConsole.vue
Normal file
285
src/renderer/components/DebugConsole.vue
Normal file
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<div
|
||||
ref="wrapper"
|
||||
class="console-wrapper"
|
||||
@mouseenter="isHover = true"
|
||||
@mouseleave="isHover = false"
|
||||
>
|
||||
<div ref="resizer" class="console-resizer" />
|
||||
<div
|
||||
id="console"
|
||||
ref="queryConsole"
|
||||
class="console column col-12"
|
||||
:style="{height: localHeight ? localHeight+'px' : ''}"
|
||||
>
|
||||
<div class="console-header">
|
||||
<ul class="tab tab-block">
|
||||
<li class="tab-item" :class="{'active': selectedTab === 'query'}">
|
||||
<a class="tab-link" @click="selectedTab = 'query'">{{ t('application.executedQueries') }}</a>
|
||||
</li>
|
||||
<li class="tab-item" :class="{'active': selectedTab === 'debug'}">
|
||||
<a class="tab-link" @click="selectedTab = 'debug'">{{ t('application.debugConsole') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
|
||||
</div>
|
||||
<div
|
||||
v-show="selectedTab === 'query'"
|
||||
ref="queryConsoleBody"
|
||||
class="console-body"
|
||||
>
|
||||
<div
|
||||
v-for="(wLog, i) in workspaceQueryLogs"
|
||||
:key="i"
|
||||
class="console-log"
|
||||
tabindex="0"
|
||||
@contextmenu.prevent="contextMenu($event, wLog)"
|
||||
>
|
||||
<span class="console-log-datetime">{{ moment(wLog.date).format('HH:mm:ss') }}</span>: <code class="console-log-sql" v-html="highlight(wLog.sql, {html: true})" />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-show="selectedTab === 'debug'"
|
||||
ref="logConsoleBody"
|
||||
class="console-body"
|
||||
>
|
||||
<div
|
||||
v-for="(log, i) in debugLogs"
|
||||
:key="i"
|
||||
class="console-log"
|
||||
tabindex="0"
|
||||
@contextmenu.prevent="contextMenu($event, log)"
|
||||
>
|
||||
<span class="console-log-datetime">{{ moment(log.date).format('HH:mm:ss') }}</span> <small>[{{ log.process.substring(0, 1).toUpperCase() }}]</small>: <span class="console-log-message" :class="`console-log-level-${log.level}`">{{ log.message }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BaseContextMenu
|
||||
v-if="isContext"
|
||||
:context-event="contextEvent"
|
||||
@close-context="isContext = false"
|
||||
>
|
||||
<div class="context-element" @click="copyLog">
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiContentCopy"
|
||||
:size="18"
|
||||
/> {{ t('general.copy') }}</span>
|
||||
</div>
|
||||
</BaseContextMenu>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as moment from 'moment';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { highlight } from 'sql-highlight';
|
||||
import { computed, nextTick, onMounted, Ref, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import { copyText } from '@/libs/copyText';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const consoleStore = useConsoleStore();
|
||||
|
||||
const { resizeConsole, getLogsByWorkspace } = consoleStore;
|
||||
const {
|
||||
isConsoleOpen,
|
||||
consoleHeight,
|
||||
selectedTab,
|
||||
debugLogs
|
||||
} = storeToRefs(consoleStore);
|
||||
|
||||
const props = defineProps({
|
||||
uid: {
|
||||
type: String,
|
||||
default: null,
|
||||
required: false
|
||||
}
|
||||
});
|
||||
|
||||
const wrapper: Ref<HTMLInputElement> = ref(null);
|
||||
const queryConsole: Ref<HTMLInputElement> = ref(null);
|
||||
const queryConsoleBody: Ref<HTMLInputElement> = ref(null);
|
||||
const logConsoleBody: Ref<HTMLInputElement> = ref(null);
|
||||
const resizer: Ref<HTMLInputElement> = ref(null);
|
||||
const localHeight = ref(consoleHeight.value);
|
||||
const isHover = ref(false);
|
||||
const isContext = ref(false);
|
||||
const contextContent: Ref<string> = ref(null);
|
||||
const contextEvent: Ref<MouseEvent> = ref(null);
|
||||
|
||||
const resize = (e: MouseEvent) => {
|
||||
const el = queryConsole.value;
|
||||
let elementHeight = el.getBoundingClientRect().bottom - e.pageY;
|
||||
if (elementHeight > 400) elementHeight = 400;
|
||||
localHeight.value = elementHeight;
|
||||
};
|
||||
|
||||
const workspaceQueryLogs = computed(() => {
|
||||
return getLogsByWorkspace(props.uid);
|
||||
});
|
||||
|
||||
const stopResize = () => {
|
||||
if (localHeight.value < 0) localHeight.value = 0;
|
||||
resizeConsole(localHeight.value);
|
||||
window.removeEventListener('mousemove', resize);
|
||||
window.removeEventListener('mouseup', stopResize);
|
||||
};
|
||||
|
||||
const contextMenu = (event: MouseEvent, wLog: {date: Date; sql?: string; message?: string}) => {
|
||||
contextEvent.value = event;
|
||||
contextContent.value = wLog.sql || wLog.message;
|
||||
isContext.value = true;
|
||||
};
|
||||
|
||||
const copyLog = () => {
|
||||
copyText(contextContent.value);
|
||||
isContext.value = false;
|
||||
};
|
||||
|
||||
watch(workspaceQueryLogs, async () => {
|
||||
if (!isHover.value) {
|
||||
await nextTick();
|
||||
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||
}
|
||||
});
|
||||
|
||||
watch(() => debugLogs.value.length, async () => {
|
||||
if (!isHover.value) {
|
||||
await nextTick();
|
||||
logConsoleBody.value.scrollTop = logConsoleBody.value.scrollHeight;
|
||||
}
|
||||
});
|
||||
|
||||
watch(isConsoleOpen, async () => {
|
||||
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||
logConsoleBody.value.scrollTop = logConsoleBody.value.scrollHeight;
|
||||
});
|
||||
|
||||
watch(selectedTab, async () => {
|
||||
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||
logConsoleBody.value.scrollTop = logConsoleBody.value.scrollHeight;
|
||||
});
|
||||
|
||||
watch(consoleHeight, async (val) => {
|
||||
await nextTick();
|
||||
localHeight.value = val;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||
logConsoleBody.value.scrollTop = logConsoleBody.value.scrollHeight;
|
||||
|
||||
resizer.value.addEventListener('mousedown', (e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
window.addEventListener('mousemove', resize);
|
||||
window.addEventListener('mouseup', stopResize);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.console-wrapper {
|
||||
width: -webkit-fill-available;
|
||||
z-index: 9;
|
||||
margin-top: auto;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
||||
.console-resizer {
|
||||
height: 4px;
|
||||
top: -1px;
|
||||
width: 100%;
|
||||
cursor: ns-resize;
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: var(--primary-color-dark);
|
||||
}
|
||||
}
|
||||
|
||||
.console {
|
||||
padding: 0;
|
||||
padding-bottom: $footer-height;
|
||||
|
||||
.console-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 4px;
|
||||
|
||||
.tab-block {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tab-block,
|
||||
.tab-item {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.tab-link {
|
||||
padding: 0.2rem 0.6rem;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.console-body {
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 100%;
|
||||
padding: 0 6px 3px;
|
||||
|
||||
.console-log {
|
||||
padding: 1px 3px;
|
||||
margin: 1px 0;
|
||||
border-radius: $border-radius;
|
||||
user-select: text;
|
||||
|
||||
&-datetime {
|
||||
opacity: .6;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
&-sql {
|
||||
font-size: 95%;
|
||||
opacity: 0.8;
|
||||
font-weight: 700;
|
||||
|
||||
&:hover {
|
||||
user-select: text;
|
||||
}
|
||||
}
|
||||
|
||||
&-message {
|
||||
font-size: 95%;
|
||||
}
|
||||
|
||||
&-level {
|
||||
// &-log,
|
||||
// &-info {}
|
||||
&-warn {
|
||||
color: orange;
|
||||
}
|
||||
&-error {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
small {
|
||||
opacity: .6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -57,8 +57,22 @@
|
||||
>
|
||||
<div class="panel">
|
||||
<div class="panel-header p-2 text-center p-relative">
|
||||
<figure class="avatar avatar-lg pt-1 mb-1">
|
||||
<i class="settingbar-element-icon dbi" :class="[`dbi-${connection.client}`]" />
|
||||
<figure class="avatar avatar-lg pt-1 mb-1 bg-dark">
|
||||
<div
|
||||
v-if="connection.icon"
|
||||
class="settingbar-connection-icon"
|
||||
>
|
||||
<BaseIcon
|
||||
:icon-name="camelize(connection.icon)"
|
||||
:type="connection.hasCustomIcon ? 'custom' : 'mdi'"
|
||||
:size="42"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="settingbar-element-icon dbi ml-1"
|
||||
:class="[`dbi-${connection.client}`]"
|
||||
/>
|
||||
</figure>
|
||||
<div class="panel-title h6 text-ellipsis">
|
||||
{{ getConnectionName(connection.uid) }}
|
||||
@@ -136,7 +150,19 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer text-center py-0">
|
||||
<div v-if="connection.ssl" class="chip bg-success mt-2">
|
||||
<div
|
||||
v-if="connection.folderName"
|
||||
class="chip mt-2 bg-dark"
|
||||
>
|
||||
<BaseIcon
|
||||
icon-name="mdiFolder"
|
||||
class="mr-1"
|
||||
:style="[connection.color ? `color: ${connection.color};`: '']"
|
||||
:size="18"
|
||||
/>
|
||||
{{ connection.folderName }}
|
||||
</div>
|
||||
<div v-if="connection.ssl" class="chip bg-dark mt-2">
|
||||
<BaseIcon
|
||||
icon-name="mdiShieldKey"
|
||||
class="mr-1"
|
||||
@@ -144,7 +170,7 @@
|
||||
/>
|
||||
SSL
|
||||
</div>
|
||||
<div v-if="connection.ssh" class="chip bg-success mt-2">
|
||||
<div v-if="connection.ssh" class="chip bg-dark mt-2">
|
||||
<BaseIcon
|
||||
icon-name="mdiConsoleNetwork"
|
||||
class="mr-1"
|
||||
@@ -152,7 +178,7 @@
|
||||
/>
|
||||
SSH
|
||||
</div>
|
||||
<div v-if="connection.readonly" class="chip bg-success mt-2">
|
||||
<div v-if="connection.readonly" class="chip bg-dark mt-2">
|
||||
<BaseIcon
|
||||
icon-name="mdiLock"
|
||||
class="mr-1"
|
||||
@@ -209,6 +235,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import ConfirmModal from '@/components/BaseConfirmModal.vue';
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import { useFocusTrap } from '@/composables/useFocusTrap';
|
||||
import { camelize } from '@/libs/camelize';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
@@ -218,7 +245,9 @@ const connectionsStore = useConnectionsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
|
||||
const { connections,
|
||||
lastConnections
|
||||
connectionsOrder,
|
||||
lastConnections,
|
||||
getFolders: folders
|
||||
} = storeToRefs(connectionsStore);
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
|
||||
@@ -236,7 +265,8 @@ const clients = new Map([
|
||||
['mysql', 'MySQL'],
|
||||
['maria', 'MariaDB'],
|
||||
['pg', 'PostgreSQL'],
|
||||
['sqlite', 'SQLite']
|
||||
['sqlite', 'SQLite'],
|
||||
['firebird', 'Firebird SQL']
|
||||
]);
|
||||
|
||||
const searchTerm = ref('');
|
||||
@@ -244,12 +274,20 @@ const isConfirmModal = ref(false);
|
||||
const connectionHover: Ref<string> = ref(null);
|
||||
const selectedConnection: Ref<ConnectionParams> = ref(null);
|
||||
|
||||
const sortedConnections = computed(() => {
|
||||
const remappedConnections = computed(() => {
|
||||
return connections.value
|
||||
.map(c => {
|
||||
const connTime = lastConnections.value.find((lc) => lc.uid === c.uid)?.time || 0;
|
||||
const connIcon = connectionsOrder.value.find((co) => co.uid === c.uid).icon;
|
||||
const connHasCustomIcon = connectionsOrder.value.find((co) => co.uid === c.uid).hasCustomIcon;
|
||||
const folder = folders.value.find(f => f.connections.includes(c.uid));
|
||||
|
||||
return {
|
||||
...c,
|
||||
icon: connIcon,
|
||||
color: folder?.color,
|
||||
folderName: folder?.name,
|
||||
hasCustomIcon: connHasCustomIcon,
|
||||
time: connTime
|
||||
};
|
||||
})
|
||||
@@ -261,7 +299,7 @@ const sortedConnections = computed(() => {
|
||||
});
|
||||
|
||||
const filteredConnections = computed(() => {
|
||||
return sortedConnections.value.filter(connection => {
|
||||
return remappedConnections.value.filter(connection => {
|
||||
return connection.name?.toLocaleLowerCase().includes(searchTerm.value.toLocaleLowerCase()) ||
|
||||
connection.host?.toLocaleLowerCase().includes(searchTerm.value.toLocaleLowerCase()) ||
|
||||
connection.database?.toLocaleLowerCase().includes(searchTerm.value.toLocaleLowerCase()) ||
|
||||
@@ -360,7 +398,7 @@ onBeforeUnmount(() => {
|
||||
outline: none;
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 3px 0.1rem rgba($primary-color, 80%);
|
||||
box-shadow: 0 0 3px 0.1rem rgba(var(--primary-color), 80%);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
|
@@ -49,18 +49,46 @@
|
||||
class="icon-box"
|
||||
:title="icon.name"
|
||||
:class="[{'selected': localConnection.icon === icon.code}]"
|
||||
@click="localConnection.icon = icon.code"
|
||||
@click="setIcon(icon.code)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="icon-box"
|
||||
:title="icon.name"
|
||||
:class="[`dbi dbi-${connection.client}`, {'selected': localConnection.icon === icon.code}]"
|
||||
@click="localConnection.icon = icon.code"
|
||||
:class="[`dbi dbi-${connection.client}`, {'selected': localConnection.icon === null}]"
|
||||
@click="setIcon(null)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-3">
|
||||
<label class="form-label">{{ t('application.customIcon') }}</label>
|
||||
</div>
|
||||
<div class="col-9 icons-wrapper">
|
||||
<div
|
||||
v-for="icon in customIcons"
|
||||
:key="icon.uid"
|
||||
>
|
||||
<BaseIcon
|
||||
v-if="icon.uid"
|
||||
:icon-name="icon.uid"
|
||||
type="custom"
|
||||
:size="36"
|
||||
class="icon-box"
|
||||
:class="[{'selected': localConnection.icon === icon.uid}]"
|
||||
@click="setIcon(icon.uid, 'custom')"
|
||||
@contextmenu.prevent="contextMenu($event, icon.uid)"
|
||||
/>
|
||||
</div>
|
||||
<BaseIcon
|
||||
:icon-name="'mdiPlus'"
|
||||
:size="36"
|
||||
class="icon-box"
|
||||
@click="openFile"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,20 +102,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BaseContextMenu
|
||||
v-if="isContext"
|
||||
:context-event="contextEvent"
|
||||
@close-context="isContext = false"
|
||||
>
|
||||
<div class="context-element" @click="removeIconHandler">
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiDelete"
|
||||
:size="18"
|
||||
/> {{ t('general.delete') }}</span>
|
||||
</div>
|
||||
</BaseContextMenu>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onBeforeUnmount, PropType, Ref, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import { useFocusTrap } from '@/composables/useFocusTrap';
|
||||
import Application from '@/ipc-api/Application';
|
||||
import { camelize } from '@/libs/camelize';
|
||||
import { unproxify } from '@/libs/unproxify';
|
||||
import { SidebarElement, useConnectionsStore } from '@/stores/connections';
|
||||
|
||||
const connectionsStore = useConnectionsStore();
|
||||
|
||||
const { addIcon, removeIcon, updateConnectionOrder, getConnectionName } = connectionsStore;
|
||||
const { customIcons } = storeToRefs(connectionsStore);
|
||||
|
||||
const isContext = ref(false);
|
||||
const contextContent: Ref<string> = ref(null);
|
||||
const contextEvent: Ref<MouseEvent> = ref(null);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps({
|
||||
@@ -99,8 +152,6 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['close']);
|
||||
|
||||
const { updateConnectionOrder, getConnectionName } = connectionsStore;
|
||||
|
||||
const icons = [
|
||||
{ name: 'default', code: null },
|
||||
|
||||
@@ -160,14 +211,33 @@ const editFolderAppearance = () => {
|
||||
closeModal();
|
||||
};
|
||||
|
||||
const camelize = (text: string) => {
|
||||
const textArr = text.split('-');
|
||||
for (let i = 0; i < textArr.length; i++) {
|
||||
if (i === 0) continue;
|
||||
textArr[i] = textArr[i].charAt(0).toUpperCase() + textArr[i].slice(1);
|
||||
}
|
||||
const setIcon = (code: string, type?: 'mdi' | 'custom') => {
|
||||
localConnection.value.icon = code;
|
||||
localConnection.value.hasCustomIcon = type === 'custom';
|
||||
};
|
||||
|
||||
return textArr.join('');
|
||||
const removeIconHandler = () => {
|
||||
if (localConnection.value.icon === contextContent.value) {
|
||||
setIcon(null);
|
||||
updateConnectionOrder(localConnection.value);
|
||||
}
|
||||
removeIcon(contextContent.value);
|
||||
isContext.value = false;
|
||||
};
|
||||
|
||||
const openFile = async () => {
|
||||
const result = await Application.showOpenDialog({ properties: ['openFile'], filters: [{ name: '"SVG"', extensions: ['svg'] }] });
|
||||
if (result && !result.canceled) {
|
||||
const file = result.filePaths[0];
|
||||
const content = await Application.readFile({ filePath: file, encoding: 'base64url' });
|
||||
addIcon(content);
|
||||
}
|
||||
};
|
||||
|
||||
const contextMenu = (event: MouseEvent, iconUid: string) => {
|
||||
contextEvent.value = event;
|
||||
contextContent.value = iconUid;
|
||||
isContext.value = true;
|
||||
};
|
||||
|
||||
const closeModal = () => emit('close');
|
||||
@@ -204,7 +274,7 @@ onBeforeUnmount(() => {
|
||||
cursor: pointer;
|
||||
|
||||
&.selected {
|
||||
outline: 2px solid $primary-color;
|
||||
outline: 2px solid var(--primary-color);
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
@@ -282,7 +282,7 @@
|
||||
import { ClientCode, SchemaInfos } from 'common/interfaces/antares';
|
||||
import { Customizations } from 'common/interfaces/customizations';
|
||||
import { ExportOptions, ExportState } from 'common/interfaces/exporter';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
||||
import * as moment from 'moment';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, onBeforeUnmount, Ref, ref } from 'vue';
|
||||
@@ -293,6 +293,7 @@ import BaseSelect from '@/components/BaseSelect.vue';
|
||||
import { useFocusTrap } from '@/composables/useFocusTrap';
|
||||
import Application from '@/ipc-api/Application';
|
||||
import Schema from '@/ipc-api/Schema';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useSchemaExportStore } from '@/stores/schemaExport';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
@@ -379,21 +380,34 @@ const startExport = async () => {
|
||||
|
||||
try {
|
||||
const { status, response } = await Schema.export(params);
|
||||
|
||||
if (status === 'success')
|
||||
progressStatus.value = response.cancelled ? t('general.aborted') : t('general.completed');
|
||||
else {
|
||||
progressStatus.value = response;
|
||||
addNotification({ status: 'error', message: response });
|
||||
useConsoleStore().putLog('debug', {
|
||||
level: 'error',
|
||||
process: 'worker',
|
||||
message: response,
|
||||
date: new Date()
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
addNotification({ status: 'error', message: err.stack });
|
||||
useConsoleStore().putLog('debug', {
|
||||
level: 'error',
|
||||
process: 'worker',
|
||||
message: err.stack,
|
||||
date: new Date()
|
||||
});
|
||||
}
|
||||
|
||||
isExporting.value = false;
|
||||
};
|
||||
|
||||
const updateProgress = (event: Event, state: ExportState) => {
|
||||
const updateProgress = (event: IpcRendererEvent, state: ExportState) => {
|
||||
progressPercentage.value = Number((state.currentItemIndex / state.totalItems * 100).toFixed(1));
|
||||
switch (state.op) {
|
||||
case 'PROCESSING':
|
||||
|
@@ -75,7 +75,7 @@
|
||||
<code
|
||||
class="cut-text"
|
||||
:title="query.sql"
|
||||
v-html="highlight(highlightWord(query.sql), {html: true})"
|
||||
v-html="highlight(query.sql, {html: true})"
|
||||
/>
|
||||
</div>
|
||||
<div class="tile-bottom-content">
|
||||
@@ -210,17 +210,6 @@ const resizeResults = () => {
|
||||
const refreshScroller = () => resizeResults();
|
||||
const closeModal = () => emit('close');
|
||||
|
||||
const highlightWord = (string: string) => {
|
||||
string = string.replaceAll('<', '<').replaceAll('>', '>');
|
||||
|
||||
if (searchTerm.value) {
|
||||
const regexp = new RegExp(`(${searchTerm.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'gi');
|
||||
return string.replace(regexp, '<span class="text-primary text-bold">$1</span>');
|
||||
}
|
||||
else
|
||||
return string;
|
||||
};
|
||||
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
if (e.key === 'Escape')
|
||||
@@ -287,7 +276,7 @@ onBeforeUnmount(() => {
|
||||
max-width: 100%;
|
||||
display: inline-block;
|
||||
font-size: 100%;
|
||||
// color: $primary-color;
|
||||
// color: var(--primary-color);
|
||||
opacity: 0.8;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ImportState } from 'common/interfaces/importer';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
||||
import * as moment from 'moment';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, onBeforeUnmount, Ref, ref } from 'vue';
|
||||
@@ -63,6 +63,7 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import Schema from '@/ipc-api/Schema';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
@@ -118,23 +119,35 @@ const startImport = async (file: string) => {
|
||||
else {
|
||||
progressStatus.value = response;
|
||||
addNotification({ status: 'error', message: response });
|
||||
useConsoleStore().putLog('debug', {
|
||||
level: 'error',
|
||||
process: 'worker',
|
||||
message: response,
|
||||
date: new Date()
|
||||
});
|
||||
}
|
||||
refreshSchema({ uid, schema: props.selectedSchema });
|
||||
completed.value = true;
|
||||
}
|
||||
catch (err) {
|
||||
addNotification({ status: 'error', message: err.stack });
|
||||
useConsoleStore().putLog('debug', {
|
||||
level: 'error',
|
||||
process: 'worker',
|
||||
message: err.stack,
|
||||
date: new Date()
|
||||
});
|
||||
}
|
||||
|
||||
isImporting.value = false;
|
||||
};
|
||||
|
||||
const updateProgress = (event: Event, state: ImportState) => {
|
||||
const updateProgress = (event: IpcRendererEvent, state: ImportState) => {
|
||||
progressPercentage.value = parseFloat(Number(state.percentage).toFixed(1));
|
||||
queryCount.value = Number(state.queryCount);
|
||||
};
|
||||
|
||||
const handleQueryError = (event: Event, err: { time: string; message: string }) => {
|
||||
const handleQueryError = (event: IpcRendererEvent, err: { time: string; message: string }) => {
|
||||
queryErrors.value.push(err);
|
||||
};
|
||||
|
||||
|
@@ -703,7 +703,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
&.selected {
|
||||
img {
|
||||
box-shadow: 0 0 0 3px $primary-color;
|
||||
box-shadow: 0 0 0 3px var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,7 +731,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
.badge-update::after {
|
||||
bottom: initial;
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
|
||||
.form-label {
|
||||
|
@@ -169,7 +169,7 @@ const emit = defineEmits(['close']);
|
||||
const { trapRef } = useFocusTrap();
|
||||
|
||||
const { getConnectionName } = useConnectionsStore();
|
||||
const { connectionsOrder, connections } = storeToRefs(useConnectionsStore());
|
||||
const { connectionsOrder, connections, customIcons } = storeToRefs(useConnectionsStore());
|
||||
const localConnections = unproxify<ConnectionParams[]>(connections.value);
|
||||
const localConnectionsOrder = unproxify<SidebarElement[]>(connectionsOrder.value);
|
||||
|
||||
@@ -246,7 +246,8 @@ const exportData = () => {
|
||||
|
||||
const exportObj = encrypt(JSON.stringify({
|
||||
connections: filteredConnections,
|
||||
connectionsOrder: filteredOrders
|
||||
connectionsOrder: filteredOrders,
|
||||
customIcons: customIcons.value
|
||||
}), options.value.passkey);
|
||||
|
||||
// console.log(exportObj, JSON.parse(decrypt(exportObj, options.value.passkey)));
|
||||
|
@@ -103,7 +103,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import BaseUploadInput from '@/components/BaseUploadInput.vue';
|
||||
import { unproxify } from '@/libs/unproxify';
|
||||
import { SidebarElement, useConnectionsStore } from '@/stores/connections';
|
||||
import { CustomIcon, SidebarElement, useConnectionsStore } from '@/stores/connections';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -156,6 +156,7 @@ const importData = () => {
|
||||
const importObj: {
|
||||
connections: ConnectionParams[];
|
||||
connectionsOrder: SidebarElement[];
|
||||
customIcons: CustomIcon[];
|
||||
} = JSON.parse(decrypt(hash, options.value.passkey));
|
||||
|
||||
if (options.value.ignoreDuplicates) {
|
||||
@@ -205,7 +206,6 @@ const importData = () => {
|
||||
.includes(c.uid) ||
|
||||
(c.isFolder && c.connections.every(c => newConnectionsUid.includes(c))));
|
||||
}
|
||||
|
||||
importConnections(importObj);
|
||||
|
||||
addNotification({
|
||||
@@ -215,6 +215,7 @@ const importData = () => {
|
||||
closeModal();
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
addNotification({
|
||||
status: 'error',
|
||||
message: t('application.wrongImportPassword')
|
||||
@@ -222,6 +223,7 @@ const importData = () => {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
addNotification({
|
||||
status: 'error',
|
||||
message: t('application.wrongFileFormat')
|
||||
|
@@ -341,7 +341,7 @@ onMounted(() => {
|
||||
lastTableFields.value = res.response.map((field: { name: string }) => field.name);
|
||||
editor.value.completers = [tableFieldsCompleter.value];
|
||||
editor.value.execCommand('startAutocomplete');
|
||||
}).catch(console.log);
|
||||
}).catch(console.error);
|
||||
}
|
||||
else
|
||||
editor.value.completers = customCompleter.value;
|
||||
@@ -409,7 +409,7 @@ defineExpose({ editor });
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
top: 2px;
|
||||
color: $primary-color;
|
||||
color: var(--primary-color);
|
||||
display: inline-block;
|
||||
font: normal normal normal 24px/1 "Material Design Icons", sans-serif;
|
||||
font-size: inherit;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<div class="tile-icon">
|
||||
<BaseIcon
|
||||
:icon-name="note.type === 'query'
|
||||
? 'mdiStarOutline'
|
||||
? 'mdiHeartOutline'
|
||||
: note.type === 'todo'
|
||||
? note.isArchived
|
||||
? 'mdiCheckboxMarkedOutline'
|
||||
@@ -32,7 +32,7 @@
|
||||
v-if="note.type === 'query'"
|
||||
ref="noteParagraph"
|
||||
class="tile-paragraph sql"
|
||||
v-html="highlight(highlightWord(note.note), {html: true})"
|
||||
v-html="highlight(note.note, {html: true})"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
|
@@ -56,6 +56,7 @@
|
||||
>
|
||||
<BaseIcon
|
||||
:icon-name="camelize(element.icon)"
|
||||
:type="element.hasCustomIcon ? 'custom' : 'mdi'"
|
||||
:size="36"
|
||||
/>
|
||||
</div>
|
||||
@@ -93,6 +94,7 @@ import * as Draggable from 'vuedraggable';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import SettingBarConnectionsFolder from '@/components/SettingBarConnectionsFolder.vue';
|
||||
import { camelize } from '@/libs/camelize';
|
||||
import { SidebarElement, useConnectionsStore } from '@/stores/connections';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
@@ -165,16 +167,6 @@ const getStatusBadge = (uid: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
const camelize = (text: string) => {
|
||||
const textArr = text.split('-');
|
||||
for (let i = 0; i < textArr.length; i++) {
|
||||
if (i === 0) continue;
|
||||
textArr[i] = textArr[i].charAt(0).toUpperCase() + textArr[i].slice(1);
|
||||
}
|
||||
|
||||
return textArr.join('');
|
||||
};
|
||||
|
||||
watch(() => dummyNested.value.length, () => {
|
||||
dummyNested.value = [];
|
||||
});
|
||||
|
@@ -70,6 +70,7 @@
|
||||
>
|
||||
<BaseIcon
|
||||
:icon-name="camelize(getConnectionOrderByUid(element).icon)"
|
||||
:type="getConnectionOrderByUid(element).hasCustomIcon ? 'custom' : 'mdi'"
|
||||
:size="36"
|
||||
/>
|
||||
</div>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div
|
||||
id="footer"
|
||||
:class="[lightColors.includes(footerColor) ? 'text-dark' : 'text-light']"
|
||||
:style="`background-color: ${footerColor};`"
|
||||
:class="[lightColors.includes(accentColor) ? 'text-dark' : 'text-light']"
|
||||
:style="`background-color: ${accentColor};`"
|
||||
>
|
||||
<div class="footer-left-elements">
|
||||
<ul class="footer-elements">
|
||||
@@ -43,11 +43,7 @@
|
||||
|
||||
<div class="footer-right-elements">
|
||||
<ul class="footer-elements">
|
||||
<li
|
||||
v-if="workspace?.connectionStatus === 'connected'"
|
||||
class="footer-element footer-link"
|
||||
@click="toggleConsole()"
|
||||
>
|
||||
<li class="footer-element footer-link" @click="toggleConsole()">
|
||||
<BaseIcon
|
||||
icon-name="mdiConsoleLine"
|
||||
class="mr-1"
|
||||
@@ -85,10 +81,11 @@
|
||||
<script setup lang="ts">
|
||||
import { shell } from 'electron';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, ComputedRef } from 'vue';
|
||||
import { computed, ComputedRef, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import { hexToRGBA } from '@/libs/hexToRgba';
|
||||
import { useApplicationStore } from '@/stores/application';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
@@ -117,7 +114,11 @@ const { getWorkspace } = workspacesStore;
|
||||
const { getConnectionFolder, getConnectionByUid } = connectionsStore;
|
||||
|
||||
const workspace = computed(() => getWorkspace(workspaceUid.value));
|
||||
const footerColor = computed(() => getConnectionFolder(workspaceUid.value)?.color || '#E36929');
|
||||
const accentColor = computed(() => {
|
||||
if (getConnectionFolder(workspaceUid.value)?.color)
|
||||
return getConnectionFolder(workspaceUid.value).color;
|
||||
return '#E36929';
|
||||
});
|
||||
const connectionInfos = computed(() => getConnectionByUid(workspaceUid.value));
|
||||
const version: ComputedRef<DatabaseInfos> = computed(() => {
|
||||
return getWorkspace(workspaceUid.value) ? workspace.value.version : null;
|
||||
@@ -129,7 +130,17 @@ const versionString = computed(() => {
|
||||
return '';
|
||||
});
|
||||
|
||||
watch(accentColor, () => {
|
||||
changeAccentColor();
|
||||
});
|
||||
|
||||
const openOutside = (link: string) => shell.openExternal(link);
|
||||
const changeAccentColor = () => {
|
||||
document.querySelector<HTMLBodyElement>(':root').style.setProperty('--primary-color', accentColor.value);
|
||||
document.querySelector<HTMLBodyElement>(':root').style.setProperty('--primary-color-shadow', hexToRGBA(accentColor.value, 0.2));
|
||||
};
|
||||
|
||||
changeAccentColor();
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@@ -233,6 +233,7 @@ if (!connectionsArr.value.length)
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
|
@@ -15,7 +15,8 @@
|
||||
:connection="connection"
|
||||
:is-selected="isSelected"
|
||||
/>
|
||||
<div v-if="workspace?.connectionStatus === 'connected'" class="workspace-tabs column columns col-gapless">
|
||||
<div class="workspace-tabs column">
|
||||
<div v-if="workspace?.connectionStatus === 'connected'" class="columns col-gapless">
|
||||
<Draggable
|
||||
ref="tabWrap"
|
||||
v-model="draggableTabs"
|
||||
@@ -42,11 +43,11 @@
|
||||
>
|
||||
<BaseIcon
|
||||
class="mt-1 mr-1"
|
||||
icon-name="mdiCodeTags"
|
||||
:icon-name="element.filePath ? 'mdiFileCodeOutline' : 'mdiCodeTags'"
|
||||
:size="18"
|
||||
/>
|
||||
<span>
|
||||
<span>{{ cutText(element.content || 'Query', 20, true) }} #{{ element.index }}</span>
|
||||
<span>{{ cutText(element.elementName || element.content || 'Query', 20, true) }} #{{ element.index }}</span>
|
||||
<span
|
||||
class="btn btn-clear"
|
||||
:title="t('general.close')"
|
||||
@@ -63,7 +64,7 @@
|
||||
>
|
||||
<BaseIcon
|
||||
class="mt-1 mr-1"
|
||||
:icon-name="element.elementType === 'view' ? 'mdiTableEye' : 'mdiTable'"
|
||||
:icon-name="['view', 'materializedview'].includes(element.elementType) ? 'mdiTableEye' : 'mdiTable'"
|
||||
:size="18"
|
||||
/>
|
||||
<span :title="`${t('general.data').toUpperCase()}: ${t(`database.${element.elementType}`)}`">
|
||||
@@ -80,7 +81,7 @@
|
||||
<a v-else-if="element.type === 'data'" class="tab-link">
|
||||
<BaseIcon
|
||||
class="mt-1 mr-1"
|
||||
:icon-name="element.elementType === 'view' ? 'mdiTableEye' : 'mdiTable'"
|
||||
:icon-name="['view', 'materializedview'].includes(element.elementType) ? 'mdiTableEye' : 'mdiTable'"
|
||||
:size="18"
|
||||
/>
|
||||
<span :title="`${t('general.data').toUpperCase()}: ${t(`database.${element.elementType}`)}`">
|
||||
@@ -157,6 +158,27 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
v-else-if="element.type === 'materialized-view-props'"
|
||||
class="tab-link"
|
||||
:class="{'badge': element.isChanged}"
|
||||
>
|
||||
<BaseIcon
|
||||
class="mr-1"
|
||||
icon-name="mdiWrenchCog"
|
||||
:size="18"
|
||||
/>
|
||||
<span :title="`${t('application.settings').toUpperCase()}: ${t(`database.view`)}`">
|
||||
{{ cutText(element.elementName, 20, true) }}
|
||||
<span
|
||||
class="btn btn-clear"
|
||||
:title="t('general.close')"
|
||||
@mousedown.left.stop
|
||||
@click.stop="closeTab(element)"
|
||||
/>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
v-else-if="element.type === 'new-view'"
|
||||
class="tab-link"
|
||||
@@ -178,6 +200,27 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
v-else-if="element.type === 'new-materialized-view'"
|
||||
class="tab-link"
|
||||
:class="{'badge': element.isChanged}"
|
||||
>
|
||||
<BaseIcon
|
||||
class="mr-1"
|
||||
icon-name="mdiShapeSquarePlus"
|
||||
:size="18"
|
||||
/>
|
||||
<span :title="`${t('general.new').toUpperCase()}: ${t(`database.${element.elementType}`)}`">
|
||||
{{ t('database.newMaterializedView') }}
|
||||
<span
|
||||
class="btn btn-clear"
|
||||
:title="t('general.close')"
|
||||
@mousedown.left.stop
|
||||
@click.stop="closeTab(element)"
|
||||
/>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
v-else-if="element.type === 'new-trigger'"
|
||||
class="tab-link"
|
||||
@@ -446,6 +489,14 @@
|
||||
:is-selected="selectedTab === tab.uid && isSelected"
|
||||
:schema="tab.schema"
|
||||
/>
|
||||
<WorkspaceTabNewMaterializedView
|
||||
v-else-if="tab.type === 'new-materialized-view'"
|
||||
:tab-uid="tab.uid"
|
||||
:tab="tab"
|
||||
:connection="connection"
|
||||
:is-selected="selectedTab === tab.uid && isSelected"
|
||||
:schema="tab.schema"
|
||||
/>
|
||||
<WorkspaceTabPropsView
|
||||
v-else-if="tab.type === 'view-props'"
|
||||
:tab-uid="tab.uid"
|
||||
@@ -454,6 +505,14 @@
|
||||
:view="tab.elementName"
|
||||
:schema="tab.schema"
|
||||
/>
|
||||
<WorkspaceTabPropsMaterializedView
|
||||
v-else-if="tab.type === 'materialized-view-props'"
|
||||
:tab-uid="tab.uid"
|
||||
:is-selected="selectedTab === tab.uid && isSelected"
|
||||
:connection="connection"
|
||||
:view="tab.elementName"
|
||||
:schema="tab.schema"
|
||||
/>
|
||||
<WorkspaceTabNewTrigger
|
||||
v-else-if="tab.type === 'new-trigger'"
|
||||
:tab-uid="tab.uid"
|
||||
@@ -540,11 +599,12 @@
|
||||
:schema="tab.schema"
|
||||
/>
|
||||
</template>
|
||||
<WorkspaceQueryConsole v-if="isConsoleOpen(workspace.uid)" :uid="workspace.uid" />
|
||||
</div>
|
||||
<div v-else class="connection-panel-wrapper p-relative">
|
||||
<WorkspaceEditConnectionPanel :connection="connection" />
|
||||
</div>
|
||||
<DebugConsole v-if="isConsoleOpen" :uid="workspace.uid" />
|
||||
</div>
|
||||
<ModalProcessesList
|
||||
v-if="isProcessesModal"
|
||||
:connection="connection"
|
||||
@@ -568,12 +628,12 @@ import { useI18n } from 'vue-i18n';
|
||||
import * as Draggable from 'vuedraggable';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import DebugConsole from '@/components/DebugConsole.vue';
|
||||
import ModalDiscardChanges from '@/components/ModalDiscardChanges.vue';
|
||||
import ModalProcessesList from '@/components/ModalProcessesList.vue';
|
||||
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel.vue';
|
||||
import WorkspaceEmptyState from '@/components/WorkspaceEmptyState.vue';
|
||||
import WorkspaceExploreBar from '@/components/WorkspaceExploreBar.vue';
|
||||
import WorkspaceQueryConsole from '@/components/WorkspaceQueryConsole.vue';
|
||||
import WorkspaceTabNewFunction from '@/components/WorkspaceTabNewFunction.vue';
|
||||
import WorkspaceTabNewRoutine from '@/components/WorkspaceTabNewRoutine.vue';
|
||||
import WorkspaceTabNewScheduler from '@/components/WorkspaceTabNewScheduler.vue';
|
||||
@@ -596,6 +656,9 @@ import Connection from '@/ipc-api/Connection';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
import { useWorkspacesStore, WorkspaceTab } from '@/stores/workspaces';
|
||||
|
||||
import WorkspaceTabNewMaterializedView from './WorkspaceTabNewMaterializedView.vue';
|
||||
import WorkspaceTabPropsMaterializedView from './WorkspaceTabPropsMaterializedView.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const { cutText } = useFilters();
|
||||
@@ -638,7 +701,6 @@ const draggableTabs = computed<WorkspaceTab[]>({
|
||||
get () {
|
||||
if (workspace.value.customizations.database)
|
||||
return workspace.value.tabs.filter(tab => tab.type === 'query' || tab.database === workspace.value.database);
|
||||
|
||||
else
|
||||
return workspace.value.tabs;
|
||||
},
|
||||
@@ -689,6 +751,7 @@ const openAsPermanentTab = (tab: WorkspaceTab) => {
|
||||
const permanentTabs = {
|
||||
table: 'data',
|
||||
view: 'data',
|
||||
materializedView: 'data',
|
||||
trigger: 'trigger-props',
|
||||
triggerFunction: 'trigger-function-props',
|
||||
function: 'function-props',
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<div class="connection-panel-wrapper p-relative">
|
||||
<div class="connection-panel">
|
||||
<div class="panel">
|
||||
<div class="panel-nav">
|
||||
@@ -385,7 +386,21 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<div
|
||||
@mouseenter="setCancelTestButtonVisibility(true)"
|
||||
@mouseleave="setCancelTestButtonVisibility(false)"
|
||||
>
|
||||
<button
|
||||
v-if="showTestCancel && isTesting"
|
||||
class="btn btn-gray mr-2 cancellable"
|
||||
:title="t('general.cancel')"
|
||||
@click="abortConnection()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiWindowClose" :size="24" />
|
||||
<span class="d-invisible pr-1">{{ t('connection.testConnection') }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
id="connection-test"
|
||||
class="btn btn-gray mr-2 d-flex"
|
||||
:class="{'loading': isTesting}"
|
||||
@@ -399,6 +414,7 @@
|
||||
/>
|
||||
{{ t('connection.testConnection') }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
id="connection-save"
|
||||
class="btn btn-primary mr-2 d-flex"
|
||||
@@ -420,21 +436,26 @@
|
||||
@credentials="continueTest"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<DebugConsole v-if="isConsoleOpen" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import customizations from 'common/customizations';
|
||||
import { ConnectionParams } from 'common/interfaces/antares';
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, Ref, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import BaseSelect from '@/components/BaseSelect.vue';
|
||||
import BaseUploadInput from '@/components/BaseUploadInput.vue';
|
||||
import DebugConsole from '@/components/DebugConsole.vue';
|
||||
import ModalAskCredentials from '@/components/ModalAskCredentials.vue';
|
||||
import Connection from '@/ipc-api/Connection';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
@@ -443,6 +464,7 @@ const { t } = useI18n();
|
||||
const { addConnection } = useConnectionsStore();
|
||||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { isConsoleOpen } = storeToRefs(useConsoleStore());
|
||||
|
||||
const { connectWorkspace, selectWorkspace } = workspacesStore;
|
||||
|
||||
@@ -487,6 +509,8 @@ const firstInput: Ref<HTMLInputElement> = ref(null);
|
||||
const isConnecting = ref(false);
|
||||
const isTesting = ref(false);
|
||||
const isAsking = ref(false);
|
||||
const showTestCancel = ref(false);
|
||||
const abortController: Ref<AbortController> = ref(new AbortController());
|
||||
const selectedTab = ref('general');
|
||||
|
||||
const clientCustomizations = computed(() => {
|
||||
@@ -509,6 +533,10 @@ const setDefaults = () => {
|
||||
connection.value.database = clientCustomizations.value.defaultDatabase;
|
||||
};
|
||||
|
||||
const setCancelTestButtonVisibility = (val: boolean) => {
|
||||
showTestCancel.value = val;
|
||||
};
|
||||
|
||||
const startTest = async () => {
|
||||
isTesting.value = true;
|
||||
|
||||
@@ -519,7 +547,7 @@ const startTest = async () => {
|
||||
const res = await Connection.makeTest(connection.value);
|
||||
if (res.status === 'error')
|
||||
addNotification({ status: 'error', message: res.response.message || res.response.toString() });
|
||||
else
|
||||
else if (res.status === 'success')
|
||||
addNotification({ status: 'success', message: t('connection.connectionSuccessfullyMade') });
|
||||
}
|
||||
catch (err) {
|
||||
@@ -530,13 +558,21 @@ const startTest = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const abortConnection = (): void => {
|
||||
abortController.value.abort();
|
||||
Connection.abortConnection(connection.value.uid);
|
||||
isTesting.value = false;
|
||||
isConnecting.value = false;
|
||||
abortController.value = new AbortController();
|
||||
};
|
||||
|
||||
const continueTest = async (credentials: { user: string; password: string }) => { // if "Ask for credentials" is true
|
||||
isAsking.value = false;
|
||||
const params = Object.assign({}, connection.value, credentials);
|
||||
|
||||
try {
|
||||
if (isConnecting.value) {
|
||||
await connectWorkspace(params);
|
||||
await connectWorkspace(params, { signal: abortController.value.signal }).catch(() => undefined);
|
||||
isConnecting.value = false;
|
||||
}
|
||||
else {
|
||||
|
@@ -387,7 +387,21 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<div
|
||||
@mouseenter="setCancelTestButtonVisibility(true)"
|
||||
@mouseleave="setCancelTestButtonVisibility(false)"
|
||||
>
|
||||
<button
|
||||
v-if="showTestCancel && isTesting"
|
||||
class="btn btn-gray mr-2 cancellable"
|
||||
:title="t('general.cancel')"
|
||||
@click="abortConnection()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiWindowClose" :size="24" />
|
||||
<span class="d-invisible pr-1">{{ t('connection.testConnection') }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
id="connection-test"
|
||||
class="btn btn-gray mr-2 d-flex"
|
||||
:class="{'loading': isTesting}"
|
||||
@@ -401,6 +415,7 @@
|
||||
/>
|
||||
{{ t('connection.testConnection') }}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
id="connection-save"
|
||||
class="btn btn-primary mr-2 d-flex"
|
||||
@@ -414,7 +429,21 @@
|
||||
/>
|
||||
{{ t('general.save') }}
|
||||
</button>
|
||||
<div
|
||||
@mouseenter="setCancelConnectButtonVisibility(true)"
|
||||
@mouseleave="setCancelConnectButtonVisibility(false)"
|
||||
>
|
||||
<button
|
||||
v-if="showConnectCancel && isConnecting"
|
||||
class="btn btn-success cancellable"
|
||||
:title="t('general.cancel')"
|
||||
@click="abortConnection()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiWindowClose" :size="24" />
|
||||
<span class="d-invisible pr-1">{{ t('connection.connect') }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
id="connection-connect"
|
||||
class="btn btn-success d-flex"
|
||||
:class="{'loading': isConnecting}"
|
||||
@@ -430,6 +459,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ModalAskCredentials
|
||||
v-if="isAsking"
|
||||
@close-asking="closeAsking"
|
||||
@@ -476,6 +506,9 @@ const localConnection: Ref<ConnectionParams & { pgConnString: string }> = ref(nu
|
||||
const isConnecting = ref(false);
|
||||
const isTesting = ref(false);
|
||||
const isAsking = ref(false);
|
||||
const showTestCancel = ref(false);
|
||||
const showConnectCancel = ref(false);
|
||||
const abortController: Ref<AbortController> = ref(new AbortController());
|
||||
const selectedTab = ref('general');
|
||||
|
||||
const clientCustomizations = computed(() => {
|
||||
@@ -501,7 +534,7 @@ const startConnection = async () => {
|
||||
if (localConnection.value.ask)
|
||||
isAsking.value = true;
|
||||
else {
|
||||
await connectWorkspace(localConnection.value);
|
||||
await connectWorkspace(localConnection.value, { signal: abortController.value.signal }).catch(() => undefined);
|
||||
isConnecting.value = false;
|
||||
}
|
||||
};
|
||||
@@ -516,7 +549,7 @@ const startTest = async () => {
|
||||
const res = await Connection.makeTest(localConnection.value);
|
||||
if (res.status === 'error')
|
||||
addNotification({ status: 'error', message: res.response.message || res.response.toString() });
|
||||
else
|
||||
else if (res.status === 'success')
|
||||
addNotification({ status: 'success', message: t('connection.connectionSuccessfullyMade') });
|
||||
}
|
||||
catch (err) {
|
||||
@@ -527,20 +560,36 @@ const startTest = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const setCancelTestButtonVisibility = (val: boolean) => {
|
||||
showTestCancel.value = val;
|
||||
};
|
||||
|
||||
const setCancelConnectButtonVisibility = (val: boolean) => {
|
||||
showConnectCancel.value = val;
|
||||
};
|
||||
|
||||
const abortConnection = (): void => {
|
||||
abortController.value.abort();
|
||||
Connection.abortConnection(localConnection.value.uid);
|
||||
isTesting.value = false;
|
||||
isConnecting.value = false;
|
||||
abortController.value = new AbortController();
|
||||
};
|
||||
|
||||
const continueTest = async (credentials: {user: string; password: string }) => { // if "Ask for credentials" is true
|
||||
isAsking.value = false;
|
||||
const params = Object.assign({}, localConnection.value, credentials);
|
||||
try {
|
||||
if (isConnecting.value) {
|
||||
const params = Object.assign({}, props.connection, credentials);
|
||||
await connectWorkspace(params);
|
||||
await connectWorkspace(params, { signal: abortController.value.signal }).catch(() => undefined);
|
||||
isConnecting.value = false;
|
||||
}
|
||||
else {
|
||||
const res = await Connection.makeTest(params);
|
||||
if (res.status === 'error')
|
||||
addNotification({ status: 'error', message: res.response.message || res.response.toString() });
|
||||
else
|
||||
else if (res.status === 'success')
|
||||
addNotification({ status: 'success', message: t('connection.connectionSuccessfullyMade') });
|
||||
}
|
||||
}
|
||||
@@ -598,6 +647,22 @@ localConnection.value = JSON.parse(JSON.stringify(props.connection));
|
||||
min-width: 450px;
|
||||
border-radius: $border-radius;
|
||||
|
||||
.panel-nav {
|
||||
.tab-block {
|
||||
background: transparent;
|
||||
margin: 0.2rem 0 0.15rem 0;
|
||||
|
||||
.tab-item {
|
||||
background: transparent;
|
||||
flex: 1 0 0;
|
||||
|
||||
> a {
|
||||
padding: 8px 4px 6px 4px
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
flex: initial;
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
v-model="selectedDatabase"
|
||||
:options="databases"
|
||||
class="form-select select-sm text-bold my-0"
|
||||
@keypress.stop=""
|
||||
@keydown.stop=""
|
||||
/>
|
||||
</div>
|
||||
<span v-else class="workspace-explorebar-title">{{ connectionName }}</span>
|
||||
@@ -109,6 +111,7 @@
|
||||
@close-context="closeDatabaseContext"
|
||||
@open-create-table-tab="openCreateElementTab('table')"
|
||||
@open-create-view-tab="openCreateElementTab('view')"
|
||||
@open-create-materialized-view-tab="openCreateElementTab('materialized-view')"
|
||||
@open-create-trigger-tab="openCreateElementTab('trigger')"
|
||||
@open-create-routine-tab="openCreateElementTab('routine')"
|
||||
@open-create-function-tab="openCreateElementTab('function')"
|
||||
@@ -139,10 +142,12 @@
|
||||
:selected-misc="selectedMisc"
|
||||
:selected-schema="selectedSchema"
|
||||
:context-event="miscContextEvent"
|
||||
@open-create-view-tab="openCreateElementTab('view')"
|
||||
@open-create-materializedview-tab="openCreateElementTab('materialized-view')"
|
||||
@open-create-trigger-tab="openCreateElementTab('trigger')"
|
||||
@open-create-trigger-function-tab="openCreateElementTab('trigger-function')"
|
||||
@open-create-routine-tab="openCreateElementTab('routine')"
|
||||
@open-create-function-tab="openCreateElementTab('function')"
|
||||
@open-create-trigger-function-tab="openCreateElementTab('trigger-function')"
|
||||
@open-create-scheduler-tab="openCreateElementTab('scheduler')"
|
||||
@close-context="closeMiscFolderContext"
|
||||
@reload="refresh"
|
||||
@@ -501,7 +506,7 @@ const toggleSearchMethod = () => {
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 50%);
|
||||
background: var(--primary-color-dark);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
/> {{ t('general.run') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedMisc.type === 'trigger' && customizations.triggerEnableDisable"
|
||||
v-if="selectedMisc.type === 'trigger' && customizations.triggerEnableDisable && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="toggleTrigger"
|
||||
>
|
||||
@@ -36,7 +36,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedMisc.type === 'scheduler'"
|
||||
v-if="selectedMisc.type === 'scheduler' && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="toggleScheduler"
|
||||
>
|
||||
@@ -63,7 +63,11 @@
|
||||
:size="18"
|
||||
/> {{ t('general.copyName') }}</span>
|
||||
</div>
|
||||
<div class="context-element" @click="showDeleteModal">
|
||||
<div
|
||||
v-if="!connection.readonly"
|
||||
class="context-element"
|
||||
@click="showDeleteModal"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
@@ -117,6 +121,7 @@ import Routines from '@/ipc-api/Routines';
|
||||
import Schedulers from '@/ipc-api/Schedulers';
|
||||
import Triggers from '@/ipc-api/Triggers';
|
||||
import { copyText } from '@/libs/copyText';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
@@ -132,6 +137,7 @@ const emit = defineEmits(['close-context', 'reload']);
|
||||
|
||||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { getConnectionByUid } = useConnectionsStore();
|
||||
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
|
||||
@@ -154,6 +160,7 @@ const workspace = computed(() => {
|
||||
const customizations = computed(() => {
|
||||
return getWorkspace(selectedWorkspace.value).customizations;
|
||||
});
|
||||
const connection = computed(() => getConnectionByUid(selectedWorkspace.value));
|
||||
|
||||
const deleteMessage = computed(() => {
|
||||
switch (props.selectedMisc.type) {
|
||||
|
@@ -3,6 +3,30 @@
|
||||
:context-event="props.contextEvent"
|
||||
@close-context="closeContext"
|
||||
>
|
||||
<div
|
||||
v-if="props.selectedMisc === 'view'"
|
||||
class="context-element"
|
||||
@click="emit('open-create-view-tab')"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiTableCog"
|
||||
:size="18"
|
||||
/> {{ t('database.createNewView') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="props.selectedMisc === 'materializedview'"
|
||||
class="context-element"
|
||||
@click="emit('open-create-materializedview-tab')"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiTableCog"
|
||||
:size="18"
|
||||
/> {{ t('database.createNewMaterializedView') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="props.selectedMisc === 'trigger'"
|
||||
class="context-element"
|
||||
@@ -81,6 +105,8 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
'open-create-view-tab',
|
||||
'open-create-materializedview-tab',
|
||||
'open-create-trigger-tab',
|
||||
'open-create-routine-tab',
|
||||
'open-create-function-tab',
|
||||
|
@@ -67,6 +67,104 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-if="filteredViews.length" class="database-misc">
|
||||
<details class="accordion">
|
||||
<summary
|
||||
class="accordion-header misc-name"
|
||||
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.trigger}"
|
||||
@contextmenu.prevent="showMiscFolderContext($event, 'view')"
|
||||
>
|
||||
<BaseIcon
|
||||
class="misc-icon mr-1"
|
||||
icon-name="mdiFolderEye"
|
||||
:size="18"
|
||||
/>
|
||||
<BaseIcon
|
||||
class="misc-icon open-folder mr-1"
|
||||
icon-name="mdiFolderOpen"
|
||||
:size="18"
|
||||
/>
|
||||
{{ t('database.view', 2) }}
|
||||
</summary>
|
||||
<div class="accordion-body">
|
||||
<div>
|
||||
<ul class="menu menu-nav pt-0">
|
||||
<li
|
||||
v-for="view of filteredViews"
|
||||
:key="view.name"
|
||||
class="menu-item"
|
||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.view === view.name}"
|
||||
@mousedown.left="selectTable({schema: database.name, table: view})"
|
||||
@dblclick="openDataTab({schema: database.name, table: view})"
|
||||
@contextmenu.prevent="showTableContext($event, view)"
|
||||
>
|
||||
<a class="table-name">
|
||||
<div v-if="checkLoadingStatus(view.name, 'table')" class="icon loading mr-1" />
|
||||
<BaseIcon
|
||||
v-else
|
||||
class="table-icon mr-1"
|
||||
icon-name="mdiTableEye"
|
||||
:size="18"
|
||||
:style="`min-width: 18px`"
|
||||
/>
|
||||
<span v-html="highlightWord(view.name)" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div v-if="filteredMatViews.length && customizations.materializedViews" class="database-misc">
|
||||
<details class="accordion">
|
||||
<summary
|
||||
class="accordion-header misc-name"
|
||||
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.trigger}"
|
||||
@contextmenu.prevent="showMiscFolderContext($event, 'materializedview')"
|
||||
>
|
||||
<BaseIcon
|
||||
class="misc-icon mr-1"
|
||||
icon-name="mdiFolderEye"
|
||||
:size="18"
|
||||
/>
|
||||
<BaseIcon
|
||||
class="misc-icon open-folder mr-1"
|
||||
icon-name="mdiFolderOpen"
|
||||
:size="18"
|
||||
/>
|
||||
{{ t('database.materializedview', 2) }}
|
||||
</summary>
|
||||
<div class="accordion-body">
|
||||
<div>
|
||||
<ul class="menu menu-nav pt-0">
|
||||
<li
|
||||
v-for="view of filteredMatViews"
|
||||
:key="view.name"
|
||||
class="menu-item"
|
||||
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.view === view.name}"
|
||||
@mousedown.left="selectTable({schema: database.name, table: view})"
|
||||
@dblclick="openDataTab({schema: database.name, table: view})"
|
||||
@contextmenu.prevent="showTableContext($event, view)"
|
||||
>
|
||||
<a class="table-name">
|
||||
<div v-if="checkLoadingStatus(view.name, 'table')" class="icon loading mr-1" />
|
||||
<BaseIcon
|
||||
v-else
|
||||
class="table-icon mr-1"
|
||||
icon-name="mdiTableEye"
|
||||
:size="18"
|
||||
:style="`min-width: 18px`"
|
||||
/>
|
||||
<span v-html="highlightWord(view.name)" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div v-if="filteredTriggers.length && customizations.triggers" class="database-misc">
|
||||
<details class="accordion">
|
||||
<summary
|
||||
@@ -380,11 +478,25 @@ const searchTerm = computed(() => {
|
||||
|
||||
const filteredTables = computed(() => {
|
||||
if (props.searchMethod === 'elements')
|
||||
return props.database.tables.filter(table => table.name.search(searchTerm.value) >= 0);
|
||||
return props.database.tables.filter(table => table.name.search(searchTerm.value) >= 0 && table.type === 'table');
|
||||
else
|
||||
return props.database.tables;
|
||||
});
|
||||
|
||||
const filteredViews = computed(() => {
|
||||
if (props.searchMethod === 'elements')
|
||||
return props.database.tables.filter(table => table.name.search(searchTerm.value) >= 0 && table.type === 'view');
|
||||
else
|
||||
return props.database.tables.filter(table => table.type === 'view');
|
||||
});
|
||||
|
||||
const filteredMatViews = computed(() => {
|
||||
if (props.searchMethod === 'elements')
|
||||
return props.database.tables.filter(table => table.name.search(searchTerm.value) >= 0 && table.type === 'materializedview');
|
||||
else
|
||||
return props.database.tables.filter(table => table.type === 'materializedview');
|
||||
});
|
||||
|
||||
const filteredTriggers = computed(() => {
|
||||
if (props.searchMethod === 'elements')
|
||||
return props.database.triggers.filter(trigger => trigger.name.search(searchTerm.value) >= 0);
|
||||
@@ -513,7 +625,13 @@ const selectMisc = ({ schema, misc, type }: { schema: string; misc: { name: stri
|
||||
};
|
||||
|
||||
const openDataTab = ({ schema, table }: { schema: string; table: TableInfos }) => {
|
||||
newTab({ uid: props.connection.uid, elementName: table.name, schema: props.database.name, type: 'data', elementType: table.type });
|
||||
newTab({
|
||||
uid: props.connection.uid,
|
||||
elementName: table.name,
|
||||
schema: props.database.name,
|
||||
type: 'data',
|
||||
elementType: table.type
|
||||
});
|
||||
setBreadcrumbs({ schema, [table.type]: table.name });
|
||||
};
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
:context-event="contextEvent"
|
||||
@close-context="closeContext"
|
||||
>
|
||||
<div class="context-element">
|
||||
<div v-if="!connection.readonly" class="context-element">
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
@@ -40,6 +40,18 @@
|
||||
:size="18"
|
||||
/> {{ t('database.view') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.materializedViewAdd"
|
||||
class="context-element"
|
||||
@click="openCreateMaterializedViewTab"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiTableEye"
|
||||
:size="18"
|
||||
/> {{ t('database.materializedview') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.triggerAdd"
|
||||
class="context-element"
|
||||
@@ -123,7 +135,7 @@
|
||||
/> {{ t('database.export') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.schemaImport"
|
||||
v-if="workspace.customizations.schemaImport && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="initImport"
|
||||
>
|
||||
@@ -135,7 +147,7 @@
|
||||
/> {{ t('database.import') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.schemaEdit"
|
||||
v-if="workspace.customizations.schemaEdit && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="showEditModal"
|
||||
>
|
||||
@@ -147,7 +159,7 @@
|
||||
/> {{ t('database.editSchema') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.schemaDrop"
|
||||
v-if="workspace.customizations.schemaDrop && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="showDeleteModal"
|
||||
>
|
||||
@@ -207,6 +219,7 @@ import ModalImportSchema from '@/components/ModalImportSchema.vue';
|
||||
import Application from '@/ipc-api/Application';
|
||||
import Schema from '@/ipc-api/Schema';
|
||||
import { copyText } from '@/libs/copyText';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useSchemaExportStore } from '@/stores/schemaExport';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
@@ -221,6 +234,7 @@ const props = defineProps({
|
||||
const emit = defineEmits([
|
||||
'open-create-table-tab',
|
||||
'open-create-view-tab',
|
||||
'open-create-materialized-view-tab',
|
||||
'open-create-trigger-tab',
|
||||
'open-create-routine-tab',
|
||||
'open-create-function-tab',
|
||||
@@ -235,7 +249,9 @@ const workspacesStore = useWorkspacesStore();
|
||||
const schemaExportStore = useSchemaExportStore();
|
||||
const { showExportModal } = schemaExportStore;
|
||||
|
||||
const connectionsStore = useConnectionsStore();
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
const { getConnectionByUid } = connectionsStore;
|
||||
|
||||
const {
|
||||
getWorkspace,
|
||||
@@ -248,6 +264,7 @@ const isEditModal = ref(false);
|
||||
const isImportSchemaModal = ref(false);
|
||||
|
||||
const workspace = computed(() => getWorkspace(selectedWorkspace.value));
|
||||
const connection = computed(() => getConnectionByUid(selectedWorkspace.value));
|
||||
|
||||
const openCreateTableTab = () => {
|
||||
emit('open-create-table-tab');
|
||||
@@ -257,6 +274,10 @@ const openCreateViewTab = () => {
|
||||
emit('open-create-view-tab');
|
||||
};
|
||||
|
||||
const openCreateMaterializedViewTab = () => {
|
||||
emit('open-create-materialized-view-tab');
|
||||
};
|
||||
|
||||
const openCreateTriggerTab = () => {
|
||||
emit('open-create-trigger-tab');
|
||||
};
|
||||
|
@@ -48,7 +48,19 @@
|
||||
/> {{ t('application.settings') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedTable && selectedTable.type === 'table' && customizations.tableDuplicate"
|
||||
v-if="selectedTable && selectedTable.type === 'materializedview' && customizations.materializedViewSettings"
|
||||
class="context-element"
|
||||
@click="openMaterializedViewSettingTab"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiWrenchCog"
|
||||
:size="18"
|
||||
/> {{ t('application.settings') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedTable && selectedTable.type === 'table' && customizations.tableDuplicate && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="duplicateTable"
|
||||
>
|
||||
@@ -60,7 +72,7 @@
|
||||
/> {{ t('database.duplicateTable') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedTable && selectedTable.type === 'table'"
|
||||
v-if="selectedTable && selectedTable.type === 'table' && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="showEmptyModal"
|
||||
>
|
||||
@@ -71,7 +83,11 @@
|
||||
:size="18"
|
||||
/> {{ t('database.emptyTable') }}</span>
|
||||
</div>
|
||||
<div class="context-element" @click="showDeleteModal">
|
||||
<div
|
||||
v-if="!connection.readonly"
|
||||
class="context-element"
|
||||
@click="showDeleteModal"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
@@ -139,6 +155,7 @@ import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import Tables from '@/ipc-api/Tables';
|
||||
import { copyText } from '@/libs/copyText';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useSchemaExportStore } from '@/stores/schemaExport';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
@@ -156,6 +173,7 @@ const emit = defineEmits(['close-context', 'duplicate-table', 'reload', 'delete-
|
||||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { showExportModal } = useSchemaExportStore();
|
||||
const { getConnectionByUid } = useConnectionsStore();
|
||||
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
|
||||
@@ -173,6 +191,7 @@ const forceTruncate = ref(false);
|
||||
|
||||
const workspace = computed(() => getWorkspace(selectedWorkspace.value));
|
||||
const customizations = computed(() => workspace.value && workspace.value.customizations ? workspace.value.customizations : null);
|
||||
const connection = computed(() => getConnectionByUid(selectedWorkspace.value));
|
||||
|
||||
const showTableExportModal = () => {
|
||||
showExportModal(props.selectedSchema, props.selectedTable.name);
|
||||
@@ -238,6 +257,23 @@ const openViewSettingTab = () => {
|
||||
closeContext();
|
||||
};
|
||||
|
||||
const openMaterializedViewSettingTab = () => {
|
||||
newTab({
|
||||
uid: selectedWorkspace.value,
|
||||
elementType: 'table',
|
||||
elementName: props.selectedTable.name,
|
||||
schema: props.selectedSchema,
|
||||
type: 'materialized-view-props'
|
||||
});
|
||||
|
||||
changeBreadcrumbs({
|
||||
schema: props.selectedSchema,
|
||||
view: props.selectedTable.name
|
||||
});
|
||||
|
||||
closeContext();
|
||||
};
|
||||
|
||||
const duplicateTable = () => {
|
||||
emit('duplicate-table', { schema: props.selectedSchema, table: props.selectedTable });
|
||||
};
|
||||
|
@@ -1,189 +0,0 @@
|
||||
<template>
|
||||
<div
|
||||
ref="wrapper"
|
||||
class="query-console-wrapper"
|
||||
@mouseenter="isHover = true"
|
||||
@mouseleave="isHover = false"
|
||||
>
|
||||
<div ref="resizer" class="query-console-resizer" />
|
||||
<div
|
||||
id="query-console"
|
||||
ref="queryConsole"
|
||||
class="query-console column col-12"
|
||||
:style="{height: localHeight ? localHeight+'px' : ''}"
|
||||
>
|
||||
<div class="query-console-header">
|
||||
<div>{{ t('application.console') }}</div>
|
||||
<button class="btn btn-clear mr-1" @click="resizeConsole(0)" />
|
||||
</div>
|
||||
<div ref="queryConsoleBody" class="query-console-body">
|
||||
<div
|
||||
v-for="(wLog, i) in workspaceLogs"
|
||||
:key="i"
|
||||
class="query-console-log"
|
||||
tabindex="0"
|
||||
@contextmenu.prevent="contextMenu($event, wLog)"
|
||||
>
|
||||
<span class="type-datetime">{{ moment(wLog.date).format('HH:mm:ss') }}</span>: <code class="query-console-log-sql" v-html="highlight(wLog.sql, {html: true})" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BaseContextMenu
|
||||
v-if="isContext"
|
||||
:context-event="contextEvent"
|
||||
@close-context="isContext = false"
|
||||
>
|
||||
<div class="context-element" @click="copyQuery">
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
icon-name="mdiContentCopy"
|
||||
:size="18"
|
||||
/> {{ t('general.copy') }}</span>
|
||||
</div>
|
||||
</BaseContextMenu>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as moment from 'moment';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { highlight } from 'sql-highlight';
|
||||
import { computed, nextTick, onMounted, Ref, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import { copyText } from '@/libs/copyText';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const consoleStore = useConsoleStore();
|
||||
|
||||
const { resizeConsole, getLogsByWorkspace } = consoleStore;
|
||||
const { consoleHeight } = storeToRefs(consoleStore);
|
||||
|
||||
const props = defineProps({
|
||||
uid: String
|
||||
});
|
||||
|
||||
const wrapper: Ref<HTMLInputElement> = ref(null);
|
||||
const queryConsole: Ref<HTMLInputElement> = ref(null);
|
||||
const queryConsoleBody: Ref<HTMLInputElement> = ref(null);
|
||||
const resizer: Ref<HTMLInputElement> = ref(null);
|
||||
const localHeight = ref(250);
|
||||
const isHover = ref(false);
|
||||
const isContext = ref(false);
|
||||
const contextQuery: Ref<string> = ref(null);
|
||||
const contextEvent: Ref<MouseEvent> = ref(null);
|
||||
|
||||
const resize = (e: MouseEvent) => {
|
||||
const el = queryConsole.value;
|
||||
let consoleHeight = el.getBoundingClientRect().bottom - e.pageY;
|
||||
if (consoleHeight > 400) consoleHeight = 400;
|
||||
localHeight.value = consoleHeight;
|
||||
};
|
||||
|
||||
const workspaceLogs = computed(() => {
|
||||
return getLogsByWorkspace(props.uid);
|
||||
});
|
||||
|
||||
const stopResize = () => {
|
||||
if (localHeight.value < 0) localHeight.value = 0;
|
||||
resizeConsole(localHeight.value);
|
||||
window.removeEventListener('mousemove', resize);
|
||||
window.removeEventListener('mouseup', stopResize);
|
||||
};
|
||||
|
||||
const contextMenu = (event: MouseEvent, wLog: {date: Date; sql: string}) => {
|
||||
contextEvent.value = event;
|
||||
contextQuery.value = wLog.sql;
|
||||
isContext.value = true;
|
||||
};
|
||||
|
||||
const copyQuery = () => {
|
||||
copyText(contextQuery.value);
|
||||
isContext.value = false;
|
||||
};
|
||||
|
||||
watch(workspaceLogs, async () => {
|
||||
if (!isHover.value) {
|
||||
await nextTick();
|
||||
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
localHeight.value = consoleHeight.value;
|
||||
queryConsoleBody.value.scrollTop = queryConsoleBody.value.scrollHeight;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
resizer.value.addEventListener('mousedown', (e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
window.addEventListener('mousemove', resize);
|
||||
window.addEventListener('mouseup', stopResize);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.query-console-wrapper {
|
||||
width: 100%;
|
||||
z-index: 9;
|
||||
margin-top: auto;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
||||
.query-console-resizer {
|
||||
height: 4px;
|
||||
top: -1px;
|
||||
width: 100%;
|
||||
cursor: ns-resize;
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 50%);
|
||||
}
|
||||
}
|
||||
|
||||
.query-console {
|
||||
padding: 0;
|
||||
padding-bottom: $footer-height;
|
||||
|
||||
.query-console-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.query-console-body {
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 100%;
|
||||
padding: 0 6px 3px;
|
||||
|
||||
.query-console-log {
|
||||
padding: 1px 3px;
|
||||
margin: 1px 0;
|
||||
border-radius: $border-radius;
|
||||
|
||||
.query-console-log-sql {
|
||||
font-size: 95%;
|
||||
opacity: 0.8;
|
||||
font-weight: 700;
|
||||
|
||||
&:hover {
|
||||
user-select: text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
293
src/renderer/components/WorkspaceTabNewMaterializedView.vue
Normal file
293
src/renderer/components/WorkspaceTabNewMaterializedView.vue
Normal file
@@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<div v-show="isSelected" class="workspace-query-tab column col-12 columns col-gapless">
|
||||
<div class="workspace-query-runner column col-12">
|
||||
<div class="workspace-query-runner-footer">
|
||||
<div class="workspace-query-buttons">
|
||||
<button
|
||||
class="btn btn-primary btn-sm"
|
||||
:disabled="!isChanged"
|
||||
:class="{'loading':isSaving}"
|
||||
@click="saveChanges"
|
||||
>
|
||||
<BaseIcon
|
||||
class="mr-1"
|
||||
icon-name="mdiContentSave"
|
||||
:size="24"
|
||||
/>
|
||||
<span>{{ t('general.save') }}</span>
|
||||
</button>
|
||||
<button
|
||||
:disabled="!isChanged"
|
||||
class="btn btn-link btn-sm mr-0"
|
||||
:title="t('database.clearChanges')"
|
||||
@click="clearChanges"
|
||||
>
|
||||
<BaseIcon
|
||||
class="mr-1"
|
||||
icon-name="mdiDeleteSweep"
|
||||
:size="24"
|
||||
/>
|
||||
<span>{{ t('general.clear') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="workspace-query-info">
|
||||
<div class="d-flex" :title="t('database.schema')">
|
||||
<BaseIcon
|
||||
class="mt-1 mr-1"
|
||||
icon-name="mdiDatabase"
|
||||
:size="18"
|
||||
/><b>{{ schema }}</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ t('general.name') }}</label>
|
||||
<input
|
||||
ref="firstInput"
|
||||
v-model="localView.name"
|
||||
class="form-input"
|
||||
type="text"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column col-auto">
|
||||
<div v-if="workspace.customizations.definer" class="form-group">
|
||||
<label class="form-label">{{ t('database.definer') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.definer"
|
||||
:options="users"
|
||||
:option-label="(user: any) => user.value === '' ? t('database.currentUser') : `${user.name}@${user.host}`"
|
||||
:option-track-by="(user: any) => user.value === '' ? '' : `\`${user.name}\`@\`${user.host}\``"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column col-auto mr-2">
|
||||
<div v-if="workspace.customizations.viewSqlSecurity" class="form-group">
|
||||
<label class="form-label">{{ t('database.sqlSecurity') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.security"
|
||||
:options="['DEFINER', 'INVOKER']"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column col-auto mr-2">
|
||||
<div v-if="workspace.customizations.viewAlgorithm" class="form-group">
|
||||
<label class="form-label">{{ t('database.algorithm') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.algorithm"
|
||||
:options="['UNDEFINED', 'MERGE', 'TEMPTABLE']"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="workspace.customizations.viewUpdateOption" class="column col-auto mr-2">
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ t('database.updateOption') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.updateOption"
|
||||
:option-track-by="(user: any) => user.value"
|
||||
:options="[{label: 'None', value: ''}, {label: 'CASCADED', value: 'CASCADED'}, {label: 'LOCAL', value: 'LOCAL'}]"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="workspace-query-results column col-12 mt-2 p-relative">
|
||||
<BaseLoader v-if="isLoading" />
|
||||
<label class="form-label ml-2">{{ t('database.selectStatement') }}</label>
|
||||
<QueryEditor
|
||||
v-show="isSelected"
|
||||
ref="queryEditor"
|
||||
v-model="localView.sql"
|
||||
:workspace="workspace"
|
||||
:schema="schema"
|
||||
:height="editorHeight"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Ace } from 'ace-builds';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import BaseLoader from '@/components/BaseLoader.vue';
|
||||
import BaseSelect from '@/components/BaseSelect.vue';
|
||||
import QueryEditor from '@/components/QueryEditor.vue';
|
||||
import Views from '@/ipc-api/Views';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps({
|
||||
tabUid: String,
|
||||
connection: Object,
|
||||
tab: Object,
|
||||
isSelected: Boolean,
|
||||
schema: String
|
||||
});
|
||||
|
||||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { consoleHeight } = storeToRefs(useConsoleStore());
|
||||
|
||||
const {
|
||||
getWorkspace,
|
||||
refreshStructure,
|
||||
setUnsavedChanges,
|
||||
changeBreadcrumbs,
|
||||
newTab,
|
||||
removeTab
|
||||
} = workspacesStore;
|
||||
|
||||
const queryEditor: Ref<Component & {editor: Ace.Editor; $el: HTMLElement}> = ref(null);
|
||||
const firstInput: Ref<HTMLInputElement> = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const isSaving = ref(false);
|
||||
const originalView = ref(null);
|
||||
const localView = ref(null);
|
||||
const editorHeight = ref(300);
|
||||
|
||||
const workspace = computed(() => getWorkspace(props.connection.uid));
|
||||
const isChanged = computed(() => JSON.stringify(originalView.value) !== JSON.stringify(localView.value));
|
||||
const isDefinerInUsers = computed(() => originalView.value ? workspace.value.users.some(user => originalView.value.definer === `\`${user.name}\`@\`${user.host}\``) : true);
|
||||
|
||||
const users = computed(() => {
|
||||
const users = [{ value: '' }, ...workspace.value.users];
|
||||
if (!isDefinerInUsers.value) {
|
||||
const [name, host] = originalView.value.definer.replaceAll('`', '').split('@');
|
||||
users.unshift({ name, host });
|
||||
}
|
||||
|
||||
return users;
|
||||
});
|
||||
|
||||
const saveChanges = async () => {
|
||||
if (isSaving.value) return;
|
||||
isSaving.value = true;
|
||||
|
||||
const params = {
|
||||
uid: props.connection.uid,
|
||||
schema: props.schema,
|
||||
...localView.value
|
||||
};
|
||||
|
||||
try {
|
||||
const { status, response } = await Views.createMaterializedView(params);
|
||||
|
||||
if (status === 'success') {
|
||||
await refreshStructure(props.connection.uid);
|
||||
|
||||
newTab({
|
||||
uid: props.connection.uid,
|
||||
schema: props.schema,
|
||||
elementName: localView.value.name,
|
||||
elementType: 'materializedview',
|
||||
type: 'materialized-view-props'
|
||||
});
|
||||
|
||||
removeTab({ uid: props.connection.uid, tab: props.tab.uid });
|
||||
changeBreadcrumbs({ schema: props.schema, view: localView.value.name });
|
||||
}
|
||||
else
|
||||
addNotification({ status: 'error', message: response });
|
||||
}
|
||||
catch (err) {
|
||||
addNotification({ status: 'error', message: err.stack });
|
||||
}
|
||||
|
||||
isSaving.value = false;
|
||||
};
|
||||
|
||||
const clearChanges = () => {
|
||||
localView.value = JSON.parse(JSON.stringify(originalView.value));
|
||||
queryEditor.value.editor.session.setValue(localView.value.sql);
|
||||
};
|
||||
|
||||
const resizeQueryEditor = () => {
|
||||
if (queryEditor.value) {
|
||||
let sizeToSubtract = 0;
|
||||
const footer = document.getElementById('footer');
|
||||
if (footer) sizeToSubtract += footer.offsetHeight;
|
||||
sizeToSubtract += consoleHeight.value;
|
||||
|
||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - sizeToSubtract;
|
||||
editorHeight.value = size;
|
||||
queryEditor.value.editor.resize();
|
||||
}
|
||||
};
|
||||
|
||||
const saveContentListener = () => {
|
||||
const hasModalOpen = !!document.querySelectorAll('.modal.active').length;
|
||||
if (props.isSelected && !hasModalOpen && isChanged.value)
|
||||
saveChanges();
|
||||
};
|
||||
|
||||
watch(() => props.isSelected, (val) => {
|
||||
if (val) {
|
||||
changeBreadcrumbs({ schema: props.schema, view: localView.value.name });
|
||||
|
||||
setTimeout(() => {
|
||||
resizeQueryEditor();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
|
||||
watch(isChanged, (val) => {
|
||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||
});
|
||||
|
||||
watch(consoleHeight, () => {
|
||||
resizeQueryEditor();
|
||||
});
|
||||
|
||||
originalView.value = {
|
||||
algorithm: 'UNDEFINED',
|
||||
definer: '',
|
||||
security: 'DEFINER',
|
||||
updateOption: '',
|
||||
sql: '',
|
||||
name: ''
|
||||
};
|
||||
|
||||
localView.value = JSON.parse(JSON.stringify(originalView.value));
|
||||
|
||||
setTimeout(() => {
|
||||
resizeQueryEditor();
|
||||
}, 50);
|
||||
|
||||
onMounted(() => {
|
||||
if (props.isSelected)
|
||||
changeBreadcrumbs({ schema: props.schema });
|
||||
|
||||
ipcRenderer.on('save-content', saveContentListener);
|
||||
|
||||
setTimeout(() => {
|
||||
firstInput.value.focus();
|
||||
}, 100);
|
||||
|
||||
window.addEventListener('resize', resizeQueryEditor);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', resizeQueryEditor);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
ipcRenderer.removeListener('save-content', saveContentListener);
|
||||
});
|
||||
|
||||
</script>
|
316
src/renderer/components/WorkspaceTabPropsMaterializedView.vue
Normal file
316
src/renderer/components/WorkspaceTabPropsMaterializedView.vue
Normal file
@@ -0,0 +1,316 @@
|
||||
<template>
|
||||
<div v-show="isSelected" class="workspace-query-tab column col-12 columns col-gapless">
|
||||
<div class="workspace-query-runner column col-12">
|
||||
<div class="workspace-query-runner-footer">
|
||||
<div class="workspace-query-buttons">
|
||||
<button
|
||||
class="btn btn-primary btn-sm"
|
||||
:disabled="!isChanged"
|
||||
:class="{'loading':isSaving}"
|
||||
@click="saveChanges"
|
||||
>
|
||||
<BaseIcon
|
||||
class="mr-1"
|
||||
icon-name="mdiContentSave"
|
||||
:size="24"
|
||||
/>
|
||||
<span>{{ t('general.save') }}</span>
|
||||
</button>
|
||||
<button
|
||||
:disabled="!isChanged"
|
||||
class="btn btn-link btn-sm mr-0"
|
||||
:title="t('database.clearChanges')"
|
||||
@click="clearChanges"
|
||||
>
|
||||
<BaseIcon
|
||||
class="mr-1"
|
||||
icon-name="mdiDeleteSweep"
|
||||
:size="24"
|
||||
/>
|
||||
<span>{{ t('general.clear') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="workspace-query-info">
|
||||
<div class="d-flex" :title="t('database.schema')">
|
||||
<BaseIcon
|
||||
class="mt-1 mr-1"
|
||||
icon-name="mdiDatabase"
|
||||
:size="18"
|
||||
/><b>{{ schema }}</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ t('general.name') }}</label>
|
||||
<input
|
||||
v-model="localView.name"
|
||||
class="form-input"
|
||||
type="text"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column col-auto">
|
||||
<div v-if="workspace.customizations.definer" class="form-group">
|
||||
<label class="form-label">{{ t('database.definer') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.definer"
|
||||
:options="users"
|
||||
:option-label="(user: any) => user.value === '' ? t('database.currentUser') : `${user.name}@${user.host}`"
|
||||
:option-track-by="(user: any) => user.value === '' ? '' : `\`${user.name}\`@\`${user.host}\``"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column col-auto mr-2">
|
||||
<div v-if="workspace.customizations.viewSqlSecurity" class="form-group">
|
||||
<label class="form-label">{{ t('database.sqlSecurity') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.security"
|
||||
:options="['DEFINER', 'INVOKER']"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column col-auto mr-2">
|
||||
<div v-if="workspace.customizations.viewAlgorithm" class="form-group">
|
||||
<label class="form-label">{{ t('database.algorithm') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.algorithm"
|
||||
:options="['UNDEFINED', 'MERGE', 'TEMPTABLE']"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="workspace.customizations.viewUpdateOption" class="column col-auto mr-2">
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ t('database.updateOption') }}</label>
|
||||
<BaseSelect
|
||||
v-model="localView.updateOption"
|
||||
:option-track-by="(user: any) => user.value"
|
||||
:options="[{label: 'None', value: ''}, {label: 'CASCADED', value: 'CASCADED'}, {label: 'LOCAL', value: 'LOCAL'}]"
|
||||
class="form-select"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="workspace-query-results column col-12 mt-2 p-relative">
|
||||
<BaseLoader v-if="isLoading" />
|
||||
<label class="form-label ml-2">{{ t('database.selectStatement') }}</label>
|
||||
<QueryEditor
|
||||
v-show="isSelected"
|
||||
ref="queryEditor"
|
||||
v-model="localView.sql"
|
||||
:workspace="workspace"
|
||||
:schema="schema"
|
||||
:height="editorHeight"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Ace } from 'ace-builds';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { Component, computed, onBeforeUnmount, onMounted, onUnmounted, Ref, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import BaseLoader from '@/components/BaseLoader.vue';
|
||||
import BaseSelect from '@/components/BaseSelect.vue';
|
||||
import QueryEditor from '@/components/QueryEditor.vue';
|
||||
import Views from '@/ipc-api/Views';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps({
|
||||
tabUid: String,
|
||||
connection: Object,
|
||||
isSelected: Boolean,
|
||||
schema: String,
|
||||
view: String
|
||||
});
|
||||
|
||||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
|
||||
const {
|
||||
getWorkspace,
|
||||
refreshStructure,
|
||||
renameTabs,
|
||||
changeBreadcrumbs,
|
||||
setUnsavedChanges
|
||||
} = workspacesStore;
|
||||
|
||||
const queryEditor: Ref<Component & {editor: Ace.Editor; $el: HTMLElement}> = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const isSaving = ref(false);
|
||||
const originalView = ref(null);
|
||||
const localView = ref(null);
|
||||
const editorHeight = ref(300);
|
||||
const lastView = ref(null);
|
||||
const sqlProxy = ref('');
|
||||
|
||||
const workspace = computed(() => getWorkspace(props.connection.uid));
|
||||
const isChanged = computed(() => JSON.stringify(originalView.value) !== JSON.stringify(localView.value));
|
||||
const isDefinerInUsers = computed(() => originalView.value ? workspace.value.users.some(user => originalView.value.definer === `\`${user.name}\`@\`${user.host}\``) : true);
|
||||
|
||||
const users = computed(() => {
|
||||
const users = [{ value: '' }, ...workspace.value.users];
|
||||
if (!isDefinerInUsers.value) {
|
||||
const [name, host] = originalView.value.definer.replaceAll('`', '').split('@');
|
||||
users.unshift({ name, host });
|
||||
}
|
||||
|
||||
return users;
|
||||
});
|
||||
|
||||
const getViewData = async () => {
|
||||
if (!props.view) return;
|
||||
isLoading.value = true;
|
||||
localView.value = { sql: '' };
|
||||
lastView.value = props.view;
|
||||
|
||||
const params = {
|
||||
uid: props.connection.uid,
|
||||
schema: props.schema,
|
||||
view: props.view
|
||||
};
|
||||
|
||||
try {
|
||||
const { status, response } = await Views.getMaterializedViewInformations(params);
|
||||
if (status === 'success') {
|
||||
originalView.value = response;
|
||||
localView.value = JSON.parse(JSON.stringify(originalView.value));
|
||||
sqlProxy.value = localView.value.sql;
|
||||
}
|
||||
else
|
||||
addNotification({ status: 'error', message: response });
|
||||
}
|
||||
catch (err) {
|
||||
addNotification({ status: 'error', message: err.stack });
|
||||
}
|
||||
|
||||
resizeQueryEditor();
|
||||
isLoading.value = false;
|
||||
};
|
||||
|
||||
const saveChanges = async () => {
|
||||
if (isSaving.value) return;
|
||||
isSaving.value = true;
|
||||
const params = {
|
||||
uid: props.connection.uid,
|
||||
view: {
|
||||
...localView.value,
|
||||
schema: props.schema,
|
||||
oldName: originalView.value.name
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
const { status, response } = await Views.alterMaterializedView(params);
|
||||
|
||||
if (status === 'success') {
|
||||
const oldName = originalView.value.name;
|
||||
|
||||
await refreshStructure(props.connection.uid);
|
||||
|
||||
if (oldName !== localView.value.name) {
|
||||
renameTabs({
|
||||
uid: props.connection.uid,
|
||||
schema: props.schema,
|
||||
elementName: oldName,
|
||||
elementNewName: localView.value.name,
|
||||
elementType: 'materializedview'
|
||||
});
|
||||
|
||||
changeBreadcrumbs({ schema: props.schema, view: localView.value.name });
|
||||
}
|
||||
else
|
||||
getViewData();
|
||||
}
|
||||
else
|
||||
addNotification({ status: 'error', message: response });
|
||||
}
|
||||
catch (err) {
|
||||
addNotification({ status: 'error', message: err.stack });
|
||||
}
|
||||
|
||||
isSaving.value = false;
|
||||
};
|
||||
|
||||
const clearChanges = () => {
|
||||
localView.value = JSON.parse(JSON.stringify(originalView.value));
|
||||
queryEditor.value.editor.session.setValue(localView.value.sql);
|
||||
};
|
||||
|
||||
const resizeQueryEditor = () => {
|
||||
if (queryEditor.value) {
|
||||
const footer = document.getElementById('footer');
|
||||
const size = window.innerHeight - queryEditor.value.$el.getBoundingClientRect().top - footer.offsetHeight;
|
||||
editorHeight.value = size;
|
||||
queryEditor.value.editor.resize();
|
||||
}
|
||||
};
|
||||
|
||||
const saveContentListener = () => {
|
||||
const hasModalOpen = !!document.querySelectorAll('.modal.active').length;
|
||||
if (props.isSelected && !hasModalOpen && isChanged.value)
|
||||
saveChanges();
|
||||
};
|
||||
|
||||
watch(() => props.schema, async () => {
|
||||
if (props.isSelected) {
|
||||
await getViewData();
|
||||
queryEditor.value.editor.session.setValue(localView.value.sql);
|
||||
lastView.value = props.view;
|
||||
}
|
||||
});
|
||||
|
||||
watch(() => props.view, async () => {
|
||||
if (props.isSelected) {
|
||||
await getViewData();
|
||||
queryEditor.value.editor.session.setValue(localView.value.sql);
|
||||
lastView.value = props.view;
|
||||
}
|
||||
});
|
||||
|
||||
watch(() => props.isSelected, (val) => {
|
||||
if (val) {
|
||||
changeBreadcrumbs({ schema: props.schema, view: localView.value.name });
|
||||
|
||||
setTimeout(() => {
|
||||
resizeQueryEditor();
|
||||
}, 50);
|
||||
}
|
||||
});
|
||||
|
||||
watch(isChanged, (val) => {
|
||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||
});
|
||||
|
||||
(async () => {
|
||||
await getViewData();
|
||||
queryEditor.value.editor.session.setValue(localView.value.sql);
|
||||
})();
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', resizeQueryEditor);
|
||||
|
||||
ipcRenderer.on('save-content', saveContentListener);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', resizeQueryEditor);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
ipcRenderer.removeListener('save-content', saveContentListener);
|
||||
});
|
||||
</script>
|
@@ -19,7 +19,10 @@
|
||||
<div ref="resizer" class="query-area-resizer" />
|
||||
<div ref="queryAreaFooter" class="workspace-query-runner-footer">
|
||||
<div class="workspace-query-buttons">
|
||||
<div @mouseenter="setCancelButtonVisibility(true)" @mouseleave="setCancelButtonVisibility(false)">
|
||||
<div
|
||||
@mouseenter="setCancelButtonVisibility(true)"
|
||||
@mouseleave="setCancelButtonVisibility(false)"
|
||||
>
|
||||
<button
|
||||
v-if="showCancel && isQuering"
|
||||
class="btn btn-primary btn-sm cancellable"
|
||||
@@ -94,6 +97,48 @@
|
||||
>
|
||||
<BaseIcon icon-name="mdiBrush" :size="24" />
|
||||
</button>
|
||||
<div class="btn-group">
|
||||
<button
|
||||
class="btn btn-dark btn-sm mr-0"
|
||||
:disabled="!filePath || lastSavedQuery === query"
|
||||
:title="t('application.saveFile')"
|
||||
@click="saveFile()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiContentSaveCheckOutline" :size="24" />
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-dark btn-sm mr-0"
|
||||
:title="t('application.saveFileAs')"
|
||||
@click="saveFileAs()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiContentSavePlusOutline" :size="24" />
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-dark btn-sm"
|
||||
:title="t('application.openFile')"
|
||||
@click="openFile()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiFolderOpenOutline" :size="24" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button
|
||||
class="btn btn-dark btn-sm mr-0"
|
||||
:disabled="isQuering || (isQuerySaved || query.length < 5)"
|
||||
:title="t('application.saveAsNote')"
|
||||
@click="saveQuery()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiHeartPlusOutline" :size="24" />
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-dark btn-sm"
|
||||
:disabled="isQuering"
|
||||
:title="t('database.savedQueries')"
|
||||
@click="openSavedModal()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiNotebookHeartOutline" :size="24" />
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
class="btn btn-dark btn-sm"
|
||||
:disabled="isQuering"
|
||||
@@ -102,24 +147,6 @@
|
||||
>
|
||||
<BaseIcon icon-name="mdiHistory" :size="24" />
|
||||
</button>
|
||||
<div class="btn-group">
|
||||
<button
|
||||
class="btn btn-dark btn-sm mr-0"
|
||||
:disabled="isQuering || (isQuerySaved || query.length < 5)"
|
||||
:title="t('general.save')"
|
||||
@click="saveQuery()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiContentSaveOutline" :size="24" />
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-dark btn-sm"
|
||||
:disabled="isQuering"
|
||||
:title="t('database.savedQueries')"
|
||||
@click="openSavedModal()"
|
||||
>
|
||||
<BaseIcon icon-name="mdiStarOutline" :size="24" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropdown table-dropdown pr-2">
|
||||
<button
|
||||
:disabled="!hasResults || isQuering"
|
||||
@@ -226,6 +253,7 @@
|
||||
v-if="results"
|
||||
v-show="!isQuering"
|
||||
ref="queryTable"
|
||||
:is-quering="isQuering"
|
||||
:results="results"
|
||||
:tab-uid="tab.uid"
|
||||
:conn-uid="connection.uid"
|
||||
@@ -251,7 +279,7 @@ import { uidGen } from 'common/libs/uidGen';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { format } from 'sql-formatter';
|
||||
import { Component, computed, onBeforeUnmount, onMounted, Prop, Ref, ref, watch } from 'vue';
|
||||
import { Component, computed, onBeforeUnmount, onMounted, Prop, Ref, ref, toRaw, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
@@ -262,6 +290,7 @@ import QueryEditor from '@/components/QueryEditor.vue';
|
||||
import WorkspaceTabQueryEmptyState from '@/components/WorkspaceTabQueryEmptyState.vue';
|
||||
import WorkspaceTabQueryTable from '@/components/WorkspaceTabQueryTable.vue';
|
||||
import { useResultTables } from '@/composables/useResultTables';
|
||||
import Application from '@/ipc-api/Application';
|
||||
import Schema from '@/ipc-api/Schema';
|
||||
import { useApplicationStore } from '@/stores/application';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
@@ -302,14 +331,18 @@ const {
|
||||
getWorkspace,
|
||||
changeBreadcrumbs,
|
||||
updateTabContent,
|
||||
setUnsavedChanges
|
||||
setUnsavedChanges,
|
||||
newTab
|
||||
} = workspacesStore;
|
||||
|
||||
const queryEditor: Ref<Component & { editor: Ace.Editor; $el: HTMLElement }> = ref(null);
|
||||
const queryAreaFooter: Ref<HTMLDivElement> = ref(null);
|
||||
const resizer: Ref<HTMLDivElement> = ref(null);
|
||||
const queryName = ref('');
|
||||
const query = ref('');
|
||||
const filePath = ref('');
|
||||
const lastQuery = ref('');
|
||||
const lastSavedQuery = ref('');
|
||||
const isCancelling = ref(false);
|
||||
const showCancel = ref(false);
|
||||
const autocommit = ref(true);
|
||||
@@ -333,17 +366,41 @@ const databaseSchemas = computed(() => {
|
||||
});
|
||||
const hasResults = computed(() => results.value.length && results.value[0].rows);
|
||||
const hasAffected = computed(() => affectedCount.value || (!resultsCount.value && affectedCount.value !== null));
|
||||
const isChanged = computed(() => {
|
||||
return filePath.value && lastSavedQuery.value !== query.value;
|
||||
});
|
||||
|
||||
watch(query, (val) => {
|
||||
clearTimeout(debounceTimeout.value);
|
||||
|
||||
debounceTimeout.value = setTimeout(() => {
|
||||
updateTabContent({
|
||||
elementName: queryName.value,
|
||||
filePath: filePath.value,
|
||||
uid: props.connection.uid,
|
||||
tab: props.tab.uid,
|
||||
type: 'query',
|
||||
schema: selectedSchema.value,
|
||||
content: val
|
||||
|
||||
});
|
||||
|
||||
isQuerySaved.value = false;
|
||||
}, 200);
|
||||
});
|
||||
|
||||
watch(queryName, (val) => {
|
||||
clearTimeout(debounceTimeout.value);
|
||||
|
||||
debounceTimeout.value = setTimeout(() => {
|
||||
updateTabContent({
|
||||
elementName: val,
|
||||
filePath: filePath.value,
|
||||
uid: props.connection.uid,
|
||||
tab: props.tab.uid,
|
||||
type: 'query',
|
||||
schema: selectedSchema.value,
|
||||
content: query.value
|
||||
});
|
||||
|
||||
isQuerySaved.value = false;
|
||||
@@ -377,6 +434,10 @@ watch(() => props.tab.content, () => {
|
||||
queryEditor.value.editor.session.setValue(query.value);
|
||||
});
|
||||
|
||||
watch(isChanged, (val) => {
|
||||
setUnsavedChanges({ uid: props.connection.uid, tUid: props.tabUid, isChanged: val });
|
||||
});
|
||||
|
||||
const runQuery = async (query: string) => {
|
||||
if (!query || isQuering.value) return;
|
||||
isQuering.value = true;
|
||||
@@ -529,7 +590,8 @@ const saveQuery = () => {
|
||||
type: 'query',
|
||||
date: new Date(),
|
||||
note: query.value,
|
||||
isArchived: false
|
||||
isArchived: false,
|
||||
title: queryName.value
|
||||
});
|
||||
isQuerySaved.value = true;
|
||||
};
|
||||
@@ -596,6 +658,8 @@ const rollbackTab = async () => {
|
||||
defineExpose({ resizeResults });
|
||||
|
||||
query.value = props.tab.content as string;
|
||||
queryName.value = props.tab.elementName as string;
|
||||
filePath.value = props.tab.filePath as string;
|
||||
selectedSchema.value = props.tab.schema || breadcrumbsSchema.value;
|
||||
|
||||
window.addEventListener('resize', onWindowResize);
|
||||
@@ -630,6 +694,73 @@ const historyListener = () => {
|
||||
openHistoryModal();
|
||||
};
|
||||
|
||||
const openFileListener = () => {
|
||||
const hasModalOpen = !!document.querySelectorAll('.modal.active').length;
|
||||
if (props.isSelected && !hasModalOpen)
|
||||
openFile();
|
||||
};
|
||||
|
||||
const saveFileAsListener = () => {
|
||||
const hasModalOpen = !!document.querySelectorAll('.modal.active').length;
|
||||
if (props.isSelected && !hasModalOpen)
|
||||
saveFileAs();
|
||||
};
|
||||
|
||||
const saveContentListener = () => {
|
||||
const hasModalOpen = !!document.querySelectorAll('.modal.active').length;
|
||||
if (props.isSelected && !hasModalOpen && filePath)
|
||||
saveFile();
|
||||
};
|
||||
|
||||
const openFile = async () => {
|
||||
const result = await Application.showOpenDialog({ properties: ['openFile'], filters: [{ name: 'SQL', extensions: ['sql', 'txt'] }] });
|
||||
if (result && !result.canceled) {
|
||||
const file = result.filePaths[0];
|
||||
const content = await Application.readFile({ filePath: file, encoding: 'utf-8' });
|
||||
const fileName = file.split('/').pop().split('\\').pop();
|
||||
if (props.tab.filePath && props.tab.filePath !== file) {
|
||||
newTab({
|
||||
uid: props.connection.uid,
|
||||
type: 'query',
|
||||
filePath: file,
|
||||
content: '',
|
||||
schema: selectedSchema.value,
|
||||
elementName: fileName
|
||||
});
|
||||
}
|
||||
else {
|
||||
filePath.value = file;
|
||||
queryName.value = fileName;
|
||||
query.value = content;
|
||||
lastSavedQuery.value = content;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const saveFileAs = async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const result: any = await Application.showSaveDialog({ filters: [{ name: 'SQL', extensions: ['sql'] }], defaultPath: `${queryName.value || 'query'}.sql` });
|
||||
if (result && !result.canceled) {
|
||||
await Application.writeFile(result.filePath, query.value);
|
||||
addNotification({ status: 'success', message: t('general.actionSuccessful', { action: t('application.saveFile') }) });
|
||||
queryName.value = result.filePath.split('/').pop().split('\\').pop();
|
||||
filePath.value = result.filePath;
|
||||
lastSavedQuery.value = toRaw(query.value);
|
||||
}
|
||||
};
|
||||
|
||||
const saveFile = async () => {
|
||||
await Application.writeFile(filePath.value, query.value);
|
||||
addNotification({ status: 'success', message: t('general.actionSuccessful', { action: t('application.saveFile') }) });
|
||||
lastSavedQuery.value = toRaw(query.value);
|
||||
};
|
||||
|
||||
const loadFileContent = async (file: string) => {
|
||||
const content = await Application.readFile({ filePath: file, encoding: 'utf-8' });
|
||||
query.value = content;
|
||||
lastSavedQuery.value = content;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
const localResizer = resizer.value;
|
||||
|
||||
@@ -638,6 +769,9 @@ onMounted(() => {
|
||||
ipcRenderer.on('kill-query', killQueryListener);
|
||||
ipcRenderer.on('clear-query', clearQueryListener);
|
||||
ipcRenderer.on('query-history', historyListener);
|
||||
ipcRenderer.on('open-file', openFileListener);
|
||||
ipcRenderer.on('save-file-as', saveFileAsListener);
|
||||
ipcRenderer.on('save-content', saveContentListener);
|
||||
|
||||
localResizer.addEventListener('mousedown', (e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
@@ -648,6 +782,9 @@ onMounted(() => {
|
||||
|
||||
if (props.tab.autorun)
|
||||
runQuery(query.value);
|
||||
|
||||
if (props.tab.filePath)
|
||||
loadFileContent(props.tab.filePath);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
@@ -663,6 +800,9 @@ onBeforeUnmount(() => {
|
||||
ipcRenderer.removeListener('kill-query', killQueryListener);
|
||||
ipcRenderer.removeListener('clear-query', clearQueryListener);
|
||||
ipcRenderer.removeListener('query-history', historyListener);
|
||||
ipcRenderer.removeListener('open-file', openFileListener);
|
||||
ipcRenderer.removeListener('save-file-as', saveFileAsListener);
|
||||
ipcRenderer.removeListener('save-content', saveContentListener);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -682,7 +822,7 @@ onBeforeUnmount(() => {
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 50%);
|
||||
background: var(--primary-color-dark);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,4 +861,4 @@ onBeforeUnmount(() => {
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>filePathsfilePathsfilePaths
|
||||
|
@@ -38,7 +38,7 @@
|
||||
<div class="thead">
|
||||
<div class="tr">
|
||||
<div
|
||||
v-for="(field, index) in fields"
|
||||
v-for="(field, index) in filteredFields"
|
||||
:key="index"
|
||||
class="th c-hand"
|
||||
:title="`${field.type} ${fieldLength(field) ? `(${fieldLength(field)})` : ''}`"
|
||||
@@ -291,6 +291,7 @@ const { consoleHeight } = storeToRefs(consoleStore);
|
||||
const props = defineProps({
|
||||
results: Array as Prop<QueryResult[]>,
|
||||
connUid: String,
|
||||
isQuering: Boolean,
|
||||
mode: String as Prop<'table' | 'query'>,
|
||||
page: {
|
||||
type: Number,
|
||||
@@ -382,6 +383,11 @@ const sortedResults = computed(() => {
|
||||
|
||||
const resultsWithRows = computed(() => props.results.filter(result => result.rows.length));
|
||||
const fields = computed(() => resultsWithRows.value.length ? resultsWithRows.value[resultsetIndex.value].fields : []);
|
||||
const filteredFields = computed(() => fields.value.reduce((acc, cur) => {
|
||||
if (acc.findIndex(f => JSON.stringify(f) === JSON.stringify(cur)))
|
||||
acc.push(cur);
|
||||
return acc;
|
||||
}, [] as TableField[]));
|
||||
const keyUsage = computed(() => resultsWithRows.value.length ? resultsWithRows.value[resultsetIndex.value].keys : []);
|
||||
|
||||
const fieldsObj = computed(() => {
|
||||
@@ -790,7 +796,7 @@ const contextMenu = (event: MouseEvent, cell: any) => {
|
||||
};
|
||||
|
||||
const sort = (field: TableField) => {
|
||||
if (!isSortable.value) return;
|
||||
if (!isSortable.value || props.isQuering) return;
|
||||
|
||||
selectedRows.value = [];
|
||||
let fieldName = field.name;
|
||||
|
@@ -91,7 +91,7 @@
|
||||
<BaseIcon icon-name="mdiMagnify" :size="24" />
|
||||
</button>
|
||||
<button
|
||||
v-if="isTable"
|
||||
v-if="isTable && !connection.readonly"
|
||||
class="btn btn-dark btn-sm"
|
||||
:disabled="isQuering"
|
||||
@click="showFakerModal()"
|
||||
@@ -202,6 +202,7 @@
|
||||
v-if="results"
|
||||
ref="queryTable"
|
||||
:results="results"
|
||||
:is-quering="isQuering"
|
||||
:page="page"
|
||||
:tab-uid="tabUid"
|
||||
:conn-uid="connection.uid"
|
||||
@@ -305,7 +306,7 @@ const customizations = computed(() => {
|
||||
});
|
||||
|
||||
const isTable = computed(() => {
|
||||
return !workspace.value.breadcrumbs.view;
|
||||
return props.elementType === 'table';
|
||||
});
|
||||
|
||||
const fields = computed(() => {
|
||||
@@ -441,6 +442,25 @@ const resizeScroller = () => {
|
||||
const updateFilters = (clausoles: TableFilterClausole[]) => {
|
||||
filters.value = clausoles;
|
||||
results.value = [];
|
||||
|
||||
const permanentTabs = {
|
||||
table: 'data',
|
||||
view: 'data',
|
||||
trigger: 'trigger-props',
|
||||
triggerFunction: 'trigger-function-props',
|
||||
function: 'function-props',
|
||||
routine: 'routine-props',
|
||||
procedure: 'routine-props',
|
||||
scheduler: 'scheduler-props'
|
||||
} as Record<string, string>;
|
||||
|
||||
newTab({
|
||||
uid: props.connection.uid,
|
||||
schema: props.schema,
|
||||
elementName: props.table,
|
||||
type: permanentTabs[props.elementType],
|
||||
elementType: props.elementType
|
||||
});
|
||||
getTableData();
|
||||
};
|
||||
|
||||
@@ -480,8 +500,8 @@ const openTableSettingTab = () => {
|
||||
uid: workspace.value.uid,
|
||||
elementName: props.table,
|
||||
schema: props.schema,
|
||||
type: isTable.value ? 'table-props' : 'view-props',
|
||||
elementType: isTable.value ? 'table' : 'view'
|
||||
type: isTable.value ? 'table-props' : props.elementType === 'view' ? 'view-props' : 'materialized-view-props',
|
||||
elementType: props.elementType
|
||||
});
|
||||
|
||||
changeBreadcrumbs({
|
||||
|
@@ -1,3 +1,13 @@
|
||||
|
||||
/**
|
||||
* [TRANSLATION UPDATE HELPER]
|
||||
* - Open a terminal in antares folder and run `npm run translation:check short-code` replacing short-code with the one you are updating.
|
||||
* - The command will output which terms are missing or not translated from english.
|
||||
* - Open antares folder with your editor of choice.
|
||||
* - Go to antares/src/renderer/i18n/ and open the locale file you want to translate.
|
||||
* - Add and translate missing terms and consider whether to translate untranslated terms.
|
||||
*/
|
||||
|
||||
export const csCZ = {
|
||||
general: { // General purpose terms
|
||||
edit: 'Upravit',
|
||||
@@ -18,7 +28,7 @@ export const csCZ = {
|
||||
download: 'Stáhnout',
|
||||
add: 'Přidat',
|
||||
data: 'Data',
|
||||
properties: 'Vlastnosti', // Lawondyss: Not used
|
||||
properties: 'Vlastnosti',
|
||||
name: 'Název',
|
||||
clear: 'Vyčistit',
|
||||
options: 'Možnosti',
|
||||
@@ -39,6 +49,7 @@ export const csCZ = {
|
||||
new: 'Nové',
|
||||
select: 'Vybrat',
|
||||
change: 'Změnit',
|
||||
include: 'Včetně',
|
||||
includes: 'Zahrnout',
|
||||
completed: 'Dokončeno',
|
||||
aborted: 'Zrušeno',
|
||||
@@ -46,15 +57,15 @@ export const csCZ = {
|
||||
enable: 'Zapnuto',
|
||||
disable: 'Vypnout',
|
||||
contributors: 'Přispěvatelé',
|
||||
pin: 'Připnout', // Lawondyss: Not used
|
||||
unpin: 'Odepnout', // Lawondyss: Not used
|
||||
folder: 'Složka | Složky', // Lawondyss: Used only 1
|
||||
pin: 'Připnout',
|
||||
unpin: 'Odepnout',
|
||||
folder: 'Složka | Složky',
|
||||
none: 'Nic',
|
||||
singleQuote: 'Apostrofy',
|
||||
doubleQuote: 'Uvozovky',
|
||||
deleteConfirm: 'Skutečně chcete smazat',
|
||||
uploadFile: 'Nahrát soubor',
|
||||
format: 'Formátovat', // Format code
|
||||
format: 'Formátovat',
|
||||
history: 'Historie',
|
||||
filter: 'Filtrovat',
|
||||
manualValue: 'Vlastní hodnota',
|
||||
@@ -64,9 +75,16 @@ export const csCZ = {
|
||||
actionSuccessful: '{action} úspěšný',
|
||||
outputFormat: 'Formát výstupu',
|
||||
singleFile: 'Jediný {ext} soubor',
|
||||
zipCompressedFile: 'ZIP komprimovaný {ext} soubor'
|
||||
zipCompressedFile: 'ZIP komprimovaný {ext} soubor',
|
||||
copyName: 'Kopírovat název',
|
||||
search: 'Hledat',
|
||||
title: 'Titulek',
|
||||
archive: 'Archivovat', // verb
|
||||
undo: 'Zpět',
|
||||
moveTo: 'Přesunout do'
|
||||
},
|
||||
connection: { // Database connection
|
||||
connection: 'Připojení',
|
||||
connectionName: 'Název',
|
||||
hostName: 'Host',
|
||||
client: 'Klient',
|
||||
@@ -75,9 +93,9 @@ export const csCZ = {
|
||||
password: 'Heslo',
|
||||
credentials: 'Pověření',
|
||||
connect: 'Připojit',
|
||||
connected: 'Připojeno', // Lawondyss: Not used
|
||||
connected: 'Připojeno',
|
||||
disconnect: 'Odpojit',
|
||||
disconnected: 'Odpojeno', // Lawondyss: Not used
|
||||
disconnected: 'Odpojeno',
|
||||
ssl: 'SSL',
|
||||
enableSsl: 'Použít SSL',
|
||||
privateKey: 'Soukromý klíč',
|
||||
@@ -90,28 +108,30 @@ export const csCZ = {
|
||||
enableSsh: 'Použít SSH',
|
||||
connectionString: 'String připojení',
|
||||
addConnection: 'Add connection',
|
||||
createConnection: 'Vytvořit připojení', // Lawondyss: Not used
|
||||
createConnection: 'Vytvořit připojení',
|
||||
createNewConnection: 'Vytvořit nové připojení',
|
||||
askCredentials: 'Vyžadovat přihlášení',
|
||||
testConnection: 'Vyzkoušet',
|
||||
editConnection: 'Upravit připojení', // Lawondyss: Not used
|
||||
editConnection: 'Upravit připojení',
|
||||
deleteConnection: 'Smazat připojení',
|
||||
connectionSuccessfullyMade: 'Spojení úspěšně navázáno!',
|
||||
readOnlyMode: 'Pouze pro čtení',
|
||||
allConnections: 'Všechna připojení',
|
||||
searchForConnections: 'Hledat připojení'
|
||||
searchForConnections: 'Hledat připojení',
|
||||
keepAliveInterval: 'Keep alive interval',
|
||||
singleConnection: 'Jediné spojení'
|
||||
},
|
||||
database: { // Database related terms
|
||||
schema: 'Schéma',
|
||||
type: 'Typ',
|
||||
insert: 'Vložit', // Lawondyss: Not used
|
||||
insert: 'Vložit',
|
||||
indexes: 'Indexy',
|
||||
foreignKeys: 'Cizí klíče',
|
||||
length: 'Délka',
|
||||
unsigned: 'Unsigned',
|
||||
default: 'Výchozí',
|
||||
comment: 'Komentář',
|
||||
key: 'Klíč | Klíče', // Lawondyss: Used only 2
|
||||
key: 'Klíč | Klíče',
|
||||
order: 'Pořadí',
|
||||
expression: 'Výraz',
|
||||
autoIncrement: 'Auto Increment',
|
||||
@@ -119,8 +139,9 @@ export const csCZ = {
|
||||
field: 'Sloupec | Sloupce',
|
||||
approximately: 'Přibližně',
|
||||
total: 'Celkem',
|
||||
table: 'Tabulka | Tabulky', // Lawondyss: Used only without argument
|
||||
view: 'Pohled | Pohledy', // Lawondyss: Used only without argument
|
||||
table: 'Tabulka | Tabulky',
|
||||
view: 'Pohled | Pohledy',
|
||||
materializedview: 'Materializovaný pohled',
|
||||
definer: 'Definér',
|
||||
algorithm: 'Algoritmus',
|
||||
trigger: 'Trigger | Triggery',
|
||||
@@ -147,25 +168,25 @@ export const csCZ = {
|
||||
row: 'Řádek | Řádky',
|
||||
cell: 'Buňka | Buňky',
|
||||
triggerFunction: 'Trigger funkce | Trigger funkce',
|
||||
routine: 'Routina | Routiny', // Lawondyss: Not used
|
||||
routine: 'Routina | Routiny',
|
||||
drop: 'Drop',
|
||||
commit: 'Commit',
|
||||
rollback: 'Rollback',
|
||||
ddl: 'DDL',
|
||||
collation: 'Porovnání',
|
||||
resultsTable: 'Tabulka výsledků',
|
||||
unableEditFieldWithoutPrimary: 'Nelze upravit buňku bez primárního klíče ve výsledku', // Lawondyss: Not used
|
||||
editCell: 'Upravit buňku', // Lawondyss: Not used
|
||||
unableEditFieldWithoutPrimary: 'Nelze upravit buňku bez primárního klíče ve výsledku',
|
||||
editCell: 'Upravit buňku',
|
||||
deleteRows: 'Smazat řádek | Smazat {count} řádků',
|
||||
confirmToDeleteRows: 'Skutečně chcete smazat řádek? | Skutečně chcete smazat {count} řádků?',
|
||||
addNewRow: 'Přidat nový řádek', // Lawondyss: Not used
|
||||
addNewRow: 'Přidat nový řádek',
|
||||
numberOfInserts: 'Počet opakování',
|
||||
affectedRows: 'Ovlivněno řádků',
|
||||
createNewDatabase: 'Vytvořit novou databázi', // Lawondyss: Not used
|
||||
databaseName: 'Název databáze', // Lawondyss: Not use
|
||||
createNewDatabase: 'Vytvořit novou databázi',
|
||||
databaseName: 'Název databáze',
|
||||
serverDefault: 'Porovnání serveru',
|
||||
deleteDatabase: 'Smazat databázi', // Lawondyss: Not used
|
||||
editDatabase: 'Upravit databázi', // Lawondyss: Not used
|
||||
deleteDatabase: 'Smazat databázi',
|
||||
editDatabase: 'Upravit databázi',
|
||||
clearChanges: 'Zrušit změny',
|
||||
addNewField: 'Přidat nový sloupec',
|
||||
manageIndexes: 'Správa indexů',
|
||||
@@ -177,17 +198,18 @@ export const csCZ = {
|
||||
deleteField: 'Smazat sloupec',
|
||||
createNewIndex: 'Vytvořit nový index',
|
||||
addToIndex: 'Přidat do indexu',
|
||||
createNewTable: 'Vytvořit novou databázi', // Lawondyss: Not used
|
||||
createNewTable: 'Vytvořit novou databázi',
|
||||
emptyTable: 'Smazat obsah tabulky',
|
||||
duplicateTable: 'Duplikovat tabulku',
|
||||
deleteTable: 'Smazat tabulku',
|
||||
exportTable: 'Exportovat tabulku',
|
||||
emptyConfirm: 'Skutečně smazat obsah tabulky',
|
||||
thereAreNoIndexes: 'Nemá žádné indexy',
|
||||
thereAreNoForeign: 'Nemá žádné cizí klíče',
|
||||
createNewForeign: 'Vytvořit nový cizí klíč',
|
||||
referenceTable: 'Ref. tabulka',
|
||||
referenceField: 'Ref. sloupec',
|
||||
foreignFields: 'Cizí sloupce', // Lawondyss: Not used
|
||||
foreignFields: 'Cizí sloupce',
|
||||
invalidDefault: 'Neplatná výchozí hodnota',
|
||||
onDelete: 'Při smazání',
|
||||
selectStatement: 'Definice pohledu',
|
||||
@@ -195,7 +217,8 @@ export const csCZ = {
|
||||
sqlSecurity: 'SQL zabezpečení',
|
||||
updateOption: 'Volba aktualizace',
|
||||
deleteView: 'Smazat pohled',
|
||||
createNewView: 'Vytvořit nový pohled', // Lawondyss: Not used
|
||||
createNewView: 'Vytvořit nový pohled',
|
||||
createNewMaterializedView: 'Vytvořit nový materializovaný pohled',
|
||||
deleteTrigger: 'Smazat trigger',
|
||||
createNewTrigger: 'Vytvořit nový trigger',
|
||||
currentUser: 'Současný uživatel',
|
||||
@@ -212,7 +235,7 @@ export const csCZ = {
|
||||
createNewScheduler: 'Vytvořit nový scheduler',
|
||||
deleteScheduler: 'Smazat scheduler',
|
||||
preserveOnCompletion: 'Uchovat po dokončení',
|
||||
tableFiller: 'Vyplňovač tabulky', // Lawondyss: Not used
|
||||
tableFiller: 'Vyplňovač tabulky',
|
||||
fakeDataLanguage: 'Jazyk pro fake data',
|
||||
queryDuration: 'Doba trvání dotazu',
|
||||
setNull: 'Nastavit NULL',
|
||||
@@ -224,10 +247,11 @@ export const csCZ = {
|
||||
editSchema: 'Upravit schéma',
|
||||
deleteSchema: 'Smazat schema',
|
||||
noSchema: 'Bez schématu',
|
||||
runQuery: 'Spustit dotaz', // Lawondyss: Not used
|
||||
runQuery: 'Spustit dotaz',
|
||||
thereAreNoTableFields: 'Nemá žádné sloupce',
|
||||
newTable: 'Nová tabulka',
|
||||
newView: 'Nový pohled',
|
||||
newMaterializedView: 'Nový materializovaný pohled',
|
||||
newTrigger: 'Nový trigger',
|
||||
newRoutine: 'Nová routina',
|
||||
newFunction: 'Nová funkce',
|
||||
@@ -244,17 +268,17 @@ export const csCZ = {
|
||||
writingTableExport: 'Zapisuji data tabulky {table}',
|
||||
checkAllTables: 'Vybrat všechny tabulky',
|
||||
uncheckAllTables: 'Vybrat žádnou tabulku',
|
||||
killQuery: 'Zabít dotaz', // Lawondyss: Not used
|
||||
insertRow: 'Vložit řádek | Vložit řádky', // Lawondyss: Used only 2
|
||||
killQuery: 'Zabít dotaz',
|
||||
insertRow: 'Vložit řádek | Vložit řádky',
|
||||
commitMode: 'Způsob commitování',
|
||||
autoCommit: 'Auto commit',
|
||||
manualCommit: 'Ruční commit',
|
||||
importQueryErrors: 'Varování: došlo k chybě {n} | Varování: došlo k chybám {n}', // Lawondyss: Used without n argument
|
||||
executedQueries: '{n} dotaz spuštěn | {n} dotazy spuštěny', // Lawondyss: Used withoum n argument
|
||||
importQueryErrors: 'Varování: došlo k chybě {n} | Varování: došlo k chybám {n}',
|
||||
executedQueries: '{n} dotaz spuštěn | {n} dotazy spuštěny',
|
||||
disableFKChecks: 'Vypnout kontrolu cizích klíčů',
|
||||
formatQuery: 'Formátovat dotaz', // Lawondyss: Not used, probably duplicate to general.format
|
||||
queryHistory: 'Historie dotazů', // Lawondyss: Not used, probably duplicate to general.history
|
||||
clearQuery: 'Clear query', // Lawondyss: Not used, probably duplicate to general.clear
|
||||
formatQuery: 'Formátovat dotaz',
|
||||
queryHistory: 'Historie dotazů',
|
||||
clearQuery: 'Clear query',
|
||||
fillCell: 'Vyplnit buňku',
|
||||
executeSelectedQuery: 'Spustit vybraný dotaz',
|
||||
noResultsPresent: 'Nejsou k dispozici žádné výsledky',
|
||||
@@ -262,12 +286,11 @@ export const csCZ = {
|
||||
targetTable: 'Cílová tabulka',
|
||||
switchDatabase: 'Přepnout databázi',
|
||||
searchForElements: 'Vyhledávání prvků',
|
||||
searchForSchemas: 'Vyhledávání schémat'
|
||||
searchForSchemas: 'Vyhledávání schémat',
|
||||
savedQueries: 'Uložit dotazy'
|
||||
},
|
||||
application: { // Application related terms
|
||||
settings: 'Nastavení',
|
||||
scratchpad: 'Zápisník',
|
||||
disableScratchpad: 'Vypnout zápisník',
|
||||
console: 'Konzole',
|
||||
general: 'Obecné',
|
||||
themes: 'Motivy',
|
||||
@@ -275,7 +298,7 @@ export const csCZ = {
|
||||
about: 'Informace',
|
||||
language: 'Jazyk',
|
||||
shortcuts: 'Zkratky',
|
||||
key: 'Klávesa | Klávesy', // Keyboard key // Lawondyss: Usedn only 2
|
||||
key: 'Klávesa | Klávesy', // Keyboard key
|
||||
event: 'Akce',
|
||||
light: 'Světlý',
|
||||
dark: 'Tmavý',
|
||||
@@ -283,13 +306,19 @@ export const csCZ = {
|
||||
application: 'Aplikace',
|
||||
editor: 'Editor',
|
||||
changelog: 'Changelog',
|
||||
small: 'Malé', // Lawondyss: Not used, probably obsolete font size settings
|
||||
medium: 'Střední', // Lawondyss: Not used, probably obsolete font size settings
|
||||
large: 'Velké', // Lawondyss: Not used, probably obsolete font size settings
|
||||
small: 'Malé',
|
||||
medium: 'Střední',
|
||||
large: 'Velké',
|
||||
appearance: 'Vzhled',
|
||||
color: 'Barva',
|
||||
label: 'Název',
|
||||
icon: 'Ikona',
|
||||
customIcon: 'Vlastní ikona',
|
||||
fileName: 'Soubor',
|
||||
choseFile: 'Vybrat soubor',
|
||||
data: 'Data',
|
||||
password: 'Heslo',
|
||||
required: 'Povinné',
|
||||
madeWithJS: 'Vytvořeno s 💛 a JavaScriptem!',
|
||||
checkForUpdates: 'Zkontrolovat aktualizace',
|
||||
noUpdatesAvailable: 'Žádné dostupné aktualizace',
|
||||
@@ -308,7 +337,7 @@ export const csCZ = {
|
||||
editorTheme: 'Motiv editoru',
|
||||
wrapLongLines: 'Zalamovat dlouhé řádky',
|
||||
markdownSupported: 'Podporován Markdown',
|
||||
plantATree: 'Zasaďte strom', // Lawondyss: Not used
|
||||
plantATree: 'Zasaďte strom',
|
||||
dataTabPageSize: 'Počet řádků na stránku',
|
||||
noOpenTabs: 'Žádné otevřené karty, vyberte z elementů vlevo nebo:',
|
||||
restorePreviousSession: 'Pamatovat si otevřené karty',
|
||||
@@ -333,15 +362,16 @@ export const csCZ = {
|
||||
saveContent: 'Uložit obsah',
|
||||
openAllConnections: 'Otevřít všechna připojení',
|
||||
openSettings: 'Otevřít nastavení',
|
||||
openScratchpad: 'Otevřít zápisník',
|
||||
runOrReload: 'Spustit dotaz',
|
||||
openFilter: 'Otevřít filtr',
|
||||
nextResultsPage: 'Další stránka výsledků',
|
||||
previousResultsPage: 'Předešlá stránka výsledků',
|
||||
editFolder: 'Upravit složku',
|
||||
folderName: 'Název složky',
|
||||
deleteFolder: 'Smazat složku', // Lawondyss: Not used
|
||||
editConnectionAppearance: 'Upravit vzhled připojení', // Lawondyss: Not used
|
||||
deleteFolder: 'Smazat složku',
|
||||
newFolder: 'Nová složka',
|
||||
outOfFolder: 'Mimo složku',
|
||||
editConnectionAppearance: 'Upravit vzhled připojení',
|
||||
defaultCopyType: 'Výchozí typ kopírování',
|
||||
showTableSize: 'Velikost tabulky v panelu',
|
||||
showTableSizeDescription: 'Pouze MySQL/MariaDB. Povolení této možnosti může ovlivnit výkon u schémat s mnoha tabulkami.',
|
||||
@@ -356,7 +386,33 @@ export const csCZ = {
|
||||
csvStringDelimiter: 'Obalit text',
|
||||
csvIncludeHeader: 'Včetně hlavičky',
|
||||
csvExportOptions: 'Možnosti CSV exportu',
|
||||
scratchPadDefaultValue: '# JAK PODPOŘIT ANTARES\n\n- [ ] Dát Antares hvězdičku [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Poslat názor či radu\n- [ ] Nahlásit chybu\n- [ ] Pokud se líbí, sdílet Antares s přáteli\n\n# O ZÁPISNÍKU\n\nToto je zápisník, který uchovává vaše **osobní poznámky**. Podporuje `markdown` formát, ale můžete použít obyčejný text.\nTento obsah je pouze ukázky, neváhejte ho smazat, abyste si udělali místo na poznámky.\n'
|
||||
exportData: 'Exportovat data',
|
||||
exportDataExplanation: 'Export uložených připojení v Antaresu. Budete požádáni o zadání hesla pro zašifrování exportovaného souboru.',
|
||||
importData: 'Importovat data',
|
||||
importDataExplanation: 'Importuje soubor .antares obsahující připojení. Je třeba zadat heslo definované při exportu.',
|
||||
includeConnectionPasswords: 'Včetně hesel připojení',
|
||||
includeFolders: 'Včetně složek',
|
||||
encryptionPassword: 'Heslo pro zašifrování souboru',
|
||||
encryptionPasswordError: 'Heslo musí mít alespoň 8 znaků.',
|
||||
ignoreDuplicates: 'Ignorovat duplicity',
|
||||
wrongImportPassword: 'Chybné heslo pro import',
|
||||
wrongFileFormat: 'Chybný formát souboru',
|
||||
dataImportSuccess: 'Data úspěšně importována',
|
||||
note: 'Poznámka',
|
||||
thereAreNoNotesYet: 'Zatím tu nejsou žádné poznámky',
|
||||
addNote: 'Přidat poznámku',
|
||||
editNote: 'Upravit poznámku',
|
||||
saveAsNote: 'Uložit jako poznámku',
|
||||
showArchivedNotes: 'Zobrazit archivované poznámky',
|
||||
hideArchivedNotes: 'Skrýt archivované poznámky',
|
||||
tag: 'Tag', // Note tag
|
||||
saveFile: 'Uložit soubor',
|
||||
saveFileAs: 'Uložit do nového souboru',
|
||||
openFile: 'Otevřít soubor',
|
||||
openNotes: 'Otevřít poznámky',
|
||||
debugConsole: 'Debug konzole', // <- console tab name
|
||||
executedQueries: 'Log dotazů', // <- console tab name
|
||||
sizeLimitError: 'Maximální velikost {size} překročena'
|
||||
},
|
||||
faker: { // Faker.js methods, used in random generated content
|
||||
address: 'Address',
|
||||
|
@@ -140,6 +140,7 @@ export const enUS = {
|
||||
total: 'Total',
|
||||
table: 'Table | Tables',
|
||||
view: 'View | Views',
|
||||
materializedview: 'Materialized view | Materialized views',
|
||||
definer: 'Definer',
|
||||
algorithm: 'Algorithm',
|
||||
trigger: 'Trigger | Triggers',
|
||||
@@ -216,6 +217,7 @@ export const enUS = {
|
||||
updateOption: 'Update option',
|
||||
deleteView: 'Delete view',
|
||||
createNewView: 'Create new view',
|
||||
createNewMaterializedView: 'Create new materialized view',
|
||||
deleteTrigger: 'Delete trigger',
|
||||
createNewTrigger: 'Create new trigger',
|
||||
currentUser: 'Current user',
|
||||
@@ -248,6 +250,7 @@ export const enUS = {
|
||||
thereAreNoTableFields: 'There are no table fields',
|
||||
newTable: 'New table',
|
||||
newView: 'New view',
|
||||
newMaterializedView: 'New materialized view',
|
||||
newTrigger: 'New trigger',
|
||||
newRoutine: 'New routine',
|
||||
newFunction: 'New function',
|
||||
@@ -309,6 +312,7 @@ export const enUS = {
|
||||
color: 'Color',
|
||||
label: 'Label',
|
||||
icon: 'Icon',
|
||||
customIcon: 'Custom icon',
|
||||
fileName: 'File name',
|
||||
choseFile: 'Choose file',
|
||||
data: 'Data',
|
||||
@@ -397,9 +401,17 @@ export const enUS = {
|
||||
thereAreNoNotesYet: 'There are no notes yet',
|
||||
addNote: 'Add note',
|
||||
editNote: 'Edit note',
|
||||
saveAsNote: 'Save as note',
|
||||
showArchivedNotes: 'Show archived notes',
|
||||
hideArchivedNotes: 'Hide archived notes',
|
||||
tag: 'Tag' // Note tag
|
||||
tag: 'Tag', // Note tag,
|
||||
saveFile: 'Save file',
|
||||
saveFileAs: 'Save file as',
|
||||
openFile: 'Open file',
|
||||
openNotes: 'Open notes',
|
||||
debugConsole: 'Debug console', // <- console tab name
|
||||
executedQueries: 'Executed queries', // <- console tab name
|
||||
sizeLimitError: 'Maximum size of {size} exceeded'
|
||||
},
|
||||
faker: { // Faker.js methods, used in random generated content
|
||||
address: 'Address',
|
||||
|
@@ -46,6 +46,8 @@ export type AvailableLocale = keyof typeof messages
|
||||
|
||||
const i18n = createI18n<[NestedPartial<MessageSchema>], AvailableLocale>({
|
||||
fallbackLocale: 'en-US',
|
||||
silentTranslationWarn: true,
|
||||
silentFallbackWarn: true,
|
||||
allowComposition: true,
|
||||
messages
|
||||
});
|
||||
|
@@ -4,106 +4,145 @@ export const jaJP = {
|
||||
save: '保存',
|
||||
close: '閉じる',
|
||||
delete: '削除',
|
||||
confirm: '確認',
|
||||
confirm: '確定',
|
||||
cancel: 'キャンセル',
|
||||
send: '送信',
|
||||
refresh: 'リフレッシュ',
|
||||
autoRefresh: 'オートリフレシュ',
|
||||
autoRefresh: '自動リフレッシュ',
|
||||
version: 'バージョン',
|
||||
donate: '寄付する',
|
||||
donate: '寄付',
|
||||
run: '実行',
|
||||
results: '結果',
|
||||
size: 'サイズ',
|
||||
mimeType: 'マイムタイプ',
|
||||
mimeType: 'MIME タイプ',
|
||||
download: 'ダウンロード',
|
||||
add: '追加',
|
||||
data: 'データ',
|
||||
properties: 'プロパティ',
|
||||
insert: '挿入',
|
||||
name: '名称',
|
||||
name: '名前',
|
||||
clear: 'クリア',
|
||||
seconds: '秒数',
|
||||
options: 'オプション',
|
||||
insert: '挿入',
|
||||
discard: '破棄',
|
||||
stay: 'ステイ',
|
||||
author: '作者',
|
||||
stay: '留まる',
|
||||
author: '作成者',
|
||||
upload: 'アップロード',
|
||||
browse: '閲覧',
|
||||
content: 'コンテンツ',
|
||||
cut: 'カット',
|
||||
browse: '参照',
|
||||
content: '内容',
|
||||
cut: '切り取り',
|
||||
copy: 'コピー',
|
||||
paste: '貼り付け',
|
||||
duplicate: '複製',
|
||||
tools: 'ツール',
|
||||
format: 'フォーマット',
|
||||
seconds: '秒',
|
||||
all: 'すべて',
|
||||
duplicate: 'デュプリケート',
|
||||
history: '履歴',
|
||||
new: '新規',
|
||||
select: '選択',
|
||||
deleteConfirm: 'のキャンセルを確認しますか?',
|
||||
change: '変更',
|
||||
include: '含める',
|
||||
includes: '含める',
|
||||
completed: '完了しました',
|
||||
aborted: '中断しました',
|
||||
disabled: '無効',
|
||||
enable: '有効化',
|
||||
disable: '無効化',
|
||||
contributors: 'コントリビューター',
|
||||
pin: '固定',
|
||||
unpin: '固定を解除',
|
||||
folder: 'フォルダー | フォルダー',
|
||||
none: 'なし',
|
||||
singleQuote: 'シングルクォート',
|
||||
doubleQuote: 'ダブルクォート',
|
||||
deleteConfirm: '次の要素を抹消します。確定しますか?',
|
||||
uploadFile: 'ファイルのアップロード',
|
||||
format: 'フォーマット',
|
||||
history: '履歴',
|
||||
filter: 'フィルタ',
|
||||
manualValue: 'マニュアル値',
|
||||
selectAll: 'すべてを選択する',
|
||||
pageNumber: 'ページ番号'
|
||||
selectAll: 'すべて選択',
|
||||
pageNumber: 'ページ番号',
|
||||
directoryPath: 'ディレクトリパス',
|
||||
actionSuccessful: '{action} 成功',
|
||||
outputFormat: '出力フォーマット',
|
||||
singleFile: '単一の {ext} ファイル',
|
||||
zipCompressedFile: 'ZIP 圧縮済の {ext} ファイル',
|
||||
copyName: '名前をコピー',
|
||||
search: '検索',
|
||||
title: 'タイトル',
|
||||
archive: 'アーカイブ',
|
||||
undo: '元に戻す',
|
||||
moveTo: '移動'
|
||||
},
|
||||
connection: {
|
||||
connection: '接続',
|
||||
connectionName: '接続名',
|
||||
client: 'クライアント',
|
||||
hostName: 'ホスト名',
|
||||
client: 'クライアント',
|
||||
port: 'ポート',
|
||||
user: 'ユーザー名',
|
||||
password: 'パスワード',
|
||||
credentials: '認証情報',
|
||||
connect: '接続',
|
||||
connected: '接続中',
|
||||
disconnect: '接続解除',
|
||||
disconnected: '接続解除',
|
||||
connected: '接続済',
|
||||
disconnect: '切断',
|
||||
disconnected: '切断済',
|
||||
ssl: 'SSL',
|
||||
enableSsl: 'SSL を有効化',
|
||||
privateKey: '秘密鍵',
|
||||
certificate: '証明書',
|
||||
caCertificate: 'CA 証明書',
|
||||
ciphers: '暗号',
|
||||
ciphers: '暗号化アルゴリズム',
|
||||
untrustedConnection: '信頼できない接続',
|
||||
passphrase: 'パスフレーズ',
|
||||
sshTunnel: 'SSH トンネル',
|
||||
addConnection: '接続の追加',
|
||||
createConnection: '接続の作成',
|
||||
createNewConnection: '新しい接続の作成',
|
||||
askCredentials: '認証情報の入力',
|
||||
testConnection: '接続のテスト',
|
||||
editConnection: '接続の編集',
|
||||
deleteConnection: '接続の削除',
|
||||
enableSsh: 'SSH を有効化',
|
||||
connectionString: '接続文字列',
|
||||
addConnection: '接続を追加',
|
||||
createConnection: '接続を作成',
|
||||
createNewConnection: '新規接続の作成',
|
||||
askCredentials: '認証情報を接続時に尋ねる',
|
||||
testConnection: '接続をテスト',
|
||||
editConnection: '接続を編集',
|
||||
deleteConnection: '接続を削除',
|
||||
connectionSuccessfullyMade: '接続に成功しました。',
|
||||
enableSsl: 'SSL 対応',
|
||||
enableSsh: 'SSH を有効にする'
|
||||
readOnlyMode: '読み取り専用モード',
|
||||
allConnections: 'すべての接続',
|
||||
searchForConnections: '接続を検索',
|
||||
keepAliveInterval: 'Keep alive 間隔',
|
||||
singleConnection: '単一接続'
|
||||
},
|
||||
database: {
|
||||
schema: 'スキーマ',
|
||||
type: 'タイプ',
|
||||
type: '型',
|
||||
insert: '挿入',
|
||||
indexes: 'インデックス',
|
||||
foreignKeys: '外部キー',
|
||||
length: '長さ',
|
||||
unsigned: '符号なし',
|
||||
default: 'デフォルト',
|
||||
default: 'デフォルト値',
|
||||
comment: 'コメント',
|
||||
collation: '照合',
|
||||
key: 'キー | キー',
|
||||
order: '順序',
|
||||
expression: '表現',
|
||||
autoIncrement: 'オートインクリメント',
|
||||
expression: '式',
|
||||
autoIncrement: '自動インクリメント',
|
||||
engine: 'エンジン',
|
||||
field: 'フィールド | フィールド',
|
||||
approximately: '約',
|
||||
total: '合計',
|
||||
table: 'テーブル',
|
||||
view: 'ビュー',
|
||||
indexes: 'インデックス',
|
||||
definer: 'デファイナー',
|
||||
algorithm: 'アルゴリズム',
|
||||
trigger: 'トリガー | トリガー',
|
||||
storedRoutine: 'ストアド・ルーチン | ストアド・ルーチン',
|
||||
scheduler: 'スケジューラー | スケジューラー',
|
||||
event: 'イベント',
|
||||
parameters: 'パラメータ',
|
||||
parameters: 'パラメーター',
|
||||
function: '関数 | 関数',
|
||||
deterministic: '決定論的',
|
||||
context: 'コンテキスト',
|
||||
export: 'エクスポート',
|
||||
import: 'インポート',
|
||||
returns: '戻り値',
|
||||
timing: 'タイミング',
|
||||
state: '状態',
|
||||
@@ -115,128 +154,249 @@ export const jaJP = {
|
||||
database: 'データベース',
|
||||
array: '配列',
|
||||
structure: '構造',
|
||||
row: 'ロウ | ロウ',
|
||||
row: '行 | 行',
|
||||
cell: 'セル | セル',
|
||||
triggerFunction: 'トリガー関数 | トリガー関数',
|
||||
routine: 'ルーチン',
|
||||
unableEditFieldWithoutPrimary: '主キーのないフィールドを結果セットで編集できない',
|
||||
editCell: 'セルの編集',
|
||||
deleteRows: '行の削除 | {count} 行の削除',
|
||||
confirmToDeleteRows: '1つの行を削除することを確認しますか? | {count} 行を削除することを確認しますか?',
|
||||
addNewRow: '新しい行の追加',
|
||||
numberOfInserts: 'インサート数',
|
||||
drop: 'ドロップ',
|
||||
commit: 'コミット',
|
||||
rollback: 'ロールバック',
|
||||
ddl: 'DDL',
|
||||
collation: '照合',
|
||||
resultsTable: '結果テーブル',
|
||||
unableEditFieldWithoutPrimary: '結果セットでは主キーのないフィールドを編集できません',
|
||||
editCell: 'セルを編集',
|
||||
deleteRows: '行を削除 | {count} 行を削除',
|
||||
confirmToDeleteRows: '行を削除します。確定しますか? | {count} 行を削除します。確定しますか?',
|
||||
addNewRow: '行を新規追加',
|
||||
numberOfInserts: '挿入レコード数',
|
||||
affectedRows: '影響を受ける行',
|
||||
createNewDatabase: '新規データベースの作成',
|
||||
databaseName: 'データベース名',
|
||||
serverDefault: 'サーバーのデフォルト',
|
||||
deleteDatabase: 'データベースの削除',
|
||||
editDatabase: 'データベースの編集',
|
||||
clearChanges: '変更の消去',
|
||||
addNewField: '新しいフィールドの追加',
|
||||
deleteDatabase: 'データベースを削除',
|
||||
editDatabase: 'データベースを編集',
|
||||
clearChanges: '変更をクリア',
|
||||
addNewField: '新規フィールドを追加',
|
||||
manageIndexes: 'インデックスの管理',
|
||||
manageForeignKeys: '外部キーの管理',
|
||||
allowNull: 'NULL を許可する',
|
||||
zeroFill: 'ゼロフィル',
|
||||
allowNull: 'NULL を許可',
|
||||
zeroFill: 'ゼロ埋め',
|
||||
customValue: 'カスタム値',
|
||||
onUpdate: '更新時',
|
||||
deleteField: 'フィールドの削除',
|
||||
createNewIndex: '新しいインデックスの作成',
|
||||
addToIndex: 'インデックスへの追加',
|
||||
createNewTable: '新しいテーブルの作成',
|
||||
emptyTable: '空のテーブル',
|
||||
deleteTable: 'テーブルの削除',
|
||||
emptyConfirm: '空にすることを確認しますか?',
|
||||
thereAreNoIndexes: 'インデックスがありません',
|
||||
onUpdate: 'ON UPDATE',
|
||||
deleteField: 'フィールドを削除',
|
||||
createNewIndex: '新規インデックスの作成',
|
||||
addToIndex: 'インデックスに追加',
|
||||
createNewTable: '新規テーブルの作成',
|
||||
emptyTable: 'テーブルを空にする',
|
||||
duplicateTable: 'テーブルを複製',
|
||||
deleteTable: 'テーブルを削除',
|
||||
exportTable: 'テーブルをエクスポート',
|
||||
emptyConfirm: 'テーブルを空にします。確定しますか?',
|
||||
thereAreNoIndexes: 'インデックスがありません。',
|
||||
thereAreNoForeign: '外部キーがありません。',
|
||||
createNewForeign: '新しい外部キーの作成',
|
||||
createNewForeign: '新規外部キーの作成',
|
||||
referenceTable: '参照テーブル',
|
||||
referenceField: '参照フィールド',
|
||||
foreignFields: '外部フィールド',
|
||||
invalidDefault: '無効なデフォルト',
|
||||
onDelete: '削除時',
|
||||
selectStatement: '選択文',
|
||||
invalidDefault: '無効なデフォルト値',
|
||||
onDelete: 'ON DELETE',
|
||||
selectStatement: 'SELECT 文',
|
||||
triggerStatement: 'トリガー文',
|
||||
sqlSecurity: 'SQL セキュリティ',
|
||||
updateOption: '更新オプション',
|
||||
deleteView: 'ビューの削除',
|
||||
createNewView: '新規ビューの作成',
|
||||
deleteTrigger: 'トリガーの削除',
|
||||
createNewTrigger: '新しいトリガの作成',
|
||||
deleteTrigger: 'トリガーを削除',
|
||||
createNewTrigger: '新規トリガーの作成',
|
||||
currentUser: '現在のユーザー',
|
||||
routineBody: 'ルーチン本体',
|
||||
routineBody: 'ルーチンの本体',
|
||||
dataAccess: 'データアクセス',
|
||||
thereAreNoParameters: 'パラメータはありません',
|
||||
createNewParameter: '新しいパラメータの作成',
|
||||
createNewRoutine: 'ストアド・ルーチンの新規作成',
|
||||
thereAreNoParameters: 'パラメーターがありません',
|
||||
createNewParameter: '新規パラメータの作成',
|
||||
createNewRoutine: '新規ストアド・ルーチンの作成',
|
||||
deleteRoutine: 'ストアド・ルーチンの削除',
|
||||
functionBody: '関数本体',
|
||||
createNewFunction: '新しい関数の作成',
|
||||
deleteFunction: '関数の削除',
|
||||
schedulerBody: 'スケジューラ本体',
|
||||
createNewScheduler: 'スケジューラの新規作成',
|
||||
deleteScheduler: 'スケジューラの削除',
|
||||
functionBody: '関数の本体',
|
||||
createNewFunction: '新規関数の作成',
|
||||
deleteFunction: '関数を削除',
|
||||
schedulerBody: 'スケジューラの本体',
|
||||
createNewScheduler: '新規スケジューラの作成',
|
||||
deleteScheduler: 'スケジューラを削除',
|
||||
preserveOnCompletion: '完了時に保存する',
|
||||
tableFiller: 'テーブルフィラー',
|
||||
fakeDataLanguage: 'フェイクデータの言語',
|
||||
queryDuration: '問い合わせ期間',
|
||||
queryDuration: 'クエリ実行時間',
|
||||
setNull: 'NULL の設定',
|
||||
processesList: 'プロセス一覧',
|
||||
processInfo: 'プロセス情報',
|
||||
manageUsers: 'ユーザーの管理',
|
||||
createNewSchema: '新しいスキーマの作成',
|
||||
createNewSchema: '新規スキーマの作成',
|
||||
schemaName: 'スキーマ名',
|
||||
editSchema: 'スキーマの編集',
|
||||
deleteSchema: 'スキーマの削除',
|
||||
duplicateTable: 'テーブルを複製する',
|
||||
editSchema: 'スキーマを編集',
|
||||
deleteSchema: 'スキーマを削除',
|
||||
noSchema: 'スキーマなし',
|
||||
runQuery: 'クエリの実行',
|
||||
thereAreNoTableFields: 'テーブルのフィールドがありません',
|
||||
newTable: '新しいテーブル',
|
||||
newView: '新しいビュー',
|
||||
newTrigger: '新しいトリガー',
|
||||
newRoutine: '新しいルーチン',
|
||||
newFunction: '新しい関数',
|
||||
runQuery: 'クエリを実行',
|
||||
thereAreNoTableFields: 'テーブルにフィールドがありません。',
|
||||
newTable: '新規テーブル',
|
||||
newView: '新規ビュー',
|
||||
newTrigger: '新規トリガー',
|
||||
newRoutine: '新規ルーチン',
|
||||
newFunction: '新規関数',
|
||||
newScheduler: '新規スケジューラ',
|
||||
newTriggerFunction: '新しいトリガー機能',
|
||||
thereAreNoQueriesYet: 'まだ問い合わせはありません',
|
||||
newTriggerFunction: '新規トリガー機能',
|
||||
thereAreNoQueriesYet: 'クエリはまだありません。',
|
||||
searchForQueries: 'クエリの検索',
|
||||
killProcess: 'プロセスの停止'
|
||||
killProcess: 'プロセスの停止',
|
||||
exportSchema: 'スキーマをエクスポート',
|
||||
importSchema: 'スキーマをインポート',
|
||||
newInsertStmtEvery: 'それぞれに新しい INSERT 文',
|
||||
processingTableExport: '{table} を処理中',
|
||||
fetchingTableExport: '{table} のデータを取得中',
|
||||
writingTableExport: '{table} のデータを書き込み中',
|
||||
checkAllTables: 'すべてのテーブルを選択',
|
||||
uncheckAllTables: 'すべてのテーブルの選択を解除',
|
||||
killQuery: 'クエリを終了',
|
||||
insertRow: '行を挿入 | 行を挿入',
|
||||
commitMode: 'コミットモード',
|
||||
autoCommit: '自動コミット',
|
||||
manualCommit: '手動コミット',
|
||||
importQueryErrors: '警告: {n} 個のエラーが発生しました。 | 警告: {n} 個のエラーが発生しました。',
|
||||
executedQueries: '{n} 個のクエリを実行しました。 | {n} 個のクエリを実行しました。',
|
||||
disableFKChecks: '外部キーのチェックを無効化',
|
||||
formatQuery: 'クエリをフォーマット',
|
||||
queryHistory: 'クエリ履歴',
|
||||
clearQuery: 'クエリをクリア',
|
||||
fillCell: 'セルを埋める',
|
||||
executeSelectedQuery: '選択されたクエリを実行',
|
||||
noResultsPresent: '結果がありません。',
|
||||
sqlExportOptions: 'SQL エクスポートオプション',
|
||||
targetTable: '対象テーブル',
|
||||
switchDatabase: 'データベースを切り替え',
|
||||
searchForElements: '要素を検索',
|
||||
searchForSchemas: 'スキーマを検索',
|
||||
savedQueries: '保存済のクエリ'
|
||||
},
|
||||
application: {
|
||||
settings: '設定',
|
||||
console: 'コンソール',
|
||||
general: '一般',
|
||||
themes: 'テーマ',
|
||||
update: '更新情報',
|
||||
update: '更新',
|
||||
about: 'About',
|
||||
language: '言語',
|
||||
shortcuts: 'ショートカット',
|
||||
key: 'キー | キー', // キーボードのキー
|
||||
event: 'イベント',
|
||||
light: 'ライト',
|
||||
dark: 'ダーク',
|
||||
autoCompletion: 'オートコンプリート',
|
||||
application: 'アプリケーション',
|
||||
editor: 'エディター',
|
||||
scratchpad: 'スクラッチパッド',
|
||||
changelog: '変更履歴',
|
||||
madeWithJS: '💛 と JavaScript で作られています。',
|
||||
checkForUpdates: '更新情報の確認',
|
||||
noUpdatesAvailable: 'アップデートがありません',
|
||||
checkingForUpdate: 'アップデートを確認中',
|
||||
checkFailure: 'チェックに失敗しました、後で試してください',
|
||||
updateAvailable: 'アップデートが利用可能です',
|
||||
downloadingUpdate: 'アップデートのダウンロード',
|
||||
updateDownloaded: 'アップデートのダウンロード',
|
||||
restartToInstall: 'Antares を再起動してインストールしてください',
|
||||
small: '小',
|
||||
medium: '中',
|
||||
large: '大',
|
||||
appearance: '外観',
|
||||
color: '色',
|
||||
label: 'ラベル',
|
||||
icon: 'アイコン',
|
||||
fileName: 'ファイル名',
|
||||
choseFile: 'ファイルを選択',
|
||||
data: 'データ',
|
||||
password: 'パスワード',
|
||||
required: '必須',
|
||||
madeWithJS: '💛 と JavaScript で作られています!',
|
||||
checkForUpdates: '更新を確認',
|
||||
noUpdatesAvailable: '更新はありません。',
|
||||
checkingForUpdate: '更新を確認中',
|
||||
checkFailure: 'チェックに失敗しました、後で試してください。',
|
||||
updateAvailable: '更新が利用可能です。',
|
||||
downloadingUpdate: '更新をダウンロード中',
|
||||
updateDownloaded: '更新をダウンロード済',
|
||||
restartToInstall: 'Antares を再起動してインストールしてください。',
|
||||
includeBetaUpdates: 'ベータ版アップデートを含む',
|
||||
notificationsTimeout: '通知のタイムアウト',
|
||||
openNewTab: '新しいタブを開く',
|
||||
unsavedChanges: '保存されていない変更',
|
||||
discardUnsavedChanges: '保存されていない変更があります。このタブを閉じると、これらの変更は破棄されます。',
|
||||
applicationTheme: 'アプリケーションテーマ',
|
||||
editorTheme: 'エディターテーマ',
|
||||
wrapLongLines: '長い行の折り返し',
|
||||
includeBetaUpdates: 'ベータ版アップデートを含む',
|
||||
markdownSupported: 'マークダウン対応',
|
||||
applicationTheme: 'アプリケーションのテーマ',
|
||||
editorTheme: 'エディターのテーマ',
|
||||
wrapLongLines: '長い行を折り返す',
|
||||
markdownSupported: 'Markdown をサポートしています。',
|
||||
plantATree: '木を植える',
|
||||
dataTabPageSize: 'DATA タブのページサイズ',
|
||||
noOpenTabs: '開いているタブがありません。左のバーでナビゲートするか',
|
||||
noOpenTabs: '開いているタブがありません。',
|
||||
restorePreviousSession: '前のセッションに戻す',
|
||||
searchForElements: '要素の検索'
|
||||
closeTab: 'タブを閉じる',
|
||||
goToDownloadPage: 'ダウンロードページへ移動',
|
||||
disableBlur: 'ぼかしを無効化',
|
||||
missingOrIncompleteTranslation: '翻訳が不足しているか、または不完全ですか?',
|
||||
findOutHowToContribute: 'コントリビュートの方法を調べる',
|
||||
reportABug: 'バグを報告',
|
||||
nextTab: '次のタブ',
|
||||
previousTab: '前のタブ',
|
||||
selectTabNumber: 'タブ番号を選択 {param}',
|
||||
toggleConsole: 'コンソールを切り替え',
|
||||
addShortcut: 'ショートカットを追加',
|
||||
editShortcut: 'ショートカットを編集',
|
||||
deleteShortcut: 'ショートカットを削除',
|
||||
restoreDefaults: 'デフォルトに戻す',
|
||||
restoreDefaultsQuestion: 'デフォルト値に戻します。確定しますか?',
|
||||
registerAShortcut: 'ショートカットを登録',
|
||||
invalidShortcutMessage: '無効な組み合わせです、続けて入力してください。',
|
||||
shortcutAlreadyExists: 'ショートカットが既に存在します。',
|
||||
saveContent: '内容を保存',
|
||||
openAllConnections: 'すべての接続を開く',
|
||||
openSettings: '設定を開く',
|
||||
runOrReload: '実行またはリロード',
|
||||
openFilter: 'フィルタを開く',
|
||||
nextResultsPage: '次の結果ページ',
|
||||
previousResultsPage: '前の結果ページ',
|
||||
editFolder: 'フォルダーを編集',
|
||||
folderName: 'フォルダー名',
|
||||
deleteFolder: 'フォルダーを削除',
|
||||
newFolder: '新規フォルダー',
|
||||
outOfFolder: 'フォルダーの外',
|
||||
editConnectionAppearance: '接続の外観を編集',
|
||||
defaultCopyType: 'デフォルトのコピータイプ',
|
||||
showTableSize: 'サイドバーにテーブルのサイズを表示',
|
||||
showTableSizeDescription: 'MySQL/MariaDB のみ。このオプションを有効にすると、多数のテーブルを持つスキーマのパフォーマンスに影響を与える可能性があります。',
|
||||
switchSearchMethod: '検索方法を切り替え',
|
||||
phpArray: 'PHP 配列',
|
||||
closeAllTabs: 'すべてのタブを閉じる',
|
||||
closeOtherTabs: '他のタブを閉じる',
|
||||
closeTabsToLeft: '左のタブを閉じる',
|
||||
closeTabsToRight: '右のタブを閉じる',
|
||||
csvFieldDelimiter: 'フィールドの区切り文字',
|
||||
csvLinesTerminator: '行の終端',
|
||||
csvStringDelimiter: '文字列の区切り文字',
|
||||
csvIncludeHeader: 'ヘッダを含める',
|
||||
csvExportOptions: 'CSV エクスポートオプション',
|
||||
exportData: 'データをエクスポート',
|
||||
exportDataExplanation: 'Anteras に保存された接続をエクスポートします。エクスポートされたファイルを暗号化するためのパスワードが要求されます。',
|
||||
importData: 'データをインポート',
|
||||
importDataExplanation: '接続を含む .antares ファイルをインポートします。エクスポート時に定義したパスワードを入力する必要があります。',
|
||||
includeConnectionPasswords: '接続パスワードを含める',
|
||||
includeFolders: 'フォルダーを含める',
|
||||
encryptionPassword: '暗号化パスワード',
|
||||
encryptionPasswordError: '暗号化パスワードは8文字以上でなければなりません。',
|
||||
ignoreDuplicates: '重複を無視',
|
||||
wrongImportPassword: 'インポートパスワードが誤っています。',
|
||||
wrongFileFormat: 'ファイルフォーマットが誤っています。',
|
||||
dataImportSuccess: 'データのインポートに成功しました。',
|
||||
note: 'ノート | ノート',
|
||||
thereAreNoNotesYet: 'ノートはまだありません。',
|
||||
addNote: 'ノートを追加',
|
||||
editNote: 'ノートを編集',
|
||||
saveAsNote: 'ノートとして保存',
|
||||
showArchivedNotes: 'アーカイブ済のノートを表示',
|
||||
hideArchivedNotes: 'アーカイブ済のノートを非表示',
|
||||
tag: 'タグ', // ノートのタグ
|
||||
saveFile: 'ファイルを保存',
|
||||
saveFileAs: 'ファイルを別名で保存',
|
||||
openFile: 'ファイルを開く',
|
||||
openNotes: 'ノートを開く'
|
||||
|
||||
},
|
||||
faker: {
|
||||
address: '住所',
|
||||
@@ -245,42 +405,42 @@ export const jaJP = {
|
||||
database: 'データベース',
|
||||
date: '日付',
|
||||
finance: 'ファイナンス',
|
||||
// git: 'ギット',
|
||||
git: 'Git',
|
||||
hacker: 'ハッカー',
|
||||
internet: 'インターネット',
|
||||
// lorem: 'ローレム',
|
||||
lorem: 'Lorem',
|
||||
name: '名前',
|
||||
music: '音楽',
|
||||
phone: '電話',
|
||||
random: 'ランダム',
|
||||
system: 'システム',
|
||||
time: '時間',
|
||||
vehicle: '車',
|
||||
vehicle: '車両',
|
||||
zipCode: '郵便番号',
|
||||
zipCodeByState: '都道府県別郵便番号',
|
||||
city: '都市名',
|
||||
cityPrefix: '市のプレフィックス',
|
||||
citySuffix: '市の接尾辞',
|
||||
cityPrefix: '都市のプレフィックス',
|
||||
citySuffix: '都市のサフィックス',
|
||||
streetName: '通りの名前',
|
||||
streetAddress: 'ストリートアドレス',
|
||||
streetSuffix: '通りの接尾辞',
|
||||
streetPrefix: 'ストリートプレフィックス',
|
||||
streetAddress: '通りの住所',
|
||||
streetSuffix: '通りのサフィックス',
|
||||
streetPrefix: '通りのプレフィックス',
|
||||
secondaryAddress: '副住所',
|
||||
county: '郡',
|
||||
country: '国名',
|
||||
countryCode: '国コード',
|
||||
state: '州',
|
||||
stateAbbr: '州の略語',
|
||||
stateAbbr: '州の略称',
|
||||
latitude: '緯度',
|
||||
longitude: '経度',
|
||||
direction: '方向',
|
||||
cardinalDirection: '枢機卿の方向',
|
||||
ordinalDirection: '序列方向',
|
||||
cardinalDirection: '4方位',
|
||||
ordinalDirection: '8方位',
|
||||
nearbyGPSCoordinate: '近くのGPS座標',
|
||||
timeZone: 'タイムゾーン',
|
||||
color: '色',
|
||||
department: '部門',
|
||||
productName: '商品名',
|
||||
productName: '製品名',
|
||||
price: '価格',
|
||||
productAdjective: '製品の形容詞',
|
||||
productMaterial: '製品の素材',
|
||||
@@ -288,29 +448,30 @@ export const jaJP = {
|
||||
productDescription: '製品の説明',
|
||||
suffixes: 'サフィックス',
|
||||
companyName: '会社名',
|
||||
companySuffix: '会社のサフィックス',
|
||||
companySuffix: '会社名のサフィックス',
|
||||
catchPhrase: 'キャッチフレーズ',
|
||||
// bs: 'BS',
|
||||
bs: 'BS',
|
||||
catchPhraseAdjective: 'キャッチフレーズ形容詞',
|
||||
catchPhraseDescriptor: 'キャッチフレーズの説明文',
|
||||
catchPhraseNoun: 'キャッチフレーズの名詞',
|
||||
bsAdjective: 'BS 形容詞',
|
||||
bsBuzz: 'BS の話題',
|
||||
bsNoun: 'BS の名詞',
|
||||
column: 'コラム',
|
||||
column: 'カラム',
|
||||
type: 'タイプ',
|
||||
collation: '照合',
|
||||
engine: 'エンジン',
|
||||
past: '過去',
|
||||
now: '現在',
|
||||
future: '未来',
|
||||
between: '間',
|
||||
recent: '最近',
|
||||
soon: 'すぐ',
|
||||
soon: 'まもなく',
|
||||
month: '月',
|
||||
weekday: '曜日',
|
||||
account: 'アカウント',
|
||||
account: '口座',
|
||||
accountName: '口座名',
|
||||
routingNumber: 'ルーティング番号',
|
||||
routingNumber: 'ルーティングナンバー',
|
||||
mask: 'マスク',
|
||||
amount: '金額',
|
||||
transactionType: '取引の種類',
|
||||
@@ -318,19 +479,19 @@ export const jaJP = {
|
||||
currencyName: '通貨名',
|
||||
currencySymbol: '通貨記号',
|
||||
bitcoinAddress: 'Bitcoin アドレス',
|
||||
litecoinAddress: 'ライトコインのアドレス',
|
||||
litecoinAddress: 'Litecoin アドレス',
|
||||
creditCardNumber: 'クレジットカード番号',
|
||||
creditCardCVV: 'クレジットカードの CVV',
|
||||
ethereumAddress: 'イーサリアムのアドレス',
|
||||
iban: 'アイバン',
|
||||
bic: 'ビック',
|
||||
transactionDescription: '取引内容',
|
||||
ethereumAddress: 'Ethereum アドレス',
|
||||
iban: 'IBAN',
|
||||
bic: 'BIC',
|
||||
transactionDescription: '取引の説明',
|
||||
branch: 'ブランチ',
|
||||
commitEntry: 'コミットエントリ',
|
||||
commitMessage: 'コミットメッセージ',
|
||||
commitSha: 'コミット SHA',
|
||||
shortSha: 'ショート SHA',
|
||||
abbreviation: '省略形',
|
||||
abbreviation: '略称',
|
||||
adjective: '形容詞',
|
||||
noun: '名詞',
|
||||
verb: '動詞',
|
||||
@@ -345,23 +506,23 @@ export const jaJP = {
|
||||
domainName: 'ドメイン名',
|
||||
domainSuffix: 'ドメインのサフィックス',
|
||||
domainWord: 'ドメイン名',
|
||||
ip: 'Ip',
|
||||
ipv6: 'Ipv6',
|
||||
userAgent: 'ユーザーエージェント',
|
||||
// mac: 'Mac',
|
||||
ip: 'IP',
|
||||
ipv6: 'IPv6',
|
||||
userAgent: 'User-Agent',
|
||||
mac: 'MAC',
|
||||
password: 'パスワード',
|
||||
word: 'ワード',
|
||||
word: '単語',
|
||||
words: '単語',
|
||||
sentence: '文章',
|
||||
slug: 'スラッグ',
|
||||
sentences: 'センテンス',
|
||||
paragraph: 'パラグラフ',
|
||||
paragraphs: 'パラグラフ',
|
||||
slug: 'Slug',
|
||||
sentences: '文章',
|
||||
paragraph: '段落',
|
||||
paragraphs: '段落',
|
||||
text: 'テキスト',
|
||||
lines: '行',
|
||||
genre: 'ジャンル',
|
||||
firstName: 'ファーストネーム',
|
||||
lastName: '苗字',
|
||||
firstName: '姓',
|
||||
lastName: '名',
|
||||
middleName: 'ミドルネーム',
|
||||
findName: 'フルネーム',
|
||||
jobTitle: '役職名',
|
||||
@@ -371,35 +532,35 @@ export const jaJP = {
|
||||
title: '役職名',
|
||||
jobDescriptor: '職務記述書',
|
||||
jobArea: '職務領域',
|
||||
jobType: '仕事の種類',
|
||||
jobType: '職種',
|
||||
phoneNumber: '電話番号',
|
||||
phoneNumberFormat: '電話番号のフォーマット',
|
||||
phoneFormats: '電話番号のフォーマット',
|
||||
// number: '番号',
|
||||
// float: 'フロート',
|
||||
number: '数字',
|
||||
float: '浮動小数点数',
|
||||
arrayElement: '配列要素',
|
||||
arrayElements: '配列要素',
|
||||
objectElement: 'オブジェクトの要素',
|
||||
// uuid: 'Uuid',
|
||||
// boolean: 'ブール',
|
||||
uuid: 'UUID',
|
||||
boolean: 'ブール値',
|
||||
image: '画像',
|
||||
locale: 'ロケール',
|
||||
alpha: '英字',
|
||||
alphaNumeric: '英数字',
|
||||
hexaDecimal: '16進法',
|
||||
hexaDecimal: '16進数',
|
||||
fileName: 'ファイル名',
|
||||
commonFileName: '一般的なファイル名',
|
||||
mimeType: 'Mimeタイプ',
|
||||
mimeType: 'MIME タイプ',
|
||||
commonFileType: '共通のファイルタイプ',
|
||||
commonFileExt: '共通のファイル拡張子',
|
||||
fileType: 'ファイルタイプ',
|
||||
fileExt: 'ファイル拡張子',
|
||||
directoryPath: 'ディレクトリパス',
|
||||
filePath: 'ファイルパス',
|
||||
// semver: 'セムバー',
|
||||
manufacturer: 'メーカー名',
|
||||
semver: 'セマンティックバージョニング',
|
||||
manufacturer: 'メーカー',
|
||||
model: 'モデル',
|
||||
fuel: '燃料'
|
||||
// vin: 'Vin'
|
||||
fuel: '燃料',
|
||||
vin: '車両識別番号'
|
||||
}
|
||||
};
|
||||
|
@@ -15,7 +15,7 @@ export const nlNL = {
|
||||
results: 'Resultaten',
|
||||
size: 'Grootte',
|
||||
mimeType: 'Mime-Type',
|
||||
download: 'Download',
|
||||
download: 'Download', // Same as English
|
||||
add: 'Toevoegen',
|
||||
data: 'Data',
|
||||
properties: 'Eigenschappen',
|
||||
@@ -65,7 +65,13 @@ export const nlNL = {
|
||||
outputFormat: 'Uitvoerformaat',
|
||||
singleFile: 'Enkel {ext}-bestand',
|
||||
zipCompressedFile: 'ZIP gecomprimeerd {ext}-bestand',
|
||||
include: 'Inclusief'
|
||||
include: 'Inclusief',
|
||||
search: 'Zoek',
|
||||
copyName: 'Kopieer naam',
|
||||
title: 'Titel',
|
||||
archive: 'Archief',
|
||||
undo: 'Ongedaan maken',
|
||||
moveTo: 'Verplaats naar'
|
||||
},
|
||||
connection: {
|
||||
connectionName: 'Naam verbinding',
|
||||
@@ -100,7 +106,10 @@ export const nlNL = {
|
||||
readOnlyMode: 'Alleen lezen modus',
|
||||
untrustedConnection: 'Niet vertrouwde verbinding',
|
||||
allConnections: 'Alle verbindingen',
|
||||
searchForConnections: 'Zoek naar verbindingen'
|
||||
searchForConnections: 'Zoek naar verbindingen',
|
||||
singleConnection: 'Enkele verbinding',
|
||||
connection: 'Verbinding',
|
||||
keepAliveInterval: 'Keep alive interval'
|
||||
},
|
||||
database: {
|
||||
schema: 'Schema',
|
||||
@@ -260,7 +269,15 @@ export const nlNL = {
|
||||
targetTable: 'Doeltabel',
|
||||
switchDatabase: 'Wissel van database',
|
||||
importQueryErrors: 'Waarschuwing: {n} fout is opgetreden | Waarschuwing: {n} fouten opgetreden',
|
||||
executedQueries: '{n} query uitgevoerd | {n} queries uitgevoerd'
|
||||
executedQueries: '{n} query uitgevoerd | {n} queries uitgevoerd',
|
||||
insert: 'Invoegen',
|
||||
exportTable: 'Exporteer tabel',
|
||||
savedQueries: 'Opgeslagen queries',
|
||||
searchForElements: 'Zoek naar elementen',
|
||||
searchForSchemas: 'Zoek naar schema\'s',
|
||||
materializedview: 'Materialized view | Materialized views',
|
||||
createNewMaterializedView: 'Materialized view maken',
|
||||
newMaterializedView: 'Nieuwe materialized view'
|
||||
},
|
||||
application: {
|
||||
settings: 'Instellingen',
|
||||
@@ -367,7 +384,30 @@ export const nlNL = {
|
||||
wrongFileFormat: 'Bestand is geen geldig .antares bestand',
|
||||
required: 'Verplicht',
|
||||
choseFile: 'Selecteer bestand',
|
||||
password: 'Wachtwoord'
|
||||
password: 'Wachtwoord',
|
||||
note: 'Notitie',
|
||||
data: 'Data',
|
||||
event: 'Event',
|
||||
key: 'Key',
|
||||
customIcon: 'Aangepast pictogram',
|
||||
fileName: 'bestandsnaam',
|
||||
newFolder: 'Nieuwe map',
|
||||
outOfFolder: 'Out of folder',
|
||||
dataImportSuccess: 'Data succesvol geïmporteerd',
|
||||
thereAreNoNotesYet: 'Er zijn nog geen notities',
|
||||
addNote: 'Voeg notitie toe',
|
||||
editNote: 'Bewerk notitie',
|
||||
saveAsNote: 'Sla op als notitie',
|
||||
showArchivedNotes: 'Toon gearchiveerde notities',
|
||||
hideArchivedNotes: 'Verberg gearchiveerde notities',
|
||||
tag: 'Tag',
|
||||
saveFile: 'Bestand opslaan',
|
||||
saveFileAs: 'Bestand opslaan als',
|
||||
openFile: 'Open bestand',
|
||||
openNotes: 'Open notities',
|
||||
debugConsole: 'Debug Console',
|
||||
executedQueries: 'Voer queries uit',
|
||||
sizeLimitError: 'Maximum grootte {size} overschreden'
|
||||
},
|
||||
faker: {
|
||||
address: 'Adres',
|
||||
@@ -434,7 +474,7 @@ export const nlNL = {
|
||||
engine: 'Engine',
|
||||
past: 'Verleden',
|
||||
now: 'Nu',
|
||||
future: 'Future',
|
||||
future: 'Toekomstig',
|
||||
between: 'Between',
|
||||
recent: 'Recent',
|
||||
soon: 'Soon',
|
||||
@@ -447,11 +487,11 @@ export const nlNL = {
|
||||
amount: 'Amount',
|
||||
transactionType: 'Transaction type',
|
||||
currencyCode: 'Currency code',
|
||||
currencyName: 'Currency name',
|
||||
currencySymbol: 'Currency symbol',
|
||||
bitcoinAddress: 'Bitcoin address',
|
||||
litecoinAddress: 'Litecoin address',
|
||||
creditCardNumber: 'Credit card number',
|
||||
currencyName: 'Valutanaam',
|
||||
currencySymbol: 'Valutateken',
|
||||
bitcoinAddress: 'Bitcoin adres',
|
||||
litecoinAddress: 'Litecoin adres',
|
||||
creditCardNumber: 'Credit card nummer',
|
||||
creditCardCVV: 'Credit card CVV',
|
||||
ethereumAddress: 'Ethereum adres',
|
||||
iban: 'IBAN',
|
||||
@@ -487,10 +527,10 @@ export const nlNL = {
|
||||
sentence: 'Zin',
|
||||
slug: 'Slug',
|
||||
sentences: 'Zinnen',
|
||||
paragraph: 'Paragraph',
|
||||
paragraphs: 'Paragraphs',
|
||||
text: 'Text',
|
||||
lines: 'Lines',
|
||||
paragraph: 'Paragraaf',
|
||||
paragraphs: 'Paragrafen',
|
||||
text: 'Tekst',
|
||||
lines: 'Regels',
|
||||
genre: 'Genre',
|
||||
firstName: 'Voornaam',
|
||||
lastName: 'Achternaam',
|
||||
@@ -500,7 +540,7 @@ export const nlNL = {
|
||||
gender: 'Gender',
|
||||
prefix: 'Prefix',
|
||||
suffix: 'Suffix',
|
||||
title: 'Title',
|
||||
title: 'Titel',
|
||||
jobDescriptor: 'Job descriptor',
|
||||
jobArea: 'Job area',
|
||||
jobType: 'Job type',
|
||||
@@ -514,24 +554,24 @@ export const nlNL = {
|
||||
objectElement: 'Object element',
|
||||
uuid: 'Uuid',
|
||||
boolean: 'Boolean',
|
||||
image: 'Image',
|
||||
image: 'Afbeelding',
|
||||
locale: 'Locale',
|
||||
alpha: 'Alpha',
|
||||
alphaNumeric: 'Alphanumeric',
|
||||
hexaDecimal: 'Hexadecimal',
|
||||
fileName: 'File name',
|
||||
alphaNumeric: 'Alfanumeriek',
|
||||
hexaDecimal: 'Hexadecimaal',
|
||||
fileName: 'Bestandsnaam',
|
||||
commonFileName: 'Common file name',
|
||||
mimeType: 'Mime type',
|
||||
commonFileType: 'Common file type',
|
||||
commonFileExt: 'Common file extension',
|
||||
fileType: 'File type',
|
||||
fileType: 'Filetype',
|
||||
fileExt: 'File extension',
|
||||
directoryPath: 'Directory path',
|
||||
filePath: 'File path',
|
||||
semver: 'Semver',
|
||||
manufacturer: 'Manufacturer',
|
||||
manufacturer: 'Fabrikant',
|
||||
model: 'Model',
|
||||
fuel: 'Fuel',
|
||||
fuel: 'Brandstof',
|
||||
vin: 'Vin'
|
||||
}
|
||||
};
|
||||
|
@@ -65,9 +65,16 @@ export const zhCN = {
|
||||
actionSuccessful: '{action} 成功',
|
||||
outputFormat: '输出格式',
|
||||
singleFile: '单个 {ext} 文件',
|
||||
zipCompressedFile: 'ZIP 压缩 {ext} 文件'
|
||||
zipCompressedFile: 'ZIP 压缩 {ext} 文件',
|
||||
copyName: '复制名称',
|
||||
search: '搜索',
|
||||
title: '标题',
|
||||
archive: '归档',
|
||||
undo: '重做',
|
||||
moveTo: '移动到'
|
||||
},
|
||||
connection: { // 数据库连接
|
||||
connection: '连接',
|
||||
connectionName: '连接名称',
|
||||
hostName: '主机名',
|
||||
client: '数据库类型',
|
||||
@@ -101,7 +108,8 @@ export const zhCN = {
|
||||
readOnlyMode: '只读模式',
|
||||
allConnections: '所有连接',
|
||||
searchForConnections: '搜索连接',
|
||||
keepAliveInterval: '保持活跃间隔'
|
||||
keepAliveInterval: '保持活跃间隔',
|
||||
singleConnection: '单一连接'
|
||||
},
|
||||
database: { // 数据库相关术语
|
||||
schema: '模式(schema)',
|
||||
@@ -265,12 +273,11 @@ export const zhCN = {
|
||||
targetTable: '目标表',
|
||||
switchDatabase: '切换数据库',
|
||||
searchForElements: '搜索元素',
|
||||
searchForSchemas: '搜索模式(schema)'
|
||||
searchForSchemas: '搜索模式(schema)',
|
||||
savedQueries: '已保存的查询'
|
||||
},
|
||||
application: { // 应用程序相关术语
|
||||
settings: '设置',
|
||||
scratchpad: '草稿栏',
|
||||
disableScratchpad: '禁用草稿栏',
|
||||
console: '控制台',
|
||||
general: '常规',
|
||||
themes: '主题',
|
||||
@@ -375,7 +382,19 @@ export const zhCN = {
|
||||
ignoreDuplicates: '忽略重复',
|
||||
wrongImportPassword: '错误的导入密码',
|
||||
wrongFileFormat: '错误的文件格式',
|
||||
dataImportSuccess: '数据已成功导入'
|
||||
dataImportSuccess: '数据已成功导入',
|
||||
note: '笔记 | 笔记',
|
||||
thereAreNoNotesYet: '目前还没有笔记',
|
||||
addNote: '添加笔记',
|
||||
editNote: '编辑笔记',
|
||||
saveAsNote: '另存为笔记',
|
||||
showArchivedNotes: '显示归档笔记',
|
||||
hideArchivedNotes: '隐藏归档笔记',
|
||||
tag: '笔记标签', // Note tag,
|
||||
saveFile: '保存文件',
|
||||
saveFileAs: '将文件另存为',
|
||||
openFile: '打开文件',
|
||||
openNotes: '打开笔记'
|
||||
},
|
||||
faker: { // Faker.js 方法,用于随机生成的内容
|
||||
address: '地址',
|
||||
|
@@ -12,7 +12,7 @@ import { createApp } from 'vue';
|
||||
import App from '@/App.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
import { useApplicationStore } from '@/stores/application';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
import { QueryLog, useConsoleStore } from '@/stores/console';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
|
||||
@@ -37,11 +37,17 @@ i18n.global.locale = locale;
|
||||
// IPC exceptions
|
||||
ipcRenderer.on('unhandled-exception', (event, error) => {
|
||||
useNotificationsStore().addNotification({ status: 'error', message: error.message });
|
||||
useConsoleStore().putLog('debug', {
|
||||
level: 'error',
|
||||
process: 'main',
|
||||
message: error.message,
|
||||
date: new Date()
|
||||
});
|
||||
});
|
||||
|
||||
// IPC query logs
|
||||
ipcRenderer.on('query-log', (event, logRecord) => {
|
||||
useConsoleStore().putLog(logRecord);
|
||||
ipcRenderer.on('query-log', (event, logRecord: QueryLog) => {
|
||||
useConsoleStore().putLog('query', logRecord);
|
||||
});
|
||||
|
||||
ipcRenderer.on('toggle-console', () => {
|
||||
|
@@ -8,6 +8,10 @@ export default class {
|
||||
return ipcRenderer.invoke('show-open-dialog', unproxify(options));
|
||||
}
|
||||
|
||||
static showSaveDialog (options: OpenDialogOptions): Promise<OpenDialogReturnValue> {
|
||||
return ipcRenderer.invoke('show-save-dialog', unproxify(options));
|
||||
}
|
||||
|
||||
static getDownloadPathDirectory (): Promise<string> {
|
||||
return ipcRenderer.invoke('get-download-dir-path');
|
||||
}
|
||||
@@ -27,4 +31,12 @@ export default class {
|
||||
static unregisterShortcuts () {
|
||||
return ipcRenderer.invoke('unregister-shortcuts');
|
||||
}
|
||||
|
||||
static readFile (params: {filePath: string; encoding: string}): Promise<string> {
|
||||
return ipcRenderer.invoke('read-file', params);
|
||||
}
|
||||
|
||||
static writeFile (path: string, content: unknown) {
|
||||
return ipcRenderer.invoke('write-file', path, content);
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,10 @@ export default class {
|
||||
return ipcRenderer.invoke('connect', unproxify(newParams));
|
||||
}
|
||||
|
||||
static abortConnection (uid: string): void {
|
||||
ipcRenderer.send('abort-connection', uid);
|
||||
}
|
||||
|
||||
static checkConnection (uid: string): Promise<boolean> {
|
||||
return ipcRenderer.invoke('check-connection', uid);
|
||||
}
|
||||
|
@@ -19,4 +19,20 @@ export default class {
|
||||
static createView (params: CreateViewParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-view', unproxify(params));
|
||||
}
|
||||
|
||||
static createMaterializedView (params: CreateViewParams & { uid: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('create-materialized-view', unproxify(params));
|
||||
}
|
||||
|
||||
static getMaterializedViewInformations (params: { uid: string; schema: string; view: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('get-materialized-view-informations', unproxify(params));
|
||||
}
|
||||
|
||||
static dropMaterializedView (params: { uid: string; schema: string; view: string }): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('drop-materialized-view', unproxify(params));
|
||||
}
|
||||
|
||||
static alterMaterializedView (params: { view: AlterViewParams & { uid: string }}): Promise<IpcResponse> {
|
||||
return ipcRenderer.invoke('alter-materialized-view', unproxify(params));
|
||||
}
|
||||
}
|
||||
|
9
src/renderer/libs/camelize.ts
Normal file
9
src/renderer/libs/camelize.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export const camelize = (text: string) => {
|
||||
const textArr = text.split('-');
|
||||
for (let i = 0; i < textArr.length; i++) {
|
||||
if (i === 0) continue;
|
||||
textArr[i] = textArr[i].charAt(0).toUpperCase() + textArr[i].slice(1);
|
||||
}
|
||||
|
||||
return textArr.join('');
|
||||
};
|
18
src/renderer/libs/colorShade.ts
Normal file
18
src/renderer/libs/colorShade.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export const colorShade = (color: string, amount: number) => {
|
||||
color = color.replaceAll('#', '');
|
||||
if (color.length === 3) color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let [r, g, b] = color.match(/.{2}/g) as any;
|
||||
([r, g, b] = [parseInt(r, 16) + amount, parseInt(g, 16) + amount, parseInt(b, 16) + amount]);
|
||||
|
||||
r = Math.max(Math.min(255, r), 0).toString(16);
|
||||
g = Math.max(Math.min(255, g), 0).toString(16);
|
||||
b = Math.max(Math.min(255, b), 0).toString(16);
|
||||
|
||||
const rr = (r.length < 2 ? '0' : '') + r;
|
||||
const gg = (g.length < 2 ? '0' : '') + g;
|
||||
const bb = (b.length < 2 ? '0' : '') + b;
|
||||
|
||||
return `#${rr}${gg}${bb}`;
|
||||
};
|
@@ -38,7 +38,7 @@ const connStringConstruct = (args: ConnectionParams & { pgConnString?: string })
|
||||
args.sshPort = stringArgs.sshPort;
|
||||
|
||||
// ssl mode
|
||||
args.ssl = checkForSSl(args.pgConnString);
|
||||
args.ssl = checkForSSl(args.pgConnString) || args.ssl;
|
||||
args.cert = stringArgs.sslcert;
|
||||
args.key = stringArgs.sslkey;
|
||||
args.ca = stringArgs.sslrootcert;
|
||||
|
16
src/renderer/libs/hexToRgba.ts
Normal file
16
src/renderer/libs/hexToRgba.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export const hexToRGBA = (hexCode: string, opacity = 1) => {
|
||||
let hex = hexCode.replace('#', '');
|
||||
|
||||
if (hex.length === 3)
|
||||
hex = `${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`;
|
||||
|
||||
const r = parseInt(hex.substring(0, 2), 16);
|
||||
const g = parseInt(hex.substring(2, 4), 16);
|
||||
const b = parseInt(hex.substring(4, 6), 16);
|
||||
|
||||
/* Backward compatibility for whole number based opacity values. */
|
||||
if (opacity > 1 && opacity <= 100)
|
||||
opacity = opacity / 100;
|
||||
|
||||
return `rgba(${r},${g},${b},${opacity})`;
|
||||
};
|
@@ -1,5 +1,5 @@
|
||||
/* Colors */
|
||||
$body-bg: #fdfdfd;
|
||||
$body-bg: #f3f3f3;
|
||||
$body-bg-dark: #1d1d1d;
|
||||
$body-font-color-dark: #fff;
|
||||
$bg-color-dark: #1d1d1d;
|
||||
|
@@ -1,4 +1,10 @@
|
||||
/* stylelint-disable */
|
||||
:root {
|
||||
--primary-color: #e36929;
|
||||
--primary-color-dark: color-mix(in srgb, var(--primary-color), #000 30%);
|
||||
--primary-color-shadow: 0 0 0 0.1rem rgba(227, 105, 41, 0.2);
|
||||
}
|
||||
|
||||
@import "~spectre.css/src/variables";
|
||||
@import "variables";
|
||||
@import "transitions";
|
||||
@@ -16,12 +22,20 @@ body {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--primary-color);
|
||||
|
||||
&:hover {
|
||||
color: var(--primary-color-dark)
|
||||
}
|
||||
}
|
||||
|
||||
::selection,
|
||||
option:hover,
|
||||
option:focus,
|
||||
option:active,
|
||||
option:checked {
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
color: $light-color;
|
||||
}
|
||||
|
||||
@@ -189,6 +203,14 @@ option:checked {
|
||||
animation: rotation 0.8s infinite linear;
|
||||
}
|
||||
|
||||
.loading {
|
||||
&::after {
|
||||
border: 0.1rem solid var(--primary-color);
|
||||
border-right-color: transparent;
|
||||
border-top-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/* Override */
|
||||
.modal {
|
||||
.modal-container,
|
||||
@@ -248,7 +270,7 @@ option:checked {
|
||||
height: 2px;
|
||||
width: 0;
|
||||
transition: width 0.2s;
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
@@ -300,9 +322,23 @@ option:checked {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.form-checkbox input:checked + .form-icon, .form-radio input:checked + .form-icon, .form-switch input:checked + .form-icon {
|
||||
background: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.form-checkbox input:focus + .form-icon, .form-radio input:focus + .form-icon, .form-switch input:focus + .form-icon {
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.form-select {
|
||||
cursor: pointer;
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
|
||||
}
|
||||
|
||||
&.small-select {
|
||||
height: 21px;
|
||||
font-size: 0.7rem;
|
||||
@@ -311,7 +347,8 @@ option:checked {
|
||||
|
||||
&.select {
|
||||
&.select--open {
|
||||
border-color: $primary-color !important;
|
||||
border-color: var(--primary-color) !important;
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow) !important;
|
||||
|
||||
@include control-shadow();
|
||||
}
|
||||
@@ -336,19 +373,28 @@ option:checked {
|
||||
z-index: 401 !important;
|
||||
border: 1px solid transparent;
|
||||
border-radius: $border-radius;
|
||||
box-shadow: 0 8px 17px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
|
||||
box-shadow:
|
||||
0 8px 17px 0 rgb(0 0 0 / 20%),
|
||||
0 6px 20px 0 rgb(0 0 0 / 19%);
|
||||
}
|
||||
|
||||
.select__option--selected {
|
||||
background: rgba($primary-color, 0.25);
|
||||
background: rgba(var(--primary-color), 0.25);
|
||||
}
|
||||
|
||||
.select__option--highlight {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
text-shadow: 0 0 15px #000;
|
||||
}
|
||||
|
||||
.form-input[type="file"] {
|
||||
.form-input {
|
||||
&[type="file"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
&:focus {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
|
||||
}
|
||||
}
|
||||
|
||||
.input-group .input-group-addon {
|
||||
@@ -370,13 +416,34 @@ option:checked {
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
|
||||
&:not(.btn-link) {
|
||||
text-shadow: 0 0 15px #000;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--primary-color-dark);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 3px 1px rgba($primary-color, 90%);
|
||||
box-shadow: 0 0 3px 1px rgba(var(--primary-color), 90%);
|
||||
}
|
||||
|
||||
&.btn-success:focus {
|
||||
border-color: $primary-color;
|
||||
box-shadow: 0 0 3px 1px rgba($primary-color, 90%);
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 3px 1px rgba(var(--primary-color), 90%);
|
||||
}
|
||||
|
||||
&.btn-primary {
|
||||
background: var(--primary-color);
|
||||
border-color: var(--primary-color-dark);
|
||||
|
||||
&:hover {
|
||||
background: var(--primary-color-dark);
|
||||
border-color: var(--primary-color-dark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,7 +502,7 @@ code.sql {
|
||||
}
|
||||
|
||||
.sql-hl-keyword {
|
||||
color: $primary-color;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.sql-hl-function {
|
||||
|
@@ -33,12 +33,41 @@
|
||||
|
||||
.menu-item a {
|
||||
&:hover {
|
||||
color: $primary-color;
|
||||
color: var(--primary-color);
|
||||
background: $bg-color-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab {
|
||||
.tab-item {
|
||||
a {
|
||||
color: $body-font-color-dark;
|
||||
opacity: .7;
|
||||
|
||||
&:hover {
|
||||
color: $body-font-color-dark;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {
|
||||
color: $body-font-color-dark;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tab-link {
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
&::after {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
&.btn-link {
|
||||
color: rgba($body-font-color-dark, 0.8);
|
||||
@@ -67,7 +96,7 @@
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +153,7 @@
|
||||
}
|
||||
|
||||
.form-select:not([multiple], [size]):focus {
|
||||
border-color: $primary-color;
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.select {
|
||||
@@ -320,11 +349,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.query-console {
|
||||
.console {
|
||||
border-top: 1px solid #444;
|
||||
background-color: $bg-color-dark;
|
||||
|
||||
.query-console-log {
|
||||
.console-log {
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: $bg-color-gray;
|
||||
@@ -432,7 +461,7 @@
|
||||
.settingbar-element {
|
||||
.settingbar-element-icon {
|
||||
&.badge-update::after {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -447,7 +476,7 @@
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
box-shadow: 0 0 1px 0 #000;
|
||||
|
||||
.footer-elements {
|
||||
|
@@ -12,6 +12,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.form-select,
|
||||
.form-input,
|
||||
.form-select:not([multiple], [size]),
|
||||
.form-checkbox .form-icon,
|
||||
.form-radio .form-icon {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-input:disabled,
|
||||
.form-input.disabled,
|
||||
.form-select:disabled,
|
||||
@@ -44,7 +52,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
.tab {
|
||||
border-bottom: 0.05rem solid #c5c5c5;
|
||||
|
||||
.tab-item {
|
||||
a {
|
||||
color: $body-font-color;
|
||||
opacity: .7;
|
||||
|
||||
&:hover {
|
||||
color: $body-font-color;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {
|
||||
color: $body-font-color;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tab-link {
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
&::after {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
&.btn-clear:focus, &.btn-clear:hover {
|
||||
background: #e0e0e0;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
&.btn-link {
|
||||
color: rgba($body-font-color, 0.8);
|
||||
|
||||
@@ -72,7 +116,7 @@
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,11 +173,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.query-console {
|
||||
.console {
|
||||
border-top: 1px solid darken($bg-color-light-gray, 15%);
|
||||
background-color: $bg-color-light;
|
||||
|
||||
.query-console-log {
|
||||
.console-log {
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: $bg-color-light-gray;
|
||||
@@ -181,7 +225,7 @@
|
||||
.settingbar-element {
|
||||
.settingbar-element-icon {
|
||||
&.badge-update::after {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,6 +274,10 @@
|
||||
.workspace-tabs {
|
||||
.tab-block {
|
||||
.tab-item {
|
||||
> a {
|
||||
color: $body-font-color;
|
||||
}
|
||||
|
||||
&.tools-dropdown {
|
||||
background-color: $body-bg;
|
||||
}
|
||||
@@ -241,19 +289,25 @@
|
||||
.workspace-query-results {
|
||||
.table {
|
||||
.th {
|
||||
background: $body-bg;
|
||||
border-color: lighten($bg-color-light-gray, 2%);
|
||||
background: #D8D8D8;
|
||||
border-color: transparent;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.th:first-child {
|
||||
border-left: 2px solid transparent;
|
||||
}
|
||||
|
||||
.tr {
|
||||
background-color: lighten($bg-color-light-gray, 2%);
|
||||
|
||||
.td:first-child {
|
||||
border-left: 2px solid $body-bg;
|
||||
border-left: 2px solid #0000001f;
|
||||
}
|
||||
|
||||
.td {
|
||||
border-color: $body-bg;
|
||||
border-color: #0000001f;
|
||||
border-radius: 1px;
|
||||
|
||||
&:focus,
|
||||
&.selected {
|
||||
@@ -272,7 +326,7 @@
|
||||
|
||||
.connection-panel {
|
||||
.panel {
|
||||
background: rgba($bg-color-light-gray, 100%);
|
||||
background: #e0e0e0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +397,7 @@
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
box-shadow: 0 0 1px 0 #000;
|
||||
|
||||
.footer-elements {
|
||||
|
@@ -5,7 +5,11 @@ import { ipcRenderer } from 'electron';
|
||||
import * as Store from 'electron-store';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { i18n } from '@/i18n';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
import { useNotificationsStore } from './notifications';
|
||||
|
||||
let key = localStorage.getItem('key');
|
||||
|
||||
export interface SidebarElement {
|
||||
@@ -16,8 +20,11 @@ export interface SidebarElement {
|
||||
color?: string;
|
||||
name?: string;
|
||||
icon?: null | string;
|
||||
hasCustomIcon?: boolean;
|
||||
}
|
||||
|
||||
export interface CustomIcon {base64: string; uid: string}
|
||||
|
||||
if (!key) { // If no key in local storace
|
||||
const storedKey = ipcRenderer.sendSync('get-key');// Ask for key stored on disk
|
||||
|
||||
@@ -44,7 +51,8 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
state: () => ({
|
||||
connections: persistentStore.get('connections', []) as ConnectionParams[],
|
||||
lastConnections: persistentStore.get('lastConnections', []) as {uid: string; time: number}[],
|
||||
connectionsOrder: persistentStore.get('connectionsOrder', []) as SidebarElement[]
|
||||
connectionsOrder: persistentStore.get('connectionsOrder', []) as SidebarElement[],
|
||||
customIcons: persistentStore.get('custom_icons', []) as CustomIcon[]
|
||||
}),
|
||||
getters: {
|
||||
getConnectionByUid: state => (uid:string) => state.connections.find(connection => connection.uid === uid),
|
||||
@@ -74,7 +82,8 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
.find(connection => connection.uid === uid),
|
||||
getFolders: state => state.connectionsOrder.filter(conn => conn.isFolder),
|
||||
getConnectionFolder: state => (uid:string) => state.connectionsOrder
|
||||
.find(folder => folder.isFolder && folder.connections.includes(uid))
|
||||
.find(folder => folder.isFolder && folder.connections.includes(uid)),
|
||||
getIconByUid: state => (uid:string) => state.customIcons.find(i => i.uid === uid)
|
||||
},
|
||||
actions: {
|
||||
addConnection (connection: ConnectionParams) {
|
||||
@@ -198,7 +207,8 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
client: conn.client,
|
||||
uid: conn.uid,
|
||||
icon: conn.icon,
|
||||
name: conn.name
|
||||
name: conn.name,
|
||||
hasCustomIcon: conn.hasCustomIcon
|
||||
});
|
||||
|
||||
connIndex = connections.findIndex((conn, i) => conn.uid === el.uid && i !== el.index);
|
||||
@@ -247,15 +257,41 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
this.connectionsOrder = (this.connectionsOrder as SidebarElement[]).filter(el => !emptyFolders.includes(el.uid));
|
||||
persistentStore.set('connectionsOrder', this.connectionsOrder);
|
||||
},
|
||||
// Custom Icons
|
||||
addIcon (svg: string) {
|
||||
if (svg.length > 16384) {
|
||||
const { t } = i18n.global;
|
||||
useNotificationsStore().addNotification({
|
||||
status: 'error',
|
||||
message: t('application.sizeLimitError', { size: '16KB' })
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const icon: CustomIcon = {
|
||||
uid: uidGen('I'),
|
||||
base64: svg
|
||||
};
|
||||
|
||||
this.customIcons.push(icon);
|
||||
persistentStore.set('custom_icons', this.customIcons);
|
||||
},
|
||||
removeIcon (uid: string) {
|
||||
this.customIcons = this.customIcons.filter((i: CustomIcon) => i.uid !== uid);
|
||||
persistentStore.set('custom_icons', this.customIcons);
|
||||
},
|
||||
importConnections (importObj: {
|
||||
connections: ConnectionParams[];
|
||||
connectionsOrder: SidebarElement[];
|
||||
customIcons: CustomIcon[];
|
||||
}) {
|
||||
this.connections = [...this.connections, ...importObj.connections];
|
||||
this.connectionsOrder = [...this.connectionsOrder, ...importObj.connectionsOrder];
|
||||
this.customIcons = [...this.customIcons, ...importObj.customIcons];
|
||||
|
||||
persistentStore.set('connections', this.connections);
|
||||
persistentStore.set('connectionsOrder', this.connectionsOrder);
|
||||
persistentStore.set('customIcons', this.customIcons);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -1,56 +1,63 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { useWorkspacesStore } from './workspaces';
|
||||
const logsSize = 1000;
|
||||
|
||||
export interface ConsoleRecord {
|
||||
export type LogType = 'query' | 'debug'
|
||||
export interface QueryLog {
|
||||
cUid: string;
|
||||
sql: string;
|
||||
date: Date;
|
||||
}
|
||||
|
||||
export interface DebugLog {
|
||||
level: 'log' | 'info' | 'warn' | 'error';
|
||||
process: 'renderer' | 'main' | 'worker';
|
||||
message: string;
|
||||
date: Date;
|
||||
}
|
||||
|
||||
export const useConsoleStore = defineStore('console', {
|
||||
state: () => ({
|
||||
records: [] as ConsoleRecord[],
|
||||
consolesHeight: new Map<string, number>(),
|
||||
consolesOpened: new Set([])
|
||||
isConsoleOpen: false,
|
||||
queryLogs: [] as QueryLog[],
|
||||
debugLogs: [] as DebugLog[],
|
||||
selectedTab: 'query' as LogType,
|
||||
consoleHeight: 0
|
||||
}),
|
||||
getters: {
|
||||
getLogsByWorkspace: state => (uid: string) => state.records.filter(r => r.cUid === uid),
|
||||
isConsoleOpen: state => (uid: string) => state.consolesOpened.has(uid),
|
||||
consoleHeight: state => {
|
||||
const uid = useWorkspacesStore().getSelected;
|
||||
return state.consolesHeight.get(uid) || 0;
|
||||
}
|
||||
getLogsByWorkspace: state => (uid: string) => state.queryLogs.filter(r => r.cUid === uid)
|
||||
},
|
||||
actions: {
|
||||
putLog (record: ConsoleRecord) {
|
||||
this.records.push(record);
|
||||
putLog (type: LogType, record: QueryLog | DebugLog) {
|
||||
if (type === 'query') {
|
||||
this.queryLogs.push(record);
|
||||
|
||||
if (this.records.length > logsSize)
|
||||
this.records = this.records.slice(0, logsSize);
|
||||
if (this.queryLogs.length > logsSize)
|
||||
this.queryLogs = this.queryLogs.slice(0, logsSize);
|
||||
}
|
||||
else if (type === 'debug') {
|
||||
this.debugLogs.push(record);
|
||||
|
||||
if (this.debugLogs.length > logsSize)
|
||||
this.debugLogs = this.debugLogs.slice(0, logsSize);
|
||||
}
|
||||
},
|
||||
openConsole () {
|
||||
const uid = useWorkspacesStore().getSelected;
|
||||
this.consolesOpened.add(uid);
|
||||
this.consolesHeight.set(uid, 250);
|
||||
this.isConsoleOpen = true;
|
||||
this.consoleHeight = 250;
|
||||
},
|
||||
closeConsole () {
|
||||
const uid = useWorkspacesStore().getSelected;
|
||||
this.consolesOpened.delete(uid);
|
||||
this.consolesHeight.set(uid, 0);
|
||||
this.isConsoleOpen = false;
|
||||
this.consoleHeight = 0;
|
||||
},
|
||||
resizeConsole (height: number) {
|
||||
const uid = useWorkspacesStore().getSelected;
|
||||
if (height < 30)
|
||||
this.closeConsole();
|
||||
else
|
||||
this.consolesHeight.set(uid, height);
|
||||
this.consoleHeight = height;
|
||||
},
|
||||
toggleConsole () {
|
||||
const uid = useWorkspacesStore().getSelected;
|
||||
|
||||
if (this.consolesOpened.has(uid))
|
||||
if (this.isConsoleOpen)
|
||||
this.closeConsole();
|
||||
else
|
||||
this.openConsole();
|
||||
|
@@ -37,6 +37,7 @@ export interface WorkspaceTab {
|
||||
isChanged?: boolean;
|
||||
content?: string;
|
||||
autorun?: boolean;
|
||||
filePath?: string;
|
||||
}
|
||||
|
||||
export interface WorkspaceStructure {
|
||||
@@ -146,7 +147,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
else
|
||||
this.selectedWorkspace = uid;
|
||||
},
|
||||
async connectWorkspace (connection: ConnectionParams & { pgConnString?: string }, mode?: string) {
|
||||
async connectWorkspace (connection: ConnectionParams & { pgConnString?: string }, args?: {mode?: string; signal?: AbortSignal}) {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid
|
||||
? {
|
||||
...workspace,
|
||||
@@ -154,14 +155,30 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
breadcrumbs: {},
|
||||
loadedSchemas: new Set(),
|
||||
database: connection.database,
|
||||
connectionStatus: mode === 'switch' ? 'connected' : 'connecting'
|
||||
connectionStatus: args?.mode === 'switch' ? 'connected' : 'connecting'
|
||||
}
|
||||
: workspace);
|
||||
|
||||
const connectionsStore = useConnectionsStore();
|
||||
const notificationsStore = useNotificationsStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
return new Promise((resolve, reject) => {
|
||||
const abortHandler = () => {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid
|
||||
? {
|
||||
...workspace,
|
||||
structure: [],
|
||||
breadcrumbs: {},
|
||||
loadedSchemas: new Set(),
|
||||
connectionStatus: 'disconnected'
|
||||
}
|
||||
: workspace);
|
||||
return reject(new Error('Connection aborted by user'));
|
||||
};
|
||||
|
||||
args?.signal?.addEventListener('abort', abortHandler);
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const { status, response } = await Connection.connect(connection);
|
||||
|
||||
@@ -176,7 +193,11 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
connectionStatus: 'failed'
|
||||
}
|
||||
: workspace);
|
||||
|
||||
return reject(new Error(response));
|
||||
}
|
||||
else if (status === 'abort')
|
||||
return reject(new Error('Connection aborted by user'));
|
||||
else {
|
||||
let clientCustomizations: Customizations;
|
||||
const { updateLastConnection } = connectionsStore;
|
||||
@@ -251,15 +272,19 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
}
|
||||
: workspace);
|
||||
|
||||
args?.signal?.removeEventListener('abort', abortHandler);
|
||||
this.refreshCollations(connection.uid);
|
||||
this.refreshVariables(connection.uid);
|
||||
this.refreshEngines(connection.uid);
|
||||
this.refreshUsers(connection.uid);
|
||||
resolve(true);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
notificationsStore.addNotification({ status: 'error', message: err.stack });
|
||||
}
|
||||
})();
|
||||
});
|
||||
},
|
||||
async refreshStructure (uid: string) {
|
||||
const notificationsStore = useNotificationsStore();
|
||||
@@ -404,7 +429,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
},
|
||||
async switchConnection (connection: ConnectionParams & { pgConnString?: string }) {
|
||||
await Connection.disconnect(connection.uid);
|
||||
return this.connectWorkspace(connection, 'switch');
|
||||
return this.connectWorkspace(connection, { mode: 'switch' });
|
||||
},
|
||||
addWorkspace (uid: string) {
|
||||
const workspace: Workspace = {
|
||||
@@ -492,7 +517,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
}
|
||||
: workspace);
|
||||
},
|
||||
_addTab ({ uid, tab, content, type, autorun, schema, database, elementName, elementType }: WorkspaceTab) {
|
||||
_addTab ({ uid, tab, content, type, autorun, schema, database, elementName, elementType, filePath }: WorkspaceTab) {
|
||||
if (type === 'query')
|
||||
tabIndex[uid] = tabIndex[uid] ? ++tabIndex[uid] : 1;
|
||||
|
||||
@@ -506,7 +531,8 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
elementName,
|
||||
elementType,
|
||||
content: content || '',
|
||||
autorun: !!autorun
|
||||
autorun: !!autorun,
|
||||
filePath: filePath || ''
|
||||
};
|
||||
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => {
|
||||
@@ -522,14 +548,23 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
|
||||
persistentStore.set(uid, (this.workspaces as Workspace[]).find(workspace => workspace.uid === uid).tabs);
|
||||
},
|
||||
_replaceTab ({ uid, tab: tUid, type, schema, content, elementName, elementType }: WorkspaceTab) {
|
||||
_replaceTab ({ uid, tab: tUid, type, schema, content, elementName, elementType, filePath }: WorkspaceTab) {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => {
|
||||
if (workspace.uid === uid) {
|
||||
return {
|
||||
...workspace,
|
||||
tabs: workspace.tabs.map(tab => {
|
||||
if (tab.uid === tUid)
|
||||
return { ...tab, type, schema, content, elementName, elementType };
|
||||
if (tab.uid === tUid) {
|
||||
return {
|
||||
...tab,
|
||||
type,
|
||||
schema,
|
||||
content,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
};
|
||||
}
|
||||
|
||||
return tab;
|
||||
})
|
||||
@@ -541,12 +576,14 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
|
||||
persistentStore.set(uid, (this.workspaces as Workspace[]).find(workspace => workspace.uid === uid).tabs);
|
||||
},
|
||||
newTab ({ uid, content, type, autorun, schema, elementName, elementType }: WorkspaceTab) {
|
||||
newTab ({ uid, content, type, autorun, schema, elementName, elementType, filePath }: WorkspaceTab) {
|
||||
let tabUid;
|
||||
const workspaceTabs = (this.workspaces as Workspace[]).find(workspace => workspace.uid === uid);
|
||||
|
||||
switch (type) {
|
||||
case 'new-table':
|
||||
case 'new-view':
|
||||
case 'new-materialized-view':
|
||||
case 'new-trigger':
|
||||
case 'new-trigger-function':
|
||||
case 'new-function':
|
||||
@@ -562,7 +599,8 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
break;
|
||||
case 'temp-data':
|
||||
@@ -576,6 +614,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
tab.schema === schema &&
|
||||
tab.elementName === elementName &&
|
||||
tab.elementType === elementType &&
|
||||
tab.database === workspaceTabs.database &&
|
||||
[type, type.replace('temp-', '')].includes(tab.type))
|
||||
: false;
|
||||
|
||||
@@ -594,27 +633,60 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
type: tab.type.replace('temp-', ''),
|
||||
schema: tab.schema,
|
||||
elementName: tab.elementName,
|
||||
elementType: tab.elementType
|
||||
elementType: tab.elementType,
|
||||
filePath: tab.filePath
|
||||
});
|
||||
|
||||
tabUid = uidGen('T');
|
||||
this._addTab({ uid, tab: tabUid, content, type, autorun, database: workspaceTabs.database, schema, elementName, elementType });
|
||||
this._addTab({
|
||||
uid,
|
||||
tab: tabUid,
|
||||
content,
|
||||
type,
|
||||
autorun,
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
}
|
||||
else {
|
||||
this._replaceTab({ uid, tab: tab.uid, type, schema, elementName, elementType });
|
||||
this._replaceTab({
|
||||
uid,
|
||||
tab: tab.uid,
|
||||
type,
|
||||
schema,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
tabUid = tab.uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
tabUid = uidGen('T');
|
||||
this._addTab({ uid, tab: tabUid, content, type, autorun, database: workspaceTabs.database, schema, elementName, elementType });
|
||||
this._addTab({
|
||||
uid,
|
||||
tab: tabUid,
|
||||
content,
|
||||
type,
|
||||
autorun,
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
case 'table-props':
|
||||
case 'view-props':
|
||||
case 'materialized-view-props':
|
||||
case 'trigger-props':
|
||||
case 'trigger-function-props':
|
||||
case 'function-props':
|
||||
@@ -625,6 +697,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
tab.schema === schema &&
|
||||
tab.elementName === elementName &&
|
||||
tab.elementType === elementType &&
|
||||
tab.database === workspaceTabs.database &&
|
||||
[`temp-${type}`, type].includes(tab.type))
|
||||
: false;
|
||||
|
||||
@@ -635,7 +708,8 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
tabUid = existentTab.uid;
|
||||
}
|
||||
@@ -649,7 +723,8 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -664,7 +739,8 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -687,8 +763,8 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
this.selectTab({ uid, tab: workspace.tabs[workspace.tabs.length - 1].uid });
|
||||
}
|
||||
},
|
||||
updateTabContent ({ uid, tab, type, schema, content }: WorkspaceTab) {
|
||||
this._replaceTab({ uid, tab, type, schema, content });
|
||||
updateTabContent ({ uid, tab, type, schema, content, elementName, filePath }: WorkspaceTab) {
|
||||
this._replaceTab({ uid, tab, type, schema, content, elementName, filePath });
|
||||
},
|
||||
renameTabs ({ uid, schema, elementName, elementNewName }: WorkspaceTab) {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => {
|
||||
|
Reference in New Issue
Block a user