Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/antares-sql/antares into …
Browse files Browse the repository at this point in the history
…context-cell-filler
  • Loading branch information
Fabio286 committed Oct 18, 2022
2 parents e695555 + 88408da commit a852131
Show file tree
Hide file tree
Showing 14 changed files with 2,080 additions and 2,589 deletions.
2 changes: 0 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"name": "Electron: Main",
"cwd": "${workspaceFolder}",
"port": 9222,
"protocol": "inspector",
"request": "attach",
"sourceMaps": true,
"type": "node",
Expand All @@ -23,7 +22,6 @@
"name": "Electron: Worker",
"cwd": "${workspaceFolder}",
"port": 9224,
"protocol": "inspector",
"request": "attach",
"sourceMaps": true,
"type": "node",
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

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.5.18](https://github.com/antares-sql/antares/compare/v0.5.17...v0.5.18) (2022-10-14)


### Features

* **PostgreSQL:** UUID random generation option on UUID fields, closes [#424](https://github.com/antares-sql/antares/issues/424) ([a521274](https://github.com/antares-sql/antares/commit/a521274d01031c1411bbbb136369802d43368089))


### Bug Fixes

* auto-scroll on sidebar not working, fixes [#447](https://github.com/antares-sql/antares/issues/447) ([dd9c089](https://github.com/antares-sql/antares/commit/dd9c089d27c61ab76d49887c7de2849cbb6e88a6))
* trackpad horizontal scroll on tabs not working properly ([ba5a1b6](https://github.com/antares-sql/antares/commit/ba5a1b68ab2d56777a5c94eede26e9bded5819e6))

### [0.5.17](https://github.com/antares-sql/antares/compare/v0.5.16...v0.5.17) (2022-09-22)


Expand Down
4,549 changes: 1,985 additions & 2,564 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "antares",
"productName": "Antares",
"version": "0.5.17",
"version": "0.5.18",
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
"license": "MIT",
"repository": "https://github.com/antares-sql/antares.git",
Expand Down Expand Up @@ -132,21 +132,21 @@
"electron-window-state": "~5.0.3",
"encoding": "~0.1.13",
"leaflet": "~1.7.1",
"marked": "~4.0.0",
"marked": "~4.0.19",
"moment": "~2.29.4",
"mysql2": "~2.3.2",
"pg": "~8.7.1",
"pg-connection-string": "~2.5.0",
"pg-query-stream": "~4.2.3",
"pgsql-ast-parser": "~7.2.1",
"pinia": "~2.0.13",
"pinia": "~2.0.23",
"source-map-support": "~0.5.20",
"spectre.css": "~0.5.9",
"sql-formatter": "~8.2.0",
"sql-formatter": "~11.0.2",
"ssh2-promise": "~1.0.2",
"v-mask": "~2.3.0",
"vue": "~3.2.37",
"vue-i18n": "~9.2.0",
"vue": "~3.2.40",
"vue-i18n": "~9.2.2",
"vuedraggable": "~4.1.0"
},
"devDependencies": {
Expand All @@ -156,7 +156,7 @@
"@playwright/test": "~1.21.1",
"@types/better-sqlite3": "~7.5.0",
"@types/leaflet": "~1.7.9",
"@types/marked": "~4.0.3",
"@types/marked": "~4.0.7",
"@types/node": "~17.0.23",
"@types/pg": "~8.6.5",
"@typescript-eslint/eslint-plugin": "~5.18.0",
Expand All @@ -167,7 +167,7 @@
"chalk": "~4.1.2",
"cross-env": "~7.0.2",
"css-loader": "~6.5.0",
"electron": "~19.0.5",
"electron": "~19.1.2",
"electron-builder": "~23.0.3",
"eslint": "~7.32.0",
"eslint-config-standard": "~16.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/common/FakerMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default class {
{ name: 'arrayElement', group: 'random', types: ['string'] },
{ name: 'arrayElements', group: 'random', types: ['string'] },
{ name: 'objectElement', group: 'random', types: ['string'] },
{ name: 'uuid', group: 'random', types: ['string'] },
{ name: 'uuid', group: 'random', types: ['string', 'uuid'] },
{ name: 'boolean', group: 'random', types: ['string'] },
{ name: 'word', group: 'random', types: ['string'] },
{ name: 'words', group: 'random', types: ['string'] },
Expand Down
9 changes: 9 additions & 0 deletions src/common/fieldTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const BLOB = [
'TINYBLOB',
'MEDIUMBLOB',
'LONGBLOB',
'LONG_BLOB',
'BYTEA'
];

Expand All @@ -86,6 +87,14 @@ export const BIT = [
'BIT VARYING'
];

export const BINARY = [
'BINARY'
];

export const UUID = [
'UUID'
];

export const SPATIAL = [
'POINT',
'LINESTRING',
Expand Down
14 changes: 13 additions & 1 deletion src/main/ipc-handlers/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ipcMain } from 'electron';
import { faker } from '@faker-js/faker';
import * as moment from 'moment';
import { sqlEscaper } from 'common/libs/sqlUtils';
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME, BOOLEAN } from 'common/fieldTypes';
import customizations from 'common/customizations';

export default (connections: {[key: string]: antares.Client}) => {
Expand Down Expand Up @@ -153,6 +153,18 @@ export default (connections: {[key: string]: antares.Client}) => {
escapedParam = `b'${sqlEscaper(params.content)}'`;
reload = true;
}
else if (BOOLEAN.includes(params.type)) {
switch (connections[params.uid]._client) {
case 'mysql':
case 'maria':
case 'pg':
escapedParam = params.content;
break;
case 'sqlite':
escapedParam = Number(params.content === 'true');
break;
}
}
else if (params.content === null)
escapedParam = 'NULL';
else
Expand Down
7 changes: 6 additions & 1 deletion src/main/libs/clients/MySQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,12 @@ export class MySQLClient extends AntaresCore {
.orderBy({ ORDINAL_POSITION: 'ASC' })
.run<TableColumnsResult>();

const { rows: fields } = await this.raw<antares.QueryResult<CreateTableResult>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
let fields: CreateTableResult[] = [];
try {
const { rows } = await this.raw<antares.QueryResult<CreateTableResult>>(`SHOW CREATE TABLE \`${schema}\`.\`${table}\``);
fields = rows;
}
catch (_) {}

const remappedFields = fields.map(row => {
if (!row['Create Table']) return false;
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/components/FakerSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

<script setup lang="ts">
import { computed, PropType, Ref, ref, watch } from 'vue';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT, UUID } from 'common/fieldTypes';
import BaseUploadInput from '@/components/BaseUploadInput.vue';
import ForeignKeySelect from '@/components/ForeignKeySelect.vue';
import FakerMethods from 'common/FakerMethods';
Expand Down Expand Up @@ -126,6 +126,8 @@ const fakerGroups = computed(() => {
localType.value = 'datetime';
else if (TIME.includes(props.type))
localType.value = 'time';
else if (UUID.includes(props.type))
localType.value = 'uuid';
else
localType.value = 'none';
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/Workspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ const hideProcessesModal = () => {
const addWheelEvent = () => {
if (!hasWheelEvent.value) {
tabWrap.value.$el.addEventListener('wheel', (e: WheelEvent) => {
if (e.deltaX !== 0) return; // If trackpad horizontal scroll
if (e.deltaY > 0) tabWrap.value.$el.scrollLeft += 50;
else tabWrap.value.$el.scrollLeft -= 50;
});
Expand Down
12 changes: 3 additions & 9 deletions src/renderer/components/WorkspaceExploreBarSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<ul class="menu menu-nav pt-0">
<li
v-for="table of filteredTables"
:ref="breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name) ? 'explorebarSelected' : ''"
:key="table.name"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name)}"
Expand Down Expand Up @@ -69,7 +68,6 @@
<li
v-for="trigger of filteredTriggers"
:key="trigger.name"
:ref="breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name}"
@mousedown.left="selectMisc({schema: database.name, misc: trigger, type: 'trigger'})"
Expand Down Expand Up @@ -111,7 +109,6 @@
<li
v-for="(routine, i) of filteredProcedures"
:key="`${routine.name}-${i}`"
:ref="breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name}"
@mousedown.left="selectMisc({schema: database.name, misc: routine, type: 'routine'})"
Expand Down Expand Up @@ -145,7 +142,6 @@
<li
v-for="(func, i) of filteredTriggerFunctions"
:key="`${func.name}-${i}`"
:ref="breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name}"
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'triggerFunction'})"
Expand Down Expand Up @@ -179,7 +175,6 @@
<li
v-for="(func, i) of filteredFunctions"
:key="`${func.name}-${i}`"
:ref="breadcrumbs.schema === database.name && breadcrumbs.function === func.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'function'})"
Expand Down Expand Up @@ -213,7 +208,6 @@
<li
v-for="scheduler of filteredSchedulers"
:key="scheduler.name"
:ref="breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name}"
@mousedown.left="selectMisc({schema: database.name, misc: scheduler, type: 'scheduler'})"
Expand Down Expand Up @@ -281,7 +275,6 @@ const {
} = workspacesStore;
const schemaAccordion: Ref<HTMLDetailsElement> = ref(null);
const explorebarSelected: Ref<HTMLElement[]> = ref(null);
const isLoading = ref(false);
const searchTerm = computed(() => {
Expand Down Expand Up @@ -340,7 +333,8 @@ const maxSize = computed(() => {
watch(breadcrumbs, (newVal, oldVal) => {
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
setTimeout(() => {
const element = explorebarSelected.value ? explorebarSelected.value[0] : null;
const element = document.querySelector<HTMLElement>('.workspace-explorebar-database .selected');
if (element) {
const rect = element.getBoundingClientRect();
const elemTop = rect.top;
Expand All @@ -353,7 +347,7 @@ watch(breadcrumbs, (newVal, oldVal) => {
element.removeAttribute('tabindex');
}
}
}, 50);
}, 100);
}
});
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/components/WorkspaceTabQueryTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ import {
DATETIME,
BLOB,
BIT,
BINARY,
HAS_TIMEZONE,
SPATIAL,
IS_MULTI_SPATIAL
Expand Down Expand Up @@ -379,6 +380,9 @@ const editON = async (field: string) => {
const content = props.row[field];
const type = props.fields[field].type.toUpperCase();
if (BINARY.includes(type)) return;
originalContent.value = typeFormat(content, type, props.fields[field].length);
editingType.value = type;
editingField.value = field;
Expand Down Expand Up @@ -582,6 +586,9 @@ const typeFormat = (val: string | number | Date | number[], type: string, precis
return parseInt(bitString).toString().padStart(Number(precision), '0');
}
if (BINARY.includes(type))
return Buffer.from(val as number[]).toString('hex');
if (ARRAY.includes(type)) {
if (Array.isArray(val))
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');
Expand Down
31 changes: 29 additions & 2 deletions src/renderer/i18n/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ export const ptBR = {
commit: 'Enviar',
rollback: 'Reverter',
connectionString: 'String da conexão',
contributors: 'Contribuintes'
contributors: 'Contribuintes',
pin: 'Fixar',
unpin: 'Desafixar',
console: 'Console',
shortcuts: 'Atalhos'
},
message: {
appWelcome: 'Bem vindo ao Antares SQL Client!',
Expand Down Expand Up @@ -293,7 +297,30 @@ export const ptBR = {
allConnections: 'Todas as conexões',
searchForConnections: 'Procurar por conexões',
disableScratchpad: 'Desativar bloco de notas',
reportABug: 'Reportar um problema'
reportABug: 'Reportar um problema',
nextTab: 'Próxima guia',
previousTab: 'Guia anterior',
selectTabNumber: 'Selecionar guia número {param}',
toggleConsole: 'Alterar console',
addShortcut: 'Adicionar Atalho',
editShortcut: 'Editar atalho',
deleteShortcut: 'Delete shortcut',
restoreDefaults: 'Restaurar padrões',
restoreDefaultsQuestion: 'Você confirma que quer restaurar os valores padrões?',
registerAShortcut: 'Registrar um atalho',
invalidShortcutMessage: 'Combinação inválida, continue digitando',
shortcutAlreadyExists: 'O atalho já existe',
saveContent: 'Salvar conteúdo',
openAllConnections: 'Abrir todas as conexões',
openSettings: 'Abrir Configurações',
openScratchpad: 'Abrir scratchpad',
runOrReload: 'Executar ou recarregar',
formatQuery: 'Formatar consulta',
queryHistory: 'Histórico de consulta',
clearQuery: 'Limpar consulta',
openFilter: 'Abrir Filtro',
nextResultsPage: 'Próxima página de resultados',
previousResultsPage: 'Página de resultados anterior'
},
faker: {
address: 'Endereço',
Expand Down
1 change: 1 addition & 0 deletions src/renderer/scss/_data-types.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"mediumblob": $blob-color,
"medium_blob": $blob-color,
"longblob": $blob-color,
"long_blob": $blob-color,
"bytea": $blob-color,
"enum": $enum-color,
"set": $enum-color,
Expand Down

0 comments on commit a852131

Please sign in to comment.