mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: merge conflicts resolved
This commit is contained in:
commit
822ae138dc
@ -9,7 +9,7 @@ export interface IEventTrackerStore {
|
||||
postHogEventTracker: (
|
||||
eventName: string,
|
||||
payload: object | [] | null,
|
||||
group?: { isGrouping: boolean | null; groupType: string | null; gorupId: string | null } | null
|
||||
group?: { isGrouping: boolean | null; groupType: string | null; groupId: string | null } | null
|
||||
) => void;
|
||||
}
|
||||
|
||||
@ -32,16 +32,19 @@ export class EventTrackerStore implements IEventTrackerStore {
|
||||
postHogEventTracker = (
|
||||
eventName: string,
|
||||
payload: object | [] | null,
|
||||
group?: { isGrouping: boolean | null; groupType: string | null; gorupId: string | null } | null
|
||||
group?: { isGrouping: boolean | null; groupType: string | null; groupId: string | null } | null
|
||||
) => {
|
||||
try {
|
||||
const currentWorkspaceDetails = this.rootStore.workspace.currentWorkspace;
|
||||
const currentProjectDetails = this.rootStore.project.projects.currentProjectDetails;
|
||||
|
||||
let extras: any = {
|
||||
workspace_name: this.rootStore.workspace.currentWorkspace?.name ?? "",
|
||||
workspace_id: this.rootStore.workspace.currentWorkspace?.id ?? "",
|
||||
workspace_slug: this.rootStore.workspace.currentWorkspace?.slug ?? "",
|
||||
project_name: this.rootStore.project.currentProjectDetails?.name ?? "",
|
||||
project_id: this.rootStore.project.currentProjectDetails?.id ?? "",
|
||||
project_identifier: this.rootStore.project.currentProjectDetails?.identifier ?? "",
|
||||
workspace_name: currentWorkspaceDetails?.name ?? "",
|
||||
workspace_id: currentWorkspaceDetails?.id ?? "",
|
||||
workspace_slug: currentWorkspaceDetails?.slug ?? "",
|
||||
project_name: currentProjectDetails?.name ?? "",
|
||||
project_id: currentProjectDetails?.id ?? "",
|
||||
project_identifier: currentProjectDetails?.identifier ?? "",
|
||||
};
|
||||
if (["PROJECT_CREATED", "PROJECT_UPDATED"].includes(eventName)) {
|
||||
const project_details: any = payload as object;
|
||||
@ -54,9 +57,9 @@ export class EventTrackerStore implements IEventTrackerStore {
|
||||
}
|
||||
|
||||
if (group && group!.isGrouping === true) {
|
||||
posthog?.group(group!.groupType!, group!.gorupId!, {
|
||||
posthog?.group(group!.groupType!, group!.groupId!, {
|
||||
date: new Date(),
|
||||
workspace_id: group!.gorupId,
|
||||
workspace_id: group!.groupId,
|
||||
});
|
||||
posthog?.capture(eventName, {
|
||||
...payload,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { action, makeObservable, observable } from "mobx";
|
||||
import { action, makeObservable, observable, computed } from "mobx";
|
||||
import { ParsedUrlQuery } from "node:querystring";
|
||||
|
||||
export interface IRouterStore {
|
||||
@ -12,6 +12,9 @@ export interface IRouterStore {
|
||||
viewId: string | undefined;
|
||||
userId: string | undefined;
|
||||
peekId: string | undefined;
|
||||
issueId: string | undefined;
|
||||
inboxId: string | undefined;
|
||||
webhookId: string | undefined;
|
||||
}
|
||||
|
||||
export class RouterStore implements IRouterStore {
|
||||
@ -23,13 +26,16 @@ export class RouterStore implements IRouterStore {
|
||||
setQuery: action,
|
||||
|
||||
//computed
|
||||
workspaceSlug: action,
|
||||
projectId: action,
|
||||
cycleId: action,
|
||||
moduleId: action,
|
||||
viewId: action,
|
||||
userId: action,
|
||||
peekId: action,
|
||||
workspaceSlug: computed,
|
||||
projectId: computed,
|
||||
cycleId: computed,
|
||||
moduleId: computed,
|
||||
viewId: computed,
|
||||
userId: computed,
|
||||
peekId: computed,
|
||||
issueId: computed,
|
||||
inboxId: computed,
|
||||
webhookId: computed,
|
||||
});
|
||||
}
|
||||
|
||||
@ -38,7 +44,7 @@ export class RouterStore implements IRouterStore {
|
||||
}
|
||||
|
||||
get workspaceSlug() {
|
||||
return this.query?.workspace_slug?.toString();
|
||||
return this.query?.workspaceSlug?.toString();
|
||||
}
|
||||
|
||||
get projectId() {
|
||||
@ -60,7 +66,20 @@ export class RouterStore implements IRouterStore {
|
||||
get userId() {
|
||||
return this.query?.userId?.toString();
|
||||
}
|
||||
|
||||
get peekId() {
|
||||
return this.query?.peekId?.toString();
|
||||
}
|
||||
|
||||
get issueId() {
|
||||
return this.query?.issueId?.toString();
|
||||
}
|
||||
|
||||
get inboxId() {
|
||||
return this.query?.inboxId?.toString();
|
||||
}
|
||||
|
||||
get webhookId() {
|
||||
return this.query?.webhookId?.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,15 @@
|
||||
import { ProjectsStore } from "./projects.store";
|
||||
import { ProjectPublishStore } from "./project-publish.store";
|
||||
import { IProjectsStore, ProjectsStore } from "./projects.store";
|
||||
import { IProjectPublishStore, ProjectPublishStore } from "./project-publish.store";
|
||||
import { RootStore } from "store/root.store";
|
||||
|
||||
export interface IProjectRootStore {
|
||||
projects: IProjectsStore;
|
||||
publish: IProjectPublishStore;
|
||||
}
|
||||
|
||||
export class ProjectRootStore {
|
||||
projects: ProjectsStore;
|
||||
publish: ProjectPublishStore;
|
||||
projects: IProjectsStore;
|
||||
publish: IProjectPublishStore;
|
||||
|
||||
constructor(_root: RootStore) {
|
||||
this.projects = new ProjectsStore(_root);
|
||||
|
@ -1,29 +1,30 @@
|
||||
import { enableStaticRendering } from "mobx-react-lite";
|
||||
// root stores
|
||||
import { AppRootStore, IAppRootStore } from "./application";
|
||||
import { ProjectRootStore } from "./project";
|
||||
import { CycleStore } from "./cycle.store";
|
||||
import { ProjectViewsStore } from "./project-view.store";
|
||||
import { ModulesStore } from "./module.store";
|
||||
import { UserStore, IUserStore } from "./user";
|
||||
import { LabelStore, ILabelStore } from "./label.store";
|
||||
import { IProjectRootStore, ProjectRootStore } from "./project";
|
||||
import { CycleStore, ICycleStore } from "./cycle.store";
|
||||
import { IProjectViewsStore, ProjectViewsStore } from "./project-view.store";
|
||||
import { IModuleStore, ModulesStore } from "./module.store";
|
||||
import { IUserStore, UserStore } from "./user";
|
||||
import { ILabelStore, LabelStore } from "./label.store";
|
||||
import { IWorkspaceRootStore, WorkspaceRootStore } from "./workspace";
|
||||
|
||||
enableStaticRendering(typeof window === "undefined");
|
||||
|
||||
export class RootStore {
|
||||
app: IAppRootStore;
|
||||
user: IUserStore;
|
||||
// workspace;
|
||||
project;
|
||||
cycle;
|
||||
module;
|
||||
projectView;
|
||||
workspace: IWorkspaceRootStore;
|
||||
project: IProjectRootStore;
|
||||
cycle: ICycleStore;
|
||||
module: IModuleStore;
|
||||
projectView: IProjectViewsStore;
|
||||
label: ILabelStore;
|
||||
|
||||
constructor() {
|
||||
this.app = new AppRootStore(this);
|
||||
this.user = new UserStore(this);
|
||||
// this.workspace = new WorkspaceRootStore();
|
||||
this.workspace = new WorkspaceRootStore(this);
|
||||
this.project = new ProjectRootStore(this);
|
||||
this.cycle = new CycleStore(this);
|
||||
this.module = new ModulesStore(this);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { action, observable, runInAction, makeObservable, computed } from "mobx";
|
||||
import { action, observable, runInAction, makeObservable } from "mobx";
|
||||
// services
|
||||
import { UserService } from "services/user.service";
|
||||
import { AuthService } from "services/auth.service";
|
||||
@ -6,7 +6,7 @@ import { AuthService } from "services/auth.service";
|
||||
import { IUser, IUserSettings } from "types/users";
|
||||
// store
|
||||
import { RootStore } from "../root.store";
|
||||
import { UserMembershipStore } from "./user-membership.store";
|
||||
import { IUserMembershipStore, UserMembershipStore } from "./user-membership.store";
|
||||
|
||||
export interface IUserStore {
|
||||
loader: boolean;
|
||||
@ -33,7 +33,7 @@ export interface IUserStore {
|
||||
deactivateAccount: () => Promise<void>;
|
||||
signOut: () => Promise<void>;
|
||||
|
||||
membership: UserMembershipStore;
|
||||
membership: IUserMembershipStore;
|
||||
}
|
||||
|
||||
export class UserStore implements IUserStore {
|
||||
|
@ -5,10 +5,10 @@ import { IWorkspace } from "types";
|
||||
// services
|
||||
import { WorkspaceService } from "services/workspace.service";
|
||||
// sub-stores
|
||||
import { WebhookStore } from "./webhook.store";
|
||||
import { ApiTokenStore } from "./api-token.store";
|
||||
import { IWebhookStore, WebhookStore } from "./webhook.store";
|
||||
import { ApiTokenStore, IApiTokenStore } from "./api-token.store";
|
||||
|
||||
export interface IWorkspaceStore {
|
||||
export interface IWorkspaceRootStore {
|
||||
// states
|
||||
loader: boolean;
|
||||
error: any | null;
|
||||
@ -31,11 +31,11 @@ export interface IWorkspaceStore {
|
||||
deleteWorkspace: (workspaceSlug: string) => Promise<void>;
|
||||
|
||||
// sub-stores
|
||||
webhook: WebhookStore;
|
||||
apiToken: ApiTokenStore;
|
||||
webhook: IWebhookStore;
|
||||
apiToken: IApiTokenStore;
|
||||
}
|
||||
|
||||
export class WorkspaceStore implements IWorkspaceStore {
|
||||
export class WorkspaceRootStore implements IWorkspaceRootStore {
|
||||
// states
|
||||
loader: boolean = false;
|
||||
error: any | null = null;
|
||||
@ -88,11 +88,11 @@ export class WorkspaceStore implements IWorkspaceStore {
|
||||
* computed value of current workspace based on workspace slug saved in the query store
|
||||
*/
|
||||
get currentWorkspace() {
|
||||
const workspaceSlug = this.rootStore.app.router.query?.workspaceSlug;
|
||||
const workspaceSlug = this.rootStore.app.router.workspaceSlug;
|
||||
|
||||
if (!workspaceSlug) return null;
|
||||
|
||||
return this.workspaces?.find((workspace) => workspace.slug === workspaceSlug.toString()) || null;
|
||||
return this.workspaces?.find((workspace) => workspace.slug === workspaceSlug) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,17 +8,13 @@ export interface IWebhookStore {
|
||||
// states
|
||||
loader: boolean;
|
||||
error: any | null;
|
||||
|
||||
// observables
|
||||
webhooks: Record<string, IWebhook> | null;
|
||||
webhookSecretKey: string | null;
|
||||
|
||||
// computed
|
||||
currentWebhook: IWebhook | null;
|
||||
|
||||
// computed actions
|
||||
getWebhookById: (webhookId: string) => IWebhook | null;
|
||||
|
||||
// actions
|
||||
fetchWebhooks: (workspaceSlug: string) => Promise<IWebhook[]>;
|
||||
fetchWebhookById: (workspaceSlug: string, webhookId: string) => Promise<IWebhook>;
|
||||
@ -39,11 +35,9 @@ export class WebhookStore implements IWebhookStore {
|
||||
// states
|
||||
loader: boolean = false;
|
||||
error: any | null = null;
|
||||
|
||||
// observables
|
||||
webhooks: Record<string, IWebhook> | null = null;
|
||||
webhookSecretKey: string | null = null;
|
||||
|
||||
// services
|
||||
webhookService;
|
||||
// root store
|
||||
@ -54,17 +48,13 @@ export class WebhookStore implements IWebhookStore {
|
||||
// states
|
||||
loader: observable.ref,
|
||||
error: observable.ref,
|
||||
|
||||
// observables
|
||||
webhooks: observable,
|
||||
webhookSecretKey: observable.ref,
|
||||
|
||||
// computed
|
||||
currentWebhook: computed,
|
||||
|
||||
// computed actions
|
||||
getWebhookById: action,
|
||||
|
||||
// actions
|
||||
fetchWebhooks: action,
|
||||
fetchWebhookById: action,
|
||||
@ -85,7 +75,7 @@ export class WebhookStore implements IWebhookStore {
|
||||
* computed value of current webhook based on webhook id saved in the query store
|
||||
*/
|
||||
get currentWebhook() {
|
||||
const webhookId = this.rootStore.app.router.query?.webhookId;
|
||||
const webhookId = this.rootStore.app.router.webhookId;
|
||||
|
||||
if (!webhookId) return null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user