mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 21:53:58 +00:00
removed marking archive as data sheet
This commit is contained in:
@@ -54,11 +54,9 @@
|
|||||||
'matview.sql': 'img view',
|
'matview.sql': 'img view',
|
||||||
};
|
};
|
||||||
|
|
||||||
function getArchiveIcon(archiveFilesAsDataSheets, data) {
|
function getArchiveIcon(data) {
|
||||||
if (data.fileType == 'jsonl') {
|
if (data.fileType == 'jsonl') {
|
||||||
return isArchiveFileMarkedAsDataSheet(archiveFilesAsDataSheets, data.folderName, data.fileName)
|
return 'img archive';
|
||||||
? 'img free-table'
|
|
||||||
: 'img archive';
|
|
||||||
}
|
}
|
||||||
return ARCHIVE_ICONS[data.fileType];
|
return ARCHIVE_ICONS[data.fileType];
|
||||||
}
|
}
|
||||||
@@ -70,20 +68,14 @@
|
|||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
|
|
||||||
import { archiveFilesAsDataSheets, currentArchive, extensions, getCurrentDatabase, getExtensions } from '../stores';
|
import { getExtensions } from '../stores';
|
||||||
|
|
||||||
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
||||||
import { exportQuickExportFile } from '../utility/exportFileTools';
|
import { exportQuickExportFile } from '../utility/exportFileTools';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import AppObjectCore from './AppObjectCore.svelte';
|
import AppObjectCore from './AppObjectCore.svelte';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import InputTextModal from '../modals/InputTextModal.svelte';
|
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||||
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
||||||
import {
|
|
||||||
isArchiveFileMarkedAsDataSheet,
|
|
||||||
markArchiveFileAsDataSheet,
|
|
||||||
markArchiveFileAsReadonly,
|
|
||||||
} from '../utility/archiveTools';
|
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
@@ -116,12 +108,10 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handleOpenRead = () => {
|
const handleOpenArchive = () => {
|
||||||
markArchiveFileAsReadonly(data.folderName, data.fileName);
|
|
||||||
openArchive(data.fileName, data.folderName);
|
openArchive(data.fileName, data.folderName);
|
||||||
};
|
};
|
||||||
const handleOpenWrite = () => {
|
const handleOpenDataSheet = () => {
|
||||||
markArchiveFileAsDataSheet(data.folderName, data.fileName);
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: data.fileName,
|
title: data.fileName,
|
||||||
icon: 'img free-table',
|
icon: 'img free-table',
|
||||||
@@ -141,11 +131,7 @@
|
|||||||
};
|
};
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
if (data.fileType == 'jsonl') {
|
if (data.fileType == 'jsonl') {
|
||||||
if (isArchiveFileMarkedAsDataSheet($archiveFilesAsDataSheets, data.folderName, data.fileName)) {
|
handleOpenArchive();
|
||||||
handleOpenWrite();
|
|
||||||
} else {
|
|
||||||
handleOpenRead();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (data.fileType.endsWith('.sql')) {
|
if (data.fileType.endsWith('.sql')) {
|
||||||
handleOpenSqlFile();
|
handleOpenSqlFile();
|
||||||
@@ -166,8 +152,8 @@
|
|||||||
|
|
||||||
function createMenu() {
|
function createMenu() {
|
||||||
return [
|
return [
|
||||||
data.fileType == 'jsonl' && { text: 'Open (readonly)', onClick: handleOpenRead },
|
data.fileType == 'jsonl' && { text: 'Open', onClick: handleOpenArchive },
|
||||||
data.fileType == 'jsonl' && { text: 'Open as data sheet', onClick: handleOpenWrite },
|
data.fileType == 'jsonl' && { text: 'Open as data sheet', onClick: handleOpenDataSheet },
|
||||||
data.fileType == 'jsonl' && { text: 'Open in text editor', onClick: handleOpenJsonLinesText },
|
data.fileType == 'jsonl' && { text: 'Open in text editor', onClick: handleOpenJsonLinesText },
|
||||||
{ text: 'Delete', onClick: handleDelete },
|
{ text: 'Delete', onClick: handleDelete },
|
||||||
{ text: 'Rename', onClick: handleRename },
|
{ text: 'Rename', onClick: handleRename },
|
||||||
@@ -232,7 +218,7 @@
|
|||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
{data}
|
{data}
|
||||||
title={data.fileLabel}
|
title={data.fileLabel}
|
||||||
icon={getArchiveIcon($archiveFilesAsDataSheets, data)}
|
icon={getArchiveIcon(data)}
|
||||||
menu={createMenu}
|
menu={createMenu}
|
||||||
on:click={handleClick}
|
on:click={handleClick}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ export const pinnedDatabases = writableWithStorage([], 'pinnedDatabases');
|
|||||||
export const pinnedTables = writableWithStorage([], 'pinnedTables');
|
export const pinnedTables = writableWithStorage([], 'pinnedTables');
|
||||||
export const commandsSettings = writable({});
|
export const commandsSettings = writable({});
|
||||||
export const allResultsInOneTabDefault = writableWithStorage(false, 'allResultsInOneTabDefault');
|
export const allResultsInOneTabDefault = writableWithStorage(false, 'allResultsInOneTabDefault');
|
||||||
export const archiveFilesAsDataSheets = writableWithStorage([], 'archiveFilesAsDataSheets');
|
|
||||||
export const commandsCustomized = derived([commands, commandsSettings], ([$commands, $commandsSettings]) =>
|
export const commandsCustomized = derived([commands, commandsSettings], ([$commands, $commandsSettings]) =>
|
||||||
_.mapValues($commands, (v, k) => ({
|
_.mapValues($commands, (v, k) => ({
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
import SaveArchiveModal from '../modals/SaveArchiveModal.svelte';
|
import SaveArchiveModal from '../modals/SaveArchiveModal.svelte';
|
||||||
import useEditorData from '../query/useEditorData';
|
import useEditorData from '../query/useEditorData';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { markArchiveFileAsDataSheet } from '../utility/archiveTools';
|
|
||||||
import { changeTab } from '../utility/common';
|
import { changeTab } from '../utility/common';
|
||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||||
@@ -95,7 +94,6 @@
|
|||||||
}));
|
}));
|
||||||
archiveFile = file;
|
archiveFile = file;
|
||||||
archiveFolder = folder;
|
archiveFolder = folder;
|
||||||
markArchiveFileAsDataSheet(folder, file);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleRunMacro(macro, params, cells) {
|
function handleRunMacro(macro, params, cells) {
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import { archiveFilesAsDataSheets } from '../stores';
|
|
||||||
|
|
||||||
export function markArchiveFileAsDataSheet(folder, file) {
|
|
||||||
archiveFilesAsDataSheets.update(ar =>
|
|
||||||
ar.find(x => x.folder == folder && x.file == file) ? ar : [...ar, { folder, file }]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function markArchiveFileAsReadonly(folder, file) {
|
|
||||||
archiveFilesAsDataSheets.update(ar => ar.filter(x => x.folder != folder || x.file != file));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isArchiveFileMarkedAsDataSheet(store, folder, file) {
|
|
||||||
return !!store.find(x => x.folder == folder && x.file == file);
|
|
||||||
}
|
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
import newQuery from '../query/newQuery';
|
import newQuery from '../query/newQuery';
|
||||||
import { currentApplication } from '../stores';
|
import { currentApplication } from '../stores';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { markArchiveFileAsDataSheet } from '../utility/archiveTools';
|
|
||||||
import { useAppFiles, useArchiveFolders } from '../utility/metadataLoaders';
|
import { useAppFiles, useArchiveFolders } from '../utility/metadataLoaders';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import WidgetsInnerContainer from './WidgetsInnerContainer.svelte';
|
import WidgetsInnerContainer from './WidgetsInnerContainer.svelte';
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import { currentArchive } from '../stores';
|
import { currentArchive } from '../stores';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { markArchiveFileAsDataSheet } from '../utility/archiveTools';
|
|
||||||
import { useArchiveFiles, useArchiveFolders } from '../utility/metadataLoaders';
|
import { useArchiveFiles, useArchiveFolders } from '../utility/metadataLoaders';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import WidgetsInnerContainer from './WidgetsInnerContainer.svelte';
|
import WidgetsInnerContainer from './WidgetsInnerContainer.svelte';
|
||||||
@@ -54,7 +53,6 @@
|
|||||||
file,
|
file,
|
||||||
data: createFreeTableModel(),
|
data: createFreeTableModel(),
|
||||||
});
|
});
|
||||||
markArchiveFileAsDataSheet($currentArchive, file);
|
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: file,
|
title: file,
|
||||||
|
|||||||
Reference in New Issue
Block a user