[WEB-5282] chore: triage state in intake (#8135)
* chore: traige state in intake * chore: triage state changes * feat: implement intake state dropdown component and integrate into issue properties * chore: added the triage state validation * chore: added triage state filter * chore: added workspace filter * fix: migration file * chore: added triage group state check * chore: updated the filters * chore: updated the filters * chore: added variables for intake state * fix: import error * refactor: improve project intake state retrieval logic and update TriageGroupIcon component * chore: changed the intake validation logic * refactor: update intake state types and clean up unused interfaces * chore: changed the state color * chore: changed the update serializer * chore: updated with current instance * chore: update TriageGroupIcon color to match new intake state group color * chore: stringified value * chore: added validation in serializer * chore: added logger instead of print * fix: correct component closing syntax in ActiveProjectItem * chore: updated the migration file * chore: added noop in migation --------- Co-authored-by: b-saikrishnakanth <bsaikrishnakanth97@gmail.com>
This commit is contained in:
parent
dbc5a6348d
commit
78fbdde165
36 changed files with 952 additions and 181 deletions
|
|
@ -469,8 +469,9 @@ export class ProjectInboxStore implements IProjectInboxStore {
|
|||
);
|
||||
});
|
||||
return inboxIssueResponse;
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error("Error creating the intake issue");
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { action, computed, makeObservable, observable, runInAction } from "mobx"
|
|||
import { computedFn } from "mobx-utils";
|
||||
// plane imports
|
||||
import { STATE_GROUPS } from "@plane/constants";
|
||||
import type { IState } from "@plane/types";
|
||||
import type { IIntakeState, IState } from "@plane/types";
|
||||
// helpers
|
||||
import { sortStates } from "@plane/utils";
|
||||
// plane web
|
||||
|
|
@ -13,19 +13,25 @@ import type { RootStore } from "@/plane-web/store/root.store";
|
|||
export interface IStateStore {
|
||||
//Loaders
|
||||
fetchedMap: Record<string, boolean>;
|
||||
fetchedIntakeMap: Record<string, boolean>;
|
||||
// observables
|
||||
stateMap: Record<string, IState>;
|
||||
intakeStateMap: Record<string, IIntakeState>;
|
||||
// computed
|
||||
workspaceStates: IState[] | undefined;
|
||||
projectStates: IState[] | undefined;
|
||||
groupedProjectStates: Record<string, IState[]> | undefined;
|
||||
// computed actions
|
||||
getStateById: (stateId: string | null | undefined) => IState | undefined;
|
||||
getIntakeStateById: (intakeStateId: string | null | undefined) => IIntakeState | undefined;
|
||||
getProjectStates: (projectId: string | null | undefined) => IState[] | undefined;
|
||||
getProjectIntakeState: (projectId: string | null | undefined) => IIntakeState | undefined;
|
||||
getProjectStateIds: (projectId: string | null | undefined) => string[] | undefined;
|
||||
getProjectIntakeStateIds: (projectId: string | null | undefined) => string[] | undefined;
|
||||
getProjectDefaultStateId: (projectId: string | null | undefined) => string | undefined;
|
||||
// fetch actions
|
||||
fetchProjectStates: (workspaceSlug: string, projectId: string) => Promise<IState[]>;
|
||||
fetchProjectIntakeState: (workspaceSlug: string, projectId: string) => Promise<IIntakeState>;
|
||||
fetchWorkspaceStates: (workspaceSlug: string) => Promise<IState[]>;
|
||||
// crud actions
|
||||
createState: (workspaceSlug: string, projectId: string, data: Partial<IState>) => Promise<IState>;
|
||||
|
|
@ -49,8 +55,10 @@ export interface IStateStore {
|
|||
|
||||
export class StateStore implements IStateStore {
|
||||
stateMap: Record<string, IState> = {};
|
||||
intakeStateMap: Record<string, IIntakeState> = {};
|
||||
//loaders
|
||||
fetchedMap: Record<string, boolean> = {};
|
||||
fetchedIntakeMap: Record<string, boolean> = {};
|
||||
rootStore: RootStore;
|
||||
router;
|
||||
stateService: ProjectStateService;
|
||||
|
|
@ -59,12 +67,15 @@ export class StateStore implements IStateStore {
|
|||
makeObservable(this, {
|
||||
// observables
|
||||
stateMap: observable,
|
||||
intakeStateMap: observable,
|
||||
fetchedMap: observable,
|
||||
fetchedIntakeMap: observable,
|
||||
// computed
|
||||
projectStates: computed,
|
||||
groupedProjectStates: computed,
|
||||
// fetch action
|
||||
fetchProjectStates: action,
|
||||
fetchProjectIntakeState: action,
|
||||
// CRUD actions
|
||||
createState: action,
|
||||
updateState: action,
|
||||
|
|
@ -127,6 +138,15 @@ export class StateStore implements IStateStore {
|
|||
return this.stateMap[stateId] ?? undefined;
|
||||
});
|
||||
|
||||
/**
|
||||
* @description returns intake state details using intake state id
|
||||
* @param intakeStateId
|
||||
*/
|
||||
getIntakeStateById = computedFn((intakeStateId: string | null | undefined) => {
|
||||
if (!this.intakeStateMap || !intakeStateId) return;
|
||||
return this.intakeStateMap[intakeStateId] ?? undefined;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the stateMap belongs to a project by projectId
|
||||
* @param projectId
|
||||
|
|
@ -138,6 +158,16 @@ export class StateStore implements IStateStore {
|
|||
return sortStates(Object.values(this.stateMap).filter((state) => state.project_id === projectId));
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the intake state for a project by projectId
|
||||
* @param projectId
|
||||
* @returns IIntakeState | undefined
|
||||
*/
|
||||
getProjectIntakeState = computedFn((projectId: string | null | undefined) => {
|
||||
if (!projectId || !this.fetchedIntakeMap[projectId]) return;
|
||||
return Object.values(this.intakeStateMap).find((state) => state.project_id === projectId);
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the state ids for a project by projectId
|
||||
* @param projectId
|
||||
|
|
@ -151,6 +181,18 @@ export class StateStore implements IStateStore {
|
|||
return projectStates?.map((state) => state.id) ?? [];
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the intake state ids for a project by projectId
|
||||
* @param projectId
|
||||
* @returns string[]
|
||||
*/
|
||||
getProjectIntakeStateIds = computedFn((projectId: string | null | undefined) => {
|
||||
const workspaceSlug = this.router.workspaceSlug;
|
||||
if (!workspaceSlug || !projectId || !this.fetchedIntakeMap[projectId]) return undefined;
|
||||
const projectIntakeState = this.getProjectIntakeState(projectId);
|
||||
return projectIntakeState?.id ? [projectIntakeState.id] : [];
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the default state id for a project
|
||||
* @param projectId
|
||||
|
|
@ -178,6 +220,21 @@ export class StateStore implements IStateStore {
|
|||
return statesResponse;
|
||||
};
|
||||
|
||||
/**
|
||||
* fetches the intakeStateMap of a project
|
||||
* @param workspaceSlug
|
||||
* @param projectId
|
||||
* @returns
|
||||
*/
|
||||
fetchProjectIntakeState = async (workspaceSlug: string, projectId: string) => {
|
||||
const intakeStateResponse = await this.stateService.getIntakeState(workspaceSlug, projectId);
|
||||
runInAction(() => {
|
||||
set(this.intakeStateMap, [intakeStateResponse.id], intakeStateResponse);
|
||||
set(this.fetchedIntakeMap, projectId, true);
|
||||
});
|
||||
return intakeStateResponse;
|
||||
};
|
||||
|
||||
/**
|
||||
* fetches the stateMap of all the states in workspace
|
||||
* @param workspaceSlug
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue