From 6acd844e7ef070e280e531145842c4ddb8fc2837 Mon Sep 17 00:00:00 2001 From: Assem Hafez <137278762+Assem-Uber@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:49:54 +0100 Subject: [PATCH] preserve query params on cluster redirect (#539) --- client/containers/domain/connector.js | 1 + client/test/domain.test.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/containers/domain/connector.js b/client/containers/domain/connector.js index 7a885fe08..dcb33a8c3 100644 --- a/client/containers/domain/connector.js +++ b/client/containers/domain/connector.js @@ -72,6 +72,7 @@ const lifecycle = { // in some cases users have urls that are generic (with no cluster name specified) those are used when we want to auto redirect the user to one of the clusters by default without carring about which cluster. dispatch(ROUTE_REPLACE, { name: state.route.name, + query: state.route.query, params: { ...state.route.params, clusterName: this.activeCluster?.clusterName, diff --git a/client/test/domain.test.js b/client/test/domain.test.js index 9719784e3..7426ec0c2 100644 --- a/client/test/domain.test.js +++ b/client/test/domain.test.js @@ -92,13 +92,13 @@ describe('Domain ', () => { .withDomainDescription('ci-test', desc) .withWorkflows({ status: 'open' }) .withWorkflows({ status: 'closed', startTimeOffset: 30 }) - .startingAt('/domains/ci-test') + .startingAt('/domains/ci-test?t=test') .go(); return [testEl, scenario]; } - it('should redirect to cluster if it is missing in the url in a cross region domain environment', async function test() { + it('should redirect to cluster if it is missing in the url in a cross region domain environment while preserving queryParams', async function test() { // if clusterName is missing in the url and active cluser exists // make sure to redirect to add cluster to url // we make sure the activeCluster config exists by passing feature flags for crossRegion configs @@ -108,6 +108,8 @@ describe('Domain ', () => { await testEl.waitUntilExists('.feature-flag .active-status'); scenario.location.should.contain('/ci-test-cluster'); + // query paramas should be preserveded + scenario.location.should.contain('t=test'); }); it('should not redirect to cluster if it is missing in the url in a non cross region domain environment', async function test() {