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
Embedded Genesys UI
Commits
9606ef40
Commit
9606ef40
authored
Nov 19, 2020
by
Matija Obreza
Browse files
Merge branch '17-overviews-only' into 'master'
Resolve "Overviews only" Closes
#17
See merge request
!13
parents
f7e7c579
301fce9d
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
.eslintrc
View file @
9606ef40
...
...
@@ -34,7 +34,7 @@
"error",
{
"types": {
"object": false
//
"object": false
}
}
],
...
...
src/genesys.tsx
View file @
9606ef40
...
...
@@ -8,6 +8,7 @@ import { reconfigureServiceAxios, LoginService } from '@genesys/client/service';
import
App
from
'
./ui/App
'
;
import
ApiAccessError
from
'
./ui/ApiAccessError
'
;
import
{
Config
,
DefaultConfig
}
from
'
../config/config
'
;
import
OverviewPage
from
'
./ui/OverviewPage
'
;
// declare const window: Window & { devToolsExtension: any, __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any, initialLanguage: any, initialI18nStore: any, localeMapping: any };
// const AUTH_COOKIE = 'GENESYS_AUTH';
...
...
@@ -62,3 +63,25 @@ export function showGenesysUI(holdingNode: HTMLElement, config: Config = Default
);
});
}
export
function
showOverview
(
holdingNode
:
HTMLElement
,
config
:
Config
=
DefaultConfig
,
language
:
string
=
'
en
'
)
{
const
{
apiUrl
,
clientId
,
clientKey
,
filter
}
=
config
;
reconfigureServiceAxios
({
apiUrl
});
initI18n
(
language
);
checkAccessTokens
(
apiUrl
,
clientId
,
clientKey
).
then
(
(
result
)
=>
{
ReactDOM
.
render
(
<
OverviewPage
filter
=
{
filter
}
/>,
holdingNode
,
);
}).
catch
((
err
)
=>
{
log
(
'
Oh, oh
'
,
err
);
ReactDOM
.
render
(
<
ApiAccessError
error
=
{
err
}
apiUrl
=
{
apiUrl
}
/>,
holdingNode
,
);
});
}
src/ui/OverviewPage.tsx
View file @
9606ef40
import
*
as
React
from
'
react
'
;
import
{
WithTranslation
,
withTranslation
}
from
'
react-i18next
'
;
import
{
parse
}
from
'
query-string
'
;
// Models
import
{
IPageRequest
}
from
'
@genesys/client/model/FilteredPage
'
;
import
{
AccessionService
}
from
'
@genesys/client/service
'
;
// UI
...
...
@@ -12,7 +10,6 @@ import AccessionFilter from '@genesys/client/model/accession/AccessionFilter';
interface
IOverviewPageProps
extends
React
.
ClassAttributes
<
any
>
,
WithTranslation
{
filter
:
AccessionFilter
;
location
:
any
;
}
class
BrowsePage
extends
React
.
Component
<
IOverviewPageProps
,
any
>
{
...
...
@@ -25,9 +22,9 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
}
}
private
loadData
=
(
pageR
:
IPageRequest
):
Promise
<
any
>
=>
{
private
loadData
=
():
Promise
<
any
>
=>
{
return
AccessionService
.
listOverview
(
this
.
props
.
filter
,
pageR
)
.
listOverview
(
this
.
props
.
filter
)
.
then
((
data
)
=>
{
console
.
log
(
'
overview:
'
,
data
);
this
.
setState
({
overviewData
:
data
});
...
...
@@ -40,8 +37,7 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
public
componentDidMount
()
{
if
(
typeof
window
!==
'
undefined
'
)
{
// Call should be started only on client side
const
current
=
+
parse
(
this
.
props
.
location
.
search
).
p
this
.
loadData
(
current
?
{
page
:
current
}
:
{});
this
.
loadData
();
}
}
...
...
yarn.lock
View file @
9606ef40
This diff is collapsed.
Click to expand it.
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