Fix tslint variable-name and no-parameter-properties

This commit is contained in:
Eric Jizba 2017-10-02 09:07:32 -07:00
Родитель 36683ee551
Коммит 2579a96a7f
4 изменённых файлов: 47 добавлений и 29 удалений

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

@ -12,13 +12,11 @@ import { FunctionAppNode, INode } from './nodes';
import * as TemplateFiles from './template-files';
import * as util from './util';
const _expectedFunctionAppFiles = [
const expectedFunctionAppFiles = [
'host.json',
'local.settings.json',
path.join('.vscode', 'launch.json')
];
const _yes = 'Yes';
const _no = 'No';
export function openInPortal(node?: INode) {
if (node && node.tenantId) {
@ -41,8 +39,9 @@ export async function createFunction(outputChannel: vscode.OutputChannel) {
const missingFiles = getMissingFunctionAppFiles(functionAppPath);
if (missingFiles.length !== 0) {
const result = await vscode.window.showWarningMessage(`The current folder is missing the following function app files: '${missingFiles.join('\', \'')}'. Add the missing files?`, _yes, _no);
if (result === _yes) {
const yes = 'Yes';
const result = await vscode.window.showWarningMessage(`The current folder is missing the following function app files: '${missingFiles.join('\', \'')}'. Add the missing files?`, yes, 'No');
if (result === yes) {
await FunctionsCli.createFunctionApp(outputChannel, functionAppPath);
} else {
throw new util.UserCancelledError();
@ -119,7 +118,7 @@ export async function restartFunctionApp(outputChannel: vscode.OutputChannel, no
}
function getMissingFunctionAppFiles(rootPath: string) {
return _expectedFunctionAppFiles.filter(file => !fs.existsSync(path.join(rootPath, file)));
return expectedFunctionAppFiles.filter(file => !fs.existsSync(path.join(rootPath, file)));
}
function validateTemplateName(rootPath: string, name: string): string | undefined {

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

@ -8,10 +8,15 @@ import { AzureAccount } from './azure-account.api';
import { GenericNode, INode, SubscriptionNode } from './nodes';
export class AzureFunctionsExplorer implements TreeDataProvider<INode> {
private _onDidChangeTreeData: EventEmitter<INode> = new EventEmitter<INode>();
public readonly onDidChangeTreeData: Event<INode> = this._onDidChangeTreeData.event;
private onDidChangeTreeDataEmitter: EventEmitter<INode> = new EventEmitter<INode>();
private azureAccount: AzureAccount;
constructor(private azureAccount: AzureAccount) {
constructor(azureAccount: AzureAccount) {
this.azureAccount = azureAccount;
}
public get onDidChangeTreeData(): Event<INode> {
return this.onDidChangeTreeDataEmitter.event;
}
public getTreeItem(node: INode): TreeItem {
@ -35,6 +40,6 @@ export class AzureFunctionsExplorer implements TreeDataProvider<INode> {
}
public refresh(node?: INode): void {
this._onDidChangeTreeData.fire(node);
this.onDidChangeTreeDataEmitter.fire(node);
}
}

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

@ -18,7 +18,12 @@ export interface INode extends vscode.TreeItem {
export class GenericNode implements INode {
public readonly contextValue: string;
public readonly command: vscode.Command;
constructor(readonly id: string, readonly label: string, commandId?: string) {
public readonly id: string;
public readonly label: string;
constructor(id: string, label: string, commandId?: string) {
this.id = id;
this.label = label;
this.contextValue = id;
if (commandId) {
this.command = {
@ -34,13 +39,15 @@ export class SubscriptionNode implements INode {
public readonly label: string;
public readonly id: string;
public readonly tenantId: string;
public readonly collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
constructor(private readonly _subscriptionFilter: AzureResourceFilter) {
this.label = _subscriptionFilter.subscription.displayName!;
this.id = _subscriptionFilter.subscription.subscriptionId!;
this.tenantId = _subscriptionFilter.session.tenantId;
private readonly subscriptionFilter: AzureResourceFilter;
constructor(subscriptionFilter: AzureResourceFilter) {
this.subscriptionFilter = subscriptionFilter;
this.label = subscriptionFilter.subscription.displayName!;
this.id = subscriptionFilter.subscription.subscriptionId!;
this.tenantId = subscriptionFilter.session.tenantId;
}
get iconPath(): { light: string, dark: string } {
@ -58,7 +65,7 @@ export class SubscriptionNode implements INode {
}
public getWebSiteClient() {
return new WebSiteManagementClient(this._subscriptionFilter.session.credentials, this.id);
return new WebSiteManagementClient(this.subscriptionFilter.session.credentials, this.id);
}
}
@ -68,10 +75,15 @@ export class FunctionAppNode implements INode {
public readonly id: string;
public readonly tenantId: string;
constructor(private readonly _functionApp: WebSiteModels.Site, private readonly _subscriptionNode: SubscriptionNode) {
this.label = `${_functionApp.name} (${this._functionApp.resourceGroup})`;
this.id = _functionApp.id!;
this.tenantId = _subscriptionNode.tenantId;
private readonly functionApp: WebSiteModels.Site;
private readonly subscriptionNode: SubscriptionNode;
constructor(functionApp: WebSiteModels.Site, subscriptionNode: SubscriptionNode) {
this.functionApp = functionApp;
this.subscriptionNode = subscriptionNode;
this.label = `${functionApp.name} (${this.functionApp.resourceGroup})`;
this.id = functionApp.id!;
this.tenantId = subscriptionNode.tenantId;
}
get iconPath(): { light: string, dark: string } {
@ -82,15 +94,15 @@ export class FunctionAppNode implements INode {
}
public async start() {
const client = this._subscriptionNode.getWebSiteClient();
await client.webApps.start(this._functionApp.resourceGroup!, this._functionApp.name!);
await util.waitForFunctionAppState(client, this._functionApp.resourceGroup!, this._functionApp.name!, util.FunctionAppState.Running);
const client = this.subscriptionNode.getWebSiteClient();
await client.webApps.start(this.functionApp.resourceGroup!, this.functionApp.name!);
await util.waitForFunctionAppState(client, this.functionApp.resourceGroup!, this.functionApp.name!, util.FunctionAppState.Running);
}
public async stop() {
const client = this._subscriptionNode.getWebSiteClient();
await client.webApps.stop(this._functionApp.resourceGroup!, this._functionApp.name!);
await util.waitForFunctionAppState(client, this._functionApp.resourceGroup!, this._functionApp.name!, util.FunctionAppState.Stopped);
const client = this.subscriptionNode.getWebSiteClient();
await client.webApps.stop(this.functionApp.resourceGroup!, this.functionApp.name!);
await util.waitForFunctionAppState(client, this.functionApp.resourceGroup!, this.functionApp.name!, util.FunctionAppState.Stopped);
}
public async restart() {

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

@ -101,14 +101,16 @@ export async function waitForFunctionAppState(webSiteManagementClient: WebSiteMa
export class QuickPickItem implements vscode.QuickPickItem {
public readonly description: string;
constructor(readonly label: string, description?: string) {
public readonly label: string;
constructor(label: string, description?: string) {
this.label = label;
this.description = description ? description : '';
}
}
export class QuickPickItemWithData<T> extends QuickPickItem {
public readonly data: T;
constructor(data: T, readonly label: string, description?: string) {
constructor(data: T, label: string, description?: string) {
super(label, description);
this.data = data;
}