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

feat: sort projects in project view #1137

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

peterblazejewicz
Copy link
Contributor

This commit adds sorting applied to projects found in workspace
configuration, before content is returned to the UI. Entries are sorted
using current environment locale settings.

  • implementation
  • tests

Thanks!

Closes #1111

@nx-cloud
Copy link

nx-cloud bot commented Sep 19, 2021

Nx Cloud Report

CI ran the following commands for commit 73718cf. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --all --parallel --target=build
#000000 nx run-many --all --parallel --target=test
#000000 nx run-many --all --parallel --target=lint

Sent with 💌 from NxCloud.

@peterblazejewicz
Copy link
Contributor Author

wait, I'm surprised it's not reflected in panel view. I'll mark this as WIP. Any clue where to look? thx!

@peterblazejewicz peterblazejewicz changed the title feat: sort projects in workspace configuration [WIP] feat: sort projects in workspace configuration Sep 19, 2021
@Cammisuli
Copy link
Member

If you want to sort the projects in the Projects view, then you'll have to manipulate the getChildren function in here:

const projects = this.cliTaskProvider.getProjectEntries();
return projects.map(
([name, def]): NxProjectTreeItem =>
this.createNxProjectTreeItem(
{ project: name },
name,
Boolean(def.targets)
)
);

@peterblazejewicz
Copy link
Contributor Author

@Cammisuli thx! Let me check this.

@peterblazejewicz
Copy link
Contributor Author

This was probably due to staled branch bits or something. I can see it works as expected. Projects are sorted,
when project name is changed in workspace config file, this is instantly reflected in projects panel:
this is the same project renamed couple of times:

image
image
image

@Cammisuli can you please clone this and run, just to confirm.
I'll review outcome of pointed method in provider (via test case), TBC

@Cammisuli
Copy link
Member

oh ya, the original implementation was working 😅 Once you're ready, we can merge this in and release it

This commit adds sorting applied to projects found in workspace
configuration, before content is returned to the UI. Entries are sorted
using current environment locale settings.

This commit contains also changes required to start tests in context of
VSCode environment.

- implementation
- tests

Thanks!

Closes nrwl#1111
@peterblazejewicz
Copy link
Contributor Author

oh ya, the original implementation was working 😅 Once you're ready, we can merge this in and release it

Done, I've hardened the tests mocks for file system checks, they were returning kind of random outcome, now that's correctted.

@peterblazejewicz peterblazejewicz changed the title [WIP] feat: sort projects in workspace configuration feat: sort projects in workspace configuration Sep 24, 2021
Copy link
Member

@Cammisuli Cammisuli left a comment

Choose a reason for hiding this comment

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

Thank you! It's going to be coming out in the next release very soon 😄

@Cammisuli Cammisuli changed the title feat: sort projects in workspace configuration feat: sort projects in project view Sep 24, 2021
@Cammisuli Cammisuli merged commit 7cc9ebe into nrwl:master Sep 24, 2021
@peterblazejewicz peterblazejewicz deleted the feat/1111 branch September 24, 2021 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List Projects in the Projects View in Alphabetical Order.
2 participants