Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
8a9d721c
Commit
8a9d721c
authored
Nov 08, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
panel-edit-ux-tabs on top alternative
parent
964a21b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
21 deletions
+96
-21
public/app/features/dashboard/dashgrid/PanelEditor.tsx
+96
-21
No files found.
public/app/features/dashboard/dashgrid/PanelEditor.tsx
View file @
8a9d721c
...
@@ -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
>
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment