-
Notifications
You must be signed in to change notification settings - Fork 2k
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
UI: Region Switcher #4572
Merged
Merged
UI: Region Switcher #4572
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ccae1fb
Bare minimum Mirage support for regions
DingoEatingFuzz dc1a031
Add three-way region property (query param, service, localStorage)
DingoEatingFuzz 27308a8
Styles for the region switcher
DingoEatingFuzz 200b3c3
Add the region qp to every api request
DingoEatingFuzz 2e26a61
Reset the system service when unloading the store
DingoEatingFuzz 840069d
Harden up the system service for the event of store unloading
DingoEatingFuzz 8d36ac8
Fetch regions and namespaces in the application route
DingoEatingFuzz 8c3e5b2
Only show the region switcher when there are multiple regions
DingoEatingFuzz 47210b3
Add region switcher to the global header
DingoEatingFuzz 3f26214
Move the region switcher out of the secondary nav and into the gutter…
DingoEatingFuzz 610db7c
Make the dropdown ever so slightly off-white
DingoEatingFuzz 95fcbda
Line breadcrumbs up flush with section content
DingoEatingFuzz d77504c
Never show the menu divider for the first menu item
DingoEatingFuzz 134ab34
Remove the gutter menu from the allocations page
DingoEatingFuzz 7e6f02d
Account for the service:system dependency due to region
DingoEatingFuzz 4715696
Clear up the data flow for namespaces
DingoEatingFuzz a5da73d
Repeat the new namespace pattern for region
DingoEatingFuzz 61bdc3b
Sidestep a transpilation bug.
DingoEatingFuzz 4473bb9
The application route doesn't need to fetch namespaces
DingoEatingFuzz c5439df
Add the region qp to all requests made through the token service
DingoEatingFuzz d690709
Get the server's region (aka default region) from the API
DingoEatingFuzz ae0bf90
Only deal with the region param (in the app and in api calls) when ne…
DingoEatingFuzz fe315fe
Address an issue with certain dependent keys
DingoEatingFuzz 822d998
Handle errors when getting regions or the default regions
DingoEatingFuzz b767a87
Update tests to handle region switching
DingoEatingFuzz 362aff0
Simplify the control flow around changing namespaces and regions
DingoEatingFuzz c55df8f
Specify the request type for token self
DingoEatingFuzz dbc18c9
Properly model regions in Mirage
DingoEatingFuzz ae464a0
Unit test coverage for adding the region param to requests
DingoEatingFuzz 95e8259
Acceptance tests for the region switcher
DingoEatingFuzz 3192267
Use the model hook and setupController hook instead of afterModel
DingoEatingFuzz a61ad7a
List the new region mirage env var in the environment file
DingoEatingFuzz 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 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 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 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
'data-test-global-header': true, | ||
|
||
onHamburgerClick() {}, | ||
}); |
This file contains 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,21 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
system: service(), | ||
router: service(), | ||
store: service(), | ||
|
||
sortedRegions: computed('system.regions', function() { | ||
return this.get('system.regions') | ||
.toArray() | ||
.sort(); | ||
}), | ||
|
||
gotoRegion(region) { | ||
this.get('router').transitionTo('jobs', { | ||
queryParams: { region }, | ||
}); | ||
}, | ||
}); |
This file contains 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 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 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 |
---|---|---|
|
@@ -32,21 +32,17 @@ export default Controller.extend(Sortable, Searchable, { | |
Filtered jobs are those that match the selected namespace and aren't children | ||
of periodic or parameterized jobs. | ||
*/ | ||
filteredJobs: computed( | ||
'model.[]', | ||
'[email protected]', | ||
'system.activeNamespace', | ||
'system.namespaces.length', | ||
function() { | ||
const hasNamespaces = this.get('system.namespaces.length'); | ||
const activeNamespace = this.get('system.activeNamespace.id') || 'default'; | ||
|
||
return this.get('model') | ||
.compact() | ||
.filter(job => !hasNamespaces || job.get('namespace.id') === activeNamespace) | ||
.filter(job => !job.get('parent.content')); | ||
} | ||
), | ||
filteredJobs: computed('model.[]', '[email protected]', function() { | ||
// Namespace related properties are ommitted from the dependent keys | ||
// due to a prop invalidation bug caused by region switching. | ||
const hasNamespaces = this.get('system.namespaces.length'); | ||
const activeNamespace = this.get('system.activeNamespace.id') || 'default'; | ||
|
||
return this.get('model') | ||
.compact() | ||
.filter(job => !hasNamespaces || job.get('namespace.id') === activeNamespace) | ||
.filter(job => !job.get('parent.content')); | ||
}), | ||
|
||
listToSort: alias('filteredJobs'), | ||
listToSearch: alias('listSorted'), | ||
|
This file contains 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 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 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
Oops, something went wrong.
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.
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.
It didn't make it all the way through the branch, but I just wanted to throw out a 👍 for the
afterSetup
route hook approach you originally took to replace this observer: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.
Which one was that? I have already suppressed all memories of this code 😅