Skip to content

Commit

Permalink
Change the URL when changing the Tabs in the Blueprint page
Browse files Browse the repository at this point in the history
Fixes #741
Closes #752
  • Loading branch information
KKoukiou committed Sep 6, 2019
1 parent b5ca894 commit d1e052c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pages/blueprint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ class BlueprintPage extends React.Component {
if (blueprint.customizations !== undefined && blueprint.customizations.user !== undefined) {
users = blueprint.customizations.user;
}
const pathSuffix = cockpit.location.path[cockpit.location.path.length - 1];
const activeKey = ["customizations", "packages", "images"].includes(pathSuffix) ? pathSuffix : undefined;

return (
<Layout className="container-fluid" ref={c => (this.layout = c)}>
Expand Down Expand Up @@ -374,7 +376,11 @@ class BlueprintPage extends React.Component {
</p>
</div>
</header>
<Tabs id="blueprint-tabs">
<Tabs
activeKey={activeKey}
onSelect={eventId => cockpit.location.go(["blueprint", blueprint.name, eventId])}
id="blueprint-tabs"
>
<Tab eventKey="customizations" title={formatMessage(messages.customizationsTitle)}>
<div className="tab-container row">
<div className="col-sm-12">
Expand Down
4 changes: 4 additions & 0 deletions routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"path": "/blueprint/:blueprint",
"page": "./pages/blueprint"
},
{
"path": "/blueprint/:blueprint/:subtab",
"page": "./pages/blueprint"
},
{
"path": "/edit/:blueprint",
"page": "./pages/blueprintEdit"
Expand Down

0 comments on commit d1e052c

Please sign in to comment.