Skip to content

Commit 5ea7b93

Browse files
committed
add GraphCreatePanel link to empty panel
1 parent 7b652c2 commit 5ea7b93

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

src/components/PanelMenuWrapper.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class PanelsWithSidebar extends Component {
2323
this.setState({group, panel});
2424
}
2525

26+
getChildContext() {
27+
return {
28+
setPanel: this.setPanel,
29+
};
30+
}
31+
2632
renderSection(section, i) {
2733
if (
2834
section.type &&
@@ -100,4 +106,8 @@ PanelsWithSidebar.propTypes = {
100106
children: PropTypes.node,
101107
};
102108

109+
PanelsWithSidebar.childContextTypes = {
110+
setPanel: PropTypes.func,
111+
};
112+
103113
export default PanelsWithSidebar;

src/components/containers/PanelEmpty.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class PanelEmpty extends Component {
77
render() {
88
const {children, icon: Icon} = this.props;
99
const heading = this.props.heading || '';
10-
const message = this.props.message || '';
1110

1211
return (
1312
<div className={bem('panel', 'empty')}>
@@ -16,10 +15,7 @@ class PanelEmpty extends Component {
1615
{Icon ? <Icon /> : <ChartLineIcon />}
1716
</div>
1817
<div className="panel__empty__message__heading">{heading}</div>
19-
<div className="panel__empty__message__content">
20-
<p>{message}</p>
21-
{children}
22-
</div>
18+
<div className="panel__empty__message__content">{children}</div>
2319
</div>
2420
</div>
2521
);
@@ -28,7 +24,6 @@ class PanelEmpty extends Component {
2824

2925
PanelEmpty.propTypes = {
3026
heading: PropTypes.string,
31-
message: PropTypes.any,
3227
children: PropTypes.node,
3328
icon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
3429
};

src/components/containers/TraceRequiredPanel.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,44 @@ class TraceRequiredPanel extends Component {
1111
render() {
1212
const {localize: _} = this.context;
1313
const {children, ...rest} = this.props;
14+
<<<<<<< HEAD
15+
=======
16+
let showPanel = true;
17+
let heading = '';
18+
>>>>>>> e9befe5... add GraphCreatePanel link to empty panel
1419

1520
if (!this.props.visible) {
1621
return null;
1722
}
1823

24+
<<<<<<< HEAD
1925
return this.hasTrace() ? (
2026
<LayoutPanel {...rest}>{children}</LayoutPanel>
2127
) : (
2228
<PanelEmpty
2329
heading={_("Looks like there aren't any traces defined yet.")}
2430
>
31+
=======
32+
if (!this.hasTrace()) {
33+
showPanel = false;
34+
heading = _("Looks like there aren't any traces defined yet.");
35+
}
36+
37+
return showPanel ? (
38+
<LayoutPanel {...rest}>{children}</LayoutPanel>
39+
) : (
40+
<PanelEmpty heading={heading}>
41+
>>>>>>> e9befe5... add GraphCreatePanel link to empty panel
2542
<p>
2643
{_('Go to the ')}
2744
<a onClick={() => this.context.setPanel('Graph', 'Create')}>
2845
{_('Create')}
2946
</a>
47+
<<<<<<< HEAD
3048
{_(' panel to define traces.')}
49+
=======
50+
{_(' tab to define traces.')}
51+
>>>>>>> e9befe5... add GraphCreatePanel link to empty panel
3152
</p>
3253
</PanelEmpty>
3354
);
@@ -46,6 +67,7 @@ TraceRequiredPanel.defaultProps = {
4667
TraceRequiredPanel.contextTypes = {
4768
fullData: PropTypes.array,
4869
localize: PropTypes.func,
70+
setPanel: PropTypes.func,
4971
};
5072

5173
export default TraceRequiredPanel;

src/styles/components/containers/_panel.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
font-size: var(--font-size-base);
8686
color: var(--color-text-base);
8787
line-height: var(--font-leading-body);
88+
a {
89+
color: $color-dodger-shade;
90+
cursor: pointer;
91+
}
8892
}
8993
}
9094
}

0 commit comments

Comments
 (0)