Skip to content

Add message components #3393

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

Open
wants to merge 25 commits into
base: 3022-foundry-ui
Choose a base branch
from

Conversation

franciszekjob
Copy link
Contributor

@franciszekjob franciszekjob commented May 22, 2025

Towards #3022

Stack:

Introduced changes

Add TypedMessage and LabeledMessage components to foundry-ui

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

This was referenced May 22, 2025
@franciszekjob franciszekjob marked this pull request as ready for review May 23, 2025 00:00
@franciszekjob franciszekjob requested a review from a team as a code owner May 23, 2025 00:00
@franciszekjob franciszekjob requested review from cptartur, kkawula and ksew1 and removed request for a team May 23, 2025 00:00
@franciszekjob franciszekjob requested a review from cptartur May 25, 2025 17:16
@franciszekjob franciszekjob mentioned this pull request May 26, 2025
5 tasks
@franciszekjob franciszekjob requested a review from kkawula May 27, 2025 10:12
Copy link
Member

@ksew1 ksew1 left a comment

Choose a reason for hiding this comment

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

@@ -64,4 +66,14 @@ impl UI {
OutputFormat::Json => eprintln!("{}", message.json()),
}
}

/// Print a warning message to stdout using the configured output format.
pub fn print_warning(&self, text: &str) {
Copy link
Member

Choose a reason for hiding this comment

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

This is inconsistent with signature print

    pub fn print<T>(&self, message: &T)
    where
        T: Message + serde::Serialize,

#[derive(Serialize)]
pub struct TaggedMessage<'a> {
tag: &'a str,
text: &'a str,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be &T where T: Message?

Copy link
Member

Choose a reason for hiding this comment

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

So we can allow creating Labeled/Tagged message from normal Message? Probably makes sense.

#[derive(Serialize)]
pub struct TaggedMessage<'a> {
tag: &'a str,
text: &'a str,
Copy link
Member

Choose a reason for hiding this comment

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

So we can allow creating Labeled/Tagged message from normal Message? Probably makes sense.

}
}

impl Message for TaggedMessage<'_> {
Copy link
Member

Choose a reason for hiding this comment

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

I know that for json we don't want to have any coloring but what about formatting? We are loosing any information about tag/label there.

Maybe it's not important to implement right away, but it could make sense to have some field in the json about the tag/label.

cc @kkawula @ksew1

Copy link
Member

Choose a reason for hiding this comment

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

Please rename the file

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.

4 participants