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
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
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
ff58583b
Commit
ff58583b
authored
Sep 21, 2020
by
Axel Bocciarelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix select all datasets in dataset table
parent
514c6eda
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
24 deletions
+24
-24
src/actions/selection.js
src/actions/selection.js
+6
-6
src/components/Dataset/DatasetTable.js
src/components/Dataset/DatasetTable.js
+8
-14
src/containers/Selection/SelectionPage.js
src/containers/Selection/SelectionPage.js
+5
-1
src/reducers/selection.js
src/reducers/selection.js
+5
-3
No files found.
src/actions/selection.js
View file @
ff58583b
...
...
@@ -3,20 +3,20 @@ import {
REMOVE_DATASET_BY_ID
,
}
from
'
../constants/actionTypes
'
;
export
function
removeDatasetById
(
datasetId
)
{
export
function
addDatasetById
(
datasetIds
)
{
return
function
(
dispatch
)
{
dispatch
({
type
:
REMOVE
_DATASET_BY_ID
,
payload
:
datasetId
,
type
:
ADD
_DATASET_BY_ID
,
payload
:
datasetId
s
,
});
};
}
export
function
addDatasetById
(
datasetId
)
{
export
function
removeDatasetById
(
datasetIds
)
{
return
function
(
dispatch
)
{
dispatch
({
type
:
ADD
_DATASET_BY_ID
,
payload
:
datasetId
,
type
:
REMOVE
_DATASET_BY_ID
,
payload
:
datasetId
s
,
});
};
}
src/components/Dataset/DatasetTable.js
View file @
ff58583b
...
...
@@ -195,19 +195,13 @@ class DatasetTable extends React.Component {
];
}
handleOnSelect
=
(
row
,
isSelect
)
=>
{
if
(
isSelect
)
{
this
.
props
.
addDatasetById
(
row
.
id
);
}
else
{
this
.
props
.
removeDatasetById
(
row
.
id
);
}
return
true
;
};
handleSelect
=
(
isSelecting
,
rows
)
=>
{
const
action
=
isSelecting
?
this
.
props
.
addDatasetById
:
this
.
props
.
removeDatasetById
;
handleOnSelectAll
=
(
isSelect
,
rows
)
=>
{
if
(
isSelect
)
{
return
rows
.
filter
((
r
)
=>
r
.
id
>=
3
).
map
((
r
)
=>
r
.
id
);
}
action
(
rows
.
map
((
r
)
=>
r
.
id
));
return
true
;
};
render
()
{
...
...
@@ -215,8 +209,8 @@ class DatasetTable extends React.Component {
mode
:
'
checkbox
'
,
clickToSelect
:
false
,
selected
:
this
.
props
.
selectedDatasetIds
,
onSelectAll
:
this
.
handle
OnSelectAll
,
onSelect
:
this
.
handleOnSelect
,
onSelectAll
:
this
.
handle
Select
,
onSelect
:
(
row
,
isSelecting
)
=>
this
.
handleSelect
(
isSelecting
,
[
row
])
,
classes
:
'
selection-row
'
,
};
...
...
src/containers/Selection/SelectionPage.js
View file @
ff58583b
...
...
@@ -48,7 +48,11 @@ function SelectionPage() {
overlay
=
{
tooltip
(
'
Mint a DOI for all selected datasets
'
)}
>
<
LinkContainer
to
=
"
/selection/mint
"
>
<
Button
bsSize
=
"
small
"
bsStyle
=
"
primary
"
>
<
Button
bsSize
=
"
small
"
bsStyle
=
"
primary
"
disabled
=
{
datasetIds
.
length
===
0
}
>
<
Glyphicon
glyph
=
"
plus
"
/>
Mint
a
DOI
<
/Button
>
<
/LinkContainer
>
...
...
src/reducers/selection.js
View file @
ff58583b
...
...
@@ -8,14 +8,16 @@ const INITIAL_STATE = {
};
function
selection
(
state
=
INITIAL_STATE
,
action
)
{
const
{
payload
:
datasetId
}
=
action
;
const
{
payload
:
datasetId
s
}
=
action
;
switch
(
action
.
type
)
{
case
ADD_DATASET_BY_ID
:
{
return
{
datasetIds
:
[...
state
.
datasetIds
,
datasetId
]
};
return
{
datasetIds
:
[...
state
.
datasetIds
,
...
datasetIds
]
};
}
case
REMOVE_DATASET_BY_ID
:
{
return
{
datasetIds
:
state
.
datasetIds
.
filter
((
d
)
=>
d
!==
datasetId
)
};
const
set
=
new
Set
(
state
.
datasetIds
);
datasetIds
.
forEach
((
id
)
=>
set
.
delete
(
id
));
return
{
datasetIds
:
[...
set
]
};
}
default
:
return
state
;
...
...
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