Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ export class DashboardAppController {
new FilterStateManager(globalState, getAppState, filterManager);
const queryFilter = filterManager;

function getUnhashableStates(): State[] {
return [getAppState(), globalState].filter(Boolean);
}

let lastReloadRequestTime = 0;

const dash = ($scope.dash = $route.current.locals.dash);
Expand Down Expand Up @@ -751,7 +747,7 @@ export class DashboardAppController {
anchorElement,
allowEmbed: true,
allowShortUrl: !dashboardConfig.getHideWriteControls(),
shareableUrl: unhashUrl(window.location.href, getUnhashableStates()),
shareableUrl: unhashUrl(window.location.href),
objectId: dash.id,
objectType: 'dashboard',
sharingData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import './np_core.test.mocks';

import 'ui/state_management/state_storage/mock';
import { DashboardStateManager } from './dashboard_state_manager';
import { getAppStateMock, getSavedDashboardMock } from './__tests__';
import { AppStateClass } from './legacy_imports';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {
getRequestInspectorStats,
getResponseInspectorStats,
getServices,
getUnhashableStatesProvider,
hasSearchStategyForIndexPattern,
intervalOptions,
isDefaultTypeIndexPattern,
Expand Down Expand Up @@ -195,10 +194,8 @@ function discoverController(
globalState,
) {
const responseHandler = vislibSeriesResponseHandlerProvider().handler;
const getUnhashableStates = Private(getUnhashableStatesProvider);
const filterStateManager = new FilterStateManager(globalState, getAppState, filterManager);


const inspectorAdapters = {
requests: new RequestAdapter()
};
Expand Down Expand Up @@ -333,7 +330,7 @@ function discoverController(
anchorElement,
allowEmbed: false,
allowShortUrl: uiCapabilities.discover.createShortUrl,
shareableUrl: unhashUrl(window.location.href, getUnhashableStates()),
shareableUrl: unhashUrl(window.location.href),
objectId: savedSearch.id,
objectType: 'search',
sharingData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ export { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
// @ts-ignore
export { timezoneProvider } from 'ui/vis/lib/timezone';
// @ts-ignore
export { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';
// @ts-ignore
export { tabifyAggResponse } from 'ui/agg_response/tabify';
// @ts-ignore
export { vislibSeriesResponseHandlerProvider } from 'ui/vis/response_handlers/vislib';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
getServices,
angular,
absoluteToParsedUrl,
getUnhashableStatesProvider,
KibanaParsedUrl,
migrateLegacyQuery,
SavedObjectSaveModal,
Expand Down Expand Up @@ -166,7 +165,6 @@ function VisEditor(
localStorage,
) {
const queryFilter = Private(FilterBarQueryFilterProvider);
const getUnhashableStates = Private(getUnhashableStatesProvider);

// Retrieve the resolved SavedVis instance.
const savedVis = $route.current.locals.savedVis;
Expand Down Expand Up @@ -250,7 +248,7 @@ function VisEditor(
anchorElement,
allowEmbed: true,
allowShortUrl: capabilities.visualize.createShortUrl,
shareableUrl: unhashUrl(window.location.href, getUnhashableStates()),
shareableUrl: unhashUrl(window.location.href),
objectId: savedVis.id,
objectType: 'visualization',
sharingData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ export { getFromSavedObject } from 'ui/index_patterns';
export { PersistedState } from 'ui/persisted_state';
// @ts-ignore
export { VisEditorTypesRegistryProvider } from 'ui/registry/vis_editor_types';
// @ts-ignore
export { getUnhashableStatesProvider } from 'ui/state_management/state_hashing';
export { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal';
export { stateMonitorFactory } from 'ui/state_management/state_monitor_factory';
export { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@
import chrome from 'ui/chrome';
import { hashUrl } from 'ui/state_management/state_hashing';
import uiRoutes from 'ui/routes';
import { fatalError } from 'ui/notify';

uiRoutes.enable();
uiRoutes
.when('/', {
resolve: {
url: function (AppState, globalState, $window) {
const redirectUrl = chrome.getInjected('redirectUrl');
try {
const hashedUrl = hashUrl(redirectUrl);
const url = chrome.addBasePath(hashedUrl);

const hashedUrl = hashUrl([new AppState(), globalState], redirectUrl);
const url = chrome.addBasePath(hashedUrl);

$window.location = url;
$window.location = url;
} catch (e) {
fatalError(e);
}
}
}
});
4 changes: 1 addition & 3 deletions src/legacy/ui/public/chrome/api/sub_url_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@
*/

import {
getUnhashableStatesProvider,
unhashUrl,
} from '../../state_management/state_hashing';

export function registerSubUrlHooks(angularModule, internals) {
angularModule.run(($rootScope, Private) => {
const getUnhashableStates = Private(getUnhashableStatesProvider);
const subUrlRouteFilter = Private(SubUrlRouteFilterProvider);

function updateSubUrls() {
const urlWithHashes = window.location.href;
const urlWithStates = unhashUrl(urlWithHashes, getUnhashableStates());
const urlWithStates = unhashUrl(urlWithHashes);
internals.trackPossibleSubUrl(urlWithStates);
}

Expand Down
10 changes: 3 additions & 7 deletions src/legacy/ui/public/state_management/__tests__/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ import '../../private';
import { toastNotifications } from '../../notify';
import * as FatalErrorNS from '../../notify/fatal_error';
import { StateProvider } from '../state';
import {
unhashQueryString,
} from '../state_hashing';
import {
createStateHash,
isStateHash,
} from '../state_storage';
unhashQuery
} from '../state_hashing';
import { HashedItemStore } from '../state_storage/hashed_item_store';
import { StubBrowserStorage } from 'test_utils/stub_browser_storage';
import { EventsProvider } from '../../events';
Expand Down Expand Up @@ -60,9 +58,7 @@ describe('State Management', () => {
const hashedItemStore = new HashedItemStore(store);
const state = new State(param, initial, hashedItemStore);

const getUnhashedSearch = state => {
return unhashQueryString($location.search(), [ state ]);
};
const getUnhashedSearch = () => unhashQuery($location.search());

return { store, hashedItemStore, state, getUnhashedSearch };
};
Expand Down
10 changes: 5 additions & 5 deletions src/legacy/ui/public/state_management/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import { createLegacyClass } from '../utils/legacy_class';
import { callEach } from '../utils/function';

import {
createStateHash,
HashedItemStoreSingleton,
isStateHash,
} from './state_storage';
import {
createStateHash,
isStateHash
} from './state_hashing';

export function StateProvider(Private, $rootScope, $location, stateManagementConfig, config, kbnUrl, $injector) {
const Events = Private(EventsProvider);
Expand Down Expand Up @@ -293,9 +295,7 @@ export function StateProvider(Private, $rootScope, $location, stateManagementCon

// We need to strip out Angular-specific properties.
const json = angular.toJson(state);
const hash = createStateHash(json, hash => {
return this._hashedItemStore.getItem(hash);
});
const hash = createStateHash(json);
const isItemSet = this._hashedItemStore.setItem(hash, json);

if (isItemSet) {
Expand Down

This file was deleted.

Loading