Skip to content
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: Allocation file system explorer: Routing #5866

Merged
merged 4 commits into from
Jun 21, 2019

Conversation

DingoEatingFuzz
Copy link
Contributor

This lays out the foundation for building out the alloc fs explorer. This allows us to work on the explorer component and file view components in parallel.

Copy link
Contributor

@johncowen johncowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! One little suggestion there, but no biggie. Especially appreciate the testing here.

One question I have is that it looks like you are going to have URLs like:

fs/path%2Fto%2Fa%2Ffolder%2Fsomewhere

instead of:

fs/path/to/a/folder/somewhere

...unless I misread that code.

Was that a specific decision to encode the slashes? You can probably forsee my following query if so, i.e. should we be doing it like vault and consul with non-encoded slashes?

John

P.S. Oh also, should I be seeing the PR preview thing that @backspace added here? It might be my rubbish GH skillsz, but I don't see it?

model({ path }) {
return {
path: decodeURIComponent(path),
task: this.modelFor('allocations.allocation.task'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little suggestion, could you just call the task property model? Then you don't need to rename it below?

setupController(controller, model) {
  this._super(...arguments);
  controller.setProperties(model);
}

It's clear from the modelFor argument that it's a task

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t know that this quite reaches convention status, but I’ve referred to this before as a “compound model”. I haven’t seen many conventions around the naming of its components apart from them being named the things that they are. I think it would be somewhat confusing to have the model hook be loading something that contains a path and a model.

I hope some day there’s a more first-class way to do this kind of data loading!

Copy link
Contributor

@johncowen johncowen Jun 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option would be to keep task and not rename it to model in setupController. I think my main point was more not having to rename it than deciding what to call it. I know that some folks prefer having a model in the templates, assumed this was why it was being renamed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I wouldn't have to do model hook shenanigans to pass that param to the controller, but if the param changes without the model changing then the setupController hook doesn't refire.

But I also wouldn't get caught up on this. I expect this route to more or less be entirely rewritten when @backspace works on the file explorer component. Hard to say now what the best way to provide context to the controller is.

Copy link
Contributor

@johncowen johncowen Jun 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet yeah, gotcha, was just a tiny thing I noticed, no biggie.

Copy link
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for setting this up!

});

test('visiting /allocations/:allocation_id/:task_name/fs/:path', async function(assert) {
const paths = ['some-file.log', 'a/deep/path/to/a/file.log', '/', 'Unicode™®'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah I love the Unicode

@@ -0,0 +1,14 @@
{{partial "allocations/allocation/task/subnav"}}
Copy link
Contributor

@backspace backspace Jun 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something for the future, do you have any interest in removing the use of this partial? As it looks like partials will be deprecated. It seems like it could be replaced by a simple component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite lackadaisical when it comes to dealing with deprecations. Of course it makes sense for these to become components eventually, and I won't stand in anyone's way who wants to do that work now. I just tend to wait until I have to 😛

@DingoEatingFuzz
Copy link
Contributor Author

@johncowen,

Regarding the URLs, slashes and whatnot will be supported in the URL. Example screenshot:

image

From the code, you're seeing two things.

  1. Ember passes the glob segment as encoded, so the route decodes it.
  2. Ember CLI Page Object encodes dynamic segments in visitable so when asserting currentURL I followed suit.

image

And, apologies in advance for this sounding like a copout, I wouldn't get too hung up on this either. This PR is just to set us up to work in parallel. Before this code makes it to master I expect to QA a variety of paths to make sure there are no situations normal all zalgo'd up.

@DingoEatingFuzz
Copy link
Contributor Author

P.S. Oh also, should I be seeing the PR preview thing that @backspace added here? It might be my rubbish GH skillsz, but I don't see it?

That's a good question, and one that @backspace is more prepared to answer. My hunch is that it isn't building because this PR isn't against master?

@johncowen
Copy link
Contributor

Cool thanks for the info, I was only because I'd just considered doing the %2F thing in consul and maybe think that would have been the better choice. I did a load of custom stuff in the end, but that could potentially be removed if we were ok with it. Hey and definitely I know it's never ever any copout's, its not fun dealing with things like this stuff so if theres a preference to avoid them some other way thats cool in my book. Sorry if it sounds like I'm asking things a bit early 😬 !

I find myself again longing for the :reverse_bushes: emoji in GH! 😂 I'll probably dip out of these a lot more now you have a good thing going.

@backspace
Copy link
Contributor

That's a good question, and one that @backspace is more prepared to answer. My hunch is that it isn't building because this PR isn't against master?

That’s my theory too, though the Netlify settings don’t indicate any such limitation:

image

Last time I wrote to Netlify support they were very eager to respond, though the answer was unfortunate (no way to restrict deployments based on branch name), so I’ll check in with them on this.

@DingoEatingFuzz
Copy link
Contributor Author

Gonna merge this now. The Netlify thing may strike again on future PRs for this project though if our theory holds true.

@DingoEatingFuzz DingoEatingFuzz merged commit 429e89f into f-ui/alloc-fs Jun 21, 2019
@DingoEatingFuzz DingoEatingFuzz deleted the f-ui/alloc-fs-routing branch June 21, 2019 18:41
@backspace
Copy link
Contributor

Re Netlify, I got a response from support and changed the settings to deploy the base branch and now it’s working:

image

I could change “Branch deploys” to just always deploy for all branches but I feel like manually updating it when we have this kind of long-running branch is fine for now, as I’m still wary of adding more deployment-failure noise to non-UI PRs.

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants