mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-21 11:47:14 +00:00
Fixed typescript issues for DatabaseAccountUtility and InMemoryContentProvider
This commit is contained in:
parent
8eeda41021
commit
55b117d83b
@ -5,11 +5,15 @@ function isVirtualNetworkFilterEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isIpRulesEnabled() {
|
function isIpRulesEnabled() {
|
||||||
return userContext.databaseAccount?.properties?.ipRules?.length > 0;
|
return userContext?.databaseAccount?.properties?.ipRules !== undefined
|
||||||
|
? userContext?.databaseAccount?.properties?.ipRules?.length > 0
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPrivateEndpointConnectionsEnabled() {
|
function isPrivateEndpointConnectionsEnabled() {
|
||||||
return userContext.databaseAccount?.properties?.privateEndpointConnections?.length > 0;
|
return userContext.databaseAccount?.properties?.privateEndpointConnections !== undefined
|
||||||
|
? userContext.databaseAccount?.properties?.privateEndpointConnections?.length > 0
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPublicInternetAccessAllowed(): boolean {
|
export function isPublicInternetAccessAllowed(): boolean {
|
||||||
|
@ -28,10 +28,10 @@ export const getErrorMessage = (error: string | Error = ""): string => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getErrorStack = (error: string | Error): string => {
|
export const getErrorStack = (error: string | Error): string => {
|
||||||
return typeof error === "string" ? undefined : error.stack;
|
return typeof error === "string" ? "" : error.stack === undefined ? "" : error.stack;
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendNotificationForError = (errorMessage: string, errorCode: number | string): void => {
|
const sendNotificationForError = (errorMessage: string, errorCode: number | string | undefined): void => {
|
||||||
if (errorCode === HttpStatusCodes.Forbidden) {
|
if (errorCode === HttpStatusCodes.Forbidden) {
|
||||||
if (errorMessage?.toLowerCase().indexOf("sharedoffer is disabled for your account") > 0) {
|
if (errorMessage?.toLowerCase().indexOf("sharedoffer is disabled for your account") > 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -2,9 +2,9 @@ import * as React from "react";
|
|||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
|
|
||||||
interface AccessibleElementProps extends React.HtmlHTMLAttributes<HTMLElement> {
|
interface AccessibleElementProps extends React.HtmlHTMLAttributes<HTMLElement> {
|
||||||
as: string; // tag element name
|
as?: string; // tag element name
|
||||||
onActivated: (event: React.SyntheticEvent<HTMLElement>) => void;
|
onActivated?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
||||||
"aria-label": string;
|
"aria-label"?: string;
|
||||||
tabIndex?: number;
|
tabIndex?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,9 @@ export class AccessibleElement extends React.Component<AccessibleElementProps> {
|
|||||||
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
if (event.charCode === Constants.KeyCodes.Space || event.charCode === Constants.KeyCodes.Enter) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.props.onActivated(event);
|
if (this.props.onActivated !== undefined) {
|
||||||
|
this.props.onActivated(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,11 +29,15 @@ export class AccessibleElement extends React.Component<AccessibleElementProps> {
|
|||||||
|
|
||||||
const tabIndex = this.props.tabIndex === undefined ? 0 : this.props.tabIndex;
|
const tabIndex = this.props.tabIndex === undefined ? 0 : this.props.tabIndex;
|
||||||
|
|
||||||
return React.createElement(this.props.as, {
|
return this.props.as !== undefined ? (
|
||||||
...elementProps,
|
React.createElement(this.props.as, {
|
||||||
onKeyPress: this.onKeyPress,
|
...elementProps,
|
||||||
onClick: this.props.onActivated,
|
onKeyPress: this.onKeyPress,
|
||||||
tabIndex,
|
onClick: this.props.onActivated,
|
||||||
});
|
tabIndex,
|
||||||
|
})
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ export class InMemoryContentProvider implements IContentProvider {
|
|||||||
request: {},
|
request: {},
|
||||||
status,
|
status,
|
||||||
response: content ? content : undefined,
|
response: content ? content : undefined,
|
||||||
responseText: content ? JSON.stringify(content) : undefined,
|
responseText: content ? JSON.stringify(content) : "",
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -137,9 +137,12 @@
|
|||||||
"./src/quickstart.ts",
|
"./src/quickstart.ts",
|
||||||
"./src/setupTests.ts",
|
"./src/setupTests.ts",
|
||||||
"./src/userContext.test.ts",
|
"./src/userContext.test.ts",
|
||||||
"src/Common/EntityValue.tsx",
|
"./src/Common/EntityValue.tsx",
|
||||||
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
|
"./src/Platform/Hosted/Components/SwitchAccount.tsx",
|
||||||
"./src/Platform/Hosted/Components/SwitchSubscription.tsx"
|
"./src/Platform/Hosted/Components/SwitchSubscription.tsx",
|
||||||
|
"./src/Common/DatabaseAccountUtility.ts",
|
||||||
|
"./src/Explorer/Controls/Tabs/TabComponent.tsx",
|
||||||
|
"./src/Explorer/Notebook/NotebookComponent/ContentProviders/InMemoryContentProvider.ts"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"src/CellOutputViewer/transforms/**/*",
|
"src/CellOutputViewer/transforms/**/*",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user