Skip to content

Commit

Permalink
SNAPSHOT.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsjohnmurray committed Apr 15, 2021
1 parent 1c5b2e0 commit 85b4941
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "servermanager",
"displayName": "InterSystems Server Manager",
"version": "2.0.0-SNAPSHOT.3",
"version": "2.0.0-SNAPSHOT.4",
"publisher": "intersystems-community",
"description": "Helper extension for defining connections to InterSystems servers.",
"repository": {
Expand Down Expand Up @@ -246,7 +246,7 @@
},
{
"command": "intersystems-community.servermanager.retryServer",
"title": "Reconnect",
"title": "Refresh",
"icon": "$(refresh)"
},
{
Expand Down Expand Up @@ -427,6 +427,11 @@
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
"group": "inline@90"
},
{
"command": "intersystems-community.servermanager.retryServer",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
"group": "0_refresh@10"
},
{
"submenu": "intersystems-community.servermanager.iconColor",
"when": "view == intersystems-community_servermanager && viewItem =~ /\\.server\\./",
Expand Down
15 changes: 12 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getServerNames } from './api/getServerNames';
import { getServerSpec } from './api/getServerSpec';
import { storePassword, clearPassword } from './commands/managePasswords';
import { importFromRegistry } from './commands/importFromRegistry';
import { ServerManagerView, ServerTreeItem } from './ui/serverManagerView';
import { ServerManagerView, ServerTreeItem, SMTreeItem } from './ui/serverManagerView';
import { addServer } from './api/addServer';
import { getPortalUriWithCredentials } from './api/getPortalUriWithCredentials';
import { getServerSummary } from './api/getServerSummary';
Expand Down Expand Up @@ -188,8 +188,17 @@ export function activate(context: vscode.ExtensionContext) {
);

context.subscriptions.push(
vscode.commands.registerCommand(`${extensionId}.retryServer`, () => {
view.refreshTree();
vscode.commands.registerCommand(`${extensionId}.retryServer`, (treeItem: SMTreeItem) => {
const depth = treeItem.id?.split(':').length;
if (depth === 2) {
view.refreshTree(treeItem);
}
else if (depth === 3) {
view.refreshTree(treeItem.parent);
}
else if (depth === 4) {
view.refreshTree(treeItem.parent?.parent);
}
})
);

Expand Down
13 changes: 5 additions & 8 deletions src/ui/serverManagerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export class ServerManagerView {

private _globalState: vscode.Memento;

private _treeView: vscode.TreeView<SMTreeItem>;

private _treeDataProvider: SMNodeProvider;

constructor(context: vscode.ExtensionContext) {
Expand All @@ -33,7 +31,6 @@ export class ServerManagerView {
this._treeDataProvider = treeDataProvider;

const treeView = vscode.window.createTreeView('intersystems-community_servermanager', { treeDataProvider, showCollapseAll: true })
this._treeView = treeView;
context.subscriptions.push(treeView);
treeDataProvider.view = treeView;

Expand Down Expand Up @@ -91,8 +88,8 @@ export class ServerManagerView {
}
};

refreshTree() {
this._treeDataProvider.refresh();
refreshTree(item?: SMTreeItem | undefined) {
this._treeDataProvider.refresh(item);
}

}
Expand All @@ -109,8 +106,8 @@ class SMNodeProvider implements vscode.TreeDataProvider<SMTreeItem> {
constructor() {
}

refresh(): void {
this._onDidChangeTreeData.fire();
refresh(item: SMTreeItem | undefined): void {
this._onDidChangeTreeData.fire(item);
}

getTreeItem(element:SMTreeItem): vscode.TreeItem {
Expand Down Expand Up @@ -183,7 +180,7 @@ interface SMItem {
params?: any,
}

class SMTreeItem extends vscode.TreeItem {
export class SMTreeItem extends vscode.TreeItem {

private readonly _getChildren?: Function;
private readonly _params?: any;
Expand Down

0 comments on commit 85b4941

Please sign in to comment.