mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Merge branch 'master' of https://github.com/antares-sql/antares into pr/toriphes/245
This commit is contained in:
@@ -2,7 +2,7 @@ import * as antares from 'common/interfaces/antares';
|
||||
import { InsertRowsParams } from 'common/interfaces/tableApis';
|
||||
import { ipcMain } from 'electron';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import moment from 'moment';
|
||||
import * as moment from 'moment';
|
||||
import { sqlEscaper } from 'common/libs/sqlEscaper';
|
||||
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
|
||||
import * as customizations from 'common/customizations';
|
||||
|
@@ -2,7 +2,7 @@ import * as antares from 'common/interfaces/antares';
|
||||
import * as mysql from 'mysql2/promise';
|
||||
import { AntaresCore } from '../AntaresCore';
|
||||
import * as dataTypes from 'common/data-types/mysql';
|
||||
import SSH2Promise from 'ssh2-promise';
|
||||
import SSH2Promise = require('ssh2-promise');
|
||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||
|
||||
export class MySQLClient extends AntaresCore {
|
||||
|
@@ -5,7 +5,7 @@ import * as pg from 'pg';
|
||||
import * as pgAst from 'pgsql-ast-parser';
|
||||
import { AntaresCore } from '../AntaresCore';
|
||||
import * as dataTypes from 'common/data-types/postgresql';
|
||||
import SSH2Promise from 'ssh2-promise';
|
||||
import SSH2Promise = require('ssh2-promise');
|
||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
@@ -23,6 +23,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
|
||||
export default {
|
||||
name: 'BaseUploadInput',
|
||||
props: {
|
||||
@@ -38,12 +40,9 @@ export default {
|
||||
emits: ['change', 'clear'],
|
||||
data () {
|
||||
return {
|
||||
id: null
|
||||
id: uidGen()
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
this.id = this._uid;
|
||||
},
|
||||
methods: {
|
||||
clear () {
|
||||
this.$emit('clear');
|
||||
|
@@ -40,7 +40,7 @@
|
||||
>
|
||||
<BaseUploadInput
|
||||
v-else-if="inputProps().type === 'file'"
|
||||
:value="selectedValue"
|
||||
:model-value="selectedValue"
|
||||
:message="$t('word.browse')"
|
||||
@clear="clearValue"
|
||||
@change="filesChange($event)"
|
||||
|
@@ -233,7 +233,7 @@ export default {
|
||||
else if ([...TIME, ...DATE].includes(field.type))
|
||||
fieldDefault = field.default;
|
||||
else if (BIT.includes(field.type))
|
||||
fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', '');
|
||||
fieldDefault = field.default?.replaceAll('\'', '').replaceAll('b', '');
|
||||
else if (DATETIME.includes(field.type)) {
|
||||
if (field.default && ['current_timestamp', 'now()'].some(term => field.default.toLowerCase().includes(term))) {
|
||||
let datePrecision = '';
|
||||
|
@@ -42,12 +42,16 @@ export default {
|
||||
methods: {
|
||||
async getChangelog () {
|
||||
try {
|
||||
const apiRes = await fetch(`https://api.github.com/repos/Fabio286/antares/releases/tags/v${this.appVersion}`, {
|
||||
const apiRes = await fetch(`https://api.github.com/repos/antares-sql/antares/releases/tags/v${this.appVersion}`, {
|
||||
method: 'GET'
|
||||
});
|
||||
|
||||
const { body } = await apiRes.json();
|
||||
const markdown = body.substr(0, body.indexOf('### Download'));
|
||||
const cutOffset = body.indexOf('### Download');
|
||||
const markdown = cutOffset >= 0
|
||||
? body.substr(0, cutOffset)
|
||||
: body;
|
||||
|
||||
const renderer = {
|
||||
link (href, title, text) {
|
||||
return text;
|
||||
|
@@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="connection.databasePath"
|
||||
:model-value="connection.databasePath"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('databasePath')"
|
||||
@change="pathSelection($event, 'databasePath')"
|
||||
@@ -205,7 +205,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="connection.key"
|
||||
:model-value="connection.key"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('key')"
|
||||
@change="pathSelection($event, 'key')"
|
||||
@@ -218,7 +218,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="connection.cert"
|
||||
:model-value="connection.cert"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('cert')"
|
||||
@change="pathSelection($event, 'cert')"
|
||||
@@ -231,7 +231,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="connection.ca"
|
||||
:model-value="connection.ca"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('ca')"
|
||||
@change="pathSelection($event, 'ca')"
|
||||
@@ -336,7 +336,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="connection.sshKey"
|
||||
:model-value="connection.sshKey"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('sshKey')"
|
||||
@change="pathSelection($event, 'sshKey')"
|
||||
|
@@ -92,7 +92,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="localConnection.databasePath"
|
||||
:model-value="localConnection.databasePath"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('databasePath')"
|
||||
@change="pathSelection($event, 'databasePath')"
|
||||
@@ -207,7 +207,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="localConnection.key"
|
||||
:model-value="localConnection.key"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('key')"
|
||||
@change="pathSelection($event, 'key')"
|
||||
@@ -220,7 +220,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="localConnection.cert"
|
||||
:model-value="localConnection.cert"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('cert')"
|
||||
@change="pathSelection($event, 'cert')"
|
||||
@@ -233,7 +233,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="localConnection.ca"
|
||||
:model-value="localConnection.ca"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('ca')"
|
||||
@change="pathSelection($event, 'ca')"
|
||||
@@ -330,7 +330,7 @@
|
||||
</div>
|
||||
<div class="column col-8 col-sm-12">
|
||||
<BaseUploadInput
|
||||
:value="localConnection.sshKey"
|
||||
:model-value="localConnection.sshKey"
|
||||
:message="$t('word.browse')"
|
||||
@clear="pathClear('sshKey')"
|
||||
@change="pathSelection($event, 'sshKey')"
|
||||
|
@@ -80,6 +80,7 @@ module.exports = {
|
||||
deterministic: 'Xác định',
|
||||
context: 'Context',
|
||||
export: 'Xuất',
|
||||
import: 'Nhập',
|
||||
returns: 'Returns',
|
||||
timing: 'Thời gian',
|
||||
state: 'Trạng thái',
|
||||
@@ -122,9 +123,23 @@ module.exports = {
|
||||
select: 'Chọn',
|
||||
passphrase: 'Cụm mật khẩu',
|
||||
filter: 'Bộ lọc',
|
||||
change: 'Thay đổi',
|
||||
views: 'Xem',
|
||||
triggers: 'Trình kích hoạt',
|
||||
routines: 'Routines',
|
||||
functions: 'Functions',
|
||||
schedulers: 'Lên lịch',
|
||||
includes: 'Includes',
|
||||
drop: 'Drop',
|
||||
completed: 'Completed',
|
||||
aborted: 'Aborted',
|
||||
disabled: 'Đã tắt',
|
||||
enable: 'Bật',
|
||||
disable: 'Tắt'
|
||||
disable: 'Tắt',
|
||||
commit: 'Cam kết',
|
||||
rollback: 'Hoàn nguyên',
|
||||
connectionString: 'Chuỗi kết nối',
|
||||
contributors: 'Người đóng góp'
|
||||
},
|
||||
message: {
|
||||
appWelcome: 'Chào bạn đến với Antares SQL Client!',
|
||||
@@ -250,8 +265,32 @@ module.exports = {
|
||||
searchForQueries: 'Tìm kiếm truy vấn',
|
||||
killProcess: 'Huỷ quá trình',
|
||||
closeTab: 'Đóng tab',
|
||||
exportSchema: 'Xuất lược đồ',
|
||||
importSchema: 'Nhập lược đồ',
|
||||
directoryPath: 'Đường dẫn thu mục',
|
||||
newInserStmtEvery: 'Câu lệnh INSERT mới mỗi',
|
||||
processingTableExport: 'Đang tiến hành {table}',
|
||||
fechingTableExport: 'Đang lấy dữ liệu {table}',
|
||||
writingTableExport: 'Đang ghi dữ liệu {table}',
|
||||
checkAllTables: 'Chọn tất cả các bảng',
|
||||
uncheckAllTables: 'Bỏ chọn tất cả các bảng',
|
||||
goToDownloadPage: 'Tới trang tải về',
|
||||
readOnlyMode: 'Chế độ chỉ đọc'
|
||||
readOnlyMode: 'Chế độ chỉ đọc',
|
||||
killQuery: 'Hủy truy vấn',
|
||||
insertRow: 'Chèn hàng | Chèn hàng',
|
||||
commitMode: 'Chế độ cam kết',
|
||||
autoCommit: 'Cam kết tự động',
|
||||
manualCommit: 'Cam kết thủ công',
|
||||
actionSuccessful: '{action} thành công',
|
||||
importQueryErrors: 'Cảnh báo: {n} lỗi đã xảy ra | Carh báo: {n} lỗi đã xảy ra',
|
||||
executedQueries: '{n} truy vấn đã chạy | {n} truy vấn đã chạy',
|
||||
ourputFormat: 'Định dạng đầu ra',
|
||||
singleFile: 'Một tệp {ext}',
|
||||
zipCompressedFile: 'Tệp nén zip {ext}',
|
||||
disableBlur: 'Tắt làm mờ',
|
||||
untrustedConnection: 'Kết nối không đáng tin cậy',
|
||||
missingOrIncompleteTranslation: 'Bản dịch thiếu hoặc không đầy đủ?',
|
||||
findOutHowToContribute: 'Tìm hiểu cách đóng góp'
|
||||
},
|
||||
faker: {
|
||||
address: 'Địa chỉ',
|
||||
|
@@ -1,13 +1,17 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import '@mdi/font/css/materialdesignicons.css';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import '@/scss/main.scss';
|
||||
import { VueMaskDirective } from 'v-mask';
|
||||
|
||||
import { useApplicationStore } from '@/stores/application';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
|
||||
import App from '@/App.vue';
|
||||
import { pinia } from '@/stores';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
// https://github.com/probil/v-mask/issues/498#issuecomment-827027834
|
||||
@@ -20,9 +24,58 @@ const vMaskV3 = {
|
||||
|
||||
createApp(App)
|
||||
.directive('mask', vMaskV3)
|
||||
.use(pinia)
|
||||
.use(createPinia())
|
||||
.use(i18n)
|
||||
.mount('#app');
|
||||
|
||||
const { locale } = useSettingsStore();
|
||||
i18n.global.locale = locale;
|
||||
|
||||
// IPC exceptions
|
||||
ipcRenderer.on('unhandled-exception', (event, error) => {
|
||||
useNotificationsStore().addNotification({ status: 'error', message: error.message });
|
||||
});
|
||||
|
||||
// IPC app updates
|
||||
ipcRenderer.on('checking-for-update', () => {
|
||||
useApplicationStore().updateStatus = 'checking';
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-available', () => {
|
||||
useApplicationStore().updateStatus = 'available';
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-not-available', () => {
|
||||
useApplicationStore().updateStatus = 'noupdate';
|
||||
});
|
||||
|
||||
ipcRenderer.on('check-failed', () => {
|
||||
useApplicationStore().updateStatus = 'nocheck';
|
||||
});
|
||||
|
||||
ipcRenderer.on('no-auto-update', () => {
|
||||
useApplicationStore().updateStatus = 'disabled';
|
||||
});
|
||||
|
||||
ipcRenderer.on('download-progress', (event, data) => {
|
||||
useApplicationStore().updateStatus = 'downloading';
|
||||
useApplicationStore().downloadprogress = data.percent;
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-downloaded', () => {
|
||||
useApplicationStore().updateStatus = 'downloaded';
|
||||
});
|
||||
|
||||
ipcRenderer.on('link-to-download', () => {
|
||||
useApplicationStore().updateStatus = 'link';
|
||||
});
|
||||
|
||||
// IPC shortcuts
|
||||
ipcRenderer.on('toggle-preferences', () => {
|
||||
useApplicationStore().showSettingModal('general');
|
||||
});
|
||||
|
||||
ipcRenderer.on('open-updates-preferences', () => {
|
||||
useApplicationStore().showSettingModal('update');
|
||||
ipcRenderer.send('check-for-updates');
|
||||
});
|
||||
|
@@ -1,14 +1,8 @@
|
||||
|
||||
@mixin type-colors($types) {
|
||||
$numbers: ('int','tinyint','smallint','mediumint','float','double','decimal');
|
||||
|
||||
@each $type, $color in $types {
|
||||
.type-#{$type} {
|
||||
color: $color;
|
||||
|
||||
@if index($numbers, $type) {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +0,0 @@
|
||||
// @ts-check
|
||||
import { createPinia } from 'pinia';
|
||||
import { ipcUpdates } from './plugins/ipcUpdates';
|
||||
import { ipcShortcuts } from './plugins/ipcShortcuts';
|
||||
import { ipcExceptions } from './plugins/ipcExceptions';
|
||||
|
||||
const pinia = createPinia();
|
||||
pinia
|
||||
.use(ipcUpdates)
|
||||
.use(ipcShortcuts)
|
||||
.use(ipcExceptions);
|
||||
|
||||
export { pinia };
|
@@ -1,7 +0,0 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
export function ipcExceptions ({ store }) {
|
||||
ipcRenderer.on('unhandled-exception', (event, error) => {
|
||||
store.notifications.addNotification({ status: 'error', message: error.message });
|
||||
});
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
export function ipcShortcuts ({ store }) {
|
||||
ipcRenderer.on('toggle-preferences', () => {
|
||||
store.application.showSettingModal('general');
|
||||
});
|
||||
|
||||
ipcRenderer.on('open-updates-preferences', () => {
|
||||
store.application.showSettingModal('update');
|
||||
ipcRenderer.send('check-for-updates');
|
||||
});
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
export function ipcUpdates ({ store }) {
|
||||
ipcRenderer.on('checking-for-update', () => {
|
||||
store.application.updateStatus = 'checking';
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-available', () => {
|
||||
store.application.updateStatus = 'available';
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-not-available', () => {
|
||||
store.application.updateStatus = 'noupdate';
|
||||
});
|
||||
|
||||
ipcRenderer.on('check-failed', () => {
|
||||
store.application.updateStatus = 'nocheck';
|
||||
});
|
||||
|
||||
ipcRenderer.on('no-auto-update', () => {
|
||||
store.application.updateStatus = 'disabled';
|
||||
});
|
||||
|
||||
ipcRenderer.on('download-progress', (event, data) => {
|
||||
store.application.updateStatus = 'downloading';
|
||||
store.application.downloadprogress = data.percent;
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-downloaded', () => {
|
||||
store.application.updateStatus = 'downloaded';
|
||||
});
|
||||
|
||||
ipcRenderer.on('link-to-download', () => {
|
||||
store.application.updateStatus = 'link';
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user