mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 15:33:57 +00:00
Merge branch 'master' into develop
This commit is contained in:
@@ -276,6 +276,28 @@ function fillMissingSettings(value) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureBoundsVisible(bounds) {
|
||||||
|
const area = electron.screen.getDisplayMatching(bounds).workArea;
|
||||||
|
|
||||||
|
let { x, y, width, height } = bounds;
|
||||||
|
|
||||||
|
const isWithinDisplay =
|
||||||
|
x >= area.x && x + width <= area.x + area.width && y >= area.y && y + height <= area.y + area.height;
|
||||||
|
|
||||||
|
if (!isWithinDisplay) {
|
||||||
|
width = Math.min(width, area.width);
|
||||||
|
height = Math.min(height, area.height);
|
||||||
|
|
||||||
|
if (width < 400) width = 400;
|
||||||
|
if (height < 300) height = 300;
|
||||||
|
|
||||||
|
x = area.x; // + Math.round(area.width - width / 2);
|
||||||
|
y = area.y; // + Math.round(area.height - height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { x, y, width, height };
|
||||||
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
let settingsJson = {};
|
let settingsJson = {};
|
||||||
try {
|
try {
|
||||||
@@ -288,7 +310,8 @@ function createWindow() {
|
|||||||
settingsJson = fillMissingSettings({});
|
settingsJson = fillMissingSettings({});
|
||||||
}
|
}
|
||||||
|
|
||||||
const bounds = initialConfig['winBounds'];
|
let bounds = initialConfig['winBounds'];
|
||||||
|
bounds = ensureBoundsVisible(bounds);
|
||||||
useNativeMenu = settingsJson['app.useNativeMenu'];
|
useNativeMenu = settingsJson['app.useNativeMenu'];
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
@@ -353,6 +376,11 @@ function createWindow() {
|
|||||||
mainWindow.on('unmaximize', () => {
|
mainWindow.on('unmaximize', () => {
|
||||||
mainWindow.webContents.send('setIsMaximized', false);
|
mainWindow.webContents.send('setIsMaximized', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// app.on('browser-window-focus', () => {
|
||||||
|
// const bounds = ensureBoundsVisible(mainWindow.getBounds());
|
||||||
|
// mainWindow.setBounds(bounds);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!apiLoaded) {
|
if (!apiLoaded) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "5.3.1",
|
"version": "5.3.2-beta.1",
|
||||||
"name": "dbgate-all",
|
"name": "dbgate-all",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|||||||
@@ -214,14 +214,14 @@ export abstract class GridDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.baseTableOrView && this.config.multiColumnFilter) {
|
if (this.baseTableOrView && this.config.multiColumnFilter) {
|
||||||
try {
|
const orCondition: CompoudCondition = {
|
||||||
const condition = parseFilter(this.config.multiColumnFilter, 'string');
|
conditionType: 'or',
|
||||||
if (condition) {
|
conditions: [],
|
||||||
const orCondition: CompoudCondition = {
|
};
|
||||||
conditionType: 'or',
|
for (const column of this.baseTableOrView.columns) {
|
||||||
conditions: [],
|
try {
|
||||||
};
|
const condition = parseFilter(this.config.multiColumnFilter, getFilterType(column.dataType));
|
||||||
for (const column of this.baseTableOrView.columns) {
|
if (condition) {
|
||||||
orCondition.conditions.push(
|
orCondition.conditions.push(
|
||||||
_.cloneDeepWith(condition, (expr: Expression) => {
|
_.cloneDeepWith(condition, (expr: Expression) => {
|
||||||
if (expr.exprType == 'placeholder') {
|
if (expr.exprType == 'placeholder') {
|
||||||
@@ -230,12 +230,13 @@ export abstract class GridDisplay {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (orCondition.conditions.length > 0) {
|
} catch (err) {
|
||||||
conditions.push(orCondition);
|
// skip for this column
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}
|
||||||
console.warn(err.message);
|
if (orCondition.conditions.length > 0) {
|
||||||
|
conditions.push(orCondition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,6 +483,7 @@ export abstract class GridDisplay {
|
|||||||
this.setConfig(cfg => ({
|
this.setConfig(cfg => ({
|
||||||
...cfg,
|
...cfg,
|
||||||
filters: {},
|
filters: {},
|
||||||
|
multiColumnFilter: null,
|
||||||
}));
|
}));
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ where
|
|||||||
table_schema <> 'information_schema'
|
table_schema <> 'information_schema'
|
||||||
and table_schema <> 'pg_catalog'
|
and table_schema <> 'pg_catalog'
|
||||||
and table_schema !~ '^pg_toast'
|
and table_schema !~ '^pg_toast'
|
||||||
|
and table_schema !~ '^_timescaledb_'
|
||||||
and (
|
and (
|
||||||
('tables:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
('tables:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ select
|
|||||||
md5(routine_definition) as "hash_code",
|
md5(routine_definition) as "hash_code",
|
||||||
routine_type as "object_type"
|
routine_type as "object_type"
|
||||||
from
|
from
|
||||||
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog'
|
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog' and routine_schema !~ '^_timescaledb_'
|
||||||
and routine_type in ('PROCEDURE', 'FUNCTION')
|
and routine_type in ('PROCEDURE', 'FUNCTION')
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ module.exports = `
|
|||||||
select
|
select
|
||||||
routine_name as "pure_name",
|
routine_name as "pure_name",
|
||||||
routine_schema as "schema_name",
|
routine_schema as "schema_name",
|
||||||
routine_definition as "definition",
|
max(routine_definition) as "definition",
|
||||||
md5(routine_definition) as "hash_code",
|
max(md5(routine_definition)) as "hash_code",
|
||||||
routine_type as "object_type",
|
routine_type as "object_type",
|
||||||
data_type as "data_type",
|
string_agg(data_type, '|') as "data_type",
|
||||||
external_language as "language"
|
max(external_language) as "language"
|
||||||
from
|
from
|
||||||
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog'
|
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog' and routine_schema !~ '^_timescaledb_'
|
||||||
and (
|
and (
|
||||||
(routine_type = 'PROCEDURE' and ('procedures:' || routine_schema || '.' || routine_name) =OBJECT_ID_CONDITION)
|
(routine_type = 'PROCEDURE' and ('procedures:' || routine_schema || '.' || routine_name) =OBJECT_ID_CONDITION)
|
||||||
or
|
or
|
||||||
(routine_type = 'FUNCTION' and ('functions:' || routine_schema || '.' || routine_name) =OBJECT_ID_CONDITION)
|
(routine_type = 'FUNCTION' and ('functions:' || routine_schema || '.' || routine_name) =OBJECT_ID_CONDITION)
|
||||||
)
|
)
|
||||||
|
group by routine_name, routine_schema, routine_type
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ and infoTables.table_schema <> 'pg_catalog'
|
|||||||
and infoTables.table_schema <> 'information_schema'
|
and infoTables.table_schema <> 'information_schema'
|
||||||
and infoTables.table_schema <> 'pg_internal'
|
and infoTables.table_schema <> 'pg_internal'
|
||||||
and infoTables.table_schema !~ '^pg_toast'
|
and infoTables.table_schema !~ '^pg_toast'
|
||||||
|
and infoTables.table_schema !~ '^_timescaledb_'
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ and infoTables.table_schema <> 'pg_catalog'
|
|||||||
and infoTables.table_schema <> 'information_schema'
|
and infoTables.table_schema <> 'information_schema'
|
||||||
and infoTables.table_schema <> 'pg_internal'
|
and infoTables.table_schema <> 'pg_internal'
|
||||||
and infoTables.table_schema !~ '^pg_toast'
|
and infoTables.table_schema !~ '^pg_toast'
|
||||||
|
and infoTables.table_schema !~ '^_timescaledb_'
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ select
|
|||||||
table_schema as "schema_name",
|
table_schema as "schema_name",
|
||||||
md5(view_definition) as "hash_code"
|
md5(view_definition) as "hash_code"
|
||||||
from
|
from
|
||||||
information_schema.views where table_schema != 'information_schema' and table_schema != 'pg_catalog'
|
information_schema.views where table_schema != 'information_schema' and table_schema != 'pg_catalog' and table_schema !~ '^_timescaledb_'
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ select
|
|||||||
md5(view_definition) as "hash_code"
|
md5(view_definition) as "hash_code"
|
||||||
from
|
from
|
||||||
information_schema.views
|
information_schema.views
|
||||||
where table_schema != 'information_schema' and table_schema != 'pg_catalog'
|
where table_schema != 'information_schema' and table_schema != 'pg_catalog' and table_schema !~ '^_timescaledb_'
|
||||||
and ('views:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
and ('views:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user