Update prettier to latest. Remove tslint (#1641)

* Rev up prettier

* Reformat

* Remove deprecated tslint

* Remove call to tslint and update package-lock.json
This commit is contained in:
Laurent Nguyen
2023-10-03 15:13:24 +00:00
committed by GitHub
parent e3c168b7be
commit 90c1439d34
311 changed files with 1899 additions and 2194 deletions

View File

@@ -298,7 +298,7 @@ export class D3ForceGraph implements GraphRenderer {
if (this.uniqueValues.length === D3ForceGraph.MAX_COLOR_NB) {
this.errorMsgs.push(
`Number of unique values for property ${key} exceeds maximum (${D3ForceGraph.MAX_COLOR_NB})`
`Number of unique values for property ${key} exceeds maximum (${D3ForceGraph.MAX_COLOR_NB})`,
);
// ignore rest of values
break;
@@ -347,14 +347,14 @@ export class D3ForceGraph implements GraphRenderer {
return d.id;
})
.distance(D3ForceGraph.FORCE_LINK_DISTANCE)
.strength(D3ForceGraph.FORCE_LINK_STRENGTH)
.strength(D3ForceGraph.FORCE_LINK_STRENGTH),
)
.force("charge", forceManyBody())
.force(
"collide",
forceCollide(D3ForceGraph.FORCE_COLLIDE_RADIUS)
.strength(D3ForceGraph.FORCE_COLLIDE_STRENGTH)
.iterations(D3ForceGraph.FORCE_COLLIDE_ITERATIONS)
.iterations(D3ForceGraph.FORCE_COLLIDE_ITERATIONS),
);
}
@@ -695,7 +695,7 @@ export class D3ForceGraph implements GraphRenderer {
}) as any)
.on("end", ((e: D3DragEvent<SVGGElement, D3Node, unknown>, d: D3Node) => {
return this.dragended(d, e);
}) as any)
}) as any),
)
.on("mouseover", (_: MouseEvent, d: D3Node) => {
if (this.isHighlightDisabled || this.selectedNode || this.isDragging) {
@@ -867,7 +867,7 @@ export class D3ForceGraph implements GraphRenderer {
select(e.target as any).classed("active", false);
}) as any)
.attr("visibility", (d: D3Node) =>
!d._pagination || d._pagination.currentPage.start !== 0 ? "visible" : "hidden"
!d._pagination || d._pagination.currentPage.start !== 0 ? "visible" : "hidden",
);
parent
.append("rect")
@@ -921,7 +921,7 @@ export class D3ForceGraph implements GraphRenderer {
gaugeYOffset +
gaugeHeight / 2 +
D3ForceGraph.PAGINATION_LINE1_Y_OFFSET_PX +
D3ForceGraph.PAGINATION_LINE2_Y_OFFSET_PX
D3ForceGraph.PAGINATION_LINE2_Y_OFFSET_PX,
)
.text((d: D3Node) => {
const pageInfo = d._pagination;
@@ -1100,7 +1100,7 @@ export class D3ForceGraph implements GraphRenderer {
default:
case NeighborType.BOTH:
return (this.graphDataWrapper.getSourcesForId(nodeId) || []).concat(
this.graphDataWrapper.getTargetsForId(nodeId)
this.graphDataWrapper.getTargetsForId(nodeId),
);
}
})(this.igraphConfig.showNeighborType);

View File

@@ -79,8 +79,8 @@ export class EditorNodePropertiesComponent extends React.Component<EditorNodePro
{this.props.editedProperties.readOnlyProperties.map((nodeProp: ViewModels.InputProperty) =>
ReadOnlyNodePropertiesComponent.renderReadOnlyPropertyKeyPair(
nodeProp.key,
nodeProp.values.map((val) => val.value)
)
nodeProp.values.map((val) => val.value),
),
)}
</React.Fragment>
);

View File

@@ -72,7 +72,7 @@ describe("Graph Data", () => {
testString: [{ id: "123", value: stringValue }],
},
},
"testString"
"testString",
);
expect(value).toEqual(stringValue);
@@ -88,7 +88,7 @@ describe("Graph Data", () => {
testString: [{ id: "123", value: numberValue }],
},
},
"testString"
"testString",
);
expect(value).toEqual(numberValue);
@@ -104,7 +104,7 @@ describe("Graph Data", () => {
testString: [{ id: "123", value: booleanValue }],
},
},
"testString"
"testString",
);
expect(value).toEqual(booleanValue);

View File

@@ -235,7 +235,7 @@ export class GraphData<V extends GremlinVertex, E extends GremlinEdge> {
*/
public static addToEdgeArray(
edge: GremlinShortInEdge | GremlinShortOutEdge,
edgeArray: (GremlinShortInEdge | GremlinShortOutEdge)[]
edgeArray: (GremlinShortInEdge | GremlinShortOutEdge)[],
) {
for (let i = 0; i < edgeArray.length; i++) {
if (edgeArray[i].id === edge.id) {

View File

@@ -54,7 +54,7 @@ describe("Check whether query result is edge-vertex array", () => {
e: { id: "ide", type: "edge" },
v: { id: "idv", type: "vertex" },
},
])
]),
).toBe(true);
});
});
@@ -207,11 +207,9 @@ describe("GraphExplorer", () => {
const gVRU = 123.456;
const disableMonacoEditor = (graphExplorer: GraphExplorer) => {
renderResultAsJsonStub = sinon.stub(graphExplorer, "renderResultAsJson").callsFake(
(): JSX.Element => {
return <div>[Monaco Editor Stub]</div>;
}
);
renderResultAsJsonStub = sinon.stub(graphExplorer, "renderResultAsJson").callsFake((): JSX.Element => {
return <div>[Monaco Editor Stub]</div>;
});
};
interface AjaxResponse {
@@ -227,7 +225,7 @@ describe("GraphExplorer", () => {
graphExplorer: GraphExplorer,
backendResponses: BackendResponses,
done: any,
ignoreD3Update: boolean
ignoreD3Update: boolean,
) => {
const complete = (): void => {
wrapper.update();
@@ -299,7 +297,7 @@ describe("GraphExplorer", () => {
docDBResponse: AjaxResponse,
backendResponses: BackendResponses,
done: any,
ignoreD3Update: boolean
ignoreD3Update: boolean,
): GraphExplorer => {
(queryDocuments as jest.Mock).mockImplementation((container: any, query: string, options: any) => {
return {
@@ -321,7 +319,7 @@ describe("GraphExplorer", () => {
headers: [] as any[],
requestCharge: gVRU,
});
}
},
);
const props: GraphExplorerProps = createMockProps();
wrapper = mount(<GraphExplorer {...props} />);

View File

@@ -346,7 +346,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
// DO NOT UPDATE Multi-value properties (as this is not supported)
if (p.values.length === 1) {
updateQueryFragment += `.Property("${GraphUtil.escapeDoubleQuotes(p.key)}", ${GraphUtil.getQuotedPropValue(
p.values[0]
p.values[0],
)})`;
}
});
@@ -374,12 +374,12 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
// TODO Wait for dropping to end. Can we drop all of them in a single query?
// Must execute these drops sequentially to avoid a 500 "{"Message":"An error has occurred."}"
promise = this.submitToBackend(
`g.V(${pkId}).properties("${GraphUtil.escapeDoubleQuotes(droppedKeys[0])}").drop()`
`g.V(${pkId}).properties("${GraphUtil.escapeDoubleQuotes(droppedKeys[0])}").drop()`,
);
for (let i = 1; i < droppedKeys.length; i++) {
promise = promise.then(() => {
return this.submitToBackend(
`g.V(${pkId}).properties("${GraphUtil.escapeDoubleQuotes(droppedKeys[i])}").drop()`
`g.V(${pkId}).properties("${GraphUtil.escapeDoubleQuotes(droppedKeys[i])}").drop()`,
);
});
}
@@ -413,7 +413,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
},
(error: string) => {
GraphExplorer.reportToConsole(ConsoleDataType.Error, "Failed to update vertex properties: " + error);
}
},
);
return promise;
@@ -458,9 +458,9 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
(error: string) => {
GraphExplorer.reportToConsole(
ConsoleDataType.Error,
`Failed to remove node (Gremlin failed to execute). id=${id} : ${error}`
`Failed to remove node (Gremlin failed to execute). id=${id} : ${error}`,
);
}
},
);
}
@@ -504,7 +504,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
outE: boolean,
vertex: GraphData.GremlinVertex,
startIndex: number,
pageSize: number
pageSize: number,
): Q.Promise<EdgeVertexPair[]> {
if (startIndex < 0) {
const error = `Attempt to fetch edge-vertex pairs with negative index: outE:${outE}, vertex id:${vertex.id}, startIndex:${startIndex}, pageSize:${pageSize}`;
@@ -528,7 +528,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
excludedEdgeIds,
startIndex,
pageSize,
GraphExplorer.WITHOUT_STEP_ARGS_MAX_CHARS
GraphExplorer.WITHOUT_STEP_ARGS_MAX_CHARS,
);
return this.submitToBackend(gremlinQuery).then((result: GremlinClient.GremlinRequestResult) => {
@@ -572,7 +572,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
public loadNeighborsPage(
vertex: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>,
offsetIndex: number
offsetIndex: number,
): Q.Promise<GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>> {
const updateGraphData = () => {
// Cache results
@@ -627,46 +627,44 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
});
addedEdgesNb += pairsToAdd.length;
return pairs.length;
}
},
);
} else {
promise = Q.resolve(0);
}
promise = promise.then(
(outEPairsNb: number): Q.Promise<number> => {
const inEdgesToFetch = totalEdgesToFetch - outEPairsNb;
if (!vertex._inEAllLoaded && inEdgesToFetch > 0) {
let start: number;
if (offsetIndex <= vertex._outEdgeIds.length) {
start = 0;
} else {
start = offsetIndex - vertex._outEdgeIds.length;
}
return this.fetchEdgeVertexPairs(false, vertex, start, inEdgesToFetch).then(
(pairs: EdgeVertexPair[]): number => {
vertex._inEAllLoaded = pairs.length < inEdgesToFetch;
const pairsToAdd = pairs.slice(0, GraphExplorer.LOAD_PAGE_SIZE - outEPairsNb);
pairsToAdd.forEach((p: EdgeVertexPair) => {
GraphData.GraphData.addInE(vertex, p.e.label, p.e);
GraphUtil.addRootChildToGraph(vertex, p.v, graphData);
graphData.addEdge(p.e);
vertex._inEdgeIds.push(p.e.id);
// Cache results (graphdata now contains a vertex with outE's filled in)
this.edgeInfoCache.addVertex(graphData.getVertexById(p.v.id));
});
addedEdgesNb += pairsToAdd.length;
return outEPairsNb + pairs.length;
}
);
promise = promise.then((outEPairsNb: number): Q.Promise<number> => {
const inEdgesToFetch = totalEdgesToFetch - outEPairsNb;
if (!vertex._inEAllLoaded && inEdgesToFetch > 0) {
let start: number;
if (offsetIndex <= vertex._outEdgeIds.length) {
start = 0;
} else {
return Q.resolve(outEPairsNb);
start = offsetIndex - vertex._outEdgeIds.length;
}
return this.fetchEdgeVertexPairs(false, vertex, start, inEdgesToFetch).then(
(pairs: EdgeVertexPair[]): number => {
vertex._inEAllLoaded = pairs.length < inEdgesToFetch;
const pairsToAdd = pairs.slice(0, GraphExplorer.LOAD_PAGE_SIZE - outEPairsNb);
pairsToAdd.forEach((p: EdgeVertexPair) => {
GraphData.GraphData.addInE(vertex, p.e.label, p.e);
GraphUtil.addRootChildToGraph(vertex, p.v, graphData);
graphData.addEdge(p.e);
vertex._inEdgeIds.push(p.e.id);
// Cache results (graphdata now contains a vertex with outE's filled in)
this.edgeInfoCache.addVertex(graphData.getVertexById(p.v.id));
});
addedEdgesNb += pairsToAdd.length;
return outEPairsNb + pairs.length;
},
);
} else {
return Q.resolve(outEPairsNb);
}
);
});
return promise.then(() => {
if (offsetIndex >= GraphExplorer.LOAD_PAGE_SIZE || !vertex._outEAllLoaded || !vertex._inEAllLoaded) {
@@ -706,7 +704,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
}
GraphExplorer.reportToConsole(
ConsoleDataType.Info,
`Executed: ${cmd} ${GremlinClient.GremlinClient.getRequestChargeString(result.totalRequestCharge)}`
`Executed: ${cmd} ${GremlinClient.GremlinClient.getRequestChargeString(result.totalRequestCharge)}`,
);
return result;
},
@@ -715,7 +713,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
GraphExplorer.reportToConsole(ConsoleDataType.Error, `Gremlin query failed: ${cmd}`, err);
clearConsoleProgress();
throw err;
}
},
);
}
@@ -733,9 +731,9 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
maxItemCount: GraphExplorer.PAGE_ALL,
enableCrossPartitionQuery:
StorageUtility.LocalStorageUtility.getEntryString(
StorageUtility.StorageKey.IsCrossPartitionQueryEnabled
StorageUtility.StorageKey.IsCrossPartitionQueryEnabled,
) === "true",
} as FeedOptions
} as FeedOptions,
);
const response = await iterator.fetchNext();
@@ -744,7 +742,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
GraphExplorer.reportToConsole(
ConsoleDataType.Error,
`Failed to execute non-paged query ${query}. Reason:${error}`,
error
error,
);
return null;
}
@@ -756,7 +754,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
*/
public createNewEdge(e: GraphNewEdgeData): Q.Promise<unknown> {
const q = `g.V('${GraphUtil.escapeSingleQuotes(e.inputOutV)}').addE('${GraphUtil.escapeSingleQuotes(
e.label
e.label,
)}').To(g.V('${GraphUtil.escapeSingleQuotes(e.inputInV)}'))`;
return this.submitToBackend(q).then(
(result: GremlinClient.GremlinRequestResult) => {
@@ -789,9 +787,9 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
(error: string) => {
GraphExplorer.reportToConsole(
ConsoleDataType.Error,
"Failed to create edge (Gremlin query failed to execute): " + error
"Failed to create edge (Gremlin query failed to execute): " + error,
);
}
},
);
}
@@ -810,9 +808,9 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
(error: string) => {
GraphExplorer.reportToConsole(
ConsoleDataType.Error,
"Failed to remove edge (Gremlin query failed to execute): " + error
"Failed to remove edge (Gremlin query failed to execute): " + error,
);
}
},
);
}
@@ -960,7 +958,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
const title = "Failed to create vertex (Gremlin query failed to execute)";
GraphExplorer.reportToConsole(ConsoleDataType.Error, title + " :" + error);
throw { title: title, detail: error };
}
},
);
}
@@ -1035,7 +1033,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
dataExplorerArea: Constants.Areas.Tab,
tabTitle: "Graph",
},
this.props.onLoadStartKey
this.props.onLoadStartKey,
);
this.props.onLoadStartKeyChange(null);
}
@@ -1119,7 +1117,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
this.collectNodeProperties(
Object.keys(rootMap).map((id: string) => {
return rootMap[id];
})
}),
);
if (this.state.igraphConfigUiData.nodeProperties.indexOf(GraphExplorer.DISPLAY_DEFAULT_PROPERTY_KEY) !== -1) {
this.setState({
@@ -1161,8 +1159,8 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
const newIconsMap = {} as D3ForceGraph.D3GraphIconMap;
this.executeNonPagedDocDbQuery(
`SELECT c._graph_icon_property_value, c.format, c.icon FROM c WHERE c._graph_icon_set = "${GraphUtil.escapeDoubleQuotes(
iconSet
)}"`
iconSet,
)}"`,
).then(
(documents: DataModels.DocumentId[]) => {
$.each(
@@ -1172,7 +1170,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
data: doc["icon"],
format: doc["format"],
};
}
},
);
// Update graph configuration
@@ -1186,7 +1184,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
},
() => {
GraphExplorer.reportToConsole(ConsoleDataType.Error, `Failed to retrieve icons. iconSet:${iconSet}`);
}
},
);
}
@@ -1228,16 +1226,13 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
private getPossibleRootNodes(): LeftPane.CaptionId[] {
const key = this.state.igraphConfig.nodeCaption;
return $.map(
this.state.rootMap,
(value: any): LeftPane.CaptionId => {
const result = GraphData.GraphData.getNodePropValue(value, key);
return {
caption: result !== undefined ? result : value.id,
id: value.id,
};
}
);
return $.map(this.state.rootMap, (value: any): LeftPane.CaptionId => {
const result = GraphData.GraphData.getNodePropValue(value, key);
return {
caption: result !== undefined ? result : value.id,
id: value.id,
};
});
}
/**
@@ -1291,7 +1286,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
},
(reason: string) => {
GraphExplorer.reportToConsole(ConsoleDataType.Error, `Failed to select root node. Reason:${reason}`);
}
},
);
}
@@ -1459,7 +1454,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
() => {
GraphExplorer.reportToConsole(ConsoleDataType.Error, "Failed to retrieve list of possible vertices");
return [];
}
},
);
}
@@ -1485,7 +1480,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
// Reload neighbors in case we linked to a vertex that isn't loaded in the graph
const highlightedVertex = this.originalGraphData.getVertexById(this.state.highlightedNode.id);
return this.loadNeighborsPage(highlightedVertex, this.originalGraphData, 0);
})
}),
);
}
@@ -1617,7 +1612,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
id: string,
nodeCaption: string,
sources: NeighborVertexBasicInfo[],
targets: NeighborVertexBasicInfo[]
targets: NeighborVertexBasicInfo[],
): void {
// update neighbors
const gd = this.originalGraphData;
@@ -1668,11 +1663,9 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
}
this.setState({
possibleEdgeLabels: Object.keys(possibleEdgeLabels).map(
(value: string): InputTypeaheadComponent.Item => {
return { caption: value, value: value };
}
),
possibleEdgeLabels: Object.keys(possibleEdgeLabels).map((value: string): InputTypeaheadComponent.Item => {
return { caption: value, value: value };
}),
});
}
@@ -1714,7 +1707,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
*/
private updateGraphData(
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>,
igraphConfig?: IGraphConfig
igraphConfig?: IGraphConfig,
) {
this.originalGraphData = graphData;
const gd = JSON.parse(JSON.stringify(this.originalGraphData));
@@ -1792,7 +1785,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
maxItemCount: GraphExplorer.ROOT_LIST_PAGE_SIZE,
enableCrossPartitionQuery:
LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true",
} as FeedOptions
} as FeedOptions,
);
this.currentDocDBQueryInfo = {
iterator: iterator,
@@ -1803,7 +1796,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
} catch (error) {
GraphExplorer.reportToConsole(
ConsoleDataType.Error,
`Failed to execute CosmosDB query: ${query} reason:${error}`
`Failed to execute CosmosDB query: ${query} reason:${error}`,
);
throw error;
}
@@ -1820,14 +1813,14 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
})`;
const clearConsoleProgress = GraphExplorer.reportToConsole(
ConsoleDataType.InProgress,
`Executing: ${queryInfoStr}`
`Executing: ${queryInfoStr}`,
);
try {
const results: ViewModels.QueryResults = await queryDocumentsPage(
this.props.collectionId,
this.currentDocDBQueryInfo.iterator,
this.currentDocDBQueryInfo.index
this.currentDocDBQueryInfo.index,
);
clearConsoleProgress();
@@ -1836,10 +1829,10 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
RU = results.requestCharge.toString();
GraphExplorer.reportToConsole(
ConsoleDataType.Info,
`Executed: ${queryInfoStr} ${GremlinClient.GremlinClient.getRequestChargeString(RU)}`
`Executed: ${queryInfoStr} ${GremlinClient.GremlinClient.getRequestChargeString(RU)}`,
);
const pkIds: string[] = (results.documents || []).map((item: DataModels.DocumentId) =>
GraphExplorer.getPkIdFromDocumentId(item, this.props.collectionPartitionKeyProperty)
GraphExplorer.getPkIdFromDocumentId(item, this.props.collectionPartitionKeyProperty),
);
const arg = pkIds.join(",");
@@ -1877,7 +1870,7 @@ export class GraphExplorer extends React.Component<GraphExplorerProps, GraphExpl
});
this.setFilterQueryStatus(FilterQueryStatus.ErrorResult);
throw error;
}
},
);
promise

View File

@@ -103,19 +103,19 @@ describe("fetchEdgeVertexPairs()", () => {
it("should perform outE() query", () => {
expect(GraphUtil.createFetchEdgePairQuery(true, pkid, [], startIndex, pageSize, max)).toMatch(
new RegExp(OUT_E_MATCHER, "g")
new RegExp(OUT_E_MATCHER, "g"),
);
});
it("should perform inE() query", () => {
expect(GraphUtil.createFetchEdgePairQuery(false, pkid, [], startIndex, pageSize, max)).toMatch(
new RegExp(IN_E_MATCHER, "g")
new RegExp(IN_E_MATCHER, "g"),
);
});
it("should contain .has(id, without()) step which contains excludedIds", () => {
expect(GraphUtil.createFetchEdgePairQuery(true, pkid, ["id1", "id2"], startIndex, pageSize, max)).toMatch(
/\.has\(id, *without\('id1', *'id2'\)\)/g
/\.has\(id, *without\('id1', *'id2'\)\)/g,
);
});
@@ -127,7 +127,7 @@ describe("fetchEdgeVertexPairs()", () => {
const regex = new RegExp(`\\.limit\\(${pageSize}\\)`, "g");
expect(GraphUtil.createFetchEdgePairQuery(true, pkid, ["id1", "id2"], startIndex, pageSize, max)).toMatch(regex);
expect(GraphUtil.createFetchEdgePairQuery(true, pkid, ["id1", "id2"], startIndex, pageSize, max)).toMatch(
/^((?!range).)*$/g
/^((?!range).)*$/g,
);
});
@@ -140,7 +140,7 @@ describe("fetchEdgeVertexPairs()", () => {
const regex = new RegExp(`\\.range\\(${expectedStart}, *${expectedStart + size}\\)`, "g");
expect(GraphUtil.createFetchEdgePairQuery(true, pkid, excludedIds, start, size, smallLimit)).toMatch(regex);
expect(GraphUtil.createFetchEdgePairQuery(true, pkid, excludedIds, start, size, smallLimit)).toMatch(
/^((?!limit).)*$/g
/^((?!limit).)*$/g,
);
});
});

View File

@@ -26,7 +26,7 @@ export const getNeighborTitle = (neighbor: NeighborVertexBasicInfo): string => {
export const createEdgesfromNode = (
vertex: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>,
newNodes?: { [id: string]: boolean }
newNodes?: { [id: string]: boolean },
): void => {
if (Object.prototype.hasOwnProperty.call(vertex, "outE")) {
const outE = vertex.outE;
@@ -104,7 +104,7 @@ export const createFetchEdgePairQuery = (
excludedEdgeIds: string[],
startIndex: number,
pageSize: number,
withoutStepArgMaxLenght: number
withoutStepArgMaxLenght: number,
): string => {
let gremlinQuery: string;
if (excludedEdgeIds.length > 0) {
@@ -135,7 +135,7 @@ export const createFetchEdgePairQuery = (
*/
export const trimGraph = (
currentRoot: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>,
): void => {
const importantNodes = [currentRoot.id].concat(currentRoot._ancestorsId);
graphData.unloadAllVertices(importantNodes);
@@ -149,7 +149,7 @@ export const trimGraph = (
export const addRootChildToGraph = (
root: GraphData.GremlinVertex,
child: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>,
): void => {
child._ancestorsId = (root._ancestorsId || []).concat([root.id]);
graphData.addVertex(child);

View File

@@ -145,7 +145,7 @@ describe("Gremlin Client", () => {
done(e);
}
},
(error) => done.fail(error)
(error) => done.fail(error),
)
.finally(() => {
logConsoleSpy.restore();
@@ -188,7 +188,7 @@ describe("Gremlin Client", () => {
done(e);
}
},
(error) => done.fail(error)
(error) => done.fail(error),
)
.finally(() => {
logConsoleSpy.restore();
@@ -225,7 +225,7 @@ describe("Gremlin Client", () => {
} catch (e) {
done(e);
}
}
},
);
gremlinClient.client.params.failureCallback(
@@ -234,7 +234,7 @@ describe("Gremlin Client", () => {
requestCharge: RU,
requestId: requestId,
},
error
error,
);
});
@@ -260,7 +260,7 @@ describe("Gremlin Client", () => {
requestCharge: undefined,
requestId: undefined,
},
error
error,
);
});
});

View File

@@ -61,7 +61,7 @@ export class GremlinClient {
if (!requestId || !this.pendingResults.has(requestId)) {
const errorMsg = `Error: ${errorMessage}, unknown requestId:${requestId} ${GremlinClient.getRequestChargeString(
result.requestCharge
result.requestCharge,
)}`;
handleError(errorMsg, GremlinClient.LOG_AREA);
@@ -90,7 +90,7 @@ export class GremlinClient {
deferred: deferred,
timeoutId: window.setTimeout(
() => this.abortPendingRequest(requestId, GremlinClient.TIMEOUT_ERROR_MSG, null),
GremlinClient.PENDING_REQUEST_TIMEOUT_MS
GremlinClient.PENDING_REQUEST_TIMEOUT_MS,
),
});
return deferred.promise;
@@ -126,7 +126,7 @@ export class GremlinClient {
this.pendingResults.delete(requestId);
const errorMsg = `Aborting pending request ${requestId}. Error:${error} ${GremlinClient.getRequestChargeString(
requestCharge
requestCharge,
)}`;
handleError(errorMsg, GremlinClient.LOG_AREA);
}

View File

@@ -30,7 +30,7 @@ describe("Gremlin Simple Client", () => {
const fakeStatus = (
code: number,
requestCharge: number
requestCharge: number,
): {
attributes: {
"x-ms-request-charge": number;
@@ -94,236 +94,16 @@ describe("Gremlin Simple Client", () => {
result: { data: ["é"], meta: {} },
};
const expectedDecodedUint8ArrayValues = [
123,
34,
114,
101,
113,
117,
101,
115,
116,
73,
100,
34,
58,
34,
100,
55,
55,
50,
102,
56,
57,
55,
45,
48,
100,
52,
100,
45,
52,
99,
100,
49,
45,
98,
51,
54,
48,
45,
100,
100,
102,
54,
99,
56,
54,
98,
57,
51,
97,
51,
34,
44,
34,
115,
116,
97,
116,
117,
115,
34,
58,
123,
34,
99,
111,
100,
101,
34,
58,
50,
48,
48,
44,
34,
97,
116,
116,
114,
105,
98,
117,
116,
101,
115,
34,
58,
123,
34,
103,
114,
97,
112,
104,
69,
120,
101,
99,
117,
116,
105,
111,
110,
83,
116,
97,
116,
117,
115,
34,
58,
50,
48,
48,
44,
34,
83,
116,
111,
114,
97,
103,
101,
82,
85,
34,
58,
50,
46,
50,
57,
44,
34,
67,
111,
109,
112,
117,
116,
101,
82,
85,
34,
58,
49,
46,
48,
55,
44,
34,
80,
101,
114,
80,
97,
114,
116,
105,
116,
105,
111,
110,
67,
111,
109,
112,
117,
116,
101,
67,
104,
97,
114,
103,
101,
115,
34,
58,
123,
125,
125,
44,
34,
109,
101,
115,
115,
97,
103,
101,
34,
58,
34,
34,
125,
44,
34,
114,
101,
115,
117,
108,
116,
34,
58,
123,
34,
100,
97,
116,
97,
34,
58,
91,
34,
195,
169,
34,
93,
44,
34,
109,
101,
116,
97,
34,
58,
123,
125,
125,
125,
123, 34, 114, 101, 113, 117, 101, 115, 116, 73, 100, 34, 58, 34, 100, 55, 55, 50, 102, 56, 57, 55, 45, 48, 100,
52, 100, 45, 52, 99, 100, 49, 45, 98, 51, 54, 48, 45, 100, 100, 102, 54, 99, 56, 54, 98, 57, 51, 97, 51, 34, 44,
34, 115, 116, 97, 116, 117, 115, 34, 58, 123, 34, 99, 111, 100, 101, 34, 58, 50, 48, 48, 44, 34, 97, 116, 116,
114, 105, 98, 117, 116, 101, 115, 34, 58, 123, 34, 103, 114, 97, 112, 104, 69, 120, 101, 99, 117, 116, 105, 111,
110, 83, 116, 97, 116, 117, 115, 34, 58, 50, 48, 48, 44, 34, 83, 116, 111, 114, 97, 103, 101, 82, 85, 34, 58, 50,
46, 50, 57, 44, 34, 67, 111, 109, 112, 117, 116, 101, 82, 85, 34, 58, 49, 46, 48, 55, 44, 34, 80, 101, 114, 80,
97, 114, 116, 105, 116, 105, 111, 110, 67, 111, 109, 112, 117, 116, 101, 67, 104, 97, 114, 103, 101, 115, 34, 58,
123, 125, 125, 44, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 34, 125, 44, 34, 114, 101, 115, 117, 108,
116, 34, 58, 123, 34, 100, 97, 116, 97, 34, 58, 91, 34, 195, 169, 34, 93, 44, 34, 109, 101, 116, 97, 34, 58, 123,
125, 125, 125,
];
// We do our best here to emulate what the server should return
const gremlinResponseData = new Uint8Array(<any>expectedDecodedUint8ArrayValues).buffer;
@@ -395,7 +175,7 @@ describe("Gremlin Simple Client", () => {
requestId: fakeResponse.requestId,
data: fakeResponse.result.data,
requestCharge: RU,
})
}),
).toBe(true);
});
@@ -419,7 +199,7 @@ describe("Gremlin Simple Client", () => {
requestId: fakeResponse.requestId,
data: null,
requestCharge: RU,
})
}),
).toBe(true);
});
@@ -444,7 +224,7 @@ describe("Gremlin Simple Client", () => {
requestId: fakeResponse.requestId,
data: fakeResponse.result.data,
requestCharge: RU,
})
}),
).toBe(true);
expect(onSuccessSpy.notCalled).toBe(true);
});

View File

@@ -136,7 +136,7 @@ export class GremlinSimpleClient {
if (this.params.failureCallback) {
this.params.failureCallback(
null,
`Unexpected error while decoding backend response: ${e} msg:${JSON.stringify(msg)}`
`Unexpected error while decoding backend response: ${e} msg:${JSON.stringify(msg)}`,
);
}
return null;
@@ -169,7 +169,7 @@ export class GremlinSimpleClient {
if (this.params.failureCallback) {
this.params.failureCallback(
result,
`Received response for missing or closed request: ${requestId} code:${statusCode} message:${statusMessage}`
`Received response for missing or closed request: ${requestId} code:${statusCode} message:${statusMessage}`,
);
}
return;
@@ -282,7 +282,7 @@ export class GremlinSimpleClient {
return btoa(
encodeURIComponent(utf8Str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
return String.fromCharCode(parseInt(p1, 16));
})
}),
);
}

View File

@@ -248,7 +248,7 @@ export class NodePropertiesComponent extends React.Component<
},
() => {
GraphExplorer.reportToConsole(ConsoleDataType.Error, "Failed to update Vertex sources.");
}
},
);
}
@@ -394,7 +394,7 @@ export class NodePropertiesComponent extends React.Component<
isSectionExpanded: boolean,
expandClickHandler: () => void,
currentView: Mode,
saveClickHandler: () => void
saveClickHandler: () => void,
): JSX.Element {
if (isSectionExpanded) {
return (
@@ -444,7 +444,7 @@ export class NodePropertiesComponent extends React.Component<
this.state.isPropertiesExpanded,
this.showPropertyEditor.bind(this),
Mode.PROPERTY_EDITOR,
this.saveProperties.bind(this)
this.saveProperties.bind(this),
)}
<AccessibleElement
className="sectionHeader"
@@ -508,7 +508,7 @@ export class NodePropertiesComponent extends React.Component<
isNeighborExpanded,
showNeighborEditor,
currentNeighborView,
this.updateVertexNeighbors.bind(this, isSource)
this.updateVertexNeighbors.bind(this, isSource),
)}
<AccessibleElement

View File

@@ -39,10 +39,10 @@ export class ReadOnlyNodePropertiesComponent extends React.Component<ReadOnlyNod
public static renderReadOnlyPropertyKeyPair(
key: string,
propertyValues: ViewModels.GremlinPropertyValueType[]
propertyValues: ViewModels.GremlinPropertyValueType[],
): JSX.Element {
const renderedValues = propertyValues.map((value) =>
ReadOnlyNodePropertiesComponent.renderSinglePropertyValue(value)
ReadOnlyNodePropertiesComponent.renderSinglePropertyValue(value),
);
const stringifiedValues = propertyValues
.map((value) => ReadOnlyNodePropertiesComponent.singlePropertyValueToString(value))

View File

@@ -27,7 +27,7 @@ export const NewVertexComponent: FunctionComponent<INewVertexComponentProps> = (
values: [{ value: "", type: DEFAULT_PROPERTY_TYPE }],
},
],
}
},
);
const propertyTypes: string[] = EditorNodePropertiesComponent.VERTEX_PROPERTY_TYPES;