Compare commits

...

1 Commits

Author SHA1 Message Date
vaidankarswapnil
244f3ff273 Fix eslint issues for Tabsbase and JupyterLabAppFactory 2021-10-07 16:13:07 +05:30
4 changed files with 16 additions and 14 deletions

View File

@@ -104,7 +104,7 @@ src/Explorer/Tabs/MongoDocumentsTab.ts
src/Explorer/Tabs/NotebookV2Tab.ts src/Explorer/Tabs/NotebookV2Tab.ts
src/Explorer/Tabs/ScriptTabBase.ts src/Explorer/Tabs/ScriptTabBase.ts
src/Explorer/Tabs/TabComponents.ts src/Explorer/Tabs/TabComponents.ts
src/Explorer/Tabs/TabsBase.ts # src/Explorer/Tabs/TabsBase.ts
src/Explorer/Tabs/TriggerTab.ts src/Explorer/Tabs/TriggerTab.ts
src/Explorer/Tabs/UserDefinedFunctionTab.ts src/Explorer/Tabs/UserDefinedFunctionTab.ts
src/Explorer/Tree/AccessibleVerticalList.ts src/Explorer/Tree/AccessibleVerticalList.ts
@@ -132,7 +132,7 @@ src/Shared/DefaultExperienceUtility.ts
src/Shared/appInsights.ts src/Shared/appInsights.ts
src/SparkClusterManager/ArcadiaResourceManager.ts src/SparkClusterManager/ArcadiaResourceManager.ts
src/SparkClusterManager/SparkClusterManager.ts src/SparkClusterManager/SparkClusterManager.ts
src/Terminal/JupyterLabAppFactory.ts # src/Terminal/JupyterLabAppFactory.ts
src/Terminal/NotebookAppContracts.d.ts src/Terminal/NotebookAppContracts.d.ts
src/applyExplorerBindings.ts src/applyExplorerBindings.ts
src/global.d.ts src/global.d.ts

View File

@@ -44,7 +44,7 @@ function TabNav({ tab, active }: { tab: Tab; active: boolean }) {
onMouseOver={() => setHovering(true)} onMouseOver={() => setHovering(true)}
onMouseLeave={() => setHovering(false)} onMouseLeave={() => setHovering(false)}
onClick={() => tab.onTabClick()} onClick={() => tab.onTabClick()}
onKeyPress={({ nativeEvent: e }) => tab.onKeyPressActivate(undefined, e)} onKeyPress={({ nativeEvent: e }) => tab.onKeyPressActivate(e)}
className={active ? "active tabList" : "tabList"} className={active ? "active tabList" : "tabList"}
title={useObservable(tab.tabPath)} title={useObservable(tab.tabPath)}
aria-selected={active} aria-selected={active}
@@ -83,7 +83,7 @@ const CloseButton = ({ tab, active, hovering }: { tab: Tab; active: boolean; hov
className="cancelButton" className="cancelButton"
onClick={() => tab.onCloseTabButtonClick()} onClick={() => tab.onCloseTabButtonClick()}
tabIndex={active ? 0 : undefined} tabIndex={active ? 0 : undefined}
onKeyPress={({ nativeEvent: e }) => tab.onKeyPressClose(undefined, e)} onKeyPress={({ nativeEvent: e }) => tab.onKeyPressClose(e)}
> >
<span className="tabIcon close-Icon"> <span className="tabIcon close-Icon">
<img src={errorIcon} title="Close" alt="Close" /> <img src={errorIcon} title="Close" alt="Close" />
@@ -98,8 +98,8 @@ const ErrorIcon = ({ tab, active }: { tab: Tab; active: boolean }) => (
title="Click to view more details" title="Click to view more details"
tabIndex={active ? 0 : undefined} tabIndex={active ? 0 : undefined}
className={active ? "actionsEnabled errorIconContainer" : "errorIconContainer"} className={active ? "actionsEnabled errorIconContainer" : "errorIconContainer"}
onClick={({ nativeEvent: e }) => tab.onErrorDetailsClick(undefined, e)} onClick={() => tab.onErrorDetailsClick()}
onKeyPress={({ nativeEvent: e }) => tab.onErrorDetailsKeyPress(undefined, e)} onKeyPress={({ nativeEvent: e }) => tab.onErrorDetailsKeyPress(e)}
> >
<span className="errorIcon" /> <span className="errorIcon" />
</div> </div>

View File

@@ -94,11 +94,11 @@ export default class TabsBase extends WaitsForTemplateViewModel {
return true; return true;
} }
public onKeyPressActivate = (source: any, event: KeyboardEvent): boolean => { public onKeyPressActivate = (event: KeyboardEvent): boolean => {
return this.onSpaceOrEnterKeyPress(event, () => this.onTabClick()); return this.onSpaceOrEnterKeyPress(event, () => this.onTabClick());
}; };
public onKeyPressClose = (source: any, event: KeyboardEvent): boolean => { public onKeyPressClose = (event: KeyboardEvent): boolean => {
return this.onSpaceOrEnterKeyPress(event, () => this.onCloseTabButtonClick()); return this.onSpaceOrEnterKeyPress(event, () => this.onCloseTabButtonClick());
}; };
@@ -120,22 +120,22 @@ export default class TabsBase extends WaitsForTemplateViewModel {
}); });
} }
public onErrorDetailsClick = (src: any, event: MouseEvent): boolean => { public onErrorDetailsClick = (): boolean => {
useNotificationConsole.getState().expandConsole(); useNotificationConsole.getState().expandConsole();
useNotificationConsole.getState().expandConsole(); useNotificationConsole.getState().expandConsole();
return false; return false;
}; };
public onErrorDetailsKeyPress = (src: any, event: KeyboardEvent): boolean => { public onErrorDetailsKeyPress = (event: KeyboardEvent): boolean => {
if (event.keyCode === Constants.KeyCodes.Space || event.keyCode === Constants.KeyCodes.Enter) { if (event.keyCode === Constants.KeyCodes.Space || event.keyCode === Constants.KeyCodes.Enter) {
this.onErrorDetailsClick(src, null); this.onErrorDetailsClick();
return false; return false;
} }
return true; return true;
}; };
public refresh() { public refresh(): void {
location.reload(); location.reload();
} }
@@ -144,6 +144,7 @@ export default class TabsBase extends WaitsForTemplateViewModel {
} }
/** Renders a Javascript object to be displayed inside Monaco Editor */ /** Renders a Javascript object to be displayed inside Monaco Editor */
//eslint-disable-next-line
public renderObjectForEditor(value: any, replacer: any, space: string | number): string { public renderObjectForEditor(value: any, replacer: any, space: string | number): string {
return JSON.stringify(value, replacer, space); return JSON.stringify(value, replacer, space);
} }

View File

@@ -5,6 +5,7 @@ import { ServerConnection, TerminalManager } from "@jupyterlab/services";
import { Terminal } from "@jupyterlab/terminal"; import { Terminal } from "@jupyterlab/terminal";
import { Panel, Widget } from "@phosphor/widgets"; import { Panel, Widget } from "@phosphor/widgets";
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class JupyterLabAppFactory { export class JupyterLabAppFactory {
public static async createTerminalApp(serverSettings: ServerConnection.ISettings) { public static async createTerminalApp(serverSettings: ServerConnection.ISettings) {
const manager = new TerminalManager({ const manager = new TerminalManager({
@@ -21,8 +22,8 @@ export class JupyterLabAppFactory {
term.title.closable = false; term.title.closable = false;
term.addClass("terminalWidget"); term.addClass("terminalWidget");
let panel = new Panel(); const panel = new Panel();
panel.addWidget(term as any); panel.addWidget((term as unknown) as Widget);
panel.id = "main"; panel.id = "main";
// Attach the widget to the dom. // Attach the widget to the dom.