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

Sort the nodes table #987

Open
wants to merge 5 commits into
base: staging
Choose a base branch
from
Open

Conversation

shortthefomo
Copy link
Contributor

@shortthefomo shortthefomo commented May 25, 2024

Add sorting to the nodes table.

Context of Change

Much needed ability to sort the tables of nodes via the headers.

Screenshot 2024-06-25 at 3 13 58 PM Screenshot 2024-06-25 at 3 13 52 PM

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Translation Updates
  • Release

{node.io_latency_ms && node.io_latency_ms > 1}
</td>
</tr>
)

const compareSemanticVersions = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add tests for this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tests have now been added that cover the compareSemanticVersions, via sorting the Version column.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to see this function tested separately and cover all cases. similar to this:

it('isEarlierVersion compare versions correctly', () => {
expect(isEarlierVersion('1.6.2', 'N/A')).toEqual(false)
expect(isEarlierVersion('N/A', '0.9.4')).toEqual(true)
expect(isEarlierVersion('N/A', 'N/A')).toEqual(false)
expect(isEarlierVersion('1.9.4', '1.9.4')).toEqual(false)
expect(isEarlierVersion('0.9.2', '1.8.4')).toEqual(true)
expect(isEarlierVersion('1.8.2', '1.9.4')).toEqual(true)
expect(isEarlierVersion('1.9.2', '1.9.4')).toEqual(true)
expect(isEarlierVersion('1.9.2', '1.9.2-b1')).toEqual(false)
expect(isEarlierVersion('1.9.2', '1.9.2-rc2')).toEqual(false)
expect(isEarlierVersion('1.9.4-b2', '1.9.4-rc1')).toEqual(true)
expect(isEarlierVersion('1.9.4-b1', '1.9.4-b2')).toEqual(true)
expect(isEarlierVersion('1.9.4-rc1', '1.9.4-rc2')).toEqual(true)
expect(isEarlierVersion('1.6.2', '0.9.4')).toEqual(false)
expect(isEarlierVersion('1.9.4', '1.8.6')).toEqual(false)
expect(isEarlierVersion('1.9.4', '1.9.2-rc5')).toEqual(false)
expect(isEarlierVersion('1.8.0-rc1', '1.8.0')).toEqual(true)
expect(isEarlierVersion('1.9.4-rc1', '1.9.4-b3')).toEqual(false)
expect(isEarlierVersion('1.9.4-b2', '1.9.4-b1')).toEqual(false)
expect(isEarlierVersion('1.9.4-rc2', '1.9.4-rc1')).toEqual(false)
})

@pdp2121
Copy link
Collaborator

pdp2121 commented Jun 20, 2024

Also, could you add an image to the description showing how the arrow would look like? Thanks!

@shortthefomo
Copy link
Contributor Author

Also, could you add an image to the description showing how the arrow would look like? Thanks!

screen shots added

{t('node_pubkey')}
</a>
</th>
<th className={getClassNamesFor('ip', 'ip')}>
Copy link
Collaborator

@pdp2121 pdp2121 Aug 23, 2024

Choose a reason for hiding this comment

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

Maybe can create a reusable component like NodeTableHeader and just call <NodeTableHeader title='ip'> for instance

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