mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 20:23:59 +00:00
1
.node-version
Normal file
1
.node-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
16.14.2
|
||||||
@@ -62,6 +62,7 @@ function getPortalCollections() {
|
|||||||
displayName: process.env[`LABEL_${id}`],
|
displayName: process.env[`LABEL_${id}`],
|
||||||
isReadOnly: process.env[`READONLY_${id}`],
|
isReadOnly: process.env[`READONLY_${id}`],
|
||||||
databases: process.env[`DBCONFIG_${id}`] ? safeJsonParse(process.env[`DBCONFIG_${id}`]) : null,
|
databases: process.env[`DBCONFIG_${id}`] ? safeJsonParse(process.env[`DBCONFIG_${id}`]) : null,
|
||||||
|
parent: process.env[`PARENT_${id}`] || undefined,
|
||||||
|
|
||||||
// SSH tunnel
|
// SSH tunnel
|
||||||
useSshTunnel: process.env[`USE_SSH_${id}`],
|
useSshTunnel: process.env[`USE_SSH_${id}`],
|
||||||
|
|||||||
@@ -10,10 +10,12 @@
|
|||||||
export let group;
|
export let group;
|
||||||
export let groupFunc;
|
export let groupFunc;
|
||||||
export let items;
|
export let items;
|
||||||
|
export let groupIconFunc = plusExpandIcon;
|
||||||
export let module;
|
export let module;
|
||||||
export let checkedObjectsStore = null;
|
export let checkedObjectsStore = null;
|
||||||
export let disableContextMenu = false;
|
export let disableContextMenu = false;
|
||||||
export let passProps;
|
export let passProps;
|
||||||
|
export let onDropOnGroup = undefined;
|
||||||
|
|
||||||
let isExpanded = true;
|
let isExpanded = true;
|
||||||
|
|
||||||
@@ -35,9 +37,19 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="group" on:click={() => (isExpanded = !isExpanded)}>
|
<div
|
||||||
|
class="group"
|
||||||
|
on:click={() => (isExpanded = !isExpanded)}
|
||||||
|
on:drop={e => {
|
||||||
|
var data = e.dataTransfer.getData('app_object_drag_data');
|
||||||
|
if (data && onDropOnGroup) {
|
||||||
|
e.stopPropagation();
|
||||||
|
onDropOnGroup(data, group);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<span class="expand-icon">
|
<span class="expand-icon">
|
||||||
<FontIcon icon={plusExpandIcon(isExpanded)} />
|
<FontIcon icon={groupIconFunc(isExpanded)} />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{group}
|
{group}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { asyncFilter } from '../utility/common';
|
import { asyncFilter } from '../utility/common';
|
||||||
import AppObjectGroup from './AppObjectGroup.svelte';
|
import AppObjectGroup from './AppObjectGroup.svelte';
|
||||||
|
import { plusExpandIcon } from '../icons/expandIcons';
|
||||||
|
|
||||||
import AppObjectListItem from './AppObjectListItem.svelte';
|
import AppObjectListItem from './AppObjectListItem.svelte';
|
||||||
|
|
||||||
@@ -18,7 +19,9 @@
|
|||||||
export let getIsExpanded = null;
|
export let getIsExpanded = null;
|
||||||
export let setIsExpanded = null;
|
export let setIsExpanded = null;
|
||||||
|
|
||||||
|
export let groupIconFunc = plusExpandIcon;
|
||||||
export let groupFunc = undefined;
|
export let groupFunc = undefined;
|
||||||
|
export let onDropOnGroup = undefined;
|
||||||
|
|
||||||
$: filtered = !groupFunc
|
$: filtered = !groupFunc
|
||||||
? list.filter(data => {
|
? list.filter(data => {
|
||||||
@@ -71,6 +74,7 @@
|
|||||||
{module}
|
{module}
|
||||||
items={groups[group]}
|
items={groups[group]}
|
||||||
{expandIconFunc}
|
{expandIconFunc}
|
||||||
|
{groupIconFunc}
|
||||||
{isExpandable}
|
{isExpandable}
|
||||||
{subItemsComponent}
|
{subItemsComponent}
|
||||||
{checkedObjectsStore}
|
{checkedObjectsStore}
|
||||||
@@ -80,6 +84,7 @@
|
|||||||
{passProps}
|
{passProps}
|
||||||
{getIsExpanded}
|
{getIsExpanded}
|
||||||
{setIsExpanded}
|
{setIsExpanded}
|
||||||
|
{onDropOnGroup}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -220,6 +220,19 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if driver}
|
||||||
|
<div>
|
||||||
|
<div class="is-full select-row">
|
||||||
|
<!-- TODO: Able to use with svelte-select the possibility to use isCreatable & isClearable -->
|
||||||
|
<FormTextField
|
||||||
|
label="Parent Folder"
|
||||||
|
name="parent"
|
||||||
|
disabled={isConnected}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.row {
|
.row {
|
||||||
margin: var(--dim-large-form-margin);
|
margin: var(--dim-large-form-margin);
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import LargeButton from '../buttons/LargeButton.svelte';
|
import LargeButton from '../buttons/LargeButton.svelte';
|
||||||
import { matchingProps } from '../tabs/TableDataTab.svelte';
|
import { matchingProps } from '../tabs/TableDataTab.svelte';
|
||||||
|
import { plusExpandIcon, chevronExpandIcon } from '../icons/expandIcons';
|
||||||
|
import { safeJsonParse } from 'dbgate-tools';
|
||||||
|
|
||||||
const connections = useConnectionList();
|
const connections = useConnectionList();
|
||||||
const serverStatus = useServerStatus();
|
const serverStatus = useServerStatus();
|
||||||
@@ -40,12 +42,29 @@
|
|||||||
x => !x.unsaved || $openedConnections.includes(x._id) || $openedSingleDatabaseConnections.includes(x._id)
|
x => !x.unsaved || $openedConnections.includes(x._id) || $openedSingleDatabaseConnections.includes(x._id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$: connectionsWithParent = connectionsWithStatusFiltered
|
||||||
|
? connectionsWithStatusFiltered?.filter(x => x.parent !== undefined && x.parent !== null && x.parent.length !== 0)
|
||||||
|
: [];
|
||||||
|
$: connectionsWithoutParent = connectionsWithStatusFiltered
|
||||||
|
? connectionsWithStatusFiltered?.filter(x => x.parent === undefined || x.parent === null || x.parent.length === 0)
|
||||||
|
: [];
|
||||||
|
|
||||||
const handleRefreshConnections = () => {
|
const handleRefreshConnections = () => {
|
||||||
for (const conid of $openedConnections) {
|
for (const conid of $openedConnections) {
|
||||||
apiCall('server-connections/refresh', { conid });
|
apiCall('server-connections/refresh', { conid });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDropOnGroup = (data, group) => {
|
||||||
|
const json = safeJsonParse(data);
|
||||||
|
if (json?._id) {
|
||||||
|
apiCall('connections/update', {
|
||||||
|
_id: json?._id,
|
||||||
|
values: { parent: group },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const connectionColorFactory = useConnectionColorFactory(3);
|
const connectionColorFactory = useConnectionColorFactory(3);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -61,9 +80,36 @@
|
|||||||
<FontIcon icon="icon refresh" />
|
<FontIcon icon="icon refresh" />
|
||||||
</InlineButton>
|
</InlineButton>
|
||||||
</SearchBoxWrapper>
|
</SearchBoxWrapper>
|
||||||
<WidgetsInnerContainer>
|
<WidgetsInnerContainer
|
||||||
|
on:drop={e => {
|
||||||
|
var data = e.dataTransfer.getData('app_object_drag_data');
|
||||||
|
if (data) {
|
||||||
|
handleDropOnGroup(data, '');
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AppObjectList
|
<AppObjectList
|
||||||
list={_.sortBy(connectionsWithStatusFiltered, connection => (getConnectionLabel(connection) || '').toUpperCase())}
|
list={_.sortBy(connectionsWithParent, connection => (getConnectionLabel(connection) || '').toUpperCase())}
|
||||||
|
module={connectionAppObject}
|
||||||
|
subItemsComponent={SubDatabaseList}
|
||||||
|
expandOnClick
|
||||||
|
isExpandable={data => $openedConnections.includes(data._id) && !data.singleDatabase}
|
||||||
|
{filter}
|
||||||
|
passProps={{ connectionColorFactory: $connectionColorFactory, showPinnedInsteadOfUnpin: true }}
|
||||||
|
getIsExpanded={data => $expandedConnections.includes(data._id) && !data.singleDatabase}
|
||||||
|
setIsExpanded={(data, value) => {
|
||||||
|
expandedConnections.update(old => (value ? [...old, data._id] : old.filter(x => x != data._id)));
|
||||||
|
}}
|
||||||
|
groupIconFunc={chevronExpandIcon}
|
||||||
|
groupFunc={data => data.parent}
|
||||||
|
expandIconFunc={plusExpandIcon}
|
||||||
|
onDropOnGroup={handleDropOnGroup}
|
||||||
|
/>
|
||||||
|
{#if connectionsWithParent?.length > 0 && connectionsWithoutParent?.length > 0}
|
||||||
|
<div class="br" />
|
||||||
|
{/if}
|
||||||
|
<AppObjectList
|
||||||
|
list={_.sortBy(connectionsWithoutParent, connection => (getConnectionLabel(connection) || '').toUpperCase())}
|
||||||
module={connectionAppObject}
|
module={connectionAppObject}
|
||||||
subItemsComponent={SubDatabaseList}
|
subItemsComponent={SubDatabaseList}
|
||||||
expandOnClick
|
expandOnClick
|
||||||
@@ -84,3 +130,11 @@
|
|||||||
</ToolbarButton> -->
|
</ToolbarButton> -->
|
||||||
{/if}
|
{/if}
|
||||||
</WidgetsInnerContainer>
|
</WidgetsInnerContainer>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.br {
|
||||||
|
background: var(--theme-bg-2);
|
||||||
|
height: 1px;
|
||||||
|
margin: 5px 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div><slot /></div>
|
<div on:drop><slot /></div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div {
|
div {
|
||||||
|
|||||||
Reference in New Issue
Block a user