Merge pull request #3039 from makeplane/promote/qa-preview

[FED-1116] bug: cycle and module change not working from the peek overview
This commit is contained in:
sriram veeraghanta 2023-12-08 19:48:38 +05:30 committed by GitHub
commit 9538d9ee9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 27 deletions

View File

@ -48,10 +48,11 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
const { const {
user: { currentProjectRole }, user: { currentProjectRole },
issueDetail: { fetchPeekIssueDetails }, issueDetail: { fetchPeekIssueDetails },
project: { getProjectById },
} = useMobxStore(); } = useMobxStore();
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string }; const { workspaceSlug, projectId } = router.query;
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
@ -138,7 +139,7 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
const handleCycleOrModuleChange = async () => { const handleCycleOrModuleChange = async () => {
if (!workspaceSlug || !projectId) return; if (!workspaceSlug || !projectId) return;
await fetchPeekIssueDetails(workspaceSlug, projectId, issue.id); await fetchPeekIssueDetails(workspaceSlug.toString(), projectId.toString(), issue.id);
}; };
const handleEditLink = (link: ILinkDetails) => { const handleEditLink = (link: ILinkDetails) => {
@ -167,6 +168,9 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
}); });
}; };
const projectDetails = workspaceSlug ? getProjectById(workspaceSlug.toString(), issue.project) : null;
const isEstimateEnabled = projectDetails?.estimate;
const minDate = issue.start_date ? new Date(issue.start_date) : null; const minDate = issue.start_date ? new Date(issue.start_date) : null;
minDate?.setDate(minDate.getDate()); minDate?.setDate(minDate.getDate());
@ -230,19 +234,21 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
</div> </div>
{/* estimate */} {/* estimate */}
<div className="flex items-center gap-2 w-full"> {isEstimateEnabled && (
<div className="flex items-center gap-2 w-40 text-sm flex-shrink-0"> <div className="flex items-center gap-2 w-full">
<Triangle className="h-4 w-4 flex-shrink-0 " /> <div className="flex items-center gap-2 w-40 text-sm flex-shrink-0">
<p>Estimate</p> <Triangle className="h-4 w-4 flex-shrink-0 " />
<p>Estimate</p>
</div>
<div>
<SidebarEstimateSelect
value={issue.estimate_point}
onChange={handleEstimate}
disabled={disableUserActions}
/>
</div>
</div> </div>
<div> )}
<SidebarEstimateSelect
value={issue.estimate_point}
onChange={handleEstimate}
disabled={disableUserActions}
/>
</div>
</div>
{/* start date */} {/* start date */}
<div className="flex items-center gap-2 w-full"> <div className="flex items-center gap-2 w-full">

View File

@ -5,7 +5,7 @@ import { IssueBaseStore } from "store/issues";
import { IssueService } from "services/issue"; import { IssueService } from "services/issue";
import { CycleService } from "services/cycle.service"; import { CycleService } from "services/cycle.service";
// types // types
import { CycleIssueResponse, TIssueGroupByOptions } from "types"; import { TIssueGroupByOptions } from "types";
import { IIssue } from "types/issues"; import { IIssue } from "types/issues";
import { IIssueResponse, TLoader, IGroupedIssues, ISubGroupedIssues, TUnGroupedIssues, ViewFlags } from "../../types"; import { IIssueResponse, TLoader, IGroupedIssues, ISubGroupedIssues, TUnGroupedIssues, ViewFlags } from "../../types";
import { RootStore } from "store/root"; import { RootStore } from "store/root";
@ -83,9 +83,6 @@ export class CycleIssuesStore extends IssueBaseStore implements ICycleIssuesStor
cycleService; cycleService;
issueService; issueService;
//projectId
currentProjectId: string | undefined;
//viewData //viewData
viewFlags = { viewFlags = {
enableQuickAdd: true, enableQuickAdd: true,
@ -174,8 +171,6 @@ export class CycleIssuesStore extends IssueBaseStore implements ICycleIssuesStor
try { try {
this.loader = loadType; this.loader = loadType;
this.currentProjectId = projectId;
const params = this.rootStore?.cycleIssuesFilter?.appliedFilters; const params = this.rootStore?.cycleIssuesFilter?.appliedFilters;
const response = await this.cycleService.getCycleIssuesWithParams(workspaceSlug, projectId, cycleId, params); const response = await this.cycleService.getCycleIssuesWithParams(workspaceSlug, projectId, cycleId, params);
@ -322,9 +317,10 @@ export class CycleIssuesStore extends IssueBaseStore implements ICycleIssuesStor
fetchAfterAddition = true, fetchAfterAddition = true,
projectId?: string projectId?: string
) => { ) => {
if (!this.currentProjectId && !projectId) return; const activeProjectId = this.rootStore.project.projectId;
if (!activeProjectId && !projectId) return;
const projectIdToUpdate: string = this.currentProjectId || projectId || ""; const projectIdToUpdate: string = projectId || activeProjectId || "";
try { try {
const issueToCycle = await this.issueService.addIssueToCycle(workspaceSlug, projectIdToUpdate, cycleId, { const issueToCycle = await this.issueService.addIssueToCycle(workspaceSlug, projectIdToUpdate, cycleId, {

View File

@ -76,8 +76,6 @@ export class ModuleIssuesStore extends IssueBaseStore implements IModuleIssuesSt
moduleService; moduleService;
issueService; issueService;
currentProjectId: string | undefined;
//viewData //viewData
viewFlags = { viewFlags = {
enableQuickAdd: true, enableQuickAdd: true,
@ -162,7 +160,6 @@ export class ModuleIssuesStore extends IssueBaseStore implements IModuleIssuesSt
) => { ) => {
if (!moduleId) return undefined; if (!moduleId) return undefined;
this.currentProjectId = projectId;
try { try {
this.loader = loadType; this.loader = loadType;
@ -314,9 +311,10 @@ export class ModuleIssuesStore extends IssueBaseStore implements IModuleIssuesSt
fetchAfterAddition = true, fetchAfterAddition = true,
projectId?: string projectId?: string
) => { ) => {
if (!this.currentProjectId && !projectId) return; const activeProjectId = this.rootStore.project.projectId;
if (!activeProjectId && !projectId) return;
const projectIdToUpdate: string = this.currentProjectId || projectId || ""; const projectIdToUpdate: string = projectId || activeProjectId || "";
try { try {
const issueToModule = await this.moduleService.addIssuesToModule(workspaceSlug, projectIdToUpdate, moduleId, { const issueToModule = await this.moduleService.addIssuesToModule(workspaceSlug, projectIdToUpdate, moduleId, {