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

Compare commits

...

18 Commits

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

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

* refactor: removed links from map attribution

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

* test: temporary fix on Windows tests
2022-01-30 11:45:24 +01:00
64deedc5ad test: temporary skip tests on WIndows 2022-01-30 11:44:01 +01:00
9f033fb994 fix: indexes and foreign keys not cleared after deletion of related field, closes #182 2022-01-28 23:57:53 +01:00
401cb49687 refactor: improved temporary fix to Windows 7 style frame 2022-01-28 09:19:49 +01:00
1356011ba3 fix(Windows): temporary fix to Windows 7 style frame on app startup, closes #169 2022-01-27 23:40:03 +01:00
0cfd7938ee fix: scale on numeric fields that doesn't support it 2022-01-27 09:12:01 +01:00
745b55a942 chore: update dependencies 2022-01-25 09:08:45 +01:00
eef7c1dcec perf: support of scale in field's length setting 2022-01-22 12:29:49 +01:00
aa8fc545d7 Rename zh_CN.js to zh-CN.js 2022-01-20 09:02:20 +01:00
a780c7e0ff Merge pull request #179 from Fabio286/all-contributors/add-goYou
docs: add goYou as a contributor for translation
2022-01-20 08:56:33 +01:00
allcontributors[bot]
9a1bb0599f docs: update .all-contributorsrc [skip ci] 2022-01-20 07:56:07 +00:00
allcontributors[bot]
d847870f67 docs: update README.md [skip ci] 2022-01-20 07:56:06 +00:00
cd24371576 Merge pull request #177 from goYou/master
feat: add Simplified Chinese translation
2022-01-20 08:54:56 +01:00
goYou
6ef565cf07 feat: add Simplified Chinese translation 2022-01-20 01:50:18 +08:00
46b45c8ab6 fix(PostgreSQL): schema different than public not automatically selected, closes #172 2022-01-17 09:15:18 +01:00
f28531a225 build: resolved dependency conflicts 2022-01-16 11:50:35 +01:00
8fb1f0803e fix: cell copy returns "undefined" in some conditions, closes #170 2022-01-14 18:37:37 +01:00
24 changed files with 787 additions and 56 deletions

View File

@@ -129,6 +129,15 @@
"contributions": [
"code"
]
},
{
"login": "goYou",
"name": "goYou",
"avatar_url": "https://avatars.githubusercontent.com/u/62732795?v=4",
"profile": "https://github.com/goYou",
"contributions": [
"translation"
]
}
],
"contributorsPerLine": 7,

View File

@@ -4,7 +4,8 @@
"core",
"MySQL",
"PostgreSQL",
"SQLite"
"SQLite",
"Windows"
],
"svg.preview.background": "transparent"
}

View File

@@ -2,6 +2,28 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.4.3](https://github.com/Fabio286/antares/compare/v0.4.2...v0.4.3) (2022-01-30)
### Features
* add Simplified Chinese translation ([6ef565c](https://github.com/Fabio286/antares/commit/6ef565cf078cb3f5b7bcdc226894cddeb6239db9))
* **MySQL:** spatial fields support ([#165](https://github.com/Fabio286/antares/issues/165)) ([48ebf23](https://github.com/Fabio286/antares/commit/48ebf23bd1574408f429f2e1200ce878352007f6))
### Bug Fixes
* cell copy returns "undefined" in some conditions, closes [#170](https://github.com/Fabio286/antares/issues/170) ([8fb1f08](https://github.com/Fabio286/antares/commit/8fb1f0803efd9df0b66521e73bb6e1a229cf9691))
* indexes and foreign keys not cleared after deletion of related field, closes [#182](https://github.com/Fabio286/antares/issues/182) ([9f033fb](https://github.com/Fabio286/antares/commit/9f033fb994916b4fb165e81e55e86127ca817791))
* **PostgreSQL:** schema different than public not automatically selected, closes [#172](https://github.com/Fabio286/antares/issues/172) ([46b45c8](https://github.com/Fabio286/antares/commit/46b45c8ab64fb6837a532c4f8342167e4fd794bb))
* scale on numeric fields that doesn't support it ([0cfd793](https://github.com/Fabio286/antares/commit/0cfd7938ee7d607dbad66ae452d0200223a6bab2))
* **Windows:** temporary fix to Windows 7 style frame on app startup, closes [#169](https://github.com/Fabio286/antares/issues/169) ([1356011](https://github.com/Fabio286/antares/commit/1356011ba3b7dd72e12cb252a8787ce48a364fd4))
### Improvements
* support of scale in field's length setting ([eef7c1d](https://github.com/Fabio286/antares/commit/eef7c1dcecc6593ab0e69ed678187a57fe0a4fb6))
### [0.4.2](https://github.com/Fabio286/antares/compare/v0.4.1...v0.4.2) (2022-01-10)

View File

@@ -131,6 +131,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="http://rsacchetto.nexxontech.it/"><img src="https://avatars.githubusercontent.com/u/18429412?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Riccardo Sacchetto</b></sub></a><br /><a href="#platform-Occhioverde" title="Packaging/porting to new platform">📦</a></td>
<td align="center"><a href="https://kilianstallinger.com"><img src="https://avatars.githubusercontent.com/u/5290318?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kilian Stallinger</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=kilianstallz" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/wenj91"><img src="https://avatars.githubusercontent.com/u/12549338?v=4?s=100" width="100px;" alt=""/><br /><sub><b>文杰</b></sub></a><br /><a href="https://github.com/Fabio286/antares/commits?author=wenj91" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/goYou"><img src="https://avatars.githubusercontent.com/u/62732795?v=4?s=100" width="100px;" alt=""/><br /><sub><b>goYou</b></sub></a><br /><a href="#translation-goYou" title="Translation">🌍</a></td>
</tr>
</table>

View File

@@ -1,7 +1,7 @@
{
"name": "antares",
"productName": "Antares",
"version": "0.4.2",
"version": "0.4.3",
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
"license": "MIT",
"repository": "https://github.com/Fabio286/antares.git",
@@ -51,7 +51,8 @@
"target": {
"target": "default",
"arch": [
"x64"
"x64",
"arm64"
]
}
},
@@ -105,14 +106,16 @@
"dependencies": {
"@electron/remote": "^2.0.1",
"@mdi/font": "^6.1.95",
"@turf/helpers": "^6.5.0",
"@vscode/vscode-languagedetection": "^1.0.21",
"ace-builds": "^1.4.13",
"better-sqlite3": "^7.4.4",
"electron-log": "^4.4.1",
"electron-store": "^8.0.1",
"electron-updater": "^4.3.9",
"electron-updater": "^4.6.1",
"electron-window-state": "^5.0.3",
"faker": "^5.5.3",
"leaflet": "^1.7.1",
"marked": "^4.0.0",
"moment": "^2.29.1",
"mysql2": "^2.3.2",
@@ -136,20 +139,20 @@
"clean-webpack-plugin": "^4.0.0",
"cross-env": "^7.0.2",
"css-loader": "^6.5.0",
"electron": "^16.0.1",
"electron": "^16.0.8",
"electron-builder": "^22.14.11",
"electron-devtools-installer": "^3.2.0",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-vue": "^8.0.3",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^2.4.3",
"mini-css-extract-plugin": "~2.4.5",
"node-loader": "^2.0.0",
"playwright": "^1.16.3",
"playwright": "^1.18.1",
"progress-webpack-plugin": "^1.0.12",
"sass": "^1.42.1",
"sass-loader": "^12.3.0",

View File

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

View File

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

View File

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

View File

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

View File

@@ -435,7 +435,7 @@ export class MySQLClient extends AntaresCore {
return rows.map(field => {
let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/);
numLength = numLength ? +numLength.pop() : null;
numLength = numLength ? +numLength.pop() : field.NUMERIC_PRECISION || null;
const enumValues = /(enum|set)/.test(field.COLUMN_TYPE)
? field.COLUMN_TYPE.match(/\(([^)]+)\)/)[0].slice(1, -1)
: null;
@@ -443,10 +443,13 @@ export class MySQLClient extends AntaresCore {
return {
name: field.COLUMN_NAME,
key: field.COLUMN_KEY.toLowerCase(),
type: (remappedFields && remappedFields[field.COLUMN_NAME]) ? remappedFields[field.COLUMN_NAME].type : field.DATA_TYPE,
type: (remappedFields && remappedFields[field.COLUMN_NAME])
? remappedFields[field.COLUMN_NAME].type
: field.DATA_TYPE.toUpperCase(),
schema: field.TABLE_SCHEMA,
table: field.TABLE_NAME,
numPrecision: field.NUMERIC_PRECISION,
numScale: field.NUMERIC_SCALE,
numLength,
enumValues,
datePrecision: field.DATETIME_PRECISION,
@@ -1295,7 +1298,7 @@ export class MySQLClient extends AntaresCore {
const length = typeInfo.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false;
newColumns.push(`\`${field.name}\`
${field.type.toUpperCase()}${length ? `(${length})` : ''}
${field.type.toUpperCase()}${length ? `(${length}${field.numScale ? `,${field.numScale}` : ''})` : ''}
${field.unsigned ? 'UNSIGNED' : ''}
${field.zerofill ? 'ZEROFILL' : ''}
${field.nullable ? 'NULL' : 'NOT NULL'}
@@ -1364,7 +1367,7 @@ export class MySQLClient extends AntaresCore {
const length = typeInfo.length ? addition.enumValues || addition.numLength || addition.charLength || addition.datePrecision : false;
alterColumns.push(`ADD COLUMN \`${addition.name}\`
${addition.type.toUpperCase()}${length ? `(${length})` : ''}
${addition.type.toUpperCase()}${length ? `(${length}${addition.numScale ? `,${addition.numScale}` : ''})` : ''}
${addition.unsigned ? 'UNSIGNED' : ''}
${addition.zerofill ? 'ZEROFILL' : ''}
${addition.nullable ? 'NULL' : 'NOT NULL'}
@@ -1402,7 +1405,7 @@ export class MySQLClient extends AntaresCore {
const length = typeInfo.length ? change.enumValues || change.numLength || change.charLength || change.datePrecision : false;
alterColumns.push(`CHANGE COLUMN \`${change.orgName}\` \`${change.name}\`
${change.type.toUpperCase()}${length ? `(${length})` : ''}
${change.type.toUpperCase()}${length ? `(${length}${change.numScale ? `,${change.numScale}` : ''})` : ''}
${change.unsigned ? 'UNSIGNED' : ''}
${change.zerofill ? 'ZEROFILL' : ''}
${change.nullable ? 'NULL' : 'NOT NULL'}

View File

@@ -131,15 +131,23 @@ export class PostgreSQLClient extends AntaresCore {
}
/**
* Executes an "USE" query
* Executes an 'SET search_path TO "${schema}"' query
*
* @param {String} schema
* @param {Object?} connection optional
* @memberof PostgreSQLClient
*/
use (schema) {
use (schema, connection) {
this._schema = schema;
if (schema)
return this.raw(`SET search_path TO "${schema}"`);
if (schema) {
const sql = `SET search_path TO "${schema}"`;
if (connection === undefined)
return this.raw(sql);
else
return connection.query(sql);
}
}
/**
@@ -318,6 +326,7 @@ export class PostgreSQLClient extends AntaresCore {
isArray,
schema: field.table_schema,
table: field.table_name,
numScale: field.numeric_scale,
numPrecision: field.numeric_precision,
datePrecision: field.datetime_precision,
charLength: field.character_maximum_length,
@@ -1136,7 +1145,7 @@ export class PostgreSQLClient extends AntaresCore {
const length = typeInfo.length ? field.enumValues || field.numLength || field.charLength || field.datePrecision : false;
newColumns.push(`"${field.name}"
${field.type.toUpperCase()}${length ? `(${length})` : ''}
${field.type.toUpperCase()}${length ? `(${length}${field.numScale !== null ? `,${field.numScale}` : ''})` : ''}
${field.unsigned ? 'UNSIGNED' : ''}
${field.zerofill ? 'ZEROFILL' : ''}
${field.nullable ? 'NULL' : 'NOT NULL'}
@@ -1200,7 +1209,7 @@ export class PostgreSQLClient extends AntaresCore {
const length = typeInfo.length ? addition.numLength || addition.charLength || addition.datePrecision : false;
alterColumns.push(`ADD COLUMN "${addition.name}"
${addition.type.toUpperCase()}${length ? `(${length})` : ''}${addition.isArray ? '[]' : ''}
${addition.type.toUpperCase()}${length ? `(${length}${addition.numScale !== null ? `,${addition.numScale}` : ''})` : ''}${addition.isArray ? '[]' : ''}
${addition.unsigned ? 'UNSIGNED' : ''}
${addition.zerofill ? 'ZEROFILL' : ''}
${addition.nullable ? 'NULL' : 'NOT NULL'}
@@ -1246,7 +1255,7 @@ export class PostgreSQLClient extends AntaresCore {
localType = change.type.toLowerCase();
}
alterColumns.push(`ALTER COLUMN "${change.name}" TYPE ${localType}${length ? `(${length})` : ''}${change.isArray ? '[]' : ''} USING "${change.name}"::${localType}`);
alterColumns.push(`ALTER COLUMN "${change.name}" TYPE ${localType}${length ? `(${length}${change.numScale ? `,${change.numScale}` : ''})` : ''}${change.isArray ? '[]' : ''} USING "${change.name}"::${localType}`);
alterColumns.push(`ALTER COLUMN "${change.name}" ${change.nullable ? 'DROP NOT NULL' : 'SET NOT NULL'}`);
alterColumns.push(`ALTER COLUMN "${change.name}" ${change.default ? `SET DEFAULT ${change.default}` : 'DROP DEFAULT'}`);
@@ -1441,7 +1450,7 @@ export class PostgreSQLClient extends AntaresCore {
this._runningConnections.set(args.tabUid, connection.processID);
if (args.schema && args.schema !== 'public')
await this.use(args.schema);
await this.use(args.schema, connection);
for (const query of queries) {
if (!query) continue;

View File

@@ -13,6 +13,7 @@ Store.initRenderer();
const isDevelopment = process.env.NODE_ENV !== 'production';
const isMacOS = process.platform === 'darwin';
const isWindows = process.platform === 'win32';
const gotTheLock = app.requestSingleInstanceLock();
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
@@ -32,6 +33,7 @@ async function createMainWindow () {
minHeight: 550,
title: 'Antares SQL',
autoHideMenuBar: true,
show: !isWindows, // Temporary workaround to https://github.com/electron/electron/issues/30024
icon: nativeImage.createFromDataURL(icon.default),
webPreferences: {
nodeIntegration: true,
@@ -81,13 +83,6 @@ async function createMainWindow () {
mainWindow = null;
});
window.webContents.on('devtools-opened', () => {
window.focus();
setImmediate(() => {
window.focus();
});
});
return window;
}
@@ -120,6 +115,9 @@ else {
mainWindow = await createMainWindow();
createAppMenu();
if (isWindows) // Temporary workaround to https://github.com/electron/electron/issues/30024
mainWindow.show();
// if (isDevelopment)
// mainWindow.webContents.openDevTools();

View File

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

View File

@@ -616,6 +616,14 @@ export default {
},
removeField (uid) {
this.localFields = this.localFields.filter(field => field._antares_id !== uid);
this.localKeyUsage = this.localKeyUsage.filter(fk =>// Clear foreign keys
this.localFields.some(field => field.name === fk.field)
);
this.localIndexes = this.localIndexes.filter(index =>// Clear indexes
this.localFields.some(field =>
index.fields.includes(field.name)
)
);
},
addNewIndex (payload) {
this.localIndexes = [...this.localIndexes, {

View File

@@ -99,6 +99,9 @@
<span v-if="localRow.enumValues">
{{ localRow.enumValues }}
</span>
<span v-else-if="localRow.numScale">
{{ localLength }}, {{ localRow.numScale }}
</span>
<span v-else>
{{ localLength }}
</span>
@@ -112,6 +115,16 @@
class="editable-field form-input input-sm px-1"
@blur="editOFF"
>
<input
v-else-if="fieldType.scale"
ref="editField"
v-model="editingContent"
type="text"
autofocus
class="editable-field form-input input-sm px-1"
@keypress="checkLengthScale"
@blur="editOFF"
>
<input
v-else
ref="editField"
@@ -480,6 +493,11 @@ export default {
this.editingContent = this.localRow.enumValues;
this.originalContent = this.localRow.enumValues;
}
else if (this.fieldType.scale && field === 'length') {
const scale = this.localRow.numScale !== null ? this.localRow.numScale : 0;
this.editingContent = `${content}, ${scale}`;
this.originalContent = `${content}, ${scale}`;
}
else {
this.editingContent = content;
this.originalContent = content;
@@ -502,10 +520,17 @@ export default {
if (this.editingField === 'name')
this.$emit('rename-field', { old: this.localRow[this.editingField], new: this.editingContent });
this.localRow[this.editingField] = this.editingContent;
if (this.editingField === 'numLength' && this.fieldType.scale) {
const [length, scale] = this.editingContent.split(',');
this.localRow.numLength = +length;
this.localRow.numScale = scale ? +scale : null;
}
else
this.localRow[this.editingField] = this.editingContent;
if (this.editingField === 'type' && this.editingContent !== this.originalContent) {
this.localRow.numLength = null;
this.localRow.numScale = null;
this.localRow.charLength = null;
this.localRow.datePrecision = null;
this.localRow.enumValues = '';
@@ -560,6 +585,15 @@ export default {
this.originalContent = null;
this.editingField = null;
},
checkLengthScale (e) {
e = (e) || window.event;
const charCode = (e.which) ? e.which : e.keyCode;
if (((charCode > 31 && (charCode < 48 || charCode > 57)) && charCode !== 44) || (charCode === 44 && e.target.value.includes(',')))
e.preventDefault();
else
return true;
},
hideDefaultModal () {
this.isDefaultModal = false;
}

View File

@@ -280,6 +280,7 @@ export default {
fieldLength (field) {
if ([...BLOB, ...LONG_TEXT].includes(field.type)) return null;
else if (TEXT.includes(field.type)) return field.charLength;
else if (field.numScale) return `${field.numPrecision}, ${field.numScale}`;
return field.length;
},
keyName (key) {
@@ -407,10 +408,13 @@ export default {
const row = this.localResults.find(row => this.selectedRows.includes(row._antares_id));
const cellName = Object.keys(row).find(prop => [
this.selectedCell.field,
this.selectedCell.orgField,
`${this.fields[0].table}.${this.selectedCell.field}`,
`${this.fields[0].tableAlias}.${this.selectedCell.field}`
].includes(prop));
const valueToCopy = row[cellName];
let valueToCopy = row[cellName];
if (typeof valueToCopy === 'object')
valueToCopy = JSON.stringify(valueToCopy);
navigator.clipboard.writeText(valueToCopy);
},
copyRow () {

View File

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

View File

@@ -10,7 +10,7 @@
:key="cKey"
class="td p-0"
tabindex="0"
@contextmenu.prevent="openContext($event, { id: row._antares_id, field: cKey })"
@contextmenu.prevent="openContext($event, { id: row._antares_id, orgField: cKey })"
>
<template v-if="cKey !== '_antares_id'">
<span
@@ -123,6 +123,21 @@
</div>
</template>
</ConfirmModal>
<ConfirmModal
v-if="isMapModal"
:hide-footer="true"
size="medium"
@hide="hideEditorModal"
>
<template #header>
<div class="d-flex">
<i class="mdi mdi-24px mdi-map mr-1" /> <span class="cut-text">"{{ editingField }}"</span>
</div>
</template>
<template #body>
<BaseMap :points="editingContent" :is-multi-spatial="isMultiSpatial" />
</template>
</ConfirmModal>
<ConfirmModal
v-if="isBlobEditor"
:confirm-text="$t('word.update')"
@@ -187,10 +202,27 @@ import { mimeFromHex } from 'common/libs/mimeFromHex';
import { formatBytes } from 'common/libs/formatBytes';
import { bufferToBase64 } from 'common/libs/bufferToBase64';
import hexToBinary from 'common/libs/hexToBinary';
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BOOLEAN, DATE, TIME, DATETIME, BLOB, BIT, HAS_TIMEZONE } from 'common/fieldTypes';
import {
TEXT,
LONG_TEXT,
ARRAY,
TEXT_SEARCH,
NUMBER,
FLOAT,
BOOLEAN,
DATE,
TIME,
DATETIME,
BLOB,
BIT,
HAS_TIMEZONE,
SPATIAL,
IS_MULTI_SPATIAL
} from 'common/fieldTypes';
import { VueMaskDirective } from 'v-mask';
import ConfirmModal from '@/components/BaseConfirmModal';
import TextEditor from '@/components/BaseTextEditor';
import BaseMap from '@/components/BaseMap';
import ForeignKeySelect from '@/components/ForeignKeySelect';
export default {
@@ -198,7 +230,8 @@ export default {
components: {
ConfirmModal,
TextEditor,
ForeignKeySelect
ForeignKeySelect,
BaseMap
},
directives: {
mask: VueMaskDirective
@@ -248,7 +281,10 @@ export default {
return val;
}
return val;
if (SPATIAL.includes(type))
return val;
return typeof val === 'object' ? JSON.stringify(val) : val;
}
},
props: {
@@ -263,6 +299,8 @@ export default {
isInlineEditor: {},
isTextareaEditor: false,
isBlobEditor: false,
isMapModal: false,
isMultiSpatial: false,
willBeDeleted: false,
originalContent: null,
editingContent: null,
@@ -331,6 +369,9 @@ export default {
if (BOOLEAN.includes(this.editingType))
return { type: 'boolean', mask: false };
if (SPATIAL.includes(this.editingType))
return { type: 'map', mask: false };
return { type: 'text', mask: false };
},
isImage () {
@@ -403,7 +444,7 @@ export default {
return bufferToBase64(val);
},
editON (event, content, field) {
if (!this.isEditable) return;
if (!this.isEditable || this.editingType === 'none') return;
window.addEventListener('keydown', this.onKey);
@@ -419,6 +460,15 @@ export default {
return;
}
if (SPATIAL.includes(type)) {
if (content) {
this.isMultiSpatial = IS_MULTI_SPATIAL.includes(type);
this.isMapModal = true;
this.editingContent = this.$options.filters.typeFormat(content, type);
}
return;
}
if (BLOB.includes(type)) {
this.isBlobEditor = true;
this.editingContent = content || '';
@@ -490,6 +540,8 @@ export default {
hideEditorModal () {
this.isTextareaEditor = false;
this.isBlobEditor = false;
this.isMapModal = false;
this.isMultiSpatial = false;
},
downloadFile () {
const downloadLink = document.createElement('a');
@@ -526,7 +578,7 @@ export default {
return this.keyUsage.find(key => key.field === keyName);
},
openContext (event, payload) {
payload.field = this.fields[payload.field].name;// Ensures field name only
payload.field = this.fields[payload.orgField].name;// Ensures field name only
payload.isEditable = this.isEditable;
this.$emit('contextmenu', event, payload);
},

View File

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

View File

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

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

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

View File

@@ -3,6 +3,7 @@
import Vue from 'vue';
import '@mdi/font/css/materialdesignicons.css';
import 'leaflet/dist/leaflet.css';
import '@/scss/main.scss';
import App from '@/App.vue';

View File

@@ -81,6 +81,15 @@
"tsvector": $array-color,
"tsquery": $array-color,
"pg_node_tree": $array-color,
"point": $array-color,
"linestring": $array-color,
"polygon": $array-color,
"geometry": $array-color,
"multipoint": $array-color,
"multilinestring": $array-color,
"multipolygon": $array-color,
"geomcollection": $array-color,
"geometrycollection": $array-color,
"aclitem": $array-color,
"unknown": $unknown-color,
)

View File

@@ -1,18 +1,31 @@
const { _electron: electron } = require('playwright');
const { strict: assert } = require('assert');
const isWindows = process.platform === 'win32';
async function wait (ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
(async () => {
if (isWindows) {
console.log('Termporary skipping tests on Windows');
return;
}
console.log('Starting tests');
// Launch Electron app.
const electronApp = await electron.launch({ args: ['dist/main.js'] });
if (isWindows) await wait(5000);
/**
* App main window state
* @type {{isVisible: boolean; isDevToolsOpened: boolean; isCrashed: boolean}}
*/
const windowState = await electronApp.evaluate(({ BrowserWindow }) => {
const mainWindow = BrowserWindow.getAllWindows()[0];
const getState = () => ({
isVisible: mainWindow.isVisible(),
isDevToolsOpened: mainWindow.webContents.isDevToolsOpened()