Родитель
7e9b71f588
Коммит
b6908007b5
13
package.json
13
package.json
|
@ -343,8 +343,11 @@
|
|||
},
|
||||
{
|
||||
"command": "azureApiManagement.openDiffEditor",
|
||||
"title": "Start file diffing",
|
||||
"icon": "./resources/diff.svg"
|
||||
"title": "Show diffs against the last saved version",
|
||||
"icon": {
|
||||
"light": "resources/light/diff.svg",
|
||||
"dark": "resources/dark/diff.svg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"viewsContainers": {
|
||||
|
@ -478,7 +481,7 @@
|
|||
},
|
||||
{
|
||||
"command": "azureApiManagement.generateFunctions",
|
||||
"when": "view == azureApiManagementExplorer && viewItem == azureApiManagementApi && config.azureApiManagement.enableCreateFunctionApp == true",
|
||||
"when": "view == azureApiManagementExplorer && viewItem == azureApiManagementApi && config.azureApiManagement.scaffoldAzureFunctions == true",
|
||||
"group": "3@1"
|
||||
},
|
||||
{
|
||||
|
@ -592,10 +595,10 @@
|
|||
"default": false,
|
||||
"description": "%azureApiManagement.advancedPolicyAuthoringExperience%"
|
||||
},
|
||||
"azureApiManagement.enableCreateFunctionApp": {
|
||||
"azureApiManagement.scaffoldAzureFunctions": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%azureApiManagement.enableCreateFunctionApp%"
|
||||
"description": "%azureApiManagement.scaffoldAzureFunctions%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,5 +40,5 @@
|
|||
"azureApiManagement.generateNewGatewayToken": "Generate New Gateway Token",
|
||||
"azureApiManagement.debugPolicy": "Start Policy Debugging",
|
||||
"azureApiManagement.generateFunctions": "Scaffold Azure Functions",
|
||||
"azureApiManagement.enableCreateFunctionApp": "(Experimental Feature) Enables scaffolding Azure Functions functionality"
|
||||
"azureApiManagement.scaffoldAzureFunctions": "(Experimental Feature) Enables scaffolding Azure Functions functionality."
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#edede4"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 3.5l.5-.5h5l.5.5v9l-.5.5h-5l-.5-.5v-9zM3 12h4V6H3v6zm0-7h4V4H3v1zm6.5-2h5l.5.5v9l-.5.5h-5l-.5-.5v-9l.5-.5zm.5 9h4v-2h-4v2zm0-4h4V4h-4v4z"/></svg>
|
После Ширина: | Высота: | Размер: 295 B |
|
@ -1 +0,0 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="white"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 3.5l.5-.5h5l.5.5v9l-.5.5h-5l-.5-.5v-9zM3 12h4V6H3v6zm0-7h4V4H3v1zm6.5-2h5l.5.5v9l-.5.5h-5l-.5-.5v-9l.5-.5zm.5 9h4v-2h-4v2zm0-4h4V4h-4v4z"/></svg>
|
До Ширина: | Высота: | Размер: 293 B |
|
@ -0,0 +1 @@
|
|||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#545351"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 3.5l.5-.5h5l.5.5v9l-.5.5h-5l-.5-.5v-9zM3 12h4V6H3v6zm0-7h4V4H3v1zm6.5-2h5l.5.5v9l-.5.5h-5l-.5-.5v-9l.5-.5zm.5 9h4v-2h-4v2zm0-4h4V4h-4v4z"/></svg>
|
После Ширина: | Высота: | Размер: 295 B |
|
@ -65,6 +65,8 @@ export async function generateFunctions(node?: ApiTreeItem): Promise<void> {
|
|||
|
||||
const openAPIFilePath = path.join(uris[0].fsPath, `${node!.apiContract.name}.json`);
|
||||
|
||||
let isSucceeded = false;
|
||||
|
||||
await window.withProgress(
|
||||
{
|
||||
location: ProgressLocation.Notification,
|
||||
|
@ -111,24 +113,34 @@ export async function generateFunctions(node?: ApiTreeItem): Promise<void> {
|
|||
throw new Error(localize("notSupported", "Only C#, Java, Python, and Typescript are supported"));
|
||||
}
|
||||
|
||||
ext.outputChannel.show();
|
||||
if (language.label === languageTypes.CSharp) {
|
||||
const versionResult = await cpUtils.executeCommand(undefined, undefined, 'dotnet --version');
|
||||
if (!versionResult.startsWith('3.')) {
|
||||
throw new Error(localize('genFunction', 'Failed to generate Functions. Please update dotnet version to 3.0.0 and above.'));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ext.outputChannel.show();
|
||||
await cpUtils.executeCommand(ext.outputChannel, undefined, 'autorest', ...args);
|
||||
await promptOpenFileFolder(uris[0].fsPath);
|
||||
isSucceeded = true;
|
||||
} catch (error) {
|
||||
if (language.label === languageTypes.CSharp) {
|
||||
const message: string = localize('genFunction', 'Failed to generate Functions using C# generator due to a known Issue. Click "Learn more" for more details on installation steps.');
|
||||
// tslint:disable-next-line: no-shadowed-variable
|
||||
window.showErrorMessage(message, DialogResponses.learnMore).then(async result => {
|
||||
if (result === DialogResponses.learnMore) {
|
||||
await openUrl('https://github.com/Azure/autorest.csharp/issues/927');
|
||||
await openUrl('https://github.com/Azure/autorest.azure-functions/issues');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
await promptOpenFileFolder(uris[0].fsPath);
|
||||
}
|
||||
).then(async () => {
|
||||
window.showInformationMessage(localize("openAPIDownloaded", `Scaffolded Azure Functions for API '${node!.apiContract.name} successfully.`));
|
||||
if (isSucceeded) {
|
||||
window.showInformationMessage(localize("openAPIDownloaded", `Scaffolded Azure Functions for API '${node!.apiContract.name} successfully.`));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче