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
152b484e
Commit
152b484e
authored
Oct 30, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: moved app/controllers -> app/core/controllers
parent
97de8c1c
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
31 additions
and
232 deletions
+31
-232
public/app/app.js
+0
-1
public/app/controllers/metricKeys.js
+0
-186
public/app/core/controllers/all.js
+0
-0
public/app/core/controllers/errorCtrl.js
+3
-5
public/app/core/controllers/grafanaCtrl.js
+3
-4
public/app/core/controllers/inspectCtrl.js
+3
-4
public/app/core/controllers/invitedCtrl.js
+3
-6
public/app/core/controllers/jsonEditorCtrl.js
+3
-5
public/app/core/controllers/loginCtrl.js
+3
-4
public/app/core/controllers/resetPasswordCtrl.js
+3
-5
public/app/core/controllers/search.js
+3
-4
public/app/core/controllers/sidemenuCtrl.js
+3
-4
public/app/core/controllers/signupCtrl.ts
+3
-4
public/app/core/core.ts
+1
-0
No files found.
public/app/app.js
View file @
152b484e
...
...
@@ -71,7 +71,6 @@ function (angular, $, _, appLevelRequire) {
var
preBootRequires
=
[
'app/services/all'
,
'app/features/all'
,
'app/controllers/all'
,
];
app
.
boot
=
function
()
{
...
...
public/app/controllers/metricKeys.js
deleted
100644 → 0
View file @
97de8c1c
define
([
'angular'
,
'lodash'
,
'app/core/config'
],
function
(
angular
,
_
,
config
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'MetricKeysCtrl'
,
function
(
$scope
,
$http
,
$q
)
{
var
elasticSearchUrlForMetricIndex
=
config
.
elasticsearch
+
'/'
+
config
.
grafana_metrics_index
+
'/'
;
var
httpOptions
=
{};
if
(
config
.
elasticsearchBasicAuth
)
{
httpOptions
.
withCredentials
=
true
;
httpOptions
.
headers
=
{
"Authorization"
:
"Basic "
+
config
.
elasticsearchBasicAuth
};
}
$scope
.
init
=
function
()
{
$scope
.
metricPath
=
"prod.apps.api.boobarella.*"
;
$scope
.
metricCounter
=
0
;
};
$scope
.
createIndex
=
function
()
{
$scope
.
errorText
=
null
;
$scope
.
infoText
=
null
;
deleteIndex
()
.
then
(
createIndex
)
.
then
(
function
()
{
$scope
.
infoText
=
"Index created!"
;
})
.
then
(
null
,
function
(
err
)
{
$scope
.
errorText
=
angular
.
toJson
(
err
);
});
};
$scope
.
loadMetricsFromPath
=
function
()
{
$scope
.
errorText
=
null
;
$scope
.
infoText
=
null
;
$scope
.
metricCounter
=
0
;
return
loadMetricsRecursive
(
$scope
.
metricPath
)
.
then
(
function
()
{
$scope
.
infoText
=
"Indexing completed!"
;
},
function
(
err
)
{
$scope
.
errorText
=
"Error: "
+
err
;
});
};
$scope
.
loadAll
=
function
()
{
$scope
.
infoText
=
"Fetching all metrics from graphite..."
;
getFromEachGraphite
(
'/metrics/index.json'
,
saveMetricsArray
)
.
then
(
function
()
{
$scope
.
infoText
=
"Indexing complete!"
;
}).
then
(
null
,
function
(
err
)
{
$scope
.
errorText
=
err
;
});
};
function
getFromEachGraphite
(
request
,
data_callback
,
error_callback
)
{
return
$q
.
all
(
_
.
map
(
config
.
datasources
,
function
(
datasource
)
{
if
(
datasource
.
type
=
'graphite'
)
{
return
$http
.
get
(
datasource
.
url
+
request
)
.
then
(
data_callback
,
error_callback
);
}
}));
}
function
saveMetricsArray
(
data
,
currentIndex
)
{
if
(
!
data
&&
!
data
.
data
&&
data
.
data
.
length
===
0
)
{
return
$q
.
reject
(
'No metrics from graphite'
);
}
if
(
data
.
data
.
length
===
currentIndex
)
{
return
$q
.
when
(
'done'
);
}
currentIndex
=
currentIndex
||
0
;
return
saveMetricKey
(
data
.
data
[
currentIndex
])
.
then
(
function
()
{
return
saveMetricsArray
(
data
,
currentIndex
+
1
);
});
}
function
deleteIndex
()
{
var
deferred
=
$q
.
defer
();
$http
.
delete
(
elasticSearchUrlForMetricIndex
,
httpOptions
)
.
success
(
function
()
{
deferred
.
resolve
(
'ok'
);
})
.
error
(
function
(
data
,
status
)
{
if
(
status
===
404
)
{
deferred
.
resolve
(
'ok'
);
}
else
{
deferred
.
reject
(
'elastic search returned unexpected error'
);
}
});
return
deferred
.
promise
;
}
function
createIndex
()
{
return
$http
.
put
(
elasticSearchUrlForMetricIndex
,
{
settings
:
{
analysis
:
{
analyzer
:
{
metric_path_ngram
:
{
tokenizer
:
"my_ngram_tokenizer"
}
},
tokenizer
:
{
my_ngram_tokenizer
:
{
type
:
"nGram"
,
min_gram
:
"3"
,
max_gram
:
"8"
,
token_chars
:
[
"letter"
,
"digit"
,
"punctuation"
,
"symbol"
]
}
}
}
},
mappings
:
{
metricKey
:
{
properties
:
{
metricPath
:
{
type
:
"multi_field"
,
fields
:
{
"metricPath"
:
{
type
:
"string"
,
index
:
"analyzed"
,
index_analyzer
:
"standard"
},
"metricPath_ng"
:
{
type
:
"string"
,
index
:
"analyzed"
,
index_analyzer
:
"metric_path_ngram"
}
}
}
}
}
}
},
httpOptions
);
}
function
receiveMetric
(
result
)
{
var
data
=
result
.
data
;
if
(
!
data
||
data
.
length
===
0
)
{
console
.
log
(
'no data'
);
return
;
}
var
funcs
=
_
.
map
(
data
,
function
(
metric
)
{
if
(
metric
.
expandable
)
{
return
loadMetricsRecursive
(
metric
.
id
+
".*"
);
}
if
(
metric
.
leaf
)
{
return
saveMetricKey
(
metric
.
id
);
}
});
return
$q
.
all
(
funcs
);
}
function
saveMetricKey
(
metricId
)
{
// Create request with id as title. Rethink this.
var
request
=
$scope
.
ejs
.
Document
(
config
.
grafana_metrics_index
,
'metricKey'
,
metricId
).
source
({
metricPath
:
metricId
});
return
request
.
doIndex
(
function
()
{
$scope
.
infoText
=
"Indexing "
+
metricId
;
$scope
.
metricCounter
=
$scope
.
metricCounter
+
1
;
},
function
()
{
$scope
.
errorText
=
"failed to save metric "
+
metricId
;
}
);
}
function
loadMetricsRecursive
(
metricPath
)
{
return
getFromEachGraphite
(
'/metrics/find/?query='
+
metricPath
,
receiveMetric
);
}
});
});
public/app/controllers/all.js
→
public/app/co
re/co
ntrollers/all.js
View file @
152b484e
File moved
public/app/controllers/errorCtrl.js
→
public/app/co
re/co
ntrollers/errorCtrl.js
View file @
152b484e
define
([
'angular'
,
'
lodash'
'
../core_module'
,
],
function
(
angular
)
{
function
(
angular
,
coreModule
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'ErrorCtrl'
,
function
(
$scope
,
contextSrv
)
{
coreModule
.
controller
(
'ErrorCtrl'
,
function
(
$scope
,
contextSrv
)
{
var
showSideMenu
=
contextSrv
.
sidemenu
;
contextSrv
.
sidemenu
=
false
;
...
...
public/app/controllers/grafanaCtrl.js
→
public/app/co
re/co
ntrollers/grafanaCtrl.js
View file @
152b484e
...
...
@@ -2,15 +2,14 @@ define([
'angular'
,
'lodash'
,
'jquery'
,
'../core_module'
,
'app/core/config'
,
'app/core/store'
,
],
function
(
angular
,
_
,
$
,
config
,
store
)
{
function
(
angular
,
_
,
$
,
co
reModule
,
co
nfig
,
store
)
{
"use strict"
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'GrafanaCtrl'
,
function
(
$scope
,
alertSrv
,
utilSrv
,
$rootScope
,
$controller
,
contextSrv
)
{
coreModule
.
controller
(
'GrafanaCtrl'
,
function
(
$scope
,
alertSrv
,
utilSrv
,
$rootScope
,
$controller
,
contextSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
contextSrv
=
contextSrv
;
...
...
public/app/controllers/inspectCtrl.js
→
public/app/co
re/co
ntrollers/inspectCtrl.js
View file @
152b484e
...
...
@@ -2,13 +2,12 @@ define([
'angular'
,
'lodash'
,
'jquery'
,
'../core_module'
,
],
function
(
angular
,
_
,
$
)
{
function
(
angular
,
_
,
$
,
coreModule
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'InspectCtrl'
,
function
(
$scope
)
{
coreModule
.
controller
(
'InspectCtrl'
,
function
(
$scope
)
{
var
model
=
$scope
.
inspector
;
function
getParametersFromQueryString
(
queryString
)
{
...
...
public/app/controllers/invitedCtrl.js
→
public/app/co
re/co
ntrollers/invitedCtrl.js
View file @
152b484e
define
([
'angular'
,
'../core_module'
,
'app/core/config'
,
],
function
(
angular
,
config
)
{
function
(
angular
,
co
reModule
,
co
nfig
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'InvitedCtrl'
,
function
(
$scope
,
$routeParams
,
contextSrv
,
backendSrv
)
{
coreModule
.
controller
(
'InvitedCtrl'
,
function
(
$scope
,
$routeParams
,
contextSrv
,
backendSrv
)
{
contextSrv
.
sidemenu
=
false
;
$scope
.
formModel
=
{};
$scope
.
init
=
function
()
{
...
...
public/app/controllers/jsonEditorCtrl.js
→
public/app/co
re/co
ntrollers/jsonEditorCtrl.js
View file @
152b484e
define
([
'angular'
,
'
lodash'
'
../core_module'
,
],
function
(
angular
)
{
function
(
angular
,
coreModule
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'JsonEditorCtrl'
,
function
(
$scope
)
{
coreModule
.
controller
(
'JsonEditorCtrl'
,
function
(
$scope
)
{
$scope
.
json
=
angular
.
toJson
(
$scope
.
object
,
true
);
$scope
.
canUpdate
=
$scope
.
updateHandler
!==
void
0
;
...
...
public/app/controllers/loginCtrl.js
→
public/app/co
re/co
ntrollers/loginCtrl.js
View file @
152b484e
define
([
'angular'
,
'../core_module'
,
'app/core/config'
,
],
function
(
angular
,
config
)
{
function
(
angular
,
co
reModule
,
co
nfig
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
backendSrv
,
contextSrv
,
$location
)
{
coreModule
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
backendSrv
,
contextSrv
,
$location
)
{
$scope
.
formModel
=
{
user
:
''
,
email
:
''
,
...
...
public/app/controllers/resetPasswordCtrl.js
→
public/app/co
re/co
ntrollers/resetPasswordCtrl.js
View file @
152b484e
define
([
'angular'
,
'../core_module'
,
],
function
(
angular
)
{
function
(
angular
,
coreModule
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'ResetPasswordCtrl'
,
function
(
$scope
,
contextSrv
,
backendSrv
,
$location
)
{
coreModule
.
controller
(
'ResetPasswordCtrl'
,
function
(
$scope
,
contextSrv
,
backendSrv
,
$location
)
{
contextSrv
.
sidemenu
=
false
;
$scope
.
formModel
=
{};
$scope
.
mode
=
'send'
;
...
...
public/app/controllers/search.js
→
public/app/co
re/co
ntrollers/search.js
View file @
152b484e
define
([
'angular'
,
'lodash'
,
'../core_module'
,
'app/core/config'
,
],
function
(
angular
,
_
,
config
)
{
function
(
angular
,
_
,
co
reModule
,
co
nfig
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'SearchCtrl'
,
function
(
$scope
,
$location
,
$timeout
,
backendSrv
)
{
coreModule
.
controller
(
'SearchCtrl'
,
function
(
$scope
,
$location
,
$timeout
,
backendSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
giveSearchFocus
=
0
;
...
...
public/app/controllers/sidemenuCtrl.js
→
public/app/co
re/co
ntrollers/sidemenuCtrl.js
View file @
152b484e
...
...
@@ -2,14 +2,13 @@ define([
'angular'
,
'lodash'
,
'jquery'
,
'../core_module'
,
'app/core/config'
,
],
function
(
angular
,
_
,
$
,
config
)
{
function
(
angular
,
_
,
$
,
co
reModule
,
co
nfig
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'SideMenuCtrl'
,
function
(
$scope
,
$location
,
contextSrv
,
backendSrv
)
{
coreModule
.
controller
(
'SideMenuCtrl'
,
function
(
$scope
,
$location
,
contextSrv
,
backendSrv
)
{
$scope
.
getUrl
=
function
(
url
)
{
return
config
.
appSubUrl
+
url
;
...
...
public/app/controllers/signupCtrl.ts
→
public/app/co
re/co
ntrollers/signupCtrl.ts
View file @
152b484e
///<reference path="../headers/common.d.ts" />
///<reference path="../
../
headers/common.d.ts" />
import
angular
=
require
(
'angular'
);
import
config
=
require
(
'app/core/config'
);
var
module
=
angular
.
module
(
'grafana.controllers'
);
import
coreModule
=
require
(
'../core_module'
);
export
class
SignUpCtrl
{
...
...
@@ -48,5 +47,5 @@ export class SignUpCtrl {
};
}
m
odule
.
controller
(
'SignUpCtrl'
,
SignUpCtrl
);
coreM
odule
.
controller
(
'SignUpCtrl'
,
SignUpCtrl
);
public/app/core/core.ts
View file @
152b484e
...
...
@@ -16,6 +16,7 @@
///<amd-dependency path="./directives/value_select_dropdown" />
///<amd-dependency path="./routes/all" />
///<amd-dependency path="./controllers/all" />
///<amd-dependency path="./jquery_extended" />
///<amd-dependency path="./partials" />
...
...
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