Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Genesys Website
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Website
Commits
1e62f327
Commit
1e62f327
authored
Oct 31, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subsets: Don't send accessionRefs for basic updates
- Loading indicator
parent
72192b83
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
31 deletions
+54
-31
src/accessions/actions/public.ts
src/accessions/actions/public.ts
+0
-5
src/subsets/actions/editor.ts
src/subsets/actions/editor.ts
+16
-6
src/subsets/ui/dashboard/subset-stepper/steps/accessions-list/ListOfAccessions.tsx
...subset-stepper/steps/accessions-list/ListOfAccessions.tsx
+29
-11
src/subsets/ui/dashboard/subset-stepper/steps/accessions-list/index.tsx
.../dashboard/subset-stepper/steps/accessions-list/index.tsx
+4
-3
src/ui/catalog/accession/AccessionRefsTable.tsx
src/ui/catalog/accession/AccessionRefsTable.tsx
+5
-6
No files found.
src/accessions/actions/public.ts
View file @
1e62f327
...
...
@@ -10,7 +10,6 @@ import AccessionMapInfo from 'model/accession/AccessionMapInfo';
import
{
RECEIVE_ACCESSIONS
,
RECEIVE_ACCESSION
,
RECEIVE_ACCESSION_OVERVIEW
,
APPEND_ACCESSIONS
,
RECEIVE_ACCESSION_MAPINFO
}
from
'
accessions/constants
'
;
import
AccessionService
from
'
service/genesys/AccessionService
'
;
import
{
AccessionRef
}
from
'
model/accession/AccessionRef
'
;
import
{
showSnackbar
}
from
'
actions/snackbar
'
;
import
Page
from
'
model/Page
'
;
...
...
@@ -39,10 +38,6 @@ const receiveAccession = (accession: AccessionDetails, error = null) => ({
payload
:
{
accession
,
error
},
});
export
const
toUUIDPromise
=
(
identifiers
:
AccessionRef
[])
=>
(
dispatch
,
getState
):
Promise
<
Map
<
string
,
AccessionRef
>>
=>
{
return
AccessionService
.
toUUID
(
identifiers
);
};
export
const
updateRoute
=
(
paged
:
FilteredPage
<
Accession
>
,
path
:
string
=
'
/a
'
)
=>
(
dispatch
)
=>
{
const
qs
=
{
s
:
paged
.
sort
[
0
].
property
===
Accession
.
DEFAULT_SORT
.
property
?
undefined
:
paged
.
sort
[
0
].
property
,
...
...
src/subsets/actions/editor.ts
View file @
1e62f327
// Actions
import
navigateTo
from
'
actions/navigation
'
;
import
{
toUUIDPromise
}
from
'
accessions/actions/public
'
;
// TODO
import
{
receiveSubset
,
removeSubset
}
from
'
./dashboard
'
;
// Constants
...
...
@@ -13,17 +12,19 @@ import { AccessionRef } from 'model/accession/AccessionRef';
// Service
import
SubsetService
from
'
service/genesys/SubsetService
'
;
import
AccessionService
from
'
service/genesys/AccessionService
'
;
// UI
import
steps
from
'
subsets/ui/dashboard/subset-stepper/steps
'
;
// Accession Identifiers step
export
const
updateSubsetAccessionRefs
=
(
subset
:
Subset
,
A
ccessionRefs
:
AccessionRef
[])
=>
(
dispatch
)
=>
{
dispatch
(
toUUIDPromise
(
AccessionRefs
)
)
.
then
((
A
ccessionRefs
)
=>
{
SubsetService
.
addAccessions
(
subset
.
uuid
,
subset
.
version
,
Object
.
keys
(
A
ccessionRefs
))
export
const
updateSubsetAccessionRefs
=
(
subset
:
Subset
,
a
ccessionRefs
:
AccessionRef
[])
=>
(
dispatch
)
=>
{
return
AccessionService
.
toUUID
(
accessionRefs
)
.
then
((
a
ccessionRefs
)
=>
{
SubsetService
.
addAccessions
(
subset
.
uuid
,
subset
.
version
,
Object
.
keys
(
a
ccessionRefs
))
.
then
((
subset
)
=>
{
dispatch
(
receiveSubset
(
subset
));
return
subset
;
});
});
};
...
...
@@ -35,6 +36,7 @@ export const publishSubset = (subset: Subset) => (dispatch) => {
dispatch
(
receiveSubset
(
subset
));
});
};
export
const
unpublishSubset
=
(
subset
:
Subset
)
=>
(
dispatch
)
=>
{
return
SubsetService
.
rejectSubset
(
subset
.
uuid
,
subset
.
version
)
.
then
((
subset
)
=>
{
...
...
@@ -127,6 +129,14 @@ export const saveSubset = (subset: Subset) => (dispatch) => {
dispatch
(
gotoNextStep
(
subset
));
});
}
return
SubsetService
.
update
(
subset
)
// remove normalized data here
const
data
:
Subset
=
{
...
subset
,
creators
:
[],
accessionRefs
:
[],
};
return
SubsetService
.
update
(
data
)
.
then
((
subset
)
=>
dispatch
(
receiveSubset
(
subset
)));
};
src/subsets/ui/dashboard/subset-stepper/steps/accessions-list/ListOfAccessions.tsx
View file @
1e62f327
...
...
@@ -16,11 +16,12 @@ import Subset from 'model/subset/Subset';
// ui
import
CSVConfiguration
,
{
CSVConfig
}
from
'
ui/common/csv-configuration/CSVConfiguration
'
;
import
AccessionRefsTable
from
'
ui/catalog/accession/AccessionRefsTable
'
;
import
Loading
from
'
ui/common/Loading
'
;
interface
IListOfAccession
extends
React
.
ClassAttributes
<
any
>
{
classes
:
any
;
subset
:
Subset
;
onAccessionsUpdated
:
(
AccessionRefs
:
AccessionRef
[])
=>
void
;
onAccessionsUpdated
:
(
AccessionRefs
:
AccessionRef
[])
=>
Promise
<
Subset
>
;
t
:
any
;
}
...
...
@@ -40,16 +41,20 @@ const styleSheet = {
class
ListOfAccession
extends
React
.
Component
<
IListOfAccession
,
any
>
{
public
dataPasted
=
(
e
)
=>
{
e
.
preventDefault
();
this
.
setState
({
...
this
.
state
,
uploading
:
true
,
uploadText
:
'
Parsing
'
});
console
.
log
(
'
Pasted
'
,
e
.
clipboardData
);
// console.log(e.clipboardData.getData('text/plain'));
this
.
parseCsv
(
e
.
clipboardData
.
getData
(
'
text/plain
'
));
// Delay parsing a little bit for UI to update
const
data
=
e
.
clipboardData
.
getData
(
'
text/plain
'
);
setTimeout
(()
=>
this
.
parseCsv
(
data
),
10
);
}
public
textBlurred
=
(
e
)
=>
{
this
.
parseCsv
(
e
.
target
.
value
);
}
private
onUpdateCsvConfig
=
(
value
:
CSVConfig
)
=>
{
this
.
setState
({...
this
.
state
,
csvConfig
:
value
});
}
...
...
@@ -64,12 +69,14 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
quote
:
'
"
'
,
autodetect
:
false
,
},
uploading
:
false
,
};
}
public
render
()
{
const
{
classes
,
subset
,
t
}
=
this
.
props
;
const
{
classes
,
subset
,
t
}
=
this
.
props
;
const
{
uploading
,
uploadText
}
=
this
.
state
;
return
(
<
div
className
=
{
`
${
classes
.
root
}
m-20 p-20 even-row`
}
>
...
...
@@ -95,9 +102,11 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
</
div
>
{
uploading
&&
<
Loading
message
=
{
uploadText
}
/>
}
<
h3
>
{
t
(
'
subsets.dashboard.p.stepper.accessionList.accessionListCount
'
,
{
count
:
subset
.
accessionRefs
&&
subset
.
accessionRefs
.
length
||
0
})
}
</
h3
>
{
subset
.
accessionRefs
&&
<
AccessionRefsTable
A
ccessionRefs
=
{
subset
.
accessionRefs
.
map
((
accessionRef
)
=>
(
<
AccessionRefsTable
a
ccessionRefs
=
{
subset
.
accessionRefs
.
map
((
accessionRef
)
=>
(
{
doi
:
accessionRef
.
accession
.
doi
,
instCode
:
accessionRef
.
accession
.
institute
.
code
,
...
...
@@ -114,6 +123,7 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
private
parseCsv
(
csvText
:
string
)
{
// log('CSV text', csvText);
if
(
!
csvText
)
{
this
.
setState
({
...
this
.
state
,
uploading
:
false
,
uploadText
:
undefined
});
return
;
}
...
...
@@ -124,15 +134,23 @@ class ListOfAccession extends React.Component<IListOfAccession, any> {
const
newIdentifiers
:
AccessionRef
[]
=
[];
CSV
.
parse
(
csvText
,
config
,
{
headers
:
[
'
instCode
'
,
'
acceNumb
'
,
'
genus
'
,
'
species
'
,
'
doi
'
]
})
CSV
.
parse
(
csvText
,
config
,
{
headers
:
[
'
instCode
'
,
'
acceNumb
'
,
'
genus
'
,
'
species
'
,
'
doi
'
]
})
.
subscribe
((
jsonObj
)
=>
{
const
aid
:
AccessionRef
=
new
AccessionRef
(
jsonObj
);
newIdentifiers
.
push
(
aid
);
log
(
aid
);
//
log(aid);
}).
then
(()
=>
{
log
(
'
All CSV parsed
'
);
this
.
props
.
onAccessionsUpdated
(
newIdentifiers
);
});
log
(
'
All CSV parsed
'
);
this
.
setState
({
...
this
.
state
,
uploading
:
true
,
uploadText
:
'
Uploading to server
'
});
this
.
props
.
onAccessionsUpdated
(
newIdentifiers
)
.
then
((
dataset
)
=>
{
console
.
log
(
'
Done
'
,
dataset
);
this
.
setState
({
...
this
.
state
,
uploading
:
false
});
}).
catch
((
err
)
=>
{
this
.
setState
({
...
this
.
state
,
uploading
:
false
});
console
.
log
(
'
Error uploading
'
,
err
);
});
});
}
}
...
...
src/subsets/ui/dashboard/subset-stepper/steps/accessions-list/index.tsx
View file @
1e62f327
...
...
@@ -18,7 +18,7 @@ interface IAccessionsListStep extends React.ClassAttributes<any> {
updateSubsetAccessionRefs
:
(
subset
:
Subset
,
accessionRefs
:
AccessionRef
[])
=>
Promise
<
Subset
>
;
}
class
AccessionsListStep
extends
StepperTemplate
<
IAccessionsListStep
>
{
class
AccessionsListStep
extends
StepperTemplate
<
IAccessionsListStep
>
{
protected
renderContent
=
()
=>
{
const
{
item
}
=
this
.
props
;
...
...
@@ -32,11 +32,12 @@ class AccessionsListStep extends StepperTemplate<IAccessionsListStep> {
}
protected
updateaccessionRefs
=
(
AccessionRefs
:
AccessionRef
[])
=>
{
const
{
item
:
subset
,
updateSubsetAccessionRefs
}
=
this
.
props
;
updateSubsetAccessionRefs
(
subset
,
AccessionRefs
);
const
{
item
:
subset
,
updateSubsetAccessionRefs
}
=
this
.
props
;
return
updateSubsetAccessionRefs
(
subset
,
AccessionRefs
);
}
}
const
mapStateToProps
=
(
state
,
ownProps
)
=>
({
// null
});
...
...
src/ui/catalog/accession/AccessionRefsTable.tsx
View file @
1e62f327
...
...
@@ -5,7 +5,6 @@ import { withStyles } from '@material-ui/core/styles';
import
{
AccessionRef
}
from
'
model/accession/AccessionRef
'
;
import
{
Table
as
VTable
,
Column
as
VColumn
,
AutoSizer
}
from
'
react-virtualized
'
;
import
DOI
from
'
ui/common/DOI
'
;
// import Hidden from '@material-ui/core/Hidden';
const
styles
=
(
theme
)
=>
({
...
...
@@ -34,7 +33,7 @@ const styles = (theme) => ({
interface
IAccessionRefsTableProps
extends
React
.
ClassAttributes
<
any
>
{
classes
:
any
;
A
ccessionRefs
:
AccessionRef
[];
a
ccessionRefs
:
AccessionRef
[];
t
:
any
;
}
...
...
@@ -45,12 +44,12 @@ class AccessionRefsTable extends React.Component<IAccessionRefsTableProps, any>
}
public
render
()
{
const
{
A
ccessionRefs
,
classes
,
t
}
=
this
.
props
;
const
rowGetter
=
({
index
})
=>
A
ccessionRefs
[
index
];
const
{
a
ccessionRefs
,
classes
,
t
}
=
this
.
props
;
const
rowGetter
=
({
index
})
=>
a
ccessionRefs
[
index
];
const
renderDoi
=
({
cellData
})
=>
<
DOI
noPrefix
value
=
{
cellData
}
/>;
const
rowClassName
=
({
index
})
=>
index
===
-
1
?
''
:
`
${
classes
.
tableCell
}
${
index
%
2
===
0
?
classes
.
evenRow
:
classes
.
oddRow
}
`
;
return
AccessionRefs
&&
A
ccessionRefs
.
sort
((
a
,
b
)
=>
a
.
acceNumb
.
localeCompare
(
b
.
acceNumb
))
&&
(
return
accessionRefs
&&
a
ccessionRefs
.
sort
((
a
,
b
)
=>
a
.
acceNumb
.
localeCompare
(
b
.
acceNumb
))
&&
(
<
AutoSizer
disableHeight
>
{
({
width
})
=>
(
<
VTable
...
...
@@ -59,7 +58,7 @@ class AccessionRefsTable extends React.Component<IAccessionRefsTableProps, any>
height
=
{
500
}
headerHeight
=
{
25
}
rowHeight
=
{
30
}
rowCount
=
{
A
ccessionRefs
.
length
}
rowCount
=
{
a
ccessionRefs
.
length
}
rowGetter
=
{
rowGetter
}
rowClassName
=
{
rowClassName
}
headerClassName
=
{
`back-green`
}
...
...
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