mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
a17b08dd15
* fix: Implemented new workflow in the issue store and updated the quick add workflow in list layout * fix: initial load and mutaion of issues in list layout * dev: implemented the new project issues store with grouped, subGrouped and unGrouped issue computed functions * dev: default display properties data made as a function * conflict: merge conflict resolved * dev: implemented quick add logic in kanban * chore: implemented quick add logic in calendar and spreadsheet layout * fix: spreadsheet layout quick add fix * dev: optimised the issues workflow and handled the issues order_by filter * dev: project issue CRUD operations in new issue store architecture * dev: issues filtering in calendar layout * fix: build error * dev/issue_filters_store * chore: updated filters computed structure * conflict: merge conflicts resolved in project issues * dev: implemented gantt chart for project issues using the new mobx store * dev: initialized cycle and module issue filters store * dev: issue store and list layout store updates * dev: quick add and update, delete issue in the list * refactor list root changes * dev: store new structure * refactor spreadsheet and gnatt project roots * fix errors for base gantt and spreadsheet roots * connect Calendar project view * minor house keeping * connect Kanban View to th enew store * generalise base calendar issue actions * dev: store project issues and issue filters * dev: store project issues and filters * dev: updated undefined with displayFilters in project issue store * Add Quick add to all the layouts * connect module views to store * dev: Rendering list issues in project issues * dev: removed console log * dev: module filters store * fix errors and connect modules list and quick add for list * dev: module issue store * dev: modle filter store issue fixed and updates cycle issue filters * minor house keeping changes * dev: cycle issues and cycle filters * connecty cycles to teh store * dev: project view issues and issue filtrs * connect project views * dev: updated applied filters in layouts * dev: replaced project id with view id in project views * dev: in cycle and module store made cycledId and moduleId as optional * fix minor issues and build errots * dev: project draft and archived issues store and filters --------- Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> Co-authored-by: rahulramesha <rahulramesham@gmail.com>
507 lines
16 KiB
TypeScript
507 lines
16 KiB
TypeScript
import React from "react";
|
|
import { observer } from "mobx-react-lite";
|
|
// components
|
|
import { KanBanGroupByHeaderRoot } from "./headers/group-by-root";
|
|
import { KanBanSubGroupByHeaderRoot } from "./headers/sub-group-by-root";
|
|
import { KanBan } from "./default";
|
|
// types
|
|
import { IIssue, IIssueDisplayProperties, IIssueLabel, IProject, IState, IUserLite } from "types";
|
|
import { IIssueResponse, IGroupedIssues, ISubGroupedIssues, TUnGroupedIssues } from "store/issues/types";
|
|
// constants
|
|
import { getValueFromObject } from "constants/issue";
|
|
import { EIssueActions } from "../types";
|
|
|
|
interface ISubGroupSwimlaneHeader {
|
|
issues: IIssueResponse;
|
|
issueIds: any;
|
|
sub_group_by: string | null;
|
|
group_by: string | null;
|
|
list: any;
|
|
listKey: string;
|
|
kanBanToggle: any;
|
|
handleKanBanToggle: any;
|
|
}
|
|
const SubGroupSwimlaneHeader: React.FC<ISubGroupSwimlaneHeader> = ({
|
|
issues,
|
|
issueIds,
|
|
sub_group_by,
|
|
group_by,
|
|
list,
|
|
listKey,
|
|
kanBanToggle,
|
|
handleKanBanToggle,
|
|
}) => {
|
|
const calculateIssueCount = (column_id: string) => {
|
|
let issueCount = 0;
|
|
issueIds &&
|
|
Object.keys(issueIds)?.forEach((_issueKey: any) => {
|
|
issueCount += issueIds?.[_issueKey]?.[column_id]?.length || 0;
|
|
});
|
|
return issueCount;
|
|
};
|
|
|
|
return (
|
|
<div className="relative w-full min-h-full h-max flex items-center">
|
|
{list &&
|
|
list.length > 0 &&
|
|
list.map((_list: any) => (
|
|
<div className="flex-shrink-0 flex flex-col w-[340px]">
|
|
<KanBanGroupByHeaderRoot
|
|
column_id={getValueFromObject(_list, listKey) as string}
|
|
column_value={_list}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
issues_count={calculateIssueCount(getValueFromObject(_list, listKey) as string)}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
interface ISubGroupSwimlane extends ISubGroupSwimlaneHeader {
|
|
issues: IIssueResponse;
|
|
issueIds: any;
|
|
order_by: string | null;
|
|
showEmptyGroup: boolean;
|
|
states: IState[] | null;
|
|
stateGroups: any;
|
|
priorities: any;
|
|
labels: IIssueLabel[] | null;
|
|
members: IUserLite[] | null;
|
|
projects: IProject[] | null;
|
|
handleIssues: (sub_group_by: string | null, group_by: string | null, issue: IIssue, action: EIssueActions) => void;
|
|
quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode;
|
|
displayProperties: IIssueDisplayProperties | null;
|
|
kanBanToggle: any;
|
|
handleKanBanToggle: any;
|
|
isDragStarted?: boolean;
|
|
}
|
|
const SubGroupSwimlane: React.FC<ISubGroupSwimlane> = observer((props) => {
|
|
const {
|
|
issues,
|
|
issueIds,
|
|
sub_group_by,
|
|
group_by,
|
|
order_by,
|
|
list,
|
|
listKey,
|
|
handleIssues,
|
|
quickActions,
|
|
displayProperties,
|
|
kanBanToggle,
|
|
handleKanBanToggle,
|
|
showEmptyGroup,
|
|
states,
|
|
stateGroups,
|
|
priorities,
|
|
labels,
|
|
members,
|
|
projects,
|
|
isDragStarted,
|
|
} = props;
|
|
|
|
const calculateIssueCount = (column_id: string) => {
|
|
let issueCount = 0;
|
|
issueIds?.[column_id] &&
|
|
Object.keys(issueIds?.[column_id])?.forEach((_list: any) => {
|
|
issueCount += issueIds?.[column_id]?.[_list]?.length || 0;
|
|
});
|
|
return issueCount;
|
|
};
|
|
|
|
return (
|
|
<div className="relative w-full min-h-full h-max">
|
|
{list &&
|
|
list.length > 0 &&
|
|
list.map((_list: any) => (
|
|
<div className="flex-shrink-0 flex flex-col">
|
|
<div className="sticky top-[50px] w-full z-[1] bg-custom-background-90 flex items-center py-1">
|
|
<div className="flex-shrink-0 sticky left-0 bg-custom-background-90 pr-2">
|
|
<KanBanSubGroupByHeaderRoot
|
|
column_id={getValueFromObject(_list, listKey) as string}
|
|
column_value={_list}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
issues_count={calculateIssueCount(getValueFromObject(_list, listKey) as string)}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
</div>
|
|
<div className="w-full border-b border-custom-border-400 border-dashed" />
|
|
</div>
|
|
{!kanBanToggle?.subgroupByIssuesVisibility.includes(getValueFromObject(_list, listKey) as string) && (
|
|
<div className="relative">
|
|
<KanBan
|
|
issues={issues}
|
|
issueIds={issueIds?.[getValueFromObject(_list, listKey) as string]}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
sub_group_id={getValueFromObject(_list, listKey) as string}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
enableQuickIssueCreate
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
});
|
|
|
|
export interface IKanBanSwimLanes {
|
|
issues: IIssueResponse;
|
|
issueIds: IGroupedIssues | ISubGroupedIssues | TUnGroupedIssues;
|
|
sub_group_by: string | null;
|
|
group_by: string | null;
|
|
order_by: string | null;
|
|
handleIssues: (sub_group_by: string | null, group_by: string | null, issue: IIssue, action: EIssueActions) => void;
|
|
quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode;
|
|
displayProperties: IIssueDisplayProperties | null;
|
|
kanBanToggle: any;
|
|
handleKanBanToggle: any;
|
|
showEmptyGroup: boolean;
|
|
states: IState[] | null;
|
|
stateGroups: any;
|
|
priorities: any;
|
|
labels: IIssueLabel[] | null;
|
|
members: IUserLite[] | null;
|
|
projects: IProject[] | null;
|
|
isDragStarted?: boolean;
|
|
}
|
|
|
|
export const KanBanSwimLanes: React.FC<IKanBanSwimLanes> = observer((props) => {
|
|
const {
|
|
issues,
|
|
issueIds,
|
|
sub_group_by,
|
|
group_by,
|
|
order_by,
|
|
handleIssues,
|
|
quickActions,
|
|
displayProperties,
|
|
kanBanToggle,
|
|
handleKanBanToggle,
|
|
showEmptyGroup,
|
|
states,
|
|
stateGroups,
|
|
priorities,
|
|
labels,
|
|
members,
|
|
projects,
|
|
isDragStarted,
|
|
} = props;
|
|
|
|
return (
|
|
<div className="relative">
|
|
<div className="sticky top-0 z-[2] bg-custom-background-90 h-[50px]">
|
|
{group_by && group_by === "project" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={projects}
|
|
listKey={`id`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
|
|
{group_by && group_by === "state" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={states}
|
|
listKey={`id`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
|
|
{group_by && group_by === "state_detail.group" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={stateGroups}
|
|
listKey={`key`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
|
|
{group_by && group_by === "priority" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={priorities}
|
|
listKey={`key`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
|
|
{group_by && group_by === "labels" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={labels ? [...labels, { id: "None", name: "None" }] : labels}
|
|
listKey={`id`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
|
|
{group_by && group_by === "assignees" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={members ? [...members, { id: "None", display_name: "None" }] : members}
|
|
listKey={`id`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
|
|
{group_by && group_by === "created_by" && (
|
|
<SubGroupSwimlaneHeader
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
list={members}
|
|
listKey={`id`}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
/>
|
|
)}
|
|
</div>
|
|
|
|
{sub_group_by && sub_group_by === "project" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={projects}
|
|
listKey={`id`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "state" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={states}
|
|
listKey={`id`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "state" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={states}
|
|
listKey={`id`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "state_detail.group" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={stateGroups}
|
|
listKey={`key`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "priority" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={priorities}
|
|
listKey={`key`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "labels" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={labels ? [...labels, { id: "None", name: "None" }] : labels}
|
|
listKey={`id`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "assignees" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={members ? [...members, { id: "None", display_name: "None" }] : members}
|
|
listKey={`id`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
|
|
{sub_group_by && sub_group_by === "created_by" && (
|
|
<SubGroupSwimlane
|
|
issues={issues}
|
|
issueIds={issueIds}
|
|
sub_group_by={sub_group_by}
|
|
group_by={group_by}
|
|
order_by={order_by}
|
|
list={members}
|
|
listKey={`id`}
|
|
handleIssues={handleIssues}
|
|
quickActions={quickActions}
|
|
displayProperties={displayProperties}
|
|
kanBanToggle={kanBanToggle}
|
|
handleKanBanToggle={handleKanBanToggle}
|
|
showEmptyGroup={showEmptyGroup}
|
|
states={states}
|
|
stateGroups={stateGroups}
|
|
priorities={priorities}
|
|
labels={labels}
|
|
members={members}
|
|
projects={projects}
|
|
isDragStarted={isDragStarted}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|