mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 10:51:30 +00:00
Compare commits
1 Commits
fixed-inpu
...
fixed-ts-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9593407677 |
@@ -1,7 +1,5 @@
|
||||
jest.mock("./MessageHandler");
|
||||
import { LogEntryLevel } from "../Contracts/Diagnostics";
|
||||
import * as Logger from "./Logger";
|
||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||
import { sendMessage } from "./MessageHandler";
|
||||
|
||||
describe("Logger", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { shallow } from "enzyme";
|
||||
import React from "react";
|
||||
import "../../../../externals/jquery.typeahead.min.js";
|
||||
import { shallow } from "enzyme";
|
||||
import { InputTypeaheadComponent, InputTypeaheadComponentProps } from "./InputTypeaheadComponent";
|
||||
import "../../../../externals/jquery.typeahead.min.js";
|
||||
|
||||
describe("inputTypeahead", () => {
|
||||
it("renders <input />", () => {
|
||||
@@ -12,12 +12,6 @@ describe("inputTypeahead", () => {
|
||||
],
|
||||
placeholder: "placeholder",
|
||||
useTextarea: false,
|
||||
onNewValue: () => {
|
||||
("");
|
||||
},
|
||||
submitFct: () => {
|
||||
("");
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = shallow(<InputTypeaheadComponent {...props} />);
|
||||
@@ -32,12 +26,6 @@ describe("inputTypeahead", () => {
|
||||
],
|
||||
placeholder: "placeholder",
|
||||
useTextarea: true,
|
||||
onNewValue: () => {
|
||||
("");
|
||||
},
|
||||
submitFct: () => {
|
||||
("");
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = shallow(<InputTypeaheadComponent {...props} />);
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface InputTypeaheadComponentProps {
|
||||
/**
|
||||
* The current string value of <input>
|
||||
*/
|
||||
onNewValue: (newValue?: string) => void;
|
||||
onNewValue?: (newValue: string) => void;
|
||||
// inputValue?:ko.Observable<string>;
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export interface InputTypeaheadComponentProps {
|
||||
/**
|
||||
* This function gets called when pressing ENTER on the input box
|
||||
*/
|
||||
submitFct?: (inputValue?: string, selection?: Item) => void;
|
||||
submitFct?: (inputValue: string, selection: Item) => void;
|
||||
|
||||
/**
|
||||
* Typehead comes with a Search button that we normally remove.
|
||||
@@ -76,7 +76,7 @@ export interface InputTypeaheadComponentProps {
|
||||
|
||||
interface InputTypeaheadComponentState {
|
||||
isSuggestionVisible: boolean;
|
||||
selectedChoice?: Item;
|
||||
selectedChoice: Item;
|
||||
filteredChoices: Item[];
|
||||
}
|
||||
|
||||
@@ -96,21 +96,21 @@ export class InputTypeaheadComponent extends React.Component<
|
||||
};
|
||||
}
|
||||
|
||||
private onRenderCell = (item?: Item): JSX.Element => {
|
||||
private onRenderCell = (item: Item): JSX.Element => {
|
||||
return (
|
||||
<div className="input-typeahead-chocies-container" onClick={() => this.onChoiceClick(item)}>
|
||||
<p className="choice-caption">{item?.caption}</p>
|
||||
<span>{item?.value}</span>
|
||||
<p className="choice-caption">{item.caption}</p>
|
||||
<span>{item.value}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
private onChoiceClick = (item?: Item): void => {
|
||||
this.props.onNewValue(item?.caption);
|
||||
private onChoiceClick = (item: Item): void => {
|
||||
this.props.onNewValue(item.caption);
|
||||
this.setState({ isSuggestionVisible: false, selectedChoice: item });
|
||||
};
|
||||
|
||||
private handleChange = (value?: string): void => {
|
||||
private handleChange = (value: string): void => {
|
||||
if (!value) {
|
||||
this.setState({ isSuggestionVisible: true });
|
||||
}
|
||||
@@ -130,7 +130,7 @@ export class InputTypeaheadComponent extends React.Component<
|
||||
}
|
||||
};
|
||||
|
||||
private filterChoiceByValue = (choices: Item[], searchKeyword?: string): Item[] => {
|
||||
private filterChoiceByValue = (choices: Item[], searchKeyword: string): Item[] => {
|
||||
return choices.filter((choice) =>
|
||||
// @ts-ignore
|
||||
Object.keys(choice).some((key) => choice[key].toLowerCase().includes(searchKeyword.toLowerCase()))
|
||||
@@ -138,7 +138,7 @@ export class InputTypeaheadComponent extends React.Component<
|
||||
};
|
||||
|
||||
public render(): JSX.Element {
|
||||
const { defaultValue, useTextarea, placeholder, onNewValue, submitFct } = this.props;
|
||||
const { defaultValue, useTextarea, placeholder, onNewValue } = this.props;
|
||||
const { isSuggestionVisible, selectedChoice, filteredChoices } = this.state;
|
||||
const theme = getTheme();
|
||||
|
||||
@@ -185,7 +185,7 @@ export class InputTypeaheadComponent extends React.Component<
|
||||
styles={iconButtonStyles}
|
||||
iconProps={searchIcon}
|
||||
ariaLabel="Search Button"
|
||||
onClick={() => submitFct && submitFct(defaultValue, selectedChoice)}
|
||||
onClick={() => this.props.submitFct(defaultValue, selectedChoice)}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { GraphData, GremlinVertex, GremlinEdge } from "./GraphData";
|
||||
import { GraphData, GremlinEdge, GremlinVertex } from "./GraphData";
|
||||
|
||||
describe("Graph Data", () => {
|
||||
it("should set only one node as root", () => {
|
||||
const graphData = new GraphData<GremlinVertex, GremlinEdge>();
|
||||
const v1: GremlinVertex = { id: "1", label: null };
|
||||
const v2: GremlinVertex = { id: "2", label: null };
|
||||
const v3: GremlinVertex = { id: "3", label: null };
|
||||
const v1: GremlinVertex = { id: "1", label: undefined };
|
||||
const v2: GremlinVertex = { id: "2", label: undefined };
|
||||
const v3: GremlinVertex = { id: "3", label: undefined };
|
||||
v3._isRoot = true;
|
||||
|
||||
graphData.addVertex(v1);
|
||||
@@ -28,9 +28,9 @@ describe("Graph Data", () => {
|
||||
|
||||
it("should properly find root id", () => {
|
||||
const graphData = new GraphData();
|
||||
const v1: GremlinVertex = { id: "1", label: null };
|
||||
const v2: GremlinVertex = { id: "2", label: null };
|
||||
const v3: GremlinVertex = { id: "3", label: null };
|
||||
const v1: GremlinVertex = { id: "1", label: undefined };
|
||||
const v2: GremlinVertex = { id: "2", label: undefined };
|
||||
const v3: GremlinVertex = { id: "3", label: undefined };
|
||||
|
||||
graphData.addVertex(v1);
|
||||
graphData.addVertex(v2);
|
||||
@@ -44,12 +44,12 @@ describe("Graph Data", () => {
|
||||
it("should remove edge from graph", () => {
|
||||
const graphData = new GraphData();
|
||||
|
||||
graphData.addVertex({ id: "v1", label: null });
|
||||
graphData.addVertex({ id: "v2", label: null });
|
||||
graphData.addVertex({ id: "v3", label: null });
|
||||
graphData.addVertex({ id: "v1", label: undefined });
|
||||
graphData.addVertex({ id: "v2", label: undefined });
|
||||
graphData.addVertex({ id: "v3", label: undefined });
|
||||
|
||||
graphData.addEdge({ id: "e1", inV: "v1", outV: "v2", label: null });
|
||||
graphData.addEdge({ id: "e2", inV: "v1", outV: "v3", label: null });
|
||||
graphData.addEdge({ id: "e1", inV: "v1", outV: "v2", label: "" });
|
||||
graphData.addEdge({ id: "e2", inV: "v1", outV: "v3", label: "" });
|
||||
|
||||
// in edge
|
||||
graphData.removeEdge("e1", false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SimulationLinkDatum, SimulationNodeDatum } from "d3";
|
||||
import _ from "underscore";
|
||||
import { SimulationNodeDatum, SimulationLinkDatum } from "d3";
|
||||
|
||||
export interface PaginationInfo {
|
||||
total: number;
|
||||
@@ -10,7 +10,7 @@ export interface PaginationInfo {
|
||||
|
||||
export interface GremlinVertex {
|
||||
id: string;
|
||||
label: string;
|
||||
label?: string;
|
||||
inE?: { [label: string]: GremlinShortInEdge[] };
|
||||
outE?: { [label: string]: GremlinShortOutEdge[] };
|
||||
properties?: { [propName: string]: GremlinProperty[] };
|
||||
|
||||
@@ -66,7 +66,7 @@ interface InitialProps {
|
||||
}
|
||||
|
||||
// Redux
|
||||
const makeMapStateToProps = (state: AppState, initialProps: InitialProps) => {
|
||||
const makeMapStateToProps = (_state: AppState, initialProps: InitialProps) => {
|
||||
const mapStateToProps = (state: AppState): StateProps => ({
|
||||
isNotebookUntrusted: NotebookUtil.isNotebookUntrusted(state, initialProps.contentRef),
|
||||
});
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"files": [
|
||||
"./src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx",
|
||||
"./src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.test.tsx",
|
||||
"./src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts",
|
||||
"./src/Common/Logger.test.ts",
|
||||
"./src/AuthType.ts",
|
||||
"./src/Bindings/ReactBindingHandler.ts",
|
||||
"./src/Common/ArrayHashMap.ts",
|
||||
@@ -57,6 +57,7 @@
|
||||
"./src/Explorer/Notebook/NotebookContentItem.ts",
|
||||
"./src/Explorer/Notebook/NotebookRenderer/AzureTheme.tsx",
|
||||
"./src/Explorer/Notebook/NotebookRenderer/Prompt.tsx",
|
||||
"./src/Explorer/Notebook/NotebookRenderer/PromptContent.test.tsx",
|
||||
"./src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx",
|
||||
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
||||
@@ -64,6 +65,7 @@
|
||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
||||
"./src/Explorer/Notebook/SecurityWarningBar/SecurityWarningBar.tsx",
|
||||
"./src/Explorer/OpenFullScreen.test.tsx",
|
||||
"./src/Explorer/OpenFullScreen.tsx",
|
||||
"./src/Explorer/Panes/PanelContainerComponent.test.tsx",
|
||||
@@ -84,10 +86,13 @@
|
||||
"./src/Explorer/Tree/AccessibleVerticalList.ts",
|
||||
"./src/GitHub/GitHubConnector.ts",
|
||||
"./src/HostedExplorerChildFrame.ts",
|
||||
"./src/Index.tsx",
|
||||
"./src/Platform/Hosted/Authorization.ts",
|
||||
"./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/HostedUtils.test.ts",
|
||||
"./src/Platform/Hosted/HostedUtils.ts",
|
||||
"./src/Platform/Hosted/extractFeatures.test.ts",
|
||||
@@ -131,17 +136,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/**/*",
|
||||
|
||||
Reference in New Issue
Block a user