[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 удалений

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

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

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

@@ -232,7 +232,12 @@ const WorkTemplateModal = () => {
const execute = async (template: WorkTemplate, name = '', visibility: Visibility) => {
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) {
const pbTemplate = playbookTemplates.find((pb) => pb.title === item.playbook.template);
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 = {
team_id: teamId,
name,
visibility,
work_template: template,
work_template: filteredTemplate,
playbook_templates: pbTemplates,
};

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

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