Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
LaVizu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
behaviors-ai-public
LaVizu
Commits
18783c36
Commit
18783c36
authored
Jul 02, 2019
by
Dorian Goepp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move LatestInteraction to its own file (cleaning refactor)
parent
86fcd411
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
67 deletions
+67
-67
src/LatestInteraction/DemoLatestInteraction.js
src/LatestInteraction/DemoLatestInteraction.js
+1
-1
src/LatestInteraction/LatestInteraction.js
src/LatestInteraction/LatestInteraction.js
+65
-0
src/LatestInteraction/RosLastestInteraction.js
src/LatestInteraction/RosLastestInteraction.js
+1
-1
src/LatestInteraction/index.js
src/LatestInteraction/index.js
+0
-65
No files found.
src/LatestInteraction/DemoLatestInteraction.js
View file @
18783c36
import
React
from
'
react
'
import
{
LatestInteraction
}
from
'
./
index
'
import
{
LatestInteraction
}
from
'
./
LatestInteraction
'
export
function
DemoLatestInteraction
(
props
)
{
const
intended
=
{
action_names
:
[
"
A
"
,
"
A
"
,
"
B
"
,
"
C
"
],
primitive_valences
:[
1
,
2
,
3
,
4
]};
...
...
src/LatestInteraction/LatestInteraction.js
0 → 100644
View file @
18783c36
import
React
from
'
react
'
import
{
observer
}
from
'
mobx-react
'
import
{
actionClassName
}
from
'
../utils/valenceColours
'
;
export
const
LatestInteraction
=
observer
(
function
LatestInteraction
(
props
)
{
let
intended
,
enacted
;
let
iteration
=
null
;
if
(
'
int-trace
'
in
props
.
store
.
components
&&
props
.
store
.
components
[
'
int-trace
'
].
showInteraction
)
{
intended
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
intended
;
enacted
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
enacted
;
const
iteration_id
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
id
;
iteration
=
[
<
p
key
=
"
first
"
><
span
className
=
"
label
"
>
Iteration
:
<
/span> {iteration_id}</
p
>
,
<
hr
key
=
"
last
"
/>
];
}
else
{
intended
=
props
.
intended
;
enacted
=
props
.
enacted
;
}
/**
* Return the
* @param {Object} inter object representing the interaction to display (either intended or enacted)
* @param {Number} i index of primitive action which row this is makeing
*/
function
inter2row
(
inter
,
length
,
i
)
{
if
(
i
<
length
)
{
return
(
<
td
className
=
{
actionClassName
(
inter
.
primitive_valences
[
i
])}
>
{
inter
.
action_names
[
i
]}
({
inter
.
primitive_valences
[
i
]})
<
/td>
)
;
}
else
{
return
null
;
}
}
const
length_i
=
intended
.
action_names
.
length
,
length_e
=
enacted
.
action_names
.
length
;
let
rows
=
[];
for
(
let
i
=
0
;
i
<
Math
.
max
(
length_i
,
length_e
);
i
++
)
{
rows
.
push
(
<
tr
key
=
{
i
}
>
{
inter2row
(
intended
,
length_i
,
i
)}
{
inter2row
(
enacted
,
length_e
,
i
)}
<
/tr
>
);
}
return
(
<
div
className
=
"
latest-interaction
"
>
{
iteration
}
<
table
>
<
thead
>
<
tr
>
<
th
className
=
"
label
"
>
Intended
<
/th
>
<
th
className
=
"
label
"
>
Enacted
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
rows
}
<
/tbody
>
<
/table
>
<
/div
>
);
}
)
\ No newline at end of file
src/LatestInteraction/RosLastestInteraction.js
View file @
18783c36
...
...
@@ -2,7 +2,7 @@ import React, {Component} from 'react'
import
RosLib
from
'
roslib
'
import
{
Modal
}
from
'
../utils/modeHandler
'
import
{
LatestInteraction
}
from
'
./
index
'
import
{
LatestInteraction
}
from
'
./
LatestInteraction
'
class
RosLatestInteraction
extends
Component
{
constructor
(
props
)
{
...
...
src/LatestInteraction/index.js
View file @
18783c36
import
React
from
'
react
'
import
{
observer
}
from
'
mobx-react
'
import
'
./LatestInteraction.css
'
import
{
actionClassName
}
from
'
../utils/valenceColours
'
;
export
const
LatestInteraction
=
observer
(
function
LatestInteraction
(
props
)
{
let
intended
,
enacted
;
let
iteration
=
null
;
if
(
'
int-trace
'
in
props
.
store
.
components
&&
props
.
store
.
components
[
'
int-trace
'
].
showInteraction
)
{
intended
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
intended
;
enacted
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
enacted
;
const
iteration_id
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
id
;
iteration
=
[
<
p
key
=
"
first
"
><
span
className
=
"
label
"
>
Iteration
:
<
/span> {iteration_id}</
p
>
,
<
hr
key
=
"
last
"
/>
];
}
else
{
intended
=
props
.
intended
;
enacted
=
props
.
enacted
;
}
/**
* Return the
* @param {Object} inter object representing the interaction to display (either intended or enacted)
* @param {Number} i index of primitive action which row this is makeing
*/
function
inter2row
(
inter
,
length
,
i
)
{
if
(
i
<
length
)
{
return
(
<
td
className
=
{
actionClassName
(
inter
.
primitive_valences
[
i
])}
>
{
inter
.
action_names
[
i
]}
({
inter
.
primitive_valences
[
i
]})
<
/td>
)
;
}
else
{
return
null
;
}
}
const
length_i
=
intended
.
action_names
.
length
,
length_e
=
enacted
.
action_names
.
length
;
let
rows
=
[];
for
(
let
i
=
0
;
i
<
Math
.
max
(
length_i
,
length_e
);
i
++
)
{
rows
.
push
(
<
tr
key
=
{
i
}
>
{
inter2row
(
intended
,
length_i
,
i
)}
{
inter2row
(
enacted
,
length_e
,
i
)}
<
/tr
>
);
}
return
(
<
div
className
=
"
latest-interaction
"
>
{
iteration
}
<
table
>
<
thead
>
<
tr
>
<
th
className
=
"
label
"
>
Intended
<
/th
>
<
th
className
=
"
label
"
>
Enacted
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
rows
}
<
/tbody
>
<
/table
>
<
/div
>
);
}
)
export
{
DemoLatestInteraction
}
from
'
./DemoLatestInteraction
'
export
{
RosLatestInteraction
}
from
'
./RosLastestInteraction
'
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment