Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Datahub
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ICAT
Datahub
Commits
5e74726f
Commit
5e74726f
authored
Sep 01, 2020
by
Loic Huder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash of ParcelDetails when seen by someone who is not the user
parent
ebe8ef9e
Pipeline
#32435
passed with stage
in 3 minutes
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
src/components/Parcels/ParcelDetails.js
src/components/Parcels/ParcelDetails.js
+9
-7
src/components/Parcels/ParcelHeader.js
src/components/Parcels/ParcelHeader.js
+7
-2
No files found.
src/components/Parcels/ParcelDetails.js
View file @
5e74726f
...
...
@@ -16,6 +16,9 @@ import StatusTable from './StatusTable';
import
styles
from
'
./ParcelDetails.module.css
'
;
import
AddressPanel
from
'
../Address/AddressPanel
'
;
import
AdminPanel
from
'
./AdminPanel
'
;
import
{
useInvestigation
}
from
'
../../helpers/hooks
'
;
import
Loader
from
'
../Loader
'
;
import
PageNotFound
from
'
../../containers/PageNotFound
'
;
function
ParcelDetails
(
props
)
{
const
{
investigationId
,
parcelId
}
=
props
;
...
...
@@ -49,14 +52,9 @@ function ParcelDetails(props) {
const
[
alert
,
setAlert
]
=
useState
();
const
dispatch
=
useDispatch
();
const
userInvestigations
=
useSelector
(
(
state
)
=>
state
.
myInvestigations
.
data
);
const
user
=
useSelector
((
state
)
=>
state
.
user
);
const
investigation
=
userInvestigations
.
find
(
(
investigation
)
=>
investigation
.
id
===
Number
(
investigationId
)
);
const
{
investigation
,
fetching
}
=
useInvestigation
(
investigationId
);
useEffect
(()
=>
{
if
(
investigation
)
{
...
...
@@ -77,8 +75,12 @@ function ParcelDetails(props) {
}
},
[
dispatch
,
investigation
,
parcel
]);
if
(
fetching
)
{
return
<
Loader
message
=
"
Loading parcel...
"
/>
;
}
if
(
!
parcel
)
{
return
<
p
>
Parcel
not
found
!<
/p
>
;
return
<
PageNotFound
/
>
;
}
function
handleCloseModal
()
{
...
...
src/components/Parcels/ParcelHeader.js
View file @
5e74726f
...
...
@@ -14,6 +14,12 @@ function ParcelHeader(props) {
const
{
shipmentId
,
investigationId
,
_id
}
=
parcel
;
const
history
=
useHistory
();
const
investigationSummary
=
investigation
?
`
${
investigation
.
name
}
-
${
dateFormatter
(
investigation
.
startDate
)}
-
${
investigation
.
visitId
.
toUpperCase
()}
`
:
parcel
.
investigationName
;
const
deleteParcel
=
useFetcher
(
ParcelResource
.
deleteShape
());
return
(
...
...
@@ -25,8 +31,7 @@ function ParcelHeader(props) {
<
h4
className
=
{
styles
.
investigation
}
>
Investigation
{
'
'
}
<
Link
to
=
{
`/investigation/
${
investigationId
}
/shipping`
}
>
{
investigation
.
name
}
-
{
dateFormatter
(
investigation
.
startDate
)}
-
{
'
'
}
{
investigation
.
visitId
.
toUpperCase
()}
{
investigationSummary
}
<
/Link
>
<
/h4
>
<
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment