@orange-soft/strapi-deployment-trigger 1.0.1 → 1.1.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/admin/src/pages/HomePage.jsx +109 -61
- package/admin/src/pages/SettingsPage.jsx +270 -97
- package/dist/_chunks/App-CuSCtdH7.js +666 -0
- package/dist/_chunks/App-vakyp6FE.mjs +666 -0
- package/dist/_chunks/{index-C18aSW5z.mjs → index-CZWWYGR3.mjs} +1 -1
- package/dist/_chunks/{index-CqpMwL_C.js → index-DGatQB-9.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +160 -24
- package/dist/server/index.mjs +160 -24
- package/package.json +1 -1
- package/server/src/controllers/controller.js +58 -3
- package/server/src/routes/admin/index.js +25 -0
- package/server/src/services/service.js +114 -24
- package/dist/_chunks/App-3JntxPYv.js +0 -520
- package/dist/_chunks/App-C0Byi5W1.mjs +0 -520
|
@@ -1,520 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const admin = require("@strapi/strapi/admin");
|
|
5
|
-
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const reactIntl = require("react-intl");
|
|
8
|
-
const designSystem = require("@strapi/design-system");
|
|
9
|
-
const icons = require("@strapi/icons");
|
|
10
|
-
const index = require("./index-CqpMwL_C.js");
|
|
11
|
-
const getTranslation = (id) => `${index.PLUGIN_ID}.${id}`;
|
|
12
|
-
const HomePage = () => {
|
|
13
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
14
|
-
const { get, post } = admin.useFetchClient();
|
|
15
|
-
const [status, setStatus] = react.useState(null);
|
|
16
|
-
const [loading, setLoading] = react.useState(true);
|
|
17
|
-
const [deploying, setDeploying] = react.useState(false);
|
|
18
|
-
const [notification, setNotification] = react.useState(null);
|
|
19
|
-
react.useEffect(() => {
|
|
20
|
-
fetchStatus();
|
|
21
|
-
}, []);
|
|
22
|
-
const fetchStatus = async () => {
|
|
23
|
-
try {
|
|
24
|
-
const { data } = await get(`/${index.PLUGIN_ID}/status`);
|
|
25
|
-
setStatus(data.data);
|
|
26
|
-
} catch (error) {
|
|
27
|
-
console.error("Failed to fetch status:", error);
|
|
28
|
-
} finally {
|
|
29
|
-
setLoading(false);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const handleDeploy = async () => {
|
|
33
|
-
setDeploying(true);
|
|
34
|
-
setNotification(null);
|
|
35
|
-
try {
|
|
36
|
-
const { data } = await post(`/${index.PLUGIN_ID}/trigger`, {});
|
|
37
|
-
setNotification({
|
|
38
|
-
type: "success",
|
|
39
|
-
message: data.data?.message || "Deployment triggered successfully!",
|
|
40
|
-
actionsUrl: data.data?.actionsUrl
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
setNotification({
|
|
44
|
-
type: "danger",
|
|
45
|
-
message: error?.response?.data?.error?.message || error.message || "Deployment failed"
|
|
46
|
-
});
|
|
47
|
-
} finally {
|
|
48
|
-
setDeploying(false);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
if (loading) {
|
|
52
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Root, { children: [
|
|
53
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
admin.Layouts.Header,
|
|
55
|
-
{
|
|
56
|
-
title: formatMessage({ id: getTranslation("plugin.name") }),
|
|
57
|
-
subtitle: "Loading..."
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) }) })
|
|
61
|
-
] });
|
|
62
|
-
}
|
|
63
|
-
const settings = status?.settings || {};
|
|
64
|
-
const parsed = status?.parsed || {};
|
|
65
|
-
const isConfigured = status?.configured;
|
|
66
|
-
const hasToken = status?.hasToken;
|
|
67
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Root, { children: [
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
-
admin.Layouts.Header,
|
|
70
|
-
{
|
|
71
|
-
title: formatMessage({ id: getTranslation("plugin.name") }),
|
|
72
|
-
subtitle: "Trigger GitHub Actions deployment to production",
|
|
73
|
-
secondaryAction: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/plugins/${index.PLUGIN_ID}/settings`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cog, {}), children: "Settings" }) })
|
|
74
|
-
}
|
|
75
|
-
),
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Content, { children: [
|
|
77
|
-
notification && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
-
designSystem.Alert,
|
|
79
|
-
{
|
|
80
|
-
closeLabel: "Close",
|
|
81
|
-
title: notification.message,
|
|
82
|
-
variant: notification.type,
|
|
83
|
-
onClose: () => setNotification(null),
|
|
84
|
-
children: notification.actionsUrl && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", children: [
|
|
85
|
-
"Check the deployment status at",
|
|
86
|
-
" ",
|
|
87
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
-
designSystem.Typography,
|
|
89
|
-
{
|
|
90
|
-
variant: "pi",
|
|
91
|
-
tag: "a",
|
|
92
|
-
href: notification.actionsUrl,
|
|
93
|
-
target: "_blank",
|
|
94
|
-
rel: "noopener noreferrer",
|
|
95
|
-
textColor: "primary600",
|
|
96
|
-
children: "GitHub Actions"
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
] })
|
|
100
|
-
}
|
|
101
|
-
) }),
|
|
102
|
-
!hasToken && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { title: "Token Missing", variant: "danger", children: "GitHub Personal Access Token is not configured. Please add it in Settings." }) }),
|
|
103
|
-
!settings.repoUrl && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { title: "Configuration Required", variant: "warning", children: "Please configure your GitHub repository in the Settings page before triggering deployments." }) }),
|
|
104
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
-
designSystem.Box,
|
|
107
|
-
{
|
|
108
|
-
background: "neutral0",
|
|
109
|
-
hasRadius: true,
|
|
110
|
-
shadow: "filterShadow",
|
|
111
|
-
paddingTop: 6,
|
|
112
|
-
paddingBottom: 6,
|
|
113
|
-
paddingLeft: 7,
|
|
114
|
-
paddingRight: 7,
|
|
115
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
116
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: "Configuration" }),
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", gap: 6, children: [
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { display: "grid", gridTemplateColumns: "120px 1fr", gap: "12px 16px", alignItems: "center" }, children: [
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: "Repository" }),
|
|
120
|
-
parsed.owner && parsed.repo ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
121
|
-
designSystem.Typography,
|
|
122
|
-
{
|
|
123
|
-
variant: "pi",
|
|
124
|
-
tag: "a",
|
|
125
|
-
href: settings.repoUrl,
|
|
126
|
-
target: "_blank",
|
|
127
|
-
rel: "noopener noreferrer",
|
|
128
|
-
textColor: "primary600",
|
|
129
|
-
style: { textDecoration: "none" },
|
|
130
|
-
children: [
|
|
131
|
-
parsed.owner,
|
|
132
|
-
"/",
|
|
133
|
-
parsed.repo
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Not configured" }),
|
|
137
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: "Workflow" }),
|
|
138
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", children: settings.workflow || "deploy.yml (default)" }),
|
|
139
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: "Branch" }),
|
|
140
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", children: settings.branch || "master (default)" }),
|
|
141
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: "GitHub Token" }),
|
|
142
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: hasToken ? "success600" : "danger600", children: hasToken ? "Configured" : "Missing" })
|
|
143
|
-
] }),
|
|
144
|
-
isConfigured && /* @__PURE__ */ jsxRuntime.jsx(
|
|
145
|
-
designSystem.Button,
|
|
146
|
-
{
|
|
147
|
-
onClick: handleDeploy,
|
|
148
|
-
loading: deploying,
|
|
149
|
-
disabled: deploying,
|
|
150
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Rocket, {}),
|
|
151
|
-
size: "L",
|
|
152
|
-
children: deploying ? "Triggering..." : "Trigger Deployment"
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
] })
|
|
156
|
-
] })
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
!isConfigured && /* @__PURE__ */ jsxRuntime.jsx(
|
|
160
|
-
designSystem.Box,
|
|
161
|
-
{
|
|
162
|
-
background: "neutral0",
|
|
163
|
-
hasRadius: true,
|
|
164
|
-
shadow: "filterShadow",
|
|
165
|
-
paddingTop: 8,
|
|
166
|
-
paddingBottom: 8,
|
|
167
|
-
paddingLeft: 7,
|
|
168
|
-
paddingRight: 7,
|
|
169
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", justifyContent: "center", gap: 3, children: [
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", textColor: "neutral600", textAlign: "center", children: "Setup Required" }),
|
|
171
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", textAlign: "center", children: "Configure your GitHub repository settings to enable deployment triggering." }),
|
|
172
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/plugins/${index.PLUGIN_ID}/settings`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "default", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cog, {}), children: "Go to Settings" }) }) })
|
|
173
|
-
] })
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
] })
|
|
177
|
-
] })
|
|
178
|
-
] });
|
|
179
|
-
};
|
|
180
|
-
const TOKEN_PATTERN = /^github_pat_[a-zA-Z0-9_]+$/;
|
|
181
|
-
const REPO_URL_PATTERN = /^https:\/\/github\.com\/[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+\/?$/;
|
|
182
|
-
const WORKFLOW_PATTERN = /^[a-zA-Z0-9_.-]+\.ya?ml$/;
|
|
183
|
-
const validateToken = (value) => {
|
|
184
|
-
if (!value) return null;
|
|
185
|
-
if (!TOKEN_PATTERN.test(value)) {
|
|
186
|
-
return 'Token must start with "github_pat_" followed by alphanumeric characters';
|
|
187
|
-
}
|
|
188
|
-
return null;
|
|
189
|
-
};
|
|
190
|
-
const validateRepoUrl = (value) => {
|
|
191
|
-
if (!value) return "Repository URL is required";
|
|
192
|
-
if (!REPO_URL_PATTERN.test(value)) {
|
|
193
|
-
return "Must be a valid GitHub URL (e.g., https://github.com/owner/repo)";
|
|
194
|
-
}
|
|
195
|
-
return null;
|
|
196
|
-
};
|
|
197
|
-
const validateWorkflow = (value) => {
|
|
198
|
-
if (!value) return null;
|
|
199
|
-
if (!WORKFLOW_PATTERN.test(value)) {
|
|
200
|
-
return "Workflow file must end with .yml or .yaml";
|
|
201
|
-
}
|
|
202
|
-
return null;
|
|
203
|
-
};
|
|
204
|
-
const SettingsPage = () => {
|
|
205
|
-
const { get, put } = admin.useFetchClient();
|
|
206
|
-
const [settings, setSettings] = react.useState({
|
|
207
|
-
githubToken: "",
|
|
208
|
-
repoUrl: "",
|
|
209
|
-
workflow: "",
|
|
210
|
-
branch: ""
|
|
211
|
-
});
|
|
212
|
-
const [errors, setErrors] = react.useState({});
|
|
213
|
-
const [hasExistingToken, setHasExistingToken] = react.useState(false);
|
|
214
|
-
const [maskedToken, setMaskedToken] = react.useState(null);
|
|
215
|
-
const [loading, setLoading] = react.useState(true);
|
|
216
|
-
const [saving, setSaving] = react.useState(false);
|
|
217
|
-
const [notification, setNotification] = react.useState(null);
|
|
218
|
-
react.useEffect(() => {
|
|
219
|
-
fetchSettings();
|
|
220
|
-
}, []);
|
|
221
|
-
const fetchSettings = async () => {
|
|
222
|
-
setLoading(true);
|
|
223
|
-
try {
|
|
224
|
-
const { data } = await get(`/${index.PLUGIN_ID}/settings`);
|
|
225
|
-
const fetchedSettings = data.data || {};
|
|
226
|
-
setSettings({
|
|
227
|
-
githubToken: "",
|
|
228
|
-
repoUrl: fetchedSettings.repoUrl || "",
|
|
229
|
-
workflow: fetchedSettings.workflow || "",
|
|
230
|
-
branch: fetchedSettings.branch || ""
|
|
231
|
-
});
|
|
232
|
-
setHasExistingToken(fetchedSettings.hasToken || false);
|
|
233
|
-
setMaskedToken(fetchedSettings.maskedToken || null);
|
|
234
|
-
} catch (error) {
|
|
235
|
-
console.error("Error fetching settings:", error);
|
|
236
|
-
setNotification({
|
|
237
|
-
type: "danger",
|
|
238
|
-
message: "Failed to load settings"
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
setLoading(false);
|
|
242
|
-
};
|
|
243
|
-
const validateAll = () => {
|
|
244
|
-
const newErrors = {};
|
|
245
|
-
const tokenError = validateToken(settings.githubToken);
|
|
246
|
-
if (tokenError && settings.githubToken) newErrors.githubToken = tokenError;
|
|
247
|
-
const repoError = validateRepoUrl(settings.repoUrl);
|
|
248
|
-
if (repoError) newErrors.repoUrl = repoError;
|
|
249
|
-
const workflowError = validateWorkflow(settings.workflow);
|
|
250
|
-
if (workflowError) newErrors.workflow = workflowError;
|
|
251
|
-
setErrors(newErrors);
|
|
252
|
-
return Object.keys(newErrors).length === 0;
|
|
253
|
-
};
|
|
254
|
-
const handleSave = async () => {
|
|
255
|
-
if (!validateAll()) {
|
|
256
|
-
setNotification({
|
|
257
|
-
type: "warning",
|
|
258
|
-
message: "Please fix the validation errors before saving"
|
|
259
|
-
});
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
setSaving(true);
|
|
263
|
-
try {
|
|
264
|
-
const dataToSave = { ...settings };
|
|
265
|
-
if (!dataToSave.githubToken) {
|
|
266
|
-
delete dataToSave.githubToken;
|
|
267
|
-
}
|
|
268
|
-
await put(`/${index.PLUGIN_ID}/settings`, { data: dataToSave });
|
|
269
|
-
if (settings.githubToken) {
|
|
270
|
-
setHasExistingToken(true);
|
|
271
|
-
}
|
|
272
|
-
setSettings((prev) => ({ ...prev, githubToken: "" }));
|
|
273
|
-
setNotification({
|
|
274
|
-
type: "success",
|
|
275
|
-
message: "Settings saved successfully"
|
|
276
|
-
});
|
|
277
|
-
} catch (error) {
|
|
278
|
-
console.error("Error saving settings:", error);
|
|
279
|
-
setNotification({
|
|
280
|
-
type: "danger",
|
|
281
|
-
message: "Failed to save settings"
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
setSaving(false);
|
|
285
|
-
};
|
|
286
|
-
const handleChange = (field) => (e) => {
|
|
287
|
-
const value = e.target.value;
|
|
288
|
-
setSettings((prev) => ({ ...prev, [field]: value }));
|
|
289
|
-
if (errors[field]) {
|
|
290
|
-
setErrors((prev) => ({ ...prev, [field]: null }));
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
const handleBlur = (field, validator) => () => {
|
|
294
|
-
const error = validator(settings[field]);
|
|
295
|
-
if (error) {
|
|
296
|
-
setErrors((prev) => ({ ...prev, [field]: error }));
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
if (loading) {
|
|
300
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Root, { children: [
|
|
301
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
302
|
-
admin.Layouts.Header,
|
|
303
|
-
{
|
|
304
|
-
title: "Settings",
|
|
305
|
-
subtitle: "Configure GitHub Actions deployment",
|
|
306
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(admin.BackButton, { fallback: `/plugins/${index.PLUGIN_ID}` })
|
|
307
|
-
}
|
|
308
|
-
),
|
|
309
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading settings..." }) }) })
|
|
310
|
-
] });
|
|
311
|
-
}
|
|
312
|
-
const isValid = settings.repoUrl && !errors.repoUrl && !errors.githubToken && !errors.workflow;
|
|
313
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Root, { children: [
|
|
314
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
315
|
-
admin.Layouts.Header,
|
|
316
|
-
{
|
|
317
|
-
title: "Settings",
|
|
318
|
-
subtitle: "Configure GitHub Actions deployment",
|
|
319
|
-
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(admin.BackButton, { fallback: `/plugins/${index.PLUGIN_ID}` }),
|
|
320
|
-
primaryAction: /* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
-
designSystem.Button,
|
|
322
|
-
{
|
|
323
|
-
onClick: handleSave,
|
|
324
|
-
loading: saving,
|
|
325
|
-
disabled: loading || !isValid,
|
|
326
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
|
|
327
|
-
size: "L",
|
|
328
|
-
children: "Save Settings"
|
|
329
|
-
}
|
|
330
|
-
)
|
|
331
|
-
}
|
|
332
|
-
),
|
|
333
|
-
/* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Content, { children: [
|
|
334
|
-
notification && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
335
|
-
designSystem.Alert,
|
|
336
|
-
{
|
|
337
|
-
closeLabel: "Close",
|
|
338
|
-
title: notification.message,
|
|
339
|
-
variant: notification.type,
|
|
340
|
-
onClose: () => setNotification(null)
|
|
341
|
-
}
|
|
342
|
-
) }),
|
|
343
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
344
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
-
designSystem.Box,
|
|
346
|
-
{
|
|
347
|
-
background: "neutral0",
|
|
348
|
-
hasRadius: true,
|
|
349
|
-
shadow: "filterShadow",
|
|
350
|
-
paddingTop: 6,
|
|
351
|
-
paddingBottom: 6,
|
|
352
|
-
paddingLeft: 7,
|
|
353
|
-
paddingRight: 7,
|
|
354
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
355
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: "Repository" }),
|
|
356
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
357
|
-
designSystem.Field.Root,
|
|
358
|
-
{
|
|
359
|
-
name: "repoUrl",
|
|
360
|
-
required: true,
|
|
361
|
-
error: errors.repoUrl,
|
|
362
|
-
hint: "Copy the URL from your browser when viewing the repository",
|
|
363
|
-
children: [
|
|
364
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Repository URL" }),
|
|
365
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
366
|
-
designSystem.Field.Input,
|
|
367
|
-
{
|
|
368
|
-
placeholder: "https://github.com/{owner}/{repo}",
|
|
369
|
-
value: settings.repoUrl,
|
|
370
|
-
onChange: handleChange("repoUrl"),
|
|
371
|
-
onBlur: handleBlur("repoUrl", validateRepoUrl)
|
|
372
|
-
}
|
|
373
|
-
),
|
|
374
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
375
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
376
|
-
]
|
|
377
|
-
}
|
|
378
|
-
)
|
|
379
|
-
] })
|
|
380
|
-
}
|
|
381
|
-
),
|
|
382
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
383
|
-
designSystem.Box,
|
|
384
|
-
{
|
|
385
|
-
background: "neutral0",
|
|
386
|
-
hasRadius: true,
|
|
387
|
-
shadow: "filterShadow",
|
|
388
|
-
paddingTop: 6,
|
|
389
|
-
paddingBottom: 6,
|
|
390
|
-
paddingLeft: 7,
|
|
391
|
-
paddingRight: 7,
|
|
392
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
393
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: "Workflow Configuration" }),
|
|
394
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
|
|
395
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
396
|
-
designSystem.Field.Root,
|
|
397
|
-
{
|
|
398
|
-
name: "workflow",
|
|
399
|
-
required: true,
|
|
400
|
-
error: errors.workflow,
|
|
401
|
-
hint: "Filename in .github/workflows/",
|
|
402
|
-
children: [
|
|
403
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Workflow File" }),
|
|
404
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
405
|
-
designSystem.Field.Input,
|
|
406
|
-
{
|
|
407
|
-
placeholder: "deploy.yml",
|
|
408
|
-
value: settings.workflow,
|
|
409
|
-
onChange: handleChange("workflow"),
|
|
410
|
-
onBlur: handleBlur("workflow", validateWorkflow)
|
|
411
|
-
}
|
|
412
|
-
),
|
|
413
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
414
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
415
|
-
]
|
|
416
|
-
}
|
|
417
|
-
) }),
|
|
418
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
419
|
-
designSystem.Field.Root,
|
|
420
|
-
{
|
|
421
|
-
name: "branch",
|
|
422
|
-
required: true,
|
|
423
|
-
hint: "Branch to trigger the workflow on",
|
|
424
|
-
children: [
|
|
425
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Branch" }),
|
|
426
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
-
designSystem.Field.Input,
|
|
428
|
-
{
|
|
429
|
-
placeholder: "main",
|
|
430
|
-
value: settings.branch,
|
|
431
|
-
onChange: handleChange("branch")
|
|
432
|
-
}
|
|
433
|
-
),
|
|
434
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
435
|
-
]
|
|
436
|
-
}
|
|
437
|
-
) })
|
|
438
|
-
] })
|
|
439
|
-
] })
|
|
440
|
-
}
|
|
441
|
-
),
|
|
442
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
443
|
-
designSystem.Box,
|
|
444
|
-
{
|
|
445
|
-
background: "neutral0",
|
|
446
|
-
hasRadius: true,
|
|
447
|
-
shadow: "filterShadow",
|
|
448
|
-
paddingTop: 6,
|
|
449
|
-
paddingBottom: 6,
|
|
450
|
-
paddingLeft: 7,
|
|
451
|
-
paddingRight: 7,
|
|
452
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
453
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: "Authentication" }),
|
|
454
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
455
|
-
designSystem.Field.Root,
|
|
456
|
-
{
|
|
457
|
-
name: "githubToken",
|
|
458
|
-
required: true,
|
|
459
|
-
error: errors.githubToken,
|
|
460
|
-
hint: !hasExistingToken || !maskedToken ? "Create a fine-grained token with Actions (Read and write) permission" : void 0,
|
|
461
|
-
children: [
|
|
462
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "GitHub Personal Access Token" }),
|
|
463
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
464
|
-
designSystem.Field.Input,
|
|
465
|
-
{
|
|
466
|
-
type: "password",
|
|
467
|
-
placeholder: hasExistingToken ? "••••••••••••••••" : "github_pat_xxxxxxxxxxxx",
|
|
468
|
-
value: settings.githubToken,
|
|
469
|
-
onChange: handleChange("githubToken"),
|
|
470
|
-
onBlur: handleBlur("githubToken", validateToken)
|
|
471
|
-
}
|
|
472
|
-
),
|
|
473
|
-
hasExistingToken && maskedToken ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
|
|
474
|
-
"Existing token:",
|
|
475
|
-
" ",
|
|
476
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
477
|
-
designSystem.Typography,
|
|
478
|
-
{
|
|
479
|
-
variant: "pi",
|
|
480
|
-
fontWeight: "bold",
|
|
481
|
-
textColor: "success600",
|
|
482
|
-
tag: "span",
|
|
483
|
-
children: maskedToken
|
|
484
|
-
}
|
|
485
|
-
),
|
|
486
|
-
". Leave empty to keep existing, or enter new to replace."
|
|
487
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
488
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
489
|
-
]
|
|
490
|
-
}
|
|
491
|
-
),
|
|
492
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingTop: 2, children: [
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: "How to get a GitHub Token:" }),
|
|
494
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", tag: "ol", textColor: "neutral600", children: [
|
|
495
|
-
/* @__PURE__ */ jsxRuntime.jsx("li", { children: "Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens" }),
|
|
496
|
-
/* @__PURE__ */ jsxRuntime.jsx("li", { children: 'Click "Generate new token"' }),
|
|
497
|
-
/* @__PURE__ */ jsxRuntime.jsx("li", { children: "Set token name, expiration, and select the target repository" }),
|
|
498
|
-
/* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
499
|
-
'Under "Repository permissions", set ',
|
|
500
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Actions" }),
|
|
501
|
-
' to "Read and write"'
|
|
502
|
-
] }),
|
|
503
|
-
/* @__PURE__ */ jsxRuntime.jsx("li", { children: 'Click "Generate token" and paste it above' })
|
|
504
|
-
] }) })
|
|
505
|
-
] })
|
|
506
|
-
] })
|
|
507
|
-
}
|
|
508
|
-
)
|
|
509
|
-
] })
|
|
510
|
-
] })
|
|
511
|
-
] });
|
|
512
|
-
};
|
|
513
|
-
const App = () => {
|
|
514
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
515
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
|
|
516
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "settings", element: /* @__PURE__ */ jsxRuntime.jsx(SettingsPage, {}) }),
|
|
517
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
|
|
518
|
-
] });
|
|
519
|
-
};
|
|
520
|
-
exports.App = App;
|