* Small fixes

* Small fixes
This commit is contained in:
RupengLiu 2020-10-29 09:52:22 -07:00 коммит произвёл GitHub
Родитель 7e9b71f588
Коммит b6908007b5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 28 добавлений и 12 удалений

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

@ -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."
}

1
resources/dark/diff.svg Normal file
Просмотреть файл

@ -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

1
resources/light/diff.svg Normal file
Просмотреть файл

@ -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.`));
}
});
}