Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): Support namespaced pipelines from the UI. Closes #5084 #8831

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions frontend/src/atoms/MD2Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import * as React from 'react';
import Button from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip';
import Separator from './Separator';
import { color, fontsize } from '../Css';
import { classes, stylesheet } from 'typestyle';
Expand All @@ -24,7 +25,7 @@ import { logger } from '../lib/Utils';
interface MD2TabsProps {
onSwitch?: (tab: number) => void;
selectedTab: number;
tabs: string[];
tabs: (string | { header: string; tooltip: string })[];
}

const css = stylesheet({
Expand Down Expand Up @@ -74,22 +75,30 @@ class MD2Tabs extends React.Component<MD2TabsProps, any> {
public render(): JSX.Element {
const selected = this._getSelectedIndex();
const switchHandler = this.props.onSwitch || (() => null);
const tabs = this.props.tabs.map(tab => {
if (typeof tab === 'string') {
return { header: tab, tooltip: '' };
}
return tab;
});
return (
<div className={css.tabs} ref={this._rootRef}>
<div className={css.indicator} ref={this._indicatorRef} />
<Separator units={20} />
{this.props.tabs.map((tab, i) => (
<Button
className={classes(css.button, i === selected ? css.active : '')}
key={i}
onClick={() => {
if (i !== selected) {
switchHandler(i);
}
}}
>
<span ref={this._tabRefs[i]}>{tab}</span>
</Button>
{tabs.map((tab, i) => (
<Tooltip title={tab.tooltip} placement='top-start' key={i}>
<Button
className={classes(css.button, i === selected ? css.active : '')}
key={i}
onClick={() => {
if (i !== selected) {
switchHandler(i);
}
}}
>
<span ref={this._tabRefs[i]}>{tab.header}</span>
</Button>
</Tooltip>
))}
</div>
);
Expand Down
Loading