mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
added project states events
This commit is contained in:
parent
97eea75cb7
commit
ffc987bcc8
@ -8,7 +8,7 @@ import type { IState } from "@plane/types";
|
||||
// ui
|
||||
import { Button, CustomSelect, Input, Tooltip, TOAST_TYPE, setToast } from "@plane/ui";
|
||||
// constants
|
||||
import { STATE_CREATED, STATE_UPDATED } from "@/constants/event-tracker";
|
||||
import { E_STATES, STATE_CREATED, STATE_UPDATED } from "@/constants/event-tracker";
|
||||
import { GROUP_CHOICES } from "@/constants/project";
|
||||
// hooks
|
||||
import { useEventTracker, useProjectState } from "@/hooks/store";
|
||||
@ -43,7 +43,7 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
// form info
|
||||
const {
|
||||
handleSubmit,
|
||||
formState: { errors, isSubmitting },
|
||||
formState: { errors, isSubmitting, dirtyFields },
|
||||
watch,
|
||||
reset,
|
||||
control,
|
||||
@ -91,7 +91,7 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
payload: {
|
||||
...res,
|
||||
state: "SUCCESS",
|
||||
element: "Project settings states page",
|
||||
element: E_STATES,
|
||||
},
|
||||
});
|
||||
})
|
||||
@ -114,7 +114,7 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
payload: {
|
||||
...formData,
|
||||
state: "FAILED",
|
||||
element: "Project settings states page",
|
||||
element: E_STATES,
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -130,8 +130,9 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
eventName: STATE_UPDATED,
|
||||
payload: {
|
||||
...res,
|
||||
change_details: Object.keys(dirtyFields),
|
||||
state: "SUCCESS",
|
||||
element: "Project settings states page",
|
||||
element: E_STATES,
|
||||
},
|
||||
});
|
||||
setToast({
|
||||
@ -158,7 +159,7 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
payload: {
|
||||
...formData,
|
||||
state: "FAILED",
|
||||
element: "Project settings states page",
|
||||
element: E_STATES,
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -292,9 +293,7 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
variant="primary"
|
||||
type="submit"
|
||||
loading={isSubmitting}
|
||||
onClick={() => {
|
||||
setTrackElement("PROJECT_SETTINGS_STATE_PAGE");
|
||||
}}
|
||||
onClick={() => setTrackElement(E_STATES)}
|
||||
size="sm"
|
||||
>
|
||||
{data ? (isSubmitting ? "Updating" : "Update") : isSubmitting ? "Creating" : "Create"}
|
||||
|
@ -7,6 +7,8 @@ import { Pencil, X, ArrowDown, ArrowUp } from "lucide-react";
|
||||
import { IState } from "@plane/types";
|
||||
// ui
|
||||
import { Tooltip, StateGroupIcon } from "@plane/ui";
|
||||
// constants
|
||||
import { E_STATES } from "@/constants/event-tracker";
|
||||
// hooks
|
||||
import { useEventTracker, useProjectState } from "@/hooks/store";
|
||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||
@ -103,7 +105,7 @@ export const StatesListItem: React.FC<Props> = observer((props) => {
|
||||
state.default || groupLength === 1 ? "cursor-not-allowed" : ""
|
||||
} grid place-items-center`}
|
||||
onClick={() => {
|
||||
setTrackElement("PROJECT_SETTINGS_STATE_PAGE");
|
||||
setTrackElement(E_STATES);
|
||||
handleDeleteState();
|
||||
}}
|
||||
disabled={state.default || groupLength === 1}
|
||||
|
@ -138,6 +138,7 @@ export const getProjectStateEventPayload = (payload: any) => ({
|
||||
default: payload.default,
|
||||
state: payload.state,
|
||||
element: payload.element,
|
||||
change_details: payload.change_details,
|
||||
});
|
||||
|
||||
// Workspace crud Events
|
||||
@ -222,3 +223,6 @@ export const SNOOZED_NOTIFICATIONS = "Snoozed notifications viewed";
|
||||
export const ARCHIVED_NOTIFICATIONS = "Archived notifications viewed";
|
||||
// Groups
|
||||
export const GROUP_WORKSPACE = "Workspace_metrics";
|
||||
|
||||
// Elements
|
||||
export const E_STATES = "Project states page";
|
Loading…
Reference in New Issue
Block a user