use function hoisting for utility functions

This commit is contained in:
Joe Fleming 2015-03-24 15:28:45 -07:00
parent cb547f2f20
commit 0438874967

View file

@ -118,24 +118,6 @@ define(function (require) {
'index.nameIsPattern',
'index.nameInterval.name'
], function (newVal, oldVal) {
function getPatternDefault(interval) {
switch (interval) {
case 'hours':
return '[logstash-]YYYY.MM.DD.HH';
case 'days':
return '[logstash-]YYYY.MM.DD';
case 'weeks':
return '[logstash-]GGGG.WW';
case 'months':
return '[logstash-]YYYY.MM';
case 'years':
return '[logstash-]YYYY';
default:
return 'logstash-*';
}
}
var isTimeBased = newVal[0];
var nameIsPattern = newVal[1];
var newDefault = getPatternDefault(newVal[2]);
@ -158,14 +140,6 @@ define(function (require) {
}
});
var mockIndexPattern = function (index) {
// trick the mapper into thinking this is an indexPattern
return {
id: index.name,
intervalName: index.nameInterval
};
};
$scope.moreSamples = function (andUpdate) {
index.sampleCount += 5;
if (andUpdate) updateSamples();
@ -254,5 +228,30 @@ define(function (require) {
index.fetchFieldsError = 'Loading';
}
}
function getPatternDefault(interval) {
switch (interval) {
case 'hours':
return '[logstash-]YYYY.MM.DD.HH';
case 'days':
return '[logstash-]YYYY.MM.DD';
case 'weeks':
return '[logstash-]GGGG.WW';
case 'months':
return '[logstash-]YYYY.MM';
case 'years':
return '[logstash-]YYYY';
default:
return 'logstash-*';
}
}
function mockIndexPattern(index) {
// trick the mapper into thinking this is an indexPattern
return {
id: index.name,
intervalName: index.nameInterval
};
}
});
});