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
257ea391
Commit
257ea391
authored
Jun 12, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issues with unsaved changes srv
parent
4c64bcfa
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
6 deletions
+71
-6
src/app/routes/all.js
+3
-1
src/app/routes/dashboard-from-script.js
+61
-0
src/app/services/dashboard/dashboardKeyBindings.js
+0
-2
src/app/services/filterSrv.js
+2
-2
src/app/services/unsavedChangesSrv.js
+5
-1
No files found.
src/app/routes/all.js
View file @
257ea391
define
([
define
([
'./dashboard-from-es'
,
'./dashboard-from-es'
,
'./dashboard-from-file'
'./dashboard-from-file'
,
'./dashboard-from-script'
],
],
function
()
{});
function
()
{});
\ No newline at end of file
src/app/routes/dashboard-from-script.js
0 → 100644
View file @
257ea391
define
([
'angular'
,
'jquery'
,
'config'
,
'underscore'
,
'kbn'
,
'moment'
],
function
(
angular
,
$
,
config
,
_
,
kbn
,
moment
)
{
"use strict"
;
var
module
=
angular
.
module
(
'kibana.routes'
);
module
.
config
(
function
(
$routeProvider
)
{
$routeProvider
.
when
(
'/dashboard/script/:jsFile'
,
{
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromScriptProvider'
,
});
});
module
.
controller
(
'DashFromScriptProvider'
,
function
(
$scope
,
$rootScope
,
$http
,
$routeParams
,
alertSrv
,
$q
)
{
var
execute_script
=
function
(
result
)
{
/*jshint -W054 */
var
script_func
=
new
Function
(
'ARGS'
,
'kbn'
,
'_'
,
'moment'
,
'window'
,
'document'
,
'$'
,
'jQuery'
,
result
.
data
);
var
script_result
=
script_func
(
$routeParams
,
kbn
,
_
,
moment
,
window
,
document
,
$
,
$
);
// Handle async dashboard scripts
if
(
_
.
isFunction
(
script_result
))
{
var
deferred
=
$q
.
defer
();
script_result
(
function
(
dashboard
)
{
$rootScope
.
$apply
(
function
()
{
deferred
.
resolve
({
data
:
dashboard
});
});
});
return
deferred
.
promise
;
}
return
{
data
:
script_result
};
};
var
script_load
=
function
(
file
)
{
var
url
=
'app/dashboards/'
+
file
.
replace
(
/
\.(?!
js
)
/
,
"/"
)
+
'?'
+
new
Date
().
getTime
();
return
$http
({
url
:
url
,
method
:
"GET"
})
.
then
(
execute_script
)
.
then
(
null
,
function
(
err
)
{
console
.
log
(
'Script dashboard error '
+
err
);
alertSrv
.
set
(
'Error'
,
"Could not load <i>scripts/"
+
file
+
"</i>. Please make sure it exists and returns a valid dashboard"
,
'error'
);
return
false
;
});
};
script_load
(
$routeParams
.
jsFile
).
then
(
function
(
result
)
{
$scope
.
emitAppEvent
(
'setup-dashboard'
,
result
.
data
);
});
});
});
src/app/services/dashboard/dashboardKeyBindings.js
View file @
257ea391
...
@@ -9,7 +9,6 @@ function(angular, $) {
...
@@ -9,7 +9,6 @@ function(angular, $) {
var
module
=
angular
.
module
(
'kibana.services'
);
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'dashboardKeybindings'
,
function
(
$rootScope
,
keyboardManager
)
{
module
.
service
(
'dashboardKeybindings'
,
function
(
$rootScope
,
keyboardManager
)
{
this
.
hasRegistered
=
false
;
this
.
shortcuts
=
function
(
scope
)
{
this
.
shortcuts
=
function
(
scope
)
{
...
@@ -28,7 +27,6 @@ function(angular, $) {
...
@@ -28,7 +27,6 @@ function(angular, $) {
});
});
scope
.
$on
(
'$destroy'
,
function
()
{
scope
.
$on
(
'$destroy'
,
function
()
{
console
.
log
(
'unbind keyboardManager'
);
keyboardManager
.
unbind
(
'ctrl+f'
);
keyboardManager
.
unbind
(
'ctrl+f'
);
keyboardManager
.
unbind
(
'ctrl+h'
);
keyboardManager
.
unbind
(
'ctrl+h'
);
keyboardManager
.
unbind
(
'ctrl+s'
);
keyboardManager
.
unbind
(
'ctrl+s'
);
...
...
src/app/services/filterSrv.js
View file @
257ea391
...
@@ -94,7 +94,7 @@ define([
...
@@ -94,7 +94,7 @@ define([
this
.
dashboard
=
dashboard
;
this
.
dashboard
=
dashboard
;
this
.
templateSettings
=
{
interpolate
:
/
\[\[([\s\S]
+
?)\]\]
/g
};
this
.
templateSettings
=
{
interpolate
:
/
\[\[([\s\S]
+
?)\]\]
/g
};
/*
if (!this.dashboard.services.filter) {
if
(
!
this
.
dashboard
.
services
.
filter
)
{
this
.
dashboard
.
services
.
filter
=
{
this
.
dashboard
.
services
.
filter
=
{
list
:
[],
list
:
[],
time
:
{
time
:
{
...
@@ -103,7 +103,7 @@ define([
...
@@ -103,7 +103,7 @@ define([
}
}
};
};
}
}
*/
this
.
time
=
dashboard
.
services
.
filter
.
time
;
this
.
time
=
dashboard
.
services
.
filter
.
time
;
this
.
templateParameters
=
dashboard
.
services
.
filter
.
list
||
[];
this
.
templateParameters
=
dashboard
.
services
.
filter
.
list
||
[];
this
.
updateTemplateData
(
true
);
this
.
updateTemplateData
(
true
);
...
...
src/app/services/unsavedChangesSrv.js
View file @
257ea391
...
@@ -18,8 +18,11 @@ function(angular, _, config) {
...
@@ -18,8 +18,11 @@ function(angular, _, config) {
var
modalScope
=
$rootScope
.
$new
();
var
modalScope
=
$rootScope
.
$new
();
$rootScope
.
$on
(
"dashboard-loaded"
,
function
(
event
,
newDashboard
)
{
$rootScope
.
$on
(
"dashboard-loaded"
,
function
(
event
,
newDashboard
)
{
// wait for different services to patch the dashboard (missing properties)
$timeout
(
function
()
{
self
.
original
=
angular
.
copy
(
newDashboard
);
self
.
original
=
angular
.
copy
(
newDashboard
);
self
.
current
=
newDashboard
;
self
.
current
=
newDashboard
;
},
1000
);
});
});
$rootScope
.
$on
(
"dashboard-saved"
,
function
(
event
,
savedDashboard
)
{
$rootScope
.
$on
(
"dashboard-saved"
,
function
(
event
,
savedDashboard
)
{
...
@@ -42,7 +45,8 @@ function(angular, _, config) {
...
@@ -42,7 +45,8 @@ function(angular, _, config) {
if
(
self
.
has_unsaved_changes
())
{
if
(
self
.
has_unsaved_changes
())
{
event
.
preventDefault
();
event
.
preventDefault
();
self
.
next
=
next
;
self
.
next
=
next
;
self
.
open_modal
();
$timeout
(
self
.
open_modal
);
}
}
});
});
};
};
...
...
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