Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
8e874b06
Verified
Commit
8e874b06
authored
2 years ago
by
Marte Fossum
Browse files
Options
Downloads
Patches
Plain Diff
Reload guests when period changed
parent
3ac692f5
No related branches found
No related tags found
1 merge request
!376
Reload guests when period changed
Pipeline
#179245
passed
2 years ago
Stage: venv update
Stage: tests and linting
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/routes/sponsor/guest/guestRoleInfo/index.tsx
+10
-2
10 additions, 2 deletions
frontend/src/routes/sponsor/guest/guestRoleInfo/index.tsx
frontend/src/routes/sponsor/guest/index.tsx
+5
-1
5 additions, 1 deletion
frontend/src/routes/sponsor/guest/index.tsx
with
15 additions
and
3 deletions
frontend/src/routes/sponsor/guest/guestRoleInfo/index.tsx
+
10
−
2
View file @
8e874b06
...
...
@@ -30,9 +30,14 @@ import useOus from '../../../../hooks/useOus'
interface
GuestRoleInfoProps
{
guest
:
Guest
reloadGuest
:
()
=>
void
reloadGuests
:
()
=>
void
}
const
endPeriodPost
=
(
id
:
string
,
data
:
{
end_date
:
Date
})
=>
{
const
endPeriodPost
=
(
id
:
string
,
data
:
{
end_date
:
Date
},
reloadGuests
:
()
=>
void
)
=>
{
const
payload
=
{
end_date
:
format
(
data
.
end_date
as
Date
,
'
yyyy-MM-dd
'
),
}
...
...
@@ -48,6 +53,7 @@ const endPeriodPost = (id: string, data: { end_date: Date }) => {
.
then
((
result
)
=>
{
if
(
result
!==
null
)
{
console
.
log
(
'
result
'
,
result
)
reloadGuests
()
}
})
.
catch
((
error
)
=>
{
...
...
@@ -107,6 +113,7 @@ const TableContainer = styled(TableContainerMui)({
export
default
function
GuestRoleInfo
({
guest
,
reloadGuest
,
reloadGuests
,
}:
GuestRoleInfoProps
)
{
const
{
pid
,
id
}
=
useParams
<
GuestRoleInfoParams
>
()
const
{
ous
}
=
useOus
()
...
...
@@ -145,7 +152,7 @@ export default function GuestRoleInfo({
setBadEndDate
(
true
)
}
else
{
role
.
end_date
=
newEndDate
endPeriodPost
(
role_id
,
{
end_date
:
newEndDate
})
endPeriodPost
(
role_id
,
{
end_date
:
newEndDate
}
,
reloadGuests
)
// Go back to guest overview page
navigate
(
`/sponsor/guest/
${
guest
.
pid
}
`
,
{
state
:
{
...
...
@@ -192,6 +199,7 @@ export default function GuestRoleInfo({
console
.
log
(
'
result
'
,
result
)
}
// Reload the guest so that the information on the overview page is updated
reloadGuests
()
reloadGuest
()
// A submit does not clear the dirty state, so resetting values in the form
// to the values just submitted to clear the dirty-flag
...
...
This diff is collapsed.
Click to expand it.
frontend/src/routes/sponsor/guest/index.tsx
+
5
−
1
View file @
8e874b06
...
...
@@ -66,7 +66,11 @@ function GuestRoutes({ reloadGuests }: GuestRoutesProps) {
<
Route
path
=
"/roles/:id"
element
=
{
<
GuestRoleInfo
guest
=
{
guestInfo
}
reloadGuest
=
{
reloadGuestInfo
}
/>
<
GuestRoleInfo
guest
=
{
guestInfo
}
reloadGuest
=
{
reloadGuestInfo
}
reloadGuests
=
{
reloadGuests
}
/>
}
/>
<
Route
...
...
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