mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-01 07:11:23 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
56
src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx
Normal file
56
src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import * as React from "react";
|
||||
import { IconButton } from "office-ui-fabric-react/lib/Button";
|
||||
import { Spinner, SpinnerSize } from "office-ui-fabric-react/lib/Spinner";
|
||||
import "./Prompt.less";
|
||||
import { PassedPromptProps } from "./Prompt";
|
||||
|
||||
export const promptContent = (props: PassedPromptProps): JSX.Element => {
|
||||
if (props.status === "busy") {
|
||||
const stopButtonText: string = "Stop cell execution";
|
||||
return (
|
||||
<div
|
||||
style={{ position: "sticky", width: "100%", maxHeight: "100%", left: 0, top: 0, zIndex: 300 }}
|
||||
className={props.isHovered ? "" : "greyStopButton"}
|
||||
>
|
||||
<IconButton
|
||||
className="runCellButton"
|
||||
iconProps={{ iconName: "CircleStopSolid" }}
|
||||
title={stopButtonText}
|
||||
ariaLabel={stopButtonText}
|
||||
onClick={props.stopCell}
|
||||
style={{ position: "absolute" }}
|
||||
/>
|
||||
<Spinner size={SpinnerSize.large} style={{ position: "absolute", width: "100%", paddingTop: 5 }} />
|
||||
</div>
|
||||
);
|
||||
} else if (props.isHovered) {
|
||||
const playButtonText: string = "Run cell";
|
||||
return (
|
||||
<IconButton
|
||||
className="runCellButton"
|
||||
iconProps={{ iconName: "MSNVideosSolid" }}
|
||||
title={playButtonText}
|
||||
ariaLabel={playButtonText}
|
||||
onClick={props.runCell}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return <div style={{ paddingTop: 7 }}>{promptText(props)}</div>;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate what text goes inside the prompt based on the props to the prompt
|
||||
*/
|
||||
const promptText = (props: PassedPromptProps): string => {
|
||||
if (props.status === "busy") {
|
||||
return "[*]";
|
||||
}
|
||||
if (props.status === "queued") {
|
||||
return "[…]";
|
||||
}
|
||||
if (typeof props.executionCount === "number") {
|
||||
return `[${props.executionCount}]`;
|
||||
}
|
||||
return "[ ]";
|
||||
};
|
||||
Reference in New Issue
Block a user