-
Notifications
You must be signed in to change notification settings - Fork 164
Select the correct request tab link for request page url #964
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,13 +34,7 @@ | |
| <div class="container" id="request-page-container"> | ||
| <div class="container__header"> | ||
| <nav> | ||
| <a | ||
| href="#" | ||
| class="selected__tab" | ||
| id="ooo_tab_link" | ||
| data-testid="ooo-tab" | ||
| >OOO</a | ||
| > | ||
| <a href="#" id="ooo_tab_link" data-testid="ooo-tab">OOO</a> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the default selected_tab class from here because after a reload it selects the ooo tab then goes to another tab to match the request page url |
||
| <a | ||
| href="#" | ||
| class="disabled__tab hidden" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,14 +19,30 @@ const filterOptionsContainer = document.getElementById( | |
| ); | ||
| const applyFilterButton = document.getElementById('applyFilterButton'); | ||
| const userNameFilterInput = document.getElementById('assignee-search-input'); | ||
| let currentReqType = OOO_REQUEST_TYPE; | ||
| let currentReqType = params.get('type') ?? OOO_REQUEST_TYPE; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fetches type from page url if not found select ooo request type as default |
||
| let selected__tab__class = 'selected__tab'; | ||
| let statusValue = null; | ||
| let sortByValue = null; | ||
| let userDetails = []; | ||
| let nextLink = ''; | ||
| let isDataLoading = false; | ||
|
|
||
| function updateTabLink(requestType) { | ||
| if (requestType === OOO_REQUEST_TYPE) { | ||
| oooTabLink.classList.add(selected__tab__class); | ||
| onboardingExtensionTabLink.classList.remove(selected__tab__class); | ||
| extensionTabLink.classList.remove(selected__tab__class); | ||
| } else if (requestType === ONBOARDING_EXTENSION_REQUEST_TYPE) { | ||
| onboardingExtensionTabLink.classList.add(selected__tab__class); | ||
| oooTabLink.classList.remove(selected__tab__class); | ||
| extensionTabLink.classList.remove(selected__tab__class); | ||
| } else if (requestType === EXTENSION_REQUEST_TYPE) { | ||
| extensionTabLink.classList.add(selected__tab__class); | ||
| oooTabLink.classList.remove(selected__tab__class); | ||
| onboardingExtensionTabLink.classList.remove(selected__tab__class); | ||
| } | ||
| } | ||
|
|
||
|
Comment on lines
+30
to
+45
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on current request type it adds selected__tab class to request tab link and removes from others |
||
| function getUserDetails(id) { | ||
| return userDetails.find((user) => user.id === id); | ||
| } | ||
|
|
@@ -65,9 +81,7 @@ oooTabLink.addEventListener('click', async function (event) { | |
| nextLink = ''; | ||
| deselectRadioButtons(); | ||
| userNameFilterInput.value = ''; | ||
| oooTabLink.classList.add(selected__tab__class); | ||
| extensionTabLink.classList.remove(selected__tab__class); | ||
| onboardingExtensionTabLink.classList.remove(selected__tab__class); | ||
| updateTabLink(currentReqType.toUpperCase()); | ||
|
Comment on lines
-68
to
+84
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have refactored this as it is being handle in updateTabLink function |
||
| changeFilter(); | ||
| updateUrlWithQuery(currentReqType); | ||
| await renderRequestCards({ state: statusValue, sort: sortByValue }); | ||
|
|
@@ -80,9 +94,7 @@ extensionTabLink.addEventListener('click', async function (event) { | |
| nextLink = ''; | ||
| deselectRadioButtons(); | ||
| userNameFilterInput.value = ''; | ||
| extensionTabLink.classList.add(selected__tab__class); | ||
| oooTabLink.classList.remove(selected__tab__class); | ||
| onboardingExtensionTabLink.classList.remove(selected__tab__class); | ||
| updateTabLink(currentReqType.toUpperCase()); | ||
|
Comment on lines
-83
to
+97
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have refactored this as it is being handle in updateTabLink function |
||
| changeFilter(); | ||
| updateUrlWithQuery(currentReqType); | ||
| await renderRequestCards({ state: statusValue, sort: sortByValue }); | ||
|
|
@@ -95,9 +107,7 @@ onboardingExtensionTabLink.addEventListener('click', async function (event) { | |
| nextLink = ''; | ||
| deselectRadioButtons(); | ||
| userNameFilterInput.value = ''; | ||
| onboardingExtensionTabLink.classList.add(selected__tab__class); | ||
| extensionTabLink.classList.remove(selected__tab__class); | ||
| oooTabLink.classList.remove(selected__tab__class); | ||
| updateTabLink(currentReqType.toUpperCase()); | ||
|
Comment on lines
-98
to
+110
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have refactored this as it is being handle in updateTabLink function |
||
| changeFilter(); | ||
| updateUrlWithQuery(currentReqType); | ||
| await renderRequestCards({ state: statusValue, sort: sortByValue }); | ||
|
|
@@ -768,7 +778,6 @@ function populateStatus() { | |
| addRadioButton(name, id, 'status-filter'); | ||
| } | ||
| } | ||
|
|
||
| updateTabLink(currentReqType.toUpperCase()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. select the request tab link based on current type for every page reload |
||
| populateStatus(); | ||
|
|
||
| renderRequestCards({ state: statusValue, sort: sortByValue }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the selected__tab has been removed from index.html, has to manually click ooo_tab_link to simulate the behaviour