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
71b14e46
Commit
71b14e46
authored
Aug 26, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zero'
parents
1222b498
49c596a8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
193 additions
and
71 deletions
+193
-71
js/services.js
+4
-0
panels/dashcontrol/module.js
+42
-17
panels/histogram/module.js
+147
-54
No files found.
js/services.js
View file @
71b14e46
...
@@ -800,6 +800,10 @@ angular.module('kibana.services', [])
...
@@ -800,6 +800,10 @@ angular.module('kibana.services', [])
);
);
};
};
this
.
elasticsearch_create_index
=
function
()
{
return
ejs
.
client
.
post
(
'/'
+
config
.
kibana_index
);
};
this
.
elasticsearch_delete
=
function
(
id
)
{
this
.
elasticsearch_delete
=
function
(
id
)
{
return
ejs
.
Document
(
config
.
kibana_index
,
'dashboard'
,
id
).
doDelete
(
return
ejs
.
Document
(
config
.
kibana_index
,
'dashboard'
,
id
).
doDelete
(
// Success
// Success
...
...
panels/dashcontrol/module.js
View file @
71b14e46
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
* hide_control :: Upon save, hide this panel
* hide_control :: Upon save, hide this panel
* elasticsearch_size :: show this many dashboards under the ES section in the load drop down
* elasticsearch_size :: show this many dashboards under the ES section in the load drop down
* temp :: Allow saving of temp dashboards
* temp :: Allow saving of temp dashboards
* ttl :: Enable setting ttl.
* ttl :: Enable setting ttl.
* temp_ttl :: How long should temp dashboards persist
* temp_ttl :: How long should temp dashboards persist
*/
*/
...
@@ -61,6 +61,10 @@ angular.module('kibana.dashcontrol', [])
...
@@ -61,6 +61,10 @@ angular.module('kibana.dashcontrol', [])
services
:
{}
services
:
{}
};
};
function
notice
(
type
,
title
,
message
)
{
alertSrv
.
set
(
title
,
message
,
type
,
5000
);
}
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
gist_pattern
=
/
(
^
\d{5,}
$
)
|
(
^
[
a-z0-9
]{10,}
$
)
|
(
gist.github.com
(\/
*.*
)\/[
a-z0-9
]{5,}\/
*$
)
/
;
$scope
.
gist_pattern
=
/
(
^
\d{5,}
$
)
|
(
^
[
a-z0-9
]{10,}
$
)
|
(
gist.github.com
(\/
*.*
)\/[
a-z0-9
]{5,}\/
*$
)
/
;
$scope
.
gist
=
{};
$scope
.
gist
=
{};
...
@@ -69,17 +73,17 @@ angular.module('kibana.dashcontrol', [])
...
@@ -69,17 +73,17 @@ angular.module('kibana.dashcontrol', [])
$scope
.
set_default
=
function
()
{
$scope
.
set_default
=
function
()
{
if
(
dashboard
.
set_default
())
{
if
(
dashboard
.
set_default
())
{
alertSrv
.
set
(
'Local Default Set'
,
dashboard
.
current
.
title
+
' has been set as your local default'
,
'success'
,
5000
);
notice
(
'success'
,
'Local Default Set'
,
dashboard
.
current
.
title
+
' has been set as your local default'
);
}
else
{
}
else
{
alertSrv
.
set
(
'Incompatible Browser'
,
'Sorry, your browser is too old for this feature'
,
'error'
,
5000
);
notice
(
'error'
,
'Incompatible Browser'
,
'Sorry, your browser is too old for this feature'
);
}
}
};
};
$scope
.
purge_default
=
function
()
{
$scope
.
purge_default
=
function
()
{
if
(
dashboard
.
purge_default
())
{
if
(
dashboard
.
purge_default
())
{
alertSrv
.
set
(
'Local Default Clear'
,
'Your local default dashboard has been cleared'
,
'success'
,
5000
);
notice
(
'success'
,
'Local Default Clear'
,
'Your local default dashboard has been cleared'
);
}
else
{
}
else
{
alertSrv
.
set
(
'Incompatible Browser'
,
'Sorry, your browser is too old for this feature'
,
'error'
,
5000
);
notice
(
'error'
,
'Incompatible Browser'
,
'Sorry, your browser is too old for this feature'
);
}
}
};
};
...
@@ -91,13 +95,30 @@ angular.module('kibana.dashcontrol', [])
...
@@ -91,13 +95,30 @@ angular.module('kibana.dashcontrol', [])
).
then
(
).
then
(
function
(
result
)
{
function
(
result
)
{
if
(
!
_
.
isUndefined
(
result
.
_id
))
{
if
(
!
_
.
isUndefined
(
result
.
_id
))
{
alertSrv
.
set
(
'Dashboard Saved'
,
'This dashboard has been saved to Elasticsearch as "'
+
notice
(
result
.
_id
+
'"'
,
'success'
,
5000
);
'success'
,
'Dashboard Saved'
,
'This dashboard has been saved to Elasticsearch as "'
+
result
.
_id
+
'"'
);
if
(
type
===
'temp'
)
{
if
(
type
===
'temp'
)
{
$scope
.
share
=
dashboard
.
share_link
(
dashboard
.
current
.
title
,
'temp'
,
result
.
_id
);
$scope
.
share
=
dashboard
.
share_link
(
dashboard
.
current
.
title
,
'temp'
,
result
.
_id
);
}
}
}
else
{
}
else
{
alertSrv
.
set
(
'Save failed'
,
'Dashboard could not be saved to Elasticsearch'
,
'error'
,
5000
);
if
(
result
.
status
===
404
)
{
// auto create must be disabled and the index doesn't exist, create it!
return
dashboard
.
elasticsearch_create_index
().
then
(
function
()
{
return
$scope
.
elasticsearch_save
(
type
,
ttl
);
},
function
()
{
notice
(
'error'
,
'Save failed'
,
'Dashboard could not be saved because the "'
+
config
.
kibana_index
+
'" '
+
'index does not exist and could not be created.'
);
});
}
else
{
notice
(
'error'
,
'Save failed'
,
'Dashboard could not be saved to Elasticsearch'
);
}
}
}
});
});
};
};
...
@@ -107,15 +128,15 @@ angular.module('kibana.dashcontrol', [])
...
@@ -107,15 +128,15 @@ angular.module('kibana.dashcontrol', [])
function
(
result
)
{
function
(
result
)
{
if
(
!
_
.
isUndefined
(
result
))
{
if
(
!
_
.
isUndefined
(
result
))
{
if
(
result
.
found
)
{
if
(
result
.
found
)
{
alertSrv
.
set
(
'Dashboard Deleted'
,
id
+
' has been deleted'
,
'success'
,
5000
);
notice
(
'success'
,
'Dashboard Deleted'
,
id
+
' has been deleted'
);
// Find the deleted dashboard in the cached list and remove it
// Find the deleted dashboard in the cached list and remove it
var
toDelete
=
_
.
where
(
$scope
.
elasticsearch
.
dashboards
,{
_id
:
id
})[
0
];
var
toDelete
=
_
.
where
(
$scope
.
elasticsearch
.
dashboards
,{
_id
:
id
})[
0
];
$scope
.
elasticsearch
.
dashboards
=
_
.
without
(
$scope
.
elasticsearch
.
dashboards
,
toDelete
);
$scope
.
elasticsearch
.
dashboards
=
_
.
without
(
$scope
.
elasticsearch
.
dashboards
,
toDelete
);
}
else
{
}
else
{
alertSrv
.
set
(
'Dashboard Not Found'
,
'Could not find '
+
id
+
' in Elasticsearch'
,
'warning'
,
5000
);
notice
(
'warning'
,
'Dashboard Not Found'
,
'Could not find '
+
id
+
' in Elasticsearch'
);
}
}
}
else
{
}
else
{
alertSrv
.
set
(
'Dashboard Not Deleted'
,
'An error occurred deleting the dashboard'
,
'error'
,
5000
);
notice
(
'error'
,
'Dashboard Not Deleted'
,
'An error occurred deleting the dashboard'
);
}
}
}
}
);
);
...
@@ -137,10 +158,14 @@ angular.module('kibana.dashcontrol', [])
...
@@ -137,10 +158,14 @@ angular.module('kibana.dashcontrol', [])
function
(
link
)
{
function
(
link
)
{
if
(
!
_
.
isUndefined
(
link
))
{
if
(
!
_
.
isUndefined
(
link
))
{
$scope
.
gist
.
last
=
link
;
$scope
.
gist
.
last
=
link
;
alertSrv
.
set
(
'Gist saved'
,
'You will be able to access your exported dashboard file at '
+
notice
(
'<a href="'
+
link
+
'">'
+
link
+
'</a> in a moment'
,
'success'
);
'success'
,
'Gist saved'
,
'You will be able to access your exported dashboard file at '
+
'<a href="'
+
link
+
'">'
+
link
+
'</a> in a moment'
);
}
else
{
}
else
{
alertSrv
.
set
(
'Save failed'
,
'Gist could not be saved'
,
'error'
,
5000
);
notice
(
'error'
,
'Save failed'
,
'Gist could not be saved'
);
}
}
});
});
};
};
...
@@ -151,7 +176,7 @@ angular.module('kibana.dashcontrol', [])
...
@@ -151,7 +176,7 @@ angular.module('kibana.dashcontrol', [])
if
(
files
&&
files
.
length
>
0
)
{
if
(
files
&&
files
.
length
>
0
)
{
$scope
.
gist
.
files
=
files
;
$scope
.
gist
.
files
=
files
;
}
else
{
}
else
{
alertSrv
.
set
(
'Gist Failed'
,
'Could not retrieve dashboard list from gist'
,
'error
'
,
5000
);
notice
(
'error'
,
'Gist Failed'
,
'Could not retrieve dashboard list from gist
'
,
5000
);
}
}
});
});
};
};
...
@@ -183,7 +208,7 @@ angular.module('kibana.dashcontrol', [])
...
@@ -183,7 +208,7 @@ angular.module('kibana.dashcontrol', [])
// Something
// Something
document
.
getElementById
(
'dashupload'
).
addEventListener
(
'change'
,
file_selected
,
false
);
document
.
getElementById
(
'dashupload'
).
addEventListener
(
'change'
,
file_selected
,
false
);
}
else
{
}
else
{
alertSrv
.
set
(
'Oops'
,
'Sorry, the HTML5 File APIs are not fully supported in this browser.'
,
'error'
);
alertSrv
.
set
(
'Oops'
,
'Sorry, the HTML5 File APIs are not fully supported in this browser.'
,
'error'
,
5000
);
}
}
}
}
};
};
...
...
panels/histogram/module.js
View file @
71b14e46
This diff is collapsed.
Click to expand it.
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