mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 21:46:00 +00:00
connecting to cloud database
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<script lang="ts" context="module">
|
||||
import { cloudConnectionsStore } from '../stores';
|
||||
import { apiCall } from '../utility/api';
|
||||
import AppObjectCore from './AppObjectCore.svelte';
|
||||
|
||||
export const extractKey = data => data.cntid;
|
||||
@@ -10,15 +12,44 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { filterName } from 'dbgate-tools';
|
||||
import ConnectionAppObject, { openConnection } from './ConnectionAppObject.svelte';
|
||||
|
||||
export let data;
|
||||
export let passProps;
|
||||
|
||||
function createMenu() {
|
||||
return [];
|
||||
}
|
||||
|
||||
async function handleOpenContent() {
|
||||
switch (data.type) {
|
||||
case 'connection':
|
||||
const conn = await apiCall('connections/get', { conid: data.conid });
|
||||
$cloudConnectionsStore[data.conid] = conn;
|
||||
openConnection(conn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<AppObjectCore {...$$restProps} {data} icon={'img connection'} title={data.name} menu={createMenu}></AppObjectCore>
|
||||
{#if data.conid && $cloudConnectionsStore[data.conid]}
|
||||
<ConnectionAppObject
|
||||
{passProps}
|
||||
data={{
|
||||
...$cloudConnectionsStore[data.conid],
|
||||
status: data.status,
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
<AppObjectCore
|
||||
{...$$restProps}
|
||||
{data}
|
||||
icon={'img connection'}
|
||||
title={data.name}
|
||||
menu={createMenu}
|
||||
on:click={handleOpenContent}
|
||||
></AppObjectCore>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.info {
|
||||
|
||||
10
packages/web/src/appobj/SubCloudItemsList.svelte
Normal file
10
packages/web/src/appobj/SubCloudItemsList.svelte
Normal file
@@ -0,0 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { cloudConnectionsStore } from '../stores';
|
||||
import SubDatabaseList from './SubDatabaseList.svelte';
|
||||
|
||||
export let data;
|
||||
</script>
|
||||
|
||||
{#if data.conid && $cloudConnectionsStore[data.conid]}
|
||||
<SubDatabaseList {...$$props} data={$cloudConnectionsStore[data.conid]} />
|
||||
{/if}
|
||||
Reference in New Issue
Block a user