Add compile options to a few extensions (#8252)

* add compile options to a few extensions

* move dep to dev dep

* fix return types
This commit is contained in:
Anthony Dresser
2019-11-07 11:41:31 -08:00
committed by GitHub
parent b364e32beb
commit ef0a92d83f
68 changed files with 121 additions and 211 deletions

View File

@@ -3,17 +3,15 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { ClusterController, ControllerError } from '../controller/clusterControllerApi';
import { ControllerTreeDataProvider } from '../tree/controllerTreeDataProvider';
import { TreeNode } from '../tree/treeNode';
import { AuthType } from '../constants';
import { ManageControllerCommand } from '../../extension';
import { BdcDashboardOptions } from './bdcDashboardModel';
import { ControllerNode } from '../tree/controllerTreeNode';
const localize = nls.loadMessageBundle();
@@ -33,7 +31,7 @@ export class AddControllerDialogModel {
private _authTypes: azdata.CategoryValue[];
constructor(
public treeDataProvider: ControllerTreeDataProvider,
public node?: TreeNode,
public node?: ControllerNode,
public prefilledUrl?: string,
public prefilledAuth?: azdata.CategoryValue,
public prefilledUsername?: string,

View File

@@ -192,7 +192,7 @@ export class BdcDashboard extends BdcDashboardPage {
* @param serviceName The name of the service to switch to the tab of
*/
public switchToServiceTab(serviceName: string): void {
const tabPageMapping = this.serviceTabPageMapping[serviceName];
const tabPageMapping = this.serviceTabPageMapping.get(serviceName);
if (!tabPageMapping) {
return;
}
@@ -213,7 +213,7 @@ export class BdcDashboard extends BdcDashboardPage {
if (services) {
// Add a nav item for each service
services.forEach(s => {
const existingTabPage = this.serviceTabPageMapping[s.serviceName];
const existingTabPage = this.serviceTabPageMapping.get(s.serviceName);
if (existingTabPage) {
// We've already created the tab and page for this service, just update the tab health status dot
existingTabPage.navTab.dot.value = getHealthStatusDot(s.healthStatus);
@@ -221,7 +221,7 @@ export class BdcDashboard extends BdcDashboardPage {
// New service - create the page and tab
const navItem = createServiceNavTab(this.modelView.modelBuilder, s);
const serviceStatusPage = new BdcServiceStatusPage(s.serviceName, this.model, this.modelView).container;
this.serviceTabPageMapping[s.serviceName] = { navTab: navItem, servicePage: serviceStatusPage };
this.serviceTabPageMapping.set(s.serviceName, { navTab: navItem, servicePage: serviceStatusPage });
navItem.div.onDidClick(() => {
this.switchToServiceTab(s.serviceName);
});

View File

@@ -79,7 +79,7 @@ export class BdcServiceStatusPage extends BdcDashboardPage {
private createResourceNavTabs(resources: ResourceStatusModel[]) {
let tabIndex = this.createdTabs.size;
resources.forEach(resource => {
const existingTab: ServiceTab = this.createdTabs[resource.resourceName];
const existingTab: ServiceTab = this.createdTabs.get(resource.resourceName);
if (existingTab) {
// We already created this tab so just update the status
existingTab.dot.value = getHealthStatusDot(resource.healthStatus);
@@ -87,7 +87,7 @@ export class BdcServiceStatusPage extends BdcDashboardPage {
// New tab - create and add to the end of the container
const currentIndex = tabIndex++;
const resourceHeaderTab = createResourceHeaderTab(this.modelView.modelBuilder, resource);
this.createdTabs[resource.resourceName] = resourceHeaderTab;
this.createdTabs.set(resource.resourceName, resourceHeaderTab);
const resourceStatusPage: azdata.FlexContainer = new BdcDashboardResourceStatusPage(this.model, this.modelView, this.serviceName, resource.resourceName).container;
resourceHeaderTab.div.onDidClick(() => {
// Don't need to do anything if this is already the currently selected tab

View File

@@ -22,7 +22,7 @@ function convertCredsToJson(creds: string): { credentials: {} } {
if (!creds) {
return undefined;
}
let credObj = { 'credentials': {} };
let credObj: { 'credentials': { [key: string]: any } } = { 'credentials': {} };
let pairs = creds.split(',');
let validPairs: string[] = [];
for (let i = 0; i < pairs.length; i++) {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls';
import * as azdata from 'azdata';
import * as vscode from 'vscode';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TreeNode } from './treeNode';
export interface IControllerTreeChangeHandler {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import { TreeNode } from './treeNode';
@@ -77,7 +75,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
this.notifyNodeChanged();
}
public deleteController(url: string, auth: AuthType, username: string): ControllerNode {
public deleteController(url: string, auth: AuthType, username: string): ControllerNode[] {
let deleted = this.root.deleteControllerNode(url, auth, username);
if (deleted) {
this.notifyNodeChanged();

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
@@ -129,20 +127,20 @@ export class ControllerRootNode extends ControllerTreeNode {
}
}
public deleteControllerNode(url: string, auth: AuthType, username: string): ControllerNode {
public deleteControllerNode(url: string, auth: AuthType, username: string): ControllerNode[] | undefined {
if (!url || (auth === 'basic' && !username)) {
return undefined;
}
let nodes = this.children as ControllerNode[];
let index = nodes.findIndex(e => isControllerMatch(e, url, auth, username));
let deleted = undefined;
let deleted: ControllerNode[] | undefined;
if (index >= 0) {
deleted = nodes.splice(index, 1);
}
return deleted;
}
private getExistingControllerNode(url: string, auth: AuthType, username: string): ControllerNode {
private getExistingControllerNode(url: string, auth: AuthType, username: string): ControllerNode | undefined {
if (!url || !username) {
return undefined;
}
@@ -169,7 +167,7 @@ export class ControllerNode extends ControllerTreeNode {
this.description = description;
}
public async getChildren(): Promise<ControllerTreeNode[]> {
public async getChildren(): Promise<ControllerTreeNode[] | undefined> {
if (this.children && this.children.length > 0) {
this.clearChildren();
}
@@ -178,11 +176,12 @@ export class ControllerNode extends ControllerTreeNode {
vscode.commands.executeCommand('bigDataClusters.command.addController', this);
return this.children as ControllerTreeNode[];
}
return undefined;
}
public static toIpAndPort(url: string): string {
public static toIpAndPort(url: string): string | undefined {
if (!url) {
return;
return undefined;
}
return url.trim().replace(/ /g, '').replace(/^.+\:\/\//, '');
}
@@ -245,4 +244,3 @@ export class ControllerNode extends ControllerTreeNode {
function isControllerMatch(node: ControllerNode, url: string, auth: string, username: string): unknown {
return node.url === url && node.auth === auth && node.username === username;
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls';
import * as azdata from 'azdata';
import * as vscode from 'vscode';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { generateGuid } from '../utils';

View File

@@ -73,7 +73,7 @@ export function showErrorMessage(error: any, prefixText?: string): void {
* Mappings of the different expected state values to their localized friendly names.
* These are defined in aris/projects/controller/src/Microsoft.SqlServer.Controller/StateMachines
*/
const stateToDisplayTextMap = {
const stateToDisplayTextMap: { [key: string]: string } = {
// K8sScaledSetStateMachine
'creating': localize('state.creating', "Creating"),
'waiting': localize('state.waiting', "Waiting"),
@@ -287,5 +287,3 @@ export function getIgnoreSslVerificationConfigSetting(): boolean {
}
return true;
}