-
Notifications
You must be signed in to change notification settings - Fork 204
Switch to new tenant after loading a copied long URL #1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DarshitChanpura
merged 80 commits into
opensearch-project:main
from
leanneeliatra:1204-fix-for-url-tenancy-stuck-reload-issue
Jun 19, 2023
Merged
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
407dfaf
Replace legacy template with index template (#1359)
cliu123 f0b3b36
added loginEndPointWithPath (#1358)
mattieserver e1cdfb9
Add release notes for 1.3.9 (#1379)
RyanL1997 e6292a8
No blank backend role before adding a new one in Create User page (#1…
nurSaadat edb65ea
Fix script for Windows (#1393)
nurbq 00bd284
Adding new actions for ppl and datasource apis (#1395)
vamsimanohar c3c88e4
Fix "Get started" image is not adaptive to the browser window size. (…
curq a999f35
Split up a value into multiple cookie payloads (#1352)
jochen-kressin 3dd704c
Dynamic tenancy configurations (#1394)
abhivka7 01c1127
Add release notes for 2.7.0 (#1407)
RyanL1997 83fd577
Removes tiny.amazon.com links (#1420)
DarshitChanpura 500ef1c
Fixing dynamic tenancy changes for issues 1412 (#1419)
abhivka7 eb7f84e
Change the testuser's password in some integration test cases into a …
RyanL1997 5ee51fd
Increment version to 3.0.0.0 (#1414)
opensearch-trigger-bot[bot] 69f6196
Adds the newly created admin api permissions to the static dropdown l…
DarshitChanpura c3ba3d7
Update account-nav-button.tsx
leanneeliatra 5f157ff
Update account-nav-button.tsx
leanneeliatra 1da4bb8
add new cluster permissions constants for lron (#1444)
zhichao-aws d00dcd3
removing whitespace due to linting fix
leanneeliatra 7f1b505
Adding tests for account-nav-button wip
leanneeliatra 0ea6d93
put commented code to original state
leanneeliatra 98129e0
Skip flaky SAML test as it awaits a fix (#1453)
cwperks c8f3d99
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 7d689c2
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 b36973a
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 d6c2226
Use version from package.json for integration tests (#1463)
cwperks c0a7956
Adds 2.8 release notes (#1464)
DarshitChanpura 38adf3d
Adding tests to jest test for tenant switch. Putting test in correct …
leanneeliatra fbf21c7
handle switch calling correct function
leanneeliatra 378f0a7
checking for session storage
leanneeliatra 634d35f
adding window to make sessionStorage more explicit
leanneeliatra e54f7ca
Moved the test into account-nav-button.test.tsx
leanneeliatra 3194452
Removing additional files.
leanneeliatra d915bc7
Declared session storage as a constant
leanneeliatra 4e4176a
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 e007ff9
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 294f0f8
Update account-nav-button.tsx
leanneeliatra 3d37601
Update account-nav-button.tsx
leanneeliatra 09adf98
removing whitespace due to linting fix
leanneeliatra 8be9be9
Adding tests for account-nav-button wip
leanneeliatra 624e2c5
put commented code to original state
leanneeliatra 47a5cfe
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 d6182bd
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 5adc1e3
Adding tests to jest test for tenant switch. Putting test in correct …
leanneeliatra cb6b8dd
handle switch calling correct function
leanneeliatra 09e5f31
Removing additional files.
leanneeliatra 4a0b695
Fix unwanted changes
DarshitChanpura c6b09ca
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 eb20a4b
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 74ad1f1
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 543a360
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 41f2ce2
Update account-nav-button.tsx
leanneeliatra 13dc4c6
Adding tests for account-nav-button wip
leanneeliatra c6079c7
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 8f0ee8b
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 55edb20
Adding tests to jest test for tenant switch. Putting test in correct …
leanneeliatra 4af5994
checking for session storage
leanneeliatra d21659a
Declared session storage as a constant
leanneeliatra cd96416
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 c29c3de
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 bc8b12a
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 c4b31c5
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 3183f37
Adding tests for account-nav-button wip
leanneeliatra abf9510
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 2f25951
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 476b5c4
Adding tests to jest test for tenant switch. Putting test in correct …
leanneeliatra 5976e9d
Moved the test into account-nav-button.test.tsx
leanneeliatra e2d009b
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 8c121f2
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 7918505
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 939c1a2
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 829e75e
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 ee7ab0a
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 d8f8daa
Dynamic tenancy configurations (#1394)
abhivka7 965b982
Fixing dynamic tenancy changes for issues 1412 (#1419)
abhivka7 27128ad
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 b6a38c7
Removing Prerequisite Checks Workflow (#1456)
RyanL1997 9d7da4c
Use version from package.json for integration tests (#1463)
cwperks 50956c6
Merge branch 'main' into 1204-fix-for-url-tenancy-stuck-reload-issue
leanneeliatra ba17d04
Removing unneded file
leanneeliatra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| import { reloadAfterTenantSwitch } from '../account-nav-button'; | ||
|
|
||
| describe('Reload window after tenant switch', () => { | ||
| const originalLocation = window.location; | ||
| const mockSetWindowHref = jest.fn(); | ||
| let pathname: string = ''; | ||
| beforeAll(() => { | ||
| pathname = '/app/myapp'; | ||
| Object.defineProperty(window, 'location', { | ||
| value: { | ||
| get pathname() { | ||
| return pathname; | ||
| }, | ||
| get href() { | ||
| return '/app/dashboards?security_tenant=admin_tenant'; | ||
| }, | ||
| set href(value: string) { | ||
| mockSetWindowHref(value); | ||
| }, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| afterAll(() => { | ||
| window.location = originalLocation; | ||
| }); | ||
|
|
||
| it('should remove the tenant query parameter before reloading', () => { | ||
| pathname = '/app/pathname-only'; | ||
| reloadAfterTenantSwitch(); | ||
| expect(mockSetWindowHref).toHaveBeenCalledWith(pathname); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Clear lastUrls after tenant switch', () => { | ||
| afterAll(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('should clear out keys with a lastUrl prefix', () => { | ||
| window.sessionStorage.setItem('lastUrl:dashboard', '/dashboard1'); | ||
| window.sessionStorage.setItem('lastUrl:otherApp', '/otherApp'); | ||
| window.sessionStorage.setItem('somethingElse:here', '/random'); | ||
| const mockRemoveItem = jest.spyOn(Object.getPrototypeOf(window.sessionStorage), 'removeItem'); | ||
| reloadAfterTenantSwitch(); | ||
| expect(mockRemoveItem).toHaveBeenCalledWith('lastUrl:dashboard'); | ||
| expect(mockRemoveItem).toHaveBeenCalledWith('lastUrl:otherApp'); | ||
| expect(mockRemoveItem).toHaveBeenCalledTimes(2); | ||
| }); | ||
|
|
||
| it('should not clear out keys without a lastUrl prefix', () => { | ||
| window.sessionStorage.setItem('somethingElse:here', '/random'); | ||
| const mockRemoveItem = jest.spyOn(Object.getPrototypeOf(window.sessionStorage), 'removeItem'); | ||
|
|
||
| reloadAfterTenantSwitch(); | ||
| expect(mockRemoveItem).toHaveBeenCalledTimes(0); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.