mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-07 11:36:47 +00:00
Compare commits
2 Commits
eslint/fix
...
tsStrict/f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49e09ab677 | ||
|
|
18bb22eab8 |
@@ -121,6 +121,7 @@ src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts
|
||||
src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.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
|
||||
|
||||
@@ -28,8 +28,9 @@ export const CostEstimateText: FunctionComponent<CostEstimateTextProps> = ({
|
||||
}
|
||||
|
||||
const serverId: string = userContext.portalEnv;
|
||||
const { enableMultipleWriteLocations } = databaseAccount.properties;
|
||||
const numberOfRegions: number = databaseAccount.properties.readLocations?.length || 1;
|
||||
const multimasterEnabled: boolean = databaseAccount.properties.enableMultipleWriteLocations;
|
||||
const multimasterEnabled: boolean = enableMultipleWriteLocations ? enableMultipleWriteLocations : false;
|
||||
const hourlyPrice: number = computeRUUsagePriceHourly({
|
||||
serverId,
|
||||
requestUnits,
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
DropTargetConnector,
|
||||
DropTargetMonitor,
|
||||
} from "react-dnd";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { Dispatch } from "redux";
|
||||
import styled, { StyledComponent } from "styled-components";
|
||||
@@ -109,7 +108,7 @@ const DragHandleAnchor = styled.div`
|
||||
position: relative;
|
||||
`;
|
||||
|
||||
export function isDragUpper(props: Props, monitor: DropTargetMonitor, el: HTMLElement): boolean {
|
||||
export function isDragUpper(_props: Props, monitor: DropTargetMonitor, el: HTMLElement): boolean {
|
||||
const hoverBoundingRect = el.getBoundingClientRect();
|
||||
const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
||||
|
||||
@@ -223,7 +222,7 @@ export class DraggableCellView extends React.Component<Props & DnDSourceProps &
|
||||
const source = DragSource<Props, DnDSourceProps>("CELL", cellSource, collectSource);
|
||||
const target = DropTarget<Props, DnDTargetProps>("CELL", cellTarget, collectTarget);
|
||||
|
||||
export const makeMapDispatchToProps = (initialDispatch: Dispatch) => {
|
||||
export const makeMapDispatchToProps = (_initialDispatch: Dispatch) => {
|
||||
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||
moveCell: (payload: actions.MoveCell["payload"]) => dispatch(actions.moveCell(payload)),
|
||||
focusCell: (payload: actions.FocusCell["payload"]) => dispatch(actions.focusCell(payload)),
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* [Todo] disable any type of file.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as _ from "underscore";
|
||||
import Q from "q";
|
||||
import * as Entities from "./Entities";
|
||||
@@ -13,11 +8,11 @@ import * as Constants from "./Constants";
|
||||
* Generates a pseudo-random GUID.
|
||||
*/
|
||||
export function guid() {
|
||||
const s4 = () => {
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 0x10000)
|
||||
.toString(16)
|
||||
.substring(1);
|
||||
};
|
||||
}
|
||||
return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
|
||||
}
|
||||
|
||||
@@ -44,7 +39,7 @@ export function ensureBetweenBounds(value: number, minimum: number, maximum: num
|
||||
* If supplied, the original error will be added as "details".
|
||||
*/
|
||||
export function getErrorMessage(error: any, simpleMessage?: string): string {
|
||||
let detailsMessage: string;
|
||||
var detailsMessage: string;
|
||||
if (typeof error === "string" || error instanceof String) {
|
||||
detailsMessage = error.toString();
|
||||
} else {
|
||||
@@ -64,7 +59,7 @@ export function getErrorMessage(error: any, simpleMessage?: string): string {
|
||||
* Get the environment's new line characters
|
||||
*/
|
||||
export function getEnvironmentNewLine(): string {
|
||||
const platform = navigator.platform.toUpperCase();
|
||||
var platform = navigator.platform.toUpperCase();
|
||||
|
||||
if (platform.indexOf("WIN") >= 0) {
|
||||
return "\r\n";
|
||||
@@ -78,7 +73,7 @@ export function getEnvironmentNewLine(): string {
|
||||
* Tests whether two arrays have same elements in the same sequence.
|
||||
*/
|
||||
export function isEqual<T>(a: T[], b: T[]): boolean {
|
||||
let isEqual = false;
|
||||
var isEqual: boolean = false;
|
||||
if (!!a && !!b && a.length === b.length) {
|
||||
isEqual = _.every(a, (value: T, index: number) => value === b[index]);
|
||||
}
|
||||
@@ -90,13 +85,12 @@ export function isEqual<T>(a: T[], b: T[]): boolean {
|
||||
*/
|
||||
export function jQuerySelectorEscape(value: string): string {
|
||||
value = value || "";
|
||||
// removed Unnecessary escape character: \/.eslintno-useless-escape
|
||||
return value.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
|
||||
return value.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, "\\$&");
|
||||
}
|
||||
|
||||
export function copyTableQuery(query: Entities.ITableQuery): Entities.ITableQuery {
|
||||
if (!query) {
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -110,7 +104,7 @@ export function copyTableQuery(query: Entities.ITableQuery): Entities.ITableQuer
|
||||
* Html encode
|
||||
*/
|
||||
export function htmlEncode(value: string): string {
|
||||
const _divElem: JQuery = $("<div/>");
|
||||
var _divElem: JQuery = $("<div/>");
|
||||
return _divElem.text(value).html();
|
||||
}
|
||||
|
||||
@@ -123,22 +117,22 @@ export function onKey(
|
||||
event: any,
|
||||
eventKeyCode: number,
|
||||
action: ($sourceElement: JQuery) => void,
|
||||
metaKey?: boolean,
|
||||
shiftKey?: boolean,
|
||||
altKey?: boolean
|
||||
metaKey: boolean = null,
|
||||
shiftKey: boolean = null,
|
||||
altKey: boolean = null
|
||||
): boolean {
|
||||
const source: unknown = event.target || event.srcElement,
|
||||
var source: any = event.target || event.srcElement,
|
||||
keyCode: number = event.keyCode,
|
||||
$sourceElement = $(source);
|
||||
let handled = false;
|
||||
$sourceElement = $(source),
|
||||
handled: boolean = false;
|
||||
|
||||
if (
|
||||
$sourceElement.length &&
|
||||
keyCode === eventKeyCode &&
|
||||
$.isFunction(action) &&
|
||||
(metaKey === undefined || metaKey === event.metaKey) &&
|
||||
(shiftKey === undefined || shiftKey === event.shiftKey) &&
|
||||
(altKey === undefined || altKey === event.altKey)
|
||||
(metaKey === null || metaKey === event.metaKey) &&
|
||||
(shiftKey === null || shiftKey === event.shiftKey) &&
|
||||
(altKey === null || altKey === event.altKey)
|
||||
) {
|
||||
action($sourceElement);
|
||||
handled = true;
|
||||
@@ -153,9 +147,9 @@ export function onKey(
|
||||
export function onEnter(
|
||||
event: any,
|
||||
action: ($sourceElement: JQuery) => void,
|
||||
metaKey?: boolean,
|
||||
shiftKey?: boolean,
|
||||
altKey?: boolean
|
||||
metaKey: boolean = null,
|
||||
shiftKey: boolean = null,
|
||||
altKey: boolean = null
|
||||
): boolean {
|
||||
return onKey(event, Constants.keyCodes.Enter, action, metaKey, shiftKey, altKey);
|
||||
}
|
||||
@@ -166,9 +160,9 @@ export function onEnter(
|
||||
export function onTab(
|
||||
event: any,
|
||||
action: ($sourceElement: JQuery) => void,
|
||||
metaKey?: boolean,
|
||||
shiftKey?: boolean,
|
||||
altKey?: boolean
|
||||
metaKey: boolean = null,
|
||||
shiftKey: boolean = null,
|
||||
altKey: boolean = null
|
||||
): boolean {
|
||||
return onKey(event, Constants.keyCodes.Tab, action, metaKey, shiftKey, altKey);
|
||||
}
|
||||
@@ -179,9 +173,9 @@ export function onTab(
|
||||
export function onEsc(
|
||||
event: any,
|
||||
action: ($sourceElement: JQuery) => void,
|
||||
metaKey?: boolean,
|
||||
shiftKey?: boolean,
|
||||
altKey?: boolean
|
||||
metaKey: boolean = null,
|
||||
shiftKey: boolean = null,
|
||||
altKey: boolean = null
|
||||
): boolean {
|
||||
return onKey(event, Constants.keyCodes.Esc, action, metaKey, shiftKey, altKey);
|
||||
}
|
||||
@@ -206,21 +200,21 @@ export function isEnvironmentAltPressed(event: JQueryEventObject): boolean {
|
||||
* Returns whether the current platform is MacOS.
|
||||
*/
|
||||
export function isMac(): boolean {
|
||||
const platform = navigator.platform.toUpperCase();
|
||||
var platform = navigator.platform.toUpperCase();
|
||||
return platform.indexOf("MAC") >= 0;
|
||||
}
|
||||
|
||||
// MAX_SAFE_INTEGER and MIN_SAFE_INTEGER will be provided by ECMAScript 6's Number
|
||||
export const MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
||||
export const MIN_SAFE_INTEGER = -MAX_SAFE_INTEGER;
|
||||
export var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
|
||||
export var MIN_SAFE_INTEGER = -MAX_SAFE_INTEGER;
|
||||
|
||||
/**
|
||||
* Tests whether a value a safe integer.
|
||||
* A safe integer is an integer that can be exactly represented as an IEEE-754 double precision number (all integers from (2^53 - 1) to -(2^53 - 1))
|
||||
* Note: Function and constants will be provided by ECMAScript 6's Number.
|
||||
*/
|
||||
export function isSafeInteger(value: number | string): boolean {
|
||||
const n: number = typeof value !== "number" ? Number(value) : value;
|
||||
export function isSafeInteger(value: any): boolean {
|
||||
var n: number = typeof value !== "number" ? Number(value) : value;
|
||||
|
||||
return Math.round(n) === n && MIN_SAFE_INTEGER <= n && n <= MAX_SAFE_INTEGER;
|
||||
}
|
||||
@@ -246,7 +240,7 @@ export function getInputTypeFromDisplayedName(displayedName: string): string {
|
||||
}
|
||||
|
||||
export function padLongWithZeros(value: string): string {
|
||||
const s = "0000000000000000000" + value;
|
||||
var s = "0000000000000000000" + value;
|
||||
return s.substr(s.length - 20);
|
||||
}
|
||||
|
||||
@@ -255,13 +249,13 @@ export function padLongWithZeros(value: string): string {
|
||||
* Notice: Not every header will have a data type since some headers don't even exist in entities.
|
||||
*/
|
||||
export function getDataTypesFromEntities(headers: string[], entities: Entities.ITableEntity[]): any {
|
||||
let currentHeaders: string[] = _.clone(headers);
|
||||
const dataTypes: any = {};
|
||||
var currentHeaders: string[] = _.clone(headers);
|
||||
var dataTypes: any = {};
|
||||
entities = entities || [];
|
||||
entities.forEach((entity: Entities.ITableEntity) => {
|
||||
entities.forEach((entity: Entities.ITableEntity, index: number) => {
|
||||
if (currentHeaders.length) {
|
||||
const keys: string[] = _.keys(entity);
|
||||
const headersToProcess: string[] = _.intersection(currentHeaders, keys);
|
||||
var keys: string[] = _.keys(entity);
|
||||
var headersToProcess: string[] = _.intersection(currentHeaders, keys);
|
||||
headersToProcess &&
|
||||
headersToProcess.forEach((propertyName: string) => {
|
||||
dataTypes[propertyName] = entity[propertyName].$ || Constants.TableType.String;
|
||||
@@ -276,9 +270,9 @@ export function getDataTypesFromEntities(headers: string[], entities: Entities.I
|
||||
* Set a data type for each header. The data type is inferred from Cassandra Schema.
|
||||
*/
|
||||
export function getDataTypesFromCassandraSchema(schema: CassandraTableKey[]): any {
|
||||
const dataTypes: any = {};
|
||||
var dataTypes: any = {};
|
||||
schema &&
|
||||
schema.forEach((schemaItem: CassandraTableKey) => {
|
||||
schema.forEach((schemaItem: CassandraTableKey, index: number) => {
|
||||
dataTypes[schemaItem.property] = schemaItem.type;
|
||||
});
|
||||
return dataTypes;
|
||||
|
||||
@@ -10,7 +10,7 @@ describe("parseResourceTokenConnectionString", () => {
|
||||
accountEndpoint: "fakeEndpoint",
|
||||
collectionId: "fakeCollectionId",
|
||||
databaseId: "fakeDatabaseId",
|
||||
partitionKey: undefined,
|
||||
partitionKey: "",
|
||||
resourceToken: "type=resource&ver=1&sig=2dIP+CdIfT1ScwHWdv5GGw==;fakeToken;",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,11 +7,11 @@ export interface ParsedResourceTokenConnectionString {
|
||||
}
|
||||
|
||||
export function parseResourceTokenConnectionString(connectionString: string): ParsedResourceTokenConnectionString {
|
||||
let accountEndpoint: string;
|
||||
let collectionId: string;
|
||||
let databaseId: string;
|
||||
let partitionKey: string;
|
||||
let resourceToken: string;
|
||||
let accountEndpoint = "";
|
||||
let collectionId = "";
|
||||
let databaseId = "";
|
||||
let partitionKey = "";
|
||||
let resourceToken = "";
|
||||
const connectionStringParts = connectionString.split(";");
|
||||
connectionStringParts.forEach((part: string) => {
|
||||
if (part.startsWith("type=resource")) {
|
||||
@@ -39,5 +39,5 @@ export function parseResourceTokenConnectionString(connectionString: string): Pa
|
||||
}
|
||||
|
||||
export function isResourceTokenConnectionString(connectionString: string): boolean {
|
||||
return connectionString && connectionString.includes("type=resource");
|
||||
return connectionString.includes("type=resource");
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ interface UserContext {
|
||||
// This is coming in a future Cosmos ARM API version as a prperty on databaseAccount
|
||||
apiType: ApiType;
|
||||
readonly isTryCosmosDBSubscription?: boolean;
|
||||
readonly portalEnv?: PortalEnv;
|
||||
readonly portalEnv: PortalEnv;
|
||||
readonly features: Features;
|
||||
readonly addCollectionFlight: string;
|
||||
readonly hasWriteAccess: boolean;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"./src/Explorer/Controls/Dialog.tsx",
|
||||
"./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
|
||||
"./src/Explorer/Controls/SmartUi/InputUtils.ts",
|
||||
"./src/Explorer/Controls/ThroughputInput/CostEstimateText/CostEstimateText.tsx",
|
||||
"./src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts",
|
||||
"./src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts",
|
||||
"./src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts",
|
||||
@@ -84,9 +85,15 @@
|
||||
"./src/GitHub/GitHubConnector.ts",
|
||||
"./src/HostedExplorerChildFrame.ts",
|
||||
"./src/Platform/Hosted/Authorization.ts",
|
||||
"./src/Platform/Hosted/Components/ConnectExplorer.test.tsx",
|
||||
"./src/Platform/Hosted/Components/ConnectExplorer.tsx",
|
||||
"./src/Platform/Hosted/Components/MeControl.test.tsx",
|
||||
"./src/Platform/Hosted/Components/MeControl.tsx",
|
||||
"./src/Platform/Hosted/Components/SignInButton.tsx",
|
||||
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
|
||||
"./src/Platform/Hosted/Components/SwitchSubscription.tsx",
|
||||
"./src/Platform/Hosted/Helpers/ResourceTokenUtils.test.ts",
|
||||
"./src/Platform/Hosted/Helpers/ResourceTokenUtils.ts",
|
||||
"./src/Platform/Hosted/HostedUtils.test.ts",
|
||||
"./src/Platform/Hosted/HostedUtils.ts",
|
||||
"./src/Platform/Hosted/extractFeatures.test.ts",
|
||||
@@ -130,17 +137,15 @@
|
||||
"./src/hooks/useFullScreenURLs.tsx",
|
||||
"./src/hooks/useGraphPhoto.tsx",
|
||||
"./src/hooks/useNotebookSnapshotStore.ts",
|
||||
"./src/hooks/usePortalAccessToken.tsx",
|
||||
"./src/hooks/useNotificationConsole.ts",
|
||||
"./src/hooks/useObservable.ts",
|
||||
"./src/hooks/usePortalAccessToken.tsx",
|
||||
"./src/hooks/useSidePanel.ts",
|
||||
"./src/i18n.ts",
|
||||
"./src/quickstart.ts",
|
||||
"./src/setupTests.ts",
|
||||
"./src/userContext.test.ts",
|
||||
"src/Common/EntityValue.tsx",
|
||||
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
|
||||
"./src/Platform/Hosted/Components/SwitchSubscription.tsx"
|
||||
"src/Common/EntityValue.tsx"
|
||||
],
|
||||
"include": [
|
||||
"src/CellOutputViewer/transforms/**/*",
|
||||
@@ -155,6 +160,7 @@
|
||||
"src/Explorer/Graph/GraphExplorerComponent/__mocks__/**/*",
|
||||
"src/Explorer/Menus/NavBar/**/*",
|
||||
"src/Explorer/Notebook/NotebookComponent/__mocks__/**/*",
|
||||
"src/Explorer/Notebook/NotebookRenderer/decorators/draggable/**/*",
|
||||
"src/Explorer/Notebook/NotebookRenderer/decorators/hijack-scroll/**/*",
|
||||
"src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/**/*",
|
||||
"src/Explorer/Panes/RightPaneForm/**/*",
|
||||
@@ -166,4 +172,4 @@
|
||||
"src/Terminal/**/*",
|
||||
"src/Utils/arm/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user