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: implement tests sorting #621

Merged
merged 7 commits into from
Dec 8, 2024
Merged

Conversation

shadowusr
Copy link
Member

@shadowusr shadowusr commented Dec 2, 2024

What's done

  • Implemented flat list view
  • Implemented adaptive selects for better space usage when tree view is compact
  • Implemented sorting of trees and lists of tests

Demo report: https://nda.ya.ru/t/r_tGtS0S7A9u5q

sorting-demo

Copy link
Member

@DudaGod DudaGod left a comment

Choose a reason for hiding this comment

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

🔥

lib/static/modules/actions/sort-tests.ts Show resolved Hide resolved
lib/static/modules/actions/types.ts Show resolved Hide resolved
lib/static/modules/default-state.ts Show resolved Hide resolved
lib/static/modules/reducers/sort-tests.ts Show resolved Hide resolved
lib/static/constants/sort-tests.ts Outdated Show resolved Hide resolved
};

return sortAndGetWeight(treeNodes).sortedTreeNodes;
};
Copy link
Member

Choose a reason for hiding this comment

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

a little bit complicated logic here, but i don't how it makes simpler. Just a lot of cases which should be covered.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, so I once again looked at the code and tried to simplify it. What's came out of this:

  • There is no referring to magic indexes like [0], [1] anymore, I introduced weight metadata instead, which is type-safe and more explicit & readable
  • Got rid of duplicating logic related to adding tags, and the code's become a lot cleaner

The file is still pretty large, but more readable and clear.

const treeNodesCopy = treeNodes.slice(0);
const weights: Record<string, TreeNodeWeight> = {};

treeNodesCopy.forEach((treeNode, index) => {
Copy link
Member

Choose a reason for hiding this comment

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

hard core =)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree! So I decided to fix it. Replied here: #621 (comment)

@shadowusr shadowusr force-pushed the users/shadowusr/TESTPLANE-349 branch from c27ee15 to 117a268 Compare December 8, 2024 21:49
@shadowusr shadowusr merged commit 4a341c3 into master Dec 8, 2024
4 checks passed
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.

2 participants