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
159c5cdb
Commit
159c5cdb
authored
Nov 14, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: adding general tab for react panel edit mode
parent
fade3c47
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
2 deletions
+89
-2
public/app/features/dashboard/dashgrid/GeneralTab.tsx
+60
-0
public/app/features/dashboard/dashgrid/PanelEditor.tsx
+3
-1
public/app/features/panel/GeneralTabCtrl.ts
+23
-0
public/app/features/panel/panel_ctrl.ts
+3
-1
public/app/features/panel/partials/general_tab.html
+0
-0
No files found.
public/app/features/dashboard/dashgrid/GeneralTab.tsx
0 → 100644
View file @
159c5cdb
import
React
,
{
PureComponent
}
from
'react'
;
import
{
getAngularLoader
,
AngularComponent
}
from
'app/core/services/AngularLoader'
;
import
{
EditorTabBody
}
from
'./EditorTabBody'
;
import
{
PanelModel
}
from
'../panel_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
interface
Props
{
panel
:
PanelModel
;
dashboard
:
DashboardModel
;
}
export
class
GeneralTab
extends
PureComponent
<
Props
>
{
element
:
any
;
component
:
AngularComponent
;
constructor
(
props
)
{
super
(
props
);
}
componentDidMount
()
{
if
(
!
this
.
element
)
{
return
;
}
const
{
panel
,
dashboard
}
=
this
.
props
;
const
loader
=
getAngularLoader
();
const
template
=
'<panel-general-tab />'
;
const
scopeProps
=
{
ctrl
:
{
panel
:
panel
,
dashboard
:
dashboard
,
},
};
this
.
component
=
loader
.
load
(
this
.
element
,
scopeProps
,
template
);
}
componentWillUnmount
()
{
if
(
this
.
component
)
{
this
.
component
.
destroy
();
}
}
render
()
{
const
currentDataSource
=
{
title
:
'ProductionDB'
,
imgSrc
:
'public/app/plugins/datasource/prometheus/img/prometheus_logo.svg'
,
render
:
()
=>
<
h2
>
hello
</
h2
>,
};
return
(
<
EditorTabBody
main=
{
currentDataSource
}
toolbarItems=
{
[]
}
>
<
div
ref=
{
element
=>
(
this
.
element
=
element
)
}
style=
{
{
width
:
'100%'
}
}
/>
</
EditorTabBody
>
);
}
}
public/app/features/dashboard/dashgrid/PanelEditor.tsx
View file @
159c5cdb
...
...
@@ -3,6 +3,7 @@ import classNames from 'classnames';
import
{
QueriesTab
}
from
'./QueriesTab'
;
import
{
VisualizationTab
}
from
'./VisualizationTab'
;
import
{
GeneralTab
}
from
'./GeneralTab'
;
import
{
store
}
from
'app/store/store'
;
import
{
updateLocation
}
from
'app/core/actions'
;
...
...
@@ -31,9 +32,9 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
super
(
props
);
this
.
tabs
=
[
{
id
:
'general'
,
text
:
'General'
,
icon
:
'gicon gicon-preferences'
},
{
id
:
'queries'
,
text
:
'Queries'
,
icon
:
'fa fa-database'
},
{
id
:
'visualization'
,
text
:
'Visualization'
,
icon
:
'fa fa-line-chart'
},
{
id
:
'alert'
,
text
:
'Alert'
,
icon
:
'gicon gicon-alert'
},
];
}
...
...
@@ -81,6 +82,7 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
</
button
>
</
div
>
{
activeTab
===
'general'
&&
<
GeneralTab
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
}
{
activeTab
===
'queries'
&&
<
QueriesTab
panel=
{
panel
}
dashboard=
{
dashboard
}
/>
}
{
activeTab
===
'visualization'
&&
(
<
VisualizationTab
panel=
{
panel
}
dashboard=
{
dashboard
}
plugin=
{
plugin
}
onTypeChanged=
{
onTypeChanged
}
/>
...
...
public/app/features/panel/GeneralTabCtrl.ts
0 → 100644
View file @
159c5cdb
import
coreModule
from
'app/core/core_module'
;
import
{
DashboardModel
}
from
'../dashboard/dashboard_model'
;
export
class
GeneralTabCtrl
{
panelCtrl
:
any
;
/** @ngInject */
constructor
(
$scope
)
{
this
.
panelCtrl
=
$scope
.
ctrl
;
}
}
/** @ngInject */
export
function
generalTab
()
{
'use strict'
;
return
{
restrict
:
'E'
,
templateUrl
:
'public/app/features/panel/partials/general_tab.html'
,
controller
:
GeneralTabCtrl
,
};
}
coreModule
.
directive
(
'panelGeneralTab'
,
generalTab
);
public/app/features/panel/panel_ctrl.ts
View file @
159c5cdb
...
...
@@ -12,6 +12,8 @@ import {
sharePanel
as
sharePanelUtil
,
}
from
'app/features/dashboard/utils/panel'
;
import
{
generalTab
}
from
'./GeneralTabCtrl'
;
import
{
GRID_CELL_HEIGHT
,
GRID_CELL_VMARGIN
,
PANEL_HEADER_HEIGHT
,
PANEL_BORDER
}
from
'app/core/constants'
;
export
class
PanelCtrl
{
...
...
@@ -91,7 +93,7 @@ export class PanelCtrl {
initEditMode
()
{
this
.
editorTabs
=
[];
this
.
addEditorTab
(
'General'
,
'public/app/partials/panelgeneral.html'
);
this
.
addEditorTab
(
'General'
,
generalTab
);
this
.
editModeInitiated
=
true
;
this
.
events
.
emit
(
'init-edit-mode'
,
null
);
...
...
public/app/
partials/panelgeneral
.html
→
public/app/
features/panel/partials/general_tab
.html
View file @
159c5cdb
File moved
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