[WEB-478]: implemented cycle filters in display properties for list, kanban, and spreadsheet layouts (#3702)
* chore: implemented the modules and cycle filter in the display properties * typo: added placeholders for module and cycle select in spreadsheet view * feat: created workspace modules and cycles endpoints in appi server and implemented in application * ui: UI changes in the spreadsheet module and cycle dropdown and added cursor navigation for cycle via arrow keys * format: formatted api sever * chore: module select logic updated * chore: updated module updated handler in all-properties and spreadsheet column * chore: updated url names for workspace modules and cycles * fix: validated members availability in the modules list member tooltip --------- Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
parent
56f4df4cb5
commit
ac6e710623
25 changed files with 696 additions and 60 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useState } from "react";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import xor from "lodash/xor";
|
||||
// hooks
|
||||
import { useIssueDetail } from "hooks/store";
|
||||
// components
|
||||
|
|
@ -36,16 +37,22 @@ export const IssueModuleSelect: React.FC<TIssueModuleSelect> = observer((props)
|
|||
if (!issue || !issue.module_ids) return;
|
||||
|
||||
setIsUpdating(true);
|
||||
const updatedModuleIds = xor(issue.module_ids, moduleIds);
|
||||
const modulesToAdd: string[] = [];
|
||||
const modulesToRemove: string[] = [];
|
||||
|
||||
if (moduleIds.length === 0)
|
||||
await issueOperations.removeModulesFromIssue?.(workspaceSlug, projectId, issueId, issue.module_ids);
|
||||
else if (moduleIds.length > issue.module_ids.length) {
|
||||
const newModuleIds = moduleIds.filter((m) => !issue.module_ids?.includes(m));
|
||||
await issueOperations.addModulesToIssue?.(workspaceSlug, projectId, issueId, newModuleIds);
|
||||
} else if (moduleIds.length < issue.module_ids.length) {
|
||||
const removedModuleIds = issue.module_ids.filter((m) => !moduleIds.includes(m));
|
||||
await issueOperations.removeModulesFromIssue?.(workspaceSlug, projectId, issueId, removedModuleIds);
|
||||
for (const moduleId of updatedModuleIds) {
|
||||
if (issue.module_ids.includes(moduleId)) {
|
||||
modulesToRemove.push(moduleId);
|
||||
} else {
|
||||
modulesToAdd.push(moduleId);
|
||||
}
|
||||
}
|
||||
if (modulesToRemove.length > 0)
|
||||
await issueOperations.removeModulesFromIssue?.(workspaceSlug, projectId, issueId, modulesToRemove);
|
||||
|
||||
if (modulesToAdd.length > 0)
|
||||
await issueOperations.addModulesToIssue?.(workspaceSlug, projectId, issueId, modulesToAdd);
|
||||
|
||||
setIsUpdating(false);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue