mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 20:43:58 +00:00
view JSON log message
This commit is contained in:
@@ -9,11 +9,11 @@
|
|||||||
import { apiCall } from './utility/api';
|
import { apiCall } from './utility/api';
|
||||||
import FormStyledButton from './buttons/FormStyledButton.svelte';
|
import FormStyledButton from './buttons/FormStyledButton.svelte';
|
||||||
import getElectron from './utility/getElectron';
|
import getElectron from './utility/getElectron';
|
||||||
import { openWebLink } from './utility/exportFileTools';
|
|
||||||
import SpecialPageLayout from './widgets/SpecialPageLayout.svelte';
|
import SpecialPageLayout from './widgets/SpecialPageLayout.svelte';
|
||||||
import hasPermission from './utility/hasPermission';
|
import hasPermission from './utility/hasPermission';
|
||||||
import ErrorInfo from './elements/ErrorInfo.svelte';
|
import ErrorInfo from './elements/ErrorInfo.svelte';
|
||||||
import { isOneOfPage } from './utility/pageDefs';
|
import { isOneOfPage } from './utility/pageDefs';
|
||||||
|
import { openWebLink } from './utility/simpleTools';
|
||||||
|
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
const values = writable({ amoid: null, databaseServer: null });
|
const values = writable({ amoid: null, databaseServer: null });
|
||||||
|
|||||||
@@ -202,11 +202,6 @@
|
|||||||
on:click={async e => {
|
on:click={async e => {
|
||||||
const state = `dbg-dblogin:${strmid}:${selectedConnection?.conid}:${$values.amoid}`;
|
const state = `dbg-dblogin:${strmid}:${selectedConnection?.conid}:${$values.amoid}`;
|
||||||
sessionStorage.setItem('dbloginAuthState', state);
|
sessionStorage.setItem('dbloginAuthState', state);
|
||||||
// openWebLink(
|
|
||||||
// `connections/dblogin?conid=${selectedConnection?.conid}&state=${encodeURIComponent(state)}&redirectUri=${
|
|
||||||
// location.origin + location.pathname
|
|
||||||
// }`
|
|
||||||
// );
|
|
||||||
internalRedirectTo(
|
internalRedirectTo(
|
||||||
`/connections/dblogin-web?conid=${selectedConnection?.conid}&state=${encodeURIComponent(state)}&redirectUri=${extractRedirectUri()}`
|
`/connections/dblogin-web?conid=${selectedConnection?.conid}&state=${encodeURIComponent(state)}&redirectUri=${extractRedirectUri()}`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import { removeLocalStorage } from '../utility/storageCache';
|
|||||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import runCommand from './runCommand';
|
import runCommand from './runCommand';
|
||||||
import { openWebLink } from '../utility/exportFileTools';
|
|
||||||
import { getSettings } from '../utility/metadataLoaders';
|
import { getSettings } from '../utility/metadataLoaders';
|
||||||
import { isMac, switchCurrentDatabase } from '../utility/common';
|
import { isMac, switchCurrentDatabase } from '../utility/common';
|
||||||
import { doLogout } from '../clientAuth';
|
import { doLogout } from '../clientAuth';
|
||||||
@@ -46,6 +45,7 @@ import localforage from 'localforage';
|
|||||||
import { openImportExportTab } from '../utility/importExportTools';
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
import newTable from '../tableeditor/newTable';
|
import newTable from '../tableeditor/newTable';
|
||||||
import { isProApp } from '../utility/proTools';
|
import { isProApp } from '../utility/proTools';
|
||||||
|
import { openWebLink } from '../utility/simpleTools';
|
||||||
|
|
||||||
// function themeCommand(theme: ThemeDefinition) {
|
// function themeCommand(theme: ThemeDefinition) {
|
||||||
// return {
|
// return {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { openWebLink } from '../utility/exportFileTools';
|
|
||||||
import contextMenu from '../utility/contextMenu';
|
import contextMenu from '../utility/contextMenu';
|
||||||
import { internalRedirectTo } from '../clientAuth';
|
import { internalRedirectTo } from '../clientAuth';
|
||||||
|
import { openWebLink } from '../utility/simpleTools';
|
||||||
|
|
||||||
export let href = undefined;
|
export let href = undefined;
|
||||||
export let onClick = undefined;
|
export let onClick = undefined;
|
||||||
|
|||||||
@@ -1,19 +1,5 @@
|
|||||||
<script lang="ts" context="module">
|
|
||||||
function formatDuration(duration) {
|
|
||||||
if (duration == 0) return '0';
|
|
||||||
if (duration < 1000) {
|
|
||||||
return `${Math.round(duration)} ms`;
|
|
||||||
}
|
|
||||||
if (duration < 10000) {
|
|
||||||
return `${Math.round(duration / 100) / 10} s`;
|
|
||||||
}
|
|
||||||
return `${Math.round(duration / 1000)} s`;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte';
|
import MessageViewRow from './MessageViewRow.svelte';
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
export let items: any[];
|
export let items: any[];
|
||||||
export let showProcedure = false;
|
export let showProcedure = false;
|
||||||
@@ -22,8 +8,6 @@
|
|||||||
|
|
||||||
$: time0 = items[0] && new Date(items[0].time).getTime();
|
$: time0 = items[0] && new Date(items[0].time).getTime();
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
// $: console.log('MESSAGE ROWS', items);
|
// $: console.log('MESSAGE ROWS', items);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -43,28 +27,16 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{#each items as row, index}
|
{#each items as row, index}
|
||||||
<tr
|
<MessageViewRow
|
||||||
class:isError={row.severity == 'error'}
|
{row}
|
||||||
class:isDebug={row.severity == 'debug'}
|
{index}
|
||||||
class:isActive={row.line}
|
{showProcedure}
|
||||||
on:click={() => dispatch('messageclick', row)}
|
{showLine}
|
||||||
>
|
{time0}
|
||||||
<td>{index + 1}</td>
|
{startLine}
|
||||||
<td>{row.message}</td>
|
previousRow={index > 0 ? items[index - 1] : null}
|
||||||
<td>{moment(row.time).format('HH:mm:ss')}</td>
|
on:messageclick
|
||||||
<td>{formatDuration(new Date(row.time).getTime() - time0)}</td>
|
/>
|
||||||
<td>
|
|
||||||
{index > 0
|
|
||||||
? formatDuration(new Date(row.time).getTime() - new Date(items[index - 1].time).getTime())
|
|
||||||
: 'n/a'}</td
|
|
||||||
>
|
|
||||||
{#if showProcedure}
|
|
||||||
<td>{row.procedure || ''}</td>
|
|
||||||
{/if}
|
|
||||||
{#if showLine}
|
|
||||||
<td>{row.line == null ? '' : row.line + 1 + startLine}</td>
|
|
||||||
{/if}
|
|
||||||
</tr>
|
|
||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,23 +58,4 @@
|
|||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
td.header {
|
|
||||||
text-align: left;
|
|
||||||
border-bottom: 2px solid var(--theme-border);
|
|
||||||
background-color: var(--theme-bg-1);
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
td:not(.header) {
|
|
||||||
border-top: 1px solid var(--theme-border);
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
tr.isActive:hover {
|
|
||||||
background: var(--theme-bg-2);
|
|
||||||
}
|
|
||||||
tr.isError {
|
|
||||||
color: var(--theme-icon-red);
|
|
||||||
}
|
|
||||||
tr.isDebug {
|
|
||||||
color: var(--theme-font-3);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import { showModal } from '../modals/modalTools';
|
|||||||
import DatabaseLoginModal, { isDatabaseLoginVisible } from '../modals/DatabaseLoginModal.svelte';
|
import DatabaseLoginModal, { isDatabaseLoginVisible } from '../modals/DatabaseLoginModal.svelte';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
import { openWebLink } from './exportFileTools';
|
|
||||||
import { callServerPing } from './connectionsPinger';
|
import { callServerPing } from './connectionsPinger';
|
||||||
import { batchDispatchCacheTriggers, dispatchCacheChange } from './cache';
|
import { batchDispatchCacheTriggers, dispatchCacheChange } from './cache';
|
||||||
import { isAdminPage, isOneOfPage } from './pageDefs';
|
import { isAdminPage, isOneOfPage } from './pageDefs';
|
||||||
|
import { openWebLink } from './simpleTools';
|
||||||
|
|
||||||
export const strmid = uuidv1();
|
export const strmid = uuidv1();
|
||||||
|
|
||||||
|
|||||||
@@ -211,16 +211,6 @@ export async function saveFileToDisk(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openWebLink(href) {
|
|
||||||
const electron = getElectron();
|
|
||||||
|
|
||||||
if (electron) {
|
|
||||||
electron.send('open-link', href);
|
|
||||||
} else {
|
|
||||||
window.open(href, '_blank');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function downloadFromApi(route: string, donloadName: string) {
|
export async function downloadFromApi(route: string, donloadName: string) {
|
||||||
fetch(`${resolveApi()}/${route}`, {
|
fetch(`${resolveApi()}/${route}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -240,4 +230,3 @@ export async function downloadFromApi(route: string, donloadName: string) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
packages/web/src/utility/simpleTools.ts
Normal file
11
packages/web/src/utility/simpleTools.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import getElectron from './getElectron';
|
||||||
|
|
||||||
|
export function openWebLink(href) {
|
||||||
|
const electron = getElectron();
|
||||||
|
|
||||||
|
if (electron) {
|
||||||
|
electron.send('open-link', href);
|
||||||
|
} else {
|
||||||
|
window.open(href, '_blank');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user