@orange-soft/strapi-deployment-trigger 1.1.0 → 1.2.0
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/README.md +34 -13
- package/admin/src/pages/HomePage.jsx +67 -33
- package/admin/src/pages/SettingsPage.jsx +143 -68
- package/dist/_chunks/{App-vakyp6FE.mjs → App-k07qAAvE.mjs} +165 -90
- package/dist/_chunks/{App-CuSCtdH7.js → App-vIrt97zQ.js} +162 -87
- package/dist/_chunks/{index-CZWWYGR3.mjs → index-BwZtnn__.mjs} +1 -1
- package/dist/_chunks/{index-DGatQB-9.js → index-w-vQ80Px.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +95 -27
- package/dist/server/index.mjs +95 -27
- package/package.json +1 -1
- package/server/src/controllers/controller.js +73 -23
- package/server/src/services/service.js +47 -8
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useFetchClient, Layouts, BackButton, Page } from "@strapi/strapi/admin";
|
|
3
|
-
import { Link, Routes, Route } from "react-router-dom";
|
|
3
|
+
import { useLocation, Link, useNavigate, Routes, Route } from "react-router-dom";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
|
-
import { Flex, Loader, Button, Box, Alert, Typography, Table, Thead, Tr, Th, Tbody, Td, Field, Grid,
|
|
6
|
+
import { Flex, Loader, Button, Box, Alert, Typography, Table, Thead, Tr, Th, Tbody, Td, Field, Grid, SingleSelect, SingleSelectOption, Dialog } from "@strapi/design-system";
|
|
7
7
|
import { Cog, Rocket, Check, Plus, Pencil, Trash } from "@strapi/icons";
|
|
8
|
-
import { P as PLUGIN_ID } from "./index-
|
|
8
|
+
import { P as PLUGIN_ID } from "./index-BwZtnn__.mjs";
|
|
9
9
|
const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
|
|
10
10
|
const HomePage = () => {
|
|
11
11
|
const { formatMessage } = useIntl();
|
|
12
12
|
const { get, post } = useFetchClient();
|
|
13
|
+
const location = useLocation();
|
|
13
14
|
const [status, setStatus] = useState(null);
|
|
14
15
|
const [loading, setLoading] = useState(true);
|
|
15
16
|
const [deployingTargetId, setDeployingTargetId] = useState(null);
|
|
16
17
|
const [notification, setNotification] = useState(null);
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
fetchStatus();
|
|
20
|
+
if (location.state?.notification) {
|
|
21
|
+
setNotification(location.state.notification);
|
|
22
|
+
window.history.replaceState({}, document.title);
|
|
23
|
+
}
|
|
19
24
|
}, []);
|
|
20
25
|
const fetchStatus = async () => {
|
|
21
26
|
try {
|
|
@@ -60,9 +65,18 @@ const HomePage = () => {
|
|
|
60
65
|
}
|
|
61
66
|
const settings = status?.settings || {};
|
|
62
67
|
const parsed = status?.parsed || {};
|
|
63
|
-
|
|
68
|
+
status?.configured;
|
|
64
69
|
const hasToken = status?.hasToken;
|
|
65
70
|
const targets = settings.targets || [];
|
|
71
|
+
const hasGitHubTargets = targets.some((t) => (t.type || "github") === "github");
|
|
72
|
+
targets.some((t) => t.type === "vercel");
|
|
73
|
+
const canTrigger = (target) => {
|
|
74
|
+
const targetType = target.type || "github";
|
|
75
|
+
if (targetType === "github") {
|
|
76
|
+
return hasToken && parsed.owner && parsed.repo;
|
|
77
|
+
}
|
|
78
|
+
return !!target.webhookUrl;
|
|
79
|
+
};
|
|
66
80
|
return /* @__PURE__ */ jsxs(Layouts.Root, { children: [
|
|
67
81
|
/* @__PURE__ */ jsx(
|
|
68
82
|
Layouts.Header,
|
|
@@ -98,8 +112,8 @@ const HomePage = () => {
|
|
|
98
112
|
] })
|
|
99
113
|
}
|
|
100
114
|
) }),
|
|
101
|
-
!hasToken && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Alert, { title: "Token Missing", variant: "danger", children: "GitHub Personal Access Token is not configured. Please add it in Settings." }) }),
|
|
102
|
-
!settings.repoUrl && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Alert, { title: "Configuration Required", variant: "warning", children: "Please configure your GitHub repository in the Settings page before triggering deployments." }) }),
|
|
115
|
+
hasGitHubTargets && !hasToken && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Alert, { title: "Token Missing", variant: "danger", children: "GitHub Personal Access Token is not configured. Please add it in Settings." }) }),
|
|
116
|
+
hasGitHubTargets && !settings.repoUrl && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Alert, { title: "Configuration Required", variant: "warning", children: "Please configure your GitHub repository in the Settings page before triggering deployments." }) }),
|
|
103
117
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
104
118
|
/* @__PURE__ */ jsx(
|
|
105
119
|
Box,
|
|
@@ -152,27 +166,34 @@ const HomePage = () => {
|
|
|
152
166
|
/* @__PURE__ */ jsx(Typography, { variant: "delta", tag: "h2", children: "Deployment Targets" }),
|
|
153
167
|
targets.length > 0 ? /* @__PURE__ */ jsxs(Table, { children: [
|
|
154
168
|
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
169
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Type" }) }),
|
|
155
170
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Name" }) }),
|
|
156
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "
|
|
157
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Branch" }) }),
|
|
171
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Details" }) }),
|
|
158
172
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Action" }) })
|
|
159
173
|
] }) }),
|
|
160
|
-
/* @__PURE__ */ jsx(Tbody, { children: targets.map((target) =>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
/* @__PURE__ */ jsx(Tbody, { children: targets.map((target) => {
|
|
175
|
+
const targetType = target.type || "github";
|
|
176
|
+
return /* @__PURE__ */ jsxs(Tr, { children: [
|
|
177
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", textColor: targetType === "github" ? "neutral800" : "secondary600", children: targetType === "github" ? "GitHub" : "Vercel" }) }),
|
|
178
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", children: target.name }) }),
|
|
179
|
+
/* @__PURE__ */ jsx(Td, { children: targetType === "github" ? /* @__PURE__ */ jsxs(Typography, { variant: "omega", textColor: "neutral600", children: [
|
|
180
|
+
target.workflow,
|
|
181
|
+
" / ",
|
|
182
|
+
target.branch
|
|
183
|
+
] }) : /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "Webhook" }) }),
|
|
184
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
185
|
+
Button,
|
|
186
|
+
{
|
|
187
|
+
onClick: () => handleDeploy(target.id, target.name),
|
|
188
|
+
loading: deployingTargetId === target.id,
|
|
189
|
+
disabled: !canTrigger(target) || deployingTargetId !== null,
|
|
190
|
+
startIcon: /* @__PURE__ */ jsx(Rocket, {}),
|
|
191
|
+
size: "S",
|
|
192
|
+
children: deployingTargetId === target.id ? "Triggering..." : "Trigger"
|
|
193
|
+
}
|
|
194
|
+
) })
|
|
195
|
+
] }, target.id);
|
|
196
|
+
}) })
|
|
176
197
|
] }) : /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", justifyContent: "center", gap: 3, padding: 6, children: [
|
|
177
198
|
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", textAlign: "center", children: "No deployment targets configured" }),
|
|
178
199
|
/* @__PURE__ */ jsx(Link, { to: `/plugins/${PLUGIN_ID}/settings`, children: /* @__PURE__ */ jsx(Button, { variant: "default", startIcon: /* @__PURE__ */ jsx(Cog, {}), children: "Add Targets in Settings" }) })
|
|
@@ -180,7 +201,7 @@ const HomePage = () => {
|
|
|
180
201
|
] })
|
|
181
202
|
}
|
|
182
203
|
),
|
|
183
|
-
|
|
204
|
+
hasGitHubTargets && (!hasToken || !parsed.owner || !parsed.repo) && /* @__PURE__ */ jsx(
|
|
184
205
|
Box,
|
|
185
206
|
{
|
|
186
207
|
background: "neutral0",
|
|
@@ -191,8 +212,8 @@ const HomePage = () => {
|
|
|
191
212
|
paddingLeft: 7,
|
|
192
213
|
paddingRight: 7,
|
|
193
214
|
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", justifyContent: "center", gap: 3, children: [
|
|
194
|
-
/* @__PURE__ */ jsx(Typography, { variant: "beta", textColor: "neutral600", textAlign: "center", children: "Setup Incomplete" }),
|
|
195
|
-
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", textAlign: "center", children: "Please ensure repository URL and GitHub token are configured in Settings." }),
|
|
215
|
+
/* @__PURE__ */ jsx(Typography, { variant: "beta", textColor: "neutral600", textAlign: "center", children: "GitHub Setup Incomplete" }),
|
|
216
|
+
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", textAlign: "center", children: "Please ensure repository URL and GitHub token are configured in Settings for GitHub targets." }),
|
|
196
217
|
/* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Link, { to: `/plugins/${PLUGIN_ID}/settings`, children: /* @__PURE__ */ jsx(Button, { variant: "default", startIcon: /* @__PURE__ */ jsx(Cog, {}), children: "Go to Settings" }) }) })
|
|
197
218
|
] })
|
|
198
219
|
}
|
|
@@ -204,6 +225,7 @@ const HomePage = () => {
|
|
|
204
225
|
const TOKEN_PATTERN = /^github_pat_[a-zA-Z0-9_]+$/;
|
|
205
226
|
const REPO_URL_PATTERN = /^https:\/\/github\.com\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+\/?$/;
|
|
206
227
|
const WORKFLOW_PATTERN = /^[a-zA-Z0-9_.-]+\.ya?ml$/;
|
|
228
|
+
const VERCEL_WEBHOOK_PATTERN = /^https:\/\/api\.vercel\.com\/v1\/integrations\/deploy\/.+$/;
|
|
207
229
|
const validateToken = (value) => {
|
|
208
230
|
if (!value) return null;
|
|
209
231
|
if (!TOKEN_PATTERN.test(value)) {
|
|
@@ -225,7 +247,15 @@ const validateWorkflow = (value) => {
|
|
|
225
247
|
}
|
|
226
248
|
return null;
|
|
227
249
|
};
|
|
250
|
+
const validateVercelWebhook = (value) => {
|
|
251
|
+
if (!value) return "Webhook URL is required";
|
|
252
|
+
if (!VERCEL_WEBHOOK_PATTERN.test(value)) {
|
|
253
|
+
return "Must be a valid Vercel deploy hook URL (https://api.vercel.com/v1/integrations/deploy/...)";
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
};
|
|
228
257
|
const SettingsPage = () => {
|
|
258
|
+
const navigate = useNavigate();
|
|
229
259
|
const { get, put, post, del } = useFetchClient();
|
|
230
260
|
const [settings, setSettings] = useState({
|
|
231
261
|
githubToken: "",
|
|
@@ -239,7 +269,7 @@ const SettingsPage = () => {
|
|
|
239
269
|
const [saving, setSaving] = useState(false);
|
|
240
270
|
const [notification, setNotification] = useState(null);
|
|
241
271
|
const [editingTarget, setEditingTarget] = useState(null);
|
|
242
|
-
const [targetForm, setTargetForm] = useState({ name: "", workflow: "", branch: "" });
|
|
272
|
+
const [targetForm, setTargetForm] = useState({ type: "github", name: "", workflow: "", branch: "", webhookUrl: "" });
|
|
243
273
|
const [targetErrors, setTargetErrors] = useState({});
|
|
244
274
|
const [showAddForm, setShowAddForm] = useState(false);
|
|
245
275
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
@@ -286,17 +316,14 @@ const SettingsPage = () => {
|
|
|
286
316
|
dataToSave.githubToken = settings.githubToken;
|
|
287
317
|
}
|
|
288
318
|
const { data } = await put(`/${PLUGIN_ID}/settings`, { data: dataToSave });
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
setSettings((prev) => ({ ...prev, githubToken: "" }));
|
|
294
|
-
setNotification({ type: "success", message: "Settings saved successfully" });
|
|
319
|
+
navigate(`/plugins/${PLUGIN_ID}`, {
|
|
320
|
+
state: { notification: { type: "success", message: "Settings saved successfully" } }
|
|
321
|
+
});
|
|
295
322
|
} catch (error) {
|
|
296
323
|
console.error("Error saving settings:", error);
|
|
297
324
|
setNotification({ type: "danger", message: "Failed to save settings" });
|
|
325
|
+
setSaving(false);
|
|
298
326
|
}
|
|
299
|
-
setSaving(false);
|
|
300
327
|
};
|
|
301
328
|
const handleChange = (field) => (e) => {
|
|
302
329
|
const value = e.target.value;
|
|
@@ -306,7 +333,7 @@ const SettingsPage = () => {
|
|
|
306
333
|
}
|
|
307
334
|
};
|
|
308
335
|
const resetTargetForm = () => {
|
|
309
|
-
setTargetForm({ name: "", workflow: "deploy.yml", branch: "master" });
|
|
336
|
+
setTargetForm({ type: "github", name: "", workflow: "deploy.yml", branch: "master", webhookUrl: "" });
|
|
310
337
|
setTargetErrors({});
|
|
311
338
|
setEditingTarget(null);
|
|
312
339
|
setShowAddForm(false);
|
|
@@ -314,9 +341,14 @@ const SettingsPage = () => {
|
|
|
314
341
|
const validateTargetForm = () => {
|
|
315
342
|
const newErrors = {};
|
|
316
343
|
if (!targetForm.name.trim()) newErrors.name = "Name is required";
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
344
|
+
if (targetForm.type === "github") {
|
|
345
|
+
const workflowError = validateWorkflow(targetForm.workflow);
|
|
346
|
+
if (workflowError) newErrors.workflow = workflowError;
|
|
347
|
+
if (!targetForm.branch.trim()) newErrors.branch = "Branch is required";
|
|
348
|
+
} else if (targetForm.type === "vercel") {
|
|
349
|
+
const webhookError = validateVercelWebhook(targetForm.webhookUrl);
|
|
350
|
+
if (webhookError) newErrors.webhookUrl = webhookError;
|
|
351
|
+
}
|
|
320
352
|
setTargetErrors(newErrors);
|
|
321
353
|
return Object.keys(newErrors).length === 0;
|
|
322
354
|
};
|
|
@@ -337,7 +369,13 @@ const SettingsPage = () => {
|
|
|
337
369
|
};
|
|
338
370
|
const handleEditTarget = (target) => {
|
|
339
371
|
setEditingTarget(target.id);
|
|
340
|
-
setTargetForm({
|
|
372
|
+
setTargetForm({
|
|
373
|
+
type: target.type || "github",
|
|
374
|
+
name: target.name,
|
|
375
|
+
workflow: target.workflow || "deploy.yml",
|
|
376
|
+
branch: target.branch || "master",
|
|
377
|
+
webhookUrl: target.webhookUrl || ""
|
|
378
|
+
});
|
|
341
379
|
setShowAddForm(false);
|
|
342
380
|
};
|
|
343
381
|
const handleUpdateTarget = async () => {
|
|
@@ -479,7 +517,7 @@ const SettingsPage = () => {
|
|
|
479
517
|
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
480
518
|
onClick: () => {
|
|
481
519
|
setShowAddForm(true);
|
|
482
|
-
setTargetForm({ name: "", workflow: "deploy.yml", branch: "master" });
|
|
520
|
+
setTargetForm({ type: "github", name: "", workflow: "deploy.yml", branch: "master", webhookUrl: "" });
|
|
483
521
|
},
|
|
484
522
|
size: "S",
|
|
485
523
|
children: "Add Target"
|
|
@@ -495,7 +533,21 @@ const SettingsPage = () => {
|
|
|
495
533
|
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, children: [
|
|
496
534
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", children: editingTarget ? "Edit Target" : "Add New Target" }),
|
|
497
535
|
/* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
498
|
-
/* @__PURE__ */ jsx(Grid.Item, { col:
|
|
536
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 12, children: /* @__PURE__ */ jsxs(Field.Root, { name: "targetType", required: true, children: [
|
|
537
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Type" }),
|
|
538
|
+
/* @__PURE__ */ jsxs(
|
|
539
|
+
SingleSelect,
|
|
540
|
+
{
|
|
541
|
+
value: targetForm.type,
|
|
542
|
+
onChange: (value) => setTargetForm((prev) => ({ ...prev, type: value })),
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "github", children: "GitHub" }),
|
|
545
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "vercel", children: "Vercel" })
|
|
546
|
+
]
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
] }) }),
|
|
550
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 12, children: /* @__PURE__ */ jsxs(Field.Root, { name: "targetName", required: true, error: targetErrors.name, children: [
|
|
499
551
|
/* @__PURE__ */ jsx(Field.Label, { children: "Name" }),
|
|
500
552
|
/* @__PURE__ */ jsx(
|
|
501
553
|
Field.Input,
|
|
@@ -507,26 +559,40 @@ const SettingsPage = () => {
|
|
|
507
559
|
),
|
|
508
560
|
/* @__PURE__ */ jsx(Field.Error, {})
|
|
509
561
|
] }) }),
|
|
510
|
-
|
|
511
|
-
/* @__PURE__ */ jsx(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
/* @__PURE__ */ jsx(
|
|
562
|
+
targetForm.type === "github" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
563
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 12, children: /* @__PURE__ */ jsxs(Field.Root, { name: "targetWorkflow", required: true, error: targetErrors.workflow, children: [
|
|
564
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Workflow File" }),
|
|
565
|
+
/* @__PURE__ */ jsx(
|
|
566
|
+
Field.Input,
|
|
567
|
+
{
|
|
568
|
+
placeholder: "deploy.yml",
|
|
569
|
+
value: targetForm.workflow,
|
|
570
|
+
onChange: handleTargetFormChange("workflow")
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
574
|
+
] }) }),
|
|
575
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 12, children: /* @__PURE__ */ jsxs(Field.Root, { name: "targetBranch", required: true, error: targetErrors.branch, children: [
|
|
576
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Branch" }),
|
|
577
|
+
/* @__PURE__ */ jsx(
|
|
578
|
+
Field.Input,
|
|
579
|
+
{
|
|
580
|
+
placeholder: "main",
|
|
581
|
+
value: targetForm.branch,
|
|
582
|
+
onChange: handleTargetFormChange("branch")
|
|
583
|
+
}
|
|
584
|
+
),
|
|
585
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
586
|
+
] }) })
|
|
587
|
+
] }),
|
|
588
|
+
targetForm.type === "vercel" && /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxs(Field.Root, { name: "targetWebhookUrl", required: true, error: targetErrors.webhookUrl, children: [
|
|
589
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Webhook URL" }),
|
|
524
590
|
/* @__PURE__ */ jsx(
|
|
525
591
|
Field.Input,
|
|
526
592
|
{
|
|
527
|
-
placeholder: "
|
|
528
|
-
value: targetForm.
|
|
529
|
-
onChange: handleTargetFormChange("
|
|
593
|
+
placeholder: "https://api.vercel.com/v1/integrations/deploy/...",
|
|
594
|
+
value: targetForm.webhookUrl,
|
|
595
|
+
onChange: handleTargetFormChange("webhookUrl")
|
|
530
596
|
}
|
|
531
597
|
),
|
|
532
598
|
/* @__PURE__ */ jsx(Field.Error, {})
|
|
@@ -548,39 +614,48 @@ const SettingsPage = () => {
|
|
|
548
614
|
),
|
|
549
615
|
settings.targets.length > 0 ? /* @__PURE__ */ jsxs(Table, { children: [
|
|
550
616
|
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
617
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Type" }) }),
|
|
551
618
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Name" }) }),
|
|
552
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "
|
|
553
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Branch" }) }),
|
|
619
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Details" }) }),
|
|
554
620
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Actions" }) })
|
|
555
621
|
] }) }),
|
|
556
|
-
/* @__PURE__ */ jsx(Tbody, { children: settings.targets.map((target) =>
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
/* @__PURE__ */ jsx(
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
622
|
+
/* @__PURE__ */ jsx(Tbody, { children: settings.targets.map((target) => {
|
|
623
|
+
const targetType = target.type || "github";
|
|
624
|
+
return /* @__PURE__ */ jsxs(Tr, { children: [
|
|
625
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", textColor: targetType === "github" ? "neutral800" : "secondary600", children: targetType === "github" ? "GitHub" : "Vercel" }) }),
|
|
626
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: target.name }) }),
|
|
627
|
+
/* @__PURE__ */ jsx(Td, { children: targetType === "github" ? /* @__PURE__ */ jsxs(Typography, { variant: "omega", textColor: "neutral600", children: [
|
|
628
|
+
target.workflow,
|
|
629
|
+
" / ",
|
|
630
|
+
target.branch
|
|
631
|
+
] }) : /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "Webhook configured" }) }),
|
|
632
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
633
|
+
/* @__PURE__ */ jsx(
|
|
634
|
+
Button,
|
|
635
|
+
{
|
|
636
|
+
onClick: () => handleEditTarget(target),
|
|
637
|
+
variant: "tertiary",
|
|
638
|
+
size: "S",
|
|
639
|
+
startIcon: /* @__PURE__ */ jsx(Pencil, {}),
|
|
640
|
+
children: "Edit"
|
|
641
|
+
}
|
|
642
|
+
),
|
|
643
|
+
/* @__PURE__ */ jsx(
|
|
644
|
+
Button,
|
|
645
|
+
{
|
|
646
|
+
onClick: () => {
|
|
647
|
+
setTargetToDelete(target.id);
|
|
648
|
+
setDeleteDialogOpen(true);
|
|
649
|
+
},
|
|
650
|
+
variant: "danger-light",
|
|
651
|
+
size: "S",
|
|
652
|
+
startIcon: /* @__PURE__ */ jsx(Trash, {}),
|
|
653
|
+
children: "Delete"
|
|
654
|
+
}
|
|
655
|
+
)
|
|
656
|
+
] }) })
|
|
657
|
+
] }, target.id);
|
|
658
|
+
}) })
|
|
584
659
|
] }) : !showAddForm && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: 'No deployment targets configured. Click "Add Target" to create one.' })
|
|
585
660
|
] })
|
|
586
661
|
}
|