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

TextBlock used for text in msteamsv2 receiver must have wrap: true to display the content correctly #4088

Open
Lddeiva opened this issue Oct 29, 2024 · 4 comments

Comments

@Lddeiva
Copy link

Lddeiva commented Oct 29, 2024

TextBlock used for title in msteamsv2 receiver needs wrap: true to display the content correctly.

{
	Type:   "TextBlock",
	Text:   title,
	Weight: "Bolder",
	Size:   "Medium",
	Wrap:   true,
	Style:  "heading",
	Color:  color,
},
{
	Type: "TextBlock",
	Text: text,
},

Note: - The TextBlock used for title is using wrap: true already.

When there is a lengthy line, the title is displayed correctly but the text is not. So, please add wrap: true in text as well.

{
	Type:   "TextBlock",
	Text:   title,
	Weight: "Bolder",
	Size:   "Medium",
	Wrap:   true,
	Style:  "heading",
	Color:  color,
},
{
	Type: "TextBlock",
	Text: text,
	Wrap: true,
},
@grobinson-grafana
Copy link
Contributor

Hi! 👋 Do you think you could open a PR with the fix (and some screenshots to show broken/fixed behavior)?

@Lddeiva
Copy link
Author

Lddeiva commented Oct 29, 2024

Hi! 👋 Do you think you could open a PR with the fix (and some screenshots to show broken/fixed behavior)?

#4088 (comment)

I couldn't paste any screenshots but I built the alertmanager locally (with wrap: true) and tested the Microsoft Teams messages.

The existing code without wrap when used will display messages like this. The lines which are lengthy will be shown like this.

Status: firing
Severity: warning
Description: Job ns-prod-app1/metric-exporter-2882016...
Instance: 10.79.0.233:8080

The new code (with wrap: true) wraps the text and shows the lines within the viewable area.

Status: firing
Severity: warning
Description: Job ns-prod-app1/metric-exporter-2882016
has failed to complete
Instance: 10.79.0.233:8080

Note: - This might be due to the AdaptiveCard format in which not entire screen area is used to display the message (we might need to use ColumnSet with Width but that requires additional changes and testing). As you can see in the screenshot below, only half of the viewable area is used to display the card.
image

The fix is something like this. I'll submit an MR by referring this issue.

{
	Type:   "TextBlock",
	Text:   title,
	Weight: "Bolder",
	Size:   "Medium",
	Wrap:   true,
	Style:  "heading",
	Color:  color,
},
{
	Type: "TextBlock",
	Text: text,
	Wrap: true,    # this line is introduced to fix the issue
},

@grobinson-grafana
Copy link
Contributor

Hi! 👋 Thanks for this. Are you still planning to open a PR with the fix?

Lddeiva added a commit to Lddeiva/alertmanager that referenced this issue Nov 4, 2024
`TextBlock` used for `text` in msteamsv2 receiver must have `wrap: true` to display the content correctly prometheus#4088

Signed-off-by: Deivasigamani Duraisamy <[email protected]>
@Lddeiva
Copy link
Author

Lddeiva commented Nov 4, 2024

Hi! 👋 Thanks for this. Are you still planning to open a PR with the fix?

@grobinson-grafana , I have submitted the PR now.

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

No branches or pull requests

2 participants