From 1d2995ef32a7bcb57ceabc5dc7c7aa75d7a9a657 Mon Sep 17 00:00:00 2001 From: Jordi Bunster Date: Mon, 8 Mar 2021 10:29:41 -0800 Subject: [PATCH 01/13] Fix eslint warnings (#456) --- test/utils/shared.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/utils/shared.ts b/test/utils/shared.ts index 7393bee59..f749f71cf 100644 --- a/test/utils/shared.ts +++ b/test/utils/shared.ts @@ -30,7 +30,7 @@ export function generateDatabaseName(baseName = "db", length = 1): string { return `${baseName}${crypto.randomBytes(length).toString("hex")}-${Date.now()}`; } -export async function createDatabase(frame: Frame) { +export async function createDatabase(frame: Frame): Promise { const dbId = generateDatabaseName(); const collectionId = generateUniqueName("col"); const shardKey = "partitionKey"; @@ -70,7 +70,7 @@ export async function createDatabase(frame: Frame) { return dbId; } -export async function onClickSaveButton(frame: Frame) { +export async function onClickSaveButton(frame: Frame): Promise { await frame.waitFor(`button[data-test="Save"]`), { visible: true }; await frame.waitFor(LOADING_STATE_DELAY); await frame.click(`button[data-test="Save"]`); From 4e702716bdec45d327d51b06ab9a2dc144bd7179 Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Mon, 8 Mar 2021 14:41:12 -0600 Subject: [PATCH 02/13] More Flaky Test Improvements (#498) --- test/mongo/mongoIndexPolicy.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/mongo/mongoIndexPolicy.spec.ts b/test/mongo/mongoIndexPolicy.spec.ts index 0eef4f2e8..340973327 100644 --- a/test/mongo/mongoIndexPolicy.spec.ts +++ b/test/mongo/mongoIndexPolicy.spec.ts @@ -4,7 +4,7 @@ import { createDatabase, onClickSaveButton } from "../utils/shared"; import { generateUniqueName } from "../utils/shared"; import { ApiKind } from "../../src/Contracts/DataModels"; -const LOADING_STATE_DELAY = 3000; +const LOADING_STATE_DELAY = 5000; jest.setTimeout(300000); describe("MongoDB Index policy tests", () => { @@ -74,6 +74,7 @@ describe("MongoDB Index policy tests", () => { let singleFieldIndexInserted = false, wildCardIndexInserted = false; await frame.waitFor("div[data-automationid='DetailsRowCell'] > span"), { visible: true }; + await frame.waitFor(20000); const elements = await frame.$$("div[data-automationid='DetailsRowCell'] > span"); for (let i = 0; i < elements.length; i++) { From c844986c342e232f81dcd8dacf3ce5c32f72c7ed Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Mon, 8 Mar 2021 16:35:20 -0600 Subject: [PATCH 03/13] Move resourceToken test to portal runner sub (#499) Co-authored-by: Steve Faulkner --- test/sql/resourceToken.spec.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/sql/resourceToken.spec.ts b/test/sql/resourceToken.spec.ts index e8d119c75..0ccf0c5ab 100644 --- a/test/sql/resourceToken.spec.ts +++ b/test/sql/resourceToken.spec.ts @@ -3,6 +3,14 @@ import "expect-puppeteer"; import { Frame } from "puppeteer"; import { generateDatabaseName, generateUniqueName } from "../utils/shared"; import { CosmosClient, PermissionMode } from "@azure/cosmos"; +import { CosmosDBManagementClient } from "@azure/arm-cosmosdb"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; + +const clientId = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_ID"]; +const secret = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET"]; +const tenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"; +const subscriptionId = "69e02f2d-f059-4409-9eac-97e8a276ae2c"; +const resourceGroupName = "runners"; jest.setTimeout(300000); const RETRY_DELAY = 5000; @@ -10,11 +18,16 @@ const CREATE_DELAY = 10000; describe("Collection Add and Delete SQL spec", () => { it("creates a collection", async () => { + const credentials = await msRestNodeAuth.loginWithServicePrincipalSecret(clientId, secret, tenantId); + const armClient = new CosmosDBManagementClient(credentials, subscriptionId); + const account = await armClient.databaseAccounts.get(resourceGroupName, "portal-sql-runner"); + const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, "portal-sql-runner"); const dbId = generateDatabaseName(); const collectionId = generateUniqueName("col"); - const connectionString = process.env.PORTAL_RUNNER_CONNECTION_STRING; - const client = new CosmosClient(connectionString); - const endpoint = /AccountEndpoint=(.*);/.exec(connectionString)[1]; + const client = new CosmosClient({ + endpoint: account.documentEndpoint, + key: keys.primaryMasterKey, + }); const { database } = await client.databases.createIfNotExists({ id: dbId }); const { container } = await database.containers.createIfNotExists({ id: collectionId }); const { user } = await database.users.upsert({ id: "testUser" }); @@ -23,7 +36,7 @@ describe("Collection Add and Delete SQL spec", () => { permissionMode: PermissionMode.All, resource: container.url, }); - const resourceTokenConnectionString = `AccountEndpoint=${endpoint};DatabaseId=${database.id};CollectionId=${container.id};${containerPermission._token}`; + const resourceTokenConnectionString = `AccountEndpoint=${account.documentEndpoint};DatabaseId=${database.id};CollectionId=${container.id};${containerPermission._token}`; try { await page.goto(process.env.DATA_EXPLORER_ENDPOINT); await page.waitFor("div > p.switchConnectTypeText", { visible: true }); From 4eb0dedddb3b650b09ddf4cd536921aaedeb0994 Mon Sep 17 00:00:00 2001 From: hardiknai-techm <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 9 Mar 2021 04:38:24 +0530 Subject: [PATCH 04/13] Resolve Lint errors in quickstart.ts (#492) --- .eslintignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 391441f12..7a601f97d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -287,7 +287,6 @@ src/Utils/StringUtils.test.ts src/Utils/StringUtils.ts src/applyExplorerBindings.ts src/global.d.ts -src/quickstart.ts src/setupTests.ts src/workers/upload/index.ts src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx From 9d30dd5d0a0ffeb0d8297d2d47370f83174a17e7 Mon Sep 17 00:00:00 2001 From: hardiknai-techm <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 9 Mar 2021 04:39:46 +0530 Subject: [PATCH 05/13] Resolve Lint errors in AutoPilotUtils.ts (#488) --- .eslintignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.eslintignore b/.eslintignore index 7a601f97d..0f0b908f1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -273,8 +273,6 @@ src/TokenProviders/PortalTokenProvider.ts src/TokenProviders/TokenProviderFactory.ts src/Utils/AuthorizationUtils.test.ts src/Utils/AuthorizationUtils.ts -src/Utils/AutoPilotUtils.test.ts -src/Utils/AutoPilotUtils.ts src/Utils/DatabaseAccountUtils.test.ts src/Utils/DatabaseAccountUtils.ts src/Utils/JunoUtils.ts From 1af44fb207a3cc0a2bfda215ae793b40e90d398f Mon Sep 17 00:00:00 2001 From: hardiknai-techm <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 9 Mar 2021 04:40:24 +0530 Subject: [PATCH 06/13] Fix Lint errors in JunoUtil (#484) --- .eslintignore | 1 - src/Explorer/Panes/GitHubReposPane.ts | 2 +- src/Utils/JunoUtils.test.ts | 2 +- src/Utils/JunoUtils.ts | 32 +++++++++++++-------------- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.eslintignore b/.eslintignore index 0f0b908f1..d29ce45fd 100644 --- a/.eslintignore +++ b/.eslintignore @@ -275,7 +275,6 @@ src/Utils/AuthorizationUtils.test.ts src/Utils/AuthorizationUtils.ts src/Utils/DatabaseAccountUtils.test.ts src/Utils/DatabaseAccountUtils.ts -src/Utils/JunoUtils.ts src/Utils/MessageValidation.ts src/Utils/NotebookConfigurationUtils.ts src/Utils/PricingUtils.test.ts diff --git a/src/Explorer/Panes/GitHubReposPane.ts b/src/Explorer/Panes/GitHubReposPane.ts index 2ba2517bf..b360b1865 100644 --- a/src/Explorer/Panes/GitHubReposPane.ts +++ b/src/Explorer/Panes/GitHubReposPane.ts @@ -6,7 +6,7 @@ import { IPinnedRepo, JunoClient } from "../../Juno/JunoClient"; import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import * as GitHubUtils from "../../Utils/GitHubUtils"; -import { JunoUtils } from "../../Utils/JunoUtils"; +import * as JunoUtils from "../../Utils/JunoUtils"; import { AuthorizeAccessComponent } from "../Controls/GitHub/AuthorizeAccessComponent"; import { GitHubReposComponent, GitHubReposComponentProps, RepoListItem } from "../Controls/GitHub/GitHubReposComponent"; import { GitHubReposComponentAdapter } from "../Controls/GitHub/GitHubReposComponentAdapter"; diff --git a/src/Utils/JunoUtils.test.ts b/src/Utils/JunoUtils.test.ts index 1bdb60e89..b08e0b168 100644 --- a/src/Utils/JunoUtils.test.ts +++ b/src/Utils/JunoUtils.test.ts @@ -1,6 +1,6 @@ import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent"; import { IPinnedRepo } from "../Juno/JunoClient"; -import { JunoUtils } from "./JunoUtils"; +import * as JunoUtils from "./JunoUtils"; import { IGitHubRepo } from "../GitHub/GitHubClient"; const gitHubRepo: IGitHubRepo = { diff --git a/src/Utils/JunoUtils.ts b/src/Utils/JunoUtils.ts index ecfcaf65d..cd6006a0f 100644 --- a/src/Utils/JunoUtils.ts +++ b/src/Utils/JunoUtils.ts @@ -2,21 +2,19 @@ import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent"; import { IGitHubRepo } from "../GitHub/GitHubClient"; import { IPinnedRepo } from "../Juno/JunoClient"; -export class JunoUtils { - public static toPinnedRepo(item: RepoListItem): IPinnedRepo { - return { - owner: item.repo.owner, - name: item.repo.name, - private: item.repo.private, - branches: item.branches.map((element) => ({ name: element.name })), - }; - } - - public static toGitHubRepo(pinnedRepo: IPinnedRepo): IGitHubRepo { - return { - owner: pinnedRepo.owner, - name: pinnedRepo.name, - private: pinnedRepo.private, - }; - } +export function toPinnedRepo(item: RepoListItem): IPinnedRepo { + return { + owner: item.repo.owner, + name: item.repo.name, + private: item.repo.private, + branches: item.branches.map((element) => ({ name: element.name })), + }; +} + +export function toGitHubRepo(pinnedRepo: IPinnedRepo): IGitHubRepo { + return { + owner: pinnedRepo.owner, + name: pinnedRepo.name, + private: pinnedRepo.private, + }; } From 9617b80b563ff451a742cefd4e3e2280595ac280 Mon Sep 17 00:00:00 2001 From: hardiknai-techm <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 9 Mar 2021 04:49:22 +0530 Subject: [PATCH 07/13] Fix Lint errors in ThemeUtility (#477) * Fix Lint errors in ThemeUtility * format ThemeUtility.ts file Co-authored-by: hardiknai Co-authored-by: zen3-hardik --- .eslintignore | 1 - src/Common/ThemeUtility.ts | 24 +++++++++++------------- src/Explorer/Tabs/TabsBase.ts | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.eslintignore b/.eslintignore index d29ce45fd..25ddee280 100644 --- a/.eslintignore +++ b/.eslintignore @@ -28,7 +28,6 @@ src/Common/ObjectCache.test.ts src/Common/ObjectCache.ts src/Common/QueriesClient.ts src/Common/Splitter.ts -src/Common/ThemeUtility.ts src/Common/UrlUtility.ts src/Config.ts src/Contracts/ActionContracts.ts diff --git a/src/Common/ThemeUtility.ts b/src/Common/ThemeUtility.ts index 1c9fc7671..ae0e6872c 100644 --- a/src/Common/ThemeUtility.ts +++ b/src/Common/ThemeUtility.ts @@ -2,18 +2,16 @@ * Copyright (C) Microsoft Corporation. All rights reserved. *----------------------------------------------------------*/ -export default class ThemeUtility { - public static getMonacoTheme(theme: string): string { - switch (theme) { - case "default": - case "hc-white": - return "vs"; - case "dark": - return "vs-dark"; - case "hc-black": - return "hc-black"; - default: - return "vs"; - } +export function getMonacoTheme(theme: string): string { + switch (theme) { + case "default": + case "hc-white": + return "vs"; + case "dark": + return "vs-dark"; + case "hc-black": + return "hc-black"; + default: + return "vs"; } } diff --git a/src/Explorer/Tabs/TabsBase.ts b/src/Explorer/Tabs/TabsBase.ts index 2ea43e7f6..fe2fa8edf 100644 --- a/src/Explorer/Tabs/TabsBase.ts +++ b/src/Explorer/Tabs/TabsBase.ts @@ -7,7 +7,7 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan import { RouteHandler } from "../../RouteHandlers/RouteHandler"; import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; -import ThemeUtility from "../../Common/ThemeUtility"; +import * as ThemeUtility from "../../Common/ThemeUtility"; import Explorer from "../Explorer"; import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent"; From d85b6285ac5ec9aa58eb726e658216da3fdbe42c Mon Sep 17 00:00:00 2001 From: Sunil Kumar Yadav <79906609+sunilyadav840@users.noreply.github.com> Date: Tue, 9 Mar 2021 04:50:11 +0530 Subject: [PATCH 08/13] fixed lint issue of StringUtils file (#480) * fixed lint issue of StringUtils file * Fixed null lint issue --- .eslintignore | 2 -- .../CommandButton/CommandButtonComponent.tsx | 2 +- .../Notebook/NotebookTerminalComponent.tsx | 2 +- .../contents/file/text-file.tsx | 2 +- .../Notebook/NotebookContentClient.ts | 2 +- src/Explorer/Notebook/NotebookUtil.ts | 2 +- src/Utils/StringUtils.test.ts | 8 ++--- src/Utils/StringUtils.ts | 36 +++++++++---------- 8 files changed, 26 insertions(+), 30 deletions(-) diff --git a/.eslintignore b/.eslintignore index 25ddee280..1e9d595b2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -279,8 +279,6 @@ src/Utils/NotebookConfigurationUtils.ts src/Utils/PricingUtils.test.ts src/Utils/QueryUtils.test.ts src/Utils/QueryUtils.ts -src/Utils/StringUtils.test.ts -src/Utils/StringUtils.ts src/applyExplorerBindings.ts src/global.d.ts src/setupTests.ts diff --git a/src/Explorer/Controls/CommandButton/CommandButtonComponent.tsx b/src/Explorer/Controls/CommandButton/CommandButtonComponent.tsx index 93c53c56d..a514ffffd 100644 --- a/src/Explorer/Controls/CommandButton/CommandButtonComponent.tsx +++ b/src/Explorer/Controls/CommandButton/CommandButtonComponent.tsx @@ -1,4 +1,4 @@ -import { StringUtils } from "../../../Utils/StringUtils"; +import * as StringUtils from "../../../Utils/StringUtils"; import { KeyCodes } from "../../../Common/Constants"; import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants"; diff --git a/src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx b/src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx index 35d3fe375..a7b51e896 100644 --- a/src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx +++ b/src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx @@ -4,7 +4,7 @@ import * as React from "react"; import * as DataModels from "../../../Contracts/DataModels"; -import { StringUtils } from "../../../Utils/StringUtils"; +import * as StringUtils from "../../../Utils/StringUtils"; import { userContext } from "../../../UserContext"; import { TerminalQueryParams } from "../../../Common/Constants"; import { handleError } from "../../../Common/ErrorHandlingUtils"; diff --git a/src/Explorer/Notebook/NotebookComponent/contents/file/text-file.tsx b/src/Explorer/Notebook/NotebookComponent/contents/file/text-file.tsx index 4ad2c63af..fdefe2342 100644 --- a/src/Explorer/Notebook/NotebookComponent/contents/file/text-file.tsx +++ b/src/Explorer/Notebook/NotebookComponent/contents/file/text-file.tsx @@ -1,4 +1,4 @@ -import { StringUtils } from "../../../../../Utils/StringUtils"; +import * as StringUtils from "../../../../../Utils/StringUtils"; import { actions, AppState, ContentRef, selectors } from "@nteract/core"; import { IMonacoProps as MonacoEditorProps } from "@nteract/monaco-editor"; import * as React from "react"; diff --git a/src/Explorer/Notebook/NotebookContentClient.ts b/src/Explorer/Notebook/NotebookContentClient.ts index dfb5ab8c5..44ab852ee 100644 --- a/src/Explorer/Notebook/NotebookContentClient.ts +++ b/src/Explorer/Notebook/NotebookContentClient.ts @@ -1,6 +1,6 @@ import * as DataModels from "../../Contracts/DataModels"; import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem"; -import { StringUtils } from "../../Utils/StringUtils"; +import * as StringUtils from "../../Utils/StringUtils"; import { FileSystemUtil } from "./FileSystemUtil"; import { NotebookUtil } from "./NotebookUtil"; diff --git a/src/Explorer/Notebook/NotebookUtil.ts b/src/Explorer/Notebook/NotebookUtil.ts index 519cbcd4d..5070e2823 100644 --- a/src/Explorer/Notebook/NotebookUtil.ts +++ b/src/Explorer/Notebook/NotebookUtil.ts @@ -1,7 +1,7 @@ import path from "path"; import { ImmutableNotebook, ImmutableCodeCell } from "@nteract/commutable"; import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem"; -import { StringUtils } from "../../Utils/StringUtils"; +import * as StringUtils from "../../Utils/StringUtils"; import * as GitHubUtils from "../../Utils/GitHubUtils"; // Must match rx-jupyter' FileType diff --git a/src/Utils/StringUtils.test.ts b/src/Utils/StringUtils.test.ts index b1ae4419b..f725e9428 100644 --- a/src/Utils/StringUtils.test.ts +++ b/src/Utils/StringUtils.test.ts @@ -1,4 +1,4 @@ -import { StringUtils } from "./StringUtils"; +import * as StringUtils from "./StringUtils"; describe("StringUtils", () => { describe("stripSpacesFromString()", () => { @@ -12,9 +12,9 @@ describe("StringUtils", () => { expect(transformedString).toBe("abc"); }); - it("should return null if input is null", () => { - const transformedString: string = StringUtils.stripSpacesFromString(null); - expect(transformedString).toBeNull(); + it("should return undefined if input is undefined", () => { + const transformedString: string = StringUtils.stripSpacesFromString(undefined); + expect(transformedString).toBeUndefined(); }); it("should return undefined if input is undefiend", () => { diff --git a/src/Utils/StringUtils.ts b/src/Utils/StringUtils.ts index 303b99931..2618544c3 100644 --- a/src/Utils/StringUtils.ts +++ b/src/Utils/StringUtils.ts @@ -1,21 +1,19 @@ -export class StringUtils { - public static stripSpacesFromString(inputString: string): string { - if (inputString == null || typeof inputString !== "string") { - return inputString; - } - return inputString.replace(/ /g, ""); - } - - /** - * Implementation of endsWith which works for IE - * @param stringToTest - * @param suffix - */ - public static endsWith(stringToTest: string, suffix: string): boolean { - return stringToTest.indexOf(suffix, stringToTest.length - suffix.length) !== -1; - } - - public static startsWith(stringToTest: string, prefix: string): boolean { - return stringToTest.indexOf(prefix) === 0; +export function stripSpacesFromString(inputString: string): string { + if (inputString === undefined || typeof inputString !== "string") { + return inputString; } + return inputString.replace(/ /g, ""); +} + +/** + * Implementation of endsWith which works for IE + * @param stringToTest + * @param suffix + */ +export function endsWith(stringToTest: string, suffix: string): boolean { + return stringToTest.indexOf(suffix, stringToTest.length - suffix.length) !== -1; +} + +export function startsWith(stringToTest: string, prefix: string): boolean { + return stringToTest.indexOf(prefix) === 0; } From 4807169b0ca3d7f068962d7ad143907bbcb313c4 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Yadav <79906609+sunilyadav840@users.noreply.github.com> Date: Tue, 9 Mar 2021 04:50:45 +0530 Subject: [PATCH 09/13] Eslint/fix lint date time utility (#471) * fixed lint issue of DateTimeUtility * remove commented code * Do change request. --- .eslintignore | 2 -- .../Tables/QueryBuilder/DateTimeUtilities.ts | 32 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1e9d595b2..2d350472c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -176,8 +176,6 @@ src/Explorer/Tables/Entities.ts src/Explorer/Tables/QueryBuilder/ClauseGroup.ts src/Explorer/Tables/QueryBuilder/ClauseGroupViewModel.ts src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts -src/Explorer/Tables/QueryBuilder/DateTimeUtilities.test.ts -src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts src/Explorer/Tables/QueryBuilder/QueryViewModel.ts diff --git a/src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts b/src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts index 810757f60..86bcc6a1e 100644 --- a/src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts +++ b/src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts @@ -2,26 +2,26 @@ const epochTicks = 621355968000000000; const ticksPerMillisecond = 10000; export function getLocalDateTime(dateTime: string): string { - var dateTimeObject: Date = new Date(dateTime); - var year: number = dateTimeObject.getFullYear(); - var month: string = ensureDoubleDigits(dateTimeObject.getMonth() + 1); // Month ranges from 0 to 11 - var day: string = ensureDoubleDigits(dateTimeObject.getDate()); - var hours: string = ensureDoubleDigits(dateTimeObject.getHours()); - var minutes: string = ensureDoubleDigits(dateTimeObject.getMinutes()); - var seconds: string = ensureDoubleDigits(dateTimeObject.getSeconds()); - var milliseconds: string = ensureTripleDigits(dateTimeObject.getMilliseconds()); + const dateTimeObject: Date = new Date(dateTime); + const year: number = dateTimeObject.getFullYear(); + const month: string = ensureDoubleDigits(dateTimeObject.getMonth() + 1); // Month ranges from 0 to 11 + const day: string = ensureDoubleDigits(dateTimeObject.getDate()); + const hours: string = ensureDoubleDigits(dateTimeObject.getHours()); + const minutes: string = ensureDoubleDigits(dateTimeObject.getMinutes()); + const seconds: string = ensureDoubleDigits(dateTimeObject.getSeconds()); + const milliseconds: string = ensureTripleDigits(dateTimeObject.getMilliseconds()); - var localDateTime: string = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}`; + const localDateTime = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}`; return localDateTime; } export function getUTCDateTime(dateTime: string): string { - var dateTimeObject: Date = new Date(dateTime); + const dateTimeObject = new Date(dateTime); return dateTimeObject.toISOString(); } export function ensureDoubleDigits(num: number): string { - var doubleDigitsString: string = num.toString(); + let doubleDigitsString: string = num.toString(); if (num < 10) { doubleDigitsString = `0${doubleDigitsString}`; } else if (num > 99) { @@ -31,7 +31,7 @@ export function ensureDoubleDigits(num: number): string { } export function ensureTripleDigits(num: number): string { - var tripleDigitsString: string = num.toString(); + let tripleDigitsString: string = num.toString(); if (num < 10) { tripleDigitsString = `00${tripleDigitsString}`; } else if (num < 100) { @@ -51,17 +51,17 @@ export function convertJSDateToUnix(dateTime: string): number { } export function convertTicksToJSDate(ticks: string): Date { - var ticksJSBased = Number(ticks) - epochTicks; - var timeInMillisecond = ticksJSBased / ticksPerMillisecond; + const ticksJSBased = Number(ticks) - epochTicks; + const timeInMillisecond = ticksJSBased / ticksPerMillisecond; return new Date(timeInMillisecond); } export function convertJSDateToTicksWithPadding(dateTime: string): string { - var ticks = epochTicks + new Date(dateTime).getTime() * ticksPerMillisecond; + const ticks = epochTicks + new Date(dateTime).getTime() * ticksPerMillisecond; return padDateTicksWithZeros(ticks.toString()); } function padDateTicksWithZeros(value: string): string { - var s = "0000000000000000000" + value; + const s = "0000000000000000000" + value; return s.substr(s.length - 20); } From 9c28b7f9c5dcd5c1719108ad6c2523ad9d2f0834 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Yadav <79906609+sunilyadav840@users.noreply.github.com> Date: Tue, 9 Mar 2021 06:40:26 +0530 Subject: [PATCH 10/13] Fixed lint issue of AuthorizationUtils (#496) --- .eslintignore | 2 -- src/Utils/AuthorizationUtils.test.ts | 6 ------ src/Utils/AuthorizationUtils.ts | 1 - 3 files changed, 9 deletions(-) diff --git a/.eslintignore b/.eslintignore index 2d350472c..a2cf975bc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -268,8 +268,6 @@ src/Terminal/NotebookAppContracts.d.ts src/Terminal/index.ts src/TokenProviders/PortalTokenProvider.ts src/TokenProviders/TokenProviderFactory.ts -src/Utils/AuthorizationUtils.test.ts -src/Utils/AuthorizationUtils.ts src/Utils/DatabaseAccountUtils.test.ts src/Utils/DatabaseAccountUtils.ts src/Utils/MessageValidation.ts diff --git a/src/Utils/AuthorizationUtils.test.ts b/src/Utils/AuthorizationUtils.test.ts index 8c5cbafa1..6a78a8c97 100644 --- a/src/Utils/AuthorizationUtils.test.ts +++ b/src/Utils/AuthorizationUtils.test.ts @@ -1,9 +1,7 @@ import * as Constants from "../Common/Constants"; import * as AuthorizationUtils from "./AuthorizationUtils"; import { AuthType } from "../AuthType"; -import Explorer from "../Explorer/Explorer"; import { updateUserContext } from "../UserContext"; -import { Platform, updateConfigContext } from "../ConfigContext"; jest.mock("../Explorer/Explorer"); describe("AuthorizationUtils", () => { @@ -34,10 +32,6 @@ describe("AuthorizationUtils", () => { expect(() => AuthorizationUtils.decryptJWTToken(undefined)).toThrowError(); }); - it("should throw an error if token is null", () => { - expect(() => AuthorizationUtils.decryptJWTToken(null)).toThrowError(); - }); - it("should throw an error if token is empty", () => { expect(() => AuthorizationUtils.decryptJWTToken("")).toThrowError(); }); diff --git a/src/Utils/AuthorizationUtils.ts b/src/Utils/AuthorizationUtils.ts index 051b827db..308e7f0ad 100644 --- a/src/Utils/AuthorizationUtils.ts +++ b/src/Utils/AuthorizationUtils.ts @@ -1,7 +1,6 @@ import { AuthType } from "../AuthType"; import * as Constants from "../Common/Constants"; import * as Logger from "../Common/Logger"; -import { configContext, Platform } from "../ConfigContext"; import * as ViewModels from "../Contracts/ViewModels"; import { userContext } from "../UserContext"; From 7eb2817accc6091aff50e2cbd02957756527ba17 Mon Sep 17 00:00:00 2001 From: hardiknai-techm <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:15:56 +0530 Subject: [PATCH 11/13] Resolve Lint errors in MessageValidation.ts (#489) --- .eslintignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index a2cf975bc..1d59e9a1d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -270,7 +270,6 @@ src/TokenProviders/PortalTokenProvider.ts src/TokenProviders/TokenProviderFactory.ts src/Utils/DatabaseAccountUtils.test.ts src/Utils/DatabaseAccountUtils.ts -src/Utils/MessageValidation.ts src/Utils/NotebookConfigurationUtils.ts src/Utils/PricingUtils.test.ts src/Utils/QueryUtils.test.ts From 588c1d3ec355317dce3d145ef10c217814db8583 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Yadav <79906609+sunilyadav840@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:23:08 +0530 Subject: [PATCH 12/13] fixed eslint GraphUtil and removed files from eslintignore (#482) --- .eslintignore | 6 - .../EditorNeighborsComponent.tsx | 2 +- .../GraphExplorerComponent/GraphExplorer.tsx | 2 +- .../GraphExplorerComponent/GraphUtil.test.ts | 4 +- .../Graph/GraphExplorerComponent/GraphUtil.ts | 340 +++++++++--------- .../ReadOnlyNeighborsComponent.tsx | 2 +- 6 files changed, 177 insertions(+), 179 deletions(-) diff --git a/.eslintignore b/.eslintignore index 1d59e9a1d..c4aa1be52 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,8 +11,6 @@ src/Common/CosmosClient.test.ts src/Common/CosmosClient.ts src/Common/DataAccessUtilityBase.test.ts src/Common/DataAccessUtilityBase.ts -src/Common/DeleteFeedback.ts -src/Common/DocumentClientUtilityBase.ts src/Common/EditableUtility.ts src/Common/HashMap.test.ts src/Common/HashMap.ts @@ -55,8 +53,6 @@ src/Explorer/ComponentRegisterer.test.ts src/Explorer/ComponentRegisterer.ts src/Explorer/ContextMenuButtonFactory.ts src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts -src/Explorer/Controls/CommandButton/CommandButton.test.ts -src/Explorer/Controls/CommandButton/CommandButton.ts src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts src/Explorer/Controls/DynamicList/DynamicList.test.ts src/Explorer/Controls/DynamicList/DynamicListComponent.ts @@ -92,8 +88,6 @@ src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts src/Explorer/Graph/GraphExplorerComponent/GraphData.ts -src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts -src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts diff --git a/src/Explorer/Graph/GraphExplorerComponent/EditorNeighborsComponent.tsx b/src/Explorer/Graph/GraphExplorerComponent/EditorNeighborsComponent.tsx index 58ba8def1..5b4470054 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/EditorNeighborsComponent.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/EditorNeighborsComponent.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import { NeighborVertexBasicInfo, EditedEdges, GraphNewEdgeData, PossibleVertex } from "./GraphExplorer"; -import { GraphUtil } from "./GraphUtil"; +import * as GraphUtil from "./GraphUtil"; import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent"; import DeleteIcon from "../../../../images/delete.svg"; import AddPropertyIcon from "../../../../images/Add-property.svg"; diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx index cda7370ba..ba35d2fd8 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx @@ -9,7 +9,7 @@ import { GraphVizComponentProps } from "./GraphVizComponent"; import * as GraphData from "./GraphData"; import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent"; import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils"; -import { GraphUtil } from "./GraphUtil"; +import * as GraphUtil from "./GraphUtil"; import * as DataModels from "../../../Contracts/DataModels"; import * as ViewModels from "../../../Contracts/ViewModels"; import * as GremlinClient from "./GremlinClient"; diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts b/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts index 1e06263bd..754f6217c 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts @@ -1,4 +1,4 @@ -import { GraphUtil } from "./GraphUtil"; +import * as GraphUtil from "./GraphUtil"; import { GraphData, GremlinVertex, GremlinEdge } from "./GraphData"; import * as sinon from "sinon"; import { GraphExplorer } from "./GraphExplorer"; @@ -69,7 +69,7 @@ describe("Process Gremlin vertex", () => { describe("getLimitedArrayString()", () => { const expectedEmptyResult = { result: "", consumedCount: 0 }; it("should handle null array", () => { - expect(GraphUtil.getLimitedArrayString(null, 10)).toEqual(expectedEmptyResult); + expect(GraphUtil.getLimitedArrayString(undefined, 10)).toEqual(expectedEmptyResult); }); it("should handle empty array", () => { diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts b/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts index 7467e11bc..2faf25c67 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts @@ -7,180 +7,184 @@ interface JoinArrayMaxCharOutput { consumedCount: number; // Number of items consumed } -export class GraphUtil { - public static getNeighborTitle(neighbor: NeighborVertexBasicInfo): string { - return `edge id: ${neighbor.edgeId}, vertex id: ${neighbor.id}`; - } +interface EdgePropertyType { + id: string; + outV?: string; + inV?: string; +} - /** - * Collect all edges from this node - * @param vertex - * @param graphData - * @param newNodes (optional) object describing new nodes encountered - */ - public static createEdgesfromNode( - vertex: GraphData.GremlinVertex, - graphData: GraphData.GraphData, - newNodes?: { [id: string]: boolean } - ): void { - if (vertex.hasOwnProperty("outE")) { - let outE = vertex.outE; - for (var label in outE) { - $.each(outE[label], (index: number, edge: any) => { - // We create our own edge. No need to fetch - let e = { - id: edge.id, - label: label, - inV: edge.inV, - outV: vertex.id, - }; +export function getNeighborTitle(neighbor: NeighborVertexBasicInfo): string { + return `edge id: ${neighbor.edgeId}, vertex id: ${neighbor.id}`; +} - graphData.addEdge(e); - if (newNodes) { - newNodes[edge.inV] = true; - } - }); - } - } - if (vertex.hasOwnProperty("inE")) { - let inE = vertex.inE; - for (var label in inE) { - $.each(inE[label], (index: number, edge: any) => { - // We create our own edge. No need to fetch - let e = { - id: edge.id, - label: label, - inV: vertex.id, - outV: edge.outV, - }; +/** + * Collect all edges from this node + * @param vertex + * @param graphData + * @param newNodes (optional) object describing new nodes encountered + */ +export function createEdgesfromNode( + vertex: GraphData.GremlinVertex, + graphData: GraphData.GraphData, + newNodes?: { [id: string]: boolean } +): void { + if (Object.prototype.hasOwnProperty.call(vertex, "outE")) { + const outE = vertex.outE; + for (const label in outE) { + $.each(outE[label], (index: number, edge: EdgePropertyType) => { + // We create our own edge. No need to fetch + const e = { + id: edge.id, + label: label, + inV: edge.inV, + outV: vertex.id, + }; - graphData.addEdge(e); - if (newNodes) { - newNodes[edge.outV] = true; - } - }); - } + graphData.addEdge(e); + if (newNodes) { + newNodes[edge.inV] = true; + } + }); } } + if (Object.prototype.hasOwnProperty.call(vertex, "inE")) { + const inE = vertex.inE; + for (const label in inE) { + $.each(inE[label], (index: number, edge: EdgePropertyType) => { + // We create our own edge. No need to fetch + const e = { + id: edge.id, + label: label, + inV: vertex.id, + outV: edge.outV, + }; - /** - * From ['id1', 'id2', 'idn'] build the following string "'id1','id2','idn'". - * The string length cannot exceed maxSize. - * @param array - * @param maxSize - * @return - */ - public static getLimitedArrayString(array: string[], maxSize: number): JoinArrayMaxCharOutput { - if (!array || array.length === 0 || array[0].length + 2 > maxSize) { - return { result: "", consumedCount: 0 }; + graphData.addEdge(e); + if (newNodes) { + newNodes[edge.outV] = true; + } + }); } - - const end = array.length - 1; - let output = `'${array[0]}'`; - let i = 0; - for (; i < end; i++) { - const candidate = `${output},'${array[i + 1]}'`; - if (candidate.length <= maxSize) { - output = candidate; - } else { - break; - } - } - - return { - result: output, - consumedCount: i + 1, - }; - } - - public static createFetchEdgePairQuery( - outE: boolean, - pkid: string, - excludedEdgeIds: string[], - startIndex: number, - pageSize: number, - withoutStepArgMaxLenght: number - ): string { - let gremlinQuery: string; - if (excludedEdgeIds.length > 0) { - // build a string up to max char - const joined = GraphUtil.getLimitedArrayString(excludedEdgeIds, withoutStepArgMaxLenght); - const hasWithoutStep = !!joined.result ? `.has(id, without(${joined.result}))` : ""; - - if (joined.consumedCount === excludedEdgeIds.length) { - gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}()${hasWithoutStep}.limit(${pageSize}).as('e').${ - outE ? "inV" : "outV" - }().as('v').select('e', 'v')`; - } else { - const start = startIndex - joined.consumedCount; - gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}()${hasWithoutStep}.range(${start},${ - start + pageSize - }).as('e').${outE ? "inV" : "outV"}().as('v').select('e', 'v')`; - } - } else { - gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}().limit(${pageSize}).as('e').${ - outE ? "inV" : "outV" - }().as('v').select('e', 'v')`; - } - return gremlinQuery; - } - - /** - * Trim graph - */ - public static trimGraph( - currentRoot: GraphData.GremlinVertex, - graphData: GraphData.GraphData - ) { - const importantNodes = [currentRoot.id].concat(currentRoot._ancestorsId); - graphData.unloadAllVertices(importantNodes); - - // Keep only ancestors node in fixed position - $.each(graphData.ids, (index: number, id: string) => { - graphData.getVertexById(id)._isFixedPosition = importantNodes.indexOf(id) !== -1; - }); - } - - public static addRootChildToGraph( - root: GraphData.GremlinVertex, - child: GraphData.GremlinVertex, - graphData: GraphData.GraphData - ) { - child._ancestorsId = (root._ancestorsId || []).concat([root.id]); - graphData.addVertex(child); - GraphUtil.createEdgesfromNode(child, graphData); - graphData.addNeighborInfo(child); - } - - /** - * TODO Perform minimal substitution to prevent breaking gremlin query and allow \"" for now. - * @param value - */ - public static escapeDoubleQuotes(value: string): string { - return value == null ? value : value.replace(/"/g, '\\"'); - } - - /** - * Surround with double-quotes if val is a string. - * @param val - */ - public static getQuotedPropValue(ip: ViewModels.InputPropertyValue): string { - switch (ip.type) { - case "number": - case "boolean": - return `${ip.value}`; - case "null": - return null; - default: - return `"${GraphUtil.escapeDoubleQuotes(ip.value as string)}"`; - } - } - - /** - * TODO Perform minimal substitution to prevent breaking gremlin query and allow \' for now. - * @param value - */ - public static escapeSingleQuotes(value: string): string { - return value == null ? value : value.replace(/'/g, "\\'"); } } + +/** + * From ['id1', 'id2', 'idn'] build the following string "'id1','id2','idn'". + * The string length cannot exceed maxSize. + * @param array + * @param maxSize + * @return + */ +export function getLimitedArrayString(array: string[], maxSize: number): JoinArrayMaxCharOutput { + if (!array || array.length === 0 || array[0].length + 2 > maxSize) { + return { result: "", consumedCount: 0 }; + } + + const end = array.length - 1; + let output = `'${array[0]}'`; + let i = 0; + for (; i < end; i++) { + const candidate = `${output},'${array[i + 1]}'`; + if (candidate.length <= maxSize) { + output = candidate; + } else { + break; + } + } + + return { + result: output, + consumedCount: i + 1, + }; +} + +export function createFetchEdgePairQuery( + outE: boolean, + pkid: string, + excludedEdgeIds: string[], + startIndex: number, + pageSize: number, + withoutStepArgMaxLenght: number +): string { + let gremlinQuery: string; + if (excludedEdgeIds.length > 0) { + // build a string up to max char + const joined = getLimitedArrayString(excludedEdgeIds, withoutStepArgMaxLenght); + const hasWithoutStep = joined.result ? `.has(id, without(${joined.result}))` : ""; + + if (joined.consumedCount === excludedEdgeIds.length) { + gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}()${hasWithoutStep}.limit(${pageSize}).as('e').${ + outE ? "inV" : "outV" + }().as('v').select('e', 'v')`; + } else { + const start = startIndex - joined.consumedCount; + gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}()${hasWithoutStep}.range(${start},${ + start + pageSize + }).as('e').${outE ? "inV" : "outV"}().as('v').select('e', 'v')`; + } + } else { + gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}().limit(${pageSize}).as('e').${ + outE ? "inV" : "outV" + }().as('v').select('e', 'v')`; + } + return gremlinQuery; +} + +/** + * Trim graph + */ +export function trimGraph( + currentRoot: GraphData.GremlinVertex, + graphData: GraphData.GraphData +) { + const importantNodes = [currentRoot.id].concat(currentRoot._ancestorsId); + graphData.unloadAllVertices(importantNodes); + + // Keep only ancestors node in fixed position + $.each(graphData.ids, (index: number, id: string) => { + graphData.getVertexById(id)._isFixedPosition = importantNodes.indexOf(id) !== -1; + }); +} + +export function addRootChildToGraph( + root: GraphData.GremlinVertex, + child: GraphData.GremlinVertex, + graphData: GraphData.GraphData +) { + child._ancestorsId = (root._ancestorsId || []).concat([root.id]); + graphData.addVertex(child); + createEdgesfromNode(child, graphData); + graphData.addNeighborInfo(child); +} + +/** + * TODO Perform minimal substitution to prevent breaking gremlin query and allow \"" for now. + * @param value + */ +export function escapeDoubleQuotes(value: string): string { + return value === undefined ? value : value.replace(/"/g, '\\"'); +} + +/** + * Surround with double-quotes if val is a string. + * @param val + */ +export function getQuotedPropValue(ip: ViewModels.InputPropertyValue): string { + switch (ip.type) { + case "number": + case "boolean": + return `${ip.value}`; + case "null": + return undefined; + default: + return `"${escapeDoubleQuotes(ip.value as string)}"`; + } +} + +/** + * TODO Perform minimal substitution to prevent breaking gremlin query and allow \' for now. + * @param value + */ +export function escapeSingleQuotes(value: string): string { + return value === undefined ? value : value.replace(/'/g, "\\'"); +} diff --git a/src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx b/src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx index 69cc2c4b9..8873d998e 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import { GraphHighlightedNodeData, NeighborVertexBasicInfo } from "./GraphExplorer"; -import { GraphUtil } from "./GraphUtil"; +import * as GraphUtil from "./GraphUtil"; import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement"; export interface ReadOnlyNeighborsComponentProps { From f192310697a9186fdaa9ce60b8a0847aedab6e27 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Yadav <79906609+sunilyadav840@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:24:00 +0530 Subject: [PATCH 13/13] Fixed lint issue and remove unused code (#491) --- .eslintignore | 1 - .../Tables/DataTable/DataTableUtilities.ts | 20 ++----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.eslintignore b/.eslintignore index c4aa1be52..2ecbfcdc0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -161,7 +161,6 @@ src/Explorer/Tables/DataTable/DataTableBuilder.ts src/Explorer/Tables/DataTable/DataTableContextMenu.ts src/Explorer/Tables/DataTable/DataTableOperationManager.ts src/Explorer/Tables/DataTable/DataTableOperations.ts -src/Explorer/Tables/DataTable/DataTableUtilities.ts src/Explorer/Tables/DataTable/DataTableViewModel.ts src/Explorer/Tables/DataTable/TableCommands.ts src/Explorer/Tables/DataTable/TableEntityCache.ts diff --git a/src/Explorer/Tables/DataTable/DataTableUtilities.ts b/src/Explorer/Tables/DataTable/DataTableUtilities.ts index 403d45d90..206e3bcef 100644 --- a/src/Explorer/Tables/DataTable/DataTableUtilities.ts +++ b/src/Explorer/Tables/DataTable/DataTableUtilities.ts @@ -37,23 +37,6 @@ export function containItems(items: T[]): boolean { return items && items.length > 0; } -// export function setTargetIcon(idToIconHandlerMap: CloudHub.Common.IToolbarElementIdIconMap, $sourceElement: JQuery, toIconState: IconState): void { -// if (idToIconHandlerMap) { -// var iconId: string = $sourceElement.attr("id"); -// var iconHandler = idToIconHandlerMap[iconId]; -// switch (toIconState) { -// case IconState.default: -// iconHandler.observable(iconHandler.default); -// break; -// case IconState.hoverState: -// iconHandler.observable(iconHandler.hoverState); -// break; -// default: -// window.console.log("error"); -// } -// } -// } - export function addCssClass($sourceElement: JQuery, cssClassName: string): void { if (!$sourceElement.hasClass(cssClassName)) { $sourceElement.addClass(cssClassName); @@ -78,8 +61,9 @@ export function getPropertyIntersectionFromTableEntities( entities: Entities.ITableEntity[], isCassandraApi: boolean ): string[] { - var headerUnion: string[] = []; + const headerUnion: string[] = []; entities && + // eslint-disable-next-line @typescript-eslint/no-explicit-any entities.forEach((row: any) => { const keys = Object.keys(row); keys &&