30 lines
861 B
Go
30 lines
861 B
Go
package houston
|
|
|
|
import (
|
|
"houston/entity"
|
|
|
|
"github.com/slack-go/slack"
|
|
)
|
|
|
|
func GenerateModalForShowIncidentsButtonSection(incident []entity.IncidentSeverityTeamJoinEntity) []slack.Block {
|
|
contextBlock := slack.NewContextBlock("", slack.NewTextBlockObject("mrkdwn", ":eye: Only visible to you", false, false))
|
|
|
|
sectionBlocks := []*slack.SectionBlock{}
|
|
for i := 0; i < len(incident); i++ {
|
|
fields := []*slack.TextBlockObject{
|
|
slack.NewTextBlockObject("mrkdwn", "\n`"+incident[i].SeverityName+"` `"+incident[i].TeamsName+" Incident` \n "+incident[i].Title+"\n <#"+incident[i].SlackChannel+">", false, false),
|
|
}
|
|
sectionBlocks = append(sectionBlocks, slack.NewSectionBlock(nil, fields, nil))
|
|
}
|
|
|
|
blocks := []slack.Block{
|
|
contextBlock,
|
|
}
|
|
for i := 0; i < len(sectionBlocks); i++ {
|
|
blocks = append(blocks, sectionBlocks[i])
|
|
}
|
|
|
|
return blocks
|
|
|
|
}
|