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
0741030f
Commit
0741030f
authored
Dec 09, 2020
by
Oleksii Savran
Browse files
Links to datasets and subsets
parent
519ac7d3
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/accession/AccessionDetailsPage.tsx
View file @
0741030f
...
...
@@ -21,6 +21,7 @@ interface IAccessionDetailsPageState {
interface
IAccessionDetailsPage
{
match
:
any
;
publicWebsiteUrl
:
string
;
}
class
AccessionDetailsPage
extends
React
.
Component
<
IAccessionDetailsPage
&
WithTranslation
&
WithConfig
,
IAccessionDetailsPageState
>
{
...
...
@@ -98,7 +99,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
public
render
()
{
const
{
accession
,
cartItems
}
=
this
.
state
;
const
{
t
,
appConfig
:
{
apiUrl
,
shoppingCart
,
map
},
appConfig
}
=
this
.
props
;
const
{
t
,
appConfig
:
{
apiUrl
,
shoppingCart
,
map
},
appConfig
,
publicWebsiteUrl
}
=
this
.
props
;
let
propertyIndex
=
0
;
...
...
@@ -281,7 +282,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
<
h2
className
=
"mt-4"
>
{
t
(
'
accession.subsets
'
)
}
</
h2
>
{
accession
.
subsets
.
map
((
subset
,
idx
)
=>
(
<
div
key
=
{
idx
}
>
<
h5
>
{
subset
.
title
}
</
h5
>
<
a
target
=
"_blank"
href
=
{
`
${
publicWebsiteUrl
}
/subset/
${
subset
.
uuid
}
`
}
>
{
subset
.
title
}
</
a
>
<
p
>
{
subset
.
description
}
</
p
>
</
div
>
))
}
...
...
@@ -293,7 +294,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
<
h2
className
=
"mt-4"
>
{
t
(
'
accession.datasets
'
)
}
</
h2
>
{
accession
.
datasets
.
map
((
dataset
,
idx
)
=>
(
<
div
key
=
{
idx
}
>
<
h5
>
{
dataset
.
title
}
</
h5
>
<
a
target
=
"_blank"
href
=
{
`
${
publicWebsiteUrl
}
/dataset/
${
dataset
.
uuid
}
`
}
>
{
dataset
.
title
}
</
a
>
<
p
>
{
dataset
.
description
}
</
p
>
</
div
>
))
}
...
...
@@ -324,6 +325,7 @@ class AccessionDetailsPage extends React.Component<IAccessionDetailsPage & WithT
const
mapStateToProps
=
(
state
)
=>
({
appConfig
:
state
.
appConfig
.
config
,
publicWebsiteUrl
:
(
state
.
apiInfo
.
apiInfo
&&
state
.
apiInfo
.
apiInfo
.
publicWebsiteUrl
)
||
''
,
});
export
default
connect
(
mapStateToProps
)(
withTranslation
()(
AccessionDetailsPage
));
src/core/actions/apiInfo.ts
0 → 100644
View file @
0741030f
import
{
ApiInfoService
}
from
'
@genesys/client/service
'
;
import
{
RECEIVE_API_INFO
}
from
'
core/constants/apiInfo
'
;
export
const
getApiInfo
=
()
=>
(
dispatch
)
=>
{
return
ApiInfoService
.
apiInfo
()
.
then
((
data
)
=>
{
console
.
log
(
'
apiInfo:
'
,
data
);
dispatch
({
type
:
RECEIVE_API_INFO
,
payload
:
data
,
});
})
.
catch
((
e
)
=>
{
console
.
log
(
'
Api info call failed:
'
,
e
);
});
};
src/core/constants/apiInfo.ts
0 → 100644
View file @
0741030f
export
const
RECEIVE_API_INFO
=
'
core/apiInfo/RECEIVE
'
;
src/core/reducer/apiInfo.ts
0 → 100644
View file @
0741030f
import
update
from
'
immutability-helper
'
;
import
{
RECEIVE_API_INFO
}
from
'
core/constants/apiInfo
'
;
import
ApiInfo
from
'
@genesys/client/model/ApiInfo
'
;
const
INITIAL_STATE
:
{
apiInfo
:
ApiInfo
,
}
=
{
apiInfo
:
null
,
};
export
default
(
state
=
INITIAL_STATE
,
action
:
{
type
?:
string
,
payload
?:
any
}
=
{
type
:
''
,
payload
:
{}
})
=>
{
switch
(
action
.
type
)
{
case
RECEIVE_API_INFO
:
{
return
update
(
state
,
{
apiInfo
:
{
$set
:
action
.
payload
},
});
}
default
:
return
state
;
}
}
src/core/reducer/index.ts
View file @
0741030f
import
{
combineReducers
}
from
'
redux
'
;
import
appConfig
from
'
core/reducer/appConfig
'
;
import
decoding
from
'
./decoding
'
;
import
apiInfo
from
'
./apiInfo
'
;
const
rootReducer
=
()
=>
(
combineReducers
({
appConfig
,
decoding
,
apiInfo
,
}));
...
...
src/serverinfo/ApiInfoPage.tsx
View file @
0741030f
import
React
from
'
react
'
;
import
{
ApiInfoDisplay
}
from
'
./ApiInfoDisplay
'
;
import
{
ApiInfoService
}
from
'
@genesys/client/service
'
;
import
PageTitle
from
'
ui/common/PageTitle
'
;
import
{
withTranslation
}
from
'
react-i18next
'
;
import
{
WithTranslation
,
withTranslation
}
from
'
react-i18next
'
;
import
{
connect
}
from
'
react-redux
'
;
import
ApiInfo
from
'
@genesys/client/model/ApiInfo
'
;
// interface IApiInfoPage extends React.ClassAttributes<any> {}
class
ApiInfoPage
extends
React
.
Component
<
any
,
any
>
{
public
state
=
{
apiInfo
:
null
,
};
public
componentDidMount
()
{
ApiInfoService
.
apiInfo
()
.
then
((
data
)
=>
{
console
.
log
(
'
apiInfo:
'
,
data
);
this
.
setState
({
apiInfo
:
data
});
})
.
catch
((
e
)
=>
{
console
.
log
(
'
Api info call failed:
'
,
e
);
});
}
interface
IApiInfoPage
extends
React
.
ClassAttributes
<
any
>
,
WithTranslation
{
apiInfo
:
ApiInfo
;
}
class
ApiInfoPage
extends
React
.
Component
<
IApiInfoPage
,
any
>
{
public
render
()
{
const
{
t
}
=
this
.
props
;
const
{
t
,
apiInfo
}
=
this
.
props
;
return
(
<>
<
PageTitle
title
=
{
t
(
'
pagetitle.apiInfo
'
)
}
/>
<
ApiInfoDisplay
data
=
{
this
.
state
.
apiInfo
}
/>
<
ApiInfoDisplay
data
=
{
apiInfo
}
/>
</>
);
};
}
export
default
withTranslation
()(
ApiInfoPage
);
const
mapStateToProps
=
(
state
)
=>
({
apiInfo
:
state
.
apiInfo
.
apiInfo
,
});
export
default
connect
(
mapStateToProps
)(
withTranslation
()(
ApiInfoPage
));
src/ui/core/App.tsx
View file @
0741030f
...
...
@@ -8,12 +8,14 @@ import AccessionDetails from 'accession/AccessionDetailsPage';
import
{
createHashHistory
}
from
'
history
'
;
import
{
bindActionCreators
}
from
'
redux
'
;
import
{
getCountryCodes
}
from
'
core/actions/decoding
'
;
import
{
getApiInfo
}
from
'
core/actions/apiInfo
'
;
import
{
withTranslation
,
WithTranslation
}
from
'
react-i18next
'
;
import
{
WithConfig
}
from
'
config/config
'
;
import
CartPage
from
'
request/CartPage
'
;
import
OverviewPage
from
'
accession/OverviewPage
'
;
import
RequestPage
from
'
request/RequestPage
'
;
import
MapPage
from
'
map/MapPage
'
;
import
ApiInfo
from
'
@genesys/client/model/ApiInfo
'
;
import
'
leaflet/dist/leaflet.css
'
;
...
...
@@ -21,12 +23,14 @@ const hashHistory = createHashHistory({});
interface
IAppProps
extends
React
.
ClassAttributes
<
any
>
{
getCountryCodes
:
(
lang
:
string
)
=>
Promise
<
Record
<
string
,
string
>>
;
getApiInfo
:
()
=>
Promise
<
ApiInfo
>
;
}
class
App
extends
React
.
Component
<
IAppProps
&
WithTranslation
&
WithConfig
,
any
>
{
public
componentDidMount
()
{
const
{
getCountryCodes
,
i18n
}
=
this
.
props
;
const
{
getCountryCodes
,
i18n
,
getApiInfo
}
=
this
.
props
;
getCountryCodes
(
i18n
.
language
);
getApiInfo
()
}
public
render
()
{
...
...
@@ -59,6 +63,7 @@ const mapStateToProps = (state) => ({
const
mapDispatchToProps
=
(
dispatch
)
=>
bindActionCreators
({
getCountryCodes
,
getApiInfo
,
},
dispatch
);
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
withTranslation
()(
App
));
...
...
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