Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
59419657
Commit
59419657
authored
2 years ago
by
David Bühler
Committed by
Valentin Perrelle
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Ivette] Eva state component: global state for the selected domain.
parent
6916be94
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ivette/src/frama-c/plugins/eva/DomainStates.tsx
+7
-4
7 additions, 4 deletions
ivette/src/frama-c/plugins/eva/DomainStates.tsx
with
7 additions
and
4 deletions
ivette/src/frama-c/plugins/eva/DomainStates.tsx
+
7
−
4
View file @
59419657
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
*
as
Ivette
from
'
ivette
'
;
import
*
as
Ivette
from
'
ivette
'
;
import
*
as
States
from
'
frama-c/states
'
;
import
*
as
States
from
'
frama-c/states
'
;
import
{
GlobalState
,
useGlobalState
}
from
'
dome/data/states
'
;
import
*
as
Eva
from
'
frama-c/plugins/eva/api/general
'
;
import
*
as
Eva
from
'
frama-c/plugins/eva/api/general
'
;
import
*
as
Boxes
from
'
dome/layout/boxes
'
;
import
*
as
Boxes
from
'
dome/layout/boxes
'
;
import
{
HSplit
}
from
'
dome/layout/splitters
'
;
import
{
HSplit
}
from
'
dome/layout/splitters
'
;
...
@@ -31,13 +32,15 @@ import { Text } from 'frama-c/richtext';
...
@@ -31,13 +32,15 @@ import { Text } from 'frama-c/richtext';
import
{
Select
}
from
'
dome/controls/buttons
'
;
import
{
Select
}
from
'
dome/controls/buttons
'
;
import
{
Label
}
from
'
dome/controls/labels
'
;
import
{
Label
}
from
'
dome/controls/labels
'
;
const
globalSelectedDomain
=
new
GlobalState
<
string
>
(
""
);
export
function
EvaStates
():
JSX
.
Element
{
export
function
EvaStates
():
JSX
.
Element
{
const
[
selection
]
=
States
.
useSelection
();
const
[
selection
]
=
States
.
useSelection
();
const
selectedLoc
=
selection
?.
current
;
const
selectedLoc
=
selection
?.
current
;
const
marker
=
selectedLoc
?.
marker
;
const
marker
=
selectedLoc
?.
marker
;
const
states
=
States
.
useRequest
(
Eva
.
getStates
,
marker
);
const
states
=
States
.
useRequest
(
Eva
.
getStates
,
marker
);
const
[
domains
,
setDomains
]
=
React
.
useState
<
string
[]
>
([]);
const
[
domains
,
setDomains
]
=
React
.
useState
<
string
[]
>
([]);
const
[
selected
,
setSelected
]
=
React
.
useState
<
string
>
(
);
const
[
selected
,
setSelected
]
=
useGlobalState
(
globalSelectedDomain
);
const
[
stateBefore
,
setStateBefore
]
=
React
.
useState
(
""
);
const
[
stateBefore
,
setStateBefore
]
=
React
.
useState
(
""
);
const
[
stateAfter
,
setStateAfter
]
=
React
.
useState
(
""
);
const
[
stateAfter
,
setStateAfter
]
=
React
.
useState
(
""
);
...
@@ -45,7 +48,7 @@ export function EvaStates(): JSX.Element {
...
@@ -45,7 +48,7 @@ export function EvaStates(): JSX.Element {
if
(
states
&&
states
.
length
>
0
)
{
if
(
states
&&
states
.
length
>
0
)
{
const
names
=
states
.
map
((
d
)
=>
d
[
0
]);
const
names
=
states
.
map
((
d
)
=>
d
[
0
]);
setDomains
(
names
);
setDomains
(
names
);
if
(
!
selected
||
!
names
.
includes
(
selected
))
if
(
!
names
.
includes
(
selected
))
setSelected
(
names
[
0
]);
setSelected
(
names
[
0
]);
const
selectedDomain
=
states
.
find
((
d
)
=>
d
[
0
]
===
selected
);
const
selectedDomain
=
states
.
find
((
d
)
=>
d
[
0
]
===
selected
);
if
(
selectedDomain
)
{
if
(
selectedDomain
)
{
...
@@ -54,7 +57,7 @@ export function EvaStates(): JSX.Element {
...
@@ -54,7 +57,7 @@ export function EvaStates(): JSX.Element {
}
}
}
else
}
else
setDomains
([]);
setDomains
([]);
},
[
states
,
selected
]);
},
[
states
,
selected
,
setSelected
]);
if
(
domains
.
length
===
0
)
if
(
domains
.
length
===
0
)
return
(<></>);
return
(<></>);
...
@@ -71,7 +74,7 @@ export function EvaStates(): JSX.Element {
...
@@ -71,7 +74,7 @@ export function EvaStates(): JSX.Element {
<
Select
<
Select
title
=
"Select the analysis domain to be shown"
title
=
"Select the analysis domain to be shown"
value
=
{
selected
}
value
=
{
selected
}
onChange
=
{
setSelected
}
onChange
=
{
(
domain
)
=>
setSelected
(
domain
??
""
)
}
>
>
{
list
}
{
list
}
</
Select
>
</
Select
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment