This commit is contained in:
nturinski 2020-04-27 20:57:24 -07:00
Родитель 9c540d41a6
Коммит eab5f4546e
31 изменённых файлов: 247 добавлений и 404 удалений

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

@ -1,10 +1,10 @@
# Azure Marmelade for Visual Studio Code (Preview)
# Azure Static Web Apps for Visual Studio Code (Preview)
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-marmelade.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-marmelade) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-marmelade.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-marmelade) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-marmelade)](https://dev.azure.com/ms-azuretools/AzCodePrivate/_build/latest?definitionId=29)
[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-azurestaticwebapps.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-azurestaticwebapps.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-azurestaticwebapps)](https://dev.azure.com/ms-azuretools/AzCodePrivate/_build/latest?definitionId=29)
Manage Azure Marmelade directly from VS Code.
Manage Azure Static Web Apps directly from VS Code.
**Visit the [wiki](https://github.com/Microsoft/vscode-marmelade/wiki) for additional information about the extension.**
**Visit the [wiki](https://github.com/Microsoft/vscode-azurestaticwebapps/wiki) for additional information about the extension.**
> Sign up today for your free Azure account and receive 12 months of free popular services, $200 free credit and 25+ always free services 👉 [Start Free](https://azure.microsoft.com/free/open-source).

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

@ -1,23 +1,23 @@
{
"name": "vscode-azuremarmelade",
"displayName": "Azure Marmelade",
"description": "%azureMarmelade.description%",
"name": "vscode-azurestaticwebapps",
"displayName": "Azure Static Web Apps",
"description": "%staticWebApps.description%",
"version": "0.1.0-alpha",
"publisher": "ms-azuretools",
"icon": "resources/resourceGroup.png",
"icon": "resources/azure-staticwebapps.png",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"engines": {
"vscode": "^1.41.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-azureMarmelade"
"url": "https://github.com/Microsoft/vscode-azurestaticwebapps"
},
"galleryBanner": {
"color": "#3a3d41",
"theme": "dark"
},
"homepage": "https://github.com/Microsoft/vscode-azureMarmelade/blob/master/README.md",
"homepage": "https://github.com/Microsoft/vscode-azurestaticwebapps/blob/master/README.md",
"license": "SEE LICENSE IN LICENSE.md",
"categories": [
"Azure"
@ -28,62 +28,56 @@
],
"preview": true,
"activationEvents": [
"onCommand:azureMarmelade.createStaticSite",
"onCommand:azureMarmelade.deleteStaticSite",
"onCommand:azureMarmelade.loadMore",
"onCommand:azureMarmelade.openInPortal",
"onCommand:azureMarmelade.refresh",
"onCommand:azureMarmelade.revealResource",
"onCommand:azureMarmelade.selectSubscriptions",
"onCommand:azureMarmelade.viewProperties",
"onCommand:azureMarmelade.createNewApi",
"onCommand:azureMarmelade.createNewEndpoint",
"onCommand:azureMarmelade.browse",
"onView:azureMarmelade"
"onCommand:staticWebApps.createStaticWebApp",
"onCommand:staticWebApps.deleteStaticWebApp",
"onCommand:staticWebApps.loadMore",
"onCommand:staticWebApps.openInPortal",
"onCommand:staticWebApps.refresh",
"onCommand:staticWebApps.selectSubscriptions",
"onCommand:staticWebApps.viewProperties",
"onCommand:staticWebApps.createNewApi",
"onCommand:staticWebApps.createNewEndpoint",
"onCommand:staticWebApps.browse",
"onView:staticWebApps"
],
"main": "./main.js",
"contributes": {
"commands": [
{
"command": "azureMarmelade.createStaticSite",
"title": "%azureMarmelade.createStaticSite%",
"category": "Azure Marmelade",
"command": "staticWebApps.createStaticWebApp",
"title": "%staticWebApps.createStaticWebApp%",
"category": "Azure Static Web Apps",
"icon": {
"light": "resources/light/add.svg",
"dark": "resources/dark/add.svg"
}
},
{
"command": "azureMarmelade.deleteStaticSite",
"title": "%azureMarmelade.deleteStaticSite%",
"category": "Azure Marmelade"
"command": "staticWebApps.deleteStaticWebApp",
"title": "%staticWebApps.deleteStaticWebApp%",
"category": "Azure Static Web Apps"
},
{
"command": "azureMarmelade.loadMore",
"title": "%azureMarmelade.loadMore%",
"category": "Azure Marmelade"
"command": "staticWebApps.loadMore",
"title": "%staticWebApps.loadMore%",
"category": "Azure Static Web Apps"
},
{
"command": "azureMarmelade.openInPortal",
"title": "%azureMarmelade.openInPortal%",
"category": "Azure Marmelade"
"command": "staticWebApps.openInPortal",
"title": "%staticWebApps.openInPortal%",
"category": "Azure Static Web Apps"
},
{
"command": "azureMarmelade.refresh",
"title": "%azureMarmelade.refresh%",
"category": "Azure Marmelade",
"command": "staticWebApps.refresh",
"title": "%staticWebApps.refresh%",
"category": "Azure Static Web Apps",
"icon": {
"light": "resources/light/refresh.svg",
"dark": "resources/dark/refresh.svg"
}
},
{
"command": "azureMarmelade.revealResource",
"title": "%azureMarmelade.revealResource%",
"category": "Azure Marmelade"
},
{
"command": "azureMarmelade.selectSubscriptions",
"command": "staticWebApps.selectSubscriptions",
"title": "Select Subscriptions...",
"icon": {
"light": "resources/light/filter.svg",
@ -91,32 +85,32 @@
}
},
{
"command": "azureMarmelade.viewProperties",
"title": "%azureMarmelade.viewProperties%",
"category": "Azure Marmelade"
"command": "staticWebApps.viewProperties",
"title": "%staticWebApps.viewProperties%",
"category": "Azure Static Web Apps"
},
{
"command": "azureMarmelade.createNewApi",
"title": "%azureMarmelade.createNewApi%",
"category": "Azure Marmelade",
"command": "staticWebApps.createNewApi",
"title": "%staticWebApps.createNewApi%",
"category": "Azure Static Web Apps",
"icon": {
"light": "resources/light/CreateNewProject.svg",
"dark": "resources/dark/CreateNewProject.svg"
}
},
{
"command": "azureMarmelade.createNewEndpoint",
"title": "%azureMarmelade.createNewEndpoint%",
"category": "Azure Marmelade",
"command": "staticWebApps.createNewEndpoint",
"title": "%staticWebApps.createNewEndpoint%",
"category": "Azure Static Web Apps",
"icon": {
"light": "resources/light/AddFunction.svg",
"dark": "resources/dark/AddFunction.svg"
}
},
{
"command": "azureMarmelade.browse",
"title": "%azureMarmelade.browse%",
"category": "Azure Marmelade"
"command": "staticWebApps.browse",
"title": "%staticWebApps.browse%",
"category": "Azure Static Web Apps"
}
],
"viewsContainers": {
@ -131,111 +125,107 @@
"views": {
"azure": [
{
"id": "azureMarmelade",
"name": "Marmelade"
"id": "staticWebApps",
"name": "Static Web Apps"
}
]
},
"menus": {
"view/title": [
{
"command": "azureMarmelade.createStaticSite",
"when": "view == azureMarmelade",
"command": "staticWebApps.createStaticWebApp",
"when": "view == staticWebApps",
"group": "navigation@1"
},
{
"command": "azureMarmelade.createNewApi",
"when": "view == azureMarmelade",
"command": "staticWebApps.createNewApi",
"when": "view == staticWebApps",
"group": "navigation@2"
},
{
"command": "azureMarmelade.createNewEndpoint",
"when": "view == azureMarmelade",
"command": "staticWebApps.createNewEndpoint",
"when": "view == staticWebApps",
"group": "navigation@3"
},
{
"command": "azureMarmelade.refresh",
"when": "view == azureMarmelade",
"command": "staticWebApps.refresh",
"when": "view == staticWebApps",
"group": "navigation@4"
}
],
"view/item/context": [
{
"command": "azureMarmelade.selectSubscriptions",
"when": "view == azureMarmelade && viewItem == azureextensionui.azureSubscription",
"command": "staticWebApps.selectSubscriptions",
"when": "view == staticWebApps && viewItem == azureextensionui.azureSubscription",
"group": "inline"
},
{
"command": "azureMarmelade.createStaticSite",
"when": "view == azureMarmelade && viewItem == azureextensionui.azureSubscription",
"command": "staticWebApps.createStaticWebApp",
"when": "view == staticWebApps && viewItem == azureextensionui.azureSubscription",
"group": "1@1"
},
{
"command": "azureMarmelade.openInPortal",
"when": "view == azureMarmelade && viewItem == azureextensionui.azureSubscription",
"command": "staticWebApps.openInPortal",
"when": "view == staticWebApps && viewItem == azureextensionui.azureSubscription",
"group": "9@1"
},
{
"command": "azureMarmelade.refresh",
"when": "view == azureMarmelade && viewItem == azureextensionui.azureSubscription",
"command": "staticWebApps.refresh",
"when": "view == staticWebApps && viewItem == azureextensionui.azureSubscription",
"group": "9@2"
},
{
"command": "azureMarmelade.deleteStaticSite",
"when": "view == azureMarmelade && viewItem == azureStaticSite",
"command": "staticWebApps.deleteStaticWebApp",
"when": "view == staticWebApps && viewItem == azureStaticWebApp",
"group": "3@1"
},
{
"command": "azureMarmelade.viewProperties",
"when": "view == azureMarmelade && viewItem == azureStaticSite",
"command": "staticWebApps.viewProperties",
"when": "view == staticWebApps && viewItem == azureStaticWebApp",
"group": "9@1"
},
{
"command": "azureMarmelade.openInPortal",
"when": "view == azureMarmelade && viewItem == azureStaticSite",
"command": "staticWebApps.openInPortal",
"when": "view == staticWebApps && viewItem == azureStaticWebApp",
"group": "1@1"
},
{
"command": "azureMarmelade.browse",
"when": "view == azureMarmelade && viewItem == azureStaticSite",
"command": "staticWebApps.browse",
"when": "view == staticWebApps && viewItem == azureStaticWebApp",
"group": "1@2"
},
{
"command": "azureMarmelade.refresh",
"when": "view == azureMarmelade && viewItem == azureStaticSite",
"command": "staticWebApps.refresh",
"when": "view == staticWebApps && viewItem == azureStaticWebApp",
"group": "9@3"
},
{
"command": "azureMarmelade.viewProperties",
"when": "view == azureMarmelade && viewItem == azureResource",
"command": "staticWebApps.viewProperties",
"when": "view == staticWebApps && viewItem == azureResource",
"group": "9@1"
},
{
"command": "azureMarmelade.openInPortal",
"when": "view == azureMarmelade && viewItem == azureResource",
"command": "staticWebApps.openInPortal",
"when": "view == staticWebApps && viewItem == azureResource",
"group": "1@1"
},
{
"command": "azureMarmelade.browse",
"when": "view == azureMarmelade && viewItem == azureResource",
"command": "staticWebApps.browse",
"when": "view == staticWebApps && viewItem == azureResource",
"group": "1@2"
}
],
"commandPalette": [
{
"command": "azureMarmelade.selectSubscriptions",
"command": "staticWebApps.selectSubscriptions",
"when": "never"
},
{
"command": "azureMarmelade.refresh",
"command": "staticWebApps.refresh",
"when": "never"
},
{
"command": "azureMarmelade.loadMore",
"when": "never"
},
{
"command": "azureMarmelade.revealResource",
"command": "staticWebApps.loadMore",
"when": "never"
}
]
@ -249,11 +239,11 @@
],
"configuration": [
{
"title": "Azure Marmelade",
"title": "Azure Static Web Apps",
"properties": {
"azureMarmelade.enableOutputTimestamps": {
"staticWebApps.enableOutputTimestamps": {
"type": "boolean",
"description": "%azureMarmelade.enableOutputTimestamps%",
"description": "%staticWebApps.enableOutputTimestamps%",
"default": true
}
}

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

@ -1,17 +1,17 @@
{
"azureMarmelade.createStaticSite": "Create Static Site...",
"azureMarmelade.deleteStaticSite": "Delete...",
"azureMarmelade.description": "An Azure Marmelade extension for Visual Studio Code.",
"azureMarmelade.enableOutputTimestamps": "Prepends each line displayed in the output channel with a timestamp.",
"azureMarmelade.loadMore": "Load More",
"azureMarmelade.openInPortal": "Open in Portal",
"azureMarmelade.refresh": "Refresh",
"azureMarmelade.revealResource": "Reveal Resource",
"azureMarmelade.viewProperties": "View Properties",
"azureMarmelade.deleteConfirmation": "The behavior to use when confirming delete of a resource group.",
"azureMarmelade.deleteConfirmation.EnterName": "Prompts with an input box where you enter the resource group name to delete.",
"azureMarmelade.deleteConfirmation.ClickButton": "Prompts with a warning dialog where you click a button to delete.",
"azureMarmelade.createNewApi": "Create New API...",
"azureMarmelade.createNewEndpoint": "Create Endpoint...",
"azureMarmelade.browse": "Browse Static Site"
"staticWebApps.createStaticWebApp": "Create Static Web App...",
"staticWebApps.deleteStaticWebApp": "Delete...",
"staticWebApps.description": "An Azure Static Web Apps extension for Visual Studio Code.",
"staticWebApps.enableOutputTimestamps": "Prepends each line displayed in the output channel with a timestamp.",
"staticWebApps.loadMore": "Load More",
"staticWebApps.openInPortal": "Open in Portal",
"staticWebApps.refresh": "Refresh",
"staticWebApps.revealResource": "Reveal Resource",
"staticWebApps.viewProperties": "View Properties",
"staticWebApps.deleteConfirmation": "The behavior to use when confirming delete of a resource group.",
"staticWebApps.deleteConfirmation.EnterName": "Prompts with an input box where you enter the resource group name to delete.",
"staticWebApps.deleteConfirmation.ClickButton": "Prompts with a warning dialog where you click a button to delete.",
"staticWebApps.createNewApi": "Create New API...",
"staticWebApps.createNewEndpoint": "Create Endpoint...",
"staticWebApps.browse": "Browse Site"
}

Двоичные данные
resources/azure-staticwebapps.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.7 KiB

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

@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<defs>
<linearGradient id="b81467a7-8040-434c-8e85-3b06adb1a444" x1="9" y1="16.236" x2="9" y2="5.599" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#32bedd"/>
<stop offset="0.775" stop-color="#32d4f5"/>
</linearGradient>
</defs>
<g id="aac29ec1-77a4-4cee-ab20-0e567be7a5e2">
<path d="M0,5.6H18a0,0,0,0,1,0,0V15.635a.6.6,0,0,1-.6.6H.6a.6.6,0,0,1-.6-.6V5.6A0,0,0,0,1,0,5.6Z" fill="url(#b81467a7-8040-434c-8e85-3b06adb1a444)"/>
<rect x="1.309" y="6.657" width="15.527" height="8.514" rx="0.6" fill="#9cebff"/>
<path d="M.6,1.764H17.4a.6.6,0,0,1,.6.6V5.6a0,0,0,0,1,0,0H0a0,0,0,0,1,0,0V2.365A.6.6,0,0,1,.6,1.764Z" fill="#198ab3"/>
<path d="M5.551,10.193H6a0,0,0,0,1,0,0v3.583a.145.145,0,0,1-.145.145H5.406a.145.145,0,0,1-.145-.145V10.483a.29.29,0,0,1,.29-.29Z" transform="translate(-6.87 7.497) rotate(-44.919)" fill="#fff" opacity="0.8"/>
<path d="M5.28,8.037h.454a.29.29,0,0,1,.29.29v3.346a.145.145,0,0,1-.145.145H5.425a.145.145,0,0,1-.145-.145V8.037a0,0,0,0,1,0,0Z" transform="translate(2.613 20.941) rotate(-134.919)" fill="#fff"/>
<path d="M12.012,10.193h.454a.145.145,0,0,1,.145.145v3.583a0,0,0,0,1,0,0h-.454a.29.29,0,0,1-.29-.29V10.338A.145.145,0,0,1,12.012,10.193Z" transform="translate(12.391 29.237) rotate(-135.081)" fill="#fff" opacity="0.8"/>
<path d="M11.99,8.039h.454a.145.145,0,0,1,.145.145V11.53a.29.29,0,0,1-.29.29h-.454a0,0,0,0,1,0,0V8.184a.145.145,0,0,1,.145-.145Z" transform="translate(-3.441 11.569) rotate(-45.081)" fill="#fff"/>
<rect x="8.606" y="7.387" width="0.745" height="7.062" rx="0.104" transform="translate(3.756 -2.218) rotate(17.752)" fill="#fff"/>
<path d="M3.166,3.847a.76.76,0,1,1-.76-.76A.76.76,0,0,1,3.166,3.847ZM4.8,3.087a.76.76,0,1,0,.76.76A.76.76,0,0,0,4.8,3.087Zm2.393,0a.76.76,0,1,0,.76.76A.76.76,0,0,0,7.191,3.087Z" fill="#fff"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

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

@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
<defs>
<linearGradient id="b81467a7-8040-434c-8e85-3b06adb1a444" x1="9" y1="16.236" x2="9" y2="5.599" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#32bedd"/>
<stop offset="0.775" stop-color="#32d4f5"/>
</linearGradient>
</defs>
<g id="aac29ec1-77a4-4cee-ab20-0e567be7a5e2">
<path d="M0,5.6H18a0,0,0,0,1,0,0V15.635a.6.6,0,0,1-.6.6H.6a.6.6,0,0,1-.6-.6V5.6A0,0,0,0,1,0,5.6Z" fill="url(#b81467a7-8040-434c-8e85-3b06adb1a444)"/>
<rect x="1.309" y="6.657" width="15.527" height="8.514" rx="0.6" fill="#9cebff"/>
<path d="M.6,1.764H17.4a.6.6,0,0,1,.6.6V5.6a0,0,0,0,1,0,0H0a0,0,0,0,1,0,0V2.365A.6.6,0,0,1,.6,1.764Z" fill="#198ab3"/>
<path d="M5.551,10.193H6a0,0,0,0,1,0,0v3.583a.145.145,0,0,1-.145.145H5.406a.145.145,0,0,1-.145-.145V10.483a.29.29,0,0,1,.29-.29Z" transform="translate(-6.87 7.497) rotate(-44.919)" fill="#fff" opacity="0.8"/>
<path d="M5.28,8.037h.454a.29.29,0,0,1,.29.29v3.346a.145.145,0,0,1-.145.145H5.425a.145.145,0,0,1-.145-.145V8.037a0,0,0,0,1,0,0Z" transform="translate(2.613 20.941) rotate(-134.919)" fill="#fff"/>
<path d="M12.012,10.193h.454a.145.145,0,0,1,.145.145v3.583a0,0,0,0,1,0,0h-.454a.29.29,0,0,1-.29-.29V10.338A.145.145,0,0,1,12.012,10.193Z" transform="translate(12.391 29.237) rotate(-135.081)" fill="#fff" opacity="0.8"/>
<path d="M11.99,8.039h.454a.145.145,0,0,1,.145.145V11.53a.29.29,0,0,1-.29.29h-.454a0,0,0,0,1,0,0V8.184a.145.145,0,0,1,.145-.145Z" transform="translate(-3.441 11.569) rotate(-45.081)" fill="#fff"/>
<rect x="8.606" y="7.387" width="0.745" height="7.062" rx="0.104" transform="translate(3.756 -2.218) rotate(17.752)" fill="#fff"/>
<path d="M3.166,3.847a.76.76,0,1,1-.76-.76A.76.76,0,0,1,3.166,3.847ZM4.8,3.087a.76.76,0,1,0,.76.76A.76.76,0,0,0,4.8,3.087Zm2.393,0a.76.76,0,1,0,.76.76A.76.76,0,0,0,7.191,3.087Z" fill="#fff"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

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

@ -5,11 +5,11 @@
import { IActionContext } from 'vscode-azureextensionui';
import { ext } from '../extensionVariables';
import { StaticSiteTreeItem } from "../tree/StaticSiteTreeItem";
import { StaticWebAppTreeItem } from "../tree/StaticWebAppTreeItem";
export async function browse(context: IActionContext, node?: StaticSiteTreeItem): Promise<void> {
export async function browse(context: IActionContext, node?: StaticWebAppTreeItem): Promise<void> {
if (!node) {
node = await ext.tree.showTreeItemPicker<StaticSiteTreeItem>(StaticSiteTreeItem.contextValue, context);
node = await ext.tree.showTreeItemPicker<StaticWebAppTreeItem>(StaticWebAppTreeItem.contextValue, context);
}
await node.browse();

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

@ -10,12 +10,12 @@ import { ext } from '../../extensionVariables';
import { createGitHubRequestOptions, gitHubRepoData, gitHubWebResource } from "../../utils/gitHubUtils";
import { localize } from '../../utils/localize';
import { requestUtils } from '../../utils/requestUtils';
import { IStaticSiteWizardContext } from '../createStaticWebApp/IStaticSiteWizardContext';
import { IStaticWebAppWizardContext } from '../createStaticWebApp/IStaticWebAppWizardContext';
export class RepoCreateStep extends AzureWizardExecuteStep<IStaticSiteWizardContext> {
export class RepoCreateStep extends AzureWizardExecuteStep<IStaticWebAppWizardContext> {
public priority: number = 200;
public async execute(wizardContext: IStaticSiteWizardContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
public async execute(wizardContext: IStaticWebAppWizardContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
const creatingGitHubRepo: string = localize('creatingGitHubRepo', 'Creating new GitHub repository "{0}"', wizardContext.newRepoName);
ext.outputChannel.appendLog(creatingGitHubRepo);
progress.report({ message: creatingGitHubRepo });
@ -29,7 +29,7 @@ export class RepoCreateStep extends AzureWizardExecuteStep<IStaticSiteWizardCont
}
public shouldExecute(wizardContext: IStaticSiteWizardContext): boolean {
public shouldExecute(wizardContext: IStaticWebAppWizardContext): boolean {
return !!(wizardContext.accessToken && wizardContext.newRepoName);
}

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

@ -10,21 +10,21 @@ import { createGitHubRequestOptions, gitHubWebResource } from '../../utils/gitHu
import { localize } from '../../utils/localize';
import { nonNullProp } from '../../utils/nonNull';
import { requestUtils } from '../../utils/requestUtils';
import { IStaticSiteWizardContext } from '../createStaticWebApp/IStaticSiteWizardContext';
import { IStaticWebAppWizardContext } from '../createStaticWebApp/IStaticWebAppWizardContext';
export class RepoNameStep extends AzureWizardPromptStep<IStaticSiteWizardContext> {
public async prompt(wizardContext: IStaticSiteWizardContext): Promise<void> {
export class RepoNameStep extends AzureWizardPromptStep<IStaticWebAppWizardContext> {
public async prompt(wizardContext: IStaticWebAppWizardContext): Promise<void> {
wizardContext.newRepoName = (await ext.ui.showInputBox({
prompt: localize('AppServicePlanPrompt', 'Enter the name of the new GitHub repository.'),
validateInput: async (value: string): Promise<string | undefined> => await this.validateRepoName(wizardContext, value)
})).trim();
}
public shouldPrompt(wizardContext: IStaticSiteWizardContext): boolean {
public shouldPrompt(wizardContext: IStaticWebAppWizardContext): boolean {
return !wizardContext.newRepoName;
}
protected async isRepoAvailable(context: IStaticSiteWizardContext, name: string): Promise<boolean> {
protected async isRepoAvailable(context: IStaticWebAppWizardContext, name: string): Promise<boolean> {
const requestOptions: gitHubWebResource = await createGitHubRequestOptions(context, `${githubApiEndpoint}/repos/${nonNullProp(context, 'orgData').login}/${name}`);
try {
await requestUtils.sendRequest(requestOptions);
@ -41,7 +41,7 @@ export class RepoNameStep extends AzureWizardPromptStep<IStaticSiteWizardContext
return false;
}
private async validateRepoName(context: IStaticSiteWizardContext, name: string | undefined): Promise<string | undefined> {
private async validateRepoName(context: IStaticWebAppWizardContext, name: string | undefined): Promise<string | undefined> {
name = name ? name.trim() : '';
if (name === '.' || name === '..') {

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

@ -6,17 +6,17 @@
import { AzureWizardPromptStep } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { IStaticSiteWizardContext } from "./IStaticSiteWizardContext";
import { IStaticWebAppWizardContext } from "./IStaticWebAppWizardContext";
export class ApiLocationStep extends AzureWizardPromptStep<IStaticSiteWizardContext> {
public async prompt(wizardContext: IStaticSiteWizardContext): Promise<void> {
export class ApiLocationStep extends AzureWizardPromptStep<IStaticWebAppWizardContext> {
public async prompt(wizardContext: IStaticWebAppWizardContext): Promise<void> {
wizardContext.apiLocation = (await ext.ui.showInputBox({
value: 'api',
prompt: localize('apiLocation', 'Enter the API directory')
})).trim();
}
public shouldPrompt(wizardContext: IStaticSiteWizardContext): boolean {
public shouldPrompt(wizardContext: IStaticWebAppWizardContext): boolean {
return !wizardContext.apiLocation;
}

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

@ -6,17 +6,17 @@
import { AzureWizardPromptStep } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { IStaticSiteWizardContext } from "./IStaticSiteWizardContext";
import { IStaticWebAppWizardContext } from "./IStaticWebAppWizardContext";
export class AppArtifactLocationStep extends AzureWizardPromptStep<IStaticSiteWizardContext> {
public async prompt(wizardContext: IStaticSiteWizardContext): Promise<void> {
export class AppArtifactLocationStep extends AzureWizardPromptStep<IStaticWebAppWizardContext> {
public async prompt(wizardContext: IStaticWebAppWizardContext): Promise<void> {
wizardContext.appArtifactLocation = (await ext.ui.showInputBox({
value: 'build',
prompt: localize('publishLocation', 'Enter the publish directory')
})).trim();
}
public shouldPrompt(wizardContext: IStaticSiteWizardContext): boolean {
public shouldPrompt(wizardContext: IStaticWebAppWizardContext): boolean {
return !wizardContext.appArtifactLocation;
}

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

@ -6,10 +6,10 @@
import { AzureWizardPromptStep } from "vscode-azureextensionui";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { IStaticSiteWizardContext } from "./IStaticSiteWizardContext";
import { IStaticWebAppWizardContext } from "./IStaticWebAppWizardContext";
export class AppLocationStep extends AzureWizardPromptStep<IStaticSiteWizardContext> {
public async prompt(wizardContext: IStaticSiteWizardContext): Promise<void> {
export class AppLocationStep extends AzureWizardPromptStep<IStaticWebAppWizardContext> {
public async prompt(wizardContext: IStaticWebAppWizardContext): Promise<void> {
wizardContext.appLocation = (await ext.ui.showInputBox({
value: 'app',
prompt: localize('appLocation', 'Enter the app directory'),
@ -17,7 +17,7 @@ export class AppLocationStep extends AzureWizardPromptStep<IStaticSiteWizardCont
})).trim();
}
public shouldPrompt(wizardContext: IStaticSiteWizardContext): boolean {
public shouldPrompt(wizardContext: IStaticWebAppWizardContext): boolean {
return !wizardContext.appLocation;
}

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

@ -5,10 +5,10 @@
import { AzureTreeItem, IResourceGroupWizardContext } from 'vscode-azureextensionui';
import { IGitHubAccessTokenContext } from '../../IGitHubAccessTokenContext';
import { StaticSite } from '../../tree/StaticSiteTreeItem';
import { StaticWebApp } from '../../tree/StaticWebAppTreeItem';
import { gitHubBranchData, gitHubOrgData, gitHubRepoData } from '../../utils/gitHubUtils';
export interface IStaticSiteWizardContext extends IResourceGroupWizardContext, IGitHubAccessTokenContext {
export interface IStaticWebAppWizardContext extends IResourceGroupWizardContext, IGitHubAccessTokenContext {
newSiteName?: string;
orgData?: gitHubOrgData;
@ -22,5 +22,5 @@ export interface IStaticSiteWizardContext extends IResourceGroupWizardContext, I
newRepoName?: string;
site?: StaticSite;
site?: StaticWebApp;
}

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

@ -5,17 +5,17 @@
import { Progress } from "vscode";
import { AzureWizardExecuteStep } from "vscode-azureextensionui";
import { StaticSite } from "../../tree/StaticSiteTreeItem";
import { StaticWebApp } from "../../tree/StaticWebAppTreeItem";
import { getGitHubAccessToken } from "../../utils/gitHubUtils";
import { localize } from "../../utils/localize";
import { nonNullProp } from "../../utils/nonNull";
import { requestUtils } from "../../utils/requestUtils";
import { IStaticSiteWizardContext } from "./IStaticSiteWizardContext";
import { IStaticWebAppWizardContext } from "./IStaticWebAppWizardContext";
export class StaticWebAppCreateStep extends AzureWizardExecuteStep<IStaticSiteWizardContext> {
export class StaticWebAppCreateStep extends AzureWizardExecuteStep<IStaticWebAppWizardContext> {
public priority: number = 250;
public async execute(wizardContext: IStaticSiteWizardContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
public async execute(wizardContext: IStaticWebAppWizardContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
const requestOptions: requestUtils.Request = await requestUtils.getDefaultAzureRequest(`${nonNullProp(wizardContext, 'resourceGroup').id}/providers/Microsoft.Web/staticSites/${wizardContext.newSiteName}?api-version=2019-12-01-preview`, wizardContext, 'PUT');
requestOptions.headers['Content-Type'] = 'application/json';
// tslint:disable-next-line:no-any
@ -42,11 +42,11 @@ export class StaticWebAppCreateStep extends AzureWizardExecuteStep<IStaticSiteWi
requestOptions.body = JSON.stringify(requestBody);
progress.report({ message: localize('creatingStaticApp', 'Creating Static Web App "{0}"...', wizardContext.newSiteName) });
wizardContext.site = <StaticSite>JSON.parse(await requestUtils.sendRequest(requestOptions));
wizardContext.site = <StaticWebApp>JSON.parse(await requestUtils.sendRequest(requestOptions));
progress.report({ message: localize('creatingStaticApp', 'Created Static Web App "{0}".', wizardContext.newSiteName) });
}
public shouldExecute(_wizardContext: IStaticSiteWizardContext): boolean {
public shouldExecute(_wizardContext: IStaticWebAppWizardContext): boolean {
return true;
}
}

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

@ -6,17 +6,17 @@
import { MessageItem, window } from 'vscode';
import { IActionContext } from 'vscode-azureextensionui';
import { ext } from '../../extensionVariables';
import { StaticSiteTreeItem } from '../../tree/StaticSiteTreeItem';
import { StaticWebAppTreeItem } from '../../tree/StaticWebAppTreeItem';
import { SubscriptionTreeItem } from '../../tree/SubscriptionTreeItem';
import { localize } from '../../utils/localize';
import { openUrl } from '../../utils/openUrl';
export async function createStaticSite(context: IActionContext, node?: SubscriptionTreeItem): Promise<void> {
export async function createStaticWebApp(context: IActionContext, node?: SubscriptionTreeItem): Promise<void> {
if (!node) {
node = await ext.tree.showTreeItemPicker<SubscriptionTreeItem>(SubscriptionTreeItem.contextValue, context);
}
const ssNode: StaticSiteTreeItem = await node.createChild(context);
const ssNode: StaticWebAppTreeItem = await node.createChild(context);
const createdSs: string = localize('createdSs', 'Created static site "{0}".', ssNode.name);
ext.outputChannel.appendLog(createdSs);

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

@ -5,11 +5,11 @@
import { IActionContext } from 'vscode-azureextensionui';
import { ext } from '../extensionVariables';
import { StaticSiteTreeItem } from '../tree/StaticSiteTreeItem';
import { StaticWebAppTreeItem } from '../tree/StaticWebAppTreeItem';
export async function deleteStaticSite(context: IActionContext, node?: StaticSiteTreeItem): Promise<void> {
export async function deleteStaticWebApp(context: IActionContext, node?: StaticWebAppTreeItem): Promise<void> {
if (!node) {
node = await ext.tree.showTreeItemPicker<StaticSiteTreeItem>(StaticSiteTreeItem.contextValue, context);
node = await ext.tree.showTreeItemPicker<StaticWebAppTreeItem>(StaticWebAppTreeItem.contextValue, context);
}
await node.deleteTreeItem(context);

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

@ -5,12 +5,11 @@
import * as ui from 'vscode-azureextensionui';
import { ext } from '../extensionVariables';
import { ResourceTreeItem } from '../tree/ResourceTreeItem';
import { StaticSiteTreeItem } from '../tree/StaticSiteTreeItem';
import { StaticWebAppTreeItem } from '../tree/StaticWebAppTreeItem';
export async function openInPortal(context: ui.IActionContext, node?: StaticSiteTreeItem | ResourceTreeItem): Promise<void> {
export async function openInPortal(context: ui.IActionContext, node?: StaticWebAppTreeItem): Promise<void> {
if (!node) {
node = await ext.tree.showTreeItemPicker<StaticSiteTreeItem>(StaticSiteTreeItem.contextValue, context);
node = await ext.tree.showTreeItemPicker<StaticWebAppTreeItem>(StaticWebAppTreeItem.contextValue, context);
}
await ui.openInPortal(node.root, node.fullId);

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

@ -9,22 +9,20 @@ import { ext } from '../extensionVariables';
import { browse } from './browse';
import { createNewApi } from './createNewApi';
import { createNewEndpoint } from './createNewEndpoint/createNewEndpoint';
import { createStaticSite } from './createStaticWebApp/createStaticSite';
import { deleteStaticSite } from './deleteStaticSite';
import { createStaticWebApp } from './createStaticWebApp/createStaticWebApp';
import { deleteStaticWebApp } from './deleteStaticWebApp';
import { openInPortal } from './openInPortal';
import { revealResource } from './revealResource';
import { viewProperties } from './viewProperties';
export function registerCommands(): void {
registerCommand('azureMarmelade.createStaticSite', createStaticSite);
registerCommand('azureMarmelade.deleteStaticSite', deleteStaticSite);
registerCommand('azureMarmelade.loadMore', async (context: IActionContext, node: AzureTreeItem) => await ext.tree.loadMore(node, context));
registerCommand('azureMarmelade.openInPortal', openInPortal);
registerCommand('azureMarmelade.refresh', async (_context: IActionContext, node?: AzureTreeItem) => await ext.tree.refresh(node));
registerCommand('azureMarmelade.revealResource', revealResource);
registerCommand('azureMarmelade.selectSubscriptions', () => commands.executeCommand('azure-account.selectSubscriptions'));
registerCommand('azureMarmelade.viewProperties', viewProperties);
registerCommand('azureMarmelade.createNewEndpoint', createNewEndpoint);
registerCommand('azureMarmelade.createNewApi', createNewApi);
registerCommand('azureMarmelade.browse', browse);
registerCommand('staticWebApps.createStaticWebApp', createStaticWebApp);
registerCommand('staticWebApps.deleteStaticWebApp', deleteStaticWebApp);
registerCommand('staticWebApps.loadMore', async (context: IActionContext, node: AzureTreeItem) => await ext.tree.loadMore(node, context));
registerCommand('staticWebApps.openInPortal', openInPortal);
registerCommand('staticWebApps.refresh', async (_context: IActionContext, node?: AzureTreeItem) => await ext.tree.refresh(node));
registerCommand('staticWebApps.selectSubscriptions', () => commands.executeCommand('azure-account.selectSubscriptions'));
registerCommand('staticWebApps.viewProperties', viewProperties);
registerCommand('staticWebApps.createNewEndpoint', createNewEndpoint);
registerCommand('staticWebApps.createNewApi', createNewApi);
registerCommand('staticWebApps.browse', browse);
}

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

@ -1,73 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { commands, Extension, extensions } from 'vscode';
import { IActionContext, parseError } from 'vscode-azureextensionui';
// tslint:disable-next-line: no-submodule-imports
import { AzureExtensionApi, AzureExtensionApiProvider } from 'vscode-azureextensionui/api';
import { ResourceTreeItem } from '../tree/ResourceTreeItem';
import { viewProperties } from './viewProperties';
export async function revealResource(context: IActionContext, node: ResourceTreeItem): Promise<void> {
context.telemetry.properties.resourceType = node.data.type;
context.telemetry.properties.resourceKind = node.data.kind;
let extensionName: string | undefined;
const publisher: string = 'ms-azuretools';
switch (node.data.type?.toLowerCase()) {
case 'microsoft.documentdb/databaseaccounts':
extensionName = 'vscode-cosmosdb';
break;
case 'microsoft.storage/storageaccounts':
extensionName = 'vscode-azurestorage';
break;
case 'microsoft.compute/virtualmachines':
extensionName = 'vscode-azurevirtualmachines';
break;
case 'microsoft.web/sites':
if (node.data.kind?.toLowerCase().includes('functionapp')) {
extensionName = 'vscode-azurefunctions';
} else {
extensionName = 'vscode-azureappservice';
}
break;
case 'microsoft.eventgrid/eventsubscriptions':
case 'microsoft.eventgrid/topics':
extensionName = 'vscode-azureeventgrid';
break;
default:
}
let viewPropertiesInstead: boolean = false;
if (!extensionName) {
viewPropertiesInstead = true;
} else {
const extensionId: string = `${publisher}.${extensionName}`;
const extension: Extension<AzureExtensionApiProvider> | undefined = extensions.getExtension(extensionId);
if (!extension) {
await commands.executeCommand('extension.open', extensionId);
} else {
if (!extension.isActive) {
await extension.activate();
}
try {
const api: IRevealApi = extension.exports.getApi('*');
await api.revealTreeItem(node.fullId);
} catch (error) {
viewPropertiesInstead = true;
context.telemetry.properties.revealError = parseError(error).message;
}
}
}
if (viewPropertiesInstead) {
await viewProperties(context, node);
}
}
interface IRevealApi extends AzureExtensionApi {
revealTreeItem(resourceId: string): Promise<void>;
}

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

@ -5,12 +5,11 @@
import { IActionContext, openReadOnlyJson } from 'vscode-azureextensionui';
import { ext } from '../extensionVariables';
import { ResourceTreeItem } from '../tree/ResourceTreeItem';
import { StaticSiteTreeItem } from '../tree/StaticSiteTreeItem';
import { StaticWebAppTreeItem } from '../tree/StaticWebAppTreeItem';
export async function viewProperties(context: IActionContext, node?: StaticSiteTreeItem | ResourceTreeItem): Promise<void> {
export async function viewProperties(context: IActionContext, node?: StaticWebAppTreeItem): Promise<void> {
if (!node) {
node = await ext.tree.showTreeItemPicker<StaticSiteTreeItem>(StaticSiteTreeItem.contextValue, context);
node = await ext.tree.showTreeItemPicker<StaticWebAppTreeItem>(StaticWebAppTreeItem.contextValue, context);
}
await openReadOnlyJson(node, node.data);

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

@ -3,5 +3,5 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export const extensionPrefix: string = 'azureMarmelade';
export const extensionPrefix: string = 'staticWebApps';
export const githubApiEndpoint: string = 'https://api.github.com';

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

@ -17,21 +17,21 @@ import { AzureAccountTreeItem } from './tree/AzureAccountTreeItem';
export async function activateInternal(context: vscode.ExtensionContext, perfStats: { loadStartTime: number; loadEndTime: number }): Promise<AzureExtensionApiProvider> {
ext.context = context;
ext.reporter = createTelemetryReporter(context);
ext.outputChannel = createAzExtOutputChannel('Azure Marmelade', ext.prefix);
ext.outputChannel = createAzExtOutputChannel('Azure Static Web Apps', ext.prefix);
context.subscriptions.push(ext.outputChannel);
ext.ui = new AzureUserInput(context.globalState);
registerUIExtensionVariables(ext);
registerAppServiceExtensionVariables(ext);
await callWithTelemetryAndErrorHandling('azureMarmelade.activate', async (activateContext: IActionContext) => {
await callWithTelemetryAndErrorHandling('staticWebApps.activate', async (activateContext: IActionContext) => {
activateContext.telemetry.properties.isActivationEvent = 'true';
activateContext.telemetry.measurements.mainFileLoad = (perfStats.loadEndTime - perfStats.loadStartTime) / 1000;
const accountTreeItem: AzureAccountTreeItem = new AzureAccountTreeItem();
context.subscriptions.push(accountTreeItem);
ext.tree = new AzExtTreeDataProvider(accountTreeItem, 'azureMarmelade.loadMore');
context.subscriptions.push(vscode.window.createTreeView('azureMarmelade', { treeDataProvider: ext.tree, showCollapseAll: true, canSelectMany: true }));
ext.tree = new AzExtTreeDataProvider(accountTreeItem, 'staticWebApps.loadMore');
context.subscriptions.push(vscode.window.createTreeView('staticWebApps', { treeDataProvider: ext.tree, showCollapseAll: true, canSelectMany: true }));
registerCommands();
});

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

@ -18,5 +18,5 @@ export namespace ext {
export let reporter: ITelemetryReporter;
// tslint:disable-next-line: strict-boolean-expressions
export let ignoreBundle: boolean = !/^(false|0)?$/i.test(process.env.AZCODE_MARMELADE_IGNORE_BUNDLE || '');
export let prefix: string = 'azureMarmelade';
export let prefix: string = 'staticWebApps';
}

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

@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import { AzureWizardPromptStep, IAzureQuickPickItem } from 'vscode-azureextensionui';
import { IStaticSiteWizardContext } from '../commands/createStaticWebApp/IStaticSiteWizardContext';
import { IStaticWebAppWizardContext } from '../commands/createStaticWebApp/IStaticWebAppWizardContext';
import { githubApiEndpoint } from '../constants';
import { ext } from '../extensionVariables';
import { createGitHubRequestOptions, getGitHubQuickPicksWithLoadMore, gitHubBranchData, gitHubWebResource, ICachedQuickPicks } from '../utils/gitHubUtils';
import { localize } from '../utils/localize';
import { nonNullProp } from '../utils/nonNull';
export class GitHubBranchListStep extends AzureWizardPromptStep<IStaticSiteWizardContext> {
public async prompt(context: IStaticSiteWizardContext): Promise<void> {
export class GitHubBranchListStep extends AzureWizardPromptStep<IStaticWebAppWizardContext> {
public async prompt(context: IStaticWebAppWizardContext): Promise<void> {
const placeHolder: string = localize('chooseBranch', 'Choose branch');
let branchData: gitHubBranchData | undefined;
const picksCache: ICachedQuickPicks<gitHubBranchData> = { picks: [] };
@ -23,7 +23,7 @@ export class GitHubBranchListStep extends AzureWizardPromptStep<IStaticSiteWizar
context.branchData = branchData;
}
public shouldPrompt(context: IStaticSiteWizardContext): boolean {
public shouldPrompt(context: IStaticWebAppWizardContext): boolean {
if (context.newRepoName) {
// if this is a new repo, the only branch that will have been created is 'master'
context.branchData = { name: 'master' };
@ -32,7 +32,7 @@ export class GitHubBranchListStep extends AzureWizardPromptStep<IStaticSiteWizar
return !context.branchData;
}
private async getBranchPicks(context: IStaticSiteWizardContext, picksCache: ICachedQuickPicks<gitHubBranchData>): Promise<IAzureQuickPickItem<gitHubBranchData | undefined>[]> {
private async getBranchPicks(context: IStaticWebAppWizardContext, picksCache: ICachedQuickPicks<gitHubBranchData>): Promise<IAzureQuickPickItem<gitHubBranchData | undefined>[]> {
const repoHtmlUrl: string = nonNullProp(context, 'repoHtmlUrl');
const owner: string = repoHtmlUrl.split('/')[3];
const repo: string = repoHtmlUrl.split('/')[4];

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

@ -6,16 +6,16 @@
import { AzureWizardPromptStep, IAzureQuickPickItem, IWizardOptions } from 'vscode-azureextensionui';
import { RepoCreateStep } from '../commands/createNewEndpoint/RepoCreateStep';
import { RepoNameStep } from '../commands/createNewEndpoint/RepoNameStep';
import { IStaticSiteWizardContext } from '../commands/createStaticWebApp/IStaticSiteWizardContext';
import { IStaticWebAppWizardContext } from '../commands/createStaticWebApp/IStaticWebAppWizardContext';
import { ext } from '../extensionVariables';
import { createGitHubRequestOptions, getGitHubQuickPicksWithLoadMore, gitHubRepoData, gitHubWebResource, ICachedQuickPicks } from '../utils/gitHubUtils';
import { localize } from '../utils/localize';
import { nonNullProp } from '../utils/nonNull';
const createNewRepo: string = 'createNewRepo';
export class GitHubRepoListStep extends AzureWizardPromptStep<IStaticSiteWizardContext> {
export class GitHubRepoListStep extends AzureWizardPromptStep<IStaticWebAppWizardContext> {
public async prompt(context: IStaticSiteWizardContext): Promise<void> {
public async prompt(context: IStaticWebAppWizardContext): Promise<void> {
const placeHolder: string = localize('chooseRepo', 'Choose repository');
let repoData: gitHubRepoData | undefined;
let quickPickItems: IAzureQuickPickItem<gitHubRepoData | undefined>[] = [];
@ -31,11 +31,11 @@ export class GitHubRepoListStep extends AzureWizardPromptStep<IStaticSiteWizardC
context.repoHtmlUrl = repoData.html_url;
}
public shouldPrompt(context: IStaticSiteWizardContext): boolean {
public shouldPrompt(context: IStaticWebAppWizardContext): boolean {
return !context.repoHtmlUrl;
}
public async getSubWizard(context: IStaticSiteWizardContext): Promise<IWizardOptions<IStaticSiteWizardContext> | undefined> {
public async getSubWizard(context: IStaticWebAppWizardContext): Promise<IWizardOptions<IStaticWebAppWizardContext> | undefined> {
if (context.repoData?.name === createNewRepo) {
return { promptSteps: [new RepoNameStep()], executeSteps: [new RepoCreateStep()] };
} else {
@ -43,7 +43,7 @@ export class GitHubRepoListStep extends AzureWizardPromptStep<IStaticSiteWizardC
}
}
private async getRepositories(context: IStaticSiteWizardContext, picksCache: ICachedQuickPicks<gitHubRepoData>): Promise<IAzureQuickPickItem<gitHubRepoData | undefined>[]> {
private async getRepositories(context: IStaticWebAppWizardContext, picksCache: ICachedQuickPicks<gitHubRepoData>): Promise<IAzureQuickPickItem<gitHubRepoData | undefined>[]> {
const requestOptions: gitHubWebResource = await createGitHubRequestOptions(context, nonNullProp(context, 'orgData').repos_url);
return await getGitHubQuickPicksWithLoadMore<gitHubRepoData>(picksCache, requestOptions, 'name');
}

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

@ -1,108 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ResourceModels } from "azure-arm-resource";
import * as path from 'path';
import { AzureParentTreeItem, AzureTreeItem, TreeItemIconPath } from "vscode-azureextensionui";
import { nonNullProp } from "../utils/nonNull";
import { treeUtils } from "../utils/treeUtils";
export class ResourceTreeItem extends AzureTreeItem {
public static contextValue: string = 'azureResource';
public readonly contextValue: string = ResourceTreeItem.contextValue;
public readonly data: ResourceModels.GenericResource;
public readonly commandId: string = 'azureMarmelade.revealResource';
constructor(parent: AzureParentTreeItem, resource: ResourceModels.GenericResource) {
super(parent);
this.data = resource;
}
public get name(): string {
return nonNullProp(this.data, 'name');
}
public get id(): string {
return nonNullProp(this.data, 'id');
}
public get label(): string {
return this.name;
}
public get iconPath(): TreeItemIconPath {
let iconName: string;
const rType: string | undefined = this.data.type?.toLowerCase();
if (rType && supportedIconTypes.includes(rType)) {
iconName = rType;
switch (rType) {
case 'microsoft.web/sites':
if (this.data.kind?.toLowerCase().includes('functionapp')) {
iconName = iconName.replace('sites', 'functionapp');
}
break;
default:
}
iconName = path.join('providers', iconName);
} else {
iconName = 'resource';
}
return treeUtils.getIconPath(iconName);
}
}
// Execute `npm run listIcons` from root of repo to re-generate this list after adding an icon
const supportedIconTypes: string[] = [
'microsoft.web/functionapp',
'microsoft.web/hostingenvironments',
'microsoft.web/serverfarms',
'microsoft.web/sites',
'microsoft.storage/storageaccounts',
'microsoft.sql/servers',
'microsoft.sql/servers/databases',
'microsoft.signalrservice/signalr',
'microsoft.servicefabricmesh/applications',
'microsoft.servicefabric/clusters',
'microsoft.servicebus/namespaces',
'microsoft.operationsmanagement/solutions',
'microsoft.operationalinsights/workspaces',
'microsoft.notificationhubs/namespaces',
'microsoft.network/applicationgateways',
'microsoft.network/applicationsecuritygroups',
'microsoft.network/loadbalancers',
'microsoft.network/localnetworkgateways',
'microsoft.network/networkinterfaces',
'microsoft.network/networksecuritygroups',
'microsoft.network/networkwatchers',
'microsoft.network/publicipaddresses',
'microsoft.network/publicipprefixes',
'microsoft.network/routetables',
'microsoft.network/virtualnetworkgateways',
'microsoft.network/virtualnetworks',
'microsoft.logic/workflows',
'microsoft.keyvault/vaults',
'microsoft.insights/components',
'microsoft.eventhub/namespaces',
'microsoft.eventgrid/domains',
'microsoft.eventgrid/eventsubscriptions',
'microsoft.eventgrid/topics',
'microsoft.documentdb/databaseaccounts',
'microsoft.devtestlab/labs',
'microsoft.devices/iothubs',
'microsoft.dbforpostgresql/servers',
'microsoft.dbformysql/servers',
'microsoft.containerservice/managedclusters',
'microsoft.containerregistry/registries',
'microsoft.compute/availabilitysets',
'microsoft.compute/disks',
'microsoft.compute/images',
'microsoft.compute/virtualmachines',
'microsoft.compute/virtualmachinescalesets',
'microsoft.cdn/profiles',
'microsoft.cache/redis',
'microsoft.batch/batchaccounts',
'microsoft.apimanagement/service',
];

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

@ -11,7 +11,7 @@ import { openUrl } from '../utils/openUrl';
import { requestUtils } from "../utils/requestUtils";
import { treeUtils } from "../utils/treeUtils";
export type StaticSite = {
export type StaticWebApp = {
id: string;
location: string;
name: string;
@ -29,12 +29,12 @@ export type StaticSite = {
type: string;
};
export class StaticSiteTreeItem extends AzureTreeItem {
public static contextValue: string = 'azureStaticSite';
public readonly contextValue: string = StaticSiteTreeItem.contextValue;
public readonly data: StaticSite;
export class StaticWebAppTreeItem extends AzureTreeItem {
public static contextValue: string = 'azureStaticWebApp';
public readonly contextValue: string = StaticWebAppTreeItem.contextValue;
public readonly data: StaticWebApp;
constructor(parent: AzureParentTreeItem, ss: StaticSite) {
constructor(parent: AzureParentTreeItem, ss: StaticWebApp) {
super(parent);
this.data = ss;
}
@ -56,7 +56,7 @@ export class StaticSiteTreeItem extends AzureTreeItem {
}
public get iconPath(): TreeItemIconPath {
return treeUtils.getIconPath('resourceGroup');
return treeUtils.getThemedIconPath('azure-staticwebapps');
}
public async deleteTreeItemImpl(): Promise<void> {

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

@ -9,7 +9,7 @@ import { AzExtTreeItem, AzureWizard, AzureWizardExecuteStep, AzureWizardPromptSt
import { ApiLocationStep } from '../commands/createStaticWebApp/ApiLocationStep';
import { AppArtifactLocationStep } from '../commands/createStaticWebApp/AppArtifactLocationStep';
import { AppLocationStep } from '../commands/createStaticWebApp/AppLocationStep';
import { IStaticSiteWizardContext } from '../commands/createStaticWebApp/IStaticSiteWizardContext';
import { IStaticWebAppWizardContext } from '../commands/createStaticWebApp/IStaticWebAppWizardContext';
import { StaticWebAppCreateStep } from '../commands/createStaticWebApp/StaticWebAppCreateStep';
import { GitHubBranchListStep } from '../github/GitHubBranchListStep';
import { GitHubOrgListStep } from '../github/GitHubOrgListStep';
@ -18,7 +18,7 @@ import { IGitHubAccessTokenContext } from '../IGitHubAccessTokenContext';
import { localize } from '../utils/localize';
import { nonNullProp } from '../utils/nonNull';
import { requestUtils } from '../utils/requestUtils';
import { StaticSite, StaticSiteTreeItem } from './StaticSiteTreeItem';
import { StaticWebApp, StaticWebAppTreeItem } from './StaticWebAppTreeItem';
export class SubscriptionTreeItem extends SubscriptionTreeItemBase {
public readonly childTypeLabel: string = localize('resourceGroup', 'Resource Group');
@ -37,38 +37,38 @@ export class SubscriptionTreeItem extends SubscriptionTreeItemBase {
const client: ResourceManagementClient = createAzureClient(this.root, ResourceManagementClient);
const rgs: ResourceModels.ResourceGroupListResult = this._nextLink ? await client.resourceGroups.listNext(this._nextLink) : await client.resourceGroups.list();
this._nextLink = rgs.nextLink;
const allGetRequests: { value: StaticSite[] }[] = await Promise.all(rgs.map(async (rg) => {
const allGetRequests: { value: StaticWebApp[] }[] = await Promise.all(rgs.map(async (rg) => {
const requestOptions: requestUtils.Request = await requestUtils.getDefaultAzureRequest(`${rg.id}/providers/Microsoft.Web/staticSites?api-version=2019-12-01-preview`, this.root);
return JSON.parse(await requestUtils.sendRequest(requestOptions));
}));
const staticSites: StaticSite[] = [];
const staticWebApps: StaticWebApp[] = [];
for (const ssRes of allGetRequests) {
if (ssRes.value.length > 0) {
for (const ss of ssRes.value) {
staticSites.push(ss);
staticWebApps.push(ss);
}
}
}
return await this.createTreeItemsWithErrorHandling(
staticSites,
'invalidResourceGroup',
ss => new StaticSiteTreeItem(this, ss),
staticWebApps,
'invalidStaticWebApp',
ss => new StaticWebAppTreeItem(this, ss),
ss => ss.name
);
}
public async createChildImpl(context: ICreateChildImplContext): Promise<AzExtTreeItem> {
const wizardContext: IStaticSiteWizardContext = { ...context, ...this.root };
const wizardContext: IStaticWebAppWizardContext = { ...context, ...this.root };
const title: string = localize('createStaticApp', 'Create Static Web App');
const promptSteps: AzureWizardPromptStep<IGitHubAccessTokenContext>[] = [new SiteNameStep(), new GitHubOrgListStep(), new GitHubRepoListStep(), new GitHubBranchListStep(), new AppLocationStep(), new ApiLocationStep(), new AppArtifactLocationStep()];
LocationListStep.addStep(wizardContext, promptSteps);
const executeSteps: AzureWizardExecuteStep<IStaticSiteWizardContext>[] = [new ResourceGroupCreateStep(), new StaticWebAppCreateStep()];
const executeSteps: AzureWizardExecuteStep<IStaticWebAppWizardContext>[] = [new ResourceGroupCreateStep(), new StaticWebAppCreateStep()];
const wizard: AzureWizard<IStaticSiteWizardContext> = new AzureWizard(wizardContext, {
const wizard: AzureWizard<IStaticWebAppWizardContext> = new AzureWizard(wizardContext, {
title,
promptSteps,
executeSteps
@ -85,6 +85,6 @@ export class SubscriptionTreeItem extends SubscriptionTreeItemBase {
const newSiteName: string = nonNullProp(wizardContext, 'newSiteName');
context.showCreatingTreeItem(newSiteName);
return new StaticSiteTreeItem(this, nonNullProp(wizardContext, 'site'));
return new StaticWebAppTreeItem(this, nonNullProp(wizardContext, 'site'));
}
}

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

@ -8,7 +8,7 @@ import { ext } from "../extensionVariables";
export namespace settingUtils {
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export async function updateGlobalSetting<T = string>(section: string, value: T, prefix: string = ext.prefix): Promise<void> {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix);
@ -16,7 +16,7 @@ export namespace settingUtils {
}
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export async function updateWorkspaceSetting<T = string>(section: string, value: T, fsPath: string, prefix: string = ext.prefix): Promise<void> {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix, Uri.file(fsPath));
@ -24,7 +24,7 @@ export namespace settingUtils {
}
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export function getGlobalSetting<T>(key: string, prefix: string = ext.prefix): T | undefined {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix);
@ -33,7 +33,7 @@ export namespace settingUtils {
}
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export function getWorkspaceSetting<T>(key: string, fsPath?: string, prefix: string = ext.prefix): T | undefined {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix, fsPath ? Uri.file(fsPath) : undefined);
@ -42,7 +42,7 @@ export namespace settingUtils {
/**
* Searches through all open folders and gets the current workspace setting (as long as there are no conflicts)
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export function getWorkspaceSettingFromAnyFolder(key: string, prefix: string = ext.prefix): string | undefined {
if (workspace.workspaceFolders && workspace.workspaceFolders.length > 0) {

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

@ -7,7 +7,7 @@ import { ConfigurationTarget, Uri, workspace, WorkspaceConfiguration } from "vsc
import { ext } from '../../extensionVariables';
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export async function updateGlobalSetting<T = string>(section: string, value: T, prefix: string = ext.prefix): Promise<void> {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix);
@ -15,7 +15,7 @@ export async function updateGlobalSetting<T = string>(section: string, value: T,
}
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export async function updateWorkspaceSetting<T = string>(section: string, value: T, fsPath: string, prefix: string = ext.prefix): Promise<void> {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix, Uri.file(fsPath));
@ -23,7 +23,7 @@ export async function updateWorkspaceSetting<T = string>(section: string, value:
}
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export function getGlobalSetting<T>(key: string, prefix: string = ext.prefix): T | undefined {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix);
@ -32,7 +32,7 @@ export function getGlobalSetting<T>(key: string, prefix: string = ext.prefix): T
}
/**
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export function getWorkspaceSetting<T>(key: string, fsPath?: string, prefix: string = ext.prefix): T | undefined {
const projectConfiguration: WorkspaceConfiguration = workspace.getConfiguration(prefix, fsPath ? Uri.file(fsPath) : undefined);
@ -41,7 +41,7 @@ export function getWorkspaceSetting<T>(key: string, fsPath?: string, prefix: str
/**
* Searches through all open folders and gets the current workspace setting (as long as there are no conflicts)
* Uses ext.prefix 'azureMarmelade' unless otherwise specified
* Uses ext.prefix 'staticWebApps' unless otherwise specified
*/
export function getWorkspaceSettingFromAnyFolder(key: string, prefix: string = ext.prefix): string | undefined {
if (workspace.workspaceFolders && workspace.workspaceFolders.length > 0) {

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

@ -19,7 +19,7 @@ export function createTestActionContext(): IActionContext {
suiteSetup(async function (this: IHookCallbackContext): Promise<void> {
this.timeout(1 * 60 * 1000);
await vscode.commands.executeCommand('azureMarmelade.refresh'); // activate the extension before tests begin
await vscode.commands.executeCommand('staticWebApps.refresh'); // activate the extension before tests begin
ext.outputChannel = new TestOutputChannel();
ext.ui = testUserInput;