Skip to content

Commit

Permalink
fix: create undefined node
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoliang committed Mar 19, 2022
1 parent e6f0345 commit 9567f29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Visual ZooKeeper",
"publisher": "gaoliang",
"description": "Visually manage your ZooKeeper in Visual Studio Code.",
"version": "1.0.0",
"version": "1.0.1",
"repository": "https://github.com/gaoliang/visual-zookeeper",
"license": "SEE LICENSE IN LICENSE",
"icon": "media/zk-logo.png",
Expand Down
14 changes: 12 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('visualZooKeeper.addNode', async (parent: ZkNode) => {
let nodeName = await vscode.window.showInputBox({
title: 'Input New Node Name',
placeHolder: 'Please input new node name.'
placeHolder: 'Please input new node name.',
validateInput: (value: string) => {
if (!value) {
return "Node name is empty";
}
if (value.indexOf("/") !== -1) {
return "Node name can't contain '/'";
}
}
});

if (!nodeName) {
return;
}
let fullNewPath = `${parent.fullPath === '/' ? '' : parent.fullPath}/${nodeName}`;
zkClient.client?.create(fullNewPath, function (error, path) {
if (error) {
Expand Down

0 comments on commit 9567f29

Please sign in to comment.