Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
COLLET Ismael
Goshimmer_without_tipselection
Commits
93e83505
Unverified
Commit
93e83505
authored
4 years ago
by
Luca Moser
Browse files
Options
Downloads
Patches
Plain Diff
use @computed for grid
parent
ec23f194
Branches
ui/example
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/dashboard/frontend/src/app/components/FPC.tsx
+3
-16
3 additions, 16 deletions
plugins/dashboard/frontend/src/app/components/FPC.tsx
plugins/dashboard/frontend/src/app/stores/FPCStore.tsx
+20
-1
20 additions, 1 deletion
plugins/dashboard/frontend/src/app/stores/FPCStore.tsx
with
23 additions
and
17 deletions
plugins/dashboard/frontend/src/app/components/FPC.tsx
+
3
−
16
View file @
93e83505
import
*
as
React
from
'
react
'
;
import
NodeStore
from
"
app/stores/NodeStore
"
;
import
{
inject
,
observer
}
from
"
mobx-react
"
;
import
{
FPCStore
,
LightenDarkenColor
,
Node
}
from
"
app/stores/FPCStore
"
;
import
{
FPCStore
}
from
"
app/stores/FPCStore
"
;
import
Row
from
"
react-bootstrap/Row
"
;
import
Container
from
"
react-bootstrap/Container
"
;
import
Col
from
"
react-bootstrap/Col
"
;
interface
Props
{
nodeStore
?:
NodeStore
;
...
...
@@ -16,23 +15,11 @@ interface Props {
@
observer
export
default
class
FPC
extends
React
.
Component
<
Props
,
any
>
{
render
()
{
let
{
nodes
}
=
this
.
props
.
fpcStore
;
let
nodeSquares
=
[];
nodes
.
forEach
((
node
:
Node
,
id
:
number
,
obj
:
Map
<
number
,
Node
>
)
=>
{
nodeSquares
.
push
(
<
Col
xs
=
{
1
}
key
=
{
id
.
toString
()
}
style
=
{
{
height
:
50
,
width
:
50
,
background
:
LightenDarkenColor
(
"
#707070
"
,
node
.
opinion
),
}
}
>
{
node
.
opinion
}
</
Col
>
)
})
let
{
nodeGrid
}
=
this
.
props
.
fpcStore
;
return
(
<
Container
>
<
Row
>
{
node
Squares
}
{
node
Grid
}
</
Row
>
</
Container
>
);
...
...
This diff is collapsed.
Click to expand it.
plugins/dashboard/frontend/src/app/stores/FPCStore.tsx
+
20
−
1
View file @
93e83505
import
{
RouterStore
}
from
"
mobx-react-router
"
;
import
{
action
,
observable
,
ObservableMap
}
from
"
mobx
"
;
import
{
action
,
computed
,
observable
,
ObservableMap
}
from
"
mobx
"
;
import
Col
from
"
react-bootstrap/Col
"
;
import
*
as
React
from
"
react
"
;
export
class
Node
{
id
:
number
;
...
...
@@ -48,6 +50,23 @@ export class FPCStore {
}
}
@
computed
get
nodeGrid
(){
let
nodeSquares
=
[];
this
.
nodes
.
forEach
((
node
:
Node
,
id
:
number
,
obj
:
Map
<
number
,
Node
>
)
=>
{
nodeSquares
.
push
(
<
Col
xs
=
{
1
}
key
=
{
id
.
toString
()
}
style
=
{
{
height
:
50
,
width
:
50
,
background
:
LightenDarkenColor
(
"
#707070
"
,
node
.
opinion
),
}
}
>
{
node
.
opinion
}
</
Col
>
)
})
return
nodeSquares
;
}
}
...
...
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