Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
WIMMA Lab 2019
Overflow
ehasa-frontend
Merge requests
!11
Combine gamelist and new game form
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Combine gamelist and new game form
gamelist
into
25-pelinluontilomake
Overview
0
Commits
9
Pipelines
0
Changes
4
Merged
H9031
requested to merge
gamelist
into
25-pelinluontilomake
5 years ago
Overview
0
Commits
9
Pipelines
0
Changes
4
Expand
Combine gamelist and new game form
0
0
Merge request reports
Compare
25-pelinluontilomake
version 1
96d59a83
5 years ago
25-pelinluontilomake (base)
and
latest version
latest version
5435b699
9 commits,
5 years ago
version 1
96d59a83
8 commits,
5 years ago
4 files
+
108
−
23
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/components/GameList.js
0 → 100644
+
57
−
0
Options
import
React
,
{
Fragment
}
from
'
react
'
;
class
GameList
extends
React
.
Component
{
constructor
(
props
){
super
(
props
);
this
.
state
=
{
games
:
[],
selectedGame
:
null
}
}
componentDidMount
()
{
fetch
(
'
http://localhost:5000/game/listgames
'
)
.
then
(
response
=>
response
.
json
())
.
then
(
games
=>
this
.
setState
({
games
}))
.
catch
(
error
=>
{
console
.
log
(
error
);})
}
handleChange
=
(
e
)
=>
{
this
.
setState
({
selectedGame
:
e
.
target
.
value
});
}
handleEditClick
=
(
e
)
=>
{
if
(
this
.
state
.
selectedGame
===
null
){
alert
(
'
No game selected
'
);}
else
{
fetch
(
'
http://localhost:5000/game/
'
+
this
.
state
.
selectedGame
)
.
then
(
response
=>
response
.
json
())
.
then
(
json
=>
console
.
log
(
json
))
.
catch
(
error
=>
console
.
log
(
error
))
}
}
render
()
{
let
items
=
[];
for
(
let
i
=
0
;
i
<
this
.
state
.
games
.
length
;
i
++
)
{
const
element
=
this
.
state
.
games
[
i
];
items
.
push
(
<
option
key
=
{
element
.
id
}
value
=
{
element
.
id
}
>
{
element
.
name
}
<
/option
>
);
}
return
(
<
Fragment
>
<
label
>
Game
:
<
/label
>
<
select
onChange
=
{
this
.
handleChange
}
>
{
items
}
<
/select>
<
button
onClick
=
{
this
.
handleEditClick
}
>
Edit
game
<
/button
>
<
/Fragment
>
);
}
}
export
default
GameList
;
\ No newline at end of file
Loading