mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 14:01:45 +02:00
* chore: add template * chore: add page template and project template migrations * chore: add migration file for project and page templates * chore: page templates * chore: update template * feat: page templates * chore: update model * chore: asset copy * chore: update page templates * feat: add project template create/update endpoint * improvement: update all templates endpoint * chore: project template basic types and services * feat: project template instance and store * feat: project template store hooks * chore: feature flags and minor improvements * feat: project templates list settings * feat: project templates * chore: common constants across templates * improvement: work item template util types * improvement: moved all project related types to packages and re-exported them to avoid changes in files. * feat: create project template form with all basic fields and attributes * chore: add project creation bgtask from template * chore: update project template configuration * chore: update project template migrations * chore: added migration for workspace connection disconnect_meta * chore: update migration files * chore: model changes * chore: add project template validation * chore: update template task * chore: project templates endpoints * fix: base serializers * chore: add comment edit migrations * chore: minor improvements and base template store fixes * chore: minor improvements * improvement: common template related components * feat: project template features * chore: minor formatting * chore: minor translation updates * feat: update project template form data * chore: work item template util improvements * feat: use project templates in create project modal * chore: use template endpoint * chore: update imports * feat: project creation using templates * fix: build error * feat: work item type creation form * chore: convert project work item types form data to required schema * feat: update work item type form data extraction and sanitization * chore: add project template default settings * chore: update formatting * improvement: sync all project level features * revert: utils package build related changes * feat: project epics in templates * chore: update background task to handle member and intake creation * improvement: epic name while creating template * fix: api server * revert: utils build * feat: added work item labels while creating project templates * chore: update project template task * refactor: project state list components * improvement: additional classNames for the group list item and state item * fix: options * fix: epic creations * feat: add project states while creating project templates * improvements: add empty state for labels * chore: remove unused exports * fix: build error * chore: add intake setting schema * feat: intake feature settings for project templates * feat: intake settings and deploy board when creating project from template * fix: feature children layout * fix: form keydown events * fix: template description * fix: delete state button type * improvement: UI enhancements related to background, border and shadow * improvement: project templates dropdown * improvement: remove empty templates list sections * improvement: remove empty templates list sections * improvement: enhance project level template list modularity * improvement: minor component improvements * chore: minor type changes * improvement: template list loader * improvement: project template form background color * improvement: work item template form background color * chore: add asset url validation and resolve pr comments --------- Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
121 lines
3.5 KiB
TypeScript
121 lines
3.5 KiB
TypeScript
/* eslint-disable no-useless-catch */
|
|
|
|
// plane imports
|
|
import { TProject, TProjectLink, TStateAnalytics } from "@plane/types";
|
|
// plane web imports
|
|
import { TProjectAttributesParams, TProjectAttributesResponse, TProjectFeatures } from "@/plane-web/types";
|
|
// services
|
|
import { ProjectService as CeProjectService } from "@/services/project";
|
|
|
|
export class ProjectService extends CeProjectService {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
// create project using template
|
|
async createProjectUsingTemplate(
|
|
workspaceSlug: string,
|
|
templateId: string,
|
|
data: Partial<TProject>
|
|
): Promise<TProject> {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/use-template/`, {
|
|
template_id: templateId,
|
|
...data,
|
|
})
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
|
|
// attributes
|
|
async getProjectAttributes(
|
|
workspaceSlug: string,
|
|
params?: TProjectAttributesParams
|
|
): Promise<TProjectAttributesResponse[]> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/project-attributes/`, {
|
|
params,
|
|
})
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
// analytics
|
|
async fetchProjectAnalytics(workspaceSlug: string, projectId: string): Promise<TStateAnalytics> {
|
|
try {
|
|
const { data } = await this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/analytics/`);
|
|
return data || undefined;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
// links
|
|
async fetchProjectLinks(workspaceSlug: string, projectId: string): Promise<TProjectLink[]> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/links/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
|
|
async createProjectLink(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
data: Partial<TProjectLink>
|
|
): Promise<TProjectLink> {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/links/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
|
|
async updateProjectLink(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
linkId: string,
|
|
data: Partial<TProjectLink>
|
|
): Promise<TProjectLink> {
|
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/links/${linkId}/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
|
|
async deleteProjectLink(workspaceSlug: string, projectId: string, linkId: string): Promise<any> {
|
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/links/${linkId}/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getProjectFeatures(workspaceSlug: string): Promise<TProjectFeatures[]> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/workspace-project-features/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async toggleProjectFeatures(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
data: Partial<TProjectFeatures>
|
|
): Promise<TProjectFeatures> {
|
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/features/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
}
|
|
|
|
const projectService = new ProjectService();
|
|
|
|
export default projectService;
|