mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 14:01:45 +02:00
* feat: project grouping migrations * chore: implemented workspace features * chore: updated worksapce feature import in types * chore: project states endpoint * chore: updated migration file * chore: migration file changes * chore: workspace project states * feat: project states * fix: project states * chore: replaced base modal with project base modal in project attribute * chore: removed 002 migration * chore: project attribute migration * chore: project states feature flagged * chore: project state marking as default * chore: code cleanup * chore: updated the project attributes operations in the project crud endpoints * fix: wip * chore: feature flag validation on project create and update. * fix: sync develope * dev: project state feature flag and removed read only fields from serializer * wip * chore: updated project id and project validation when we toggle the workspace project_grouping feature is true * wip: layouts * chore: updated project filter store * wip: default screens * chore: filters update * chore: filters updates * chore: display filter updates * wip: state dropdown * chore: seperated project components for CE * chore: splitted the code for project creation form * fix: code structure optimization * chore: handled project filters * wip: gallery layout for projects * wip: spreadsheet filters * chore: added state and priority filters * fix: project page root moved * fix: synced with preview * dev: updated sorting * wip: role based permissions * fix: header sorting fixed * fix: project types + state filter * fix: optimizations * fix: optimizations * fix: partial feature flagging * fix: project states * fix: css * fix: css foxes * fix: * chore: handled board layout in project grouping * fix: post ce sync changes * fix: gantt permissions + member bugs * fix: mobile header + layout fixes * fix: workspace sidebar + archives * fix: build errors * fix: dark theme handling * fix: archive fix + miscellaneous * Fix: build errors * fix: kandban drag and drop + miscellaneous * fix: kanban drag and drop * fix: imports * fix: drag & drop + project dropdown * fix: merge changes --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: gakshita <akshitagoyal1516@gmail.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
100 lines
2.7 KiB
TypeScript
100 lines
2.7 KiB
TypeScript
/* eslint-disable no-useless-catch */
|
|
|
|
import { action, computed, makeObservable } from "mobx";
|
|
// types
|
|
|
|
// plane web store
|
|
|
|
// plane web service
|
|
|
|
// store
|
|
import { ProjectStore as CeProjectStore, IProjectStore as ICeProjectStore } from "@/store/project/project.store";
|
|
import { CoreRootStore } from "@/store/root.store";
|
|
|
|
export interface IProjectStore extends ICeProjectStore {
|
|
//computed
|
|
publicProjectIds: string[];
|
|
privateProjectIds: string[];
|
|
myProjectIds: string[];
|
|
// actions
|
|
filteredProjectCount: (filter: string) => number | undefined;
|
|
}
|
|
|
|
export class ProjectStore extends CeProjectStore implements IProjectStore {
|
|
constructor(public store: CoreRootStore) {
|
|
super(store);
|
|
makeObservable(this, {
|
|
// computed
|
|
publicProjectIds: computed,
|
|
privateProjectIds: computed,
|
|
myProjectIds: computed,
|
|
// actions
|
|
filteredProjectCount: action,
|
|
});
|
|
}
|
|
|
|
// computed
|
|
/**
|
|
* Returns public project IDs belong to current workspace.
|
|
*/
|
|
get publicProjectIds() {
|
|
const currentWorkspace = this.rootStore.workspaceRoot.currentWorkspace;
|
|
if (!currentWorkspace) return [];
|
|
|
|
const projects = Object.values(this.projectMap ?? {});
|
|
|
|
const projectIds = projects
|
|
.filter((project) => project.workspace === currentWorkspace.id && project.network === 2)
|
|
.map((project) => project.id);
|
|
return projectIds;
|
|
}
|
|
|
|
/**
|
|
* Returns private project IDs belong to current workspace.
|
|
*/
|
|
get myProjectIds() {
|
|
const currentWorkspace = this.rootStore.workspaceRoot.currentWorkspace;
|
|
if (!currentWorkspace) return [];
|
|
|
|
const projects = Object.values(this.projectMap ?? {});
|
|
|
|
const projectIds = projects
|
|
.filter((project) => project.workspace === currentWorkspace.id && project.is_member)
|
|
.map((project) => project.id);
|
|
return projectIds;
|
|
}
|
|
|
|
/**
|
|
* Returns private project IDs belong to current workspace.
|
|
*/
|
|
get privateProjectIds() {
|
|
const currentWorkspace = this.rootStore.workspaceRoot.currentWorkspace;
|
|
if (!currentWorkspace) return [];
|
|
|
|
const projects = Object.values(this.projectMap ?? {});
|
|
|
|
const projectIds = projects
|
|
.filter((project) => project.workspace === currentWorkspace.id && project.network === 0)
|
|
.map((project) => project.id);
|
|
return projectIds;
|
|
}
|
|
/**
|
|
* Returns private project IDs belong to current workspace.
|
|
*/
|
|
filteredProjectCount = (filter: string) => {
|
|
console.log(this, filter);
|
|
switch (filter) {
|
|
case "all_projects":
|
|
return this.totalProjectIds?.length;
|
|
case "public":
|
|
return this.publicProjectIds.length;
|
|
case "private":
|
|
return this.privateProjectIds.length;
|
|
case "my_projects":
|
|
return this.myProjectIds.length;
|
|
default:
|
|
return 0;
|
|
}
|
|
};
|
|
}
|