Merge pull request #815 from c-bata/fix-code-server-extension

Fix the bug of code-server extension fails to load studies on the first attempt.
This commit is contained in:
c-bata
2024-03-04 18:27:09 +09:00
committed by GitHub
5 changed files with 33 additions and 27 deletions
-3
View File
@@ -112,9 +112,6 @@ or install the code-server extension via [Open VSX](https://open-vsx.org/extensi
Please right-click the SQLite3 files (`*.db` or `*.sqlite3`) in the VS Code file explorer and select the "Open in Optuna Dashboard" command from the dropdown menu.
This extension leverages the browser-only version of Optuna Dashboard, so the same limitations apply.
Please note that we have confirmed the behavior of the code-server extension can be unstable.
When opening SQLite files, the dashboard may not appear on the first attempt, but it should be displayed upon a second try.
## Submitting patches
If you want to contribute, please check [Developers Guide](./CONTRIBUTING.md).
-3
View File
@@ -228,9 +228,6 @@ or install the code-server extension via `Open VSX <https://open-vsx.org/extensi
To use, right-click the SQLite3 files (``*.db`` or ``*.sqlite3``) in the file explorer and select the "Open in Optuna Dashboard" from the dropdown menu.
This extension leverages the browser-only version of Optuna Dashboard, so the same limitations apply.
Please note that we have confirmed the behavior of the code-server extension can be unstable.
When opening SQLite files, the dashboard may not appear on the first attempt, but it should be displayed upon a second try.
Google Colaboratory
-------------------
+15 -1
View File
@@ -6,4 +6,18 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [Unreleased]
- Initial release
* [bug] Fix a bug that the extension cannot show studies on the first attempt.
* [feature] Enable a "Open in Optuna Dashboard" menu for `.log` files.
## 0.2.0
* [feature] Added support for `JournalFileStorage`.
* [feature] Added support for code-server.
## 0.1.0
* [feature] Added older database schemas support (Optuna 2.6.0 or later)
## 0.0.1
* Initial Release
-15
View File
@@ -12,21 +12,6 @@ Please right-click on the SQLite3 file (`*.db` or `*.sqlite3`) in the file explo
Nothing to configure.
## Release Notes
### 0.2.0
* Added support for `JournalFileStorage`.
* Added support for code-server.
### 0.1.0
Added older database schemas support (Optuna 2.6.0 or later)
### 0.0.1
Initial Release
---
**Enjoy!**
+18 -5
View File
@@ -30,11 +30,16 @@ export function activate(context: vscode.ExtensionContext) {
const appPath = panel.webview.asWebviewUri(indexJsUri)
panel.webview.html = getWebviewContent(appPath)
const storageContentBase64 = await readFileAsBase64(fileUri)
panel.webview.postMessage({
type: "optunaStorage",
content: storageContentBase64,
panel.webview.onDidReceiveMessage(async (message: any) => {
switch (message.type) {
case "webviewDidLoad":
const storageContentBase64 = await readFileAsBase64(fileUri)
panel.webview.postMessage({
type: "optunaStorage",
content: storageContentBase64,
})
break
}
})
}
)
@@ -64,6 +69,14 @@ function getWebviewContent(indexJsUri: vscode.Uri): string {
<meta charset="utf-8" />
<title>Optuna Dashboard (Wasm ver.)</title>
<script type="module" crossorigin src="${indexJsUri}"></script>
<script>
(function() {
const vscodeApi = acquireVsCodeApi();
window.addEventListener('DOMContentLoaded', (event) => {
vscodeApi.postMessage({ type: 'webviewDidLoad' })
})
}())
</script>
</head>
<body>
<div id="root"></div>