add choose link to current data bundle component
import React, { Component } from 'react'
+import { Link, withRouter } from "react-router-dom";
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import { Message } from 'semantic-ui-react';
+import urls from 'urls'
class CurrentDataBundleName extends Component {
render() {
- const { t, name } = this.props
+ const { t, name, match } = this.props
+
+ const link = (match.url !== urls.gui.dataBundle.index) ? (
+ <>
+ &nbsp;
+ <Link to={urls.gui.dataBundle.index}>
+ { t('model.common.chooseOrNewLabel') }
+ </Link>
+ </>
+ ) : ( null )
const current = name ?
(
@@ -16,6 +27,7 @@ class CurrentDataBundleName extends Component {
) : (
<Message negative>
{ t('dataBundle.common.noCurrentDataBundleLabel') }
+ { link }
</Message>
)
@@ -30,4 +42,8 @@ const mapStateToProps = state => {
name: state.dataBundle.name
}
}
-export default connect(mapStateToProps)(translate('common')(CurrentDataBundleName))
+export default withRouter(
+ connect(mapStateToProps)(
+ translate('common')(CurrentDataBundleName)
+ )
+)
\ No newline at end of file
