Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight errors in stdout under Test mode #834

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ui/frontend/Output/Execute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import styles from './Execute.module.css';
const Execute: React.FC = () => {
const details = useSelector((state: State) => state.output.execute);
const isAutoBuild = useSelector(selectors.isAutoBuildSelector);
const isTest = useSelector(selectors.isTestPrimaryAction)

const dispatch = useDispatch();
const addMainFunction = useCallback(() => dispatch(actions.addMainFunction()), [dispatch]);

return (
<SimplePane {...details} kind="execute">
<SimplePane highlightStdOut={isTest} {...details} kind="execute">
{isAutoBuild && <Warning addMainFunction={addMainFunction} />}
</SimplePane>

Expand Down
5 changes: 4 additions & 1 deletion ui/frontend/Output/SimplePane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface SimplePaneProps extends ReallySimplePaneProps {

export interface ReallySimplePaneProps {
requestsInProgress: number;
highlightStdOut?: boolean
stdout?: string;
stderr?: string;
error?: string;
Expand All @@ -34,7 +35,9 @@ const SimplePane: React.FC<SimplePaneProps> = props => (
{(props.requestsInProgress > 0) && <Loader />}
<Section kind="error" label="Errors">{props.error}</Section>
<HighlightErrors label="Standard Error">{props.stderr}</HighlightErrors>
<Section kind="stdout" label="Standard Output">{props.stdout}</Section>
{props.highlightStdOut ?
<HighlightErrors label="Standard Output">{props.stdout}</HighlightErrors> :
<Section kind="stdout" label="Standard Output">{props.stdout}</Section>}
{props.children}
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions ui/frontend/selectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export const getCrateType = createSelector(

const rawPrimaryActionSelector = (state: State) => state.configuration.primaryAction;

export const isTestPrimaryAction = createSelector(
rawPrimaryActionSelector,
(primaryAction) => (primaryAction === PrimaryActionCore.Test),
)

export const isAutoBuildSelector = createSelector(
rawPrimaryActionSelector,
autoPrimaryActionSelector,
Expand Down