diff --git a/common/util/constant.go b/common/util/constant.go index fa27f98..edec743 100644 --- a/common/util/constant.go +++ b/common/util/constant.go @@ -20,6 +20,7 @@ const ( SetRCASummary = "set_rca_summary" SetJiraLinks = "set_jira_links" MarkIncidentDuplicate = "mark_incident_duplicate" + ButtonsBlock = "buttons_block" ) type ViewSubmissionType string diff --git a/internal/processor/action/view/incident_section.go b/internal/processor/action/view/incident_section.go index 0354a3f..be6a2b0 100644 --- a/internal/processor/action/view/incident_section.go +++ b/internal/processor/action/view/incident_section.go @@ -26,14 +26,7 @@ func NewIncidentBlock() map[string]interface{} { Text: "Show incidents", }, ), - slack.NewButtonBlockElement( - util.HelpCommand, - "help_commands_button_value", - &slack.TextBlockObject{ - Type: slack.PlainTextType, - Text: "Help-commands", - }, - )), + getHelpCommandsButtonBlockElement()), }, } return payload @@ -55,7 +48,7 @@ func ExistingIncidentOptionsBlock() map[string]interface{} { return map[string]interface{}{ "blocks": []slack.Block{ incidentSectionBlock(), - rcaSectionBlock(), + buttonsBlock(), }, } } @@ -136,15 +129,28 @@ func incidentSectionBlock() *slack.SectionBlock { return slack.NewSectionBlock(textBlock, nil, accessoryOption, slack.SectionBlockOptionBlockID("incident")) } -func rcaSectionBlock() *slack.ActionBlock { - buttonElement := &slack.ButtonBlockElement{ - Type: "button", - ActionID: util.SetRCADetails, - Text: &slack.TextBlockObject{ - Type: "plain_text", +func buttonsBlock() *slack.ActionBlock { + return slack.NewActionBlock(util.ButtonsBlock, getFillRcaButtonBlockElement(), getHelpCommandsButtonBlockElement()) +} + +func getFillRcaButtonBlockElement() *slack.ButtonBlockElement { + return slack.NewButtonBlockElement( + util.SetRCADetails, + util.SetRCADetails, + &slack.TextBlockObject{ + Type: slack.PlainTextType, Text: "Fill RCA details", }, - Value: util.SetRCADetails, - } - return slack.NewActionBlock(util.SetRCADetails, buttonElement) + ) +} + +func getHelpCommandsButtonBlockElement() *slack.ButtonBlockElement { + return slack.NewButtonBlockElement( + util.HelpCommand, + "help_commands_button_value", + &slack.TextBlockObject{ + Type: slack.PlainTextType, + Text: "Help-commands", + }, + ) }