Merge branch 'master' into develop

This commit is contained in:
SPRINX0\prochazka
2024-07-24 15:43:14 +02:00
10 changed files with 57 additions and 23 deletions

View File

@@ -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) {

View File

@@ -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/*",

View File

@@ -214,14 +214,14 @@ export abstract class GridDisplay {
} }
if (this.baseTableOrView && this.config.multiColumnFilter) { if (this.baseTableOrView && this.config.multiColumnFilter) {
try {
const condition = parseFilter(this.config.multiColumnFilter, 'string');
if (condition) {
const orCondition: CompoudCondition = { const orCondition: CompoudCondition = {
conditionType: 'or', conditionType: 'or',
conditions: [], conditions: [],
}; };
for (const column of this.baseTableOrView.columns) { for (const column of this.baseTableOrView.columns) {
try {
const condition = parseFilter(this.config.multiColumnFilter, getFilterType(column.dataType));
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,14 +230,15 @@ export abstract class GridDisplay {
}) })
); );
} }
} catch (err) {
// skip for this column
continue;
}
}
if (orCondition.conditions.length > 0) { if (orCondition.conditions.length > 0) {
conditions.push(orCondition); conditions.push(orCondition);
} }
} }
} catch (err) {
console.warn(err.message);
}
}
if (conditions.length > 0) { if (conditions.length > 0) {
select.where = { select.where = {
@@ -482,6 +483,7 @@ export abstract class GridDisplay {
this.setConfig(cfg => ({ this.setConfig(cfg => ({
...cfg, ...cfg,
filters: {}, filters: {},
multiColumnFilter: null,
})); }));
this.reload(); this.reload();
} }

View File

@@ -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

View File

@@ -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')
`; `;

View File

@@ -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
`; `;

View File

@@ -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_'
`; `;

View File

@@ -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_'
`; `;

View File

@@ -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_'
`; `;

View File

@@ -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
`; `;