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
e529006d
Commit
e529006d
authored
Jan 17, 2019
by
Viacheslav Pavlov
Browse files
Browser back navigation
parent
566dece5
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/accessions/ui/OverviewPage.tsx
View file @
e529006d
...
...
@@ -60,6 +60,16 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
applyOverviewFilters
(
filterCode
||
''
);
}
}
public
componentWillReceiveProps
(
nextProps
)
{
const
{
filterCode
:
prevCode
,
overview
:
prevOverview
}
=
this
.
props
;
const
{
filterCode
,
applyOverviewFilters
,
overview
}
=
nextProps
;
if
(
prevOverview
&&
overview
&&
_
.
isEqual
(
overview
.
filter
,
prevOverview
.
filter
))
{
if
(
prevCode
!==
filterCode
)
{
applyOverviewFilters
(
filterCode
||
''
);
}
}
}
private
addTerm
=
(
property
,
term
)
=>
{
const
{
overview
,
applyOverviewFilters
,
showSnackbar
}
=
this
.
props
;
...
...
src/actions/navigation.ts
View file @
e529006d
...
...
@@ -4,15 +4,19 @@ import { stringify } from 'query-string';
const
IN_BROWSER
=
typeof
window
!==
'
undefined
'
;
export
function
navigateTo
(
path
:
string
,
query
?:
object
)
{
return
(
dispatch
)
=>
{
return
(
dispatch
,
getState
)
=>
{
if
(
!
IN_BROWSER
)
{
console
.
log
(
'
Not navigating anywhere while on the server!
'
);
return
;
}
if
(
!
query
)
{
dispatch
(
push
(
path
?
path
:
''
));
}
else
{
dispatch
(
push
(
`
${
path
?
path
:
''
}
?`
+
stringify
(
query
)));
const
location
=
getState
().
routing
.
location
.
pathname
;
if
(
location
!==
path
)
{
if
(
!
query
)
{
dispatch
(
push
(
path
?
path
:
''
));
}
else
{
dispatch
(
push
(
`
${
path
?
path
:
''
}
?`
+
stringify
(
query
)));
}
}
};
}
...
...
src/datasets/ui/dashboard/DashboardPage.tsx
View file @
e529006d
...
...
@@ -23,6 +23,7 @@ const mapStateToProps = (state, ownProps) => ({
paged
:
state
.
datasets
.
dashboard
.
paged
,
tab
:
'
datasets
'
,
dataClassName
:
Dataset
.
clazz
,
filterCode
:
ownProps
.
match
.
params
.
filterCode
,
});
const
mapDispatchToProps
=
(
dispatch
)
=>
bindActionCreators
({
...
...
src/descriptorlists/ui/dashboard/DashboardPage.tsx
View file @
e529006d
...
...
@@ -21,6 +21,7 @@ const mapStateToProps = (state, ownProps) => ({
paged
:
state
.
descriptorList
.
dashboard
.
paged
,
tab
:
'
descriptorlists
'
,
dataClassName
:
DescriptorList
.
clazz
,
filterCode
:
ownProps
.
match
.
params
.
filterCode
,
});
const
mapDispatchToProps
=
(
dispatch
)
=>
bindActionCreators
({
...
...
src/descriptors/ui/dashboard/DashboardPage.tsx
View file @
e529006d
...
...
@@ -23,6 +23,7 @@ const mapStateToProps = (state, ownProps) => ({
paged
:
state
.
descriptors
.
dashboard
.
paged
,
tab
:
'
descriptors
'
,
dataClassName
:
Descriptor
.
clazz
,
filterCode
:
ownProps
.
match
.
params
.
filterCode
,
filterComponent
:
DashboardDescriptorFilters
,
});
...
...
src/subsets/ui/dashboard/DashboardPage.tsx
View file @
e529006d
...
...
@@ -69,9 +69,13 @@ class DashboardPage extends React.Component<IDashboardPageProps> {
}
public
componentWillReceiveProps
(
nextProps
)
{
const
{
applyFilters
,
filterCode
}
=
this
.
props
;
if
(
filterCode
&&
(
!
nextProps
.
filterCode
))
{
applyFilters
(
''
);
const
{
filterCode
:
prevCode
,
paged
:
prevPaged
}
=
this
.
props
;
const
{
filterCode
,
applyFilters
,
paged
}
=
nextProps
;
if
(
prevPaged
&&
paged
&&
_
.
isEqual
(
paged
.
filter
,
prevPaged
.
filter
))
{
if
(
prevCode
!==
filterCode
)
{
applyFilters
(
filterCode
||
''
);
}
}
}
...
...
src/ui/catalog/dashboard/MyDataPage.tsx
View file @
e529006d
...
...
@@ -31,6 +31,7 @@ interface IDataPublishedContainerProps extends React.ClassAttributes<any> {
paged
:
FilteredPage
<
any
>
;
preFilter
?:
object
;
basePath
:
string
;
filterCode
:
string
;
filterCodeToUrl
:
any
;
listMyData
:
any
;
dataClassName
:
string
;
...
...
@@ -95,12 +96,18 @@ class BaseMyDataPage<T> extends React.Component<T & IDataPublishedContainerProps
}
public
componentWillReceiveProps
(
nextProps
)
{
const
{
filterCodeToUrl
,
paged
}
=
this
.
props
;
if
(
paged
)
{
filterCodeToUrl
(
paged
.
filterCode
);
const
{
filterCode
:
prevCode
,
paged
}
=
this
.
props
;
const
{
filterCode
,
tab
,
pagination
}
=
nextProps
;
// if (paged) {
// filterCodeToUrl(paged.filterCode);
// }
if
(
paged
&&
paged
.
filterCode
!==
filterCode
)
{
if
(
filterCode
!==
prevCode
)
{
this
.
loadData
(
filterCode
,
tab
,
pagination
.
page
,
pagination
.
size
,
pagination
.
sort
,
pagination
.
dir
);
}
}
const
{
tab
}
=
nextProps
;
if
(
tab
!==
this
.
state
.
tab
)
{
const
{
pagination
}
=
nextProps
;
this
.
loadData
(
null
,
tab
,
pagination
.
page
,
pagination
.
size
,
pagination
.
sort
,
pagination
.
dir
);
...
...
@@ -114,7 +121,7 @@ class BaseMyDataPage<T> extends React.Component<T & IDataPublishedContainerProps
const
Filters
=
filterComponent
?
filterComponent
:
DashboardFilters
;
return
(
<
ContentLayout
customHeaderHeight
left
=
{
<
Filters
initialValues
=
{
pag
ination
.
filter
}
onSubmit
=
{
this
.
onFilter
}
/>
}
>
<
ContentLayout
customHeaderHeight
left
=
{
<
Filters
initialValues
=
{
pag
ed
&&
paged
.
filter
}
onSubmit
=
{
this
.
onFilter
}
/>
}
>
<
MyDataTable
tab
=
{
tab
}
filterComponent
=
{
filterComponent
}
...
...
@@ -151,8 +158,8 @@ class BaseMyDataPage<T> extends React.Component<T & IDataPublishedContainerProps
protected
loadData
(
filter
,
tab
,
page
,
size
,
sortBy
,
dir
)
{
const
{
listMyData
,
preFilter
,
pagination
,
onPageChange
}
=
this
.
props
;
const
newFilters
=
filter
&&
{
...
preFilter
,
...
filter
};
const
{
listMyData
,
preFilter
,
pagination
,
filterCode
,
onPageChange
}
=
this
.
props
;
const
newFilters
=
typeof
filter
===
'
string
'
?
filter
:
filter
&&
{
...
preFilter
,
...
filter
};
// console.log(`Filters code=${filterCode}`, newFilters, preFilter);
if
(
newFilters
||
this
.
state
.
tab
!==
tab
||
this
.
state
.
pagination
.
page
!==
page
||
this
.
state
.
pagination
.
size
!==
size
||
this
.
state
.
pagination
.
sort
!==
sortBy
||
this
.
state
.
pagination
.
dir
!==
dir
)
{
...
...
@@ -169,7 +176,7 @@ class BaseMyDataPage<T> extends React.Component<T & IDataPublishedContainerProps
},
}));
listMyData
({
page
,
size
,
sort
:
[{
property
:
sortBy
}],
filterCode
:
newFilters
||
pagination
.
filterCode
,
direction
:
dir
});
listMyData
({
page
,
size
,
sort
:
[{
property
:
sortBy
}],
filterCode
:
newFilters
||
filterCode
,
direction
:
dir
});
}
}
}
...
...
src/ui/pages/_base/BrowsePage.tsx
View file @
e529006d
import
*
as
React
from
'
react
'
;
import
*
as
_
from
'
lodash
'
;
// Models
import
FilteredPage
from
'
model/FilteredPage
'
;
...
...
@@ -31,6 +32,17 @@ class BrowsePage<T> extends React.Component<IBrowsePageProps<T> & any, any> {
}
}
public
componentWillReceiveProps
(
nextProps
)
{
const
{
filterCode
:
prevCode
,
paged
:
prevPaged
}
=
this
.
props
;
const
{
filterCode
,
applyFilters
,
paged
}
=
nextProps
;
if
(
prevPaged
&&
paged
&&
_
.
isEqual
(
paged
.
filter
,
prevPaged
.
filter
))
{
if
(
prevCode
!==
filterCode
)
{
applyFilters
(
filterCode
||
''
);
}
}
}
protected
onSortChange
=
(
sortBy
:
string
,
dir
:
SortDirection
)
=>
{
const
{
paged
,
loadMoreData
}
=
this
.
props
;
loadMoreData
(
FilteredPage
.
reSort
(
paged
,
sortBy
,
dir
));
...
...
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