[MM-52926] Deprecating work templates (#23466)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Julien Tant
2023-06-05 18:42:03 -07:00
коммит произвёл GitHub
родитель 22275fa0f5
Коммит 0468e772a9
184 изменённых файлов: 4 добавлений и 10688 удалений

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

@@ -140,8 +140,6 @@ import {CompleteOnboardingRequest} from '@mattermost/types/setup';
import {UserThreadList, UserThread, UserThreadWithPost} from '@mattermost/types/threads';
import {LeastActiveChannelsResponse, TopChannelResponse, TopReactionResponse, TopThreadResponse, TopDMsResponse} from '@mattermost/types/insights';
import {Category, ExecuteWorkTemplateRequest, ExecuteWorkTemplateResponse, WorkTemplate} from '@mattermost/types/work_templates';
import {cleanUrlForLogging} from './errors';
import {buildQueryString} from './helpers';
import {TelemetryHandler} from './telemetry';
@@ -341,31 +339,6 @@ export default class Client4 {
return `${this.getBaseRoute()}/commands`;
}
getBaseWorkTemplate() {
return `${this.getBaseRoute()}/worktemplates`;
}
getWorkTemplateCategories = () => {
return this.doFetch<Category[]>(
`${this.getBaseWorkTemplate()}/categories`,
{method: 'get'},
);
}
getWorkTemplates = (categoryId: string) => {
return this.doFetch<WorkTemplate[]>(
`${this.getBaseWorkTemplate()}/categories/${categoryId}/templates`,
{method: 'get'},
);
}
executeWorkTemplate = (req: ExecuteWorkTemplateRequest) => {
return this.doFetch<ExecuteWorkTemplateResponse>(
`${this.getBaseWorkTemplate()}/execute`,
{method: 'post', body: JSON.stringify(req)},
);
}
getFilesRoute() {
return `${this.getBaseRoute()}/files`;
}

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

@@ -3,6 +3,5 @@
export type CompleteOnboardingRequest = {
organization: string;
role?: string;
install_plugins: string[];
}

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

@@ -31,7 +31,6 @@ import {UsersState} from './users';
import {AppsState} from './apps';
import {InsightsState} from './insights';
import {GifsState} from './gifs';
import {WorkTemplatesState} from './work_templates';
export type GlobalState = {
entities: {
@@ -71,7 +70,6 @@ export type GlobalState = {
hostedCustomer: HostedCustomerState;
usage: CloudUsage;
insights: InsightsState;
worktemplates: WorkTemplatesState;
};
errors: any[];
requests: {

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

@@ -1,100 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {RequireOnlyOne} from './utilities';
export type WorkTemplatesState = {
categories: Category[];
templatesInCategory: Record<string, WorkTemplate[]>;
playbookTemplates: PlaybookTemplateType[];
linkedProducts: Record<string, string | number>;
}
export interface PlaybookTemplateType {
title: string;
template: any;
}
export interface ExecuteWorkTemplateRequest {
team_id: string;
name: string;
visibility: Visibility;
work_template: WorkTemplate;
playbook_templates?: PlaybookTemplateType[];
}
export interface ExecuteWorkTemplateResponse {
channel_with_playbook_ids: string[];
channel_ids: string[];
}
export interface WorkTemplate {
id: string;
category: string;
useCase: string;
description: Description;
illustration: string;
visibility: Visibility;
content: ValidContent[];
}
export const categories = ['product', 'devops', 'company_wide', 'leadership', 'design'];
export interface Category {
id: typeof categories[number];
name: string;
}
export interface Channel {
id: string;
name: string;
illustration: string;
playbook?: string;
}
export interface Board {
id: string;
name: string;
illustration: string;
channel?: string;
}
export interface Playbook {
id: string;
name: string;
illustration: string;
template: string;
}
export interface Integration {
id: string;
recommended: boolean;
name?: string;
icon?: string;
installed?: boolean;
}
interface Content {
channel?: Channel;
board?: Board;
playbook?: Playbook;
integration?: Integration;
}
type ValidContent = RequireOnlyOne<Content, 'channel' | 'board' | 'playbook' | 'integration'>;
export interface MessageWithIllustration {
message: string;
illustration?: string;
}
type MessageWithMandatoryIllustration = Partial<MessageWithIllustration> & Required<Pick<MessageWithIllustration, 'illustration'>>;
interface Description {
channel: MessageWithIllustration;
board: MessageWithIllustration;
playbook: MessageWithIllustration;
integration: MessageWithMandatoryIllustration;
}
export enum Visibility {
Public = 'public',
Private = 'private',
}
export const CategoryOther = 'other'