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
107cf6b8
Commit
107cf6b8
authored
Mar 01, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added creating and sharing of short url links to dashboards
parent
6d2af0d8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
27 deletions
+37
-27
panels/dashcontrol/load.html
+1
-1
panels/dashcontrol/module.html
+2
-0
panels/dashcontrol/module.js
+30
-12
panels/dashcontrol/save.html
+2
-1
panels/dashcontrol/share.html
+2
-4
partials/search.html
+0
-9
No files found.
panels/dashcontrol/load.html
View file @
107cf6b8
...
...
@@ -31,7 +31,7 @@
<h6
ng-hide=
"elasticsearch.dashboards.length"
>
No dashboards matching your query found
</h6>
<table
class=
"table table-condensed table-striped"
>
<tr
ng-repeat=
"dashboard in elasticsearch.dashboards"
>
<td><a
ng-click=
"
delete_elasticsearch
(dashboard)"
><i
class=
"icon-remove"
></i></a></td>
<td><a
ng-click=
"
elasticsearch_delete
(dashboard)"
><i
class=
"icon-remove"
></i></a></td>
<td><a
ng-click=
"dash_load(dashboard['_source']['dashboard'])"
>
{{dashboard._id}}
</a></td>
<td><a><i
class=
"icon-share"
ng-click=
"share_link(dashboard._id,'elasticsearch',dashboard._id)"
bs-modal=
"'panels/dashcontrol/share.html'"
></i></a></td>
</tr>
...
...
panels/dashcontrol/module.html
View file @
107cf6b8
...
...
@@ -2,4 +2,5 @@
<label
class=
'small'
>
Dashboard Control
</label>
<button
class=
'btn'
ng-show=
"panel.load.gist || panel.load.elasticsearch || panel.load.local"
data-placement=
"bottom"
data-unique=
"1"
ng-click=
"elasticsearch_dblist(elasticsearch.query)"
bs-popover=
"'panels/dashcontrol/load.html'"
><i
class=
'icon-folder-open'
></i>
<i
class=
'icon-caret-down'
></i></button>
<button
class=
'btn'
ng-show=
"panel.save.gist || panel.save.elasticsearch || panel.save.local || panel.save.default"
data-placement=
"bottom"
data-unique=
"1"
bs-popover=
"'panels/dashcontrol/save.html'"
><i
class=
'icon-save'
></i>
<i
class=
'icon-caret-down'
></i></button>
<button
class=
'btn'
ng-click=
"elasticsearch_save('temp')"
bs-modal=
"'panels/dashcontrol/share.html'"
><i
class=
'icon-share'
></i></button>
</kibana-panel>
\ No newline at end of file
panels/dashcontrol/module.js
View file @
107cf6b8
...
...
@@ -17,6 +17,7 @@ angular.module('kibana.dashcontrol', [])
},
elasticsearch_size
:
20
,
elasticsearch_saveto
:
$scope
.
config
.
kibana_index
,
temp_ttl
:
'30d'
,
}
_
.
defaults
(
$scope
.
panel
,
_d
);
...
...
@@ -36,9 +37,11 @@ angular.module('kibana.dashcontrol', [])
var
_type
=
$routeParams
.
type
;
var
_id
=
$routeParams
.
id
;
if
(
_type
===
'elasticsearch'
)
{
$scope
.
elasticsearch_load
(
_id
)
}
if
(
_type
===
'elasticsearch'
)
$scope
.
elasticsearch_load
(
'dashboard'
,
_id
)
if
(
_type
===
'temp'
)
$scope
.
elasticsearch_load
(
'temp'
,
_id
)
// No dashboard in the URL
}
else
{
// Check if browser supports localstorage, and if there's a dashboard
...
...
@@ -94,7 +97,8 @@ angular.module('kibana.dashcontrol', [])
location
:
location
.
href
.
replace
(
location
.
hash
,
""
),
type
:
type
,
id
:
id
,
link
:
location
.
href
.
replace
(
location
.
hash
,
""
)
+
"#dashboard/"
+
type
+
"/"
+
id
link
:
location
.
href
.
replace
(
location
.
hash
,
""
)
+
"#dashboard/"
+
type
+
"/"
+
id
,
title
:
title
,
};
}
...
...
@@ -111,23 +115,37 @@ angular.module('kibana.dashcontrol', [])
}
}
$scope
.
save_elasticsearch
=
function
()
{
$scope
.
elasticsearch_save
=
function
(
type
)
{
console
.
log
(
type
)
// Clone object so we can modify it without influencing the existing obejct
var
save
=
_
.
clone
(
$scope
.
dashboards
)
save
.
title
=
$scope
.
elasticsearch
.
title
;
var
result
=
$scope
.
ejs
.
Document
(
$scope
.
panel
.
elasticsearch_saveto
,
'dashboard'
,
save
.
title
).
source
({
// Change title on object clone
if
(
type
===
'dashboard'
)
var
id
=
save
.
title
=
$scope
.
elasticsearch
.
title
;
// Create request with id as title. Rethink this.
var
request
=
$scope
.
ejs
.
Document
(
$scope
.
panel
.
elasticsearch_saveto
,
type
,
id
).
source
({
user
:
'guest'
,
group
:
'guest'
,
title
:
save
.
title
,
dashboard
:
angular
.
toJson
(
save
)
}).
doIndex
();
result
.
then
(
function
(
result
)
{
})
if
(
type
===
'temp'
)
request
=
request
.
ttl
(
$scope
.
panel
.
temp_ttl
)
var
result
=
request
.
doIndex
();
var
id
=
result
.
then
(
function
(
result
)
{
$scope
.
alert
(
'Dashboard Saved'
,
'This dashboard has been saved to Elasticsearch'
,
'success'
,
5000
)
$scope
.
elasticsearch_dblist
(
$scope
.
elasticsearch
.
query
);
$scope
.
elasticsearch
.
title
=
''
;
if
(
type
===
'temp'
)
$scope
.
share_link
(
$scope
.
dashboards
.
title
,
'temp'
,
result
.
_id
)
})
}
$scope
.
delete_elasticsearch
=
function
(
dashboard
)
{
$scope
.
elasticsearch_delete
=
function
(
dashboard
)
{
var
result
=
$scope
.
ejs
.
Document
(
$scope
.
panel
.
elasticsearch_saveto
,
'dashboard'
,
dashboard
.
_id
).
doDelete
();
result
.
then
(
function
(
result
)
{
$scope
.
alert
(
'Dashboard Deleted'
,
''
,
'success'
,
5000
)
...
...
@@ -135,8 +153,8 @@ angular.module('kibana.dashcontrol', [])
})
}
$scope
.
elasticsearch_load
=
function
(
id
)
{
var
request
=
$scope
.
ejs
.
Request
().
indices
(
$scope
.
panel
.
elasticsearch_saveto
).
types
(
'dashboard'
);
$scope
.
elasticsearch_load
=
function
(
type
,
id
)
{
var
request
=
$scope
.
ejs
.
Request
().
indices
(
$scope
.
panel
.
elasticsearch_saveto
).
types
(
type
);
var
results
=
request
.
query
(
$scope
.
ejs
.
IdsQuery
(
id
)
).
size
(
$scope
.
panel
.
elasticsearch_size
).
doSearch
();
...
...
panels/dashcontrol/save.html
View file @
107cf6b8
...
...
@@ -23,7 +23,7 @@
<h5>
Elasticsearch
</h5>
<form
class=
"input-append"
>
<input
class=
'input-medium'
placeholder=
'Title'
type=
"text"
ng-model=
"elasticsearch.title"
/>
<button
class=
"btn"
ng-click=
"
save_elasticsearch(
)"
><i
class=
"icon-save"
></i></button>
<button
class=
"btn"
ng-click=
"
elasticsearch_save('dashboard'
)"
><i
class=
"icon-save"
></i></button>
</form>
</div>
</div>
\ No newline at end of file
panels/dashcontrol/share.html
View file @
107cf6b8
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h3>
{{share.
id
}}
<small>
shareable link
</small></h3>
<h3>
{{share.
title
}}
<small>
shareable link
</small></h3>
</div>
<div
class=
"modal-body"
>
<label>
Share this dashboard with this URL
</label>
<input
ng-model=
'share.link'
type=
"text"
style=
"width:90%"
onclick=
"this.select()"
onfocus=
"this.select()"
ng-change=
"share_link(share.type,share.id)"
>
<input
ng-model=
'share.link'
type=
"text"
style=
"width:90%"
onclick=
"this.select()"
onfocus=
"this.select()"
ng-change=
"share_link(share.title,share.type,share.id)"
>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-success"
ng-click=
"dismiss();$broadcast('render')"
>
Close
</button>
...
...
partials/search.html
deleted
100644 → 0
View file @
6d2af0d8
<div
class=
"row-fluid"
style=
"margin-top:15%"
>
<form
class=
"span4 offset4 form-inline"
ng-submit=
"$parent.search()"
>
<input
class=
"input-xlarge"
ng-model=
"$parent.queryTerm"
type=
"text"
placeholder=
"Search"
autofocus
>
<button
class=
"btn"
type=
"submit"
>
Search
</button>
</form>
</div>
\ No newline at end of file
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