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