[MM-52271] Add recommended tag to Work Template integrations (#23016)

Этот коммит содержится в:
Julien Tant
2023-04-24 09:59:01 -07:00
коммит произвёл GitHub
родитель bf4555a223
Коммит 94cb2867a7
8 изменённых файлов: 55 добавлений и 18 удалений

Просмотреть файл

@@ -93,6 +93,7 @@ var wt{{.MD5}} = &WorkTemplate{
Illustration: "{{.Playbook.Illustration}}", Illustration: "{{.Playbook.Illustration}}",
},{{end}}{{if .Integration}}Integration: &Integration{ },{{end}}{{if .Integration}}Integration: &Integration{
ID: "{{.Integration.ID}}", ID: "{{.Integration.ID}}",
Recommended: {{.Integration.Recommended}},
},{{end}} },{{end}}
}, },
{{end}} {{end}}

Просмотреть файл

@@ -45,8 +45,10 @@ content:
illustration: "/static/worktemplates/playbooks/product_release.png" illustration: "/static/worktemplates/playbooks/product_release.png"
- integration: - integration:
id: jira id: jira
recommended: true
- integration: - integration:
id: github id: github
recommended: true
--- ---
id: 'product_teams/goals_and_okrs:v1' id: 'product_teams/goals_and_okrs:v1'
category: product_teams category: product_teams
@@ -86,7 +88,7 @@ content:
channel: channel-1674845108569 channel: channel-1674845108569
- integration: - integration:
id: zoom id: zoom
recommended: true
--- ---
id: 'product_teams/bug_bash:v1' id: 'product_teams/bug_bash:v1'
category: product_teams category: product_teams
@@ -120,6 +122,7 @@ content:
playbook: playbook-1674844017943 playbook: playbook-1674844017943
- integration: - integration:
id: jira id: jira
recommended: true
--- ---
id: 'product_teams/sprint_planning:v1' id: 'product_teams/sprint_planning:v1'
category: product_teams category: product_teams
@@ -153,6 +156,7 @@ content:
channel: channel-1674850783500 channel: channel-1674850783500
- integration: - integration:
id: zoom id: zoom
recommended: true
--- ---
id: 'product_teams/product_roadmap:v1' id: 'product_teams/product_roadmap:v1'
category: product_teams category: product_teams
@@ -282,6 +286,7 @@ content:
channel: channel-1674845108569 channel: channel-1674845108569
- integration: - integration:
id: zoom id: zoom
recommended: true
--- ---
id: 'companywide/create_project:v1' id: 'companywide/create_project:v1'
category: companywide category: companywide
@@ -316,10 +321,13 @@ content:
channel: channel-1674851940114 channel: channel-1674851940114
- integration: - integration:
id: jira id: jira
recommended: true
- integration: - integration:
id: github id: github
recommended: true
- integration: - integration:
id: zoom id: zoom
recommended: true
--- ---
###################### ######################
# Leadership # Leadership
@@ -356,4 +364,4 @@ content:
channel: channel-1674845108569 channel: channel-1674845108569
- integration: - integration:
id: zoom id: zoom
recommended: true

Просмотреть файл

@@ -108,7 +108,8 @@ func (wt WorkTemplate) ToModelWorkTemplate(t i18n.TranslateFunc) *model.WorkTemp
if content.Integration != nil { if content.Integration != nil {
mwt.Content = append(mwt.Content, model.WorkTemplateContent{ mwt.Content = append(mwt.Content, model.WorkTemplateContent{
Integration: &model.WorkTemplateIntegration{ Integration: &model.WorkTemplateIntegration{
ID: content.Integration.ID, ID: content.Integration.ID,
Recommended: content.Integration.Recommended,
}, },
}) })
} }
@@ -320,7 +321,8 @@ func (p *Playbook) Validate() error {
} }
type Integration struct { type Integration struct {
ID string `yaml:"id"` ID string `yaml:"id"`
Recommended bool `yaml:"recommended"`
} }
func (i *Integration) Validate() error { func (i *Integration) Validate() error {

Просмотреть файл

@@ -148,12 +148,14 @@ var wt00a1b44a5831c0a3acb14787b3fdd352 = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "jira", ID: "jira",
Recommended: true,
}, },
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "github", ID: "github",
Recommended: true,
}, },
}, },
}, },
@@ -214,7 +216,8 @@ var wt5baa68055bf9ea423273662e01ccc575 = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "zoom", ID: "zoom",
Recommended: true,
}, },
}, },
}, },
@@ -265,7 +268,8 @@ var wtfeb56bc6a8f277c47b503bd1c92d830e = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "jira", ID: "jira",
Recommended: true,
}, },
}, },
}, },
@@ -317,7 +321,8 @@ var wt8d2ef53deac5517eb349dc5de6150196 = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "zoom", ID: "zoom",
Recommended: true,
}, },
}, },
}, },
@@ -518,7 +523,8 @@ var wtf7b846d35810f8272eeb9a1a562025b5 = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "zoom", ID: "zoom",
Recommended: true,
}, },
}, },
}, },
@@ -570,17 +576,20 @@ var wtb9ab412890c2410c7b49eec8f12e7edc = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "jira", ID: "jira",
Recommended: true,
}, },
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "github", ID: "github",
Recommended: true,
}, },
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "zoom", ID: "zoom",
Recommended: true,
}, },
}, },
}, },
@@ -632,7 +641,8 @@ var wt32ab773bfe021e3d4913931041552559 = &WorkTemplate{
}, },
{ {
Integration: &Integration{ Integration: &Integration{
ID: "zoom", ID: "zoom",
Recommended: true,
}, },
}, },
}, },

Просмотреть файл

@@ -69,7 +69,8 @@ type WorkTemplatePlaybook struct {
} }
type WorkTemplateIntegration struct { type WorkTemplateIntegration struct {
ID string `json:"id"` ID string `json:"id"`
Recommended bool `json:"recommended"`
} }
type WorkTemplateContent struct { type WorkTemplateContent struct {

Просмотреть файл

@@ -117,7 +117,7 @@ const Preview = ({template, className, pluginsEnabled}: PreviewProps) => {
if (c.playbook) { if (c.playbook) {
playbooks.push(c.playbook); playbooks.push(c.playbook);
} }
if (c.integration) { if (c.integration && c.integration.recommended) {
availableIntegrations.push(c.integration); availableIntegrations.push(c.integration);
} }
}); });

Просмотреть файл

@@ -232,7 +232,12 @@ const WorkTemplateModal = () => {
const execute = async (template: WorkTemplate, name = '', visibility: Visibility) => { const execute = async (template: WorkTemplate, name = '', visibility: Visibility) => {
const pbTemplates = []; const pbTemplates = [];
for (const item of template.content) { for (const ctt in template.content) {
if (!Object.hasOwn(template.content, ctt)) {
continue;
}
const item = template.content[ctt];
if (item.playbook) { if (item.playbook) {
const pbTemplate = playbookTemplates.find((pb) => pb.title === item.playbook.template); const pbTemplate = playbookTemplates.find((pb) => pb.title === item.playbook.template);
if (pbTemplate) { if (pbTemplate) {
@@ -241,11 +246,20 @@ const WorkTemplateModal = () => {
} }
} }
// remove non recommended integrations
const filteredTemplate = {...template};
filteredTemplate.content = template.content.filter((item) => {
if (!item.integration) {
return true;
}
return item.integration.recommended;
});
const req: ExecuteWorkTemplateRequest = { const req: ExecuteWorkTemplateRequest = {
team_id: teamId, team_id: teamId,
name, name,
visibility, visibility,
work_template: template, work_template: filteredTemplate,
playbook_templates: pbTemplates, playbook_templates: pbTemplates,
}; };

Просмотреть файл

@@ -64,6 +64,7 @@ export interface Playbook {
} }
export interface Integration { export interface Integration {
id: string; id: string;
recommended: boolean;
name?: string; name?: string;
icon?: string; icon?: string;
installed?: boolean; installed?: boolean;