Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Re-enable OKD left navigation
Browse files Browse the repository at this point in the history
The default landing page is stil "Virtual Machines" (instead of "Home").

Except:
- service catalog
- Operator Lifecycle Management
- Builds
- Administration
  • Loading branch information
mareklibra authored and rawagner committed Oct 10, 2018
1 parent 6bdffab commit 5854930
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
3 changes: 2 additions & 1 deletion frontend/public/components/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ export class Nav extends React.Component {
const { isOpen } = this.state;

if (isKubevirt()) {
return <KubevirtNav isOpen={isOpen} onToggle={this.toggle} close={this.close} scroller={this.scroller} onWheel={this.preventScroll} />;
// The ResourceNSLink, HrefLink, Sep components are passed as props to eliminate the need for additional changes in OKD core code. Ugly anti-pattern, but serves its purpose.
return <KubevirtNav isOpen={isOpen} onToggle={this.toggle} close={this.close} scroller={this.scroller} onWheel={this.preventScroll} searchStartsWith={searchStartsWith} ResourceNSLink={ResourceNSLink} HrefLink={HrefLink} Sep={Sep} ResourceClusterLink={ResourceClusterLink} />;
}

return <React.Fragment>
Expand Down
54 changes: 48 additions & 6 deletions frontend/public/kubevirt/components/nav.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import * as React from 'react';
import * as classNames from 'classnames';

import {NavSection, ClusterPickerNavSection, UserNavSection} from './okdcomponents';
import {formatNamespacedRouteForResource} from '../ui/okdui-actions';
import * as routingImg from '../../imgs/routing.svg';
import * as routingActiveImg from '../../imgs/routing-active.svg';
import { FLAGS } from '../../features';

import { NavSection, ClusterPickerNavSection, UserNavSection } from './okdcomponents';
import { DeploymentConfigModel } from '../models';

// With respect to keep changes to OKD codebase at bare minimum,
// the navigation needs to be reconstructed
const Nav = ({ isOpen, onToggle, close, scroller, onWheel }) => {
// the navigation needs to be reconstructed.
// The ResourceNSLink, HrefLink, Sep components are passed as props to eliminate the need for additional changes in OKD core code. Ugly anti-pattern, but serves its purpose.
const Nav = ({ isOpen, onToggle, close, scroller, onWheel, searchStartsWith, ResourceNSLink, HrefLink, Sep, ResourceClusterLink }) => {
return (
<React.Fragment>
<button type="button" className="sidebar-toggle" aria-controls="sidebar" aria-expanded={isOpen} onClick={onToggle}>
Expand All @@ -18,8 +23,45 @@ const Nav = ({ isOpen, onToggle, close, scroller, onWheel }) => {
<div id="sidebar" className={classNames({'open': isOpen})}>
<ClusterPickerNavSection />
<div ref={scroller} onWheel={onWheel} className="navigation-container">
<NavSection text="Virtual Machines" href={formatNamespacedRouteForResource('virtualmachines')} icon="pficon pficon-home" />
<NavSection text="Templates" icon="pficon pficon-template" />
<NavSection text="Home" icon="pficon pficon-home">
<HrefLink href="/overview" name="Overview" activePath="/overview/" onClick={close} />
<HrefLink href="/status" name="Status" activePath="/status/" onClick={close} />
{/*<HrefLink href="/catalog" name="Catalog" activePath="/catalog/" onClick={close} />*/}
<HrefLink href="/search" name="Search" onClick={close} startsWith={searchStartsWith} />
<ResourceNSLink resource="events" name="Events" onClick={close} />
</NavSection>

<NavSection text="Workloads" icon="fa fa-folder-open-o">
<ResourceNSLink resource="virtualmachines" name="Virtual Machines" onClick={close} />

<ResourceNSLink resource="pods" name="Pods" onClick={close} />
<ResourceNSLink resource="deployments" name="Deployments" onClick={close} />
<ResourceNSLink resource="deploymentconfigs" name={DeploymentConfigModel.labelPlural} onClick={close} required={FLAGS.OPENSHIFT} />
<ResourceNSLink resource="statefulsets" name="Stateful Sets" onClick={close} />
<ResourceNSLink resource="secrets" name="Secrets" onClick={close} />
<ResourceNSLink resource="configmaps" name="Config Maps" onClick={close} />
<Sep />
<ResourceNSLink resource="cronjobs" name="Cron Jobs" onClick={close} />
<ResourceNSLink resource="jobs" name="Jobs" onClick={close} />
<ResourceNSLink resource="daemonsets" name="Daemon Sets" onClick={close} />
<ResourceNSLink resource="replicasets" name="Replica Sets" onClick={close} />
<ResourceNSLink resource="replicationcontrollers" name="Replication Controllers" onClick={close} />
<ResourceNSLink resource="horizontalpodautoscalers" name="HPAs" onClick={close} />
</NavSection>

<NavSection text="Networking" img={routingImg} activeImg={routingActiveImg} >
<ResourceNSLink resource="services" name="Services" onClick={close} />
<ResourceNSLink resource="routes" name="Routes" onClick={close} required={FLAGS.OPENSHIFT} />
<ResourceNSLink resource="ingresses" name="Ingress" onClick={close} />
<ResourceNSLink resource="networkpolicies" name="Network Policies" onClick={close} />
</NavSection>

<NavSection text="Storage" icon="pficon pficon-container-node">
<ResourceClusterLink resource="persistentvolumes" name="Persistent Volumes" onClick={close} required={FLAGS.CAN_LIST_PV} />
<ResourceNSLink resource="persistentvolumeclaims" name="Persistent Volume Claims" onClick={close} />
<ResourceClusterLink resource="storageclasses" name="Storage Classes" onClick={close} required={FLAGS.CAN_LIST_STORE} />
</NavSection>

<UserNavSection closeMenu={close} />
</div>
</div>
Expand Down

0 comments on commit 5854930

Please sign in to comment.