mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix state and label types
This commit is contained in:
parent
2bb0a89679
commit
f7586ba046
3
packages/types/src/issues.d.ts
vendored
3
packages/types/src/issues.d.ts
vendored
@ -110,10 +110,9 @@ export type IssuePriorities = {
|
|||||||
export interface IIssueLabel {
|
export interface IIssueLabel {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
|
||||||
color: string;
|
color: string;
|
||||||
project_id: string;
|
project_id: string;
|
||||||
workspace_slug: string;
|
workspace__slug: string;
|
||||||
parent: string | null;
|
parent: string | null;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
}
|
}
|
||||||
|
11
packages/types/src/state.d.ts
vendored
11
packages/types/src/state.d.ts
vendored
@ -5,20 +5,13 @@ export type TStateGroups = "backlog" | "unstarted" | "started" | "completed" | "
|
|||||||
export interface IState {
|
export interface IState {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
color: string;
|
color: string;
|
||||||
readonly created_at: Date;
|
|
||||||
readonly created_by: string;
|
|
||||||
default: boolean;
|
default: boolean;
|
||||||
description: string;
|
description: string;
|
||||||
group: TStateGroups;
|
group: TStateGroups;
|
||||||
name: string;
|
name: string;
|
||||||
project: string;
|
project_id: string;
|
||||||
readonly project_detail: IProjectLite;
|
|
||||||
sequence: number;
|
sequence: number;
|
||||||
readonly slug: string;
|
workspace__slug: string;
|
||||||
readonly updated_at: Date;
|
|
||||||
readonly updated_by: string;
|
|
||||||
workspace: string;
|
|
||||||
workspace_detail: IWorkspaceLite;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IStateLite {
|
export interface IStateLite {
|
||||||
|
@ -58,9 +58,10 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
|
|||||||
const storeLabels = getProjectLabels(projectId);
|
const storeLabels = getProjectLabels(projectId);
|
||||||
|
|
||||||
const openDropDown = () => {
|
const openDropDown = () => {
|
||||||
|
if (!storeLabels && workspaceSlug && projectId) {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
if (!storeLabels && workspaceSlug && projectId)
|
|
||||||
fetchProjectLabels(workspaceSlug, projectId).then(() => setIsLoading(false));
|
fetchProjectLabels(workspaceSlug, projectId).then(() => setIsLoading(false));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const { styles, attributes } = usePopper(referenceElement, popperElement, {
|
const { styles, attributes } = usePopper(referenceElement, popperElement, {
|
||||||
|
@ -42,7 +42,7 @@ export const DeleteStateModal: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
setIsDeleteLoading(true);
|
setIsDeleteLoading(true);
|
||||||
|
|
||||||
await deleteState(workspaceSlug.toString(), data.project, data.id)
|
await deleteState(workspaceSlug.toString(), data.project_id, data.id)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
postHogEventTracker("STATE_DELETE", {
|
postHogEventTracker("STATE_DELETE", {
|
||||||
state: "SUCCESS",
|
state: "SUCCESS",
|
||||||
|
@ -82,7 +82,7 @@ export class LabelStore implements ILabelStore {
|
|||||||
const currentWorkspaceDetails = this.rootStore.workspaceRoot.currentWorkspace;
|
const currentWorkspaceDetails = this.rootStore.workspaceRoot.currentWorkspace;
|
||||||
const worksapceSlug = this.rootStore.app.router.workspaceSlug || "";
|
const worksapceSlug = this.rootStore.app.router.workspaceSlug || "";
|
||||||
if (!currentWorkspaceDetails || !this.fetchedMap[worksapceSlug]) return;
|
if (!currentWorkspaceDetails || !this.fetchedMap[worksapceSlug]) return;
|
||||||
return Object.values(this.labelMap).filter((label) => label.workspace_slug === currentWorkspaceDetails.slug);
|
return Object.values(this.labelMap).filter((label) => label.workspace__slug === currentWorkspaceDetails.slug);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ export class StateStore implements IStateStore {
|
|||||||
const projectId = this.router.projectId;
|
const projectId = this.router.projectId;
|
||||||
const worksapceSlug = this.router.workspaceSlug || "";
|
const worksapceSlug = this.router.workspaceSlug || "";
|
||||||
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug])) return;
|
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug])) return;
|
||||||
return Object.values(this.stateMap).filter((state) => state.project === this.router.query.projectId);
|
return Object.values(this.stateMap).filter((state) => state.project_id === projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +106,7 @@ export class StateStore implements IStateStore {
|
|||||||
getProjectStates = computedFn((projectId: string) => {
|
getProjectStates = computedFn((projectId: string) => {
|
||||||
const worksapceSlug = this.router.workspaceSlug || "";
|
const worksapceSlug = this.router.workspaceSlug || "";
|
||||||
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug])) return;
|
if (!projectId || !(this.fetchedMap[projectId] || this.fetchedMap[worksapceSlug])) return;
|
||||||
return Object.values(this.stateMap).filter((state) => state.project === projectId);
|
return Object.values(this.stateMap).filter((state) => state.project_id === projectId);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,7 +208,7 @@ export class StateStore implements IStateStore {
|
|||||||
markStateAsDefault = async (workspaceSlug: string, projectId: string, stateId: string) => {
|
markStateAsDefault = async (workspaceSlug: string, projectId: string, stateId: string) => {
|
||||||
const originalStates = this.stateMap;
|
const originalStates = this.stateMap;
|
||||||
const currentDefaultState = Object.values(this.stateMap).find(
|
const currentDefaultState = Object.values(this.stateMap).find(
|
||||||
(state) => state.project === projectId && state.default
|
(state) => state.project_id === projectId && state.default
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user