mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
Compare commits
2 Commits
fix/projec
...
fix-overri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f04220818c | ||
|
|
98562a55c7 |
@@ -47,11 +47,8 @@ export const IssueModuleSelect: React.FC<TIssueModuleSelect> = observer((props)
|
||||
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);
|
||||
await issueOperations.changeModulesInIssue?.(workspaceSlug, projectId, issueId, modulesToAdd, modulesToRemove);
|
||||
|
||||
setIsUpdating(false);
|
||||
};
|
||||
|
||||
@@ -32,18 +32,18 @@ export type TIssueOperations = {
|
||||
addCycleToIssue?: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
|
||||
addIssueToCycle?: (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => Promise<void>;
|
||||
removeIssueFromCycle?: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
|
||||
addModulesToIssue?: (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => Promise<void>;
|
||||
removeIssueFromModule?: (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
moduleId: string,
|
||||
issueId: string
|
||||
) => Promise<void>;
|
||||
removeModulesFromIssue?: (
|
||||
changeModulesInIssue?: (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
moduleIds: string[]
|
||||
addModuleIds: string[],
|
||||
removeModuleIds: string[]
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
@@ -70,9 +70,8 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
|
||||
addCycleToIssue,
|
||||
addIssueToCycle,
|
||||
removeIssueFromCycle,
|
||||
addModulesToIssue,
|
||||
changeModulesInIssue,
|
||||
removeIssueFromModule,
|
||||
removeModulesFromIssue,
|
||||
} = useIssueDetail();
|
||||
const {
|
||||
issues: { removeIssue: removeArchivedIssue },
|
||||
@@ -258,35 +257,6 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
|
||||
});
|
||||
}
|
||||
},
|
||||
addModulesToIssue: async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
||||
try {
|
||||
const response = await addModulesToIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { ...response, state: "SUCCESS", element: "Issue detail page" },
|
||||
updates: {
|
||||
changed_property: "module_id",
|
||||
change_details: moduleIds,
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
} catch (error) {
|
||||
setToast({
|
||||
type: TOAST_TYPE.ERROR,
|
||||
title: "Error!",
|
||||
message: "Issue could not be added to the module. Please try again.",
|
||||
});
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
|
||||
updates: {
|
||||
changed_property: "module_id",
|
||||
change_details: moduleIds,
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
}
|
||||
},
|
||||
removeIssueFromModule: async (workspaceSlug: string, projectId: string, moduleId: string, issueId: string) => {
|
||||
try {
|
||||
const removeFromModulePromise = removeIssueFromModule(workspaceSlug, projectId, moduleId, issueId);
|
||||
@@ -323,25 +293,24 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
|
||||
});
|
||||
}
|
||||
},
|
||||
removeModulesFromIssue: async (
|
||||
changeModulesInIssue: async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
moduleIds: string[]
|
||||
addModuleIds: string[],
|
||||
removeModuleIds: string[]
|
||||
) => {
|
||||
const removeModulesFromIssuePromise = removeModulesFromIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||
setPromiseToast(removeModulesFromIssuePromise, {
|
||||
loading: "Removing module from issue...",
|
||||
success: {
|
||||
title: "Success!",
|
||||
message: () => "Module removed from issue successfully",
|
||||
},
|
||||
error: {
|
||||
title: "Error!",
|
||||
message: () => "Module remove from issue failed",
|
||||
const promise = await changeModulesInIssue(workspaceSlug, projectId, issueId, addModuleIds, removeModuleIds);
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
||||
updates: {
|
||||
changed_property: "module_id",
|
||||
change_details: { addModuleIds, removeModuleIds },
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
await removeModulesFromIssuePromise;
|
||||
return promise;
|
||||
},
|
||||
}),
|
||||
[
|
||||
@@ -353,9 +322,8 @@ export const IssueDetailRoot: FC<TIssueDetailRoot> = observer((props) => {
|
||||
removeArchivedIssue,
|
||||
addIssueToCycle,
|
||||
removeIssueFromCycle,
|
||||
addModulesToIssue,
|
||||
changeModulesInIssue,
|
||||
removeIssueFromModule,
|
||||
removeModulesFromIssue,
|
||||
captureIssueEvent,
|
||||
pathname,
|
||||
]
|
||||
|
||||
@@ -13,6 +13,7 @@ import { EIssuesStoreType } from "@/constants/issue";
|
||||
import { EUserProjectRoles } from "@/constants/project";
|
||||
// hooks
|
||||
import { useEventTracker, useIssueDetail, useIssues, useUser } from "@/hooks/store";
|
||||
import { useIssuesStore } from "@/hooks/use-issue-layout-store";
|
||||
|
||||
interface IIssuePeekOverview {
|
||||
embedIssue?: boolean;
|
||||
@@ -55,19 +56,10 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
} = useIssues(EIssuesStoreType.ARCHIVED);
|
||||
const {
|
||||
peekIssue,
|
||||
updateIssue,
|
||||
removeIssue,
|
||||
archiveIssue,
|
||||
issue: { fetchIssue },
|
||||
} = useIssueDetail();
|
||||
const {
|
||||
addCycleToIssue,
|
||||
addIssueToCycle,
|
||||
removeIssueFromCycle,
|
||||
addModulesToIssue,
|
||||
removeIssueFromModule,
|
||||
removeModulesFromIssue,
|
||||
} = useIssueDetail();
|
||||
|
||||
const { issues } = useIssuesStore();
|
||||
const { captureIssueEvent } = useEventTracker();
|
||||
// state
|
||||
const [loader, setLoader] = useState(true);
|
||||
@@ -94,7 +86,8 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
}
|
||||
},
|
||||
update: async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
await updateIssue(workspaceSlug, projectId, issueId, data)
|
||||
await issues
|
||||
?.updateIssue(workspaceSlug, projectId, issueId, data)
|
||||
.then(() => {
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
@@ -121,7 +114,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
},
|
||||
remove: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
removeIssue(workspaceSlug, projectId, issueId);
|
||||
issues?.removeIssue(workspaceSlug, projectId, issueId);
|
||||
setToast({
|
||||
title: "Success!",
|
||||
type: TOAST_TYPE.SUCCESS,
|
||||
@@ -147,7 +140,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
},
|
||||
archive: async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
await archiveIssue(workspaceSlug, projectId, issueId);
|
||||
issues?.archiveIssue && (await issues.archiveIssue(workspaceSlug, projectId, issueId));
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_ARCHIVED,
|
||||
payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" },
|
||||
@@ -189,8 +182,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
},
|
||||
addCycleToIssue: async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => {
|
||||
try {
|
||||
console.log("Peek adding...");
|
||||
await addCycleToIssue(workspaceSlug, projectId, cycleId, issueId);
|
||||
await issues.addCycleToIssue(workspaceSlug, projectId, cycleId, issueId);
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { issueId, state: "SUCCESS", element: "Issue peek-overview" },
|
||||
@@ -219,7 +211,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
},
|
||||
addIssueToCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => {
|
||||
try {
|
||||
await addIssueToCycle(workspaceSlug, projectId, cycleId, issueIds);
|
||||
await issues.addIssueToCycle(workspaceSlug, projectId, cycleId, issueIds);
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { ...issueIds, state: "SUCCESS", element: "Issue peek-overview" },
|
||||
@@ -248,7 +240,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
},
|
||||
removeIssueFromCycle: async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => {
|
||||
try {
|
||||
const removeFromCyclePromise = removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
||||
const removeFromCyclePromise = issues.removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
||||
setPromiseToast(removeFromCyclePromise, {
|
||||
loading: "Removing issue from the cycle...",
|
||||
success: {
|
||||
@@ -282,38 +274,34 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
});
|
||||
}
|
||||
},
|
||||
addModulesToIssue: async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
||||
try {
|
||||
const response = await addModulesToIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { ...response, state: "SUCCESS", element: "Issue peek-overview" },
|
||||
updates: {
|
||||
changed_property: "module_id",
|
||||
change_details: moduleIds,
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
} catch (error) {
|
||||
setToast({
|
||||
type: TOAST_TYPE.ERROR,
|
||||
title: "Error!",
|
||||
message: "Issue could not be added to the module. Please try again.",
|
||||
});
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" },
|
||||
updates: {
|
||||
changed_property: "module_id",
|
||||
change_details: moduleIds,
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
}
|
||||
changeModulesInIssue: async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
addModuleIds: string[],
|
||||
removeModuleIds: string[]
|
||||
) => {
|
||||
const promise = await issues.changeModulesInIssue(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
issueId,
|
||||
addModuleIds,
|
||||
removeModuleIds
|
||||
);
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
||||
updates: {
|
||||
changed_property: "module_id",
|
||||
change_details: { addModuleIds, removeModuleIds },
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
return promise;
|
||||
},
|
||||
removeIssueFromModule: async (workspaceSlug: string, projectId: string, moduleId: string, issueId: string) => {
|
||||
try {
|
||||
const removeFromModulePromise = removeIssueFromModule(workspaceSlug, projectId, moduleId, issueId);
|
||||
const removeFromModulePromise = issues.removeIssuesFromModule(workspaceSlug, projectId, moduleId, [issueId]);
|
||||
setPromiseToast(removeFromModulePromise, {
|
||||
loading: "Removing issue from the module...",
|
||||
success: {
|
||||
@@ -347,43 +335,8 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
||||
});
|
||||
}
|
||||
},
|
||||
removeModulesFromIssue: async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
moduleIds: string[]
|
||||
) => {
|
||||
const removeModulesFromIssuePromise = removeModulesFromIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||
setPromiseToast(removeModulesFromIssuePromise, {
|
||||
loading: "Removing module from issue...",
|
||||
success: {
|
||||
title: "Success!",
|
||||
message: () => "Module removed from issue successfully",
|
||||
},
|
||||
error: {
|
||||
title: "Error!",
|
||||
message: () => "Module remove from issue failed",
|
||||
},
|
||||
});
|
||||
await removeModulesFromIssuePromise;
|
||||
},
|
||||
}),
|
||||
[
|
||||
is_archived,
|
||||
is_draft,
|
||||
fetchIssue,
|
||||
updateIssue,
|
||||
removeIssue,
|
||||
archiveIssue,
|
||||
restoreIssue,
|
||||
addIssueToCycle,
|
||||
removeIssueFromCycle,
|
||||
addModulesToIssue,
|
||||
removeIssueFromModule,
|
||||
removeModulesFromIssue,
|
||||
captureIssueEvent,
|
||||
pathname,
|
||||
]
|
||||
[is_archived, is_draft, fetchIssue, issues, restoreIssue, captureIssueEvent, pathname]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { action, makeObservable, runInAction } from "mobx";
|
||||
// base class
|
||||
import { TLoader, IssuePaginationOptions, TIssuesResponse, ViewFlags, TBulkOperationsPayload } from "@plane/types";
|
||||
import {
|
||||
TLoader,
|
||||
IssuePaginationOptions,
|
||||
TIssuesResponse,
|
||||
ViewFlags,
|
||||
TBulkOperationsPayload,
|
||||
TIssue,
|
||||
} from "@plane/types";
|
||||
// services
|
||||
// types
|
||||
import { BaseIssuesStore, IBaseIssuesStore } from "../helpers/base-issues.store";
|
||||
@@ -29,12 +36,13 @@ export interface IArchivedIssues extends IBaseIssuesStore {
|
||||
subGroupId?: string
|
||||
) => Promise<TIssuesResponse | undefined>;
|
||||
|
||||
updateIssue: (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => Promise<void>;
|
||||
restoreIssue: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
||||
removeBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
archiveIssue: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
||||
quickAddIssue: (workspaceSlug: string, projectId: string, data: TIssue, id?: string) => Promise<TIssue | undefined>;
|
||||
bulkUpdateProperties: (workspaceSlug: string, projectId: string, data: TBulkOperationsPayload) => Promise<void>;
|
||||
|
||||
archiveBulkIssues: undefined;
|
||||
quickAddIssue: undefined;
|
||||
archiveBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
}
|
||||
|
||||
export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
||||
@@ -192,6 +200,31 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
||||
}
|
||||
};
|
||||
|
||||
archiveBulkIssues = undefined;
|
||||
quickAddIssue = undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override updateIssue(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
data: Partial<TIssue>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
shouldSync = true
|
||||
) {
|
||||
console.warn("Archived Issues cannot be updated");
|
||||
return Promise.resolve();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override archiveIssue(workspaceSlug: string, projectId: string, issueId: string) {
|
||||
console.warn("Archived Issues cannot be archived");
|
||||
return Promise.resolve();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override archiveBulkIssues(workspaceSlug: string, projectId: string, issueIds: string[]) {
|
||||
console.warn("Archived Issues cannot be archived");
|
||||
return Promise.resolve();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, id?: string) {
|
||||
console.warn("cannot quick Add Archived issues");
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +370,9 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
||||
set(this.activeCycleIds, [cycleId, "nextCursor"], response.next_cursor);
|
||||
set(this.activeCycleIds, [cycleId, "nextPageResults"], response.next_page_results);
|
||||
set(this.activeCycleIds, [cycleId, "issueCount"], response.total_count);
|
||||
update(this.activeCycleIds, [cycleId, "issueIds"], (issueIds: string[] = []) => this.issuesSortWithOrderBy(uniq(concat(issueIds, activeIssueIds)), this.orderBy));
|
||||
update(this.activeCycleIds, [cycleId, "issueIds"], (issueIds: string[] = []) =>
|
||||
this.issuesSortWithOrderBy(uniq(concat(issueIds, activeIssueIds)), this.orderBy)
|
||||
);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -386,7 +388,7 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
||||
* @param cycleId
|
||||
* @returns
|
||||
*/
|
||||
quickAddIssue = async (workspaceSlug: string, projectId: string, data: TIssue, cycleId: string) => {
|
||||
override async quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, cycleId: string) {
|
||||
try {
|
||||
// add temporary issue to store list
|
||||
this.addIssue(data);
|
||||
@@ -411,7 +413,5 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,9 @@ export interface IDraftIssues extends IBaseIssuesStore {
|
||||
removeBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
bulkUpdateProperties: (workspaceSlug: string, projectId: string, data: TBulkOperationsPayload) => Promise<void>;
|
||||
|
||||
archiveBulkIssues: undefined;
|
||||
quickAddIssue: undefined;
|
||||
archiveIssue: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
||||
quickAddIssue: (workspaceSlug: string, projectId: string, data: TIssue, id?: string) => Promise<TIssue | undefined>;
|
||||
archiveBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
}
|
||||
|
||||
export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
|
||||
@@ -167,6 +168,19 @@ export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
|
||||
createIssue = this.createDraftIssue;
|
||||
updateIssue = this.updateDraftIssue;
|
||||
|
||||
archiveBulkIssues = undefined;
|
||||
quickAddIssue = undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override archiveIssue(workspaceSlug: string, projectId: string, issueId: string) {
|
||||
console.warn("Archived Issues cannot be archived");
|
||||
return Promise.resolve();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override archiveBulkIssues(workspaceSlug: string, projectId: string, issueIds: string[]) {
|
||||
console.warn("Archived Issues cannot be archived");
|
||||
return Promise.resolve();
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, id?: string) {
|
||||
console.warn("cannot quick Add Archived issues");
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export interface IBaseIssuesStore {
|
||||
issuePaginationData: TIssuePaginationData; // map of groupId/subgroup and pagination Data of that particular group/subgroup
|
||||
|
||||
//actions
|
||||
removeIssue(workspaceSlug: string, projectId: string, issueId: string): Promise<void>;
|
||||
removeIssue: (workspaceSlug: string, projectId: string, issueId: string) => Promise<void>;
|
||||
// helper methods
|
||||
getIssueIds: (groupId?: string, subGroupId?: string) => string[] | undefined;
|
||||
issuesSortWithOrderBy(issueIds: string[], key: Partial<TIssueOrderByOptions>): string[];
|
||||
@@ -223,11 +223,11 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
||||
updateIssue: action,
|
||||
createDraftIssue: action,
|
||||
updateDraftIssue: action,
|
||||
issueQuickAdd: action.bound,
|
||||
quickAddIssue: action.bound,
|
||||
removeIssue: action.bound,
|
||||
archiveIssue: action.bound,
|
||||
removeBulkIssues: action.bound,
|
||||
bulkArchiveIssues: action.bound,
|
||||
archiveBulkIssues: action.bound,
|
||||
bulkUpdateProperties: action.bound,
|
||||
|
||||
addIssueToCycle: action.bound,
|
||||
@@ -684,8 +684,10 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
async issueQuickAdd(workspaceSlug: string, projectId: string, data: TIssue) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
async quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, id?: string) {
|
||||
try {
|
||||
if (!data) return;
|
||||
// Add issue to store with a temporary Id
|
||||
this.addIssue(data);
|
||||
|
||||
@@ -753,7 +755,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
||||
* @param projectId
|
||||
* @param issueIds
|
||||
*/
|
||||
bulkArchiveIssues = async (workspaceSlug: string, projectId: string, issueIds: string[]) => {
|
||||
async archiveBulkIssues(workspaceSlug: string, projectId: string, issueIds: string[]) {
|
||||
try {
|
||||
const response = await this.issueService.bulkArchiveIssues(workspaceSlug, projectId, { issue_ids: issueIds });
|
||||
|
||||
@@ -774,7 +776,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description bulk update properties of selected issues
|
||||
@@ -1173,8 +1175,8 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
||||
const issueId = issue?.id ?? issueBeforeUpdate?.id;
|
||||
if (!issueId) return;
|
||||
|
||||
// get issueUpdates from another method by passing down the three arguments
|
||||
// issueUpdates is nothing but an array of objects that contain the path of the issueId list that need updating and also the action that needs to be performed at the path
|
||||
// get updateIssues from another method by passing down the three arguments
|
||||
// updateIssues is nothing but an array of objects that contain the path of the issueId list that need updating and also the action that needs to be performed at the path
|
||||
const issueUpdates = this.getUpdateDetails(issue, issueBeforeUpdate, action);
|
||||
const accumulatedUpdatesForCount = {};
|
||||
runInAction(() => {
|
||||
|
||||
@@ -21,12 +21,12 @@ export interface IIssueStoreActions {
|
||||
addCycleToIssue: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
|
||||
addIssueToCycle: (workspaceSlug: string, projectId: string, cycleId: string, issueIds: string[]) => Promise<void>;
|
||||
removeIssueFromCycle: (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) => Promise<void>;
|
||||
addModulesToIssue: (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => Promise<any>;
|
||||
removeModulesFromIssue: (
|
||||
changeModulesInIssue: (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
moduleIds: string[]
|
||||
addModuleIds: string[],
|
||||
removeModuleIds: string[]
|
||||
) => Promise<void>;
|
||||
removeIssueFromModule: (workspaceSlug: string, projectId: string, moduleId: string, issueId: string) => Promise<void>;
|
||||
}
|
||||
@@ -193,29 +193,21 @@ export class IssueStore implements IIssueStore {
|
||||
return cycle;
|
||||
};
|
||||
|
||||
addModulesToIssue = async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
||||
const currentModule = await this.rootIssueDetailStore.rootIssueStore.moduleIssues.changeModulesInIssue(
|
||||
changeModulesInIssue = async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
addModuleIds: string[],
|
||||
removeModuleIds: string[]
|
||||
) => {
|
||||
await this.rootIssueDetailStore.rootIssueStore.moduleIssues.changeModulesInIssue(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
issueId,
|
||||
moduleIds,
|
||||
[]
|
||||
);
|
||||
if (moduleIds && moduleIds.length > 0)
|
||||
await this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
return currentModule;
|
||||
};
|
||||
|
||||
removeModulesFromIssue = async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) => {
|
||||
const currentModule = await this.rootIssueDetailStore.rootIssueStore.moduleIssues.changeModulesInIssue(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
issueId,
|
||||
[],
|
||||
moduleIds
|
||||
addModuleIds,
|
||||
removeModuleIds
|
||||
);
|
||||
await this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
return currentModule;
|
||||
};
|
||||
|
||||
removeIssueFromModule = async (workspaceSlug: string, projectId: string, moduleId: string, issueId: string) => {
|
||||
|
||||
@@ -198,10 +198,13 @@ export class IssueDetail implements IIssueDetail {
|
||||
this.issue.addIssueToCycle(workspaceSlug, projectId, cycleId, issueIds);
|
||||
removeIssueFromCycle = async (workspaceSlug: string, projectId: string, cycleId: string, issueId: string) =>
|
||||
this.issue.removeIssueFromCycle(workspaceSlug, projectId, cycleId, issueId);
|
||||
addModulesToIssue = async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) =>
|
||||
this.issue.addModulesToIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||
removeModulesFromIssue = async (workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) =>
|
||||
this.issue.removeModulesFromIssue(workspaceSlug, projectId, issueId, moduleIds);
|
||||
changeModulesInIssue = async (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
addModuleIds: string[],
|
||||
removeModuleIds: string[]
|
||||
) => this.issue.changeModulesInIssue(workspaceSlug, projectId, issueId, addModuleIds, removeModuleIds);
|
||||
removeIssueFromModule = async (workspaceSlug: string, projectId: string, moduleId: string, issueId: string) =>
|
||||
this.issue.removeIssueFromModule(workspaceSlug, projectId, moduleId, issueId);
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
|
||||
* @param moduleId
|
||||
* @returns
|
||||
*/
|
||||
quickAddIssue = async (workspaceSlug: string, projectId: string, data: TIssue, moduleId: string) => {
|
||||
override async quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, moduleId: string) {
|
||||
try {
|
||||
// add temporary issue to store list
|
||||
this.addIssue(data);
|
||||
@@ -249,7 +249,5 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@ export interface IProfileIssues extends IBaseIssuesStore {
|
||||
removeBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
archiveBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
bulkUpdateProperties: (workspaceSlug: string, projectId: string, data: TBulkOperationsPayload) => Promise<void>;
|
||||
|
||||
quickAddIssue: undefined;
|
||||
quickAddIssue: (workspaceSlug: string, projectId: string, data: TIssue, id?: string) => Promise<TIssue | undefined>;
|
||||
}
|
||||
|
||||
export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
|
||||
@@ -208,6 +207,9 @@ export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
|
||||
return await this.fetchIssues(workspaceSlug, userId, loadType, this.paginationOptions, this.currentView, true);
|
||||
};
|
||||
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
quickAddIssue = undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, id?: string) {
|
||||
console.warn("cannot quick Add to Profile issues");
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +173,4 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
||||
return await this.fetchIssues(workspaceSlug, projectId, viewId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
quickAddIssue = this.issueQuickAdd;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,4 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
|
||||
if (!this.paginationOptions) return;
|
||||
return await this.fetchIssues(workspaceSlug, projectId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
quickAddIssue = this.issueQuickAdd;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ export interface IWorkspaceIssues extends IBaseIssuesStore {
|
||||
removeBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
archiveBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
bulkUpdateProperties: (workspaceSlug: string, projectId: string, data: TBulkOperationsPayload) => Promise<void>;
|
||||
quickAddIssue: (workspaceSlug: string, projectId: string, data: TIssue, id?: string) => Promise<TIssue | undefined>;
|
||||
|
||||
quickAddIssue: undefined;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,9 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues
|
||||
return await this.fetchIssues(workspaceSlug, viewId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
quickAddIssue = undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
override quickAddIssue(workspaceSlug: string, projectId: string, data: TIssue, id?: string) {
|
||||
console.warn("cannot quick Add to workspace issues");
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user