-
Notifications
You must be signed in to change notification settings - Fork 268
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
Remove the remaining bits of the authenticated middleware #11266
Conversation
d424b68
to
15090eb
Compare
shell/initialize/entry-helpers.js
Outdated
// Call the authenticated middleware. This used to attempt to load the error layout but because it was missing it would: | ||
// 1. load the default layout instead | ||
// 2. then call the authenticated middleware | ||
// 3. Authenticated middleware would then load plugins and check to see if there was a valid route and navigate to that if it existed | ||
// 4. This would allow harvester cluster pages to load on page reload | ||
// We should really make authenticated middleware do less... | ||
await callMiddleware.call(this, [{ options: { middleware: ['authenticated'] } }], app.context); |
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.
This could cause problems with loading harvester cluster pages. I haven't been able to test yet.
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.
I think we should do that, so we do not risk rollback.
@torchiaf is it something we can try?
@@ -151,9 +111,7 @@ export default async function({ | |||
}) | |||
]); | |||
|
|||
if (localCheckResource) { |
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.
This check doesn't appear to be needed any longer.
It looked like it was previously needed because some of the code we only wanted to be executed once while others we wanted on every page with authenticated.
const backTo = window.localStorage.getItem(BACK_TO); | ||
|
||
if (backTo) { | ||
window.localStorage.removeItem(BACK_TO); |
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.
I didn't port backTo over. It's non-functional in master and Neil seems keen to remove it. You can view a thread in team-container-ui where this was discussed.
I added an issue to track the removal of the rest of this feature #11268
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.
Seen the conversation already 👍
UI/UX should be approved by Ken though and not Neil.
As he did not express any opinion, I take it as a tacit agreement.
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.
Thanks for finally implementing routing guards as replacement of the middleware.
I added some side notes.
Trivial question outside of this PR scope: should not the config
folder contain just static configuration?
I don't feel too strongly about this, I've seen a fair amount of config which included executable code. I'd be comfortable moving all of this to the initialize code though. I can understand the desire to keep it static. |
8f07fd4
to
41cb67c
Compare
b3de10c
to
41ffbcd
Compare
I'll wait to merge after we branch for the 2.9 release. |
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.
I think is pretty much fine. There are some comments to clarify some choices and so on.
}, 1); | ||
}); | ||
} | ||
const route = to; |
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.
Why this assignment? Are we trying to clone or what? Also, the name in such cases should have more specificity and a comment with an explanation.
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.
I only wanted to make this easier to diff with the original implementation so it was obvious the logic wasn't being changed. I change change all references.
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.
Updated.
@@ -71,8 +31,12 @@ export default async function({ | |||
const oldPkg = getPackageFromRoute(from); | |||
const oldProduct = getProductFromRoute(from); | |||
|
|||
// TODO: Replace all references to store.$plugin. |
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.
Thanks for clarifying the change in the comment and sorry for asking again, could you please add an issue for this?
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 I'll have to migrate this part, may I ask you where we assign the global $plugin
to the store? Or is it something from Vuex?
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.
Here's the issue: #11386
I've added a reference to where $plugin
is set in the tech debt issue but here's a reference here as well
dashboard/shell/store/index.js
Line 1149 in 5a00bcc
commit('setPlugin', nuxt.app.$plugin); |
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.
I add it to the Nuxt removal bits, since it was listed 😅
#11070
|
||
export async function loadHistory(to, from, next) { | ||
// Clear state used to record if back button was used for navigation | ||
// TODO: Investigate if this can be removed. This is only used on the templates/error.vue page and seems hacky. |
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.
Do we still use the template/error
page?
Because I think it was just on initialization.
Should we maybe open an issue to make an investigation in general on how is handled the 404, so we could merge all to failWhale
instead?
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.
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.
Thank you! 🍺
store.dispatch('gcRouteChanged', to); | ||
|
||
await applyProducts(store, store.$plugin); | ||
setProduct(store, to); |
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.
Sorry for the naive question, would not be better an action in the store for this?
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.
I'm happy to move it if you'd like. Is there a store that you think fits this best?
It seems a bit awkward for our existing stores since it touches the gc stuff, products and plugins.
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.
Let's keep it minimal and think about it in another phase then, e.g. review of the store.
41ffbcd
to
6fdcc73
Compare
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.
LGTM
|
||
export async function loadHistory(to, from, next) { | ||
// Clear state used to record if back button was used for navigation | ||
// TODO: Investigate if this can be removed. This is only used on the templates/error.vue page and seems hacky. |
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.
Thank you! 🍺
store.dispatch('gcRouteChanged', to); | ||
|
||
await applyProducts(store, store.$plugin); | ||
setProduct(store, to); |
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.
Let's keep it minimal and think about it in another phase then, e.g. review of the store.
6fdcc73
to
fdf7018
Compare
Summary
Remove the remaining bits of the authenticated middleware
Technical notes summary
Moving the remaining bits to navigation guards.
Areas which could experience regressions
Harvester clusters, products and cluster loading
Checklist