From 771ecb3b31d2b789451f9e3c9928c76a3ac98d26 Mon Sep 17 00:00:00 2001 From: Patrick Latimer Date: Thu, 24 Oct 2024 10:24:07 -0700 Subject: [PATCH 1/4] feat: alphabetize zk nodes --- src/ZkClient.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ZkClient.ts b/src/ZkClient.ts index 2757854..0523770 100644 --- a/src/ZkClient.ts +++ b/src/ZkClient.ts @@ -72,6 +72,7 @@ export const getChildren = (parent?: ZkNode): Promise => { if (error) { reject(error); } + children.sort(); resolve(children.map(child => { return new ZkNode( child, '', From e17f181940300365ef4b65209c4e2adc51b187f8 Mon Sep 17 00:00:00 2001 From: Patrick Latimer Date: Thu, 24 Oct 2024 10:46:44 -0700 Subject: [PATCH 2/4] feat: add configuration for default server and node language --- package.json | 27 +++++++++++++++++++++++---- src/extension.ts | 29 ++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 8366825..01aacde 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,17 @@ "displayName": "Visual ZooKeeper", "publisher": "gaoliang", "description": "Visually manage your ZooKeeper in Visual Studio Code.", - "version": "1.0.3", + "version": "1.0.4", "repository": "https://github.com/gaoliang/visual-zookeeper", "license": "SEE LICENSE IN LICENSE", "icon": "media/zk-logo.png", - "categories": ["Visualization", "Other"], - "keywords": ["zookeeper"], + "categories": [ + "Visualization", + "Other" + ], + "keywords": [ + "zookeeper" + ], "engines": { "vscode": "^1.65.0" }, @@ -31,6 +36,20 @@ } ] }, + "configuration": { + "title": "Visual ZooKeeper", + "properties": { + "visualZooKeeper.zooKeeperServer": { + "type": "string", + "description": "Comma separated host:port pairs, each represents a ZooKeeper server." + }, + "visualZooKeeper.nodeLanguage": { + "type": "string", + "default": "plaintext", + "description": "Default language mode used to edit ZK nodes without an extension" + } + } + }, "commands": [ { "command": "visualZooKeeper.editNode", @@ -87,7 +106,7 @@ { "command": "visualZooKeeper.copyPath", "when": "view == visualZooKeeper && viewItem == zkNode" - } + } ], "view/title": [ { diff --git a/src/extension.ts b/src/extension.ts index 690c1d5..d0f2665 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -43,6 +43,7 @@ export function activate(context: vscode.ExtensionContext) { zkStatProvider.onDidChangeEmitter.fire(uri); const doc = await vscode.workspace.openTextDocument(uri); // calls back into the provider await vscode.window.showTextDocument(doc, { preview: false }); + } else { vscode.window.showInformationMessage('[Visual ZooKeeper] node path is empty'); } @@ -55,14 +56,15 @@ export function activate(context: vscode.ExtensionContext) { zooKeeperProvider.refresh() )); - context.subscriptions.push(vscode.commands.registerCommand('visualZooKeeper.configureServer', async () => { - let server = await vscode.window.showInputBox({ - title: 'Configure ZooKeeper Server', - placeHolder: 'Comma separated host:port pairs,each represents a ZooKeeper server.' - }); - if (server) { - zkClient.createClient(server); + context.subscriptions.push(vscode.commands.registerCommand('visualZooKeeper.configureServer', async (server: string) => { + if (!server) { + let input = await vscode.window.showInputBox({ + title: 'Configure ZooKeeper Server', + placeHolder: 'Comma separated host:port pairs,each represents a ZooKeeper server.' + }); + if (input) { server = input; }; } + zkClient.createClient(server); })); @@ -120,6 +122,14 @@ export function activate(context: vscode.ExtensionContext) { let filePath = '/' + path.split("/").join(BIG_SOLIDUS); const uri = vscode.Uri.parse(zkfsScheme + ':' + filePath); vscode.commands.executeCommand("vscode.open", uri, {}, path); + const doc = await vscode.workspace.openTextDocument(uri); + await vscode.window.showTextDocument(doc, { preview: false }); + + if (vscode.window.activeTextEditor?.document.languageId === "plaintext") { + let lang = vscode.workspace.getConfiguration().get("visualZooKeeper.nodeLanguage", "yaml"); + await vscode.languages.setTextDocumentLanguage(doc, lang); + } + } else { vscode.window.showInformationMessage('[Visual ZooKeeper] node path is empty'); } @@ -130,6 +140,11 @@ export function activate(context: vscode.ExtensionContext) { vscode.window.showInformationMessage('[Visual ZooKeeper] Successfully write path to clipboard'); })); + const server = vscode.workspace.getConfiguration().get("visualZooKeeper.zooKeeperServer", false); + if (server) { + console.log("Server is set to " + server); + vscode.commands.executeCommand("visualZooKeeper.configureServer", server); + } // Use the console to output diagnostic information (console.log) and errors (console.error) // This line of code will only be executed once when your extension is activated console.log('Congratulations, your extension "visual-zookeeper" is now active!'); From fad885c5de97e7ba697dd493499a6c3af4cc7c12 Mon Sep 17 00:00:00 2001 From: Patrick Latimer Date: Thu, 24 Oct 2024 10:48:45 -0700 Subject: [PATCH 3/4] doc: update readme and changelog --- CHANGELOG.md | 6 ++++++ README.md | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00bdf60..f9c9715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [1.0.4] - 2023-05-26 +### Added +- Alphabetized ZK nodes in explorer +- Default language setting for nodes without extension +- Default ZK host configured on startup + ## [1.0.3] - 2022-03-19 ### Fixed - command title in extensiton manage page diff --git a/README.md b/README.md index 31cea6b..f607b72 100644 --- a/README.md +++ b/README.md @@ -19,15 +19,42 @@ Visually manage your ZooKeeper in Visual Studio Code. ## Extension Settings -When using Visual ZooKeeper for the first time, you need to configure the server address of zk, you can click the button or use the command palette to call out the configuration page. +- `visualZooKeeper.zooKeeperServer`, default `` +- `visualZooKeeper.nodeLanguage`, default `yaml` -![config](screenshots/6-config.png) +![settings](screenshots/settings.PNG) -## Known Issues +## Commands + +- `visualZooKeeper.editNode` +- `visualZooKeeper.refreshNode` +- `visualZooKeeper.configureServer` +- `visualZooKeeper.addNode` +- `visualZooKeeper.viewNodeStat` +- `visualZooKeeper.copyPath` + +## Development + +Follow the vscode extension documentation: https://code.visualstudio.com/api/get-started/your-first-extension + +- Install node.js and Git +- `npm install -g yo generator-code` +- `npm install -g yarn` +- `yarn` to install the project dependencies +- Use vsce to build the .vsix file for installation https://code.visualstudio.com/api/working-with-extensions/publishing-extension + - `npm install -g @vscode/vsce` + - Build with `vsce package` + ## Release Notes +### 1.0.4 + +- Alphabetized ZK nodes in explorer +- Default language setting for nodes without extension +- Default ZK host configured on startup + ### 1.0.0 Initial release of Visual ZooKeeper From cdd51e33e475ab95a2227073861838f3a590c520 Mon Sep 17 00:00:00 2001 From: Patrick Latimer Date: Thu, 24 Oct 2024 10:50:35 -0700 Subject: [PATCH 4/4] doc: update readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f607b72..8e3d7bd 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,6 @@ Visually manage your ZooKeeper in Visual Studio Code. - `visualZooKeeper.zooKeeperServer`, default `` - `visualZooKeeper.nodeLanguage`, default `yaml` -![settings](screenshots/settings.PNG) - ## Commands