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
42b415cf
Commit
42b415cf
authored
Feb 13, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dashboard editor, row adding/moving/removing
parent
b162bd64
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
11 deletions
+99
-11
common/css/main.css
+7
-2
index.html
+1
-0
js/controllers.js
+29
-1
panels/sort/module.html
+2
-1
partials/dashboard.html
+2
-3
partials/dasheditor.html
+54
-0
partials/roweditor.html
+4
-4
No files found.
common/css/main.css
View file @
42b415cf
...
@@ -27,6 +27,10 @@
...
@@ -27,6 +27,10 @@
display
:
none
;
display
:
none
;
}
}
.pointer
:hover
{
color
:
#0088CC
;
}
.panel
:hover
i
.editlink
{
.panel
:hover
i
.editlink
{
display
:
block
;
display
:
block
;
opacity
:
0.3
;
opacity
:
0.3
;
...
@@ -36,18 +40,19 @@
...
@@ -36,18 +40,19 @@
opacity
:
1
;
opacity
:
1
;
}
}
/*
.row-header i.editlink {
.row-header i.editlink {
display
:
none
;
opacity: 0
;
}
}
.row-header:hover i.editlink {
.row-header:hover i.editlink {
display
:
inline-block
;
opacity: 0.3;
opacity: 0.3;
}
}
.row-header i.editlink:hover {
.row-header i.editlink:hover {
opacity: 1;
opacity: 1;
}
}
*/
.pointer
{
.pointer
{
cursor
:
pointer
;
cursor
:
pointer
;
...
...
index.html
View file @
42b415cf
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<span
class=
"brand"
><small>
Kibana Preview
</small></span>
<span
class=
"brand"
><small>
Kibana Preview
</small></span>
<span
class=
"brand"
>
{{dashboards.title}}
</span>
<span
class=
"brand"
>
{{dashboards.title}}
</span>
<div
class=
"brand"
><i
class=
'icon-edit pointer'
bs-modal=
"'partials/dasheditor.html'"
bs-tooltip=
"'Edit Dashboard'"
data-placement=
"bottom"
></i></div>
<div
class=
"brand"
><i
class=
'icon-download pointer'
ng-click=
"export()"
bs-tooltip=
"'Export this dashboard'"
data-placement=
"bottom"
></i></div>
<div
class=
"brand"
><i
class=
'icon-download pointer'
ng-click=
"export()"
bs-tooltip=
"'Export this dashboard'"
data-placement=
"bottom"
></i></div>
<div
class=
"brand"
><i
class=
'icon-bookmark pointer'
ng-click=
"default()"
bs-tooltip=
"'Set as default dashboard'"
data-placement=
"bottom"
></i></div>
<div
class=
"brand"
><i
class=
'icon-bookmark pointer'
ng-click=
"default()"
bs-tooltip=
"'Set as default dashboard'"
data-placement=
"bottom"
></i></div>
<div
class=
"brand"
><i
class=
'icon-ban-circle pointer'
ng-click=
"purge()"
bs-tooltip=
"'Clear default dashboard settings'"
data-placement=
"bottom"
></i></div>
<div
class=
"brand"
><i
class=
'icon-ban-circle pointer'
ng-click=
"purge()"
bs-tooltip=
"'Clear default dashboard settings'"
data-placement=
"bottom"
></i></div>
...
...
js/controllers.js
View file @
42b415cf
...
@@ -5,9 +5,11 @@
...
@@ -5,9 +5,11 @@
angular
.
module
(
'kibana.controllers'
,
[])
angular
.
module
(
'kibana.controllers'
,
[])
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
ejsResource
,
timer
)
{
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
ejsResource
,
timer
)
{
$scope
.
init
=
function
()
{
$scope
.
config
=
config
;
$scope
.
config
=
config
;
$scope
.
_
=
_
;
$scope
.
_
=
_
;
$scope
.
reset_row
();
// The global dashboards object should be moved to an $http request for json
// The global dashboards object should be moved to an $http request for json
if
(
Modernizr
.
localstorage
&&
if
(
Modernizr
.
localstorage
&&
...
@@ -20,6 +22,7 @@ angular.module('kibana.controllers', [])
...
@@ -20,6 +22,7 @@ angular.module('kibana.controllers', [])
}
}
var
ejs
=
$scope
.
ejs
=
ejsResource
(
config
.
elasticsearch
);
var
ejs
=
$scope
.
ejs
=
ejsResource
(
config
.
elasticsearch
);
}
$scope
.
export
=
function
()
{
$scope
.
export
=
function
()
{
var
blob
=
new
Blob
([
angular
.
toJson
(
$scope
.
dashboards
)],
{
type
:
"application/json;charset=utf-8"
});
var
blob
=
new
Blob
([
angular
.
toJson
(
$scope
.
dashboards
)],
{
type
:
"application/json;charset=utf-8"
});
...
@@ -44,9 +47,34 @@ angular.module('kibana.controllers', [])
...
@@ -44,9 +47,34 @@ angular.module('kibana.controllers', [])
}
}
}
}
$scope
.
add_row
=
function
(
dashboards
,
row
)
{
$scope
.
dashboards
.
rows
.
push
(
row
);
}
$scope
.
reset_row
=
function
()
{
$scope
.
row
=
{
title
:
''
,
height
:
'150px'
,
editable
:
true
,
};
};
$scope
.
init
();
})
})
.
controller
(
'RowCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
ejsResource
,
timer
)
{
.
controller
(
'RowCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
ejsResource
,
timer
)
{
var
_d
=
{
title
:
"Row"
,
height
:
"150px"
,
collapse
:
false
,
editable
:
true
,
panels
:
[],
}
_
.
defaults
(
$scope
.
row
,
_d
)
$scope
.
init
=
function
(){
$scope
.
init
=
function
(){
$scope
.
reset_panel
();
$scope
.
reset_panel
();
}
}
...
...
panels/sort/module.html
View file @
42b415cf
<kibana-panel
ng-controller=
'sort'
style=
"white-space: nowrap;"
>
<kibana-panel
ng-controller=
'sort'
style=
"white-space: nowrap;"
>
<label><small>
{{panel.label}}
</small></label>
<label><small>
{{panel.label}}
</small></label>
<select
style=
"width:85%"
ng-model=
"panel.sort[0]"
ng-change=
"set_sort()"
ng-options=
"f for f in fields"
></select>
<select
style=
"width:85%"
ng-model=
"panel.sort[0]"
ng-change=
"set_sort()"
ng-options=
"f for f in fields"
></select>
<i
ng-click=
"toggle_sort()"
ng-class=
"{'icon-chevron-up': panel.sort[1] == 'asc','icon-chevron-down': panel.sort[1] == 'desc'}"
></i>
<i
ng-click=
"toggle_sort()"
class=
"pointer"
ng-class=
"{'icon-chevron-up': panel.sort[1] == 'asc','icon-chevron-down': panel.sort[1] == 'desc'}"
></i>
</kibana-panel>
</kibana-panel>
\ No newline at end of file
partials/dashboard.html
View file @
42b415cf
...
@@ -5,9 +5,8 @@
...
@@ -5,9 +5,8 @@
<div
class=
"span12"
>
<div
class=
"span12"
>
<div
class=
"row-fluid row-header"
style=
"padding:0px;margin:0px;height:0px"
>
<div
class=
"row-fluid row-header"
style=
"padding:0px;margin:0px;height:0px"
>
<div
class=
"span12"
style=
"min-height:5px;vertical-align:bottom"
>
<div
class=
"span12"
style=
"min-height:5px;vertical-align:bottom"
>
<i
class=
"pointer"
ng-class=
"{'icon-minus': !row.collapse,'icon-plus': row.collapse}"
ng-click=
"toggle_row(row)"
></i>
<i
ng-show=
"row.editable"
class=
"icon-edit pointer editlink"
bs-modal=
"'partials/roweditor.html'"
></i>
<span
ng-click=
"toggle_row(row)"
class=
"pointer"
><small>
{{row.title}}
</small></span>
<span
ng-click=
"toggle_row(row)"
class=
"pointer"
><i
class=
"pointer"
ng-class=
"{'icon-caret-down': !row.collapse,'icon-caret-right': row.collapse}"
></i>
<small>
{{row.title}}
</small></span>
<i
class=
"icon-edit pointer editlink"
bs-modal=
"'partials/roweditor.html'"
></i>
</div>
</div>
</div>
</div>
<div
class=
"row-fluid"
style=
"padding-top:10px"
ng-hide=
"row.collapse"
>
<div
class=
"row-fluid"
style=
"padding-top:10px"
ng-hide=
"row.collapse"
>
...
...
partials/dasheditor.html
0 → 100644
View file @
42b415cf
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h3>
{{dashboards.title}}
<small>
editor
</small></h3>
</div>
<div
class=
"modal-body"
>
<h4>
Dashboard Control
</h4>
<div
class=
"row-fluid"
>
<div
class=
"span8"
>
<label
class=
"small"
>
Title
</label><input
type=
"text"
class=
"input-large"
ng-model=
'dashboards.title'
></input>
</div>
<div
class=
"span1"
>
<label
class=
"small"
>
Editable
</label><input
type=
"checkbox"
ng-model=
"row.editable"
ng-checked=
"dashboards.editable"
/>
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"span12"
>
<h4>
Panels
</h4>
<table
class=
"table table-condensed table-striped"
>
<thead>
<th>
Title
</th>
<th>
Delete
</th>
<th>
Move
</th>
</thead>
<tr
ng-repeat=
"row in dashboards.rows"
>
<td>
{{row.title}}
</td>
<td><i
ng-click=
"dashboards.rows = _.without(dashboards.rows,row)"
class=
"pointer icon-remove"
></i></td>
<td><i
ng-click=
"_.move(dashboards.rows,$index,$index-1)"
ng-hide=
"$first"
class=
"pointer icon-arrow-up"
></i></td>
<td><i
ng-click=
"_.move(dashboards.rows,$index,$index+1)"
ng-hide=
"$last"
class=
"pointer icon-arrow-down"
></i></td>
</tr>
</table>
</div>
</div>
<h4>
New row
</h4>
<div
class=
"row-fluid"
>
<div
class=
"span8"
>
<label
class=
"small"
>
Title
</label>
<input
type=
"text"
class=
"input-large"
ng-model=
'row.title'
></input>
</div>
<div
class=
"span2"
>
<label
class=
"small"
>
Height
</label>
<input
type=
"text"
class=
"input-mini"
ng-model=
'row.height'
></input>
</div>
<div
class=
"span1"
>
<label
class=
"small"
>
Editable
</label>
<input
type=
"checkbox"
ng-model=
"row.editable"
ng-checked=
"row.editable"
/>
</div>
</div>
<button
ng-click=
"add_row(dashboards,row); reset_row();"
class=
"btn btn-primary"
>
Create Row
</button><br>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-success"
ng-click=
"dismiss();reset_panel();"
>
Close
</button>
</div>
\ No newline at end of file
partials/roweditor.html
View file @
42b415cf
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<label
class=
"small"
>
Height
</label><input
type=
"text"
class=
"input-mini"
ng-model=
'row.height'
></input>
<label
class=
"small"
>
Height
</label><input
type=
"text"
class=
"input-mini"
ng-model=
'row.height'
></input>
</div>
</div>
<div
class=
"span1"
>
<div
class=
"span1"
>
<label
class=
"small"
>
Editable
</label><input
type=
"checkbox"
ng-model=
"
panel
.editable"
ng-checked=
"row.editable"
/>
<label
class=
"small"
>
Editable
</label><input
type=
"checkbox"
ng-model=
"
row
.editable"
ng-checked=
"row.editable"
/>
</div>
</div>
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
...
@@ -28,9 +28,9 @@
...
@@ -28,9 +28,9 @@
<tr
ng-repeat=
"panel in row.panels"
>
<tr
ng-repeat=
"panel in row.panels"
>
<td>
{{panel.title}}
</td>
<td>
{{panel.title}}
</td>
<td>
{{panel.type}}
</td>
<td>
{{panel.type}}
</td>
<td><i
ng-click=
"row.panels = _.without(row.panels,panel)"
class=
"icon-remove"
></i></td>
<td><i
ng-click=
"row.panels = _.without(row.panels,panel)"
class=
"
pointer
icon-remove"
></i></td>
<td><i
ng-click=
"_.move(row.panels,$index,$index-1)"
ng-hide=
"$first"
class=
"icon-arrow-up"
></i></td>
<td><i
ng-click=
"_.move(row.panels,$index,$index-1)"
ng-hide=
"$first"
class=
"
pointer
icon-arrow-up"
></i></td>
<td><i
ng-click=
"_.move(row.panels,$index,$index+1)"
ng-hide=
"$last"
class=
"icon-arrow-down"
></i></td>
<td><i
ng-click=
"_.move(row.panels,$index,$index+1)"
ng-hide=
"$last"
class=
"
pointer
icon-arrow-down"
></i></td>
</tr>
</tr>
</table>
</table>
</div>
</div>
...
...
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