mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 04:06:00 +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 narrow = false;
|
||||||
export let square = true;
|
export let square = true;
|
||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
|
export let title = undefined;
|
||||||
|
|
||||||
let domButton;
|
let domButton;
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
bind:this={domButton}
|
bind:this={domButton}
|
||||||
{disabled}
|
{disabled}
|
||||||
data-testid={$$props['data-testid']}
|
data-testid={$$props['data-testid']}
|
||||||
|
{title}
|
||||||
>
|
>
|
||||||
<FontIcon icon={isLoading ? 'icon loading' : icon} />
|
<FontIcon icon={isLoading ? 'icon loading' : icon} />
|
||||||
</InlineButton>
|
</InlineButton>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
export let filePath;
|
export let filePath;
|
||||||
export let onSave = undefined;
|
export let onSave = undefined;
|
||||||
export let folid;
|
export let folid;
|
||||||
|
export let skipLocal = false;
|
||||||
// export let cntid;
|
// export let cntid;
|
||||||
|
|
||||||
const values = writable({ name, cloudFolder: folid ?? '__local' });
|
const values = writable({ name, cloudFolder: folid ?? '__local' });
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
savedFolder: folder,
|
savedFolder: folder,
|
||||||
savedFilePath: null,
|
savedFilePath: null,
|
||||||
savedCloudFolderId: cloudFolder,
|
savedCloudFolderId: cloudFolder,
|
||||||
// savedCloudContentId: resp.cntid,
|
savedCloudContentId: resp.cntid,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,12 +97,14 @@
|
|||||||
name="cloudFolder"
|
name="cloudFolder"
|
||||||
isNative
|
isNative
|
||||||
requiredRoleVariants={['write', 'admin']}
|
requiredRoleVariants={['write', 'admin']}
|
||||||
prependFolders={[
|
prependFolders={skipLocal
|
||||||
{
|
? []
|
||||||
folid: '__local',
|
: [
|
||||||
name: "Local folder (don't store on cloud)",
|
{
|
||||||
},
|
folid: '__local',
|
||||||
]}
|
name: "Local folder (don't store on cloud)",
|
||||||
|
},
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
||||||
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
||||||
import runCommand from '../commands/runCommand';
|
import runCommand from '../commands/runCommand';
|
||||||
|
import SaveFileModal from '../modals/SaveFileModal.svelte';
|
||||||
|
import newQuery from '../query/newQuery';
|
||||||
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
|
||||||
let filter = '';
|
let filter = '';
|
||||||
let domSqlObjectList = null;
|
let domSqlObjectList = null;
|
||||||
@@ -68,6 +71,7 @@
|
|||||||
'name'
|
'name'
|
||||||
);
|
);
|
||||||
$: contentGroupMap = _.keyBy($cloudContentList || [], x => x.folid);
|
$: contentGroupMap = _.keyBy($cloudContentList || [], x => x.folid);
|
||||||
|
$: privateFolderId = $cloudContentList?.find(x => x.isPrivate)?.folid;
|
||||||
|
|
||||||
// $: console.log('cloudContentFlat', cloudContentFlat);
|
// $: console.log('cloudContentFlat', cloudContentFlat);
|
||||||
// $: console.log('contentGroupMap', contentGroupMap);
|
// $: console.log('contentGroupMap', contentGroupMap);
|
||||||
@@ -110,6 +114,35 @@
|
|||||||
{
|
{
|
||||||
command: 'new.connectionOnCloud',
|
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