[Dashboard] [Visualize] Add Search to Legacy Redirect (#112365) (#112704)

added search to legacy redirect URL
This commit is contained in:
Devon Thomson 2021-09-21 14:02:32 -06:00 committed by GitHub
parent f188688c73
commit 8b66056672
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 5 deletions

View file

@ -23,9 +23,8 @@ export const DashboardNoMatch = ({ history }: { history: RouteComponentProps['hi
useEffect(() => {
services.restorePreviousUrl();
const { navigated } = services.urlForwarding.navigateToLegacyKibanaUrl(
history.location.pathname
history.location.pathname + history.location.search
);
if (!navigated) {

View file

@ -24,7 +24,7 @@ export const VisualizeNoMatch = () => {
services.restorePreviousUrl();
const { navigated } = services.urlForwarding.navigateToLegacyKibanaUrl(
services.history.location.pathname
services.history.location.pathname + services.history.location.search
);
if (!navigated) {

View file

@ -86,6 +86,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
describe('6.0 urls', () => {
let savedDashboardId: string;
it('loads an unsaved dashboard', async function () {
const url = `${kibanaLegacyBaseUrl}#/dashboard?${urlQuery}`;
log.debug(`Navigating to ${url}`);
@ -106,8 +108,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
storeTimeWithDashboard: true,
});
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
const url = `${kibanaLegacyBaseUrl}#/dashboard/${id}`;
savedDashboardId = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
const url = `${kibanaLegacyBaseUrl}#/dashboard/${savedDashboardId}`;
log.debug(`Navigating to ${url}`);
await browser.get(url, true);
await PageObjects.header.waitUntilLoadingHasFinished();
@ -121,6 +123,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardExpect.selectedLegendColorCount('#F9D9F9', 5);
});
it('loads a saved dashboard with query via dashboard_no_match', async function () {
await PageObjects.dashboard.gotoDashboardLandingPage();
const currentUrl = await browser.getCurrentUrl();
const dashboardBaseUrl = currentUrl.substring(0, currentUrl.indexOf('/app/dashboards'));
const url = `${dashboardBaseUrl}/app/dashboards#/dashboard/${savedDashboardId}?_a=(query:(language:kuery,query:'boop'))`;
log.debug(`Navigating to ${url}`);
await browser.get(url);
await PageObjects.header.waitUntilLoadingHasFinished();
const query = await queryBar.getQueryString();
expect(query).to.equal('boop');
await dashboardExpect.panelCount(2);
await PageObjects.dashboard.waitForRenderComplete();
});
it('uiState in url takes precedence over saved dashboard state', async function () {
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
const updatedQuery = urlQuery.replace(/F9D9F9/g, '000000');