Skip to content
Snippets Groups Projects
Commit 3d5bdd07 authored by Maxime Jacquemin's avatar Maxime Jacquemin Committed by Maxime Jacquemin
Browse files

[ivette] Handling unique callstack

parent 50ae0edf
No related branches found
No related tags found
No related merge requests found
...@@ -106,9 +106,7 @@ ...@@ -106,9 +106,7 @@
.eva-stmt { .eva-stmt {
color: var(--info-text); color: var(--info-text);
text-select: none;
font-weight: normal; font-weight: normal;
margin-left: 0.2em;
} }
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
...@@ -161,10 +159,6 @@ ...@@ -161,10 +159,6 @@
background-color: var(--background-alterning-even); background-color: var(--background-alterning-even);
} }
.eva-table tr:nth-child(3) {
font-style: italic;
}
.eva-table-alarm { .eva-table-alarm {
border-bottom: thin solid var(--border); border-bottom: thin solid var(--border);
} }
...@@ -195,6 +189,15 @@ ...@@ -195,6 +189,15 @@
background: var(--eva-probes-pinned-focused); background: var(--eva-probes-pinned-focused);
} }
.eva-header-after-both {
display: flex;
justify-content: center;
}
.eva-italic {
font-style: italic;
}
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* --- Table Callsite Boxes --- */ /* --- Table Callsite Boxes --- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
......
...@@ -381,9 +381,9 @@ function ProbeDescr(props: ProbeDescrProps): JSX.Element[] { ...@@ -381,9 +381,9 @@ function ProbeDescr(props: ProbeDescrProps): JSX.Element[] {
} }
const both = (): JSX.Element => const both = (): JSX.Element =>
<div style={{ display: 'flex', justifyContent: 'center' }}> <div className='eva-header-after-both'>
{'After '} {'After '}
<div style={{ color: 'var(--info-text)' }}>{'(Then|Else)'}</div> <div className='eva-stmt'>{'(Then|Else)'}</div>
</div>; </div>;
const elements: JSX.Element[] = []; const elements: JSX.Element[] = [];
...@@ -411,12 +411,13 @@ interface ProbeValuesProps { ...@@ -411,12 +411,13 @@ interface ProbeValuesProps {
status: MarkerStatus; status: MarkerStatus;
state: StateToDisplay; state: StateToDisplay;
addLoc: (loc: Location) => void; addLoc: (loc: Location) => void;
selectedClass?: string; isSelected: boolean;
summaryOnly: boolean;
// selectedClass?: string;
} }
function ProbeValues(props: ProbeValuesProps): Request<callstack, JSX.Element> { function ProbeValues(props: ProbeValuesProps): Request<callstack, JSX.Element> {
const { probe, summary, state, selectedClass = '', addLoc } = props; const { probe, summary, state, addLoc, isSelected, summaryOnly } = props;
const className = classes('eva-table-values', selectedClass);
const summaryStatus = getAlarmStatus(summary.vBefore?.alarms); const summaryStatus = getAlarmStatus(summary.vBefore?.alarms);
// Building common parts // Building common parts
...@@ -439,6 +440,9 @@ function ProbeValues(props: ProbeValuesProps): Request<callstack, JSX.Element> { ...@@ -439,6 +440,9 @@ function ProbeValues(props: ProbeValuesProps): Request<callstack, JSX.Element> {
return async (callstack: callstack): Promise<JSX.Element> => { return async (callstack: callstack): Promise<JSX.Element> => {
const evaluation = await probe.evaluate(callstack); const evaluation = await probe.evaluate(callstack);
const { vBefore, vAfter, vThen, vElse } = evaluation; const { vBefore, vAfter, vThen, vElse } = evaluation;
const selected = isSelected && callstack !== 'Summary' ? 'eva-focused' : '';
const font = summaryOnly && callstack === 'Summary' ? 'eva-italic' : '';
const className = classes('eva-table-values', selected, font);
function td(e: Values.evaluation): JSX.Element { function td(e: Values.evaluation): JSX.Element {
const status = getAlarmStatus(e.alarms); const status = getAlarmStatus(e.alarms);
const alarmClass = classes('eva-cell-alarms', `eva-alarm-${status}`); const alarmClass = classes('eva-cell-alarms', `eva-alarm-${status}`);
...@@ -447,15 +451,13 @@ function ProbeValues(props: ProbeValuesProps): Request<callstack, JSX.Element> { ...@@ -447,15 +451,13 @@ function ProbeValues(props: ProbeValuesProps): Request<callstack, JSX.Element> {
const align = e.value.includes('\n') ? 'left' : 'center'; const align = e.value.includes('\n') ? 'left' : 'center';
const alignClass = `eva-table-values-${align}`; const alignClass = `eva-table-values-${align}`;
const width = summaryStatus !== 'none' ? 'eva-table-values-alarms' : ''; const width = summaryStatus !== 'none' ? 'eva-table-values-alarms' : '';
const c = classes(className, alignClass, width);
return ( return (
<> <>
<td <td className={c} onContextMenu={onContextMenu(e)}>
className={classes(className, alignClass, width)}
onContextMenu={onContextMenu(e)}
>
<span >{e.value}</span> <span >{e.value}</span>
</td> </td>
<td className={classes('eva-table-alarm', selectedClass)}> <td className={classes('eva-table-alarm', selected)}>
<Icon className={alarmClass} size={10} title={title} id="WARNING" /> <Icon className={alarmClass} size={10} title={title} id="WARNING" />
</td> </td>
</> </>
...@@ -509,8 +511,9 @@ async function FunctionSection(props: FunctionProps): Promise<JSX.Element> { ...@@ -509,8 +511,9 @@ async function FunctionSection(props: FunctionProps): Promise<JSX.Element> {
/* Compute relevant callstacks */ /* Compute relevant callstacks */
const markers = Array.from(props.markers.keys()); const markers = Array.from(props.markers.keys());
const callstacks = byCallstacks ? (await getCS(markers) ?? []) : []; const callstacks = byCallstacks ? (await getCS(markers) ?? []) : [];
const summaryOnly = callstacks.length === 1;
interface Data { probe: Probe; summary: Evaluation; status: MarkerStatus }; interface Data { probe: Probe; summary: Evaluation; status: MarkerStatus }
const entries = Array.from(props.markers.entries()); const entries = Array.from(props.markers.entries());
const probes = await Promise.all(entries.map(async ([ target, status ]) => { const probes = await Promise.all(entries.map(async ([ target, status ]) => {
const probe = await props.getProbe({ target, fct }); const probe = await props.getProbe({ target, fct });
...@@ -532,15 +535,14 @@ async function FunctionSection(props: FunctionProps): Promise<JSX.Element> { ...@@ -532,15 +535,14 @@ async function FunctionSection(props: FunctionProps): Promise<JSX.Element> {
const onClick = (c: callstack): () => void => () => props.selectCallstack(c); const onClick = (c: callstack): () => void => () => props.selectCallstack(c);
function build(d: Data, c: callstack): Promise<JSX.Element> { function build(d: Data, c: callstack): Promise<JSX.Element> {
const isSelected = isSelectedCallstack(c); const isSelected = isSelectedCallstack(c);
const selector = isSelected && c !== 'Summary'; const valuesProps = { ...d, state, addLoc, isSelected, summaryOnly };
const selectedClass = selector ? 'eva-focused' : '';
const valuesProps = { ...d, state, addLoc, selectedClass };
return ProbeValues(valuesProps)(c); return ProbeValues(valuesProps)(c);
} }
const summary = await Promise.all(probes.map((d) => build(d, 'Summary'))); const summary = await Promise.all(probes.map((d) => build(d, 'Summary')));
const summCall = await CallsiteCell({ callstack: 'Summary', getCallsites }); const summCall = await CallsiteCell({ callstack: 'Summary', getCallsites });
const values = await Promise.all(callstacks.map(async (callstack, n) => { const values = await Promise.all(callstacks.map(async (callstack, n) => {
if (summaryOnly) return <></>;
const isSelected = isSelectedCallstack(callstack); const isSelected = isSelectedCallstack(callstack);
const selector = isSelected && callstack !== 'Summary'; const selector = isSelected && callstack !== 'Summary';
const selectedClass = selector ? 'eva-focused' : ''; const selectedClass = selector ? 'eva-focused' : '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment