-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#78) Network Viewer - Add console panel for logs
- Loading branch information
1 parent
b160d87
commit beffdfd
Showing
9 changed files
with
155 additions
and
22 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
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 { BasePanel } from "./BasePanel"; | ||
|
||
/** | ||
* This class manages the state and behavior of the ConsolePanel webview. | ||
* | ||
* This is a singleton. | ||
*/ | ||
export class ConsolePanel extends BasePanel { | ||
private static instance?: ConsolePanel; | ||
|
||
/** | ||
* ConsolePanel constructor called only from ConsolePanel.render() | ||
*/ | ||
private constructor() { | ||
super("suibase.console", "Sui Console"); | ||
} | ||
|
||
// Note: Does not use the activate/deactivate pattern (the BasePanel does). | ||
// Instead this subclass uses a render()/dispose() for its lifetime. | ||
// | ||
// This is because activate() always happens once and early while render() | ||
// and dispose() may happen or not depending of the user actions to display | ||
// the panel or not. | ||
// | ||
public static render() { | ||
if (!ConsolePanel.instance) { | ||
ConsolePanel.instance = new ConsolePanel(); | ||
} | ||
ConsolePanel.instance.render(); | ||
} | ||
|
||
// Dispose is a callback triggered by VSCode (see BasePanel). | ||
protected dispose() { | ||
console.log("ConsolePanel.dispose() called"); | ||
if (ConsolePanel.instance) { | ||
super.dispose(); | ||
delete ConsolePanel.instance; | ||
ConsolePanel.instance = undefined; | ||
} else { | ||
console.log("Error: dispose() called out of order"); | ||
} | ||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
typescript/vscode-extension/webview-ui/src/components/ConsoleController.svelte
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,63 @@ | ||
<script lang="ts"> | ||
import { VSCode } from "../lib/VSCode"; | ||
import { SuibaseJSONStorage } from "../common/SuibaseJSONStorage"; | ||
</script> | ||
|
||
<main> | ||
<ul class="no-bullets"> | ||
<li> | ||
2023-10-25 14:46:19.031 [info] > git show --textconv | ||
:typescript/vscode-extension/webview-ui/src/components/ConsoleController.svelte [21ms] | ||
</li> | ||
|
||
<li> | ||
2023-10-25 14:46:19.032 [info] > git ls-files --stage -- | ||
/home/olet/suibase/typescript/vscode-extension/webview-ui/src/components/ConsoleController.svelte [1ms] | ||
</li> | ||
|
||
<li>2023-10-25 14:53:26.114 [info] > git fetch [536ms]</li> | ||
|
||
<li>2023-10-25 14:53:26.145 [info] > git config --get commit.template [1ms]</li> | ||
|
||
<li> | ||
2023-10-25 14:53:26.165 [info] > git for-each-ref | ||
--format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) | ||
refs/heads/main refs/remotes/main [1ms] | ||
</li> | ||
|
||
<li>2023-10-25 14:53:26.181 [info] > git status -z -uall [3ms]</li> | ||
<li> | ||
2023-10-25 14:53:27.331 [info] > git ls-tree -l HEAD -- | ||
/home/olet/suibase/typescript/vscode-extension/src/panels/BasePanel.ts [18ms] | ||
</li> | ||
<li> | ||
2023-10-25 14:53:27.332 [info] > git ls-files --stage -- | ||
/home/olet/suibase/typescript/vscode-extension/webview-ui/src/components/ConsoleController.svelte [1ms] | ||
</li> | ||
</ul> | ||
</main> | ||
|
||
<style> | ||
/* Hide everything above this component. */ | ||
/*:global(#smui-app), | ||
:global(body), | ||
:global(html) { | ||
display: block !important; | ||
height: auto !important; | ||
width: auto !important; | ||
position: static !important; | ||
}*/ | ||
main { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: flex-start; | ||
} | ||
ul.no-bullets { | ||
list-style-type: none; /* Remove bullets */ | ||
padding: 0; /* Remove padding */ | ||
margin: 0; /* Remove margins */ | ||
} | ||
</style> |
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 @@ | ||
/// <reference types="svelte" /> | ||
/// <reference types="svelte" /> |