mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
1 Commits
fix_eslint
...
eslint/fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a1e9f7231 |
@@ -44,8 +44,6 @@ src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
|
||||
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
||||
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
||||
src/Explorer/DataSamples/DataSamplesUtil.ts
|
||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts
|
||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
||||
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
||||
@@ -104,7 +102,7 @@ src/Explorer/Tabs/MongoDocumentsTab.ts
|
||||
src/Explorer/Tabs/NotebookV2Tab.ts
|
||||
src/Explorer/Tabs/ScriptTabBase.ts
|
||||
src/Explorer/Tabs/TabComponents.ts
|
||||
# src/Explorer/Tabs/TabsBase.ts
|
||||
src/Explorer/Tabs/TabsBase.ts
|
||||
src/Explorer/Tabs/TriggerTab.ts
|
||||
src/Explorer/Tabs/UserDefinedFunctionTab.ts
|
||||
src/Explorer/Tree/AccessibleVerticalList.ts
|
||||
@@ -132,7 +130,7 @@ src/Shared/DefaultExperienceUtility.ts
|
||||
src/Shared/appInsights.ts
|
||||
src/SparkClusterManager/ArcadiaResourceManager.ts
|
||||
src/SparkClusterManager/SparkClusterManager.ts
|
||||
# src/Terminal/JupyterLabAppFactory.ts
|
||||
src/Terminal/JupyterLabAppFactory.ts
|
||||
src/Terminal/NotebookAppContracts.d.ts
|
||||
src/applyExplorerBindings.ts
|
||||
src/global.d.ts
|
||||
|
||||
@@ -37,8 +37,8 @@ module.exports = {
|
||||
global: {
|
||||
branches: 25,
|
||||
functions: 25,
|
||||
lines: 29,
|
||||
statements: 29,
|
||||
lines: 29.5,
|
||||
statements: 29.5,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ describe("Cache arrays by key", () => {
|
||||
const key = "key";
|
||||
cache.insert(key, 1, 0);
|
||||
cache.clear();
|
||||
expect(cache.retrieve(key, 0, 1)).toBe(null);
|
||||
expect(cache.retrieve(key, 0, 1)).toBe(undefined);
|
||||
});
|
||||
|
||||
it("should invalidate oldest key to keep cache size under maximum", () => {
|
||||
@@ -21,7 +21,7 @@ describe("Cache arrays by key", () => {
|
||||
cache.insert(key1, 2, 4);
|
||||
|
||||
expect(cache.retrieve(key1, 0, 3)).toEqual([0, 2, 4]);
|
||||
expect(cache.retrieve(key2, 1, 1)).toEqual(null);
|
||||
expect(cache.retrieve(key2, 1, 1)).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("should cache and retrieve cached page within boundaries", () => {
|
||||
@@ -39,7 +39,7 @@ describe("Cache arrays by key", () => {
|
||||
const key = "key";
|
||||
cache.insert(key, 0, 0);
|
||||
cache.insert(key, 1, 1);
|
||||
expect(cache.retrieve(key, 2, 1)).toEqual(null);
|
||||
expect(cache.retrieve(key, 2, 1)).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("should not retrieve cached page overlapping boundaries", () => {
|
||||
@@ -48,7 +48,7 @@ describe("Cache arrays by key", () => {
|
||||
cache.insert(key, 0, 0);
|
||||
cache.insert(key, 1, 1);
|
||||
cache.insert(key, 2, 2);
|
||||
expect(cache.retrieve(key, 2, 4)).toEqual(null);
|
||||
expect(cache.retrieve(key, 2, 4)).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("should not insert non-contiguous element", () => {
|
||||
@@ -57,7 +57,7 @@ describe("Cache arrays by key", () => {
|
||||
cache.insert(key, 0, 0);
|
||||
cache.insert(key, 1, 1);
|
||||
cache.insert(key, 3, 3);
|
||||
expect(cache.retrieve(key, 3, 1)).toEqual(null);
|
||||
expect(cache.retrieve(key, 3, 1)).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("should cache multiple keys", () => {
|
||||
|
||||
@@ -61,12 +61,12 @@ export class ArraysByKeyCache<T> {
|
||||
* @param pageSize
|
||||
*/
|
||||
public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
|
||||
if (!this.cache.hasOwnProperty(key)) {
|
||||
return null;
|
||||
if (!Object.prototype.hasOwnProperty.call(this.cache, key)) {
|
||||
return undefined;
|
||||
}
|
||||
const elements = this.cache[key];
|
||||
if (startIndex + pageSize > elements.length) {
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return elements.slice(startIndex, startIndex + pageSize);
|
||||
|
||||
@@ -307,18 +307,11 @@ function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonCo
|
||||
|
||||
function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
||||
const label = "New " + getDatabaseName();
|
||||
const newDatabaseButton = document.activeElement as HTMLElement;
|
||||
|
||||
return {
|
||||
iconSrc: AddDatabaseIcon,
|
||||
iconAlt: label,
|
||||
onCommandClick: () =>
|
||||
useSidePanel
|
||||
.getState()
|
||||
.openSidePanel(
|
||||
"New " + getDatabaseName(),
|
||||
<AddDatabasePanel explorer={container} buttonElement={newDatabaseButton} />
|
||||
),
|
||||
useSidePanel.getState().openSidePanel("New " + getDatabaseName(), <AddDatabasePanel explorer={container} />),
|
||||
commandButtonLabel: label,
|
||||
ariaLabel: label,
|
||||
hasPopup: true,
|
||||
|
||||
@@ -44,7 +44,7 @@ function TabNav({ tab, active }: { tab: Tab; active: boolean }) {
|
||||
onMouseOver={() => setHovering(true)}
|
||||
onMouseLeave={() => setHovering(false)}
|
||||
onClick={() => tab.onTabClick()}
|
||||
onKeyPress={({ nativeEvent: e }) => tab.onKeyPressActivate(e)}
|
||||
onKeyPress={({ nativeEvent: e }) => tab.onKeyPressActivate(undefined, e)}
|
||||
className={active ? "active tabList" : "tabList"}
|
||||
title={useObservable(tab.tabPath)}
|
||||
aria-selected={active}
|
||||
@@ -83,7 +83,7 @@ const CloseButton = ({ tab, active, hovering }: { tab: Tab; active: boolean; hov
|
||||
className="cancelButton"
|
||||
onClick={() => tab.onCloseTabButtonClick()}
|
||||
tabIndex={active ? 0 : undefined}
|
||||
onKeyPress={({ nativeEvent: e }) => tab.onKeyPressClose(e)}
|
||||
onKeyPress={({ nativeEvent: e }) => tab.onKeyPressClose(undefined, e)}
|
||||
>
|
||||
<span className="tabIcon close-Icon">
|
||||
<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"
|
||||
tabIndex={active ? 0 : undefined}
|
||||
className={active ? "actionsEnabled errorIconContainer" : "errorIconContainer"}
|
||||
onClick={() => tab.onErrorDetailsClick()}
|
||||
onKeyPress={({ nativeEvent: e }) => tab.onErrorDetailsKeyPress(e)}
|
||||
onClick={({ nativeEvent: e }) => tab.onErrorDetailsClick(undefined, e)}
|
||||
onKeyPress={({ nativeEvent: e }) => tab.onErrorDetailsKeyPress(undefined, e)}
|
||||
>
|
||||
<span className="errorIcon" />
|
||||
</div>
|
||||
|
||||
@@ -94,11 +94,11 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
public onKeyPressActivate = (event: KeyboardEvent): boolean => {
|
||||
public onKeyPressActivate = (source: any, event: KeyboardEvent): boolean => {
|
||||
return this.onSpaceOrEnterKeyPress(event, () => this.onTabClick());
|
||||
};
|
||||
|
||||
public onKeyPressClose = (event: KeyboardEvent): boolean => {
|
||||
public onKeyPressClose = (source: any, event: KeyboardEvent): boolean => {
|
||||
return this.onSpaceOrEnterKeyPress(event, () => this.onCloseTabButtonClick());
|
||||
};
|
||||
|
||||
@@ -120,22 +120,22 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
public onErrorDetailsClick = (): boolean => {
|
||||
public onErrorDetailsClick = (src: any, event: MouseEvent): boolean => {
|
||||
useNotificationConsole.getState().expandConsole();
|
||||
useNotificationConsole.getState().expandConsole();
|
||||
return false;
|
||||
};
|
||||
|
||||
public onErrorDetailsKeyPress = (event: KeyboardEvent): boolean => {
|
||||
public onErrorDetailsKeyPress = (src: any, event: KeyboardEvent): boolean => {
|
||||
if (event.keyCode === Constants.KeyCodes.Space || event.keyCode === Constants.KeyCodes.Enter) {
|
||||
this.onErrorDetailsClick();
|
||||
this.onErrorDetailsClick(src, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
public refresh(): void {
|
||||
public refresh() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
@@ -144,7 +144,6 @@ export default class TabsBase extends WaitsForTemplateViewModel {
|
||||
}
|
||||
|
||||
/** Renders a Javascript object to be displayed inside Monaco Editor */
|
||||
//eslint-disable-next-line
|
||||
public renderObjectForEditor(value: any, replacer: any, space: string | number): string {
|
||||
return JSON.stringify(value, replacer, space);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ServerConnection, TerminalManager } from "@jupyterlab/services";
|
||||
import { Terminal } from "@jupyterlab/terminal";
|
||||
import { Panel, Widget } from "@phosphor/widgets";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
export class JupyterLabAppFactory {
|
||||
public static async createTerminalApp(serverSettings: ServerConnection.ISettings) {
|
||||
const manager = new TerminalManager({
|
||||
@@ -22,8 +21,8 @@ export class JupyterLabAppFactory {
|
||||
term.title.closable = false;
|
||||
term.addClass("terminalWidget");
|
||||
|
||||
const panel = new Panel();
|
||||
panel.addWidget((term as unknown) as Widget);
|
||||
let panel = new Panel();
|
||||
panel.addWidget(term as any);
|
||||
panel.id = "main";
|
||||
|
||||
// Attach the widget to the dom.
|
||||
|
||||
@@ -30,7 +30,7 @@ describe("GalleryUtils", () => {
|
||||
});
|
||||
|
||||
it("downloadItem shows dialog in data explorer", () => {
|
||||
const container = new Explorer();
|
||||
const container = {} as Explorer;
|
||||
GalleryUtils.downloadItem(container, undefined, galleryItem, undefined);
|
||||
|
||||
expect(useDialog.getState().visible).toBe(true);
|
||||
|
||||
@@ -69,11 +69,7 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
||||
if (tab.tabId === activeTab.tabId && tabIndex !== -1) {
|
||||
const tabToTheRight = updatedTabs[tabIndex];
|
||||
const lastOpenTab = updatedTabs[updatedTabs.length - 1];
|
||||
const newActiveTab = tabToTheRight ?? lastOpenTab;
|
||||
set({ activeTab: newActiveTab });
|
||||
if (newActiveTab) {
|
||||
newActiveTab.onActivate();
|
||||
}
|
||||
set({ activeTab: tabToTheRight || lastOpenTab });
|
||||
}
|
||||
|
||||
set({ openedTabs: updatedTabs });
|
||||
|
||||
Reference in New Issue
Block a user