mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 00:23:57 +00:00
refresh server summary
This commit is contained in:
@@ -1,9 +1,28 @@
|
|||||||
|
<script lang="ts" context="module">
|
||||||
|
const getCurrentEditor = () => getActiveComponent('ServerSummaryTab');
|
||||||
|
|
||||||
|
registerCommand({
|
||||||
|
id: 'serverSummary.refresh',
|
||||||
|
category: 'Server sumnmary',
|
||||||
|
name: 'Refresh',
|
||||||
|
keyText: 'F5 | CtrlOrCommand+R',
|
||||||
|
toolbar: true,
|
||||||
|
isRelatedToTab: true,
|
||||||
|
icon: 'icon reload',
|
||||||
|
onClick: () => getCurrentEditor().refresh(),
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
||||||
|
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
||||||
|
import registerCommand from '../commands/registerCommand';
|
||||||
import Link from '../elements/Link.svelte';
|
import Link from '../elements/Link.svelte';
|
||||||
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
||||||
|
|
||||||
import ObjectListControl from '../elements/ObjectListControl.svelte';
|
import ObjectListControl from '../elements/ObjectListControl.svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||||
import formatFileSize from '../utility/formatFileSize';
|
import formatFileSize from '../utility/formatFileSize';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
|
||||||
@@ -11,11 +30,17 @@
|
|||||||
|
|
||||||
let refreshToken = 0;
|
let refreshToken = 0;
|
||||||
|
|
||||||
|
export const activator = createActivator('ServerSummaryTab', true);
|
||||||
|
|
||||||
|
export function refresh() {
|
||||||
|
refreshToken += 1;
|
||||||
|
}
|
||||||
|
|
||||||
async function runAction(action, row) {
|
async function runAction(action, row) {
|
||||||
const { command, openQuery } = action;
|
const { command, openQuery } = action;
|
||||||
if (command) {
|
if (command) {
|
||||||
await apiCall('server-connections/summary-command', { conid, refreshToken, command, row });
|
await apiCall('server-connections/summary-command', { conid, refreshToken, command, row });
|
||||||
refreshToken += 1;
|
refresh();
|
||||||
}
|
}
|
||||||
if (openQuery) {
|
if (openQuery) {
|
||||||
openNewTab({
|
openNewTab({
|
||||||
@@ -32,6 +57,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<ToolStripContainer>
|
||||||
{#await apiCall('server-connections/server-summary', { conid, refreshToken })}
|
{#await apiCall('server-connections/server-summary', { conid, refreshToken })}
|
||||||
<LoadingInfo message="Loading server details" wrapper />
|
<LoadingInfo message="Loading server details" wrapper />
|
||||||
{:then summary}
|
{:then summary}
|
||||||
@@ -59,6 +85,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
|
<svelte:fragment slot="toolstrip">
|
||||||
|
<ToolStripCommandButton command="serverSummary.refresh" />
|
||||||
|
</svelte:fragment>
|
||||||
|
</ToolStripContainer>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.wrapper {
|
.wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user