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
21
Issues
21
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
2e74ba79
Commit
2e74ba79
authored
May 02, 2019
by
Viacheslav Pavlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix "Bug: Filtering Subsets in the Dashboard"
parent
65a1d30a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
src/subsets/actions/dashboard.ts
src/subsets/actions/dashboard.ts
+2
-2
src/subsets/ui/dashboard/DashboardPage.tsx
src/subsets/ui/dashboard/DashboardPage.tsx
+15
-10
No files found.
src/subsets/actions/dashboard.ts
View file @
2e74ba79
...
@@ -48,8 +48,8 @@ export const loadSubset = (uuid: string) => (dispatch) => {
...
@@ -48,8 +48,8 @@ export const loadSubset = (uuid: string) => (dispatch) => {
return
dispatch
(
apiLoadSubset
(
uuid
));
return
dispatch
(
apiLoadSubset
(
uuid
));
};
};
export
const
loadMoreSubsets
=
(
paged
?:
Page
<
Subset
>
)
=>
(
dispatch
)
=>
{
export
const
loadMoreSubsets
=
(
paged
:
Filtered
Page
<
Subset
>
)
=>
(
dispatch
)
=>
{
return
dispatch
(
apiListSubsets
(
''
,
Page
.
nextPage
(
paged
)));
return
dispatch
(
apiListSubsets
(
paged
?
paged
.
filterCode
:
''
,
Page
.
nextPage
(
paged
)));
};
};
export
const
loadMoreAccessions
=
(
uuid
:
string
,
paged
?:
Page
<
AccessionRef
>
)
=>
(
dispatch
,
getState
)
=>
{
export
const
loadMoreAccessions
=
(
uuid
:
string
,
paged
?:
Page
<
AccessionRef
>
)
=>
(
dispatch
,
getState
)
=>
{
...
...
src/subsets/ui/dashboard/DashboardPage.tsx
View file @
2e74ba79
...
@@ -12,6 +12,7 @@ import FilteredPage from 'model/FilteredPage';
...
@@ -12,6 +12,7 @@ import FilteredPage from 'model/FilteredPage';
import
Subset
from
'
model/subset/Subset
'
;
import
Subset
from
'
model/subset/Subset
'
;
import
SubsetFilter
from
'
model/subset/SubsetFilter
'
;
import
SubsetFilter
from
'
model/subset/SubsetFilter
'
;
import
{
SortDirection
,
IPageRequest
}
from
'
model/Page
'
;
import
{
SortDirection
,
IPageRequest
}
from
'
model/Page
'
;
import
ApiCall
from
'
model/ApiCall
'
;
// UI
// UI
import
SubsetFilters
from
'
./c/SubsetFilters
'
;
import
SubsetFilters
from
'
./c/SubsetFilters
'
;
...
@@ -26,7 +27,7 @@ import PaginationComponent from 'ui/common/pagination';
...
@@ -26,7 +27,7 @@ import PaginationComponent from 'ui/common/pagination';
import
PrettyFilters
from
'
ui/common/filter/PrettyFilters
'
;
import
PrettyFilters
from
'
ui/common/filter/PrettyFilters
'
;
interface
IDashboardPageProps
extends
React
.
ClassAttributes
<
any
>
{
interface
IDashboardPageProps
extends
React
.
ClassAttributes
<
any
>
{
paged
:
FilteredPage
<
Subset
>
;
apiCall
:
ApiCall
<
FilteredPage
<
Subset
>
>
;
loadMoreSubsets
:
(
page
?:
FilteredPage
<
Subset
>
)
=>
void
;
loadMoreSubsets
:
(
page
?:
FilteredPage
<
Subset
>
)
=>
void
;
createNewVersion
:
(
uuid
:
string
)
=>
void
;
createNewVersion
:
(
uuid
:
string
)
=>
void
;
login
:
any
;
login
:
any
;
...
@@ -56,7 +57,8 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
...
@@ -56,7 +57,8 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
}
}
public
componentWillMount
()
{
public
componentWillMount
()
{
const
{
paged
,
applyFilters
,
filterCode
}
=
this
.
props
;
const
{
apiCall
,
applyFilters
,
filterCode
}
=
this
.
props
;
const
{
data
:
paged
}
=
apiCall
||
{
data
:
undefined
};
if
(
filterCode
)
{
if
(
filterCode
)
{
if
(
!
paged
||
paged
.
filterCode
!==
filterCode
)
{
if
(
!
paged
||
paged
.
filterCode
!==
filterCode
)
{
applyFilters
(
filterCode
);
applyFilters
(
filterCode
);
...
@@ -67,18 +69,19 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
...
@@ -67,18 +69,19 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
}
}
public
componentWillReceiveProps
(
nextProps
)
{
public
componentWillReceiveProps
(
nextProps
)
{
const
{
filterCode
:
prev
Code
,
paged
:
prevPaged
}
=
this
.
props
;
const
{
filterCode
:
prev
FilterCode
}
=
this
.
props
;
const
{
filterCode
,
applyFilters
,
paged
}
=
nextProps
;
const
{
filterCode
,
applyFilters
,
apiCall
}
=
nextProps
;
if
(
prevPaged
&&
paged
&&
_
.
isEqual
(
paged
.
filter
,
prevPaged
.
filter
)
)
{
if
(
filterCode
!==
prevFilterCode
)
{
if
(
prev
Code
!==
filterCode
)
{
if
(
apiCall
&&
apiCall
.
data
&&
!
apiCall
.
loading
&&
apiCall
.
data
.
filter
Code
!==
filterCode
)
{
applyFilters
(
filterCode
||
''
);
applyFilters
(
filterCode
||
''
);
}
}
}
}
}
}
protected
myApplyFilters
=
(
filters
:
SubsetFilter
)
=>
{
protected
myApplyFilters
=
(
filters
:
SubsetFilter
)
=>
{
const
{
paged
,
applyFilters
}
=
this
.
props
;
const
{
apiCall
,
applyFilters
}
=
this
.
props
;
const
{
data
:
paged
}
=
apiCall
||
{
data
:
undefined
};
if
(
paged
)
{
if
(
paged
)
{
applyFilters
(
filters
,
{
page
:
0
,
direction
:
paged
.
sort
[
0
].
direction
,
properties
:
[
paged
.
sort
[
0
].
property
]
});
applyFilters
(
filters
,
{
page
:
0
,
direction
:
paged
.
sort
[
0
].
direction
,
properties
:
[
paged
.
sort
[
0
].
property
]
});
}
else
{
}
else
{
...
@@ -87,7 +90,8 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
...
@@ -87,7 +90,8 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
}
}
protected
onSortChange
=
(
sortBy
:
string
,
dir
:
SortDirection
)
=>
{
protected
onSortChange
=
(
sortBy
:
string
,
dir
:
SortDirection
)
=>
{
const
{
paged
,
applyFilters
,
filterCode
}
=
this
.
props
;
const
{
apiCall
,
applyFilters
,
filterCode
}
=
this
.
props
;
const
{
data
:
paged
}
=
apiCall
||
{
data
:
undefined
};
applyFilters
(
filterCode
||
paged
.
filterCode
||
''
,
FilteredPage
.
reSort
(
paged
,
sortBy
,
dir
));
applyFilters
(
filterCode
||
paged
.
filterCode
||
''
,
FilteredPage
.
reSort
(
paged
,
sortBy
,
dir
));
}
}
...
@@ -97,7 +101,8 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
...
@@ -97,7 +101,8 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
}
}
public
render
()
{
public
render
()
{
const
{
paged
,
login
:
{
authorities
:
userRoles
},
loadMoreSubsets
,
t
}
=
this
.
props
;
const
{
apiCall
,
login
:
{
authorities
:
userRoles
},
loadMoreSubsets
,
t
}
=
this
.
props
;
const
{
data
:
paged
}
=
apiCall
||
{
data
:
undefined
};
const
renderSubset
=
(
s
:
Subset
,
index
:
number
)
=>
{
const
renderSubset
=
(
s
:
Subset
,
index
:
number
)
=>
{
return
(
return
(
<
SubsetCard
<
SubsetCard
...
@@ -148,7 +153,7 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
...
@@ -148,7 +153,7 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
}
}
const
mapStateToProps
=
(
state
,
ownProps
)
=>
({
const
mapStateToProps
=
(
state
,
ownProps
)
=>
({
paged
:
state
.
subsets
.
dashboard
.
paged
?
state
.
subsets
.
dashboard
.
paged
.
data
:
undefin
ed
,
apiCall
:
state
.
subsets
.
dashboard
.
pag
ed
,
login
:
state
.
login
,
login
:
state
.
login
,
filterCode
:
ownProps
.
match
.
params
.
filterCode
,
filterCode
:
ownProps
.
match
.
params
.
filterCode
,
dataClassName
:
Subset
.
clazz
,
dataClassName
:
Subset
.
clazz
,
...
...
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