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(Network): add description field #848

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Nonnyjoe
Copy link

@Nonnyjoe Nonnyjoe commented Mar 9, 2024

Closes #836

Description

Adds a description field to each network. On network creation users get to input the name and description of the network they intend to create, then while displaying a users network each card has a description component that displays the description of each network.

Screenshots

Screenshot 2024-03-06 at 00 27 08

Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

Thanks for adding this new feature. I appreciate the contribution. I have some initial feedback.

I noticed that there is no way to modify a description after you initially create the network. I would think that this is something that users would want to do. I think a good place to do this is in the form displayed when you rename the node name. Add a field for the description here.
image

@@ -181,12 +181,14 @@ export const testRepoState: DockerRepoState = {
export const getNetwork = (
networkId = 1,
name?: string,
description?: string,
Copy link
Owner

Choose a reason for hiding this comment

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

I would suggest moving this to be the last parameter of this method so that you do not have to update all of the calls to this method in the many tests.

Another approach is to just remove this parameter here and only set the description in the tests that need to update it. Ex:

const network = getNetwork(1, 'test network', Status.Started, 2);
network.description = 'my description';

Comment on lines +42 to +45
<Row>
<Styled.title>{`Description`}</Styled.title>
<Styled.description>{network.description}</Styled.description>
</Row>
Copy link
Owner

Choose a reason for hiding this comment

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

It doesn't look good for networks without a description set. I also don't like the height of the card varying based on how long the description is. I would suggest using an "info" icon with a tooltip next to the name, and only display it if a description is defined.
image

@@ -18,6 +18,7 @@ import { PolarPlatform } from 'utils/system';
export interface Network {
id: number;
name: string;
description: string;
Copy link
Owner

Choose a reason for hiding this comment

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

For users with existing networks, this value will be undefined when Polar starts and loads the data from networks.json. We do not want there to ever be a mismatch between the types and the actual runtime values. This can cause some pretty hard to find bugs.

I would suggest checking if this description is undefined at startup. If so, it should be set to an empty string so that the type is always correct.

@@ -172,6 +172,7 @@ const NetworkView: React.FC<RouteComponentProps<MatchParams>> = ({ match }) => {
<Styled.PageHeader
colors={theme.pageHeader}
title={network.name}
description={'network.description'}
Copy link
Owner

Choose a reason for hiding this comment

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

This is causing a Typescript error because there is no description prop on the PageHeader component.

@jamaljsr
Copy link
Owner

Hey @Nonnyjoe do you plan on continuing to work on this PR?

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.

Feature Request: add a description field for each network
2 participants