mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 01:23:57 +00:00
archive file - open in profiler
This commit is contained in:
@@ -41,7 +41,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const extractKey = data => data.fileName;
|
export const extractKey = data => data.fileName;
|
||||||
export const createMatcher = ({ fileName }) => filter => filterName(filter, fileName);
|
export const createMatcher =
|
||||||
|
({ fileName }) =>
|
||||||
|
filter =>
|
||||||
|
filterName(filter, fileName);
|
||||||
const ARCHIVE_ICONS = {
|
const ARCHIVE_ICONS = {
|
||||||
'table.yaml': 'img table',
|
'table.yaml': 'img table',
|
||||||
'view.sql': 'img view',
|
'view.sql': 'img view',
|
||||||
@@ -67,7 +70,7 @@
|
|||||||
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 } from '../stores';
|
import { archiveFilesAsDataSheets, currentArchive, extensions, getCurrentDatabase, getExtensions } from '../stores';
|
||||||
|
|
||||||
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
||||||
import { exportQuickExportFile } from '../utility/exportFileTools';
|
import { exportQuickExportFile } from '../utility/exportFileTools';
|
||||||
@@ -198,6 +201,25 @@
|
|||||||
),
|
),
|
||||||
data.fileType.endsWith('.sql') && { text: 'Open SQL', onClick: handleOpenSqlFile },
|
data.fileType.endsWith('.sql') && { text: 'Open SQL', onClick: handleOpenSqlFile },
|
||||||
data.fileType.endsWith('.yaml') && { text: 'Open YAML', onClick: handleOpenYamlFile },
|
data.fileType.endsWith('.yaml') && { text: 'Open YAML', onClick: handleOpenYamlFile },
|
||||||
|
data.fileType == 'jsonl' && {
|
||||||
|
text: 'Open in profiler',
|
||||||
|
submenu: getExtensions()
|
||||||
|
.drivers.filter(eng => eng.profilerFormatterFunction)
|
||||||
|
.map(eng => ({
|
||||||
|
text: eng.title,
|
||||||
|
onClick: () => {
|
||||||
|
openNewTab({
|
||||||
|
title: 'Profiler',
|
||||||
|
icon: 'img profiler',
|
||||||
|
tabComponent: 'ProfilerTab',
|
||||||
|
props: {
|
||||||
|
jslid: `archive://${data.folderName}/${data.fileName}`,
|
||||||
|
formatterFunction: eng.profilerFormatterFunction,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ export const getCurrentDatabase = () => currentDatabaseValue;
|
|||||||
let currentSettingsValue = null;
|
let currentSettingsValue = null;
|
||||||
export const getCurrentSettings = () => currentSettingsValue || {};
|
export const getCurrentSettings = () => currentSettingsValue || {};
|
||||||
|
|
||||||
let extensionsValue = null;
|
let extensionsValue: ExtensionsDirectory = null;
|
||||||
extensions.subscribe(value => {
|
extensions.subscribe(value => {
|
||||||
extensionsValue = value;
|
extensionsValue = value;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
category: 'Profiler',
|
category: 'Profiler',
|
||||||
name: 'Start profiling',
|
name: 'Start profiling',
|
||||||
icon: 'icon play',
|
icon: 'icon play',
|
||||||
testEnabled: () => getCurrentEditor() && !getCurrentEditor()?.isProfiling(),
|
testEnabled: () => getCurrentEditor()?.startProfilingEnabled(),
|
||||||
onClick: () => getCurrentEditor().startProfiling(),
|
onClick: () => getCurrentEditor().startProfiling(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
category: 'Profiler',
|
category: 'Profiler',
|
||||||
name: 'Stop profiling',
|
name: 'Stop profiling',
|
||||||
icon: 'icon play-stop',
|
icon: 'icon play-stop',
|
||||||
testEnabled: () => getCurrentEditor()?.isProfiling(),
|
testEnabled: () => getCurrentEditor()?.stopProfilingEnabled(),
|
||||||
onClick: () => getCurrentEditor().stopProfiling(),
|
onClick: () => getCurrentEditor().stopProfiling(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,9 +55,10 @@
|
|||||||
|
|
||||||
export let conid;
|
export let conid;
|
||||||
export let database;
|
export let database;
|
||||||
|
export let jslid;
|
||||||
|
export let formatterFunction;
|
||||||
|
|
||||||
let profiling = false;
|
let profiling = false;
|
||||||
let jslid;
|
|
||||||
let sessionId;
|
let sessionId;
|
||||||
|
|
||||||
let intervalId;
|
let intervalId;
|
||||||
@@ -104,6 +105,10 @@
|
|||||||
invalidateCommands();
|
invalidateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function startProfilingEnabled() {
|
||||||
|
return conid && database && !isProfiling;
|
||||||
|
}
|
||||||
|
|
||||||
export function stopProfiling() {
|
export function stopProfiling() {
|
||||||
profiling = false;
|
profiling = false;
|
||||||
apiCall('sessions/stop-profiler', { sesid: sessionId });
|
apiCall('sessions/stop-profiler', { sesid: sessionId });
|
||||||
@@ -111,6 +116,10 @@
|
|||||||
invalidateCommands();
|
invalidateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function stopProfilingEnabled() {
|
||||||
|
return conid && database && isProfiling;
|
||||||
|
}
|
||||||
|
|
||||||
export function saveEnabled() {
|
export function saveEnabled() {
|
||||||
return !!jslid;
|
return !!jslid;
|
||||||
}
|
}
|
||||||
@@ -132,7 +141,11 @@
|
|||||||
|
|
||||||
<ToolStripContainer>
|
<ToolStripContainer>
|
||||||
{#if jslid}
|
{#if jslid}
|
||||||
<JslDataGrid {jslid} listenInitializeFile formatterFunction={engine?.profilerFormatterFunction} />
|
<JslDataGrid
|
||||||
|
{jslid}
|
||||||
|
listenInitializeFile
|
||||||
|
formatterFunction={formatterFunction || engine?.profilerFormatterFunction}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<ErrorInfo message="Profiler not yet started" alignTop />
|
<ErrorInfo message="Profiler not yet started" alignTop />
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user