Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mod4-wp-2023-2024-pokemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Service Desk
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
Shabani, B. (Blert, Student B-TCS)
mod4-wp-2023-2024-pokemon
Commits
b2b79a13
Commit
b2b79a13
authored
9 months ago
by
Shabani, B. (Blert, Student B-TCS)
Browse files
Options
Downloads
Patches
Plain Diff
Work done on practical 2
parent
7d77e368
Branches
update-trainer
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#98442
failed
9 months ago
Stage: build
Stage: test
Stage: dast
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/webapp/Trainers.html
+47
-0
47 additions, 0 deletions
src/main/webapp/Trainers.html
src/main/webapp/js/requests.js
+23
-0
23 additions, 0 deletions
src/main/webapp/js/requests.js
src/main/webapp/pokemonTypes.html
+1
-1
1 addition, 1 deletion
src/main/webapp/pokemonTypes.html
with
71 additions
and
1 deletion
src/main/webapp/Trainers.html
0 → 100644
+
47
−
0
View file @
b2b79a13
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<!-- Required meta tags -->
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<!-- Bootstrap CSS -->
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity=
"sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N"
crossorigin=
"anonymous"
>
<meta
charset=
"UTF-8"
>
<title>
Trainers
</title>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"/pokemon/favicon.ico"
>
</head>
<body>
<script
src=
"js/requests.js"
></script>
<script>
tableParentId
=
"
tableDiv
"
;
detailsParentId
=
"
detailsDiv
"
;
fetch
(
'
/pokemon/api/trainers
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
data
=>
{
pokemonTrainers
=
data
;
createPokemonTrainerTable
();
})
.
catch
(
err
=>
{
console
.
error
(
`Unable to fetch Pokemon Trainers:
${
err
.
status
}
`
);
console
.
error
(
err
);
});
</script>
<h1>
Pokemon
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
id=
"tableDiv"
class=
"col-8"
>
No data
</div>
<div
id=
"detailsDiv"
class=
"col-4"
>
No data
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/webapp/js/requests.js
+
23
−
0
View file @
b2b79a13
...
...
@@ -60,4 +60,27 @@ function createPokemonTypesTable() {
</tbody>
</table>
`
}
function
createPokemonTrainerTable
()
{
const
tableParent
=
document
.
getElementById
(
tableParentId
);
tableParent
.
innerHTML
=
`
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Pokedex Number</th>
<th scope="col">Primary Type</th>
<th scope="col">Secondary Type</th>
</tr>
</thead>
<tbody>
${
pokemonTypes
.
data
.
map
(
resource
=>
`
${
pokemonTypeToRow
(
resource
)}
`
).
join
(
"
\n
"
)
||
"
no data
"
}
</tbody>
</table>
`
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/webapp/pokemonTypes.html
+
1
−
1
View file @
b2b79a13
...
...
@@ -9,7 +9,7 @@
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity=
"sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N"
crossorigin=
"anonymous"
>
<title>
T
itle
</title>
<title>
T
ypes
</title>
<link
rel=
"icon"
type=
"image/x-icon"
href=
"/pokemon/favicon.ico"
>
</head>
<body>
...
...
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