-
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: Add allocation directory rendering #5873
Conversation
I changed the base branch to ETA the Netlify deploy won’t work to check out this work because there’s no Mirage response for it yet. |
This doesn’t work in every instance; sometimes when I refresh there’s a failure. I’ll have to tune the models created to eliminate these occasional problems.
This will surely break under some circumstances; refinement to come.
const statusIs500 = response.status === 500; | ||
const bodyIncludes404Text = body.includes('no such file or directory'); | ||
|
||
const translatedCode = statusIs500 && bodyIncludes404Text ? 404 : response.status; |
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 awaiting feedback on whether 500-as-404 works similarly across platforms, so this may not be quite ready, but everything else is apart from the custom Mirage scenario that I can remove 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.
I changed this to a TODO
as I think it’s fine to leave in for now and return to if the API changes.
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 is gonna be awesome!! 🤩
Generally speaking, this is great work. I had a lot of nits, but all the big stuff is good and in place.
Also apologies for being such a stickler when it comes to CSS, but that's the only way to keep that stuff under control, you know?
import FSRoute from './fs'; | ||
|
||
export default FSRoute.extend({ | ||
templateName: 'allocations/allocation/task/fs', |
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 personally trips me up when there is a route that has no template due to something like this, but I'm willing to try it out.
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.
yeah, I don’t love it either 😐
return { | ||
path: decodedPath, | ||
task, | ||
isFile: true, |
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 you think it's worth adding a directoryEntries: []
here just to ensure that the controller prop is always an array?
I'm on the fence about it.
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.
hmm… I don’t really even like this giant-conditional-in-the-template situation but I feel like isFile
adequately protects against any attempt to iterate through directoryEntries
. I’d be fine adding it though if you think it’s helpful!
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.
Nah, no need.
|
||
assert.equal(FS.breadcrumbs.length, 1); | ||
assert.ok(FS.breadcrumbs[0].isActive); | ||
assert.equal(FS.breadcrumbs[0].text, 'task-name'); |
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.
A pretty clear downside to the data-in-the-mirage-handler approach is that you can't reach into the mirage db to get the task-name
value out.
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.
agreed. Hard-coding irks me somewhat but feels okay to me for this minimal case. It’s still possible to convert to a more ORMy setup if you think that’s important though!
I appreciate the nits, especially with CSS, which definitely needs a firm hand 😆 I think I’ve addressed your suggestions etc. |
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.
Looks good!
I'm still not sure how I feel about the fixtures for the fs endpoints, but no need to delay on that. Maybe I'll have stronger feelings after I write my own fs tests.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
You can try it out with this direct link to the deployment preview.