mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-24 03:11:32 +00:00
Fixed eslint issue of GremlintClient.ts and AccessibleVerticalList.ts
This commit is contained in:
@@ -48,11 +48,9 @@ src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
|
src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts
|
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
||||||
src/Explorer/Menus/ContextMenu.ts
|
src/Explorer/Menus/ContextMenu.ts
|
||||||
@@ -107,7 +105,6 @@ 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/Collection.ts
|
src/Explorer/Tree/Collection.ts
|
||||||
src/Explorer/Tree/ConflictId.ts
|
src/Explorer/Tree/ConflictId.ts
|
||||||
src/Explorer/Tree/DocumentId.ts
|
src/Explorer/Tree/DocumentId.ts
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/**
|
/**
|
||||||
* Wrapper around GremlinSimpleClient using Q promises and tailored to cosmosdb authentication
|
* Wrapper around GremlinSimpleClient using Q promises and tailored to cosmosdb authentication
|
||||||
*/
|
*/
|
||||||
@@ -55,7 +56,7 @@ export class GremlinClient {
|
|||||||
this.flushResult(result.requestId);
|
this.flushResult(result.requestId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
failureCallback: (result: Result, error: any) => {
|
failureCallback: (result: Result, error: string) => {
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
const requestId = result.requestId;
|
const requestId = result.requestId;
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ export class GremlinClient {
|
|||||||
// Fail all pending requests if no request id (fatal)
|
// Fail all pending requests if no request id (fatal)
|
||||||
if (!requestId) {
|
if (!requestId) {
|
||||||
for (const reqId of this.pendingResults.keys()) {
|
for (const reqId of this.pendingResults.keys()) {
|
||||||
this.abortPendingRequest(reqId, errorMessage, null);
|
this.abortPendingRequest(reqId, errorMessage, undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -89,7 +90,7 @@ export class GremlinClient {
|
|||||||
},
|
},
|
||||||
deferred: deferred,
|
deferred: deferred,
|
||||||
timeoutId: window.setTimeout(
|
timeoutId: window.setTimeout(
|
||||||
() => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, null),
|
() => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, undefined),
|
||||||
GremlinClient.PENDING_REQUEST_TIMEOUT_MS
|
GremlinClient.PENDING_REQUEST_TIMEOUT_MS
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
@@ -101,7 +102,7 @@ export class GremlinClient {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.client.close();
|
this.client.close();
|
||||||
this.client = null;
|
this.client = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,7 +111,8 @@ export class GremlinClient {
|
|||||||
* @return request charge or empty string
|
* @return request charge or empty string
|
||||||
*/
|
*/
|
||||||
public static getRequestChargeString(requestCharge: string | number): string {
|
public static getRequestChargeString(requestCharge: string | number): string {
|
||||||
return requestCharge == undefined || requestCharge == null ? "" : `(${requestCharge} RUs)`;
|
// eslint-disable-next-line no-null/no-null
|
||||||
|
return requestCharge === undefined || requestCharge === null ? "" : `(${requestCharge} RUs)`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as _ from "underscore";
|
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
|
import * as _ from "underscore";
|
||||||
|
|
||||||
enum ScrollPosition {
|
enum ScrollPosition {
|
||||||
Top,
|
Top,
|
||||||
@@ -7,25 +7,25 @@ enum ScrollPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AccessibleVerticalList {
|
export class AccessibleVerticalList {
|
||||||
private items: any[] = [];
|
private items: unknown[] = [];
|
||||||
private onSelect?: (item: any) => void;
|
private onSelect?: (item: unknown) => void;
|
||||||
|
|
||||||
public currentItemIndex: ko.Observable<number>;
|
public currentItemIndex: ko.Observable<number>;
|
||||||
public currentItem: ko.Computed<any>;
|
public currentItem: ko.Computed<unknown>;
|
||||||
|
|
||||||
constructor(initialSetOfItems: any[]) {
|
constructor(initialSetOfItems: unknown[]) {
|
||||||
this.items = initialSetOfItems;
|
this.items = initialSetOfItems;
|
||||||
this.currentItemIndex = this.items != null && this.items.length > 0 ? ko.observable(0) : ko.observable(-1);
|
this.currentItemIndex = this.items !== undefined && this.items.length > 0 ? ko.observable(0) : ko.observable(-1);
|
||||||
this.currentItem = ko.computed<any>(() => this.items[this.currentItemIndex()]);
|
this.currentItem = ko.computed<unknown>(() => this.items[this.currentItemIndex()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setOnSelect(onSelect: (item: any) => void): void {
|
public setOnSelect(onSelect: (item: unknown) => void): void {
|
||||||
this.onSelect = onSelect;
|
this.onSelect = onSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public onKeyDown = (_src: unknown, event: KeyboardEvent): boolean => {
|
public onKeyDown = (_src: unknown, event: KeyboardEvent): boolean => {
|
||||||
const targetContainer: Element = <Element>event.target;
|
const targetContainer: Element = <Element>event.target;
|
||||||
if (this.items == null || this.items.length === 0) {
|
if (this.items === undefined || this.items.length === 0) {
|
||||||
// no items so this should be a noop
|
// no items so this should be a noop
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -62,8 +62,8 @@ export class AccessibleVerticalList {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
public updateItemList(newItemList: any[]) {
|
public updateItemList(newItemList: unknown[]): void {
|
||||||
if (newItemList == null || newItemList.length === 0) {
|
if (newItemList === undefined || newItemList.length === 0) {
|
||||||
this.currentItemIndex(-1);
|
this.currentItemIndex(-1);
|
||||||
this.items = [];
|
this.items = [];
|
||||||
return;
|
return;
|
||||||
@@ -73,7 +73,7 @@ export class AccessibleVerticalList {
|
|||||||
this.items = newItemList;
|
this.items = newItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateCurrentItem(item: any) {
|
public updateCurrentItem(item: unknown): void {
|
||||||
const updatedIndex: number = this.isItemListEmpty() ? -1 : _.indexOf(this.items, item);
|
const updatedIndex: number = this.isItemListEmpty() ? -1 : _.indexOf(this.items, item);
|
||||||
this.currentItemIndex(updatedIndex);
|
this.currentItemIndex(updatedIndex);
|
||||||
}
|
}
|
||||||
@@ -118,6 +118,6 @@ export class AccessibleVerticalList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private isItemListEmpty(): boolean {
|
private isItemListEmpty(): boolean {
|
||||||
return this.items == null || this.items.length === 0;
|
return this.items === undefined || this.items.length === 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user