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
e3124088
Commit
e3124088
authored
Aug 02, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated
parent
21a3f443
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
11 deletions
+73
-11
public/app/features/panel/panel_ctrl.ts
+11
-5
public/app/features/panel/panel_header.ts
+59
-3
public/sass/components/_dropdown.scss
+3
-1
public/sass/pages/_dashboard.scss
+0
-2
No files found.
public/app/features/panel/panel_ctrl.ts
View file @
e3124088
...
...
@@ -140,12 +140,18 @@ export class PanelCtrl {
getMenu
()
{
let
menu
=
[];
menu
.
push
({
text
:
'View'
,
click
:
'ctrl.viewPanel(); dismiss();'
});
menu
.
push
({
text
:
'Edit'
,
click
:
'ctrl.editPanel(); dismiss();'
,
role
:
'Editor'
});
if
(
!
this
.
fullscreen
)
{
// duplication is not supported in fullscreen mode
menu
.
push
({
text
:
'Duplicate'
,
click
:
'ctrl.duplicate()'
,
role
:
'Editor'
});
menu
.
push
({
text
:
'View'
,
click
:
'ctrl.viewPanel();'
,
icon
:
"fa fa-fw fa-eye"
,
shortcut
:
"v"
});
menu
.
push
({
text
:
'Edit'
,
click
:
'ctrl.editPanel();'
,
role
:
'Editor'
,
icon
:
"fa fa-fw fa-edit"
,
shortcut
:
"e"
});
menu
.
push
({
text
:
'Share'
,
click
:
'ctrl.sharePanel();'
,
icon
:
"fa fa-fw fa-share"
,
shortcut
:
"p s"
});
let
extendedMenu
=
this
.
getExtendedMenu
();
menu
.
push
({
text
:
'Actions'
,
click
:
'ctrl.removePanel();'
,
icon
:
"fa fa-fw fa-cube"
,
submenu
:
extendedMenu
});
if
(
!
this
.
fullscreen
)
{
menu
.
push
({
text
:
'Duplicate'
,
click
:
'ctrl.duplicate()'
,
role
:
'Editor'
,
icon
:
"fa fa-fw fa-copy"
});
}
menu
.
push
({
text
:
'Share'
,
click
:
'ctrl.sharePanel(); dismiss();'
});
menu
.
push
({
text
:
'Remove'
,
click
:
'ctrl.removePanel();'
,
icon
:
"fa fa-fw fa-trash"
,
shortcut
:
"p r"
});
return
menu
;
}
...
...
public/app/features/panel/panel_header.ts
View file @
e3124088
...
...
@@ -16,8 +16,6 @@ var template = `
<i class="fa fa-cog"></i> Edit <span class="dropdown-menu-item-shortcut">e</span>
</a>
</li>
<li><a ng-click="ctrl.addDataQuery(datasource);"><i class="fa fa-eye"></i> View</a></li>
<li><a ng-click="ctrl.addDataQuery(datasource);"><i class="fa fa-share-square-o"></i> Share</a></li>
<li class="dropdown-submenu">
<a ng-click="ctrl.addDataQuery(datasource);"><i class="fa fa-cube"></i> Actions</a>
<ul class="dropdown-menu panel-menu">
...
...
@@ -33,16 +31,74 @@ var template = `
<span class="panel-time-info" ng-show="ctrl.timeInfo"><i class="fa fa-clock-o"></i> {{ctrl.timeInfo}}</span>
</span>`
;
function
renderMenuItem
(
item
,
ctrl
)
{
let
html
=
''
;
let
listItemClass
=
''
;
if
(
item
.
submenu
)
{
listItemClass
=
'dropdown-submenu'
;
}
html
+=
`<li class="
${
listItemClass
}
"><a `
;
if
(
item
.
click
)
{
html
+=
` ng-click="
${
item
.
click
}
"`
;
}
if
(
item
.
href
)
{
html
+=
` href="
${
item
.
href
}
"`
;
}
html
+=
`><i class="
${
item
.
icon
}
"></i>`
;
html
+=
`<span>
${
item
.
text
}
</span>`
;
if
(
item
.
shortcut
)
{
html
+=
`<span class="dropdown-menu-item-shortcut">
${
item
.
shortcut
}
</span>`
;
}
html
+=
`</a>`
;
if
(
item
.
submenu
)
{
html
+=
'<ul class="dropdown-menu panel-menu">'
;
for
(
let
subitem
of
item
.
submenu
)
{
html
+=
renderMenuItem
(
subitem
,
ctrl
);
}
html
+=
'</ul>'
;
}
html
+=
`</li>`
;
return
html
;
}
function
createMenuTemplate
(
ctrl
)
{
let
html
=
''
;
for
(
let
item
of
ctrl
.
getMenu
())
{
html
+=
renderMenuItem
(
item
,
ctrl
);
}
return
html
;
}
/** @ngInject **/
function
panelHeader
()
{
function
panelHeader
(
$compile
)
{
return
{
restrict
:
'E'
,
template
:
template
,
link
:
function
(
scope
,
elem
,
attrs
)
{
let
menuElem
=
elem
.
find
(
'.panel-menu'
);
let
menuScope
;
elem
.
click
(
function
(
evt
)
{
const
targetClass
=
evt
.
target
.
className
;
// remove existing scope
if
(
menuScope
)
{
menuScope
.
$destroy
();
}
menuScope
=
scope
.
$new
();
let
menuHtml
=
createMenuTemplate
(
scope
.
ctrl
);
console
.
log
(
menuHtml
);
menuElem
.
html
(
menuHtml
);
$compile
(
menuElem
)(
menuScope
);
if
(
targetClass
===
'panel-title-text drag-handle'
||
targetClass
===
'panel-title drag-handle'
)
{
evt
.
stopPropagation
();
elem
.
find
(
'[data-toggle=dropdown]'
).
dropdown
(
'toggle'
);
...
...
public/sass/components/_dropdown.scss
View file @
e3124088
...
...
@@ -76,7 +76,7 @@
// Links within the dropdown menu
>
li
{
>
a
{
display
:
block
;
display
:
flex
;
padding
:
3px
20px
3px
15px
;
clear
:
both
;
font-weight
:
normal
;
...
...
@@ -257,6 +257,7 @@
}
.dropdown-menu-item-with-shortcut
{
min-width
:
40px
;
a
{
min-width
:
12rem
;
}
...
...
@@ -266,6 +267,7 @@
display
:
block
;
float
:
right
;
color
:
$text-muted
;
min-width
:
30px
;
&
:
:
before
{
font-family
:
FontAwesome
;
...
...
public/sass/pages/_dashboard.scss
View file @
e3124088
...
...
@@ -109,8 +109,6 @@ div.flot-text {
left
:
-100px
;
li
a
{
display
:
block
;
white-space
:
nowrap
;
color
:
$dropdown-link-color
;
font-size
:
$font-size-sm
;
padding
:
$spacer
/
2
$spacer
;
...
...
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