mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 06:46:00 +00:00
connections pinger
This commit is contained in:
@@ -1,9 +1,28 @@
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
import AppObjectCore from './AppObjectCore.svelte';
|
||||
import { currentDatabase, openedConnections } from '../stores';
|
||||
|
||||
export let commonProps;
|
||||
export let data;
|
||||
|
||||
function getStatusIcon(opened) {
|
||||
const { _id, status } = data;
|
||||
if (opened.includes(_id)) {
|
||||
if (!status) return 'icon loading';
|
||||
if (status.name == 'pending') return 'icon loading';
|
||||
if (status.name == 'ok') return 'img ok';
|
||||
return 'img error';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<AppObjectCore {...commonProps} title={data.displayName || data.server} icon="img server" />
|
||||
<AppObjectCore
|
||||
{...commonProps}
|
||||
title={data.displayName || data.server}
|
||||
icon="img server"
|
||||
isBold={_.get($currentDatabase, 'connection._id') == data._id}
|
||||
statusIcon={getStatusIcon($openedConnections)}
|
||||
statusTitle={data.status && data.status.name == 'error' ? data.status.message : null}
|
||||
on:click={() => ($openedConnections = _.uniq([...$openedConnections, data._id]))}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user