Skip to content

Feat: Added Terminal User Interface (TUI) for Sugar #165

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

Merged
merged 8 commits into from
Mar 28, 2025

Conversation

akshayw1
Copy link
Contributor

Pull Request description

This PR adds a new Terminal User Interface (TUI) for Sugar, providing a visual and interactive way to manage containers directly from the terminal. The design was inspired by k9s for Kubernetes and aims to make Sugar's functionality more accessible through an intuitive interface.

Solves #42

How to test these changes

  • Install the package in development mode: pip install -e .
  • Run the TUI: sugar tui
  • Navigate between screens using keyboard shortcuts shown in the footer
  • Test different screens:
    • Main dashboard (default view)
    • Profile management screen (press p)
    • Services management screen (press s)
    • Logs viewer (press l)
  • Test auto-refresh and following logs in the logs screen
  • Test filtering in the logs screen

I have added screenshots demonstrating UI and functionality.
image
image
image
image

Pull Request checklists

This PR is a:

  • bug-fix
  • new feature
  • maintenance

About this PR:

  • it includes tests.
  • the tests are executed on CI.
  • the tests generate log file(s) (path).
  • pre-commit hooks were executed locally.
  • this PR requires a project documentation update.

Author's checklist:

  • I have reviewed the changes and it contains no misspelling.
  • The code is well commented, especially in the parts that contain more complexity.
  • New and old tests passed locally.

Additional information

Currently, the TUI uses mock data for development and demonstration purposes. Integration with the actual Sugar backend will be implemented in future updates.

The new TUI features include:

  • Dashboard for overview of profiles and services
  • Profile management screen with detailed configuration view
  • Services management with status and control capabilities
  • Real-time log viewer with filtering and auto-refresh functionality
  • Clean dark UI theme with consistent styling across screens

Implement a TUI for Sugar using the Textual library to provide a visual and
interactive way to manage containers. The interface includes:

- Dashboard for overview of profiles and services
- Profile management screen with detailed configuration view
- Services management with status and control capabilities
- Real-time log viewer with filtering and auto-refresh functionality
- Clean dark UI theme with consistent styling across screens

Currently uses mock data for development and demonstration purposes.
Integration with the Sugar backend will be implemented in future updates.

This feature allows users to manage their containers with a more intuitive
interface directly from the terminal, similar to k9s for Kubernetes.
@akshayw1
Copy link
Contributor Author

@xmnlab Please review

@sanjay7178
Copy link
Member

sanjay7178 commented Mar 10, 2025

Hey @akshayw1 , Ivan is planning to make stats.py ( ie .. there is a extra is available under poetry install named tui) to integrate into tui command , might be useful to you , kindly check it

Copy link
Contributor

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

@akshayw1 , thanks for working on that.

I added a few comments here, but I realized that there are a bunch of small issues, so please fix that first and ping me again for a new round of review.

Copy link

This pull request has been marked as stale because it has been
inactive for more than 5 days. Please update this pull request
or it will be automatically closed in 5 days.

@github-actions github-actions bot added the stale label Mar 19, 2025
@github-actions github-actions bot removed the stale label Mar 21, 2025
@akshayw1 akshayw1 requested a review from xmnlab March 21, 2025 06:19
@xmnlab
Copy link
Contributor

xmnlab commented Mar 25, 2025

hi @akshayw1 , thanks for working on that.
the screenshots look very nice. I will review this pr after the CI jobs are completed.

@akshayw1
Copy link
Contributor Author

hi @akshayw1 , thanks for working on that. the screenshots look very nice. I will review this pr after the CI jobs are completed.

Hello @xmnlab only 1 CI job is failing, I will check the issue and address soon

Copy link
Contributor

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

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

hi @akshayw1 ,
in general it looks good to me!

it seems that the linter is failing. other than that it is ready to go.
please ping me on discord when you fix the linting issue.

Thanks!


class SugarTUI(SugarBase):
"""Terminal User Interface extension for Sugar."""

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _load_backend(self) -> None:
"""Load backend and backend parameters"""
pass

Copy link
Contributor

@xmnlab xmnlab 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 working on that @akshayw1

@xmnlab xmnlab merged commit d7a917a into sugar-org:main Mar 28, 2025
9 checks passed
Copy link

github-actions bot commented May 3, 2025

🎉 This PR is included in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants