Skip to content

Commit

Permalink
preserve query params on cluster redirect (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
Assem-Uber authored Feb 19, 2024
1 parent 7155ab0 commit 6acd844
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/containers/domain/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions client/test/domain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down

0 comments on commit 6acd844

Please sign in to comment.