TP-51020 | Added help commands button in incident channel section (#323)

* TP-38709 | Merging the changes to master on the logfix

* TP-51020 | Added help commands button in incident channel which displays the list of supported commands
This commit is contained in:
Ajay Devarakonda
2023-12-14 14:39:52 +05:30
committed by GitHub
parent 0f46d506e3
commit 51e249cef6
2 changed files with 25 additions and 18 deletions

View File

@@ -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",
},
)
}