mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-17 17:57:13 +00:00
Resolve more ESLint (#922)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
f8ab0a82e0
commit
e8d320e505
@ -83,9 +83,6 @@ src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts
|
||||||
# src/Explorer/Graph/GraphStyleComponent/GraphStyle.test.ts
|
|
||||||
# src/Explorer/Graph/GraphStyleComponent/GraphStyleComponent.ts
|
|
||||||
|
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts
|
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts
|
||||||
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts
|
src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts
|
||||||
src/Explorer/Menus/ContextMenu.ts
|
src/Explorer/Menus/ContextMenu.ts
|
||||||
@ -184,27 +181,9 @@ src/Utils/QueryUtils.test.ts
|
|||||||
src/applyExplorerBindings.ts
|
src/applyExplorerBindings.ts
|
||||||
src/global.d.ts
|
src/global.d.ts
|
||||||
src/setupTests.ts
|
src/setupTests.ts
|
||||||
src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx
|
|
||||||
src/Explorer/Controls/Accordion/AccordionComponent.tsx
|
|
||||||
src/Explorer/Controls/AccountSwitch/AccountSwitchComponent.test.tsx
|
|
||||||
src/Explorer/Controls/AccountSwitch/AccountSwitchComponent.tsx
|
|
||||||
src/Explorer/Controls/AccountSwitch/AccountSwitchComponentAdapter.tsx
|
|
||||||
src/Explorer/Controls/Arcadia/ArcadiaMenuPicker.tsx
|
|
||||||
src/Explorer/Controls/CollapsiblePanel/CollapsiblePanel.tsx
|
|
||||||
src/Explorer/Controls/CommandButton/CommandButtonComponent.tsx
|
|
||||||
src/Explorer/Controls/DialogReactComponent/DialogComponent.tsx
|
|
||||||
src/Explorer/Controls/DialogReactComponent/DialogComponentAdapter.tsx
|
|
||||||
src/Explorer/Controls/Directory/DefaultDirectoryDropdownComponent.test.tsx
|
|
||||||
src/Explorer/Controls/Directory/DefaultDirectoryDropdownComponent.tsx
|
|
||||||
src/Explorer/Controls/Directory/DirectoryComponentAdapter.tsx
|
|
||||||
src/Explorer/Controls/Directory/DirectoryListComponent.test.tsx
|
|
||||||
src/Explorer/Controls/Directory/DirectoryListComponent.tsx
|
|
||||||
src/Explorer/Controls/Editor/EditorReact.tsx
|
|
||||||
src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx
|
src/Explorer/Controls/InputTypeahead/InputTypeaheadComponent.tsx
|
||||||
src/Explorer/Controls/Notebook/NotebookTerminalComponent.test.tsx
|
src/Explorer/Controls/Notebook/NotebookTerminalComponent.test.tsx
|
||||||
src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx
|
src/Explorer/Controls/Notebook/NotebookTerminalComponent.tsx
|
||||||
src/Explorer/Controls/NotebookViewer/NotebookMetadataComponent.tsx
|
|
||||||
src/NotebookViewer/NotebookViewer.tsx
|
|
||||||
src/Explorer/Controls/NotebookViewer/NotebookViewerComponent.tsx
|
src/Explorer/Controls/NotebookViewer/NotebookViewerComponent.tsx
|
||||||
src/Explorer/Controls/TreeComponent/TreeComponent.tsx
|
src/Explorer/Controls/TreeComponent/TreeComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/EditorNodePropertiesComponent.test.tsx
|
||||||
@ -216,43 +195,20 @@ src/Explorer/Graph/GraphExplorerComponent/LeftPaneComponent.tsx
|
|||||||
src/Explorer/Graph/GraphExplorerComponent/MiddlePaneComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/MiddlePaneComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.test.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/NodePropertiesComponent.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/QueryContainerComponent.tsx
|
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNeighborsComponent.tsx
|
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.test.tsx
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
src/Explorer/Graph/GraphExplorerComponent/ReadOnlyNodePropertiesComponent.tsx
|
||||||
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
src/Explorer/Menus/CommandBar/CommandBarUtil.tsx
|
||||||
src/Explorer/Menus/NotificationConsole/NotificationConsoleComponent.test.tsx
|
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponent.tsx
|
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponentAdapter.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
|
src/Explorer/Notebook/NotebookComponent/NotebookComponentBootstrapper.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/VirtualCommandBarComponent.tsx
|
src/Explorer/Notebook/NotebookComponent/VirtualCommandBarComponent.tsx
|
||||||
src/Explorer/Notebook/NotebookComponent/contents/file/index.tsx
|
|
||||||
src/Explorer/Notebook/NotebookComponent/contents/file/text-file.tsx
|
|
||||||
src/Explorer/Notebook/NotebookComponent/contents/index.tsx
|
src/Explorer/Notebook/NotebookComponent/contents/index.tsx
|
||||||
src/Explorer/Notebook/NotebookRenderer/AzureTheme.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/NotebookReadOnlyRenderer.tsx
|
src/Explorer/Notebook/NotebookRenderer/NotebookReadOnlyRenderer.tsx
|
||||||
src/Explorer/Notebook/NotebookRenderer/NotebookRenderer.tsx
|
src/Explorer/Notebook/NotebookRenderer/NotebookRenderer.tsx
|
||||||
src/Explorer/Notebook/NotebookRenderer/Prompt.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/StatusBar.test.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/Toolbar.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/decorators/HoverableCell.tsx
|
|
||||||
src/Explorer/Notebook/NotebookRenderer/decorators/draggable/index.tsx
|
src/Explorer/Notebook/NotebookRenderer/decorators/draggable/index.tsx
|
||||||
src/Explorer/Notebook/NotebookRenderer/decorators/hijack-scroll/index.tsx
|
src/Explorer/Notebook/NotebookRenderer/decorators/hijack-scroll/index.tsx
|
||||||
src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/index.tsx
|
src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/index.tsx
|
||||||
src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx
|
src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx
|
||||||
src/Explorer/Notebook/temp/inputs/editor.tsx
|
|
||||||
src/Explorer/Notebook/temp/markdown-cell.tsx
|
|
||||||
src/Explorer/Notebook/temp/source.tsx
|
|
||||||
src/Explorer/Notebook/temp/syntax-highlighter/index.tsx
|
|
||||||
src/Explorer/SplashScreen/SplashScreen.tsx
|
src/Explorer/SplashScreen/SplashScreen.tsx
|
||||||
src/Explorer/Tabs/GalleryTab.tsx
|
|
||||||
src/Explorer/Tabs/NotebookViewerTab.tsx
|
|
||||||
src/Explorer/Tabs/TerminalTab.tsx
|
|
||||||
src/Explorer/Tree/ResourceTreeAdapter.tsx
|
src/Explorer/Tree/ResourceTreeAdapter.tsx
|
||||||
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.tsx
|
|
||||||
__mocks__/monaco-editor.ts
|
__mocks__/monaco-editor.ts
|
||||||
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx
|
@ -8,7 +8,9 @@ import TriangleDownIcon from "../../../../images/Triangle-down.svg";
|
|||||||
import TriangleRightIcon from "../../../../images/Triangle-right.svg";
|
import TriangleRightIcon from "../../../../images/Triangle-right.svg";
|
||||||
import * as Constants from "../../../Common/Constants";
|
import * as Constants from "../../../Common/Constants";
|
||||||
|
|
||||||
export interface AccordionComponentProps {}
|
export interface AccordionComponentProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
export class AccordionComponent extends React.Component<AccordionComponentProps> {
|
export class AccordionComponent extends React.Component<AccordionComponentProps> {
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
@ -78,7 +80,7 @@ export class AccordionItemComponent extends React.Component<AccordionItemCompone
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onHeaderClick = (_event: React.MouseEvent<HTMLDivElement>): void => {
|
private onHeaderClick = (): void => {
|
||||||
this.setState({ isExpanded: !this.state.isExpanded });
|
this.setState({ isExpanded: !this.state.isExpanded });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -121,8 +121,7 @@ export class CommandButtonComponent extends React.Component<CommandButtonCompone
|
|||||||
if (!this.dropdownElt || !this.expandButtonElt) {
|
if (!this.dropdownElt || !this.expandButtonElt) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$(this.dropdownElt).offset({ left: $(this.expandButtonElt).offset().left });
|
||||||
const dropdownElt = $(this.dropdownElt).offset({ left: $(this.expandButtonElt).offset().left });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private onKeyPress(event: React.KeyboardEvent): boolean {
|
private onKeyPress(event: React.KeyboardEvent): boolean {
|
||||||
|
@ -56,7 +56,7 @@ export class EditorReact extends React.Component<EditorReactProps, EditorReactSt
|
|||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
const queryEditorModel = this.editor.getModel();
|
const queryEditorModel = this.editor.getModel();
|
||||||
if (!this.props.isReadOnly && this.props.onContentChanged) {
|
if (!this.props.isReadOnly && this.props.onContentChanged) {
|
||||||
queryEditorModel.onDidChangeContent((e: monaco.editor.IModelContentChangedEvent) => {
|
queryEditorModel.onDidChangeContent(() => {
|
||||||
const queryEditorModel = this.editor.getModel();
|
const queryEditorModel = this.editor.getModel();
|
||||||
this.props.onContentChanged(queryEditorModel.getValue());
|
this.props.onContentChanged(queryEditorModel.getValue());
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent";
|
|
||||||
import CloseIcon from "../../../../images/close-black.svg";
|
import CloseIcon from "../../../../images/close-black.svg";
|
||||||
|
import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent";
|
||||||
|
|
||||||
export interface QueryContainerComponentProps {
|
export interface QueryContainerComponentProps {
|
||||||
initialQuery: string;
|
initialQuery: string;
|
||||||
@ -82,7 +82,7 @@ export class QueryContainerComponent extends React.Component<
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="filterbtnstyle queryButton"
|
className="filterbtnstyle queryButton"
|
||||||
onClick={(e) => this.props.onExecuteClick(this.state.query)}
|
onClick={() => this.props.onExecuteClick(this.state.query)}
|
||||||
disabled={this.props.isLoading || !QueryContainerComponent.isQueryValid(this.state.query)}
|
disabled={this.props.isLoading || !QueryContainerComponent.isQueryValid(this.state.query)}
|
||||||
>
|
>
|
||||||
Execute Gremlin Query
|
Execute Gremlin Query
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement";
|
||||||
import { GraphHighlightedNodeData, NeighborVertexBasicInfo } from "./GraphExplorer";
|
import { GraphHighlightedNodeData, NeighborVertexBasicInfo } from "./GraphExplorer";
|
||||||
import * as GraphUtil from "./GraphUtil";
|
import * as GraphUtil from "./GraphUtil";
|
||||||
import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement";
|
|
||||||
|
|
||||||
export interface ReadOnlyNeighborsComponentProps {
|
export interface ReadOnlyNeighborsComponentProps {
|
||||||
node: GraphHighlightedNodeData;
|
node: GraphHighlightedNodeData;
|
||||||
@ -48,7 +48,7 @@ export class ReadOnlyNeighborsComponent extends React.Component<ReadOnlyNeighbor
|
|||||||
className="clickableLink"
|
className="clickableLink"
|
||||||
as="a"
|
as="a"
|
||||||
aria-label={_neighbor.name}
|
aria-label={_neighbor.name}
|
||||||
onActivated={(e) => this.props.selectNode(_neighbor.id)}
|
onActivated={() => this.props.selectNode(_neighbor.id)}
|
||||||
title={GraphUtil.getNeighborTitle(_neighbor)}
|
title={GraphUtil.getNeighborTitle(_neighbor)}
|
||||||
>
|
>
|
||||||
{_neighbor.name}
|
{_neighbor.name}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { GraphHighlightedNodeData } from "./GraphExplorer";
|
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
|
import { GraphHighlightedNodeData } from "./GraphExplorer";
|
||||||
|
|
||||||
export interface ReadOnlyNodePropertiesComponentProps {
|
export interface ReadOnlyNodePropertiesComponentProps {
|
||||||
node: GraphHighlightedNodeData;
|
node: GraphHighlightedNodeData;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as React from "react";
|
|
||||||
import { AppState, ContentRef, selectors } from "@nteract/core";
|
import { AppState, ContentRef, selectors } from "@nteract/core";
|
||||||
|
import * as React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import * as NteractUtil from "../NTeractUtil";
|
import * as NteractUtil from "../NTeractUtil";
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { AppState, ContentRef, selectors } from "@nteract/core";
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import NotebookRenderer from "../../../NotebookRenderer/NotebookRenderer";
|
import NotebookRenderer from "../../../NotebookRenderer/NotebookRenderer";
|
||||||
import * as TextFile from "./text-file";
|
import * as TextFile from "./text-file";
|
||||||
|
|
||||||
@ -32,14 +31,14 @@ interface FileProps {
|
|||||||
|
|
||||||
export class File extends React.PureComponent<FileProps> {
|
export class File extends React.PureComponent<FileProps> {
|
||||||
getChoice = () => {
|
getChoice = () => {
|
||||||
let choice = null;
|
let choice;
|
||||||
|
|
||||||
// notebooks don't report a mimetype so we'll use the content.type
|
// notebooks don't report a mimetype so we'll use the content.type
|
||||||
if (this.props.type === "notebook") {
|
if (this.props.type === "notebook") {
|
||||||
choice = <NotebookRenderer contentRef={this.props.contentRef} />;
|
choice = <NotebookRenderer contentRef={this.props.contentRef} />;
|
||||||
} else if (this.props.type === "dummy") {
|
} else if (this.props.type === "dummy") {
|
||||||
choice = null;
|
choice = undefined;
|
||||||
} else if (this.props.mimetype == null || !TextFile.handles(this.props.mimetype)) {
|
} else if (this.props.mimetype === undefined || !TextFile.handles(this.props.mimetype)) {
|
||||||
// This should not happen as we intercept mimetype upstream, but just in case
|
// This should not happen as we intercept mimetype upstream, but just in case
|
||||||
choice = (
|
choice = (
|
||||||
<PaddedContainer>
|
<PaddedContainer>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import * as StringUtils from "../../../../../Utils/StringUtils";
|
|
||||||
import { actions, AppState, ContentRef, selectors } from "@nteract/core";
|
import { actions, AppState, ContentRef, selectors } from "@nteract/core";
|
||||||
import { IMonacoProps as MonacoEditorProps } from "@nteract/monaco-editor";
|
import { IMonacoProps as MonacoEditorProps } from "@nteract/monaco-editor";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Dispatch } from "redux";
|
import { Dispatch } from "redux";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
import * as StringUtils from "../../../../../Utils/StringUtils";
|
||||||
|
|
||||||
const EditorContainer = styled.div`
|
const EditorContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -37,7 +37,7 @@ interface TextFileState {
|
|||||||
class EditorPlaceholder extends React.PureComponent<MonacoEditorProps> {
|
class EditorPlaceholder extends React.PureComponent<MonacoEditorProps> {
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
// TODO: Show a little blocky placeholder
|
// TODO: Show a little blocky placeholder
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ function makeMapStateToTextFileProps(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
contentRef,
|
contentRef,
|
||||||
mimetype: content.mimetype != null ? content.mimetype : "text/plain",
|
mimetype: content.mimetype !== undefined ? content.mimetype : "text/plain",
|
||||||
text,
|
text,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@ import "./Prompt.less";
|
|||||||
|
|
||||||
export const promptContent = (props: PassedPromptProps): JSX.Element => {
|
export const promptContent = (props: PassedPromptProps): JSX.Element => {
|
||||||
if (props.status === "busy") {
|
if (props.status === "busy") {
|
||||||
const stopButtonText: string = "Stop cell execution";
|
const stopButtonText = "Stop cell execution";
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ position: "sticky", width: "100%", maxHeight: "100%", left: 0, top: 0, zIndex: 300 }}
|
style={{ position: "sticky", width: "100%", maxHeight: "100%", left: 0, top: 0, zIndex: 300 }}
|
||||||
@ -23,7 +23,7 @@ export const promptContent = (props: PassedPromptProps): JSX.Element => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (props.isHovered) {
|
} else if (props.isHovered) {
|
||||||
const playButtonText: string = "Run cell";
|
const playButtonText = "Run cell";
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
className="runCellButton"
|
className="runCellButton"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { StatusBar } from "./StatusBar";
|
import { StatusBar } from "./StatusBar";
|
||||||
|
|
||||||
describe("StatusBar", () => {
|
describe("StatusBar", () => {
|
||||||
@ -28,8 +27,8 @@ describe("StatusBar", () => {
|
|||||||
kernelSpecDisplayName: "javascript",
|
kernelSpecDisplayName: "javascript",
|
||||||
kernelStatus: "kernelStatus",
|
kernelStatus: "kernelStatus",
|
||||||
},
|
},
|
||||||
null,
|
undefined,
|
||||||
null
|
undefined
|
||||||
);
|
);
|
||||||
expect(shouldUpdate).toBe(true);
|
expect(shouldUpdate).toBe(true);
|
||||||
});
|
});
|
||||||
@ -47,8 +46,8 @@ describe("StatusBar", () => {
|
|||||||
kernelSpecDisplayName: "python3",
|
kernelSpecDisplayName: "python3",
|
||||||
kernelStatus: "kernelStatus",
|
kernelStatus: "kernelStatus",
|
||||||
},
|
},
|
||||||
null,
|
undefined,
|
||||||
null
|
undefined
|
||||||
);
|
);
|
||||||
expect(shouldUpdate).toBe(true);
|
expect(shouldUpdate).toBe(true);
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,7 @@ import { AppState, ContentRef, selectors } from "@nteract/core";
|
|||||||
import distanceInWordsToNow from "date-fns/distance_in_words_to_now";
|
import distanceInWordsToNow from "date-fns/distance_in_words_to_now";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import styled from "styled-components";
|
||||||
import { StyleConstants } from "../../../Common/Constants";
|
import { StyleConstants } from "../../../Common/Constants";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -12,8 +13,6 @@ interface Props {
|
|||||||
|
|
||||||
const NOT_CONNECTED = "not connected";
|
const NOT_CONNECTED = "not connected";
|
||||||
|
|
||||||
import styled from "styled-components";
|
|
||||||
|
|
||||||
export const LeftStatus = styled.div`
|
export const LeftStatus = styled.div`
|
||||||
float: left;
|
float: left;
|
||||||
display: block;
|
display: block;
|
||||||
@ -90,26 +89,26 @@ const makeMapStateToProps = (initialState: AppState, initialProps: InitialProps)
|
|||||||
return {
|
return {
|
||||||
kernelStatus: NOT_CONNECTED,
|
kernelStatus: NOT_CONNECTED,
|
||||||
kernelSpecDisplayName: "no kernel",
|
kernelSpecDisplayName: "no kernel",
|
||||||
lastSaved: null,
|
lastSaved: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const kernelRef = content.model.kernelRef;
|
const kernelRef = content.model.kernelRef;
|
||||||
let kernel = null;
|
let kernel;
|
||||||
if (kernelRef) {
|
if (kernelRef) {
|
||||||
kernel = selectors.kernel(state, { kernelRef });
|
kernel = selectors.kernel(state, { kernelRef });
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastSaved = content && content.lastSaved ? content.lastSaved : null;
|
const lastSaved = content && content.lastSaved ? content.lastSaved : undefined;
|
||||||
|
|
||||||
const kernelStatus = kernel != null && kernel.status != null ? kernel.status : NOT_CONNECTED;
|
const kernelStatus = kernel !== undefined && kernel.status !== undefined ? kernel.status : NOT_CONNECTED;
|
||||||
|
|
||||||
// TODO: We need kernels associated to the kernelspec they came from
|
// TODO: We need kernels associated to the kernelspec they came from
|
||||||
// so we can pluck off the display_name and provide it here
|
// so we can pluck off the display_name and provide it here
|
||||||
let kernelSpecDisplayName = " ";
|
let kernelSpecDisplayName = " ";
|
||||||
if (kernelStatus === NOT_CONNECTED) {
|
if (kernelStatus === NOT_CONNECTED) {
|
||||||
kernelSpecDisplayName = "no kernel";
|
kernelSpecDisplayName = "no kernel";
|
||||||
} else if (kernel != null && kernel.kernelSpecName != null) {
|
} else if (kernel !== undefined && kernel.kernelSpecName !== undefined) {
|
||||||
kernelSpecDisplayName = kernel.kernelSpecName;
|
kernelSpecDisplayName = kernel.kernelSpecName;
|
||||||
} else if (content && content.type === "notebook") {
|
} else if (content && content.type === "notebook") {
|
||||||
kernelSpecDisplayName = selectors.notebook.displayName(content.model) || " ";
|
kernelSpecDisplayName = selectors.notebook.displayName(content.model) || " ";
|
||||||
|
@ -27,7 +27,7 @@ interface DispatchProps {
|
|||||||
moveCell: (destinationId: CellId, above: boolean) => void;
|
moveCell: (destinationId: CellId, above: boolean) => void;
|
||||||
clearOutputs: () => void;
|
clearOutputs: () => void;
|
||||||
deleteCell: () => void;
|
deleteCell: () => void;
|
||||||
traceNotebookTelemetry: (action: Action, actionModifier?: string, data?: any) => void;
|
traceNotebookTelemetry: (action: Action, actionModifier?: string, data?: string) => void;
|
||||||
takeNotebookSnapshot: (payload: SnapshotRequest) => void;
|
takeNotebookSnapshot: (payload: SnapshotRequest) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ const mapDispatchToProps = (
|
|||||||
dispatch(actions.moveCell({ id, contentRef, destinationId, above })),
|
dispatch(actions.moveCell({ id, contentRef, destinationId, above })),
|
||||||
clearOutputs: () => dispatch(actions.clearOutputs({ id, contentRef })),
|
clearOutputs: () => dispatch(actions.clearOutputs({ id, contentRef })),
|
||||||
deleteCell: () => dispatch(actions.deleteCell({ id, contentRef })),
|
deleteCell: () => dispatch(actions.deleteCell({ id, contentRef })),
|
||||||
traceNotebookTelemetry: (action: Action, actionModifier?: string, data?: any) =>
|
traceNotebookTelemetry: (action: Action, actionModifier?: string, data?: string) =>
|
||||||
dispatch(cdbActions.traceNotebookTelemetry({ action, actionModifier, data })),
|
dispatch(cdbActions.traceNotebookTelemetry({ action, actionModifier, data })),
|
||||||
takeNotebookSnapshot: (request: SnapshotRequest) => dispatch(cdbActions.takeNotebookSnapshot(request)),
|
takeNotebookSnapshot: (request: SnapshotRequest) => dispatch(cdbActions.takeNotebookSnapshot(request)),
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
import { ContentRef } from "@nteract/core";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Dispatch } from "redux";
|
import { Dispatch } from "redux";
|
||||||
|
|
||||||
import { ContentRef } from "@nteract/core";
|
|
||||||
import * as actions from "../../NotebookComponent/actions";
|
import * as actions from "../../NotebookComponent/actions";
|
||||||
|
|
||||||
interface ComponentProps {
|
interface ComponentProps {
|
||||||
@ -29,10 +28,7 @@ class HoverableCell extends React.Component<ComponentProps & DispatchProps> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = (
|
const mapDispatchToProps = (dispatch: Dispatch, { id }: { id: string }): DispatchProps => ({
|
||||||
dispatch: Dispatch,
|
|
||||||
{ id, contentRef }: { id: string; contentRef: ContentRef }
|
|
||||||
): DispatchProps => ({
|
|
||||||
hover: () => dispatch(actions.setHoveredCell({ cellId: id })),
|
hover: () => dispatch(actions.setHoveredCell({ cellId: id })),
|
||||||
unHover: () => dispatch(actions.setHoveredCell({ cellId: undefined })),
|
unHover: () => dispatch(actions.setHoveredCell({ cellId: undefined })),
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user