mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 10:16:03 +00:00
@@ -567,7 +567,10 @@
|
|||||||
|
|
||||||
export async function loadCellFromFile() {
|
export async function loadCellFromFile() {
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
const files = await electron.showOpenDialog({});
|
const files = await electron.showOpenDialog({
|
||||||
|
properties: ['showHiddenFiles', 'openFile'],
|
||||||
|
filters: [{ name: 'All Files', extensions: ['*'] }],
|
||||||
|
});
|
||||||
const file = files && files[0];
|
const file = files && files[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
const fs = window.require('fs');
|
const fs = window.require('fs');
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
if (!electron) return;
|
if (!electron) return;
|
||||||
const filePaths = await electron.showOpenDialog({
|
const filePaths = await electron.showOpenDialog({
|
||||||
defaultPath: values[name],
|
defaultPath: values[name],
|
||||||
properties: ['showHiddenFiles'],
|
properties: ['showHiddenFiles', 'openFile'],
|
||||||
filters: [{ name: 'All Files', extensions: ['*'] }],
|
filters: [{ name: 'All Files', extensions: ['*'] }],
|
||||||
});
|
});
|
||||||
const filePath = filePaths && filePaths[0];
|
const filePath = filePaths && filePaths[0];
|
||||||
|
|||||||
@@ -164,14 +164,19 @@ const authTypesLoader = ({ engine }) => ({
|
|||||||
url: 'plugins/auth-types',
|
url: 'plugins/auth-types',
|
||||||
params: { engine },
|
params: { engine },
|
||||||
reloadTrigger: `installed-plugins-changed`,
|
reloadTrigger: `installed-plugins-changed`,
|
||||||
|
errorValue: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getCore(loader, args) {
|
async function getCore(loader, args) {
|
||||||
const { url, params, reloadTrigger, transform, onLoaded } = loader(args);
|
const { url, params, reloadTrigger, transform, onLoaded, errorValue } = loader(args);
|
||||||
const key = stableStringify({ url, ...params });
|
const key = stableStringify({ url, ...params });
|
||||||
|
|
||||||
async function doLoad() {
|
async function doLoad() {
|
||||||
const resp = await apiCall(url, params);
|
const resp = await apiCall(url, params);
|
||||||
|
if (resp?.errorMessage && errorValue !== undefined) {
|
||||||
|
if (onLoaded) onLoaded(errorValue);
|
||||||
|
return errorValue;
|
||||||
|
}
|
||||||
const res = (transform || (x => x))(resp);
|
const res = (transform || (x => x))(resp);
|
||||||
if (onLoaded) onLoaded(res);
|
if (onLoaded) onLoaded(res);
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ export async function openElectronFile() {
|
|||||||
{ name: `SQLite database`, extensions: ['sqlite', 'db', 'sqlite3'] },
|
{ name: `SQLite database`, extensions: ['sqlite', 'db', 'sqlite3'] },
|
||||||
...getFileFormatFilters(ext),
|
...getFileFormatFilters(ext),
|
||||||
],
|
],
|
||||||
|
properties: ['showHiddenFiles', 'openFile'],
|
||||||
});
|
});
|
||||||
const filePath = filePaths && filePaths[0];
|
const filePath = filePaths && filePaths[0];
|
||||||
if (canOpenByElectron(filePath, ext)) {
|
if (canOpenByElectron(filePath, ext)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user