From bb3f1dbc99f0e3c8eeffd3fa22d34d15ffbe02c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Fri, 18 Dec 2020 17:13:29 +0100
Subject: [PATCH] [ivette/eva] alarms icon in cells

---
 ivette/src/frama-c/eva/Values.tsx | 17 ++++++++++++-----
 ivette/src/frama-c/eva/style.css  |  8 ++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/ivette/src/frama-c/eva/Values.tsx b/ivette/src/frama-c/eva/Values.tsx
index b2293d91b2a..3392392807d 100644
--- a/ivette/src/frama-c/eva/Values.tsx
+++ b/ivette/src/frama-c/eva/Values.tsx
@@ -8,6 +8,7 @@ import * as Dome from 'dome';
 import { classes } from 'dome/misc/utils';
 import { VariableSizeList } from 'react-window';
 import { Vfill, Hpack, Filler } from 'dome/layout/boxes';
+import { Icon } from 'dome/controls/icons';
 import { Label, Code } from 'dome/controls/labels';
 import { IconButton } from 'dome/controls/buttons';
 import { ButtonGroup, Button } from 'dome/frame/toolbars';
@@ -232,6 +233,7 @@ function TableCell(props: TableCellProps) {
           probe.stmt,
           callstack,
         );
+        const { alarms = [] } = domain;
         const { vstate: s, effects, condition } = probe;
         const text = valueAt(domain, s) ?? '';
         const diff = diffAfter(domain, effects, s);
@@ -239,11 +241,16 @@ function TableCell(props: TableCellProps) {
         const diffB = diffElse(domain, condition, s);
         const { cols, rows } = sizeof(text);
         contents = (
-          <SizedArea cols={cols} rows={rows}>
-            <span className={`eva-state-${s}`}>
-              <Diff text={text} diff={diff} diffA={diffA} diffB={diffB} />
-            </span>
-          </SizedArea>
+          <>
+            {alarms.length > 0 && (
+              <Icon className="eva-cell-alarms" size={10} id='WARNING' />
+            )}
+            <SizedArea cols={cols} rows={rows}>
+              <span className={`eva-state-${s}`}>
+                <Diff text={text} diff={diff} diffA={diffA} diffB={diffB} />
+              </span>
+            </SizedArea>
+          </>
         );
       }
       break;
diff --git a/ivette/src/frama-c/eva/style.css b/ivette/src/frama-c/eva/style.css
index dfa4086596e..81387ed81fb 100644
--- a/ivette/src/frama-c/eva/style.css
+++ b/ivette/src/frama-c/eva/style.css
@@ -144,6 +144,14 @@
 .eva-state-Then .eva-diff { background: green; }
 .eva-state-Else .eva-diff { background: orange; }
 
+.eva-cell-alarms {
+    fill: red;
+    position: absolute;
+    top: -1px;
+    right: 3px;
+    z-index: 1;
+}
+
 /* -------------------------------------------------------------------------- */
 /* --- Table Rows Background                                              --- */
 /* -------------------------------------------------------------------------- */
-- 
GitLab