Skip to content

Commit

Permalink
Content/flatten navbar link items (#174)
Browse files Browse the repository at this point in the history
* #173: flattened navbar links items

* #173: fixed slice builder image issue
  • Loading branch information
yaxue1123 authored May 16, 2022
1 parent c3984aa commit 5361074
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
63 changes: 40 additions & 23 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ class Header extends React.Component {
child: [],
exact: false,
},
{
name: "Links",
path: "/links",
child: [
{ name: "Knowledge Base", href: portalData.knowledgeBaseLink, path: ""},
{ name: "JupyterHub", href: this.jupyterLinkMap[checkPortalType(window.location.href)], path: ""}
],
exact: false
},
{
name: "Knowledge Base",
href: portalData.knowledgeBaseLink,
child: [],
path: ""
},
{
name: "JupyterHub",
href: this.jupyterLinkMap[checkPortalType(window.location.href)],
child: [],
path: ""
},
{ name: "User Profile", path: "/user", child: [], exact: false },
],
};
Expand Down Expand Up @@ -114,20 +117,34 @@ class Header extends React.Component {
}
key={index}
>
<NavLink
className={
"nav-link" +
(item.child.length > 0 ? " dropdown-toggle" : "")
}
to={item.path}
id={`navbarDropdownMenuLink-${index}`}
data-toggle={item.child.length > 0 ? "dropdown" : ""}
aria-haspopup="true"
aria-expanded="false"
exact={item.exact}
>
{item.name}
</NavLink>
{
item.href && <a
className="nav-link"
key={item.name}
href={item.href}
target="_blank"
rel="noreferrer"
>
{item.name}
</a>
}
{
!item.href &&
<NavLink
className={
"nav-link" +
(item.child.length > 0 ? " dropdown-toggle" : "")
}
to={item.path}
id={`navbarDropdownMenuLink-${index}`}
data-toggle={item.child.length > 0 ? "dropdown" : ""}
aria-haspopup="true"
aria-expanded="false"
exact={item.exact}
>
{item.name}
</NavLink>
}
{item.child.length > 0 && (
<div
className="dropdown-menu"
Expand Down
6 changes: 3 additions & 3 deletions src/components/SliceViewer/SideNodes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class SideNodes extends React.Component {

handleAddNode = () => {
// type: currently only support 'VM'
const { selectedSite, nodeName, nodeType, core, ram, disk, imageType, imageRef, nodeComponents } = this.state;
const image = `${imageRef},${imageType}`;
const { selectedSite, nodeName, nodeType, core, ram, disk, imageType, selectedImageRef, nodeComponents } = this.state;
const image = `${selectedImageRef},${imageType}`;
this.props.onNodeAdd(nodeType, selectedSite, nodeName, core, ram, disk, image, nodeComponents);
this.setState({ selectedSite: "", nodeName: "", nodeComponents: [], selectedImageRef: "default_rocky_8" })
}
Expand Down Expand Up @@ -90,7 +90,7 @@ class SideNodes extends React.Component {
}

handleImageRefChange = (e) => {
this.setState({ imageRef: e.target.value })
this.setState({ selectedImageRef: e.target.value })
}

getSiteResource = () => {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/NewSliceForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ class NewSliceForm extends React.Component {
const { data } = await createSlice(requestData);
toast.success("Slice created successfully.");
// redirect users directly to the new slice page
// const slice_id = data["value"]["reservations"][0].slice_id;
this.props.history.push("/experiments#slices")
const slice_id = data["value"]["reservations"][0].slice_id;
// this.props.history.push("/experiments#slices");
this.props.history.push(`/slices/${slice_id}`)
} catch (ex) {
console.log("failed to create slice: " + ex.response.data);
toast.error("Failed to create slice.");
Expand Down

0 comments on commit 5361074

Please sign in to comment.