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

Improve Templates for Slack, GChat, and MSTeams #17771

Merged
merged 63 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
a251a49
Add default ChangeEvent template and Slack destination test template
Siddhanttimeline Sep 9, 2024
8301538
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 9, 2024
b8fb8a3
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 11, 2024
61b4fb1
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 16, 2024
2a4383d
fix conflict
Siddhanttimeline Sep 16, 2024
ccb259e
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 16, 2024
a78f1a8
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 18, 2024
369cc2d
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 18, 2024
5f852cb
initial ingestionPipeline template
Siddhanttimeline Sep 18, 2024
cb9b500
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 18, 2024
df504aa
clean templates.
Siddhanttimeline Sep 18, 2024
7711eba
clean templates
Siddhanttimeline Sep 19, 2024
9930c60
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 19, 2024
f78ce43
Merge remote-tracking branch 'origin/improvements-slack-alert-templat…
Siddhanttimeline Sep 19, 2024
ea8542c
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 20, 2024
da0ffcd
Merge remote-tracking branch 'origin/improvements-slack-alert-templat…
Siddhanttimeline Sep 20, 2024
bd5d5c2
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 23, 2024
0395e0e
Merge remote-tracking branch 'origin/improvements-slack-alert-templat…
Siddhanttimeline Sep 23, 2024
ee2ff18
teams templates.
Siddhanttimeline Sep 25, 2024
d8b381a
add getBoldWithSpace()
Siddhanttimeline Sep 25, 2024
6121a10
java check style
Siddhanttimeline Sep 25, 2024
b84ce60
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 25, 2024
8ac5c04
google chat templates.
Siddhanttimeline Sep 25, 2024
43a6c97
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 27, 2024
b244736
Refactor GChat and Teams message for template data handling for DQ_Te…
Siddhanttimeline Sep 30, 2024
6ef681c
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Sep 30, 2024
ed3377f
Refactor slack message for template data handling for DQ_Template_Sec…
Siddhanttimeline Sep 30, 2024
06a6a5c
improvements gChatMessageDecorator
Siddhanttimeline Oct 1, 2024
becb50c
improvements slackMessageDecorator
Siddhanttimeline Oct 1, 2024
c764923
improve MSTeamsMessageDecorator
Siddhanttimeline Oct 1, 2024
00abc88
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 2, 2024
d79683c
Merge remote-tracking branch 'origin/improvements-slack-alert-templat…
Siddhanttimeline Oct 2, 2024
1c33b7a
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 3, 2024
7f88762
Merge remote-tracking branch 'origin/improvements-slack-alert-templat…
Siddhanttimeline Oct 3, 2024
bdcf09a
Call templates per entityType and refactor code
Siddhanttimeline Oct 3, 2024
77b2f80
Update EmailPublisher to use testEmail template instead of changeEven…
Siddhanttimeline Oct 3, 2024
8536a36
add parameterValues sections for teams
Siddhanttimeline Oct 3, 2024
62c3afb
Update SlackMessage to have attachments.
Siddhanttimeline Oct 4, 2024
00a8d5c
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 4, 2024
68833de
Update dq templates, build dq template data in MessageDecorator
Siddhanttimeline Oct 7, 2024
65e65ad
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 7, 2024
2b6e6f7
remove IngestionPipeline template
Siddhanttimeline Oct 7, 2024
e0b0cab
move SlackCallbackResource into a separate class. Fix tests.
Siddhanttimeline Oct 8, 2024
4068045
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 8, 2024
1e42103
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 14, 2024
52ed843
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 24, 2024
a61d0b8
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 25, 2024
6100abd
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 27, 2024
3ddd30b
simulate timeout and 300.
Siddhanttimeline Oct 28, 2024
7d87554
remove the validation of messages.
Siddhanttimeline Oct 28, 2024
f4c9775
fix teams MessageDecorator
Siddhanttimeline Oct 28, 2024
645b465
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 28, 2024
f143b25
remove unused code from SlackMessageDecorator
Siddhanttimeline Oct 28, 2024
cb39dd4
fix owners and tags data population in the template
Siddhanttimeline Oct 29, 2024
b94e9ac
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 29, 2024
929fdb6
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 30, 2024
98b1d5a
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Oct 31, 2024
cfc62ea
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Nov 2, 2024
b13607c
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Nov 4, 2024
295f434
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Nov 5, 2024
cdd5a57
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Nov 9, 2024
dd94c58
Merge branch 'main' into improvements-slack-alert-templates
Siddhanttimeline Nov 10, 2024
688e291
fix: changes in test case and test case result should load different …
Siddhanttimeline Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ public void sendMessage(ChangeEvent event) throws EventPublisherException {
public void sendTestMessage() throws EventPublisherException {
try {
Set<String> receivers = emailAlertConfig.getReceivers();
EmailMessage emailMessage =
emailDecorator.buildOutgoingTestMessage(eventSubscription.getFullyQualifiedName());
EmailUtil.testConnection();

for (String email : receivers) {
EmailUtil.sendChangeEventMail(
eventSubscription.getFullyQualifiedName(), email, emailMessage);
EmailUtil.sendTestEmail(email, false);
}
setSuccessStatus(System.currentTimeMillis());
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,75 @@
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class GChatMessage {

@Getter @Setter private String text;
@Getter @Setter private List<CardsV2> cardsV2;

public static class CardsV2 {
@Getter @Setter private String cardId;
@Getter @Setter private Card card;
}
private List<GChatMessage.Card> cards;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Card {

@Getter @Setter private CardHeader header;
@Getter @Setter private List<Section> sections;
private GChatMessage.Header header;
private List<GChatMessage.Section> sections;
}

public static class CardHeader {
@Getter @Setter private String title;
@Getter @Setter private String subtitle;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Header {
private String title;
private String imageUrl;
private String imageStyle;
}

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Section {
@Getter @Setter private List<Widget> widgets;
private List<GChatMessage.Widget> widgets;
}

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Widget {
@Getter @Setter private TextParagraph textParagraph;
private GChatMessage.KeyValue keyValue;
private GChatMessage.TextParagraph textParagraph;

public Widget(GChatMessage.KeyValue keyValue) {
this.keyValue = keyValue;
}

public Widget(GChatMessage.TextParagraph textParagraph) {
this.textParagraph = textParagraph;
}
}

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class KeyValue {
private String topLabel;
private String content;
}

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class TextParagraph {
@Getter @Setter private String text;
private String text;
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,156 @@
package org.openmetadata.service.apps.bundles.changeEvent.msteams;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@JsonIgnoreProperties(ignoreUnknown = true)
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TeamsMessage {
@JsonProperty("type")
private String type;

@JsonProperty("attachments")
private List<TeamsMessage.Attachment> attachments;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class Attachment {
@JsonProperty("contentType")
private String contentType;

@JsonProperty("content")
private TeamsMessage.AdaptiveCardContent content;
}

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class AdaptiveCardContent {
@JsonProperty("type")
private String type;

@JsonProperty("version")
private String version;

@JsonProperty("body")
private List<TeamsMessage.BodyItem> body;
}

@Getter
@Setter
public static class Section {
@JsonProperty("activityTitle")
public String activityTitle;
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class ColumnSet implements TeamsMessage.BodyItem {
@JsonProperty("type")
private String type;

@JsonProperty("activityText")
public String activityText;
@JsonProperty("columns")
private List<TeamsMessage.Column> columns;
}

@JsonProperty("@type")
public String type = "MessageCard";
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class Column {
@JsonProperty("type")
private String type;

@JsonProperty("items")
private List<TeamsMessage.BodyItem> items;

@JsonProperty("@context")
public String context = "http://schema.org/extensions";
@JsonProperty("width")
private String width;
}

@JsonProperty("summary")
public String summary;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class Image implements TeamsMessage.BodyItem {
@JsonProperty("type")
private String type;

@JsonProperty("url")
private String url;

@JsonProperty("size")
private String size;
}

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class TextBlock implements TeamsMessage.BodyItem {
@JsonProperty("type")
private String type;

@JsonProperty("text")
private String text;

@JsonProperty("size")
private String size;

@JsonProperty("weight")
private String weight;

@JsonProperty("wrap")
private boolean wrap;

@JsonProperty("horizontalAlignment")
private String horizontalAlignment;

@JsonProperty("spacing")
private String spacing;

@JsonProperty("separator")
private boolean separator;
}

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class FactSet implements TeamsMessage.BodyItem {
@JsonProperty("type")
private String type;

@JsonProperty("facts")
private List<TeamsMessage.Fact> facts;
}

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class Fact {
@JsonProperty("title")
private String title;

@JsonProperty("value")
private String value;
}

@JsonProperty("sections")
public List<Section> sections;
// Interface for Body Items
public interface BodyItem {}
}
Original file line number Diff line number Diff line change
@@ -1,63 +1,54 @@
package org.openmetadata.service.apps.bundles.changeEvent.slack;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.slack.api.model.block.LayoutBlock;
import java.util.List;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SlackAttachment {
@Getter @Setter private String fallback;
@Getter @Setter private String color;
@Getter @Setter private String pretext;
private String fallback;
private String color;
private String pretext;

@JsonProperty("author_name")
@Getter
@Setter
private String authorName;

@JsonProperty("author_link")
@Getter
@Setter
private String authorLink;

@JsonProperty("author_icon")
@Getter
@Setter
private String authorIcon;

@Getter @Setter private String title;
private String title;

@JsonProperty("title_link")
@Getter
@Setter
private String titleLink;

@Getter @Setter private String text;
@Getter @Setter private Field[] fields;
private String text;
private Field[] fields;

@JsonProperty("image_url")
@Getter
@Setter
private String imageUrl;

@JsonProperty("thumb_url")
@Getter
@Setter
private String thumbUrl;

@Getter @Setter private String footer;
private String footer;

@JsonProperty("footer_icon")
@Getter
@Setter
private String footerIcon;

@Getter @Setter private String ts;
private String ts;

@JsonProperty("mrkdwn_in")
@Getter
@Setter
private List<String> markdownIn;

private List<LayoutBlock> blocks;
}
Loading
Loading