Commit 8a9d721c by Torkel Ödegaard

panel-edit-ux-tabs on top alternative

parent 964a21b0
...@@ -87,7 +87,50 @@ export class PanelEditor extends PureComponent<PanelEditorProps> { ...@@ -87,7 +87,50 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
}; };
render() { render() {
return this.renderAsTabs();
// return this.renderAsBoxes();
// const { location } = store.getState();
// const activeTab = location.query.tab || 'queries';
//
// return (
// <div className="panel-editor-container__editor">
// <div className="panel-editor-resizer">
// <div className="panel-editor-resizer__handle">
// <div className="panel-editor-resizer__handle-dots" />
// </div>
// </div>
// <div className="panel-editor__aside">
// <h2 className="panel-editor__aside-header">
// <i className="fa fa-cog" />
// Edit Panel
// </h2>
//
// {this.tabs.map(tab => {
// return <TabItem tab={tab} activeTab={activeTab} onClick={this.onChangeTab} key={tab.id} />;
// })}
//
// <div className="panel-editor__aside-actions">
// <button className="btn btn-secondary" onClick={this.onClose}>
// Back to dashboard
// </button>
// <button className="btn btn-inverse" onClick={this.onClose}>
// Discard changes
// </button>
// </div>
// </div>
// <div className="panel-editor__content">
// <CustomScrollbar>
// {activeTab === 'queries' && this.renderQueriesTab()}
// {activeTab === 'visualization' && this.renderVizTab()}
// </CustomScrollbar>
// </div>
// </div>
// );
}
renderAsTabs() {
const { location } = store.getState(); const { location } = store.getState();
const { panel } = this.props;
const activeTab = location.query.tab || 'queries'; const activeTab = location.query.tab || 'queries';
return ( return (
...@@ -97,31 +140,50 @@ export class PanelEditor extends PureComponent<PanelEditorProps> { ...@@ -97,31 +140,50 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
<div className="panel-editor-resizer__handle-dots" /> <div className="panel-editor-resizer__handle-dots" />
</div> </div>
</div> </div>
<div className="panel-editor__aside">
<h2 className="panel-editor__aside-header"> <div className="tabbed-view tabbed-view--new">
<i className="fa fa-cog" /> <div className="tabbed-view-header">
Edit Panel <h3 className="tabbed-view-panel-title">{panel.title}</h3>
</h2>
<ul className="gf-tabs">
{this.tabs.map(tab => { {this.tabs.map(tab => {
return <TabItem tab={tab} activeTab={activeTab} onClick={this.onChangeTab} key={tab.id} />; return <OldTabItem tab={tab} activeTab={activeTab} onClick={this.onChangeTab} key={tab.id} />;
})} })}
</ul>
<div className="panel-editor__aside-actions">
<button className="btn btn-secondary" onClick={this.onClose}> <button className="tabbed-view-close-btn" onClick={this.onClose}>
Back to dashboard <i className="fa fa-remove" />
</button>
<button className="btn btn-inverse" onClick={this.onClose}>
Discard changes
</button> </button>
</div> </div>
<div className="tabbed-view-body">
<CustomScrollbar>
{activeTab === 'queries' && this.renderQueriesTab()}
{activeTab === 'visualization' && this.renderVizTab()}
</CustomScrollbar>
</div>
</div> </div>
<div className="panel-editor__content"> </div>
<CustomScrollbar> );
{activeTab === 'queries' && this.renderQueriesTab()} }
{activeTab === 'visualization' && this.renderVizTab()}
</CustomScrollbar> renderAsBoxes() {
const { location } = store.getState();
const { panel } = this.props;
const activeTab = location.query.tab || 'queries';
return (
<div className="panel-editor-container__editor">
<div className="panel-editor-resizer">
<div className="panel-editor-resizer__handle">
<div className="panel-editor-resizer__handle-dots" />
</div>
</div> </div>
<CustomScrollbar>
{this.renderQueriesTab()}
{this.renderVizTab()}
</CustomScrollbar>
</div> </div>
); );
} }
...@@ -145,3 +207,16 @@ function TabItem({ tab, activeTab, onClick }: TabItemParams) { ...@@ -145,3 +207,16 @@ function TabItem({ tab, activeTab, onClick }: TabItemParams) {
</a> </a>
); );
} }
function OldTabItem({ tab, activeTab, onClick }: TabItemParams) {
const tabClasses = classNames({
'gf-tabs-link': true,
active: activeTab === tab.id,
});
return (
<li className="gf-tabs-item" onClick={() => onClick(tab)}>
<a className={tabClasses}>{tab.text}</a>
</li>
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment