Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
teknikattan-scoring-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tddd96-grupp1
teknikattan-scoring-system
Compare revisions
19928b47fc482450447ed50b967461b56aaa1325 to 0e87d25cc1ef91092cd62b17a44476b54b93cfe1
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
tddd96-grupp11/teknikattan-scoring-system
Select target project
No results found
0e87d25cc1ef91092cd62b17a44476b54b93cfe1
Select Git revision
Branches
dev
master
Swap
Target
tddd96-grupp11/teknikattan-scoring-system
Select target project
tddd96-grupp11/teknikattan-scoring-system
1 result
19928b47fc482450447ed50b967461b56aaa1325
Select Git revision
Branches
dev
master
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Add dialog when deleting a competition
· 7d13d8e5
Björn Modée
authored
3 years ago
7d13d8e5
feat: Add copy link button
· 0e87d25c
Björn Modée
authored
3 years ago
0e87d25c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/src/pages/admin/competitions/CompetitionManager.tsx
+40
-2
40 additions, 2 deletions
client/src/pages/admin/competitions/CompetitionManager.tsx
client/src/pages/views/OperatorViewPage.tsx
+11
-0
11 additions, 0 deletions
client/src/pages/views/OperatorViewPage.tsx
with
51 additions
and
2 deletions
client/src/pages/admin/competitions/CompetitionManager.tsx
View file @
0e87d25c
...
...
@@ -4,6 +4,7 @@ import {
Dialog
,
DialogActions
,
DialogContent
,
DialogContentText
,
DialogTitle
,
ListItem
,
ListItemText
,
...
...
@@ -12,13 +13,14 @@ import {
TextField
,
Tooltip
,
Typography
,
useMediaQuery
,
}
from
'
@material-ui/core
'
import
FormControl
from
'
@material-ui/core/FormControl
'
import
InputLabel
from
'
@material-ui/core/InputLabel
'
import
MenuItem
from
'
@material-ui/core/MenuItem
'
import
Paper
from
'
@material-ui/core/Paper
'
import
Select
from
'
@material-ui/core/Select
'
import
{
createStyles
,
makeStyles
,
Theme
}
from
'
@material-ui/core/styles
'
import
{
createStyles
,
makeStyles
,
Theme
,
useTheme
}
from
'
@material-ui/core/styles
'
import
Table
from
'
@material-ui/core/Table
'
import
TableBody
from
'
@material-ui/core/TableBody
'
import
TableCell
from
'
@material-ui/core/TableCell
'
...
...
@@ -72,6 +74,11 @@ interface Code {
}
const
CompetitionManager
:
React
.
FC
=
(
props
:
any
)
=>
{
// for dialog alert
const
[
openAlert
,
setOpen
]
=
React
.
useState
(
false
)
const
theme
=
useTheme
()
const
fullScreen
=
useMediaQuery
(
theme
.
breakpoints
.
down
(
'
sm
'
))
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
<
null
|
HTMLElement
>
(
null
)
const
[
activeId
,
setActiveId
]
=
React
.
useState
<
number
|
undefined
>
(
undefined
)
const
[
timerHandle
,
setTimerHandle
]
=
React
.
useState
<
number
|
undefined
>
(
undefined
)
...
...
@@ -101,6 +108,10 @@ const CompetitionManager: React.FC = (props: any) => {
setActiveId
(
undefined
)
}
const
handleCloseVerify
=
()
=>
{
setOpen
(
false
)
}
useEffect
(()
=>
{
dispatch
(
getCompetitions
())
},
[])
...
...
@@ -116,8 +127,13 @@ const CompetitionManager: React.FC = (props: any) => {
dispatch
(
setFilterParams
({
...
filterParams
,
name
:
event
.
target
.
value
}))
}
const
handleVerifyDelete
=
()
=>
{
setOpen
(
true
)
}
// Function to remove a competition from the systems database
const
handleDeleteCompetition
=
async
()
=>
{
setOpen
(
false
)
if
(
activeId
)
{
await
axios
.
delete
(
`/api/competitions/
${
activeId
}
`
)
...
...
@@ -334,10 +350,32 @@ const CompetitionManager: React.FC = (props: any) => {
<
MenuItem
onClick
=
{
handleStartCompetition
}
>
Starta
</
MenuItem
>
<
MenuItem
onClick
=
{
handleOpenDialog
}
>
Visa koder
</
MenuItem
>
<
MenuItem
onClick
=
{
handleDuplicateCompetition
}
>
Duplicera
</
MenuItem
>
<
RemoveMenuItem
onClick
=
{
handleDelete
Competition
}
data-testid
=
"removeCompetitionButton"
>
<
RemoveMenuItem
onClick
=
{
handle
Verify
Delete
}
data-testid
=
"removeCompetitionButton"
>
Ta bort
</
RemoveMenuItem
>
</
Menu
>
<
Dialog
fullScreen
=
{
fullScreen
}
open
=
{
openAlert
}
onClose
=
{
handleCloseVerify
}
aria-labelledby
=
"responsive-dialog-title"
>
<
DialogTitle
id
=
"responsive-dialog-title"
>
{
'
Ta bort tävlingen?
'
}
</
DialogTitle
>
<
DialogContent
>
<
DialogContentText
>
Är du säker på att du vill ta bort tävlingen och all dess information från systemet?
</
DialogContentText
>
</
DialogContent
>
<
DialogActions
>
<
Button
autoFocus
onClick
=
{
handleCloseVerify
}
color
=
"primary"
>
Avbryt
</
Button
>
<
Button
data-testid
=
"acceptRemoveUser"
onClick
=
{
handleDeleteCompetition
}
color
=
"primary"
autoFocus
>
Ta bort
</
Button
>
</
DialogActions
>
</
Dialog
>
<
Dialog
open
=
{
dialogIsOpen
}
onClose
=
{
handleCloseDialog
}
...
...
This diff is collapsed.
Click to expand it.
client/src/pages/views/OperatorViewPage.tsx
View file @
0e87d25c
...
...
@@ -21,6 +21,7 @@ import BackspaceIcon from '@material-ui/icons/Backspace'
import
ChevronLeftIcon
from
'
@material-ui/icons/ChevronLeft
'
import
ChevronRightIcon
from
'
@material-ui/icons/ChevronRight
'
import
FileCopyIcon
from
'
@material-ui/icons/FileCopy
'
import
LinkIcon
from
'
@material-ui/icons/Link
'
import
SupervisorAccountIcon
from
'
@material-ui/icons/SupervisorAccount
'
import
TimerIcon
from
'
@material-ui/icons/Timer
'
import
axios
from
'
axios
'
...
...
@@ -250,6 +251,16 @@ const OperatorViewPage: React.FC = () => {
<
FileCopyIcon
fontSize
=
"small"
/>
</
Button
>
</
Tooltip
>
<
Tooltip
title
=
"Kopiera länk"
arrow
>
<
Button
margin-right
=
"0px"
onClick
=
{
()
=>
{
navigator
.
clipboard
.
writeText
(
`
${
window
.
location
.
host
}
/
${
code
.
code
}
`
)
}
}
>
<
LinkIcon
fontSize
=
"small"
/>
</
Button
>
</
Tooltip
>
</
ListItem
>
))
}
</
DialogContent
>
...
...
This diff is collapsed.
Click to expand it.