Add filters and defaultUri for dialog options

This commit is contained in:
formulahendry 2017-11-01 13:30:29 +08:00 коммит произвёл Jun Han
Родитель 7ccc84de5d
Коммит 767014eab2
1 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -35,11 +35,15 @@ export class IoTEdgeExplorer extends BaseExplorer {
} }
public async setupEdge() { public async setupEdge() {
const configFiles: vscode.Uri[] = await vscode.window.showOpenDialog({ const filePathUri: vscode.Uri[] = await vscode.window.showOpenDialog({
openLabel: "Select Config File", openLabel: "Select Config File",
filters: {
JSON: ["json"],
},
defaultUri: vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri : undefined,
}); });
if (configFiles) { if (filePathUri) {
Executor.runInTerminal(Utility.adjustTerminalCommand(`iotedgectl setup --config-file "${Utility.adjustFilePath(configFiles[0].fsPath)}"`)); Executor.runInTerminal(Utility.adjustTerminalCommand(`iotedgectl setup --config-file "${Utility.adjustFilePath(filePathUri[0].fsPath)}"`));
} }
} }
@ -60,10 +64,13 @@ export class IoTEdgeExplorer extends BaseExplorer {
} }
private async getDeploymentJson(): Promise<string> { private async getDeploymentJson(): Promise<string> {
const options: vscode.OpenDialogOptions = { const filePathUri: vscode.Uri[] = await vscode.window.showOpenDialog({
openLabel: "Select Deployment File", openLabel: "Select Deployment File",
}; filters: {
const filePathUri = await vscode.window.showOpenDialog(options); JSON: ["json"],
},
defaultUri: vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri : undefined,
});
if (!filePathUri) { if (!filePathUri) {
return ""; return "";
} }