mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
Make Data Explorer work on node v18 (#1654)
* Upgrade packages to enable npm i with node 18 * Fix crypto and querystring issue * Fix webpack errors during npm start * Upgrade monaco editor. Fix alias in webconfig * Remove deprecated file-loader. Upgrade webpack to latest. * Fix format * Upgrade webpack, eslint and typescript * Update p-retry and fluentui packages * Revert monaco package upgrade * Fix notebook compile errors * Fix lint errors * Update jest snapshots * Fix unit tests * Update node version to 18 * Fix compile error * Fix compile error * Fix format * Turn off warning overlay for webpack devServer * Fix format * Re-add monaco webpack plugin and upgrade monaco-editor * Update package-lock.json * Fix build issue * Move MonacoWebpackPlugin to previous place in webpack.config.js * update package-lock.json * Fix package-lock.json * Update package-lock.json * Fix export ChoiceItem not found warning for self serve. Remove warning turn off in webpack config. * Update checkout and setup actions in for ci tests * Disable Gallery callout * Fix disable gallery header * Totally disable New gallery callout * Upgrade all github actions to latest
This commit is contained in:
@@ -27,6 +27,7 @@ export interface AccordionItemComponentProps {
|
||||
isExpanded?: boolean;
|
||||
containerStyles?: React.CSSProperties;
|
||||
styles?: React.CSSProperties;
|
||||
children: JSX.Element;
|
||||
}
|
||||
|
||||
interface AccordionItemComponentState {
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface CollapsiblePanelProps {
|
||||
isCollapsed: boolean;
|
||||
onCollapsedChanged: (newValue: boolean) => void;
|
||||
collapseToLeft?: boolean;
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
export class CollapsiblePanel extends React.Component<CollapsiblePanelProps> {
|
||||
|
||||
@@ -7,6 +7,7 @@ describe("CollapsibleSectionComponent", () => {
|
||||
const props: CollapsibleSectionProps = {
|
||||
title: "Sample title",
|
||||
isExpandedByDefault: true,
|
||||
children: <></>,
|
||||
};
|
||||
|
||||
const wrapper = shallow(<CollapsibleSectionComponent {...props} />);
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface CollapsibleSectionProps {
|
||||
title: string;
|
||||
isExpandedByDefault: boolean;
|
||||
onExpand?: () => void;
|
||||
children: JSX.Element;
|
||||
}
|
||||
|
||||
export interface CollapsibleSectionState {
|
||||
|
||||
@@ -99,7 +99,7 @@ export class DiffEditorViewModel {
|
||||
) {
|
||||
this.editorContainer = document.getElementById(this.getEditorId());
|
||||
this.editorContainer.innerHTML = "";
|
||||
const options: monaco.editor.IDiffEditorConstructionOptions = {
|
||||
const options: monaco.editor.IStandaloneDiffEditorConstructionOptions = {
|
||||
lineNumbers: this.params.lineNumbers || "off",
|
||||
fontSize: 12,
|
||||
ariaLabel: this.params.ariaLabel,
|
||||
|
||||
@@ -52,7 +52,11 @@ class EditorViewModel extends JsonEditorViewModel {
|
||||
if (EditorViewModel.providerRegistered.indexOf("sql") < 0) {
|
||||
const { SqlCompletionItemProvider } = await import("@azure/cosmos-language-service");
|
||||
const monaco = await loadMonaco();
|
||||
monaco.languages.registerCompletionItemProvider("sql", new SqlCompletionItemProvider());
|
||||
monaco.languages.registerCompletionItemProvider(
|
||||
"sql",
|
||||
// TODO cosmos-language-service could be outdated
|
||||
new SqlCompletionItemProvider() as unknown as monaco.languages.CompletionItemProvider,
|
||||
);
|
||||
EditorViewModel.providerRegistered.push("sql");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
||||
* Create the monaco editor and attach to DOM
|
||||
*/
|
||||
private async createEditor(createCallback: (e: monaco.editor.IStandaloneCodeEditor) => void) {
|
||||
const options: monaco.editor.IEditorConstructionOptions = {
|
||||
const options: monaco.editor.IStandaloneEditorConstructionOptions = {
|
||||
language: this.props.language,
|
||||
value: this.props.content,
|
||||
readOnly: this.props.isReadOnly,
|
||||
|
||||
@@ -90,7 +90,7 @@ export class JsonEditorViewModel extends WaitsForTemplateViewModel {
|
||||
protected async createEditor(content: string, createCallback: (e: monaco.editor.IStandaloneCodeEditor) => void) {
|
||||
this.registerCompletionItemProvider();
|
||||
this.editorContainer = document.getElementById(this.getEditorId());
|
||||
const options: monaco.editor.IEditorConstructionOptions = {
|
||||
const options: monaco.editor.IStandaloneEditorConstructionOptions = {
|
||||
value: content,
|
||||
language: this.getEditorLanguage(),
|
||||
readOnly: this.params.isReadOnly,
|
||||
|
||||
@@ -29,6 +29,6 @@ describe("CodeOfConduct", () => {
|
||||
const wrapper = shallow(<CodeOfConduct {...codeOfConductProps} />);
|
||||
wrapper.find(".genericPaneSubmitBtn").first().simulate("click");
|
||||
await Promise.resolve();
|
||||
expect(codeOfConductProps.onAcceptCodeOfConduct).toBeCalled();
|
||||
expect(codeOfConductProps.onAcceptCodeOfConduct).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import { updateUserContext } from "../../../UserContext";
|
||||
import Explorer from "../../Explorer";
|
||||
import { CollectionSettingsTabV2 } from "../../Tabs/SettingsTabV2";
|
||||
import { SettingsComponent, SettingsComponentProps, SettingsComponentState } from "./SettingsComponent";
|
||||
import { isDirty, TtlType } from "./SettingsUtils";
|
||||
import { TtlType, isDirty } from "./SettingsUtils";
|
||||
import { collection } from "./TestUtils";
|
||||
jest.mock("../../../Common/dataAccess/getIndexTransformationProgress", () => ({
|
||||
getIndexTransformationProgress: jest.fn().mockReturnValue(undefined),
|
||||
@@ -190,8 +190,8 @@ describe("SettingsComponent", () => {
|
||||
id: "id",
|
||||
};
|
||||
await settingsComponentInstance.onSaveClick();
|
||||
expect(updateCollection).toBeCalled();
|
||||
expect(updateOffer).toBeCalled();
|
||||
expect(updateCollection).toHaveBeenCalled();
|
||||
expect(updateOffer).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("revert resets state values", async () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { shallow } from "enzyme";
|
||||
import React from "react";
|
||||
import { renderToString } from "react-dom/server";
|
||||
import { MongoIndexTypes, MongoNotificationMessage, MongoNotificationType } from "../../SettingsUtils";
|
||||
import { MongoIndexingPolicyComponent, MongoIndexingPolicyComponentProps } from "./MongoIndexingPolicyComponent";
|
||||
import { renderToString } from "react-dom/server";
|
||||
|
||||
describe("MongoIndexingPolicyComponent", () => {
|
||||
const baseProps: MongoIndexingPolicyComponentProps = {
|
||||
@@ -84,7 +84,7 @@ describe("MongoIndexingPolicyComponent", () => {
|
||||
];
|
||||
|
||||
test.each(cases)(
|
||||
"",
|
||||
"mongo indexing policy saveable and discardable",
|
||||
(
|
||||
notification: MongoNotificationMessage,
|
||||
indexToDropIsPresent: boolean,
|
||||
@@ -111,8 +111,10 @@ describe("MongoIndexingPolicyComponent", () => {
|
||||
);
|
||||
if (mongoWarningNotificationMessage) {
|
||||
const elementAsString = renderToString(mongoIndexingPolicyComponent.getMongoWarningNotificationMessage());
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(elementAsString).toContain(mongoWarningNotificationMessage);
|
||||
} else {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(mongoIndexingPolicyComponent.getMongoWarningNotificationMessage()).toBeUndefined();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -18,17 +18,17 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
horizontal={true}
|
||||
>
|
||||
<div
|
||||
className="ms-Stack css-53"
|
||||
className="ms-Stack css-109"
|
||||
>
|
||||
<span
|
||||
className="mandatoryStar"
|
||||
key=".0:$.0"
|
||||
key=".0:$.$.0"
|
||||
>
|
||||
*
|
||||
</span>
|
||||
<Text
|
||||
aria-label="Throughput header"
|
||||
key=".0:$.1"
|
||||
key=".0:$.$.1"
|
||||
style={
|
||||
Object {
|
||||
"fontWeight": 600,
|
||||
@@ -39,7 +39,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-label="Throughput header"
|
||||
className="css-54"
|
||||
className="css-110"
|
||||
style={
|
||||
Object {
|
||||
"fontWeight": 600,
|
||||
@@ -51,7 +51,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
</span>
|
||||
</Text>
|
||||
<InfoTooltip
|
||||
key=".0:$.2"
|
||||
key=".0:$.$.2"
|
||||
>
|
||||
<span>
|
||||
<StyledTooltipHostBase
|
||||
@@ -336,12 +336,13 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="ms-TooltipHost root-55"
|
||||
className="ms-TooltipHost root-111"
|
||||
onBlurCapture={[Function]}
|
||||
onFocusCapture={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
onMouseLeave={[Function]}
|
||||
role="none"
|
||||
>
|
||||
<StyledIconBase
|
||||
ariaLabel="Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage."
|
||||
@@ -631,7 +632,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
>
|
||||
<i
|
||||
aria-label="Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage."
|
||||
className="panelInfoIcon root-57"
|
||||
className="panelInfoIcon root-114"
|
||||
data-icon-name="Info"
|
||||
role="img"
|
||||
tabIndex={0}
|
||||
@@ -640,6 +641,24 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
</i>
|
||||
</IconBase>
|
||||
</StyledIconBase>
|
||||
<div
|
||||
hidden={true}
|
||||
id="tooltip0"
|
||||
style={
|
||||
Object {
|
||||
"border": 0,
|
||||
"height": 1,
|
||||
"margin": -1,
|
||||
"overflow": "hidden",
|
||||
"padding": 0,
|
||||
"position": "absolute",
|
||||
"whiteSpace": "nowrap",
|
||||
"width": 1,
|
||||
}
|
||||
}
|
||||
>
|
||||
Set the throughput — Request Units per second (RU/s) — required for the workload. A read of a 1 KB document uses 1 RU. Select manual if you plan to scale RU/s yourself. Select autoscale to allow the system to scale RU/s based on usage.
|
||||
</div>
|
||||
</div>
|
||||
</TooltipHostBase>
|
||||
</StyledTooltipHostBase>
|
||||
@@ -652,10 +671,10 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
verticalAlign="center"
|
||||
>
|
||||
<div
|
||||
className="ms-Stack css-58"
|
||||
className="ms-Stack css-115"
|
||||
>
|
||||
<div
|
||||
key=".0:$.0"
|
||||
key=".0:$.$.0"
|
||||
role="radiogroup"
|
||||
>
|
||||
<input
|
||||
@@ -699,16 +718,16 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
className="throughputInputSpacing"
|
||||
>
|
||||
<div
|
||||
className="ms-Stack throughputInputSpacing css-59"
|
||||
className="ms-Stack throughputInputSpacing css-116"
|
||||
>
|
||||
<Text
|
||||
aria-label="capacity calculator of azure cosmos db"
|
||||
key=".0:$.0"
|
||||
key=".0:$.$.0"
|
||||
variant="small"
|
||||
>
|
||||
<span
|
||||
aria-label="capacity calculator of azure cosmos db"
|
||||
className="css-54"
|
||||
className="css-110"
|
||||
>
|
||||
Estimate your required RU/s with
|
||||
|
||||
@@ -998,7 +1017,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
>
|
||||
<a
|
||||
aria-label="capacity calculator of azure cosmos db"
|
||||
className="ms-Link root-60"
|
||||
className="ms-Link root-117"
|
||||
href="https://cosmos.azure.com/capacitycalculator/"
|
||||
onClick={[Function]}
|
||||
target="_blank"
|
||||
@@ -1012,14 +1031,14 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
</Text>
|
||||
<Stack
|
||||
horizontal={true}
|
||||
key=".0:$.1"
|
||||
key=".0:$.$.1"
|
||||
>
|
||||
<div
|
||||
className="ms-Stack css-53"
|
||||
className="ms-Stack css-109"
|
||||
>
|
||||
<Text
|
||||
aria-label="maxRUDescription"
|
||||
key=".0:$.0"
|
||||
key=".0:$.$.0"
|
||||
style={
|
||||
Object {
|
||||
"fontWeight": 600,
|
||||
@@ -1030,7 +1049,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-label="maxRUDescription"
|
||||
className="css-54"
|
||||
className="css-110"
|
||||
style={
|
||||
Object {
|
||||
"fontWeight": 600,
|
||||
@@ -1043,7 +1062,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
</span>
|
||||
</Text>
|
||||
<InfoTooltip
|
||||
key=".0:$.1"
|
||||
key=".0:$.$.1"
|
||||
>
|
||||
<span>
|
||||
<StyledTooltipHostBase
|
||||
@@ -1328,12 +1347,13 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
}
|
||||
>
|
||||
<div
|
||||
className="ms-TooltipHost root-55"
|
||||
className="ms-TooltipHost root-111"
|
||||
onBlurCapture={[Function]}
|
||||
onFocusCapture={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
onMouseLeave={[Function]}
|
||||
role="none"
|
||||
>
|
||||
<StyledIconBase
|
||||
ariaLabel="Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage."
|
||||
@@ -1623,7 +1643,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
>
|
||||
<i
|
||||
aria-label="Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage."
|
||||
className="panelInfoIcon root-57"
|
||||
className="panelInfoIcon root-114"
|
||||
data-icon-name="Info"
|
||||
role="img"
|
||||
tabIndex={0}
|
||||
@@ -1632,6 +1652,24 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
</i>
|
||||
</IconBase>
|
||||
</StyledIconBase>
|
||||
<div
|
||||
hidden={true}
|
||||
id="tooltip1"
|
||||
style={
|
||||
Object {
|
||||
"border": 0,
|
||||
"height": 1,
|
||||
"margin": -1,
|
||||
"overflow": "hidden",
|
||||
"padding": 0,
|
||||
"position": "absolute",
|
||||
"whiteSpace": "nowrap",
|
||||
"width": 1,
|
||||
}
|
||||
}
|
||||
>
|
||||
Set the max RU/s to the highest RU/s you want your container to scale to. The container will scale between 10% of max RU/s to the max RU/s based on usage.
|
||||
</div>
|
||||
</div>
|
||||
</TooltipHostBase>
|
||||
</StyledTooltipHostBase>
|
||||
@@ -1643,7 +1681,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
ariaLabel="Container max RU/s"
|
||||
errorMessage=""
|
||||
id="autoscaleRUValueField"
|
||||
key=".0:$.2"
|
||||
key=".0:$.$.2"
|
||||
max="9007199254740991"
|
||||
min={1000}
|
||||
onChange={[Function]}
|
||||
@@ -1953,18 +1991,18 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
value="4000"
|
||||
>
|
||||
<div
|
||||
className="ms-TextField is-required root-62"
|
||||
className="ms-TextField is-required root-119"
|
||||
>
|
||||
<div
|
||||
className="ms-TextField-wrapper"
|
||||
>
|
||||
<div
|
||||
className="ms-TextField-fieldGroup fieldGroup-63"
|
||||
className="ms-TextField-fieldGroup fieldGroup-120"
|
||||
>
|
||||
<input
|
||||
aria-invalid={false}
|
||||
aria-label="Container max RU/s"
|
||||
className="ms-TextField-field field-64"
|
||||
className="ms-TextField-field field-121"
|
||||
id="autoscaleRUValueField"
|
||||
max="9007199254740991"
|
||||
min={1000}
|
||||
@@ -1983,11 +2021,11 @@ exports[`ThroughputInput Pane should render Default properly 1`] = `
|
||||
</TextFieldBase>
|
||||
</StyledTextFieldBase>
|
||||
<Text
|
||||
key=".0:$.3"
|
||||
key=".0:$.$.3"
|
||||
variant="small"
|
||||
>
|
||||
<span
|
||||
className="css-54"
|
||||
className="css-110"
|
||||
>
|
||||
Your
|
||||
container
|
||||
|
||||
Reference in New Issue
Block a user