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
f0f7da9f
Commit
f0f7da9f
authored
Jan 27, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(panels): fixing broken stuff
parent
9c1217cd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
36 deletions
+40
-36
public/app/features/dashboard/rowCtrl.js
+0
-25
public/app/features/panel/panel_ctrl.ts
+29
-5
public/app/features/panel/panel_directive.js
+1
-2
public/app/features/panel/panel_loader.ts
+2
-2
public/app/features/panel/panel_menu.js
+1
-1
public/app/plugins/panel/text/module.ts
+1
-0
public/app/plugins/panel/unknown/module.ts
+6
-1
No files found.
public/app/features/dashboard/rowCtrl.js
View file @
f0f7da9f
...
...
@@ -116,32 +116,7 @@ function (angular, _, config) {
$scope
.
$broadcast
(
'render'
);
};
$scope
.
removePanel
=
function
(
panel
)
{
$scope
.
appEvent
(
'confirm-modal'
,
{
title
:
'Are you sure you want to remove this panel?'
,
icon
:
'fa-trash'
,
yesText
:
'Delete'
,
onConfirm
:
function
()
{
$scope
.
row
.
panels
=
_
.
without
(
$scope
.
row
.
panels
,
panel
);
}
});
};
$scope
.
replacePanel
=
function
(
newPanel
,
oldPanel
)
{
var
row
=
$scope
.
row
;
var
index
=
_
.
indexOf
(
row
.
panels
,
oldPanel
);
row
.
panels
.
splice
(
index
,
1
);
// adding it back needs to be done in next digest
$timeout
(
function
()
{
newPanel
.
id
=
oldPanel
.
id
;
newPanel
.
span
=
oldPanel
.
span
;
row
.
panels
.
splice
(
index
,
0
,
newPanel
);
});
};
$scope
.
init
();
});
module
.
directive
(
'rowHeight'
,
function
()
{
...
...
public/app/features/panel/panel_ctrl.ts
View file @
f0f7da9f
...
...
@@ -21,16 +21,17 @@ export class PanelCtrl {
editorHelpIndex
:
number
;
constructor
(
$scope
,
$injector
)
{
var
plugin
=
config
.
panels
[
this
.
panel
.
type
];
this
.
$injector
=
$injector
;
this
.
$scope
=
$scope
;
this
.
$timeout
=
$injector
.
get
(
'$timeout'
);
this
.
pluginName
=
plugin
.
name
;
this
.
pluginId
=
plugin
.
id
;
this
.
icon
=
plugin
.
info
.
icon
;
this
.
editorTabIndex
=
0
;
var
plugin
=
config
.
panels
[
this
.
panel
.
type
];
if
(
plugin
)
{
this
.
pluginId
=
plugin
.
id
;
this
.
pluginName
=
plugin
.
name
;
}
$scope
.
$on
(
"refresh"
,
()
=>
this
.
refresh
());
}
...
...
@@ -97,6 +98,10 @@ export class PanelCtrl {
return
menu
;
}
getExtendedMenu
()
{
return
[{
text
:
'Panel JSON'
,
click
:
'ctrl.editPanelJson(); dismiss();'
}];
}
otherPanelInFullscreenMode
()
{
return
this
.
dashboard
.
meta
.
fullscreen
&&
!
this
.
fullscreen
;
}
...
...
@@ -135,4 +140,23 @@ export class PanelCtrl {
});
}
editPanelJson
()
{
this
.
publishAppEvent
(
'show-json-editor'
,
{
object
:
this
.
panel
,
updateHandler
:
this
.
replacePanel
.
bind
(
this
)
});
}
replacePanel
(
newPanel
,
oldPanel
)
{
var
row
=
this
.
row
;
var
index
=
_
.
indexOf
(
this
.
row
.
panels
,
oldPanel
);
this
.
row
.
panels
.
splice
(
index
,
1
);
// adding it back needs to be done in next digest
this
.
$timeout
(()
=>
{
newPanel
.
id
=
oldPanel
.
id
;
newPanel
.
span
=
oldPanel
.
span
;
this
.
row
.
panels
.
splice
(
index
,
0
,
newPanel
);
});
}
}
public/app/features/panel/panel_directive.js
View file @
f0f7da9f
...
...
@@ -17,7 +17,6 @@ function (angular, $) {
var
panelContainer
=
elem
.
find
(
'.panel-container'
);
var
ctrl
=
scope
.
ctrl
;
scope
.
$watchGroup
([
'ctrl.fullscreen'
,
'ctrl.height'
,
'ctrl.panel.height'
,
'ctrl.row.height'
],
function
()
{
console
.
log
(
'height: '
,
ctrl
.
height
);
panelContainer
.
css
({
minHeight
:
ctrl
.
height
||
ctrl
.
panel
.
height
||
ctrl
.
row
.
height
,
display
:
'block'
});
elem
.
toggleClass
(
'panel-fullscreen'
,
ctrl
.
fullscreen
?
true
:
false
);
});
...
...
@@ -80,7 +79,7 @@ function (angular, $) {
function
dragEndHandler
()
{
// if close to 12
var
rowSpan
=
ctrl
.
dashboard
.
rowSpan
(
scope
.
row
);
var
rowSpan
=
ctrl
.
dashboard
.
rowSpan
(
ctrl
.
row
);
if
(
rowSpan
<
12
&&
rowSpan
>
11
)
{
lastPanel
.
span
+=
12
-
rowSpan
;
}
...
...
public/app/features/panel/panel_loader.ts
View file @
f0f7da9f
...
...
@@ -41,6 +41,7 @@ function panelLoader($compile, dynamicDirectiveSrv, $http, $q, $injector) {
function
addPanel
(
name
,
Panel
)
{
if
(
Panel
.
registered
)
{
addPanelAndCompile
(
name
);
return
;
}
if
(
Panel
.
promise
)
{
...
...
@@ -62,14 +63,13 @@ function panelLoader($compile, dynamicDirectiveSrv, $http, $q, $injector) {
Panel
.
registered
=
true
;
addPanelAndCompile
(
name
);
});
return
;
}
var
panelElemName
=
'panel-directive-'
+
scope
.
panel
.
type
;
let
panelInfo
=
config
.
panels
[
scope
.
panel
.
type
];
if
(
!
panelInfo
)
{
addPanel
(
panelElemName
,
UnknownPanel
);
return
;
}
System
.
import
(
panelInfo
.
module
).
then
(
function
(
panelModule
)
{
...
...
public/app/features/panel/panel_menu.js
View file @
f0f7da9f
...
...
@@ -64,7 +64,7 @@ function (angular, $, _) {
}
function
getExtendedMenu
(
ctrl
)
{
return
angular
.
copy
(
ctrl
.
extendedMenu
);
return
ctrl
.
getExtendedMenu
(
);
}
return
{
...
...
public/app/plugins/panel/text/module.ts
View file @
f0f7da9f
...
...
@@ -59,6 +59,7 @@ export class TextPanelCtrl extends PanelCtrl {
this
.
updateContent
(
this
.
converter
.
makeHtml
(
text
));
}
else
{
System
.
import
(
'vendor/showdown'
).
then
(
Showdown
=>
{
console
.
log
(
this
);
this
.
converter
=
new
Showdown
.
converter
();
this
.
$scope
.
$apply
(()
=>
{
this
.
updateContent
(
this
.
converter
.
makeHtml
(
text
));
...
...
public/app/plugins/panel/unknown/module.ts
View file @
f0f7da9f
...
...
@@ -2,10 +2,15 @@
import
{
PanelDirective
}
from
'../../../features/panel/panel'
;
export
class
UnknownPanel
extends
PanelDirective
{
class
UnknownPanel
extends
PanelDirective
{
template
=
`<div class="text-center" style="padding-top: 2rem">
Unknown panel type: <strong>{{ctrl.panel.type}}</strong>
</div>`
;
}
export
{
UnknownPanel
,
UnknownPanel
as
Panel
}
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