-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add global shortcut to export logs (#2336)
- Added `Ctrl+Alt+Shift+L/Cmd-Option-Shift-L` as a global shortcut for exporting support logs - When pressed in code-studio, it will download logs with the same contents as logs produced by pressing the 'Export Logs' button in the settings menu - When pressed in other contexts: when not logged in, on a reconnect error, or in embed-widgets, the logs are exported without the plugin and server info - Tested by E2E tests that navigate to the various contexts, presses the shortcut, and checks if a file was downloaded. Can further inspect the file downloaded in the tests but unsure if that's necessary Closes #1963 --------- Co-authored-by: Mike Bender <[email protected]>
- Loading branch information
Showing
14 changed files
with
134 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/app-utils/src/utils/createExportLogsContextAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { type ContextAction, GLOBAL_SHORTCUTS } from '@deephaven/components'; | ||
import { exportLogs, logHistory } from '@deephaven/log'; | ||
import { store } from '@deephaven/redux'; | ||
|
||
export function createExportLogsContextAction( | ||
metadata?: Record<string, unknown>, | ||
isGlobal = false | ||
): ContextAction { | ||
return { | ||
action: () => { | ||
exportLogs( | ||
logHistory, | ||
{ | ||
...metadata, | ||
userAgent: navigator.userAgent, | ||
}, | ||
store.getState() | ||
); | ||
}, | ||
shortcut: GLOBAL_SHORTCUTS.EXPORT_LOGS, | ||
isGlobal, | ||
}; | ||
} | ||
|
||
export default createExportLogsContextAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './ConnectUtils'; | ||
export * from './createExportLogsContextAction'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { gotoPage } from './utils'; | ||
|
||
test('shortcut downloads logs', async ({ page }) => { | ||
await gotoPage(page, ''); | ||
|
||
const downloadPromise = page.waitForEvent('download'); | ||
await page.keyboard.press('ControlOrMeta+Alt+Shift+KeyL'); | ||
const download = await downloadPromise; | ||
|
||
expect(download).not.toBeNull(); | ||
}); | ||
|
||
test('shortcut downloads logs in full screen error', async ({ page }) => { | ||
// Go to embed-widget page without url parameter to trigger a full screen error | ||
await gotoPage(page, 'http://localhost:4010/'); | ||
|
||
const downloadPromise = page.waitForEvent('download'); | ||
await page.keyboard.press('ControlOrMeta+Alt+Shift+KeyL'); | ||
const download = await downloadPromise; | ||
|
||
expect(download).not.toBeNull(); | ||
}); | ||
|
||
test('shortcut downloads logs in embeded-widget', async ({ page }) => { | ||
test.slow(true, "Extend timeout to prevent a failure before page loads"); | ||
|
||
// The embed-widgets page and the table itself have separate loading spinners, | ||
// causing a strict mode violation intermittently when using the goToPage helper | ||
await gotoPage(page, 'http://localhost:4010?name=all_types'); | ||
await expect( | ||
page.getByRole('progressbar', { | ||
name: 'Loading...', | ||
exact: true, | ||
}) | ||
).toHaveCount(0); | ||
|
||
const downloadPromise = page.waitForEvent('download'); | ||
await page.keyboard.press('ControlOrMeta+Alt+Shift+KeyL'); | ||
const download = await downloadPromise; | ||
|
||
expect(download).not.toBeNull(); | ||
}); |