mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
SYNC: create query on cloud shortcut
This commit is contained in:
committed by
Diflow
parent
e1e53d323f
commit
fa321d3e8d
@@ -11,6 +11,7 @@
|
||||
export let narrow = false;
|
||||
export let square = true;
|
||||
export let disabled = false;
|
||||
export let title = undefined;
|
||||
|
||||
let domButton;
|
||||
let isLoading = false;
|
||||
@@ -40,6 +41,7 @@
|
||||
bind:this={domButton}
|
||||
{disabled}
|
||||
data-testid={$$props['data-testid']}
|
||||
{title}
|
||||
>
|
||||
<FontIcon icon={isLoading ? 'icon loading' : icon} />
|
||||
</InlineButton>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
export let filePath;
|
||||
export let onSave = undefined;
|
||||
export let folid;
|
||||
export let skipLocal = false;
|
||||
// export let cntid;
|
||||
|
||||
const values = writable({ name, cloudFolder: folid ?? '__local' });
|
||||
@@ -59,7 +60,7 @@
|
||||
savedFolder: folder,
|
||||
savedFilePath: null,
|
||||
savedCloudFolderId: cloudFolder,
|
||||
// savedCloudContentId: resp.cntid,
|
||||
savedCloudContentId: resp.cntid,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -96,12 +97,14 @@
|
||||
name="cloudFolder"
|
||||
isNative
|
||||
requiredRoleVariants={['write', 'admin']}
|
||||
prependFolders={[
|
||||
{
|
||||
folid: '__local',
|
||||
name: "Local folder (don't store on cloud)",
|
||||
},
|
||||
]}
|
||||
prependFolders={skipLocal
|
||||
? []
|
||||
: [
|
||||
{
|
||||
folid: '__local',
|
||||
name: "Local folder (don't store on cloud)",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
||||
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
||||
import runCommand from '../commands/runCommand';
|
||||
import SaveFileModal from '../modals/SaveFileModal.svelte';
|
||||
import newQuery from '../query/newQuery';
|
||||
import openNewTab from '../utility/openNewTab';
|
||||
|
||||
let filter = '';
|
||||
let domSqlObjectList = null;
|
||||
@@ -68,6 +71,7 @@
|
||||
'name'
|
||||
);
|
||||
$: contentGroupMap = _.keyBy($cloudContentList || [], x => x.folid);
|
||||
$: privateFolderId = $cloudContentList?.find(x => x.isPrivate)?.folid;
|
||||
|
||||
// $: console.log('cloudContentFlat', cloudContentFlat);
|
||||
// $: console.log('contentGroupMap', contentGroupMap);
|
||||
@@ -110,6 +114,35 @@
|
||||
{
|
||||
command: 'new.connectionOnCloud',
|
||||
},
|
||||
{
|
||||
text: 'New SQL file',
|
||||
onClick: () => {
|
||||
const data = '';
|
||||
showModal(SaveFileModal, {
|
||||
data,
|
||||
skipLocal: true,
|
||||
folid: privateFolderId,
|
||||
folder: 'sql',
|
||||
onSave: (name, { savedFile, savedFolder, savedFilePath, savedCloudFolderId, savedCloudContentId }) => {
|
||||
openNewTab(
|
||||
{
|
||||
title: name,
|
||||
icon: 'img sql-file',
|
||||
tabComponent: 'QueryTab',
|
||||
props: {
|
||||
savedFolder: 'sql',
|
||||
savedFormat: 'text',
|
||||
savedFile,
|
||||
savedCloudFolderId,
|
||||
savedCloudContentId,
|
||||
},
|
||||
},
|
||||
{ editor: data }
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user