@burdenoff/microfe-planmagnet 2026.930.19 → 2026.930.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.js +17 -5
- package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
- package/dist/planmagnet/automation/AutomationExecutionsPanel.d.ts.map +1 -1
- package/dist/planmagnet/automation/AutomationExecutionsPanel.js +43 -39
- package/dist/planmagnet/automation/AutomationExecutionsPanel.js.map +1 -1
- package/dist/planmagnet/automation/AutomationRuleFields.d.ts +23 -4
- package/dist/planmagnet/automation/AutomationRuleFields.d.ts.map +1 -1
- package/dist/planmagnet/automation/AutomationRuleFields.js +255 -108
- package/dist/planmagnet/automation/AutomationRuleFields.js.map +1 -1
- package/dist/planmagnet/automation/automationRuleTypes.d.ts +138 -15
- package/dist/planmagnet/automation/automationRuleTypes.d.ts.map +1 -1
- package/dist/planmagnet/automation/automationRuleTypes.js +162 -22
- package/dist/planmagnet/automation/automationRuleTypes.js.map +1 -1
- package/dist/planmagnet/controls/AutomationRuleControls.d.ts.map +1 -1
- package/dist/planmagnet/controls/AutomationRuleControls.js +76 -71
- package/dist/planmagnet/controls/AutomationRuleControls.js.map +1 -1
- package/dist/planmagnet/controls/SyncControls.d.ts +101 -0
- package/dist/planmagnet/controls/SyncControls.d.ts.map +1 -0
- package/dist/planmagnet/controls/SyncControls.js +616 -0
- package/dist/planmagnet/controls/SyncControls.js.map +1 -0
- package/dist/planmagnet/index.d.ts +1 -0
- package/dist/planmagnet/index.d.ts.map +1 -1
- package/dist/planmagnet/index.js +1 -0
- package/dist/planmagnet/integrations/routes.d.ts +13 -0
- package/dist/planmagnet/integrations/routes.d.ts.map +1 -0
- package/dist/planmagnet/integrations/routes.js +9 -0
- package/dist/planmagnet/integrations/routes.js.map +1 -0
- package/dist/planmagnet/integrations/syncTypes.d.ts +143 -0
- package/dist/planmagnet/integrations/syncTypes.d.ts.map +1 -0
- package/dist/planmagnet/integrations/syncTypes.js +71 -0
- package/dist/planmagnet/integrations/syncTypes.js.map +1 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts +8 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts.map +1 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.js +27 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.js.map +1 -0
- package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js +85 -76
- package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js.map +1 -1
- package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js +12 -12
- package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js.map +1 -1
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js +48 -44
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js.map +1 -1
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js +411 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js +593 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js +267 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js.map +1 -0
- package/dist/planmagnet/people/People.d.ts.map +1 -1
- package/dist/planmagnet/people/People.js +30 -17
- package/dist/planmagnet/people/People.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { usePlanMagnet as e } from "../providers/PlanMagnetProvider.js";
|
|
2
2
|
import { throwOnError as t } from "../utils/mutationResult.js";
|
|
3
3
|
import { ErrorLine as n } from "../controls/ConfirmButton.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
4
|
+
import { isForbidden as r, mutationErrorMessage as i } from "../utils/graphqlErrors.js";
|
|
5
|
+
import { useEntityId as a } from "../hooks/useEntityId.js";
|
|
6
|
+
import { actionsFromApi as o, actionsToApi as s, conditionsFromApi as c, conditionsToApi as l, saveBlockReason as u, scheduleConditionsFromApi as d, scheduleConditionsToApi as f } from "../automation/automationRuleTypes.js";
|
|
7
|
+
import { AUTOMATION_RULE_QUERIES as p, AutomationRuleDeleteButton as m, AutomationRuleStatusSwitch as h, RunAutomationRuleDialog as g } from "../controls/AutomationRuleControls.js";
|
|
8
|
+
import { AutomationExecutionsPanel as _ } from "../automation/AutomationExecutionsPanel.js";
|
|
9
|
+
import { AutomationRuleFields as v } from "../automation/AutomationRuleFields.js";
|
|
10
|
+
import { useState as y } from "react";
|
|
11
|
+
import { Bot as b, History as x, Save as S } from "lucide-react";
|
|
12
|
+
import { gql as C } from "@apollo/client";
|
|
13
|
+
import { useMutation as w, useQuery as T } from "@apollo/client/react";
|
|
14
|
+
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
15
|
+
import { Button as O, Card as k, CardContent as A, CardHeader as j, CardTitle as M } from "@burdenoff/fe-libs/ui";
|
|
15
16
|
//#region src/planmagnet/pages/AutomationAutomationRuleDetailPagePage.tsx
|
|
16
|
-
var
|
|
17
|
+
var N = C`
|
|
17
18
|
query GetAutomationRule($id: ID!) {
|
|
18
19
|
planmagnetAutomationRule(id: $id) {
|
|
19
20
|
id
|
|
@@ -32,7 +33,7 @@ var O = v`
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
`,
|
|
36
|
+
`, P = C`
|
|
36
37
|
mutation UpdateAutomationRule($id: ID!, $input: PlanmagnetUpdateAutomationRuleInput!) {
|
|
37
38
|
planmagnetUpdateAutomationRule(id: $id, input: $input) {
|
|
38
39
|
id
|
|
@@ -44,128 +45,136 @@ var O = v`
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
`;
|
|
47
|
-
function
|
|
48
|
+
function F(e) {
|
|
49
|
+
let t = d(e.conditions);
|
|
48
50
|
return {
|
|
49
51
|
name: e.name,
|
|
50
52
|
description: e.description ?? "",
|
|
51
53
|
projectId: e.projectId ?? "",
|
|
52
54
|
triggerType: e.triggerType,
|
|
53
|
-
conditions:
|
|
54
|
-
|
|
55
|
+
conditions: c(e.conditions),
|
|
56
|
+
scheduleStatuses: t.statuses,
|
|
57
|
+
scheduleNotUpdatedForDays: t.days,
|
|
58
|
+
actions: o(e.actions)
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
function I(e) {
|
|
62
|
+
return e.triggerType === "SCHEDULE" ? f(e.scheduleStatuses, e.scheduleNotUpdatedForDays) ?? null : l(e.conditions) ?? null;
|
|
63
|
+
}
|
|
64
|
+
function L() {
|
|
65
|
+
let o = a(), { workspaceId: c } = e(), { data: l, loading: d, error: f } = T(N, {
|
|
66
|
+
variables: { id: o ?? "" },
|
|
67
|
+
skip: !o,
|
|
61
68
|
fetchPolicy: "cache-and-network"
|
|
62
|
-
}), [
|
|
63
|
-
if (
|
|
69
|
+
}), [C, { loading: L }] = w(P, { refetchQueries: p }), [R, z] = y(null), [B, V] = y(!1), H = l?.planmagnetAutomationRule ?? null, [U, W] = y(null), [G, K] = y(null);
|
|
70
|
+
if (H && G !== H.id && (K(H.id), W(F(H))), !o) return /* @__PURE__ */ E("div", {
|
|
64
71
|
className: "p-6 text-muted-foreground",
|
|
65
72
|
children: "No rule selected. Open one from the list."
|
|
66
73
|
});
|
|
67
|
-
if (
|
|
74
|
+
if (d && !l) return /* @__PURE__ */ E("div", {
|
|
68
75
|
className: "flex items-center justify-center p-12",
|
|
69
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ E("div", { className: "animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full" })
|
|
70
77
|
});
|
|
71
|
-
if (
|
|
78
|
+
if (f) return /* @__PURE__ */ D("div", {
|
|
72
79
|
className: "p-6 text-destructive",
|
|
73
|
-
children: ["Automation rule could not be loaded: ",
|
|
80
|
+
children: ["Automation rule could not be loaded: ", f.message]
|
|
74
81
|
});
|
|
75
|
-
if (!
|
|
82
|
+
if (!H || !U) return /* @__PURE__ */ E("div", {
|
|
76
83
|
className: "p-6 text-muted-foreground",
|
|
77
84
|
children: "Automation rule not found."
|
|
78
85
|
});
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
let q = u(U), J = async () => {
|
|
87
|
+
if (q) return;
|
|
88
|
+
z(null), V(!1);
|
|
89
|
+
let e = F(H), n = {};
|
|
90
|
+
U.name.trim() !== e.name && (n.name = U.name.trim()), U.description.trim() !== e.description.trim() && (n.description = U.description.trim() || null), U.triggerType !== e.triggerType && (n.triggerType = U.triggerType);
|
|
91
|
+
let a = I(U);
|
|
92
|
+
JSON.stringify(a) !== JSON.stringify(I(e)) && (n.conditions = a);
|
|
93
|
+
let o = s(U.actions);
|
|
94
|
+
if (JSON.stringify(o) !== JSON.stringify(s(e.actions)) && (n.actions = o), Object.keys(n).length === 0) {
|
|
95
|
+
V(!0);
|
|
88
96
|
return;
|
|
89
97
|
}
|
|
90
98
|
try {
|
|
91
|
-
await t(
|
|
92
|
-
id:
|
|
99
|
+
await t(C({ variables: {
|
|
100
|
+
id: H.id,
|
|
93
101
|
input: n
|
|
94
|
-
} })),
|
|
102
|
+
} })), V(!0);
|
|
95
103
|
} catch (e) {
|
|
96
|
-
|
|
104
|
+
z(r(e) ? "Your role can view automation rules but not change them." : i(e, "The rule could not be saved."));
|
|
97
105
|
}
|
|
98
106
|
};
|
|
99
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ D("div", {
|
|
100
108
|
className: "space-y-6 p-6 max-w-3xl",
|
|
101
109
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ D("div", {
|
|
103
111
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
104
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("h1", {
|
|
105
113
|
className: "text-2xl font-semibold",
|
|
106
|
-
children:
|
|
107
|
-
}), /* @__PURE__ */
|
|
114
|
+
children: H.name
|
|
115
|
+
}), /* @__PURE__ */ E("p", {
|
|
108
116
|
className: "text-sm text-muted-foreground",
|
|
109
|
-
children:
|
|
110
|
-
})] }), /* @__PURE__ */
|
|
117
|
+
children: H.project?.name ?? "Unknown project"
|
|
118
|
+
})] }), /* @__PURE__ */ E("div", {
|
|
111
119
|
className: "flex flex-col items-end gap-2",
|
|
112
|
-
children: /* @__PURE__ */
|
|
120
|
+
children: /* @__PURE__ */ D("div", {
|
|
113
121
|
className: "flex items-center gap-2",
|
|
114
122
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
ruleId:
|
|
117
|
-
projectId:
|
|
123
|
+
/* @__PURE__ */ E(g, {
|
|
124
|
+
ruleId: H.id,
|
|
125
|
+
projectId: H.projectId ?? void 0
|
|
118
126
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
ruleId:
|
|
121
|
-
status:
|
|
127
|
+
/* @__PURE__ */ E(h, {
|
|
128
|
+
ruleId: H.id,
|
|
129
|
+
status: H.status
|
|
122
130
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
ruleId:
|
|
125
|
-
name:
|
|
131
|
+
/* @__PURE__ */ E(m, {
|
|
132
|
+
ruleId: H.id,
|
|
133
|
+
name: H.name
|
|
126
134
|
})
|
|
127
135
|
]
|
|
128
136
|
})
|
|
129
137
|
})]
|
|
130
138
|
}),
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
R && /* @__PURE__ */ E(n, { message: R }),
|
|
140
|
+
B && !R && /* @__PURE__ */ E("p", {
|
|
133
141
|
className: "text-sm text-muted-foreground",
|
|
134
142
|
children: "Saved."
|
|
135
143
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(j, { children: /* @__PURE__ */ D(M, {
|
|
137
145
|
className: "flex items-center gap-2",
|
|
138
|
-
children: [/* @__PURE__ */
|
|
139
|
-
}) }), /* @__PURE__ */
|
|
146
|
+
children: [/* @__PURE__ */ E(b, { className: "h-4 w-4" }), "Rule details"]
|
|
147
|
+
}) }), /* @__PURE__ */ D(A, {
|
|
140
148
|
className: "space-y-4",
|
|
141
|
-
children: [/* @__PURE__ */
|
|
142
|
-
form:
|
|
149
|
+
children: [/* @__PURE__ */ E(v, {
|
|
150
|
+
form: U,
|
|
143
151
|
onChange: (e) => {
|
|
144
|
-
|
|
152
|
+
W(e), V(!1);
|
|
145
153
|
},
|
|
146
154
|
projectLocked: !0
|
|
147
|
-
}), /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ E("div", {
|
|
148
156
|
className: "flex justify-end",
|
|
149
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ D(O, {
|
|
150
158
|
size: "sm",
|
|
151
|
-
onClick: () => void
|
|
152
|
-
disabled:
|
|
159
|
+
onClick: () => void J(),
|
|
160
|
+
disabled: L || !!q,
|
|
161
|
+
title: q ?? void 0,
|
|
153
162
|
"data-testid": "automation-save",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
163
|
+
children: [/* @__PURE__ */ E(S, { className: "mr-1 h-4 w-4" }), L ? "Saving…" : "Save changes"]
|
|
155
164
|
})
|
|
156
165
|
})]
|
|
157
166
|
})] }),
|
|
158
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(j, { children: /* @__PURE__ */ D(M, {
|
|
159
168
|
className: "flex items-center gap-2",
|
|
160
|
-
children: [/* @__PURE__ */ x
|
|
161
|
-
}) }), /* @__PURE__ */
|
|
162
|
-
workspaceId:
|
|
163
|
-
ruleId:
|
|
169
|
+
children: [/* @__PURE__ */ E(x, { className: "h-4 w-4" }), "Recent executions"]
|
|
170
|
+
}) }), /* @__PURE__ */ E(A, { children: /* @__PURE__ */ E(_, {
|
|
171
|
+
workspaceId: c,
|
|
172
|
+
ruleId: H.id
|
|
164
173
|
}) })] })
|
|
165
174
|
]
|
|
166
175
|
});
|
|
167
176
|
}
|
|
168
177
|
//#endregion
|
|
169
|
-
export {
|
|
178
|
+
export { L as AutomationAutomationRuleDetailPagePage };
|
|
170
179
|
|
|
171
180
|
//# sourceMappingURL=AutomationAutomationRuleDetailPagePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutomationAutomationRuleDetailPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/AutomationAutomationRuleDetailPagePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { Button, Card, CardContent, CardHeader, CardTitle } from '@burdenoff/fe-libs/ui';\nimport { Bot, History, Save } from 'lucide-react';\nimport { useEntityId } from '../hooks/useEntityId';\nimport { usePlanMagnet } from '../providers/PlanMagnetProvider';\nimport { throwOnError } from '../utils/mutationResult';\nimport { ErrorLine } from '../controls/ConfirmButton';\nimport {\n AUTOMATION_RULE_QUERIES,\n AutomationRuleDeleteButton,\n AutomationRuleStatusSwitch,\n RunAutomationRuleDialog,\n} from '../controls/AutomationRuleControls';\nimport { AutomationExecutionsPanel } from '../automation/AutomationExecutionsPanel';\nimport {\n AutomationRuleFields,\n type AutomationRuleFormState,\n} from '../automation/AutomationRuleFields';\nimport {\n actionsFromApi,\n actionsToApi,\n conditionsFromApi,\n conditionsToApi,\n type TriggerType,\n} from '../automation/automationRuleTypes';\n\nconst GET_RULE = gql`\n query GetAutomationRule($id: ID!) {\n planmagnetAutomationRule(id: $id) {\n id\n name\n description\n status\n triggerType\n conditions\n actions\n executionCount\n lastExecutedAt\n projectId\n project {\n id\n name\n }\n }\n }\n`;\n\nconst UPDATE = gql`\n mutation UpdateAutomationRule($id: ID!, $input: PlanmagnetUpdateAutomationRuleInput!) {\n planmagnetUpdateAutomationRule(id: $id, input: $input) {\n id\n name\n description\n triggerType\n conditions\n actions\n }\n }\n`;\n\ninterface RuleDetail {\n id: string;\n name: string;\n description: string | null;\n status: string;\n triggerType: string;\n conditions: unknown;\n actions: unknown;\n executionCount: number;\n lastExecutedAt: string | null;\n projectId: string | null;\n project: { id: string; name: string } | null;\n}\n\nfunction toForm(rule: RuleDetail): AutomationRuleFormState {\n return {\n name: rule.name,\n description: rule.description ?? '',\n projectId: rule.projectId ?? '',\n triggerType: rule.triggerType as TriggerType,\n conditions: conditionsFromApi(rule.conditions),\n actions: actionsFromApi(rule.actions),\n };\n}\n\nexport function AutomationAutomationRuleDetailPagePage() {\n const ruleId = useEntityId();\n const { workspaceId } = usePlanMagnet();\n const { data, loading, error } = useQuery<{ planmagnetAutomationRule: RuleDetail | null }>(\n GET_RULE,\n {\n variables: { id: ruleId ?? '' },\n skip: !ruleId,\n fetchPolicy: 'cache-and-network',\n }\n );\n const [update, { loading: saving }] = useMutation(UPDATE, {\n refetchQueries: AUTOMATION_RULE_QUERIES,\n });\n const [saveError, setSaveError] = useState<string | null>(null);\n const [saved, setSaved] = useState(false);\n\n const rule = data?.planmagnetAutomationRule ?? null;\n const [form, setForm] = useState<AutomationRuleFormState | null>(null);\n const [seededFor, setSeededFor] = useState<string | null>(null);\n\n // The form tracks the loaded rule; a later refetch (status toggle, run now) must not stomp in-progress edits,\n // so this only seeds the form the first time the rule arrives — adjusted during render (React's documented\n // pattern for deriving state from a prop/query change), not in an effect, so it takes effect on the very\n // render the rule shows up rather than one render late.\n if (rule && seededFor !== rule.id) {\n setSeededFor(rule.id);\n setForm(toForm(rule));\n }\n\n if (!ruleId)\n return (\n <div className=\"p-6 text-muted-foreground\">No rule selected. Open one from the list.</div>\n );\n if (loading && !data)\n return (\n <div className=\"flex items-center justify-center p-12\">\n <div className=\"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full\" />\n </div>\n );\n if (error)\n return (\n <div className=\"p-6 text-destructive\">\n Automation rule could not be loaded: {error.message}\n </div>\n );\n if (!rule || !form)\n return <div className=\"p-6 text-muted-foreground\">Automation rule not found.</div>;\n\n const handleSave = async () => {\n setSaveError(null);\n setSaved(false);\n const initial = toForm(rule);\n const input: Record<string, unknown> = {};\n if (form.name.trim() !== initial.name) input.name = form.name.trim();\n if (form.description.trim() !== initial.description.trim())\n input.description = form.description.trim() || null;\n if (form.triggerType !== initial.triggerType) input.triggerType = form.triggerType;\n const conditions = conditionsToApi(form.conditions);\n if (\n JSON.stringify(conditions ?? null) !==\n JSON.stringify(conditionsToApi(initial.conditions) ?? null)\n )\n input.conditions = conditions ?? null;\n const actions = actionsToApi(form.actions);\n if (JSON.stringify(actions) !== JSON.stringify(actionsToApi(initial.actions)))\n input.actions = actions;\n if (Object.keys(input).length === 0) {\n setSaved(true);\n return;\n }\n try {\n await throwOnError(update({ variables: { id: rule.id, input } }));\n setSaved(true);\n } catch (e) {\n setSaveError(e instanceof Error ? e.message : 'The rule could not be saved.');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold\">{rule.name}</h1>\n <p className=\"text-sm text-muted-foreground\">{rule.project?.name ?? 'Unknown project'}</p>\n </div>\n <div className=\"flex flex-col items-end gap-2\">\n <div className=\"flex items-center gap-2\">\n <RunAutomationRuleDialog ruleId={rule.id} projectId={rule.projectId ?? undefined} />\n <AutomationRuleStatusSwitch ruleId={rule.id} status={rule.status} />\n <AutomationRuleDeleteButton ruleId={rule.id} name={rule.name} />\n </div>\n </div>\n </div>\n\n {saveError && <ErrorLine message={saveError} />}\n {saved && !saveError && <p className=\"text-sm text-muted-foreground\">Saved.</p>}\n\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <Bot className=\"h-4 w-4\" />\n Rule details\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <AutomationRuleFields\n form={form}\n onChange={(next) => {\n setForm(next);\n setSaved(false);\n }}\n projectLocked\n />\n <div className=\"flex justify-end\">\n <Button\n size=\"sm\"\n onClick={() => void handleSave()}\n disabled={saving}\n data-testid=\"automation-save\"\n >\n <Save className=\"mr-1 h-4 w-4\" />\n {saving ? 'Saving…' : 'Save changes'}\n </Button>\n </div>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <History className=\"h-4 w-4\" />\n Recent executions\n </CardTitle>\n </CardHeader>\n <CardContent>\n <AutomationExecutionsPanel workspaceId={workspaceId} ruleId={rule.id} />\n </CardContent>\n </Card>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAM,IAAW,CAAG;;;;;;;;;;;;;;;;;;;GAqBd,IAAS,CAAG;;;;;;;;;;;;AA2BlB,SAAS,EAAO,GAA2C;AACzD,QAAO;EACL,MAAM,EAAK;EACX,aAA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,GAAD,EAAW,SAAS,GAAa,CAAA;GAC9C,KAAS,CAAC,KAAa,kBAAC,KAAD;IAAG,WAAU;cAAgC;IAAU,CAAA;GAE/E,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAW,WAAU;cAArB,CACE,kBAAC,GAAD,EAAK,WAAU,WAAY,CAAA,EAAA,eAEjB;OACD,CAAA,EACb,kBAAC,GAAD;IAAa,WAAU;cAAvB,CACE,kBAAC,GAAD;KACQ;KACN,WAAW,MAAS;AAElB,MADA,EAAQ,EAAK,EACb,EAAS,GAAM;;KAEjB,eAAA;KACA,CAAA,EACF,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,MAAK;MACL,eAAe,KAAK,GAAY;MAChC,UAAU;MACV,eAAY;gBAJd,CAME,kBAAC,GAAD,EAAM,WAAU,gBAAiB,CAAA,EAChC,IAAS,YAAY,eACf;;KACL,CAAA,CACM;MACT,EAAA,CAAA;GAEP,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAW,WAAU;cAArB,CACE,kBAAC,GAAD,EAAS,WAAU,WAAY,CAAA,EAAA,oBAErB;OACD,CAAA,EACb,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAwC;IAAa,QAAQ,EAAK;IAAM,CAAA,EAC5D,CAAA,CACT,EAAA,CAAA;GACH"}
|
|
1
|
+
{"version":3,"file":"AutomationAutomationRuleDetailPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/AutomationAutomationRuleDetailPagePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { Button, Card, CardContent, CardHeader, CardTitle } from '@burdenoff/fe-libs/ui';\nimport { Bot, History, Save } from 'lucide-react';\nimport { useEntityId } from '../hooks/useEntityId';\nimport { usePlanMagnet } from '../providers/PlanMagnetProvider';\nimport { throwOnError } from '../utils/mutationResult';\nimport { isForbidden, mutationErrorMessage } from '../utils/graphqlErrors';\nimport { ErrorLine } from '../controls/ConfirmButton';\nimport {\n AUTOMATION_RULE_QUERIES,\n AutomationRuleDeleteButton,\n AutomationRuleStatusSwitch,\n RunAutomationRuleDialog,\n} from '../controls/AutomationRuleControls';\nimport { AutomationExecutionsPanel } from '../automation/AutomationExecutionsPanel';\nimport {\n AutomationRuleFields,\n type AutomationRuleFormState,\n} from '../automation/AutomationRuleFields';\nimport {\n actionsFromApi,\n actionsToApi,\n conditionsFromApi,\n conditionsToApi,\n saveBlockReason,\n scheduleConditionsFromApi,\n scheduleConditionsToApi,\n type TriggerType,\n} from '../automation/automationRuleTypes';\n\nconst GET_RULE = gql`\n query GetAutomationRule($id: ID!) {\n planmagnetAutomationRule(id: $id) {\n id\n name\n description\n status\n triggerType\n conditions\n actions\n executionCount\n lastExecutedAt\n projectId\n project {\n id\n name\n }\n }\n }\n`;\n\nconst UPDATE = gql`\n mutation UpdateAutomationRule($id: ID!, $input: PlanmagnetUpdateAutomationRuleInput!) {\n planmagnetUpdateAutomationRule(id: $id, input: $input) {\n id\n name\n description\n triggerType\n conditions\n actions\n }\n }\n`;\n\ninterface RuleDetail {\n id: string;\n name: string;\n description: string | null;\n status: string;\n triggerType: string;\n conditions: unknown;\n actions: unknown;\n executionCount: number;\n lastExecutedAt: string | null;\n projectId: string | null;\n project: { id: string; name: string } | null;\n}\n\nfunction toForm(rule: RuleDetail): AutomationRuleFormState {\n const schedule = scheduleConditionsFromApi(rule.conditions);\n return {\n name: rule.name,\n description: rule.description ?? '',\n projectId: rule.projectId ?? '',\n triggerType: rule.triggerType as TriggerType,\n conditions: conditionsFromApi(rule.conditions),\n scheduleStatuses: schedule.statuses,\n scheduleNotUpdatedForDays: schedule.days,\n actions: actionsFromApi(rule.actions),\n };\n}\n\n/** The `conditions` JSON this rule's CURRENT trigger would submit — `SCHEDULE`'s own `{status,\n * notUpdatedForDays}` shape, or the generic field/operator/value array for every other trigger. Used both to\n * submit and to diff against the loaded rule, so a trigger-type switch on this edit is compared correctly\n * either way (see `handleSave` below). */\nfunction conditionsPayload(form: AutomationRuleFormState): unknown {\n return form.triggerType === 'SCHEDULE'\n ? (scheduleConditionsToApi(form.scheduleStatuses, form.scheduleNotUpdatedForDays) ?? null)\n : (conditionsToApi(form.conditions) ?? null);\n}\n\nexport function AutomationAutomationRuleDetailPagePage() {\n const ruleId = useEntityId();\n const { workspaceId } = usePlanMagnet();\n const { data, loading, error } = useQuery<{ planmagnetAutomationRule: RuleDetail | null }>(\n GET_RULE,\n {\n variables: { id: ruleId ?? '' },\n skip: !ruleId,\n fetchPolicy: 'cache-and-network',\n }\n );\n const [update, { loading: saving }] = useMutation(UPDATE, {\n refetchQueries: AUTOMATION_RULE_QUERIES,\n });\n const [saveError, setSaveError] = useState<string | null>(null);\n const [saved, setSaved] = useState(false);\n\n const rule = data?.planmagnetAutomationRule ?? null;\n const [form, setForm] = useState<AutomationRuleFormState | null>(null);\n const [seededFor, setSeededFor] = useState<string | null>(null);\n\n // The form tracks the loaded rule; a later refetch (status toggle, run now) must not stomp in-progress edits,\n // so this only seeds the form the first time the rule arrives — adjusted during render (React's documented\n // pattern for deriving state from a prop/query change), not in an effect, so it takes effect on the very\n // render the rule shows up rather than one render late.\n if (rule && seededFor !== rule.id) {\n setSeededFor(rule.id);\n setForm(toForm(rule));\n }\n\n if (!ruleId)\n return (\n <div className=\"p-6 text-muted-foreground\">No rule selected. Open one from the list.</div>\n );\n if (loading && !data)\n return (\n <div className=\"flex items-center justify-center p-12\">\n <div className=\"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full\" />\n </div>\n );\n if (error)\n return (\n <div className=\"p-6 text-destructive\">\n Automation rule could not be loaded: {error.message}\n </div>\n );\n if (!rule || !form)\n return <div className=\"p-6 text-muted-foreground\">Automation rule not found.</div>;\n\n const blockReason = saveBlockReason(form);\n\n const handleSave = async () => {\n if (blockReason) return;\n setSaveError(null);\n setSaved(false);\n const initial = toForm(rule);\n const input: Record<string, unknown> = {};\n if (form.name.trim() !== initial.name) input.name = form.name.trim();\n if (form.description.trim() !== initial.description.trim())\n input.description = form.description.trim() || null;\n if (form.triggerType !== initial.triggerType) input.triggerType = form.triggerType;\n const conditions = conditionsPayload(form);\n if (JSON.stringify(conditions) !== JSON.stringify(conditionsPayload(initial)))\n input.conditions = conditions;\n const actions = actionsToApi(form.actions);\n if (JSON.stringify(actions) !== JSON.stringify(actionsToApi(initial.actions)))\n input.actions = actions;\n if (Object.keys(input).length === 0) {\n setSaved(true);\n return;\n }\n try {\n await throwOnError(update({ variables: { id: rule.id, input } }));\n setSaved(true);\n } catch (e) {\n setSaveError(\n isForbidden(e)\n ? 'Your role can view automation rules but not change them.'\n : mutationErrorMessage(e, 'The rule could not be saved.')\n );\n }\n };\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold\">{rule.name}</h1>\n <p className=\"text-sm text-muted-foreground\">{rule.project?.name ?? 'Unknown project'}</p>\n </div>\n <div className=\"flex flex-col items-end gap-2\">\n <div className=\"flex items-center gap-2\">\n <RunAutomationRuleDialog ruleId={rule.id} projectId={rule.projectId ?? undefined} />\n <AutomationRuleStatusSwitch ruleId={rule.id} status={rule.status} />\n <AutomationRuleDeleteButton ruleId={rule.id} name={rule.name} />\n </div>\n </div>\n </div>\n\n {saveError && <ErrorLine message={saveError} />}\n {saved && !saveError && <p className=\"text-sm text-muted-foreground\">Saved.</p>}\n\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <Bot className=\"h-4 w-4\" />\n Rule details\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <AutomationRuleFields\n form={form}\n onChange={(next) => {\n setForm(next);\n setSaved(false);\n }}\n projectLocked\n />\n <div className=\"flex justify-end\">\n <Button\n size=\"sm\"\n onClick={() => void handleSave()}\n disabled={saving || !!blockReason}\n title={blockReason ?? undefined}\n data-testid=\"automation-save\"\n >\n <Save className=\"mr-1 h-4 w-4\" />\n {saving ? 'Saving…' : 'Save changes'}\n </Button>\n </div>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2\">\n <History className=\"h-4 w-4\" />\n Recent executions\n </CardTitle>\n </CardHeader>\n <CardContent>\n <AutomationExecutionsPanel workspaceId={workspaceId} ruleId={rule.id} />\n </CardContent>\n </Card>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,IAAM,IAAW,CAAG;;;;;;;;;;;;;;;;;;;GAqBd,IAAS,CAAG;;;;;;;;;;;;AA2BlB,SAAS,EAAO,GAA2C;CACzD,IAAM,IAAW,EAA0B,EAAK,WAAW;AAC3D,QAAO;EACL,MAAM,EAAK;EACX,aAAa,EAAK,eAAe;EACjC,WAAW,EAAK,aAAa;EAC7B,aAAa,EAAK;EAClB,YAAY,EAAkB,EAAK,WAAW;EAC9C,kBAAkB,EAAS;EAC3B,2BAA2B,EAAS;EACpC,SAAS,EAAe,EAAK,QAAQ;EACtC;;AAOH,SAAS,EAAkB,GAAwC;AACjE,QAAO,EAAK,gBAAgB,aACvB,EAAwB,EAAK,kBAAkB,EAAK,0BAA0B,IAAI,OAClF,EAAgB,EAAK,WAAW,IAAI;;AAG3C,SAAgB,IAAyC;CACvD,IAAM,IAAS,GAAa,EACtB,EAAE,mBAAgB,GAAe,EACjC,EAAE,SAAM,YAAS,aAAU,EAC/B,GACA;EACE,WAAW,EAAE,IAAI,KAAU,IAAI;EAC/B,MAAM,CAAC;EACP,aAAa;EACd,CACF,EACK,CAAC,GAAQ,EAAE,SAAS,OAAY,EAAY,GAAQ,EACxD,gBAAgB,GACjB,CAAC,EACI,CAAC,GAAW,KAAgB,EAAwB,KAAK,EACzD,CAAC,GAAO,KAAY,EAAS,GAAM,EAEnC,IAAO,GAAM,4BAA4B,MACzC,CAAC,GAAM,KAAW,EA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MAChC,UAAU,KAAU,CAAC,CAAC;MACtB,OAAO,KAAe,KAAA;MACtB,eAAY;gBALd,CAOE,kBAAC,GAAD,EAAM,WAAU,gBAAiB,CAAA,EAChC,IAAS,YAAY,eACf;;KACL,CAAA,CACM;MACT,EAAA,CAAA;GAEP,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAW,WAAU;cAArB,CACE,kBAAC,GAAD,EAAS,WAAU,WAAY,CAAA,EAAA,oBAErB;OACD,CAAA,EACb,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAwC;IAAa,QAAQ,EAAK;IAAM,CAAA,EAC5D,CAAA,CACT,EAAA,CAAA;GACH"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { usePlanMagnet as e, usePlanMagnetNavigate as t } from "../providers/PlanMagnetProvider.js";
|
|
2
2
|
import { ProjectSelect as n } from "../controls/Pickers.js";
|
|
3
3
|
import { ROW_LINK_CLASS as r, detailPath as i, rowLinkProps as a, stopRowActivation as o } from "../utils/rowNavigation.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { RULE_STATUSES as s, TRIGGER_TYPES as c, TRIGGER_TYPE_LABEL as l, triggerTypeLabel as u } from "../automation/automationRuleTypes.js";
|
|
5
|
+
import { AutomationRuleDeleteButton as d, AutomationRuleStatusSwitch as f } from "../controls/AutomationRuleControls.js";
|
|
6
6
|
import { useDeferredValue as p, useState as m } from "react";
|
|
7
7
|
import { Bot as h, Plus as g, Search as _ } from "lucide-react";
|
|
8
8
|
import { gql as v } from "@apollo/client";
|
|
@@ -39,23 +39,23 @@ var E = 50, D = v`
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
`, O = ["ALL", ...
|
|
42
|
+
`, O = ["ALL", ...s];
|
|
43
43
|
function k(e) {
|
|
44
44
|
return Array.isArray(e) ? e.length : 0;
|
|
45
45
|
}
|
|
46
46
|
function A() {
|
|
47
|
-
let { workspaceId:
|
|
47
|
+
let { workspaceId: s } = e(), v = t(), [A, j] = m(""), [M, N] = m("ALL"), [P, F] = m("ALL"), [I, L] = m(""), [R, z] = m(!1), B = p(A.trim()), V = {
|
|
48
48
|
...B ? { search: B } : {},
|
|
49
49
|
...M === "ALL" ? {} : { status: M },
|
|
50
50
|
...P === "ALL" ? {} : { triggerType: P },
|
|
51
51
|
...I ? { projectId: I } : {}
|
|
52
52
|
}, { data: H, loading: U, error: W, fetchMore: G } = y(D, {
|
|
53
53
|
variables: {
|
|
54
|
-
workspaceId:
|
|
54
|
+
workspaceId: s ?? "",
|
|
55
55
|
filter: V,
|
|
56
56
|
pagination: { first: E }
|
|
57
57
|
},
|
|
58
|
-
skip: !
|
|
58
|
+
skip: !s,
|
|
59
59
|
fetchPolicy: "cache-and-network"
|
|
60
60
|
}), K = H?.planmagnetAutomationRules, q = K?.items ?? [], J = async () => {
|
|
61
61
|
let e = K?.pageInfo.endCursor;
|
|
@@ -117,9 +117,9 @@ function A() {
|
|
|
117
117
|
children: [/* @__PURE__ */ b("option", {
|
|
118
118
|
value: "ALL",
|
|
119
119
|
children: "Any trigger"
|
|
120
|
-
}),
|
|
120
|
+
}), c.map((e) => /* @__PURE__ */ b("option", {
|
|
121
121
|
value: e,
|
|
122
|
-
children:
|
|
122
|
+
children: l[e]
|
|
123
123
|
}, e))]
|
|
124
124
|
}),
|
|
125
125
|
/* @__PURE__ */ b("div", {
|
|
@@ -157,7 +157,7 @@ function A() {
|
|
|
157
157
|
K && q.length === 0 && /* @__PURE__ */ b(w, {
|
|
158
158
|
icon: /* @__PURE__ */ b(h, { className: "h-8 w-8 text-muted-foreground" }),
|
|
159
159
|
title: B || M !== "ALL" || P !== "ALL" || I ? "No rules match" : "No automation rules yet",
|
|
160
|
-
description: "Rules watch for an event
|
|
160
|
+
description: "Rules watch for an event — a work item, sprint, release or a daily schedule — and act automatically: assign, label, move status, or post a comment.",
|
|
161
161
|
action: B || M !== "ALL" || P !== "ALL" || I ? void 0 : /* @__PURE__ */ x(C, {
|
|
162
162
|
size: "sm",
|
|
163
163
|
onClick: () => v("/automation/create-automation-rule-page"),
|
|
@@ -180,7 +180,7 @@ function A() {
|
|
|
180
180
|
children: e.name
|
|
181
181
|
}), /* @__PURE__ */ b(S, {
|
|
182
182
|
variant: "outline",
|
|
183
|
-
children:
|
|
183
|
+
children: u(e.triggerType)
|
|
184
184
|
})]
|
|
185
185
|
}),
|
|
186
186
|
/* @__PURE__ */ x("p", {
|
|
@@ -206,10 +206,10 @@ function A() {
|
|
|
206
206
|
}), /* @__PURE__ */ x("div", {
|
|
207
207
|
className: "flex items-center gap-3",
|
|
208
208
|
onClick: o,
|
|
209
|
-
children: [/* @__PURE__ */ b(
|
|
209
|
+
children: [/* @__PURE__ */ b(f, {
|
|
210
210
|
ruleId: e.id,
|
|
211
211
|
status: e.status
|
|
212
|
-
}), /* @__PURE__ */ b(
|
|
212
|
+
}), /* @__PURE__ */ b(d, {
|
|
213
213
|
ruleId: e.id,
|
|
214
214
|
name: e.name
|
|
215
215
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutomationAutomationRulesPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/AutomationAutomationRulesPagePage.tsx"],"sourcesContent":["import { useDeferredValue, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { Badge, Button, EmptyState, Input } from '@burdenoff/fe-libs/ui';\nimport { Bot, Plus, Search } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { ProjectSelect } from '../controls/Pickers';\nimport {\n AutomationRuleStatusSwitch,\n AutomationRuleDeleteButton,\n} from '../controls/AutomationRuleControls';\nimport {\n rowLinkProps,\n detailPath,\n stopRowActivation,\n ROW_LINK_CLASS,\n} from '../utils/rowNavigation';\nimport {\n RULE_STATUSES,\n TRIGGER_TYPES,\n TRIGGER_TYPE_LABEL,\n triggerTypeLabel,\n} from '../automation/automationRuleTypes';\n\n/**\n * Automation rules browse surface (BOFF-8047, capability register \"Automation rules\": model/API/authz were\n * already real and prod-verified — `planmagnetAutomationRules`/Create/Update/Delete/Toggle/Execute — gate 3\n * (UI) was the only gap; \"no UI anywhere\" until now.\n */\n\nconst PAGE = 50;\n\nconst RULES = gql`\n query AutomationRulesList(\n $workspaceId: ID!\n $filter: PlanmagnetAutomationRuleFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetAutomationRules(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n items {\n id\n name\n description\n status\n triggerType\n actions\n executionCount\n lastExecutedAt\n projectId\n project {\n id\n name\n }\n }\n }\n }\n`;\n\ninterface RuleRow {\n id: string;\n name: string;\n description: string | null;\n status: string;\n triggerType: string;\n actions: unknown;\n executionCount: number;\n lastExecutedAt: string | null;\n projectId: string | null;\n project: { id: string; name: string } | null;\n}\n\nconst STATUS_FILTERS = ['ALL', ...RULE_STATUSES] as const;\n\nfunction actionCount(actions: unknown): number {\n return Array.isArray(actions) ? actions.length : 0;\n}\n\nexport function AutomationAutomationRulesPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const [search, setSearch] = useState('');\n const [status, setStatus] = useState<(typeof STATUS_FILTERS)[number]>('ALL');\n const [triggerType, setTriggerType] = useState('ALL');\n const [projectId, setProjectId] = useState('');\n const [loadingMore, setLoadingMore] = useState(false);\n const term = useDeferredValue(search.trim());\n\n const filter = {\n ...(term ? { search: term } : {}),\n ...(status !== 'ALL' ? { status } : {}),\n ...(triggerType !== 'ALL' ? { triggerType } : {}),\n ...(projectId ? { projectId } : {}),\n };\n\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetAutomationRules: {\n totalCount: number;\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n items: RuleRow[];\n };\n }>(RULES, {\n variables: { workspaceId: workspaceId ?? '', filter, pagination: { first: PAGE } },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n });\n\n const list = data?.planmagnetAutomationRules;\n const rules = list?.items ?? [];\n\n const loadMore = async () => {\n const after = list?.pageInfo.endCursor;\n if (!after) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { first: PAGE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetAutomationRules: {\n ...fetchMoreResult.planmagnetAutomationRules,\n items: [\n ...prev.planmagnetAutomationRules.items,\n ...fetchMoreResult.planmagnetAutomationRules.items,\n ],\n },\n }),\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\" data-testid=\"automation-rules-page\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Automation rules</h1>\n <p className=\"text-sm text-muted-foreground\">\n {list\n ? `${list.totalCount} rule${list.totalCount === 1 ? '' : 's'}`\n : 'Trigger, condition and action rules that run against work items'}\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={() => navigate('/automation/create-automation-rule-page')}\n data-testid=\"automation-new\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n New rule\n </Button>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-3\">\n <div className=\"relative w-full max-w-sm\">\n <Search className=\"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground\" />\n <Input\n aria-label=\"Search automation rules\"\n placeholder=\"Search by name or description\"\n className=\"pl-8\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n />\n </div>\n <select\n aria-label=\"Filter by trigger\"\n className=\"rounded-md border border-input bg-background px-2 py-1.5 text-sm\"\n value={triggerType}\n onChange={(e) => setTriggerType(e.target.value)}\n >\n <option value=\"ALL\">Any trigger</option>\n {TRIGGER_TYPES.map((t) => (\n <option key={t} value={t}>\n {TRIGGER_TYPE_LABEL[t]}\n </option>\n ))}\n </select>\n <div className=\"w-48\">\n <ProjectSelect\n id=\"automation-filter-project\"\n value={projectId}\n onChange={setProjectId}\n noneLabel=\"Any project\"\n />\n </div>\n </div>\n <div className=\"flex gap-1\" role=\"group\" aria-label=\"Filter by status\">\n {STATUS_FILTERS.map((s) => (\n <button\n key={s}\n type=\"button\"\n aria-pressed={status === s}\n onClick={() => setStatus(s)}\n className={`px-3 py-1.5 text-sm rounded-md capitalize ${status === s ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n >\n {s === 'ALL' ? 'All' : s.toLowerCase()}\n </button>\n ))}\n </div>\n\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n Automation rules could not be loaded: {error.message}\n </p>\n )}\n {loading && !data && (\n <p className=\"text-sm text-muted-foreground\">Loading automation rules…</p>\n )}\n {list && rules.length === 0 && (\n <EmptyState\n icon={<Bot className=\"h-8 w-8 text-muted-foreground\" />}\n title={\n term || status !== 'ALL' || triggerType !== 'ALL' || projectId\n ? 'No rules match'\n : 'No automation rules yet'\n }\n description=\"Rules watch for an event on a project's work items and act automatically — assign, label, or move status.\"\n action={\n !(term || status !== 'ALL' || triggerType !== 'ALL' || projectId) ? (\n <Button size=\"sm\" onClick={() => navigate('/automation/create-automation-rule-page')}>\n <Plus className=\"mr-1 h-4 w-4\" />\n New rule\n </Button>\n ) : undefined\n }\n />\n )}\n\n <ul className=\"space-y-2\">\n {rules.map((rule) => (\n <li key={rule.id}>\n <div\n {...rowLinkProps(\n () => navigate(detailPath('/automation/automation-rule-detail-page', rule.id)),\n rule.name\n )}\n data-testid=\"automation-rule-row\"\n className={`flex flex-wrap items-center justify-between gap-3 rounded-md border p-3 ${ROW_LINK_CLASS}`}\n >\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"truncate text-sm font-medium\">{rule.name}</span>\n <Badge variant=\"outline\">{triggerTypeLabel(rule.triggerType)}</Badge>\n </div>\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {rule.project?.name ?? 'Unknown project'} · {actionCount(rule.actions)} action\n {actionCount(rule.actions) === 1 ? '' : 's'} · run {rule.executionCount} time\n {rule.executionCount === 1 ? '' : 's'}\n {rule.lastExecutedAt\n ? ` · last ${new Date(rule.lastExecutedAt).toLocaleString()}`\n : ''}\n </p>\n {rule.description && (\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {rule.description}\n </p>\n )}\n </div>\n <div className=\"flex items-center gap-3\" onClick={stopRowActivation}>\n <AutomationRuleStatusSwitch ruleId={rule.id} status={rule.status} />\n <AutomationRuleDeleteButton ruleId={rule.id} name={rule.name} />\n </div>\n </div>\n </li>\n ))}\n </ul>\n {list?.pageInfo.hasNextPage && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => void loadMore()} disabled={loadingMore}>\n {loadingMore ? 'Loading…' : `Show more (${rules.length} of ${list.totalCount})`}\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAM,IAAO,IAEP,IAAQ,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CX,IAAiB,CAAC,OAAO,GAAG,EAAc;AAEhD,SAAS,EAAY,GAA0B;AAC7C,QAAO,MAAM,QAAQ,EAAQ,GAAG,EAAQ,SAAS;;AAGnD,SAAgB,IAAoC;CAClD,IAAM,EAAE,mBAAgB,GAAe,EACjC,IAAW,GAAuB,EAClC,CAAC,GAAQ,KAAa,EAAS,GAAG,EAClC,CAAC,GAAQ,KAAa,EAA0C,MAAM,EACtE,CAAC,GAAa,KAAkB,EAAS,MAAM,EAC/C,CAAC,GAAW,KAAgB,EAAS,GAAG,EACxC,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,IAAO,EAAiB,EAAO,MAAM,CAAC,EAEtC,IAAS;EACb,GAAI,IAAO,EAAE,QAAQ,GAAM,GAAG,EAAE;EAChC,GAAI,MAAW,QAAqB,EAAE,GAAf,EAAE,WAAQ;EACjC,GAAI,MAAgB,QAA0B,EAAE,GAApB,E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ationRulesPagePage.tsx"],"sourcesContent":["import { useDeferredValue, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { Badge, Button, EmptyState, Input } from '@burdenoff/fe-libs/ui';\nimport { Bot, Plus, Search } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { ProjectSelect } from '../controls/Pickers';\nimport {\n AutomationRuleStatusSwitch,\n AutomationRuleDeleteButton,\n} from '../controls/AutomationRuleControls';\nimport {\n rowLinkProps,\n detailPath,\n stopRowActivation,\n ROW_LINK_CLASS,\n} from '../utils/rowNavigation';\nimport {\n RULE_STATUSES,\n TRIGGER_TYPES,\n TRIGGER_TYPE_LABEL,\n triggerTypeLabel,\n} from '../automation/automationRuleTypes';\n\n/**\n * Automation rules browse surface (BOFF-8047, capability register \"Automation rules\": model/API/authz were\n * already real and prod-verified — `planmagnetAutomationRules`/Create/Update/Delete/Toggle/Execute — gate 3\n * (UI) was the only gap; \"no UI anywhere\" until now.\n */\n\nconst PAGE = 50;\n\nconst RULES = gql`\n query AutomationRulesList(\n $workspaceId: ID!\n $filter: PlanmagnetAutomationRuleFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetAutomationRules(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n items {\n id\n name\n description\n status\n triggerType\n actions\n executionCount\n lastExecutedAt\n projectId\n project {\n id\n name\n }\n }\n }\n }\n`;\n\ninterface RuleRow {\n id: string;\n name: string;\n description: string | null;\n status: string;\n triggerType: string;\n actions: unknown;\n executionCount: number;\n lastExecutedAt: string | null;\n projectId: string | null;\n project: { id: string; name: string } | null;\n}\n\nconst STATUS_FILTERS = ['ALL', ...RULE_STATUSES] as const;\n\nfunction actionCount(actions: unknown): number {\n return Array.isArray(actions) ? actions.length : 0;\n}\n\nexport function AutomationAutomationRulesPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const [search, setSearch] = useState('');\n const [status, setStatus] = useState<(typeof STATUS_FILTERS)[number]>('ALL');\n const [triggerType, setTriggerType] = useState('ALL');\n const [projectId, setProjectId] = useState('');\n const [loadingMore, setLoadingMore] = useState(false);\n const term = useDeferredValue(search.trim());\n\n const filter = {\n ...(term ? { search: term } : {}),\n ...(status !== 'ALL' ? { status } : {}),\n ...(triggerType !== 'ALL' ? { triggerType } : {}),\n ...(projectId ? { projectId } : {}),\n };\n\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetAutomationRules: {\n totalCount: number;\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n items: RuleRow[];\n };\n }>(RULES, {\n variables: { workspaceId: workspaceId ?? '', filter, pagination: { first: PAGE } },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n });\n\n const list = data?.planmagnetAutomationRules;\n const rules = list?.items ?? [];\n\n const loadMore = async () => {\n const after = list?.pageInfo.endCursor;\n if (!after) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { first: PAGE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetAutomationRules: {\n ...fetchMoreResult.planmagnetAutomationRules,\n items: [\n ...prev.planmagnetAutomationRules.items,\n ...fetchMoreResult.planmagnetAutomationRules.items,\n ],\n },\n }),\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\" data-testid=\"automation-rules-page\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Automation rules</h1>\n <p className=\"text-sm text-muted-foreground\">\n {list\n ? `${list.totalCount} rule${list.totalCount === 1 ? '' : 's'}`\n : 'Trigger, condition and action rules that run against work items'}\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={() => navigate('/automation/create-automation-rule-page')}\n data-testid=\"automation-new\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n New rule\n </Button>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-3\">\n <div className=\"relative w-full max-w-sm\">\n <Search className=\"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground\" />\n <Input\n aria-label=\"Search automation rules\"\n placeholder=\"Search by name or description\"\n className=\"pl-8\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n />\n </div>\n <select\n aria-label=\"Filter by trigger\"\n className=\"rounded-md border border-input bg-background px-2 py-1.5 text-sm\"\n value={triggerType}\n onChange={(e) => setTriggerType(e.target.value)}\n >\n <option value=\"ALL\">Any trigger</option>\n {TRIGGER_TYPES.map((t) => (\n <option key={t} value={t}>\n {TRIGGER_TYPE_LABEL[t]}\n </option>\n ))}\n </select>\n <div className=\"w-48\">\n <ProjectSelect\n id=\"automation-filter-project\"\n value={projectId}\n onChange={setProjectId}\n noneLabel=\"Any project\"\n />\n </div>\n </div>\n <div className=\"flex gap-1\" role=\"group\" aria-label=\"Filter by status\">\n {STATUS_FILTERS.map((s) => (\n <button\n key={s}\n type=\"button\"\n aria-pressed={status === s}\n onClick={() => setStatus(s)}\n className={`px-3 py-1.5 text-sm rounded-md capitalize ${status === s ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n >\n {s === 'ALL' ? 'All' : s.toLowerCase()}\n </button>\n ))}\n </div>\n\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n Automation rules could not be loaded: {error.message}\n </p>\n )}\n {loading && !data && (\n <p className=\"text-sm text-muted-foreground\">Loading automation rules…</p>\n )}\n {list && rules.length === 0 && (\n <EmptyState\n icon={<Bot className=\"h-8 w-8 text-muted-foreground\" />}\n title={\n term || status !== 'ALL' || triggerType !== 'ALL' || projectId\n ? 'No rules match'\n : 'No automation rules yet'\n }\n description=\"Rules watch for an event — a work item, sprint, release or a daily schedule — and act automatically: assign, label, move status, or post a comment.\"\n action={\n !(term || status !== 'ALL' || triggerType !== 'ALL' || projectId) ? (\n <Button size=\"sm\" onClick={() => navigate('/automation/create-automation-rule-page')}>\n <Plus className=\"mr-1 h-4 w-4\" />\n New rule\n </Button>\n ) : undefined\n }\n />\n )}\n\n <ul className=\"space-y-2\">\n {rules.map((rule) => (\n <li key={rule.id}>\n <div\n {...rowLinkProps(\n () => navigate(detailPath('/automation/automation-rule-detail-page', rule.id)),\n rule.name\n )}\n data-testid=\"automation-rule-row\"\n className={`flex flex-wrap items-center justify-between gap-3 rounded-md border p-3 ${ROW_LINK_CLASS}`}\n >\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"truncate text-sm font-medium\">{rule.name}</span>\n <Badge variant=\"outline\">{triggerTypeLabel(rule.triggerType)}</Badge>\n </div>\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {rule.project?.name ?? 'Unknown project'} · {actionCount(rule.actions)} action\n {actionCount(rule.actions) === 1 ? '' : 's'} · run {rule.executionCount} time\n {rule.executionCount === 1 ? '' : 's'}\n {rule.lastExecutedAt\n ? ` · last ${new Date(rule.lastExecutedAt).toLocaleString()}`\n : ''}\n </p>\n {rule.description && (\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {rule.description}\n </p>\n )}\n </div>\n <div className=\"flex items-center gap-3\" onClick={stopRowActivation}>\n <AutomationRuleStatusSwitch ruleId={rule.id} status={rule.status} />\n <AutomationRuleDeleteButton ruleId={rule.id} name={rule.name} />\n </div>\n </div>\n </li>\n ))}\n </ul>\n {list?.pageInfo.hasNextPage && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => void loadMore()} disabled={loadingMore}>\n {loadingMore ? 'Loading…' : `Show more (${rules.length} of ${list.totalCount})`}\n </Button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAM,IAAO,IAEP,IAAQ,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CX,IAAiB,CAAC,OAAO,GAAG,EAAc;AAEhD,SAAS,EAAY,GAA0B;AAC7C,QAAO,MAAM,QAAQ,EAAQ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AU;MAA0B,SAAS;gBAAlD,CACE,kBAAC,GAAD;OAA4B,QAAQ,EAAK;OAAI,QAAQ,EAAK;OAAU,CAAA,EACpE,kBAAC,GAAD;OAA4B,QAAQ,EAAK;OAAI,MAAM,EAAK;OAAQ,CAAA,CAC5D;QACF;QACH,EAjCI,EAAK,GAiCT,CACL;IACC,CAAA;GACJ,GAAM,SAAS,eACd,kBAAC,GAAD;IAAQ,MAAK;IAAK,SAAQ;IAAU,eAAe,KAAK,GAAU;IAAE,UAAU;cAC3E,IAAc,aAAa,cAAc,EAAM,OAAO,MAAM,EAAK,WAAW;IACtE,CAAA;GAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutomationCreateAutomationRulePagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/AutomationCreateAutomationRulePagePage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AutomationCreateAutomationRulePagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/AutomationCreateAutomationRulePagePage.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,sCAAsC,4CAoGrD"}
|
|
@@ -1,93 +1,97 @@
|
|
|
1
1
|
import { usePlanMagnet as e, usePlanMagnetNavigate as t } from "../providers/PlanMagnetProvider.js";
|
|
2
2
|
import { throwOnError as n } from "../utils/mutationResult.js";
|
|
3
3
|
import { detailPath as r } from "../utils/rowNavigation.js";
|
|
4
|
-
import {
|
|
5
|
-
import { actionsToApi as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
4
|
+
import { isForbidden as i, mutationErrorMessage as a } from "../utils/graphqlErrors.js";
|
|
5
|
+
import { actionsToApi as o, conditionsToApi as s, saveBlockReason as c, scheduleConditionsToApi as l } from "../automation/automationRuleTypes.js";
|
|
6
|
+
import { AUTOMATION_RULE_QUERIES as u } from "../controls/AutomationRuleControls.js";
|
|
7
|
+
import { AutomationRuleFields as d } from "../automation/AutomationRuleFields.js";
|
|
8
|
+
import { useState as f } from "react";
|
|
9
|
+
import { Bot as p, Save as m, X as h } from "lucide-react";
|
|
10
|
+
import { gql as g } from "@apollo/client";
|
|
11
|
+
import { useMutation as _ } from "@apollo/client/react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
|
+
import { Button as b, Card as x, CardContent as S, CardHeader as C, CardTitle as w } from "@burdenoff/fe-libs/ui";
|
|
13
14
|
//#region src/planmagnet/pages/AutomationCreateAutomationRulePagePage.tsx
|
|
14
|
-
var
|
|
15
|
+
var T = g`
|
|
15
16
|
mutation CreateAutomationRule($input: PlanmagnetCreateAutomationRuleInput!) {
|
|
16
17
|
planmagnetCreateAutomationRule(input: $input) {
|
|
17
18
|
id
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
`,
|
|
21
|
+
`, E = {
|
|
21
22
|
name: "",
|
|
22
23
|
description: "",
|
|
23
24
|
projectId: "",
|
|
24
25
|
triggerType: "WORK_ITEM_CREATED",
|
|
25
26
|
conditions: [],
|
|
27
|
+
scheduleStatuses: [],
|
|
28
|
+
scheduleNotUpdatedForDays: "",
|
|
26
29
|
actions: []
|
|
27
30
|
};
|
|
28
|
-
function
|
|
29
|
-
let { workspaceId:
|
|
30
|
-
if (!(!
|
|
31
|
-
|
|
31
|
+
function D() {
|
|
32
|
+
let { workspaceId: g } = e(), D = t(), [O, k] = f(E), [A, j] = f(null), [M, { loading: N }] = _(T, { refetchQueries: u }), P = c(O), F = O.name.trim() !== "" && O.projectId !== "" && !P && !N, I = async () => {
|
|
33
|
+
if (!(!F || !g)) {
|
|
34
|
+
j(null);
|
|
32
35
|
try {
|
|
33
|
-
let e = (await n(
|
|
34
|
-
projectId:
|
|
35
|
-
name:
|
|
36
|
-
description:
|
|
37
|
-
triggerType:
|
|
36
|
+
let e = (await n(M({ variables: { input: {
|
|
37
|
+
projectId: O.projectId,
|
|
38
|
+
name: O.name.trim(),
|
|
39
|
+
description: O.description.trim() || void 0,
|
|
40
|
+
triggerType: O.triggerType,
|
|
38
41
|
triggerConfig: {},
|
|
39
|
-
conditions:
|
|
40
|
-
actions:
|
|
42
|
+
conditions: O.triggerType === "SCHEDULE" ? l(O.scheduleStatuses, O.scheduleNotUpdatedForDays) : s(O.conditions),
|
|
43
|
+
actions: o(O.actions)
|
|
41
44
|
} } }))).data?.planmagnetCreateAutomationRule.id;
|
|
42
|
-
|
|
45
|
+
D(e ? r("/automation/automation-rule-detail-page", e) : "/automation/automation-rules-page");
|
|
43
46
|
} catch (e) {
|
|
44
|
-
|
|
47
|
+
j(i(e) ? "Your role can view automation rules but not change them." : a(e, "The rule could not be created."));
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
};
|
|
48
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ y("div", {
|
|
49
52
|
className: "space-y-6 p-6 max-w-3xl",
|
|
50
53
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ y("div", {
|
|
52
55
|
className: "flex items-center justify-between",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("h1", {
|
|
54
57
|
className: "text-2xl font-semibold",
|
|
55
58
|
children: "New automation rule"
|
|
56
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ v("p", {
|
|
57
60
|
className: "text-sm text-muted-foreground",
|
|
58
61
|
children: "Runs its actions when the trigger fires and every condition matches."
|
|
59
|
-
})] }), /* @__PURE__ */
|
|
62
|
+
})] }), /* @__PURE__ */ y("div", {
|
|
60
63
|
className: "flex gap-2",
|
|
61
|
-
children: [/* @__PURE__ */
|
|
64
|
+
children: [/* @__PURE__ */ y(b, {
|
|
62
65
|
variant: "outline",
|
|
63
66
|
size: "sm",
|
|
64
|
-
onClick: () =>
|
|
65
|
-
children: [/* @__PURE__ */
|
|
66
|
-
}), /* @__PURE__ */
|
|
67
|
+
onClick: () => D("/automation/automation-rules-page"),
|
|
68
|
+
children: [/* @__PURE__ */ v(h, { className: "mr-1 h-4 w-4" }), "Cancel"]
|
|
69
|
+
}), /* @__PURE__ */ y(b, {
|
|
67
70
|
size: "sm",
|
|
68
|
-
onClick: () => void
|
|
69
|
-
disabled: !
|
|
71
|
+
onClick: () => void I(),
|
|
72
|
+
disabled: !F,
|
|
73
|
+
title: P ?? void 0,
|
|
70
74
|
"data-testid": "automation-create-submit",
|
|
71
|
-
children: [/* @__PURE__ */ m
|
|
75
|
+
children: [/* @__PURE__ */ v(m, { className: "mr-1 h-4 w-4" }), N ? "Creating…" : "Create rule"]
|
|
72
76
|
})]
|
|
73
77
|
})]
|
|
74
78
|
}),
|
|
75
|
-
|
|
79
|
+
A && /* @__PURE__ */ v("div", {
|
|
76
80
|
role: "alert",
|
|
77
81
|
className: "p-3 bg-destructive/10 text-destructive rounded-md text-sm",
|
|
78
|
-
children:
|
|
82
|
+
children: A
|
|
79
83
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ y(x, { children: [/* @__PURE__ */ v(C, { children: /* @__PURE__ */ y(w, {
|
|
81
85
|
className: "flex items-center gap-2",
|
|
82
|
-
children: [/* @__PURE__ */
|
|
83
|
-
}) }), /* @__PURE__ */
|
|
84
|
-
form:
|
|
85
|
-
onChange:
|
|
86
|
+
children: [/* @__PURE__ */ v(p, { className: "h-4 w-4" }), "Rule details"]
|
|
87
|
+
}) }), /* @__PURE__ */ v(S, { children: /* @__PURE__ */ v(d, {
|
|
88
|
+
form: O,
|
|
89
|
+
onChange: k
|
|
86
90
|
}) })] })
|
|
87
91
|
]
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
94
|
//#endregion
|
|
91
|
-
export {
|
|
95
|
+
export { D as AutomationCreateAutomationRulePagePage };
|
|
92
96
|
|
|
93
97
|
//# sourceMappingURL=AutomationCreateAutomationRulePagePage.js.map
|