Skip to content

Commit 0929471

Browse files
authored
hide only Publish option for allowHubPublish=false (#414)
1 parent 516252b commit 0929471

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src/dashboard/Dashboard.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,8 @@ export default class Dashboard extends React.Component {
473473
<Route path={ match.path + '/analytics' } render={AnalyticsRoute}/>
474474
<Redirect exact from={ match.path + '/settings' } to='/apps/:appId/settings/general' />
475475
<Route path={ match.path + '/settings' } render={SettingsRoute}/>
476-
477-
{user.allowHubPublish && (
478-
<>
479-
<Route exact path={ match.path + '/connections' } component={HubConnections} />
480-
<Route path={ match.path + '/hub-publish' } component={B4aHubPublishPage} />
481-
</>
482-
)}
476+
<Route exact path={ match.path + '/connections' } component={HubConnections} />
477+
{user.allowHubPublish && <Route path={ match.path + '/hub-publish' } component={B4aHubPublishPage} />}
483478
</Switch>
484479
</AppData>
485480
)

src/dashboard/DashboardView.react.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,10 @@ export default class DashboardView extends React.Component {
182182
link: '/analytics'
183183
})
184184

185-
if (user.allowHubPublish) {
186-
moreSubSection.push({
187-
name: 'Database HUB',
188-
link: '/connections'
189-
})
190-
}
185+
moreSubSection.push({
186+
name: 'Database HUB',
187+
link: '/connections'
188+
})
191189

192190
moreSubSection.push({
193191
name: 'Admin App',

src/dashboard/Hub/HubConnections.react.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import AccountManager from 'lib/AccountManager';
12
import PropTypes from 'prop-types'
23
import React from 'react'
34
import Swal from 'sweetalert2'
@@ -23,6 +24,8 @@ class HubConnections extends DashboardView {
2324
showDisconnectDialog: false,
2425
isDisconnecting: false
2526
};
27+
28+
this.user = AccountManager.currentUser();
2629
}
2730

2831
async componentDidMount() {
@@ -33,11 +36,14 @@ class HubConnections extends DashboardView {
3336
renderSidebar() {
3437
const { path } = this.props.match;
3538
const current = path.substr(path.lastIndexOf("/") + 1, path.length - 1);
39+
const categories = [
40+
{ name: 'Connections', id: 'connections' },
41+
];
42+
if (this.user.allowHubPublish) {
43+
categories.push({ name: 'Publish', id: 'hub-publish' })
44+
}
3645
return (
37-
<CategoryList current={current} linkPrefix={''} categories={[
38-
{ name: 'Connections', id: 'connections' },
39-
{ name: 'Publish', id: 'hub-publish' }
40-
]} />
46+
<CategoryList current={current} linkPrefix={''} categories={categories} />
4147
);
4248
}
4349

0 commit comments

Comments
 (0)