Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Website
Commits
69c23a12
Commit
69c23a12
authored
Mar 11, 2019
by
Matija Obreza
Browse files
Admin Requests: Updated default sort and fixed admin request actions (on fail)
parent
367e918a
Changes
7
Hide whitespace changes
Inline
Side-by-side
locales/en/common.json
View file @
69c23a12
...
...
@@ -64,7 +64,7 @@
"fromIncluding"
:
"At least (min)"
,
"toIncluding"
:
"At most (max)"
,
"createdDate"
:
"Created on"
,
"lastModifiedDate"
:
"Last modified
date
"
,
"lastModifiedDate"
:
"Last modified"
,
"textSearch"
:
"Text search"
,
"keyword"
:
"Keyword search"
},
...
...
src/model/request/MaterialRequest.ts
View file @
69c23a12
...
...
@@ -20,8 +20,8 @@ class MaterialRequest {
public
version
:
number
;
public
static
DEFAULT_SORT
=
{
property
:
'
id
'
,
direction
:
'
A
SC
'
,
property
:
'
lastModifiedDate
'
,
direction
:
'
DE
SC
'
,
};
public
static
STATE
:
{
[
key
:
number
]:
string
;
}
=
{
...
...
src/requests/actions/admin.ts
View file @
69c23a12
...
...
@@ -22,9 +22,6 @@ import MaterialRequestFilter from 'model/request/MaterialRequestFilter';
// Wrapped API Calls
const
apiListRequests
=
createApiCaller
(
RequestService
.
list
,
ADMIN_APPEND_MATERIAL_REQUESTS
);
const
apiLoadRequest
=
createApiCaller
(
RequestService
.
getRequest
,
ADMIN_RECEIVE_MATERIAL_REQUEST
);
const
apiRecheckPid
=
createApiCaller
(
RequestService
.
recheckPid
,
ADMIN_RECEIVE_MATERIAL_REQUEST
);
const
apiValidateRequest
=
createApiCaller
(
RequestService
.
validateRequest
,
ADMIN_RECEIVE_MATERIAL_REQUEST
);
const
apiSendValidationEmail
=
createApiCaller
(
RequestService
.
sendValidationEmail
,
ADMIN_RECEIVE_MATERIAL_REQUEST
);
const
apiAccessionIdToUUID
=
createPureApiCaller
(
AccessionService
.
uuidFromIds
);
const
apiListAccessionsByUUID
=
createApiCaller
(
AccessionService
.
listAllByUuid
,
ADMIN_RECEIVE_MATERIAL_REQUEST_ACCESSIONS
);
...
...
@@ -41,19 +38,19 @@ export const loadMaterialRequest = (uuid: string) => (dispatch) => {
};
export
const
recheckPidAction
=
(
uuid
:
string
)
=>
(
dispatch
)
=>
{
return
dispatch
(
apiR
echeckPid
(
uuid
)
)
.
then
((
request
)
=>
dispatch
(
load
RequestAccessions
(
request
)));
return
RequestService
.
r
echeckPid
(
uuid
)
.
then
((
request
)
=>
dispatch
(
load
MaterialRequest
(
request
.
uuid
)));
};
export
const
validateRequestAction
=
(
uuid
:
string
)
=>
(
dispatch
)
=>
{
return
dispatch
(
apiV
alidateRequest
(
uuid
)
)
.
then
((
request
)
=>
dispatch
(
load
RequestAccessions
(
request
)));
return
RequestService
.
v
alidateRequest
(
uuid
)
.
then
((
request
)
=>
dispatch
(
load
MaterialRequest
(
request
.
uuid
)));
};
export
const
sendValidationEmailAction
=
(
uuid
:
string
)
=>
(
dispatch
)
=>
{
return
dispatch
(
apiS
endValidationEmail
(
uuid
)
)
.
then
((
request
)
=>
dispatch
(
load
RequestAccessions
(
request
)));
return
RequestService
.
s
endValidationEmail
(
uuid
)
.
then
((
request
)
=>
dispatch
(
load
MaterialRequest
(
request
.
uuid
)));
};
const
loadRequestAccessions
=
(
request
:
MaterialRequest
)
=>
(
dispatch
)
=>
{
...
...
src/requests/ui/admin/DisplayPage.tsx
View file @
69c23a12
...
...
@@ -22,6 +22,7 @@ import Markdown from 'ui/common/markdown';
import
PageTitle
from
'
ui/common/PageTitle
'
;
import
AccessionCard
from
'
accessions/ui/c/AccessionCard
'
;
import
ApiCall
from
'
model/ApiCall
'
;
import
confirm
from
'
utilities/confirmAlert
'
;
interface
IDisplayPageProps
extends
React
.
ClassAttributes
<
any
>
{
t
:
any
;
...
...
@@ -56,6 +57,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
const
{
requestCall
,
sendValidationEmail
}
=
this
.
props
;
sendValidationEmail
(
requestCall
.
data
.
uuid
).
catch
((
error
)
=>
{
console
.
log
(
`Error sending validation email`
,
error
);
confirm
(
`Error sending validation email`
,
{
confirmOnly
:
true
,
description
:
JSON
.
stringify
(
error
.
response
.
data
)
});
});
}
...
...
@@ -63,13 +65,14 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
const
{
requestCall
,
validateRequest
}
=
this
.
props
;
validateRequest
(
requestCall
.
data
.
uuid
).
catch
((
error
)
=>
{
console
.
log
(
`Error validating request`
,
error
);
confirm
(
`Error validating request`
,
{
confirmOnly
:
true
,
description
:
JSON
.
stringify
(
error
.
response
.
data
)
});
});
}
private
recheckPid
=
()
=>
{
const
{
requestCall
,
recheckPid
}
=
this
.
props
;
recheckPid
(
requestCall
.
data
.
uuid
).
catch
((
error
)
=>
{
con
sole
.
log
(
`Error checking for PID`
,
error
);
con
firm
(
`Error checking for PID`
,
{
confirmOnly
:
true
,
description
:
JSON
.
stringify
(
error
.
response
.
data
)
}
);
});
}
...
...
@@ -90,9 +93,9 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
title
=
{
t
(
'
requests.admin.p.display.title
'
,
{
email
:
request
.
email
})
}
buttons
=
{
<
div
>
<
ActionButton
title
=
{
t
(
'
requests.admin.p.display.sendValidationEmail
'
)
}
action
=
{
this
.
sendValidationEmail
}
/>
<
ActionButton
title
=
{
t
(
'
requests.admin.p.display.
validateRequest
'
)
}
action
=
{
this
.
validateRequest
}
/>
<
ActionButton
title
=
{
t
(
'
requests.admin.p.display.
recheckPID
'
)
}
action
=
{
this
.
recheckPid
}
/>
{
request
.
state
===
0
&&
<
ActionButton
title
=
{
t
(
'
requests.admin.p.display.sendValidationEmail
'
)
}
action
=
{
this
.
sendValidationEmail
}
/>
}
{
request
.
body
&&
!
request
.
body
.
pid
&&
<
ActionButton
title
=
{
t
(
'
requests.admin.p.display.
recheckPID
'
)
}
action
=
{
this
.
recheckPid
}
/>
}
{
request
.
state
!==
2
&&
<
ActionButton
title
=
{
t
(
'
requests.admin.p.display.
validateRequest
'
)
}
action
=
{
this
.
validateRequest
}
/>
}
<
BackButton
defaultTarget
=
"/admin/requests"
/>
</
div
>
}
...
...
@@ -155,14 +158,14 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
</
PageSection
>
}
{
requestAccessionsCall
&&
requestAccessionsCall
.
data
&&
requestAccessionsCall
.
data
.
length
>
0
&&
<
div
>
<
h3
style
=
{
{
marginTop
:
'
1em
'
}
}
>
{
t
(
'
requests.admin.p.display.requestedAccessions
'
)
}
</
h3
>
<
div
className
=
"container-spacing-horizontal mb-15"
>
{
requestAccessionsCall
.
data
.
map
((
accession
,
index
)
=>
<
AccessionCa
rd
key
=
{
accession
.
uuid
}
index
=
{
index
}
accession
=
{
accession
}
/>)
}
</
div
>
<
div
>
<
h3
style
=
{
{
marginTop
:
'
1em
'
}
}
>
{
t
(
'
requests.admin.p.display.requestedAccessions
'
)
}
</
h3
>
<
div
className
=
"container-spacing-horizontal mb-15"
>
{
requestAccessionsCall
&&
requestAccessionsCall
.
loading
&&
<
Loading
/>
}
{
requestAccessionsCall
&&
!
request
Accession
s
Ca
ll
.
loading
&&
requestAccessionsCall
.
data
&&
requestAccessionsCall
.
data
.
length
&&
requestAccessionsCall
.
data
.
map
((
accession
,
index
)
=>
<
AccessionCard
key
=
{
accession
.
uuid
}
index
=
{
index
}
accession
=
{
accession
}
/>)
}
</
div
>
}
</
div
>
</
PageContents
>
}
</
div
>
...
...
src/requests/ui/admin/c/RequestCard.tsx
View file @
69c23a12
...
...
@@ -32,7 +32,9 @@ const RequestCard = ({request, classes, index, t, ...other}: { request: Material
</
RequestLink
>
</
b
>
<
b
>
•
</
b
>
<
PrettyDate
value
=
{
request
.
createdDate
}
/>
{
t
(
'
common:f.lastModifiedDate
'
)
}
<
PrettyDate
value
=
{
request
.
lastModifiedDate
}
/>
<
b
>
•
</
b
>
{
t
(
'
common:f.createdDate
'
)
}
<
PrettyDate
value
=
{
request
.
createdDate
}
/>
</
div
>
<
div
>
{
request
.
state
!==
undefined
&&
...
...
src/service/genesys/RequestService.ts
View file @
69c23a12
...
...
@@ -163,8 +163,8 @@ class RequestService {
f
:
typeof
filter
===
'
string
'
?
filter
:
undefined
,
p
:
page
.
page
||
undefined
,
l
:
page
.
size
||
undefined
,
d
:
page
.
direction
?
page
.
direction
:
undefined
,
s
:
page
.
properties
||
undefined
,
d
:
page
.
direction
?
page
.
direction
:
MaterialRequest
.
DEFAULT_SORT
.
direction
,
s
:
page
.
properties
||
MaterialRequest
.
DEFAULT_SORT
.
property
,
},
{});
const
apiUrl
=
URL_LIST
+
(
qs
?
`?
${
qs
}
`
:
''
);
// console.log(`Fetching from ${apiUrl}`);
...
...
src/utilities/confirmAlert.tsx
View file @
69c23a12
...
...
@@ -9,10 +9,11 @@ import DialogTitle from '@material-ui/core/DialogTitle';
interface
IConfirmProps
extends
React
.
ClassAttributes
<
any
>
{
message
:
string
;
description
:
string
;
message
?
:
string
;
description
?
:
string
;
confirmLabel
?:
string
;
abortLabel
?:
string
;
confirmOnly
?:
boolean
;
}
function
PromiseWrapper
()
{
...
...
@@ -41,7 +42,7 @@ class Confirm extends React.Component<IConfirmProps, any> {
}
public
render
()
{
const
{
message
,
description
,
confirmLabel
=
'
OK
'
,
abortLabel
=
'
Cancel
'
}
=
this
.
props
;
const
{
message
,
description
,
confirmLabel
=
'
OK
'
,
abortLabel
=
'
Cancel
'
,
confirmOnly
=
false
}
=
this
.
props
;
return
(
<
Dialog
...
...
@@ -51,16 +52,20 @@ class Confirm extends React.Component<IConfirmProps, any> {
aria-describedby
=
"alert-dialog-description"
>
<
DialogTitle
id
=
"alert-dialog-title"
>
{
message
}
</
DialogTitle
>
<
DialogContent
>
<
DialogContentText
id
=
"alert-dialog-description"
>
{
description
}
</
DialogContentText
>
</
DialogContent
>
{
description
&&
(
<
DialogContent
>
<
DialogContentText
id
=
"alert-dialog-description"
>
{
description
}
</
DialogContentText
>
</
DialogContent
>
)
}
<
DialogActions
>
<
Button
onClick
=
{
this
.
reject
}
autoFocus
>
{
abortLabel
}
</
Button
>
<
Button
onClick
=
{
this
.
resolve
}
color
=
"primary"
>
{
!
confirmOnly
&&
(
<
Button
onClick
=
{
this
.
reject
}
autoFocus
>
{
abortLabel
}
</
Button
>
)
}
<
Button
onClick
=
{
this
.
resolve
}
color
=
"primary"
autoFocus
=
{
confirmOnly
}
>
{
confirmLabel
}
</
Button
>
</
DialogActions
>
...
...
@@ -70,7 +75,7 @@ class Confirm extends React.Component<IConfirmProps, any> {
}
export
default
(
message
,
options
=
{})
=>
{
export
default
(
message
:
any
,
options
:
IConfirmProps
=
{})
=>
{
const
props
:
any
=
{
message
,
...
options
};
const
wrapper
=
document
.
body
.
appendChild
(
document
.
createElement
(
'
div
'
));
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment