mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 07:36:01 +00:00
Merge branch 'master' into tableeditor2
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
# ChangeLog
|
||||
|
||||
### 4.2.6
|
||||
- Fixed MongoDB import
|
||||
- Configurable thousands separator #136
|
||||
- Using case insensitive text search in postgres
|
||||
|
||||
### 4.2.5
|
||||
- FIXED: Fixed crash when using large model on some installations
|
||||
- FIXED: Postgre SQL CREATE function
|
||||
|
||||
@@ -64,7 +64,7 @@ There are many database managers now, so why DbGate?
|
||||
* Backend - NodeJs, ExpressJs, socket.io, database connection drivers
|
||||
* JavaScript + TypeScript
|
||||
* App - electron
|
||||
* Platform independed - will run as web application in single docker container on server, or as application using Electron platform on Linux, Windows and Mac
|
||||
* Platform independent - will run as web application in single docker container on server, or as application using Electron platform on Linux, Windows and Mac
|
||||
|
||||
## Plugins
|
||||
Plugins are standard NPM packages published on [npmjs.com](https://www.npmjs.com).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"version": "4.2.6-beta.2",
|
||||
"version": "4.2.7",
|
||||
"name": "dbgate-all",
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
|
||||
@@ -75,6 +75,7 @@ export abstract class GridDisplay {
|
||||
}
|
||||
changeSetKeyFields: string[] = null;
|
||||
sortable = false;
|
||||
groupable = false;
|
||||
filterable = false;
|
||||
editable = false;
|
||||
isLoadedCorrectly = true;
|
||||
|
||||
@@ -35,6 +35,7 @@ export class TableGridDisplay extends GridDisplay {
|
||||
this.columns = this.getDisplayColumns(this.table, []);
|
||||
this.filterable = true;
|
||||
this.sortable = true;
|
||||
this.groupable = true;
|
||||
this.editable = true;
|
||||
this.supportsReload = true;
|
||||
this.baseTable = this.table;
|
||||
|
||||
@@ -17,6 +17,7 @@ export class ViewGridDisplay extends GridDisplay {
|
||||
this.columns = this.getDisplayColumns(view);
|
||||
this.filterable = true;
|
||||
this.sortable = true;
|
||||
this.groupable = true;
|
||||
this.editable = false;
|
||||
this.supportsReload = true;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseUp(e) {
|
||||
if (e.button == 1) {
|
||||
dispatch('middleclick');
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
function setChecked(value) {
|
||||
if (!value && isChecked) {
|
||||
checkedObjectsStore.update(x => x.filter(y => module.extractKey(data) != module.extractKey(y)));
|
||||
@@ -53,6 +61,7 @@
|
||||
class:isBold
|
||||
draggable={true}
|
||||
on:click={handleClick}
|
||||
on:mouseup={handleMouseUp}
|
||||
use:contextMenu={disableContextMenu ? null : menu}
|
||||
on:dragstart={e => {
|
||||
e.dataTransfer.setData('app_object_drag_data', JSON.stringify(data));
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
text: 'Connect',
|
||||
onClick: handleConnect,
|
||||
},
|
||||
{ onClick: handleNewQuery, text: 'New query' },
|
||||
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
||||
$openedConnections.includes(data._id) &&
|
||||
data.status && {
|
||||
text: 'Refresh',
|
||||
@@ -190,4 +190,9 @@
|
||||
on:click={handleConnect}
|
||||
on:click
|
||||
on:expand
|
||||
on:middleclick={() => {
|
||||
_.flattenDeep(getContextMenu())
|
||||
.find(x => x.isNewQuery)
|
||||
.onClick();
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
};
|
||||
|
||||
return [
|
||||
{ onClick: handleNewQuery, text: 'New query' },
|
||||
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
||||
{ onClick: handleImport, text: 'Import' },
|
||||
{ onClick: handleExport, text: 'Export' },
|
||||
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
|
||||
@@ -68,7 +68,7 @@
|
||||
<script lang="ts">
|
||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||
|
||||
import _ from 'lodash';
|
||||
import _, { find } from 'lodash';
|
||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||
@@ -93,5 +93,10 @@
|
||||
isBold={_.get($currentDatabase, 'connection._id') == _.get(data.connection, '_id') &&
|
||||
_.get($currentDatabase, 'name') == data.name}
|
||||
on:click={() => ($currentDatabase = data)}
|
||||
on:middleclick={() => {
|
||||
createMenu()
|
||||
.find(x => x.isNewQuery)
|
||||
.onClick();
|
||||
}}
|
||||
menu={createMenu}
|
||||
/>
|
||||
|
||||
@@ -328,7 +328,6 @@
|
||||
{ forceNewTab }
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -351,7 +350,7 @@
|
||||
|
||||
export let data;
|
||||
|
||||
function handleClick() {
|
||||
function handleClick(forceNewTab = false) {
|
||||
const { schemaName, pureName, conid, database, objectTypeField } = data;
|
||||
|
||||
openDatabaseObjectDetail(
|
||||
@@ -364,7 +363,7 @@
|
||||
database,
|
||||
objectTypeField,
|
||||
},
|
||||
false,
|
||||
forceNewTab,
|
||||
null
|
||||
);
|
||||
|
||||
@@ -508,7 +507,6 @@
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<AppObjectCore
|
||||
@@ -518,6 +516,7 @@
|
||||
title={data.schemaName ? `${data.schemaName}.${data.pureName}` : data.pureName}
|
||||
icon={icons[data.objectTypeField]}
|
||||
menu={createMenu}
|
||||
on:click={handleClick}
|
||||
on:click={() => handleClick()}
|
||||
on:middleclick={() => handleClick(true)}
|
||||
on:expand
|
||||
/>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import ColumnLabel from '../elements/ColumnLabel.svelte';
|
||||
import { isTypeDateTime } from 'dbgate-tools';
|
||||
import { openDatabaseObjectDetail } from '../appobj/DatabaseObjectAppObject.svelte';
|
||||
import { copyTextToClipboard } from '../utility/clipboard';
|
||||
|
||||
export let column;
|
||||
export let conid = undefined;
|
||||
@@ -27,19 +28,20 @@
|
||||
|
||||
function getMenu() {
|
||||
return [
|
||||
{ onClick: () => setSort('ASC'), text: 'Sort ascending' },
|
||||
{ onClick: () => setSort('DESC'), text: 'Sort descending' },
|
||||
setSort && { onClick: () => setSort('ASC'), text: 'Sort ascending' },
|
||||
setSort && { onClick: () => setSort('DESC'), text: 'Sort descending' },
|
||||
{ onClick: () => copyTextToClipboard(column.columnName), text: 'Copy column name' },
|
||||
|
||||
column.foreignKey && [{ divider: true }, { onClick: openReferencedTable, text: column.foreignKey.refTableName }],
|
||||
|
||||
{ divider: true },
|
||||
{ onClick: () => setGrouping('GROUP'), text: 'Group by' },
|
||||
{ onClick: () => setGrouping('MAX'), text: 'MAX' },
|
||||
{ onClick: () => setGrouping('MIN'), text: 'MIN' },
|
||||
{ onClick: () => setGrouping('SUM'), text: 'SUM' },
|
||||
{ onClick: () => setGrouping('AVG'), text: 'AVG' },
|
||||
{ onClick: () => setGrouping('COUNT'), text: 'COUNT' },
|
||||
{ onClick: () => setGrouping('COUNT DISTINCT'), text: 'COUNT DISTINCT' },
|
||||
setGrouping && { divider: true },
|
||||
setGrouping && { onClick: () => setGrouping('GROUP'), text: 'Group by' },
|
||||
setGrouping && { onClick: () => setGrouping('MAX'), text: 'MAX' },
|
||||
setGrouping && { onClick: () => setGrouping('MIN'), text: 'MIN' },
|
||||
setGrouping && { onClick: () => setGrouping('SUM'), text: 'SUM' },
|
||||
setGrouping && { onClick: () => setGrouping('AVG'), text: 'AVG' },
|
||||
setGrouping && { onClick: () => setGrouping('COUNT'), text: 'COUNT' },
|
||||
setGrouping && { onClick: () => setGrouping('COUNT DISTINCT'), text: 'COUNT DISTINCT' },
|
||||
|
||||
isTypeDateTime(column.dataType) && [
|
||||
{ divider: true },
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
return value;
|
||||
}
|
||||
|
||||
const dateTimeRegex = /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?Z?$/;
|
||||
// const dateTimeRegex = /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d\d)?Z?$/;
|
||||
const dateTimeRegex = /^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|()|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))$/;
|
||||
|
||||
function formatNumber(value) {
|
||||
if (value >= 10000 || value <= -10000) {
|
||||
@@ -25,12 +26,15 @@
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
function formatDateTime(testedString) {
|
||||
const m = testedString.match(dateTimeRegex);
|
||||
return `${m[1]}-${m[2]}-${m[3]} ${m[4]}:${m[5]}:${m[6]}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import moment from 'moment';
|
||||
import _ from 'lodash';
|
||||
import { isTypeLogical } from 'dbgate-tools';
|
||||
import ShowFormButton from '../formview/ShowFormButton.svelte';
|
||||
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||
|
||||
@@ -79,28 +83,18 @@
|
||||
{:else if value === undefined}
|
||||
<span class="null">(No field)</span>
|
||||
{:else if _.isDate(value)}
|
||||
{moment(value).format('YYYY-MM-DD HH:mm:ss')}
|
||||
{value.toString()}
|
||||
{:else if value === true}
|
||||
{#if isDynamicStructure}
|
||||
<span class="value">true</span>
|
||||
{:else}
|
||||
1
|
||||
{/if}
|
||||
<span class="value">true</span>
|
||||
{:else if value === false}
|
||||
{#if isDynamicStructure}
|
||||
<span class="value">false</span>
|
||||
{:else}
|
||||
0
|
||||
{/if}
|
||||
<span class="value">false</span>
|
||||
{:else if _.isNumber(value)}
|
||||
{#if isDynamicStructure}
|
||||
<span class="value">{formatNumber(value)}</span>
|
||||
{:else}
|
||||
{formatNumber(value)}
|
||||
{/if}
|
||||
<span class="value">{formatNumber(value)}</span>
|
||||
{:else if _.isString(value)}
|
||||
{#if dateTimeRegex.test(value)}
|
||||
{moment(value).format('YYYY-MM-DD HH:mm:ss')}
|
||||
<span class="value">
|
||||
{formatDateTime(value)}
|
||||
</span>
|
||||
{:else}
|
||||
{highlightSpecialCharacters(value)}
|
||||
{/if}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
name: 'Set NULL',
|
||||
keyText: 'Ctrl+0',
|
||||
testEnabled: () => getCurrentDataGrid()?.getGrider()?.editable,
|
||||
onClick: () => getCurrentDataGrid().setNull(),
|
||||
onClick: () => getCurrentDataGrid().setFixedValue(null),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
@@ -310,10 +310,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
export function setNull() {
|
||||
export function setFixedValue(value) {
|
||||
grider.beginUpdate();
|
||||
selectedCells.filter(isRegularCell).forEach(cell => {
|
||||
setCellValue(cell, null);
|
||||
setCellValue(cell, value);
|
||||
});
|
||||
grider.endUpdate();
|
||||
}
|
||||
@@ -733,6 +733,7 @@
|
||||
!event.altKey &&
|
||||
((event.keyCode >= keycodes.a && event.keyCode <= keycodes.z) ||
|
||||
(event.keyCode >= keycodes.n0 && event.keyCode <= keycodes.n9) ||
|
||||
(event.keyCode >= keycodes.numPad0 && event.keyCode <= keycodes.numPad9) ||
|
||||
event.keyCode == keycodes.dash)
|
||||
) {
|
||||
// @ts-ignore
|
||||
@@ -1050,7 +1051,7 @@
|
||||
// @ts-ignore
|
||||
display.resizeColumn(col.uniqueName, col.width, e.detail);
|
||||
}}
|
||||
setGrouping={display.sortable ? groupFunc => display.setGrouping(col.uniqueName, groupFunc) : null}
|
||||
setGrouping={display.groupable ? groupFunc => display.setGrouping(col.uniqueName, groupFunc) : null}
|
||||
grouping={display.getGrouping(col.uniqueName)}
|
||||
/>
|
||||
</td>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
name: 'Set NULL',
|
||||
keyText: 'Ctrl+0',
|
||||
testEnabled: () => getCurrentDataForm() != null,
|
||||
onClick: () => getCurrentDataForm().setNull(),
|
||||
onClick: () => getCurrentDataForm().setFixedValue(null),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
@@ -247,9 +247,9 @@
|
||||
// if (onSave) onSave();
|
||||
// }
|
||||
|
||||
export function setNull() {
|
||||
export function setFixedValue(value) {
|
||||
if (isDataCell(currentCell)) {
|
||||
setCellValue(currentCell, null);
|
||||
setCellValue(currentCell, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
if (tab.props && tab.props.conid && tab.props.database) return tab.props.database;
|
||||
if (tab.props && tab.props.conid) {
|
||||
const connection = connectionList?.find(x => x._id == tab.props.conid);
|
||||
if (connection) return getConnectionLabel(connection.displayName, { allowExplicitDatabase: false });
|
||||
if (connection) return getConnectionLabel(connection, { allowExplicitDatabase: false });
|
||||
return '???';
|
||||
}
|
||||
if (tab.props && tab.props.archiveFolder) return tab.props.archiveFolder;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const _isString = require('lodash/isString');
|
||||
const { driverBase } = global.DBGATE_TOOLS;
|
||||
const Dumper = require('./Dumper');
|
||||
const { noSplitSplitterOptions } = require('dbgate-query-splitter/lib/options');
|
||||
@@ -5,7 +6,7 @@ const { noSplitSplitterOptions } = require('dbgate-query-splitter/lib/options');
|
||||
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||
|
||||
function getConditionPreview(condition) {
|
||||
if (condition && _.isString(condition._id) && condition._id.match(mongoIdRegex)) {
|
||||
if (condition && _isString(condition._id) && condition._id.match(mongoIdRegex)) {
|
||||
return `{ _id: ObjectId('${condition._id}') }`;
|
||||
}
|
||||
return JSON.stringify(condition);
|
||||
|
||||
@@ -88,7 +88,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
|
||||
|
||||
const tables = tablesRows.rows.map(row => ({
|
||||
...row,
|
||||
contentHash: row.modifyDate.toISOString(),
|
||||
contentHash: row.modifyDate && row.modifyDate.toISOString(),
|
||||
columns: columnsRows.rows.filter(col => col.objectId == row.objectId).map(getColumnInfo),
|
||||
primaryKey: DatabaseAnalyser.extractPrimaryKeys(row, pkColumnsRows.rows),
|
||||
foreignKeys: DatabaseAnalyser.extractForeignKeys(row, fkColumnsRows.rows),
|
||||
@@ -96,7 +96,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
|
||||
|
||||
const views = viewsRows.rows.map(row => ({
|
||||
...row,
|
||||
contentHash: row.modifyDate.toISOString(),
|
||||
contentHash: row.modifyDate && row.modifyDate.toISOString(),
|
||||
createSql: getCreateSql(row),
|
||||
columns: viewColumnRows.rows.filter(col => col.objectId == row.objectId).map(getColumnInfo),
|
||||
}));
|
||||
@@ -105,7 +105,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
|
||||
.filter(x => x.sqlObjectType.trim() == 'P')
|
||||
.map(row => ({
|
||||
...row,
|
||||
contentHash: row.modifyDate.toISOString(),
|
||||
contentHash: row.modifyDate && row.modifyDate.toISOString(),
|
||||
createSql: getCreateSql(row),
|
||||
}));
|
||||
|
||||
@@ -113,7 +113,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
|
||||
.filter(x => ['FN', 'IF', 'TF'].includes(x.sqlObjectType.trim()))
|
||||
.map(row => ({
|
||||
...row,
|
||||
contentHash: row.modifyDate.toISOString(),
|
||||
contentHash: row.modifyDate && row.modifyDate.toISOString(),
|
||||
createSql: getCreateSql(row),
|
||||
}));
|
||||
|
||||
@@ -137,7 +137,7 @@ class MsSqlAnalyser extends DatabaseAnalyser {
|
||||
|
||||
res[field].push({
|
||||
objectId,
|
||||
contentHash: modifyDate.toISOString(),
|
||||
contentHash: modifyDate && modifyDate.toISOString(),
|
||||
schemaName,
|
||||
pureName,
|
||||
});
|
||||
|
||||
@@ -128,14 +128,14 @@ class Analyser extends DatabaseAnalyser {
|
||||
.map(x => ({
|
||||
...x,
|
||||
objectId: x.pureName,
|
||||
contentHash: x.modifyDate.toISOString(),
|
||||
contentHash: x.modifyDate && x.modifyDate.toISOString(),
|
||||
})),
|
||||
views: tableModificationsQueryData.rows
|
||||
.filter(x => x.objectType == 'VIEW')
|
||||
.map(x => ({
|
||||
...x,
|
||||
objectId: x.pureName,
|
||||
contentHash: x.modifyDate.toISOString(),
|
||||
contentHash: x.modifyDate && x.modifyDate.toISOString(),
|
||||
})),
|
||||
procedures: procedureModificationsQueryData.rows.map(x => ({
|
||||
contentHash: x.Modified,
|
||||
|
||||
@@ -86,6 +86,12 @@ class Dumper extends SqlDumper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
putValue(value) {
|
||||
if (value === true) this.putRaw('true');
|
||||
else if (value === false) this.putRaw('false');
|
||||
else super.putValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Dumper;
|
||||
|
||||
Reference in New Issue
Block a user