mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: build errors in the inbox store and updated the types for filters, display_filters and display_properties in the global views
This commit is contained in:
parent
5674acd985
commit
05e4311e06
14
packages/types/src/view.d.ts
vendored
14
packages/types/src/view.d.ts
vendored
@ -53,22 +53,16 @@ export type TViewDisplayProperties = {
|
|||||||
updated_on: boolean;
|
updated_on: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TViewProps = {
|
|
||||||
filters: TViewFilters;
|
|
||||||
display_filters: TViewDisplayFilters;
|
|
||||||
display_properties: TViewDisplayProperties;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type TView = {
|
export type TView = {
|
||||||
id: string;
|
id: string;
|
||||||
workspace: string;
|
workspace: string;
|
||||||
project: string | undefined;
|
project: string | undefined;
|
||||||
name: string;
|
name: string;
|
||||||
description: string | undefined;
|
description: string;
|
||||||
query: string;
|
query: string;
|
||||||
filters: undefined;
|
filters: TViewFilters;
|
||||||
display_filters: undefined;
|
display_filters: TViewDisplayFilters;
|
||||||
display_properties: undefined;
|
display_properties: TViewDisplayProperties;
|
||||||
access: TViewAccess;
|
access: TViewAccess;
|
||||||
owned_by: string;
|
owned_by: string;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
|
@ -18,7 +18,7 @@ import { Button } from "@plane/ui";
|
|||||||
// icons
|
// icons
|
||||||
import { CheckCircle2, ChevronDown, ChevronUp, Clock, FileStack, Trash2, XCircle } from "lucide-react";
|
import { CheckCircle2, ChevronDown, ChevronUp, Clock, FileStack, Trash2, XCircle } from "lucide-react";
|
||||||
// types
|
// types
|
||||||
import type { TInboxStatus, TInboxDetailedStatus } from "@plane/types";
|
import type { TInboxDetailedStatus } from "@plane/types";
|
||||||
import { EUserProjectRoles } from "constants/project";
|
import { EUserProjectRoles } from "constants/project";
|
||||||
|
|
||||||
type TInboxIssueActionsHeader = {
|
type TInboxIssueActionsHeader = {
|
||||||
@ -29,7 +29,7 @@ type TInboxIssueActionsHeader = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type TInboxIssueOperations = {
|
type TInboxIssueOperations = {
|
||||||
updateInboxIssueStatus: (data: TInboxStatus) => Promise<void>;
|
updateInboxIssueStatus: (data: TInboxDetailedStatus) => Promise<void>;
|
||||||
removeInboxIssue: () => Promise<void>;
|
removeInboxIssue: () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
import { APIService } from "services/api.service";
|
|
||||||
// helpers
|
|
||||||
import { API_BASE_URL } from "helpers/common.helper";
|
|
||||||
// types
|
|
||||||
import type { IInboxIssue, IInbox, TInboxStatus, IInboxQueryParams } from "@plane/types";
|
|
||||||
|
|
||||||
export class InboxService extends APIService {
|
|
||||||
constructor() {
|
|
||||||
super(API_BASE_URL);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getInboxes(workspaceSlug: string, projectId: string): Promise<IInbox[]> {
|
|
||||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/`)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getInboxById(workspaceSlug: string, projectId: string, inboxId: string): Promise<IInbox> {
|
|
||||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/`)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async patchInbox(workspaceSlug: string, projectId: string, inboxId: string, data: Partial<IInbox>): Promise<any> {
|
|
||||||
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/`, data)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getInboxIssues(
|
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
inboxId: string,
|
|
||||||
params?: IInboxQueryParams
|
|
||||||
): Promise<IInboxIssue[]> {
|
|
||||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/`, {
|
|
||||||
params,
|
|
||||||
})
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getInboxIssueById(
|
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
inboxId: string,
|
|
||||||
inboxIssueId: string
|
|
||||||
): Promise<IInboxIssue> {
|
|
||||||
return this.get(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteInboxIssue(
|
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
inboxId: string,
|
|
||||||
inboxIssueId: string
|
|
||||||
): Promise<any> {
|
|
||||||
return this.delete(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async markInboxStatus(
|
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
inboxId: string,
|
|
||||||
inboxIssueId: string,
|
|
||||||
data: TInboxStatus
|
|
||||||
): Promise<IInboxIssue> {
|
|
||||||
return this.patch(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async patchInboxIssue(
|
|
||||||
workspaceSlug: string,
|
|
||||||
projectId: string,
|
|
||||||
inboxId: string,
|
|
||||||
inboxIssueId: string,
|
|
||||||
data: { issue: Partial<IInboxIssue> }
|
|
||||||
): Promise<any> {
|
|
||||||
return this.patch(
|
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/${inboxIssueId}/`,
|
|
||||||
data
|
|
||||||
)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async createInboxIssue(workspaceSlug: string, projectId: string, inboxId: string, data: any): Promise<IInboxIssue> {
|
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/inboxes/${inboxId}/inbox-issues/`, data)
|
|
||||||
.then((response) => response?.data)
|
|
||||||
.catch((error) => {
|
|
||||||
throw error?.response?.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ import { observable, action, makeObservable, runInAction, computed } from "mobx"
|
|||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
// services
|
// services
|
||||||
import { InboxService } from "services/inbox.service";
|
import { InboxService } from "services/inbox/inbox.service";
|
||||||
// types
|
// types
|
||||||
import { RootStore } from "store/root.store";
|
import { RootStore } from "store/root.store";
|
||||||
import { TInboxIssueFilterOptions, TInboxIssueFilters, TInboxIssueQueryParams, TInbox } from "@plane/types";
|
import { TInboxIssueFilterOptions, TInboxIssueFilters, TInboxIssueQueryParams, TInbox } from "@plane/types";
|
||||||
|
@ -53,7 +53,7 @@ export class ViewRoot implements TViewRoot {
|
|||||||
fetch = async () => {
|
fetch = async () => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const views = await this.service.fetch(workspaceSlug, projectId);
|
const views = await this.service.fetch(workspaceSlug, projectId);
|
||||||
if (!views) return;
|
if (!views) return;
|
||||||
@ -69,7 +69,7 @@ export class ViewRoot implements TViewRoot {
|
|||||||
create = async (_view: Partial<TView>) => {
|
create = async (_view: Partial<TView>) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.create(workspaceSlug, _view, projectId);
|
const view = await this.service.create(workspaceSlug, _view, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
@ -83,7 +83,7 @@ export class ViewRoot implements TViewRoot {
|
|||||||
delete = async (viewId: string) => {
|
delete = async (viewId: string) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
await this.service.remove(workspaceSlug, viewId, projectId);
|
await this.service.remove(workspaceSlug, viewId, projectId);
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export class ViewRoot implements TViewRoot {
|
|||||||
duplicate = async (viewId: string) => {
|
duplicate = async (viewId: string) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.duplicate(workspaceSlug, viewId, projectId);
|
const view = await this.service.duplicate(workspaceSlug, viewId, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
|
@ -12,9 +12,9 @@ export type TViews = TView & {
|
|||||||
// actions
|
// actions
|
||||||
updateName: (name: string) => Promise<void>;
|
updateName: (name: string) => Promise<void>;
|
||||||
updateDescription: (description: string) => Promise<void>;
|
updateDescription: (description: string) => Promise<void>;
|
||||||
updateFilters: (filters: TViewFilters) => Promise<void>;
|
updateFilters: (filters: Partial<TViewFilters>) => Promise<void>;
|
||||||
updateDisplayFilters: (display_filters: TViewDisplayFilters) => Promise<void>;
|
updateDisplayFilters: (display_filters: Partial<TViewDisplayFilters>) => Promise<void>;
|
||||||
updateDisplayProperties: (display_properties: TViewDisplayProperties) => Promise<void>;
|
updateDisplayProperties: (display_properties: Partial<TViewDisplayProperties>) => Promise<void>;
|
||||||
lockView: () => Promise<void>;
|
lockView: () => Promise<void>;
|
||||||
unlockView: () => Promise<void>;
|
unlockView: () => Promise<void>;
|
||||||
};
|
};
|
||||||
@ -24,11 +24,11 @@ export class Views implements TViews {
|
|||||||
workspace: string;
|
workspace: string;
|
||||||
project: string | undefined;
|
project: string | undefined;
|
||||||
name: string;
|
name: string;
|
||||||
description: string | undefined;
|
description: string;
|
||||||
query: string;
|
query: string;
|
||||||
filters: undefined;
|
filters: TViewFilters;
|
||||||
display_filters: undefined;
|
display_filters: TViewDisplayFilters;
|
||||||
display_properties: undefined;
|
display_properties: TViewDisplayProperties;
|
||||||
access: TViewAccess;
|
access: TViewAccess;
|
||||||
owned_by: string;
|
owned_by: string;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
@ -82,7 +82,7 @@ export class Views implements TViews {
|
|||||||
updateName = async (name: string) => {
|
updateName = async (name: string) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.update(workspaceSlug, this.id, { name: name }, projectId);
|
const view = await this.service.update(workspaceSlug, this.id, { name: name }, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
@ -96,7 +96,7 @@ export class Views implements TViews {
|
|||||||
updateDescription = async (description: string) => {
|
updateDescription = async (description: string) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.update(workspaceSlug, this.id, { description: description }, projectId);
|
const view = await this.service.update(workspaceSlug, this.id, { description: description }, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
@ -107,12 +107,15 @@ export class Views implements TViews {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updateFilters = async (filters: any) => {
|
updateFilters = async (filters: Partial<TViewFilters>) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.update(workspaceSlug, this.id, { filters: filters }, projectId);
|
const viewFilters = this.filters;
|
||||||
|
const _filters = { ...viewFilters, ...filters };
|
||||||
|
|
||||||
|
const view = await this.service.update(workspaceSlug, this.id, { filters: _filters }, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
|
|
||||||
this.filters = view.filters;
|
this.filters = view.filters;
|
||||||
@ -121,12 +124,15 @@ export class Views implements TViews {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updateDisplayFilters = async (display_filters: any) => {
|
updateDisplayFilters = async (display_filters: Partial<TViewDisplayFilters>) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.update(workspaceSlug, this.id, { display_filters: display_filters }, projectId);
|
const viewDisplayFilters = this.display_filters;
|
||||||
|
const _filters = { ...viewDisplayFilters, ...display_filters };
|
||||||
|
|
||||||
|
const view = await this.service.update(workspaceSlug, this.id, { display_filters: _filters }, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
|
|
||||||
this.display_filters = view.display_filters;
|
this.display_filters = view.display_filters;
|
||||||
@ -135,17 +141,15 @@ export class Views implements TViews {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updateDisplayProperties = async (display_properties: any) => {
|
updateDisplayProperties = async (display_properties: Partial<TViewDisplayProperties>) => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.update(
|
const viewDisplayProperties = this.display_properties;
|
||||||
workspaceSlug,
|
const _filters = { ...viewDisplayProperties, ...display_properties };
|
||||||
this.id,
|
|
||||||
{ display_properties: display_properties },
|
const view = await this.service.update(workspaceSlug, this.id, { display_properties: _filters }, projectId);
|
||||||
projectId
|
|
||||||
);
|
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
|
|
||||||
this.display_properties = view.display_properties;
|
this.display_properties = view.display_properties;
|
||||||
@ -157,7 +161,7 @@ export class Views implements TViews {
|
|||||||
lockView = async () => {
|
lockView = async () => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.lock(workspaceSlug, this.id, projectId);
|
const view = await this.service.lock(workspaceSlug, this.id, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
@ -171,7 +175,7 @@ export class Views implements TViews {
|
|||||||
unlockView = async () => {
|
unlockView = async () => {
|
||||||
try {
|
try {
|
||||||
const { workspaceSlug, projectId } = this.store.app.router;
|
const { workspaceSlug, projectId } = this.store.app.router;
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
const view = await this.service.unlock(workspaceSlug, this.id, projectId);
|
const view = await this.service.unlock(workspaceSlug, this.id, projectId);
|
||||||
if (!view) return;
|
if (!view) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user