Skip to content

Commit

Permalink
Merge branch 'GH-59' into candidate-0.0.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/eclTree.ts
  • Loading branch information
GordonSmith committed Dec 5, 2017
2 parents 8c4fe46 + bf5f9f2 commit 7323cb8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 16 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ The following Visual Studio Code settings are available for the ECL extension.

// Add '-legacy' arguement to eclcc.
"ecl.legacyMode": false,

// Open workunits in external browser.
"ecl.WUOpenExternal": false

// Automatically open WU in browser on creation.
"ecl.WUAutoOpen": false
```

#### Launch Settings
Expand Down
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,18 +342,28 @@
"type": "string"
},
"default": [],
"description": "External folders use by IMPORT"
"description": "External folders use by IMPORT."
},
"ecl.eclccPath": {
"type": "string",
"default": "",
"description": "Override eclcc auto detection"
"description": "Override eclcc auto detection."
},
"ecl.legacyMode": {
"type": "boolean",
"default": false,
"description": "Add '-legacy' arguement to eclcc."
},
"ecl.WUOpenExternal": {
"type": "boolean",
"default": false,
"description": "Open WU in external browser."
},
"ecl.WUAutoOpen": {
"type": "boolean",
"default": false,
"description": "Automatically open WU on creation."
},
"ecl.defaultServer": {
"type": "string",
"description": "Default Server"
Expand Down
15 changes: 10 additions & 5 deletions src/eclCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ export class ECLCommands {
}

openWUDetails(url: string, wuid: string) {
const uri = encodeLocation(url, wuid);
return vscode.commands.executeCommand("vscode.previewHtml", uri, vscode.ViewColumn.Two, wuid).then((success) => {
}, (reason) => {
vscode.window.showErrorMessage(reason);
});
const eclConfig = vscode.workspace.getConfiguration("ecl");
if (eclConfig.get<boolean>("WUOpenExternal")) {
opn(url);
} else {
const uri = encodeLocation(url, wuid);
return vscode.commands.executeCommand("vscode.previewHtml", uri, vscode.ViewColumn.Two, wuid).then((success) => {
}, (reason) => {
vscode.window.showErrorMessage(reason);
});
}
}
}
14 changes: 5 additions & 9 deletions src/eclTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ export class ECLTree implements vscode.TreeDataProvider<ECLNode> {
switch (event.event) {
case "WUCreated":
this.refresh();
const eclConfig = vscode.workspace.getConfiguration("ecl");
if (eclConfig.get<boolean>("WUAutoOpen")) {
const launchConfig = new LaunchConfig(event.body);
eclCommands.openWUDetails(launchConfig.wuDetailsUrl(event.body.wuid), event.body.wuid);
}
break;
}
}, null, ctx.subscriptions);
Expand Down Expand Up @@ -213,15 +218,6 @@ export class ECLTree implements vscode.TreeDataProvider<ECLNode> {
node._treeItem = new vscode.TreeItem(node.getLabel(), node.collapseState());
node._treeItem.command = node.command();
}
/*
treeItem.command = {
command: 'extension.openJsonSelection',
title: '',
arguments: [new vscode.Range(this.editor.document.positionAt(node.offset), this.editor.document.positionAt(node.offset + node.length))]
};
treeItem.iconPath = this.getIcon(node);
treeItem.contextValue = this.getNodeType(node);
*/
return node._treeItem;
}

Expand Down
15 changes: 15 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,18 @@ export function initLogger(level: Level) {
logger.writer(new VSCodeWriter());
logger.level(level);
}

export class LaunchConfig {
_config: any;
constructor(config: any) {
this._config = config;
}

espUrl() {
return `${this._config.protocol}://${this._config.serverAddress}:${this._config.port}`;
}

wuDetailsUrl(wuid: string) {
return `${this.espUrl()}/?Wuid=${wuid}&Widget=WUDetailsWidget`;
}
}

0 comments on commit 7323cb8

Please sign in to comment.