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

Add " Interface IP" display capability + More modern CSS style #25

Merged
merged 27 commits into from
Aug 11, 2024

Conversation

benjisho
Copy link
Contributor

@benjisho benjisho commented Jun 12, 2024

Summary

This pull request enhances the tcgui project by adding the capability to display the IP addresses of each interface and updating the CSS to a more modern style.

Changes

  1. Interface IP Display:

    • Modified the Flask application to fetch and display IP addresses alongside interface names.
    • Updated the HTML templates to incorporate IP addresses next to interface names in all relevant sections.
  2. CSS Update:

    • Updated the CSS to improve the visual style, making it more modern and user-friendly.

Benefits

  • Enhanced Usability: Users can now easily see the IP addresses of each network interface directly in the web UI, improving the usability and convenience of the tool.
  • Modern Look: The updated CSS provides a cleaner and more modern look, enhancing the overall user experience.

Screenshots

Before:

tcgui before

After:

tcgui-after

Testing

  • Verified that the IP addresses are correctly fetched and displayed for each interface.
  • Confirmed that the updated CSS renders correctly across various browsers.

benjisho added 4 commits June 12, 2024 18:09
- Improved the overall layout and styling of the interface table.
- Added a cleaner and modern design using CSS.
- Ensured all interfaces are displayed and properly aligned.
- Added hover effects for buttons to enhance interactivity.
- Updated the color scheme for better readability and aesthetics.
- Maintained functionality while improving visual appeal.
Copy link
Collaborator

@hofbi hofbi 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 your contributions, I really like the new style of the app!

main.py Outdated Show resolved Hide resolved
main.py Outdated Show resolved Hide resolved
main.py Outdated Show resolved Hide resolved
static/pure-min.css Outdated Show resolved Hide resolved
@TheLoneDev
Copy link

Oh wow, I use TC and I really like the new design

@benjisho
Copy link
Contributor Author

Changes were applied, let me know what you think :)

Copy link
Collaborator

@hofbi hofbi left a comment

Choose a reason for hiding this comment

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

Last small comment, then we are ready to merge.

main.py Outdated Show resolved Hide resolved
Display of IP addresses started causing issues after last edit, had to rollback to my initial contribution so UI will display IP correctly
@hofbi
Copy link
Collaborator

hofbi commented Jul 3, 2024

@benjisho regarding the last rollback, could you please try subprocess.run? see https://stackoverflow.com/a/39187984 as a reference. It looks like we mainly care about running the command and getting the output back.

benjisho added 2 commits July 12, 2024 13:16
use subprocess.run instead of subprocess.Popen for
retrieving IP
@benjisho
Copy link
Contributor Author

I have replaced subprocess.Popen with subprocess.run for retrieving IP addresses and also decided to add a bit error handling to it, please let me know what you think

@hofbi
Copy link
Collaborator

hofbi commented Jul 12, 2024

Looks good to me. Almost ready to merge. Let's just replace the old image with the new one. No need to keep the old image.

@benjisho benjisho closed this Jul 19, 2024
@benjisho benjisho deleted the patch-1 branch July 19, 2024 20:41
@benjisho benjisho restored the patch-1 branch July 19, 2024 22:11
@benjisho benjisho reopened this Jul 19, 2024
@benjisho
Copy link
Contributor Author

seems that CI is now failing because isort packege

@hofbi
Copy link
Collaborator

hofbi commented Jul 19, 2024

I can take a look on Monday.

If you want to take some action, you could create a separate PR where you do a pre-commit autoupdate and then pre-commit run -a and commit these changes. If you encounter some failures it might be because Python 3.8 is no longer supported by the most recent hooks. So we might have to update to Python 3.10.

.pre-commit-config.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

@hofbi hofbi left a comment

Choose a reason for hiding this comment

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

Last small comment before we can merge

main.py Outdated
Comment on lines 189 to 195
result = subprocess.run(
["ip", "-o", "-4", "addr", "show"],
capture_output=True,
text=True,
check=True,
)
output = result.stdout
Copy link
Collaborator

Choose a reason for hiding this comment

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

These lines are duplicated from above, can we make it a seperate one and reuse in both places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added new run_ip_command function to handle this

@benjisho
Copy link
Contributor Author

@hofbi Seems tha CI is failing due to pre-commit update of package pyupgrade
The new version of pyupgrade is requiring the user to use python version 3.9 or above, while ci.yml is using python 3.8.

Can we ignore the issue? or shall we change the ci.yml to use python 3.9 or above?

@hofbi
Copy link
Collaborator

hofbi commented Aug 10, 2024

To finally get this PR merged, I suggest we downgrade pyupgrade to 3.16 which is the last version supporting python 3.8

Upgrading the entire thing would be a follow up PR. Here we could add support for Ubuntu 22.04 by switching to Python 3.10.

@hofbi hofbi merged commit e996853 into tum-lkn:master Aug 11, 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.

3 participants