[WEB-1818] fix: issue changes done in Peek overview to reflect in the issue list boards (#5010)
* fix issue changes done in Peek overview to reflect in the issue boards * Adding comments to aliased names
This commit is contained in:
parent
f1496e3144
commit
5918607171
14 changed files with 148 additions and 201 deletions
|
|
@ -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,34 +86,36 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
|
|||
}
|
||||
},
|
||||
update: async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>) => {
|
||||
await updateIssue(workspaceSlug, projectId, issueId, data)
|
||||
.then(() => {
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { ...data, issueId, state: "SUCCESS", element: "Issue peek-overview" },
|
||||
updates: {
|
||||
changed_property: Object.keys(data).join(","),
|
||||
change_details: Object.values(data).join(","),
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { state: "FAILED", element: "Issue peek-overview" },
|
||||
path: pathname,
|
||||
});
|
||||
setToast({
|
||||
title: "Error!",
|
||||
type: TOAST_TYPE.ERROR,
|
||||
message: "Issue update failed",
|
||||
});
|
||||
});
|
||||
issues?.updateIssue &&
|
||||
(await issues
|
||||
.updateIssue(workspaceSlug, projectId, issueId, data)
|
||||
.then(() => {
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { ...data, issueId, state: "SUCCESS", element: "Issue peek-overview" },
|
||||
updates: {
|
||||
changed_property: Object.keys(data).join(","),
|
||||
change_details: Object.values(data).join(","),
|
||||
},
|
||||
path: pathname,
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
captureIssueEvent({
|
||||
eventName: ISSUE_UPDATED,
|
||||
payload: { state: "FAILED", element: "Issue peek-overview" },
|
||||
path: pathname,
|
||||
});
|
||||
setToast({
|
||||
title: "Error!",
|
||||
type: TOAST_TYPE.ERROR,
|
||||
message: "Issue update failed",
|
||||
});
|
||||
}));
|
||||
},
|
||||
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 +141,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 +183,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 +212,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 +241,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 +275,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 +336,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(() => {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ export interface IArchivedIssues extends IBaseIssuesStore {
|
|||
removeBulkIssues: (workspaceSlug: string, projectId: string, issueIds: string[]) => Promise<void>;
|
||||
bulkUpdateProperties: (workspaceSlug: string, projectId: string, data: TBulkOperationsPayload) => Promise<void>;
|
||||
|
||||
updateIssue: undefined;
|
||||
archiveIssue: undefined;
|
||||
archiveBulkIssues: undefined;
|
||||
quickAddIssue: undefined;
|
||||
}
|
||||
|
|
@ -192,6 +194,9 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
|||
}
|
||||
};
|
||||
|
||||
// Setting them as undefined as they can not performed on Archived issues
|
||||
updateIssue = undefined;
|
||||
archiveIssue = undefined;
|
||||
archiveBulkIssues = undefined;
|
||||
quickAddIssue = 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) {
|
||||
|
|
@ -413,5 +415,8 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
}
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
updateIssue = this.issueUpdate;
|
||||
archiveIssue = this.issueArchive;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ export interface IDraftIssues extends IBaseIssuesStore {
|
|||
|
||||
archiveBulkIssues: undefined;
|
||||
quickAddIssue: undefined;
|
||||
archiveIssue: undefined;
|
||||
}
|
||||
|
||||
export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
|
||||
|
|
@ -164,9 +165,12 @@ export class DraftIssues extends BaseIssuesStore implements IDraftIssues {
|
|||
return await this.fetchIssues(workspaceSlug, projectId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
createIssue = this.createDraftIssue;
|
||||
updateIssue = this.updateDraftIssue;
|
||||
|
||||
// Setting them as undefined as they can not performed on draft issues
|
||||
archiveBulkIssues = undefined;
|
||||
quickAddIssue = undefined;
|
||||
archiveIssue = 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[];
|
||||
|
|
@ -220,12 +220,12 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
removeIssueFromList: action.bound,
|
||||
|
||||
createIssue: action,
|
||||
updateIssue: action,
|
||||
issueUpdate: action,
|
||||
createDraftIssue: action,
|
||||
updateDraftIssue: action,
|
||||
issueQuickAdd: action.bound,
|
||||
removeIssue: action.bound,
|
||||
archiveIssue: action.bound,
|
||||
issueArchive: action.bound,
|
||||
removeBulkIssues: action.bound,
|
||||
bulkArchiveIssues: action.bound,
|
||||
bulkUpdateProperties: action.bound,
|
||||
|
|
@ -539,7 +539,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @param shouldSync If False then only issue is to be updated in the store not call API to update
|
||||
* @returns
|
||||
*/
|
||||
async updateIssue(
|
||||
async issueUpdate(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
issueId: string,
|
||||
|
|
@ -656,7 +656,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @param projectId
|
||||
* @param issueId
|
||||
*/
|
||||
async archiveIssue(workspaceSlug: string, projectId: string, issueId: string) {
|
||||
async issueArchive(workspaceSlug: string, projectId: string, issueId: string) {
|
||||
try {
|
||||
// Male API call
|
||||
const response = await this.issueArchiveService.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
|
|
@ -759,7 +759,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
|
||||
runInAction(() => {
|
||||
issueIds.forEach((issueId) => {
|
||||
this.updateIssue(
|
||||
this.issueUpdate(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
issueId,
|
||||
|
|
@ -855,7 +855,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
|
||||
// For Each issue update cycle Id by calling current store's update Issue, without making an API call
|
||||
issueIds.forEach((issueId) => {
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { cycle_id: cycleId }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: cycleId }, false);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
|
|
@ -883,7 +883,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
});
|
||||
|
||||
// update Issue cycle Id to null by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { cycle_id: null }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: null }, false);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
|
@ -897,7 +897,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
// If cycle Id is the current cycle Id, then, add issue to list of issueIds
|
||||
if (this.cycleId === cycleId) this.addIssueToList(issueId);
|
||||
// For Each issue update cycle Id by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { cycle_id: cycleId }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: cycleId }, false);
|
||||
});
|
||||
|
||||
await this.issueService.addIssueToCycle(workspaceSlug, projectId, cycleId, {
|
||||
|
|
@ -912,7 +912,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
// If cycle Id is the current cycle Id, then, remove issue to list of issueIds
|
||||
if (this.cycleId === cycleId) this.removeIssueFromList(issueId);
|
||||
// For Each issue update cycle Id to previous value by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { cycle_id: issueCycleId }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: issueCycleId }, false);
|
||||
});
|
||||
|
||||
throw error;
|
||||
|
|
@ -936,7 +936,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
// If cycle Id is the current cycle Id, then, add issue to list of issueIds
|
||||
if (this.cycleId === issueCycleId) this.removeIssueFromList(issueId);
|
||||
// For Each issue update cycle Id by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { cycle_id: null }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: null }, false);
|
||||
});
|
||||
|
||||
// make API call
|
||||
|
|
@ -950,7 +950,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
// If cycle Id is the current cycle Id, then, add issue to list of issueIds
|
||||
if (this.cycleId === issueCycleId) this.addIssueToList(issueId);
|
||||
// For Each issue update cycle Id by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { cycle_id: issueCycleId }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: issueCycleId }, false);
|
||||
});
|
||||
|
||||
throw error;
|
||||
|
|
@ -993,7 +993,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
issueIds.forEach((issueId) => {
|
||||
const issueModuleIds = get(this.rootIssueStore.issues.issuesMap, [issueId, "module_ids"]) ?? [];
|
||||
const updatedIssueModuleIds = uniq(concat(issueModuleIds, [moduleId]));
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { module_ids: updatedIssueModuleIds }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { module_ids: updatedIssueModuleIds }, false);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
|
|
@ -1031,7 +1031,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
issueIds.forEach((issueId) => {
|
||||
const issueModuleIds = get(this.rootIssueStore.issues.issuesMap, [issueId, "module_ids"]) ?? [];
|
||||
const updatedIssueModuleIds = pull(issueModuleIds, moduleId);
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { module_ids: updatedIssueModuleIds }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { module_ids: updatedIssueModuleIds }, false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1111,7 +1111,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
currentModuleIds = uniq(concat([...currentModuleIds], addModuleIds));
|
||||
|
||||
// For current Issue, update module Ids by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { module_ids: currentModuleIds }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { module_ids: currentModuleIds }, false);
|
||||
});
|
||||
|
||||
//Perform API call
|
||||
|
|
@ -1132,7 +1132,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
if (removeModuleIds.includes(this.moduleId ?? "")) this.addIssueToList(issueId);
|
||||
|
||||
// For current Issue, update module Ids by calling current store's update Issue, without making an API call
|
||||
this.updateIssue(workspaceSlug, projectId, issueId, { module_ids: originalModuleIds }, false);
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { module_ids: originalModuleIds }, false);
|
||||
});
|
||||
|
||||
throw error;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -251,5 +251,8 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
|
|||
}
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
updateIssue = this.issueUpdate;
|
||||
archiveIssue = this.issueArchive;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,6 +208,11 @@ export class ProfileIssues extends BaseIssuesStore implements IProfileIssues {
|
|||
return await this.fetchIssues(workspaceSlug, userId, loadType, this.paginationOptions, this.currentView, true);
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
updateIssue = this.issueUpdate;
|
||||
archiveIssue = this.issueArchive;
|
||||
|
||||
// Setting them as undefined as they can not performed on profile issues
|
||||
quickAddIssue = undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,9 @@ export class ProjectViewIssues extends BaseIssuesStore implements IProjectViewIs
|
|||
return await this.fetchIssues(workspaceSlug, projectId, viewId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
quickAddIssue = this.issueQuickAdd;
|
||||
updateIssue = this.issueUpdate;
|
||||
archiveIssue = this.issueArchive;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,6 +165,9 @@ export class ProjectIssues extends BaseIssuesStore implements IProjectIssues {
|
|||
return await this.fetchIssues(workspaceSlug, projectId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
quickAddIssue = this.issueQuickAdd;
|
||||
updateIssue = this.issueUpdate;
|
||||
archiveIssue = this.issueArchive;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,11 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues
|
|||
return await this.fetchIssues(workspaceSlug, viewId, loadType, this.paginationOptions, true);
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
archiveBulkIssues = this.bulkArchiveIssues;
|
||||
updateIssue = this.issueUpdate;
|
||||
archiveIssue = this.issueArchive;
|
||||
|
||||
// Setting them as undefined as they can not performed on workspace issues
|
||||
quickAddIssue = undefined;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue