diff --git a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx index 6f5916e89..d01850097 100644 --- a/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx +++ b/src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.tsx @@ -11,8 +11,8 @@ import ErrorBlackIcon from "../../../../images/error_black.svg"; import infoBubbleIcon from "../../../../images/info-bubble-9x9.svg"; import InfoIcon from "../../../../images/info_color.svg"; import ErrorRedIcon from "../../../../images/error_red.svg"; -import LoaderIcon from "../../../../images/circular_loader_black_16x16.gif"; import ClearIcon from "../../../../images/Clear.svg"; +import LoaderIcon from "../../../../images/circular_loader_black_16x16.gif"; import ChevronUpIcon from "../../../../images/QueryBuilder/CollapseChevronUp_16x.png"; import ChevronDownIcon from "../../../../images/QueryBuilder/CollapseChevronDown_16x.png"; @@ -59,9 +59,9 @@ export class NotificationConsoleComponent extends React.Component< { key: "Info", text: "Info" }, { key: "Error", text: "Error" } ]; - private headerTimeoutId: number; - private prevHeaderStatus: string; - private consoleHeaderElement: HTMLElement; + private headerTimeoutId?: number; + private prevHeaderStatus: string | null; + private consoleHeaderElement?: HTMLElement; constructor(props: NotificationConsoleComponentProps) { super(props); @@ -99,6 +99,10 @@ export class NotificationConsoleComponent extends React.Component< } } + public setElememntRef = (element: HTMLElement) => { + this.consoleHeaderElement = element; + }; + public render(): JSX.Element { const numInProgress = this.props.consoleData.filter((data: ConsoleData) => data.type === ConsoleDataType.InProgress) .length; @@ -110,7 +114,7 @@ export class NotificationConsoleComponent extends React.Component<
(this.consoleHeaderElement = element)} + ref={this.setElememntRef} onClick={(event: React.MouseEvent) => this.expandCollapseConsole()} onKeyDown={(event: React.KeyboardEvent) => this.onExpandCollapseKeyPress(event)} tabIndex={0} @@ -220,12 +224,12 @@ export class NotificationConsoleComponent extends React.Component< )); } - private onFilterSelected(event: React.ChangeEvent, option: IDropdownOption): void { + private onFilterSelected = (event: React.ChangeEvent, option: IDropdownOption): void => { this.setState({ selectedFilter: String(option.key) }); - } + }; private getFilteredConsoleData(): ConsoleData[] { - let filterType: ConsoleDataType = null; + let filterType: ConsoleDataType | null = null; switch (this.state.selectedFilter) { case "All": @@ -272,7 +276,7 @@ export class NotificationConsoleComponent extends React.Component< private onConsoleWasExpanded = (): void => { this.props.onConsoleExpandedChange(this.state.isExpanded); - if (this.state.isExpanded) { + if (this.state.isExpanded && this.consoleHeaderElement) { this.consoleHeaderElement.focus(); } }; diff --git a/src/Explorer/Notebook/NotebookComponent/epics.ts b/src/Explorer/Notebook/NotebookComponent/epics.ts index f99785a59..acd8d794e 100644 --- a/src/Explorer/Notebook/NotebookComponent/epics.ts +++ b/src/Explorer/Notebook/NotebookComponent/epics.ts @@ -808,7 +808,7 @@ const closeUnsupportedMimetypesEpic = ( const filepath = action.payload.filepath; // Close tab and show error message explorer.tabsManager.closeTabsByComparator( - tab => (tab as any).notebookPath && FileSystemUtil.isPathEqual((tab as any).notebookPath(), filepath) + (tab: any) => (tab as any).notebookPath && FileSystemUtil.isPathEqual((tab as any).notebookPath(), filepath) ); const msg = `${filepath} cannot be rendered. Please download the file, in order to view it outside of Data Explorer.`; explorer.showOkModalDialog("File cannot be rendered", msg); @@ -836,7 +836,7 @@ const closeContentFailedToFetchEpic = ( const filepath = action.payload.filepath; // Close tab and show error message explorer.tabsManager.closeTabsByComparator( - tab => (tab as any).notebookPath && FileSystemUtil.isPathEqual((tab as any).notebookPath(), filepath) + (tab: any) => (tab as any).notebookPath && FileSystemUtil.isPathEqual((tab as any).notebookPath(), filepath) ); const msg = `Failed to load file: ${filepath}.`; explorer.showOkModalDialog("Failure to load", msg); diff --git a/src/Explorer/Notebook/NotebookContentClient.ts b/src/Explorer/Notebook/NotebookContentClient.ts index 60358d306..28a9a7f34 100644 --- a/src/Explorer/Notebook/NotebookContentClient.ts +++ b/src/Explorer/Notebook/NotebookContentClient.ts @@ -192,7 +192,7 @@ export class NotebookContentClient { const dir = xhr.response; const item = NotebookUtil.createNotebookContentItem(dir.name, dir.path, dir.type); item.parent = parent; - parent.children!.push(item); + parent.children?.push(item); return item; }); } diff --git a/src/Utils/AutoPilotUtils.ts b/src/Utils/AutoPilotUtils.ts index 18a390100..4474c19e5 100644 --- a/src/Utils/AutoPilotUtils.ts +++ b/src/Utils/AutoPilotUtils.ts @@ -1,5 +1,4 @@ import * as Constants from "../Common/Constants"; -import { AutoPilotOfferSettings, Offer } from "../Contracts/DataModels"; export const manualToAutoscaleDisclaimer = `The starting autoscale max RU/s will be determined by the system, based on the current manual throughput settings and storage of your resource. After autoscale has been enabled, you can change the max RU/s. Learn more.`; diff --git a/src/Utils/NotificationConsoleUtils.ts b/src/Utils/NotificationConsoleUtils.ts index 5be0a2248..6a01ed802 100644 --- a/src/Utils/NotificationConsoleUtils.ts +++ b/src/Utils/NotificationConsoleUtils.ts @@ -21,7 +21,7 @@ export function logConsoleMessage(type: ConsoleDataType, message: string, id?: s } dataExplorer.logConsoleData({ type: type, date: formattedDate, message: message, id: id }); } - return id; + return id || ""; } export function clearInProgressMessageWithId(id: string): void { diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 2a7da5bcd..67c287714 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -95,6 +95,8 @@ "./src/Utils/StringUtils.ts", "./src/Utils/WindowUtils.ts", "./src/Utils/arm/generatedClients/2020-04-01/types.ts", + "./src/Utils/AutoPilotUtils.ts", + "./src/Utils/PricingUtils.ts", "./src/Utils/arm/generatedClients/2020-04-01/cassandraResources.ts", "./src/Utils/arm/generatedClients/2020-04-01/collection.ts", "./src/Utils/arm/generatedClients/2020-04-01/collectionPartition.ts",