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
3e14f8a0
Commit
3e14f8a0
authored
Jan 24, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(): panel refactoring
parent
a950ff97
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
75 deletions
+105
-75
public/app/features/panel/metrics_panel_ctrl.ts
+22
-0
public/app/features/panel/panel.ts
+8
-68
public/app/features/panel/panel_ctrl.ts
+69
-0
public/app/plugins/panel/test/module.ts
+6
-7
No files found.
public/app/features/panel/metrics_panel_ctrl.ts
0 → 100644
View file @
3e14f8a0
///<reference path="../../headers/common.d.ts" />
import
config
from
'app/core/config'
;
import
{
PanelCtrl
}
from
'./panel_ctrl'
;
function
metricsEditorTab
()
{
return
{
templateUrl
:
'public/app/partials/metrics.html'
};
}
class
MetricsPanelCtrl
extends
PanelCtrl
{
constructor
(
$scope
)
{
super
(
$scope
);
}
initEditorTabs
()
{
super
.
initEditorTabs
();
this
.
editorTabs
.
push
({
title
:
'Metrics'
,
directiveFn
:
metricsEditorTab
});
}
}
export
{
MetricsPanelCtrl
};
public/app/features/panel/panel.ts
View file @
3e14f8a0
...
...
@@ -2,75 +2,10 @@
import
config
from
'app/core/config'
;
function
generalOptionsTabEditorTab
()
{
return
{
templateUrl
:
'public/app/partials/panelgeneral.html'
};
}
export
class
PanelCtrl
{
panel
:
any
;
row
:
any
;
dashboard
:
any
;
editorTabIndex
:
number
;
name
:
string
;
icon
:
string
;
editorTabs
:
any
;
$scope
:
any
;
constructor
(
$scope
)
{
var
plugin
=
config
.
panels
[
this
.
panel
.
type
];
this
.
$scope
=
$scope
;
this
.
name
=
plugin
.
name
;
this
.
icon
=
plugin
.
info
.
icon
;
this
.
editorTabIndex
=
0
;
this
.
publishAppEvent
(
'panel-instantiated'
,
{
scope
:
$scope
});
}
publishAppEvent
(
evtName
,
evt
)
{
this
.
$scope
.
$root
.
appEvent
(
evtName
,
evt
);
}
changeView
(
fullscreen
,
edit
)
{
this
.
publishAppEvent
(
'panel-change-view'
,
{
fullscreen
:
fullscreen
,
edit
:
edit
,
panelId
:
this
.
panel
.
id
});
}
viewPanel
()
{
this
.
changeView
(
true
,
false
);
}
editPanel
()
{
if
(
!
this
.
editorTabs
)
{
this
.
initEditorTabs
();
}
this
.
changeView
(
true
,
true
);
}
exitFullscreen
()
{
this
.
changeView
(
false
,
false
);
}
initEditorTabs
()
{
this
.
editorTabs
=
[];
this
.
editorTabs
.
push
({
title
:
'General'
,
directiveFn
:
generalOptionsTabEditorTab
});
this
.
editorTabs
=
this
.
editorTabs
.
concat
(
this
.
getEditorTabs
());
}
getEditorTabs
()
{
return
[];}
getMenu
()
{
let
menu
=
[];
menu
.
push
({
text
:
'View'
,
click
:
'ctrl.viewPanel(); dismiss();'
});
menu
.
push
({
text
:
'Edit'
,
click
:
'ctrl.editPanel(); dismiss();'
,
role
:
'Editor'
});
menu
.
push
({
text
:
'Duplicate'
,
click
:
'ctrl.duplicate()'
,
role
:
'Editor'
});
menu
.
push
({
text
:
'Share'
,
click
:
'ctrl.share(); dismiss();'
});
return
menu
;
}
}
import
{
PanelCtrl
}
from
'./panel_ctrl'
;
import
{
MetricsPanelCtrl
}
from
'./metrics_panel_ctrl'
;
export
class
PanelDirective
{
class
PanelDirective
{
template
:
string
;
templateUrl
:
string
;
bindToController
:
boolean
;
...
...
@@ -99,3 +34,8 @@ export class PanelDirective {
}
}
export
{
PanelCtrl
,
MetricsPanelCtrl
,
PanelDirective
,
}
public/app/features/panel/panel_ctrl.ts
0 → 100644
View file @
3e14f8a0
///<reference path="../../headers/common.d.ts" />
import
config
from
'app/core/config'
;
function
generalOptionsTabEditorTab
()
{
return
{
templateUrl
:
'public/app/partials/panelgeneral.html'
};
}
export
class
PanelCtrl
{
panel
:
any
;
row
:
any
;
dashboard
:
any
;
editorTabIndex
:
number
;
name
:
string
;
icon
:
string
;
editorTabs
:
any
;
$scope
:
any
;
isMetricsPanel
:
boolean
;
constructor
(
$scope
)
{
var
plugin
=
config
.
panels
[
this
.
panel
.
type
];
this
.
$scope
=
$scope
;
this
.
name
=
plugin
.
name
;
this
.
icon
=
plugin
.
info
.
icon
;
this
.
editorTabIndex
=
0
;
this
.
publishAppEvent
(
'panel-instantiated'
,
{
scope
:
$scope
});
}
publishAppEvent
(
evtName
,
evt
)
{
this
.
$scope
.
$root
.
appEvent
(
evtName
,
evt
);
}
changeView
(
fullscreen
,
edit
)
{
this
.
publishAppEvent
(
'panel-change-view'
,
{
fullscreen
:
fullscreen
,
edit
:
edit
,
panelId
:
this
.
panel
.
id
});
}
viewPanel
()
{
this
.
changeView
(
true
,
false
);
}
editPanel
()
{
if
(
!
this
.
editorTabs
)
{
this
.
initEditorTabs
();
}
this
.
changeView
(
true
,
true
);
}
exitFullscreen
()
{
this
.
changeView
(
false
,
false
);
}
initEditorTabs
()
{
this
.
editorTabs
=
[];
this
.
editorTabs
.
push
({
title
:
'General'
,
directiveFn
:
generalOptionsTabEditorTab
});
}
getMenu
()
{
let
menu
=
[];
menu
.
push
({
text
:
'View'
,
click
:
'ctrl.viewPanel(); dismiss();'
});
menu
.
push
({
text
:
'Edit'
,
click
:
'ctrl.editPanel(); dismiss();'
,
role
:
'Editor'
});
menu
.
push
({
text
:
'Duplicate'
,
click
:
'ctrl.duplicate()'
,
role
:
'Editor'
});
menu
.
push
({
text
:
'Share'
,
click
:
'ctrl.share(); dismiss();'
});
return
menu
;
}
}
public/app/plugins/panel/test/module.ts
View file @
3e14f8a0
///<reference path="../../../headers/common.d.ts" />
import
{
PanelDirective
,
PanelCtrl
}
from
'../../../features/panel/panel'
;
import
{
PanelDirective
,
Metrics
PanelCtrl
}
from
'../../../features/panel/panel'
;
function
optionsTab
()
{
return
{
template
:
'<h2>options!</h2>'
};
return
{
template
:
'<h2>options!</h2>'
};
}
export
class
TestPanelCtrl
extends
PanelCtrl
{
export
class
TestPanelCtrl
extends
Metrics
PanelCtrl
{
constructor
(
$scope
)
{
super
(
$scope
);
}
getEditorTabs
()
{
return
[{
title
:
'Options'
,
directiveFn
:
optionsTab
}];
initEditorTabs
()
{
super
.
initEditorTabs
();
this
.
editorTabs
.
push
({
title
:
'Options'
,
directiveFn
:
optionsTab
});
}
}
...
...
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