Compare commits

..

3 Commits

Author SHA1 Message Date
hardiknai-techm
0897c75114 resolve_eslint_ReadOnlyNodePropertiesComponent 2021-10-14 11:13:35 +05:30
hardiknai-techm
b9e06858c5 resolve master code conflict 2021-10-12 20:59:27 +05:30
hardiknai-techm
043541b0dc resolve eslint ReadOnlyNodePropertiesComponent 2021-08-20 08:10:58 +05:30
9 changed files with 47 additions and 73 deletions

View File

@@ -2,8 +2,6 @@
src/**/__mocks__/**/*
dist/
Contracts/
src/Api/Apis.ts
src/AuthType.ts
src/Bindings/BindingHandlersRegisterer.ts
src/Bindings/ReactBindingHandler.ts
src/Common/Constants.ts
@@ -37,7 +35,6 @@ src/Definitions/svg.d.ts
src/Explorer/ComponentRegisterer.test.ts
src/Explorer/ComponentRegisterer.ts
src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts
src/Explorer/Controls/Editor/EditorComponent.ts
src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts
src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
@@ -85,10 +82,14 @@ src/Explorer/Tables/DataTable/DataTableViewModel.ts
src/Explorer/Tables/DataTable/TableEntityListViewModel.ts
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
src/Explorer/Tables/TableDataClient.ts
src/Explorer/Tables/TableEntityProcessor.ts
src/Explorer/Tables/Utilities.ts
src/Explorer/Tabs/ConflictsTab.ts
src/Explorer/Tabs/DatabaseSettingsTab.ts
src/Explorer/Tabs/DocumentsTab.test.ts
src/Explorer/Tabs/DocumentsTab.ts
src/Explorer/Tabs/GraphTab.ts
src/Explorer/Tabs/MongoDocumentsTab.ts
src/Explorer/Tabs/NotebookV2Tab.ts
src/Explorer/Tabs/ScriptTabBase.ts
src/Explorer/Tabs/TabComponents.ts
@@ -112,12 +113,8 @@ src/ReactDevTools.ts
src/Shared/Constants.ts
src/Shared/DefaultExperienceUtility.test.ts
src/Shared/DefaultExperienceUtility.ts
src/Shared/appInsights.ts
src/SparkClusterManager/ArcadiaResourceManager.ts
src/SparkClusterManager/SparkClusterManager.ts
src/Terminal/JupyterLabAppFactory.ts
src/Terminal/NotebookAppContracts.d.ts
src/applyExplorerBindings.ts
src/global.d.ts
src/setupTests.ts
src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx
@@ -127,8 +124,6 @@ src/Explorer/Controls/NotebookViewer/NotebookViewerComponent.tsx
src/Explorer/Controls/TreeComponent/TreeComponent.tsx
src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
src/Explorer/Notebook/NotebookComponent/VirtualCommandBarComponent.tsx
@@ -137,7 +132,6 @@ src/Explorer/Notebook/NotebookRenderer/NotebookRenderer.tsx
src/Explorer/Notebook/NotebookRenderer/decorators/draggable/index.tsx
src/Explorer/Notebook/NotebookRenderer/decorators/hijack-scroll/index.tsx
src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/index.tsx
src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx
src/Explorer/Tree/ResourceTreeAdapter.tsx
__mocks__/monaco-editor.ts
src/Explorer/Tree/ResourceTree.tsx

View File

@@ -1,4 +1,4 @@
/**
* Data Explorer version {major.minor.patch}
*/
export const DataExplorer: string = "1.0.1";
export const DataExplorer = "1.0.1";

View File

@@ -1,7 +1,6 @@
import React from "react";
import { shallow } from "enzyme";
import React from "react";
import { GraphHighlightedNodeData } from "./GraphExplorer";
import {
ReadOnlyNodePropertiesComponent,
ReadOnlyNodePropertiesComponentProps,
@@ -44,7 +43,7 @@ describe("<ReadOnlyNodePropertiesComponent />", () => {
const mockNode2 = {
...mockNode,
properties: {
key3: ["abcd", 1234, true, false, undefined, null],
key3: ["abcd", 1234, true, false, undefined],
},
};
const props: ReadOnlyNodePropertiesComponentProps = { node: mockNode2 };

View File

@@ -60,9 +60,7 @@ export class ReadOnlyNodePropertiesComponent extends React.Component<ReadOnlyNod
}
public static singlePropertyValueToString(value: ViewModels.GremlinPropertyValueType): string {
if (value === null) {
return "null";
} else if (typeof value === "undefined") {
if (typeof value === "undefined") {
return "undefined";
} else {
return value.toString();
@@ -71,11 +69,8 @@ export class ReadOnlyNodePropertiesComponent extends React.Component<ReadOnlyNod
public static renderSinglePropertyValue(value: ViewModels.GremlinPropertyValueType): JSX.Element {
let singlePropValue = value;
let className = "propertyValue";
if (singlePropValue === null) {
singlePropValue = "null";
className += " isNull";
} else if (typeof singlePropValue === "undefined") {
const className = "propertyValue";
if (typeof singlePropValue === "undefined") {
singlePropValue = "undefined";
} else {
singlePropValue = value.toString();

View File

@@ -123,7 +123,7 @@ exports[`<ReadOnlyNodePropertiesComponent /> renders properties (with multiple v
</td>
<td
className="valueCol"
title="abcd, 1234, true, false, undefined, null"
title="abcd, 1234, true, false, undefined"
>
<div
className="propertyValue"
@@ -155,12 +155,6 @@ exports[`<ReadOnlyNodePropertiesComponent /> renders properties (with multiple v
>
undefined
</div>
<div
className="propertyValue isNull"
key="null"
>
null
</div>
</td>
</tr>
</tbody>

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as ViewModels from "../../Contracts/ViewModels";
import * as Constants from "./Constants";
import * as Entities from "./Entities";
@@ -17,12 +16,12 @@ enum DataTypes {
Int64 = 18,
}
const tablesIndexers = {
var tablesIndexers = {
Value: "$v",
Type: "$t",
};
export const keyProperties = {
export var keyProperties = {
PartitionKey: "$pk",
Id: "id",
Id2: "$id", // This should always be the same value as Id
@@ -34,17 +33,14 @@ export const keyProperties = {
};
export function convertDocumentsToEntities(documents: any[]): Entities.ITableEntityForTablesAPI[] {
const results: Entities.ITableEntityForTablesAPI[] = [];
let results: Entities.ITableEntityForTablesAPI[] = [];
documents &&
documents.forEach((document) => {
if (
!Object.prototype.hasOwnProperty.call(document, keyProperties.PartitionKey) ||
Object.prototype.hasOwnProperty.call(document, keyProperties.Id)
) {
if (!document.hasOwnProperty(keyProperties.PartitionKey) || !document.hasOwnProperty(keyProperties.Id)) {
//Document does not match the current required format for Tables, so we ignore it
return; // The rest of the key properties should be guaranteed as DocumentDB properties
}
const entity: Entities.ITableEntityForTablesAPI = <Entities.ITableEntityForTablesAPI>{
let entity: Entities.ITableEntityForTablesAPI = <Entities.ITableEntityForTablesAPI>{
PartitionKey: {
_: document[keyProperties.PartitionKey],
$: Constants.TableType.String,
@@ -75,8 +71,8 @@ export function convertDocumentsToEntities(documents: any[]): Entities.ITableEnt
$: Constants.TableType.String,
},
};
for (const property in document) {
if (Object.prototype.hasOwnProperty.call(document, property)) {
for (var property in document) {
if (document.hasOwnProperty(property)) {
if (
property !== keyProperties.PartitionKey &&
property !== keyProperties.Id &&
@@ -87,10 +83,7 @@ export function convertDocumentsToEntities(documents: any[]): Entities.ITableEnt
property !== keyProperties.attachments &&
property !== keyProperties.Id2
) {
if (
!Object.prototype.hasOwnProperty.call(document[property], "$v") ||
!Object.prototype.hasOwnProperty.call(document[property], "$t")
) {
if (!document[property].hasOwnProperty("$v") || !document[property].hasOwnProperty("$t")) {
return; //Document property does not match the current required format for Tables, so we ignore it
}
if (DataTypes[document[property][tablesIndexers.Type]] === DataTypes[DataTypes.DateTime]) {
@@ -118,10 +111,10 @@ export function convertEntitiesToDocuments(
entities: Entities.ITableEntityForTablesAPI[],
collection: ViewModels.Collection
): any[] {
const results: any[] = [];
let results: any[] = [];
entities &&
entities.forEach((entity) => {
const document: any = {
let document: any = {
$id: entity.RowKey._,
id: entity.RowKey._,
ts: DateTimeUtilities.convertJSDateToUnix(entity.Timestamp._), // Convert back to unix time
@@ -136,7 +129,7 @@ export function convertEntitiesToDocuments(
document[collection.partitionKeyProperty] = entity.PartitionKey._;
document["partitionKeyValue"] = entity.PartitionKey._;
}
for (const property in entity) {
for (var property in entity) {
if (
property !== Constants.EntityKeyNames.PartitionKey &&
property !== Constants.EntityKeyNames.RowKey &&
@@ -167,7 +160,7 @@ export function convertEntitiesToDocuments(
}
export function convertEntityToNewDocument(entity: Entities.ITableEntityForTablesAPI): any {
const document: any = {
let document: any = {
$pk: entity.PartitionKey._,
$id: entity.RowKey._,
id: entity.RowKey._,

View File

@@ -92,7 +92,7 @@ export default class DocumentsTab extends TabsBase {
this.partitionKeyPropertyHeader =
(this.collection && this.collection.partitionKeyPropertyHeader) || this._getPartitionKeyPropertyHeader();
this.partitionKeyProperty = this.partitionKeyPropertyHeader
this.partitionKeyProperty = !!this.partitionKeyPropertyHeader
? this.partitionKeyPropertyHeader.replace(/[/]+/g, ".").substr(1).replace(/[']+/g, "")
: null;
@@ -446,8 +446,8 @@ export default class DocumentsTab extends TabsBase {
this.partitionKey as PartitionKeyDefinition
);
const partitionKeyValue = partitionKeyValueArray && partitionKeyValueArray[0];
const id = new DocumentId(this, savedDocument, partitionKeyValue);
const ids = this.documentIds();
let id = new DocumentId(this, savedDocument, partitionKeyValue);
let ids = this.documentIds();
ids.push(id);
this.selectedDocumentId(id);
@@ -682,10 +682,10 @@ export default class DocumentsTab extends TabsBase {
}
public createIterator(): QueryIterator<ItemDefinition & Resource> {
const filters = this.lastFilterContents();
let filters = this.lastFilterContents();
const filter: string = this.filterContent().trim();
const query: string = this.buildQuery(filter);
const options: any = {};
let options: any = {};
options.enableCrossPartitionQuery = HeadersUtility.shouldEnableCrossPartitionKey();
if (this._resourceTokenPartitionKey) {
@@ -778,7 +778,7 @@ export default class DocumentsTab extends TabsBase {
protected _onEditorContentChange(newContent: string) {
try {
const parsed: any = JSON.parse(newContent);
let parsed: any = JSON.parse(newContent);
this.onValidDocumentEdit();
} catch (e) {
this.onInvalidDocumentEdit();

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { extractPartitionKey, PartitionKeyDefinition } from "@azure/cosmos";
import * as ko from "knockout";
import Q from "q";
@@ -46,7 +44,7 @@ export default class MongoDocumentsTab extends DocumentsTab {
super.buildCommandBarOptions();
}
public onSaveNewDocumentClick = (): Promise<void> => {
public onSaveNewDocumentClick = (): Promise<any> => {
const documentContent = JSON.parse(this.selectedDocumentContent());
this.displayedError("");
const startKey: number = TelemetryProcessor.traceStart(Action.CreateDocument, {
@@ -61,8 +59,9 @@ export default class MongoDocumentsTab extends DocumentsTab {
) {
const message = `The document is lacking the shard property: ${this.partitionKeyProperty}`;
this.displayedError(message);
let that = this;
setTimeout(() => {
this.displayedError("");
that.displayedError("");
}, Constants.ClientDefaults.errorNotificationTimeoutMs);
this.isExecutionError(true);
TelemetryProcessor.traceFailure(
@@ -83,19 +82,19 @@ export default class MongoDocumentsTab extends DocumentsTab {
return createDocument(this.collection.databaseId, this.collection, this.partitionKeyProperty, documentContent)
.then(
(savedDocument: any) => {
const partitionKeyArray = extractPartitionKey(
let partitionKeyArray = extractPartitionKey(
savedDocument,
this._getPartitionKeyDefinition() as PartitionKeyDefinition
);
const partitionKeyValue = partitionKeyArray && partitionKeyArray[0];
let partitionKeyValue = partitionKeyArray && partitionKeyArray[0];
const id = new ObjectId(this, savedDocument, partitionKeyValue);
const ids = this.documentIds();
let id = new ObjectId(this, savedDocument, partitionKeyValue);
let ids = this.documentIds();
ids.push(id);
delete savedDocument._self;
const value: string = this.renderObjectForEditor(savedDocument || {}, null, 4);
let value: string = this.renderObjectForEditor(savedDocument || {}, null, 4);
this.selectedDocumentContent.setBaseline(value);
this.selectedDocumentId(id);
@@ -129,7 +128,7 @@ export default class MongoDocumentsTab extends DocumentsTab {
.finally(() => this.isExecuting(false));
};
public onSaveExisitingDocumentClick = (): Promise<void> => {
public onSaveExisitingDocumentClick = (): Promise<any> => {
const selectedDocumentId = this.selectedDocumentId();
const documentContent = this.selectedDocumentContent();
this.isExecutionError(false);
@@ -142,7 +141,7 @@ export default class MongoDocumentsTab extends DocumentsTab {
return updateDocument(this.collection.databaseId, this.collection, selectedDocumentId, documentContent)
.then(
(updatedDocument: any) => {
const value: string = this.renderObjectForEditor(updatedDocument || {}, null, 4);
let value: string = this.renderObjectForEditor(updatedDocument || {}, null, 4);
this.selectedDocumentContent.setBaseline(value);
this.documentIds().forEach((documentId: DocumentId) => {
@@ -152,7 +151,7 @@ export default class MongoDocumentsTab extends DocumentsTab {
this._getPartitionKeyDefinition() as PartitionKeyDefinition
);
const partitionKeyValue = partitionKeyArray && partitionKeyArray[0];
let partitionKeyValue = partitionKeyArray && partitionKeyArray[0];
const id = new ObjectId(this, updatedDocument, partitionKeyValue);
documentId.id(id.id());
@@ -197,7 +196,7 @@ export default class MongoDocumentsTab extends DocumentsTab {
this.initDocumentEditor(documentId, content);
}
public loadNextPage(): Q.Promise<void> {
public loadNextPage(): Q.Promise<any> {
this.isExecuting(true);
this.isExecutionError(false);
const filter: string = this.filterContent().trim();
@@ -229,7 +228,7 @@ export default class MongoDocumentsTab extends DocumentsTab {
this.selectedDocumentId(null);
this.editorState(ViewModels.DocumentExplorerState.noDocumentSelected);
}
if (this.onLoadStartKey !== null && this.onLoadStartKey !== undefined) {
if (this.onLoadStartKey != null && this.onLoadStartKey != undefined) {
TelemetryProcessor.traceSuccess(
Action.Tab,
{
@@ -244,8 +243,8 @@ export default class MongoDocumentsTab extends DocumentsTab {
this.onLoadStartKey = null;
}
},
(error: Error) => {
if (this.onLoadStartKey !== null && this.onLoadStartKey !== undefined) {
(error: any) => {
if (this.onLoadStartKey != null && this.onLoadStartKey != undefined) {
TelemetryProcessor.traceFailure(
Action.Tab,
{
@@ -266,13 +265,13 @@ export default class MongoDocumentsTab extends DocumentsTab {
.finally(() => this.isExecuting(false));
}
protected _onEditorContentChange(newContent: string): void {
protected _onEditorContentChange(newContent: string) {
try {
if (
this.editorState() === ViewModels.DocumentExplorerState.newDocumentValid ||
this.editorState() === ViewModels.DocumentExplorerState.newDocumentInvalid
) {
const parsed: any = JSON.parse(newContent);
let parsed: any = JSON.parse(newContent);
}
// Mongo uses BSON format for _id, trying to parse it as JSON blocks normal flow in an edit

View File

@@ -3,7 +3,7 @@ import { BindingHandlersRegisterer } from "./Bindings/BindingHandlersRegisterer"
import Explorer from "./Explorer/Explorer";
export const applyExplorerBindings = (explorer: Explorer) => {
if (!!explorer) {
if (explorer) {
window.dataExplorer = explorer;
BindingHandlersRegisterer.registerBindingHandlers();
ko.applyBindings(explorer);