mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
remove 'write global state' to url all over the place
This commit is contained in:
parent
4d83fea7b5
commit
bc7daf9ac6
5 changed files with 12 additions and 33 deletions
|
@ -45,8 +45,7 @@ define(function (require) {
|
|||
}
|
||||
});
|
||||
|
||||
app.controller('discover', function ($scope, config, courier, $route, $window, $q, savedSearches, savedVisualizations,
|
||||
Notifier, $location, AppState, timefilter, Promise, Private, kbnUrl) {
|
||||
app.controller('discover', function ($scope, config, courier, $route, $window, Notifier, AppState, timefilter, Promise, Private, kbnUrl) {
|
||||
|
||||
var Vis = Private(require('components/vis/vis'));
|
||||
var SegmentedFetch = Private(require('apps/discover/_segmented_fetch'));
|
||||
|
@ -615,7 +614,7 @@ define(function (require) {
|
|||
var loadingVis;
|
||||
var setupVisualization = function () {
|
||||
// If we're not setting anything up we need to return an empty promise
|
||||
if (!$scope.opts.timefield) return $q.when();
|
||||
if (!$scope.opts.timefield) return Promise.resolve();
|
||||
if (loadingVis) return loadingVis;
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
require('modules').get('apps/settings')
|
||||
.controller('settingsIndicesCreate', function ($scope, $location, Private, Notifier, indexPatterns, es, config) {
|
||||
.controller('settingsIndicesCreate', function ($scope, kbnUrl, Private, Notifier, indexPatterns, es, config) {
|
||||
var notify = new Notifier();
|
||||
var MissingIndices = errors.IndexPatternMissingIndices;
|
||||
var refreshKibanaIndex = Private(require('apps/settings/sections/indices/_refresh_kibana_index'));
|
||||
|
@ -148,7 +148,7 @@ define(function (require) {
|
|||
config.set('defaultIndex', indexPattern.id);
|
||||
}
|
||||
indexPatterns.cache.clear(indexPattern.id);
|
||||
$location.url('/settings/indices/' + indexPattern.id);
|
||||
kbnUrl.change('/settings/indices/' + indexPattern.id);
|
||||
});
|
||||
|
||||
// refreshFields calls save() after a successfull fetch, no need to save again
|
||||
|
|
|
@ -27,18 +27,9 @@ define(function (require) {
|
|||
|
||||
url = self.eval(url, paramObj);
|
||||
|
||||
// path change
|
||||
if (type === 'path') {
|
||||
if (url !== $location.path()) {
|
||||
$location.path(globalState.removeFromUrl(url));
|
||||
doReload = (!self.matches(url));
|
||||
}
|
||||
// default to url change
|
||||
} else {
|
||||
if (url !== $location.url()) {
|
||||
$location.url(globalState.removeFromUrl(url));
|
||||
doReload = (!self.matches(url));
|
||||
}
|
||||
if (url !== $location[type]()) {
|
||||
$location[type](url);
|
||||
doReload = !self.matches(url);
|
||||
}
|
||||
|
||||
if (forceReload || doReload) {
|
||||
|
|
|
@ -17,6 +17,11 @@ module.exports = function (grunt) {
|
|||
}
|
||||
|
||||
grunt.registerTask('test', function () {
|
||||
if (grunt.option('quick')) {
|
||||
grunt.task.run('quick-test');
|
||||
return;
|
||||
}
|
||||
|
||||
var tasks = [
|
||||
'jshint',
|
||||
'ruby_server',
|
||||
|
|
|
@ -90,22 +90,6 @@ define(function (require) {
|
|||
expect(kbnUrl.reload.callCount).to.be(uniqWordCount);
|
||||
});
|
||||
|
||||
it('should persist global state', function () {
|
||||
var wordCount = _.random(3, 6);
|
||||
var globalStateSpy = sinon.spy(globalStateMock, 'writeToUrl');
|
||||
var urls = faker.Lorem.words(wordCount).map(function (url, i) {
|
||||
return '/' + url + i;
|
||||
});
|
||||
|
||||
urls.forEach(function (url) {
|
||||
kbnUrl.change(url);
|
||||
|
||||
expect($location.url()).to.be(url);
|
||||
});
|
||||
|
||||
expect(globalStateSpy.callCount).to.be(wordCount);
|
||||
});
|
||||
|
||||
it('should reload when forceReload is true', function () {
|
||||
var words = [faker.Lorem.words(_.random(2, 6)).join('/')];
|
||||
words.push(words[0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue