make last stored url space aware (#62264)
This commit is contained in:
parent
f86dac77da
commit
c2e43109a4
11 changed files with 683 additions and 3 deletions
|
@ -100,7 +100,7 @@ export class DiscoverPlugin implements Plugin<void, void> {
|
|||
} = createKbnUrlTracker({
|
||||
baseUrl: core.http.basePath.prepend('/app/kibana'),
|
||||
defaultSubUrl: '#/discover',
|
||||
storageKey: 'lastUrl:discover',
|
||||
storageKey: `lastUrl:${core.http.basePath.get()}:discover`,
|
||||
navLinkUpdater$: this.appStateUpdater,
|
||||
toastNotifications: core.notifications.toasts,
|
||||
stateParams: [
|
||||
|
|
|
@ -89,7 +89,7 @@ export class VisualizePlugin implements Plugin {
|
|||
const { appMounted, appUnMounted, stop: stopUrlTracker, setActiveUrl } = createKbnUrlTracker({
|
||||
baseUrl: core.http.basePath.prepend('/app/kibana'),
|
||||
defaultSubUrl: '#/visualize',
|
||||
storageKey: 'lastUrl:visualize',
|
||||
storageKey: `lastUrl:${core.http.basePath.get()}:visualize`,
|
||||
navLinkUpdater$: this.appStateUpdater,
|
||||
toastNotifications: core.notifications.toasts,
|
||||
stateParams: [
|
||||
|
|
|
@ -183,7 +183,7 @@ export class DashboardPlugin
|
|||
targetAppName === DashboardConstants.DASHBOARD_ID
|
||||
);
|
||||
},
|
||||
storageKey: 'lastUrl:dashboard',
|
||||
storageKey: `lastUrl:${core.http.basePath.get()}:dashboard`,
|
||||
navLinkUpdater$: this.appStateUpdater,
|
||||
toastNotifications: core.notifications.toasts,
|
||||
stateParams: [
|
||||
|
|
|
@ -10,5 +10,6 @@ export default function({ loadTestFile }: FtrProviderContext) {
|
|||
this.tags('ciGroup7');
|
||||
|
||||
loadTestFile(require.resolve('./feature_controls'));
|
||||
loadTestFile(require.resolve('./preserve_url'));
|
||||
});
|
||||
}
|
||||
|
|
70
x-pack/test/functional/apps/dashboard/preserve_url.ts
Normal file
70
x-pack/test/functional/apps/dashboard/preserve_url.ts
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const PageObjects = getPageObjects(['common', 'dashboard', 'spaceSelector', 'header']);
|
||||
const appsMenu = getService('appsMenu');
|
||||
const globalNav = getService('globalNav');
|
||||
|
||||
describe('preserve url', function() {
|
||||
before(async function() {
|
||||
await esArchiver.load('spaces/multi_space');
|
||||
});
|
||||
|
||||
after(function() {
|
||||
return esArchiver.unload('spaces/multi_space');
|
||||
});
|
||||
|
||||
it('goes back to last opened url', async function() {
|
||||
await PageObjects.common.navigateToApp('dashboard');
|
||||
await PageObjects.dashboard.loadSavedDashboard('A Dashboard');
|
||||
await PageObjects.common.navigateToApp('home');
|
||||
await appsMenu.clickLink('Dashboard');
|
||||
await PageObjects.dashboard.loadSavedDashboard('A Dashboard');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
const activeTitle = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitle).to.be('A Dashboard');
|
||||
});
|
||||
|
||||
it('remembers url after switching spaces', async function() {
|
||||
// default space
|
||||
await PageObjects.common.navigateToApp('dashboard');
|
||||
await PageObjects.dashboard.loadSavedDashboard('A Dashboard');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('another-space');
|
||||
await PageObjects.spaceSelector.expectHomePage('another-space');
|
||||
|
||||
// other space
|
||||
await appsMenu.clickLink('Dashboard');
|
||||
await PageObjects.dashboard.loadSavedDashboard('A Dashboard in another space');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('default');
|
||||
await PageObjects.spaceSelector.expectHomePage('default');
|
||||
|
||||
// default space
|
||||
await appsMenu.clickLink('Dashboard');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
const activeTitleDefaultSpace = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitleDefaultSpace).to.be('A Dashboard');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('another-space');
|
||||
await PageObjects.spaceSelector.expectHomePage('another-space');
|
||||
|
||||
// other space
|
||||
await appsMenu.clickLink('Dashboard');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
const activeTitleOtherSpace = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitleOtherSpace).to.be('A Dashboard in another space');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -10,5 +10,6 @@ export default function({ loadTestFile }: FtrProviderContext) {
|
|||
this.tags('ciGroup8');
|
||||
|
||||
loadTestFile(require.resolve('./feature_controls'));
|
||||
loadTestFile(require.resolve('./preserve_url'));
|
||||
});
|
||||
}
|
||||
|
|
69
x-pack/test/functional/apps/discover/preserve_url.ts
Normal file
69
x-pack/test/functional/apps/discover/preserve_url.ts
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const PageObjects = getPageObjects(['common', 'discover', 'spaceSelector', 'header']);
|
||||
const appsMenu = getService('appsMenu');
|
||||
const globalNav = getService('globalNav');
|
||||
|
||||
describe('preserve url', function() {
|
||||
before(async function() {
|
||||
await esArchiver.load('spaces/multi_space');
|
||||
});
|
||||
|
||||
after(function() {
|
||||
return esArchiver.unload('spaces/multi_space');
|
||||
});
|
||||
|
||||
it('goes back to last opened url', async function() {
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await PageObjects.discover.saveSearch('A Search');
|
||||
await PageObjects.common.navigateToApp('home');
|
||||
await appsMenu.clickLink('Discover');
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
const activeTitle = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitle).to.be('A Search');
|
||||
});
|
||||
|
||||
it('remembers url after switching spaces', async function() {
|
||||
// default space
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await PageObjects.discover.loadSavedSearch('A Search');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('another-space');
|
||||
await PageObjects.spaceSelector.expectHomePage('another-space');
|
||||
|
||||
// other space
|
||||
await appsMenu.clickLink('Discover');
|
||||
await PageObjects.discover.saveSearch('A Search in another space');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('default');
|
||||
await PageObjects.spaceSelector.expectHomePage('default');
|
||||
|
||||
// default space
|
||||
await appsMenu.clickLink('Discover');
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
const activeTitleDefaultSpace = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitleDefaultSpace).to.be('A Search');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('another-space');
|
||||
await PageObjects.spaceSelector.expectHomePage('another-space');
|
||||
|
||||
// other space
|
||||
await appsMenu.clickLink('Discover');
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
const activeTitleOtherSpace = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitleOtherSpace).to.be('A Search in another space');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -14,5 +14,6 @@ export default function visualize({ loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./feature_controls/visualize_spaces'));
|
||||
loadTestFile(require.resolve('./hybrid_visualization'));
|
||||
loadTestFile(require.resolve('./precalculated_histogram'));
|
||||
loadTestFile(require.resolve('./preserve_url'));
|
||||
});
|
||||
}
|
||||
|
|
69
x-pack/test/functional/apps/visualize/preserve_url.ts
Normal file
69
x-pack/test/functional/apps/visualize/preserve_url.ts
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'spaceSelector', 'visChart']);
|
||||
const appsMenu = getService('appsMenu');
|
||||
const globalNav = getService('globalNav');
|
||||
|
||||
describe('preserve url', function() {
|
||||
before(async function() {
|
||||
await esArchiver.load('spaces/multi_space');
|
||||
});
|
||||
|
||||
after(function() {
|
||||
return esArchiver.unload('spaces/multi_space');
|
||||
});
|
||||
|
||||
it('goes back to last opened url', async function() {
|
||||
await PageObjects.common.navigateToApp('visualize');
|
||||
await PageObjects.visualize.openSavedVisualization('A Pie');
|
||||
await PageObjects.common.navigateToApp('home');
|
||||
await appsMenu.clickLink('Visualize');
|
||||
await PageObjects.visChart.waitForVisualization();
|
||||
const activeTitle = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitle).to.be('A Pie');
|
||||
});
|
||||
|
||||
it('remembers url after switching spaces', async function() {
|
||||
// default space
|
||||
await PageObjects.common.navigateToApp('visualize');
|
||||
await PageObjects.visualize.openSavedVisualization('A Pie');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('another-space');
|
||||
await PageObjects.spaceSelector.expectHomePage('another-space');
|
||||
|
||||
// other space
|
||||
await appsMenu.clickLink('Visualize');
|
||||
await PageObjects.visualize.openSavedVisualization('A Pie in another space');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('default');
|
||||
await PageObjects.spaceSelector.expectHomePage('default');
|
||||
|
||||
// default space
|
||||
await appsMenu.clickLink('Visualize');
|
||||
await PageObjects.visChart.waitForVisualization();
|
||||
const activeTitleDefaultSpace = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitleDefaultSpace).to.be('A Pie');
|
||||
|
||||
await PageObjects.spaceSelector.openSpacesNav();
|
||||
await PageObjects.spaceSelector.clickSpaceAvatar('another-space');
|
||||
await PageObjects.spaceSelector.expectHomePage('another-space');
|
||||
|
||||
// other space
|
||||
await appsMenu.clickLink('Visualize');
|
||||
await PageObjects.visChart.waitForVisualization();
|
||||
const activeTitleOtherSpace = await globalNav.getLastBreadcrumb();
|
||||
expect(activeTitleOtherSpace).to.be('A Pie in another space');
|
||||
});
|
||||
});
|
||||
}
|
185
x-pack/test/functional/es_archives/spaces/multi_space/data.json
Normal file
185
x-pack/test/functional/es_archives/spaces/multi_space/data.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,284 @@
|
|||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": ".kibana",
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"config": {
|
||||
"dynamic": "true",
|
||||
"properties": {
|
||||
"buildNum": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"dateFormat:tz": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 256,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionsJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"panelsJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"refreshInterval": {
|
||||
"properties": {
|
||||
"display": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"pause": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"section": {
|
||||
"type": "integer"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeFrom": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timeRestore": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"timeTo": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"uiStateJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"index-pattern": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"fieldFormatMap": {
|
||||
"type": "text"
|
||||
},
|
||||
"fields": {
|
||||
"type": "text"
|
||||
},
|
||||
"intervalName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"notExpandable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceFilters": {
|
||||
"type": "text"
|
||||
},
|
||||
"timeFieldName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"columns": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sort": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"uuid": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"space": {
|
||||
"properties": {
|
||||
"_reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"color": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"disabledFeatures": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"initials": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 2048,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"spaceId": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timelion-sheet": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timelion_chart_height": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timelion_columns": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timelion_interval": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timelion_other_interval": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timelion_rows": {
|
||||
"type": "integer"
|
||||
},
|
||||
"timelion_sheet": {
|
||||
"type": "text"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"url": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"accessCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"accessDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"createDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"url": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 2048,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"visualization": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"savedSearchId": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"uiStateJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"visState": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": "1",
|
||||
"number_of_shards": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue