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 context-cell-filler
This commit is contained in:
@@ -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'] },
|
||||
|
@@ -78,6 +78,7 @@ export const BLOB = [
|
||||
'TINYBLOB',
|
||||
'MEDIUMBLOB',
|
||||
'LONGBLOB',
|
||||
'LONG_BLOB',
|
||||
'BYTEA'
|
||||
];
|
||||
|
||||
@@ -86,6 +87,14 @@ export const BIT = [
|
||||
'BIT VARYING'
|
||||
];
|
||||
|
||||
export const BINARY = [
|
||||
'BINARY'
|
||||
];
|
||||
|
||||
export const UUID = [
|
||||
'UUID'
|
||||
];
|
||||
|
||||
export const SPATIAL = [
|
||||
'POINT',
|
||||
'LINESTRING',
|
||||
|
@@ -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}) => {
|
||||
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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';
|
||||
@@ -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';
|
||||
|
||||
|
@@ -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;
|
||||
});
|
||||
|
@@ -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)}"
|
||||
@@ -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'})"
|
||||
@@ -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'})"
|
||||
@@ -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'})"
|
||||
@@ -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'})"
|
||||
@@ -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'})"
|
||||
@@ -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(() => {
|
||||
@@ -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;
|
||||
@@ -353,7 +347,7 @@ watch(breadcrumbs, (newVal, oldVal) => {
|
||||
element.removeAttribute('tabindex');
|
||||
}
|
||||
}
|
||||
}, 50);
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -212,6 +212,7 @@ import {
|
||||
DATETIME,
|
||||
BLOB,
|
||||
BIT,
|
||||
BINARY,
|
||||
HAS_TIMEZONE,
|
||||
SPATIAL,
|
||||
IS_MULTI_SPATIAL
|
||||
@@ -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;
|
||||
@@ -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(']', '}');
|
||||
|
@@ -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!',
|
||||
@@ -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',
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user