plum-e2e 1.0.10 → 1.1.1
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/.claude/settings.local.json +16 -1
- package/.vscode/settings.json +10 -0
- package/README.md +151 -37
- package/backend/_scaffold/features/LoginPage.feature +45 -3
- package/backend/_scaffold/pages/HomepagePage.ts +7 -0
- package/backend/_scaffold/pages/LoginPage.ts +37 -13
- package/backend/_scaffold/step_definitions/HomepageSteps.ts +6 -0
- package/backend/_scaffold/step_definitions/LoginSteps.ts +30 -4
- package/backend/_scaffold/utils/browser.ts +33 -0
- package/backend/_scaffold/utils/hooks.ts +8 -29
- package/backend/_scaffold/utils/utils.ts +3 -9
- package/backend/config/scripts/create-settings.js +7 -14
- package/backend/config/scripts/create-step.mjs +268 -0
- package/backend/config/scripts/generate-report.js +31 -75
- package/backend/config/scripts/run-tests.js +19 -4
- package/backend/package-lock.json +56 -641
- package/backend/package.json +4 -1
- package/backend/routes/reports.routes.js +6 -10
- package/backend/services/envService.js +4 -10
- package/backend/services/reportService.js +70 -20
- package/backend/services/testService.js +99 -24
- package/backend/tsconfig.json +2 -2
- package/backend/websockets/socketHandler.js +12 -6
- package/bin/plum.js +49 -3
- package/frontend/package-lock.json +436 -135
- package/frontend/package.json +1 -1
- package/frontend/src/app.css +241 -6
- package/frontend/src/app.html +14 -1
- package/frontend/src/lib/api/reports.js +68 -0
- package/frontend/src/lib/api/schedules.js +64 -0
- package/frontend/src/lib/api/tests.js +41 -0
- package/frontend/src/lib/components/layout/Nav.svelte +304 -0
- package/frontend/src/lib/components/layout/PageShell.svelte +28 -0
- package/frontend/src/lib/components/layout/RunnerPanel.svelte +378 -0
- package/frontend/src/lib/components/ui/Badge.svelte +63 -0
- package/frontend/src/lib/components/ui/Button.svelte +117 -0
- package/frontend/src/lib/components/ui/Modal.svelte +140 -0
- package/frontend/src/lib/components/ui/Pagination.svelte +100 -0
- package/frontend/src/lib/components/ui/Terminal.svelte +100 -0
- package/frontend/src/lib/stores/runner.js +55 -0
- package/frontend/src/lib/stores/theme.js +47 -0
- package/frontend/src/routes/+layout.svelte +7 -12
- package/frontend/src/routes/+page.svelte +690 -142
- package/frontend/src/routes/reports/+page.svelte +395 -125
- package/frontend/src/routes/reports/[slug]/+page.svelte +749 -0
- package/frontend/src/routes/scheduled-tests/+page.svelte +267 -303
- package/frontend/svelte.config.js +1 -4
- package/frontend/tailwind.config.js +2 -23
- package/package.json +2 -2
- package/backend/_scaffold/utils/world.ts +0 -25
- package/frontend/src/routes/components/Navigation.svelte +0 -53
package/frontend/package.json
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@sveltejs/adapter-auto": "^4.0.0",
|
|
14
|
+
"@sveltejs/adapter-node": "^5.5.4",
|
|
14
15
|
"@sveltejs/kit": "^2.16.0",
|
|
15
16
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
16
17
|
"autoprefixer": "^10.4.20",
|
|
17
|
-
"daisyui": "^4.12.23",
|
|
18
18
|
"postcss": "^8.5.1",
|
|
19
19
|
"svelte": "^5.0.0",
|
|
20
20
|
"tailwindcss": "^3.4.17",
|
package/frontend/src/app.css
CHANGED
|
@@ -14,22 +14,257 @@ GNU General Public License for more details.
|
|
|
14
14
|
You should have received a copy of the GNU General Public License
|
|
15
15
|
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
*/
|
|
17
|
+
|
|
17
18
|
@tailwind base;
|
|
18
19
|
@tailwind components;
|
|
19
20
|
@tailwind utilities;
|
|
20
21
|
|
|
22
|
+
/* ── Design tokens ─────────────────────────────────────────────────────── */
|
|
23
|
+
|
|
24
|
+
:root {
|
|
25
|
+
--bg: #fdfcfb;
|
|
26
|
+
--bg-subtle: #f7f6f4;
|
|
27
|
+
--bg-elevated: #ffffff;
|
|
28
|
+
--border: #e9e5df;
|
|
29
|
+
--text: #18160f;
|
|
30
|
+
--text-muted: #9c9185;
|
|
31
|
+
--accent: #5c1b87;
|
|
32
|
+
--accent-soft: #f3eaff;
|
|
33
|
+
--pass: #16a34a;
|
|
34
|
+
--pass-soft: #dcfce7;
|
|
35
|
+
--fail: #dc2626;
|
|
36
|
+
--fail-soft: #fee2e2;
|
|
37
|
+
--warn: #d97706;
|
|
38
|
+
--warn-soft: #fef3c7;
|
|
39
|
+
--terminal-bg: #0d0c08;
|
|
40
|
+
--terminal-text: #d6d0c8;
|
|
41
|
+
|
|
42
|
+
--font-display: 'Playfair Display', Georgia, serif;
|
|
43
|
+
--font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
|
|
44
|
+
|
|
45
|
+
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
46
|
+
--duration-fast: 140ms;
|
|
47
|
+
--duration-base: 240ms;
|
|
48
|
+
--duration-slow: 400ms;
|
|
49
|
+
|
|
50
|
+
--radius-sm: 6px;
|
|
51
|
+
--radius-md: 10px;
|
|
52
|
+
--radius-lg: 16px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-theme='dark'] {
|
|
56
|
+
--bg: #101009;
|
|
57
|
+
--bg-subtle: #1a1910;
|
|
58
|
+
--bg-elevated: #201f14;
|
|
59
|
+
--border: #2e2c1e;
|
|
60
|
+
--text: #f0ede6;
|
|
61
|
+
--text-muted: #706a5e;
|
|
62
|
+
--accent: #d0a5f5;
|
|
63
|
+
--accent-soft: #1b0d30;
|
|
64
|
+
--pass: #22c55e;
|
|
65
|
+
--pass-soft: #0d2118;
|
|
66
|
+
--fail: #f87171;
|
|
67
|
+
--fail-soft: #2d1010;
|
|
68
|
+
--warn: #fbbf24;
|
|
69
|
+
--warn-soft: #2a1f06;
|
|
70
|
+
--terminal-bg: #080807;
|
|
71
|
+
--terminal-text: #cbc5bd;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ── Reset ──────────────────────────────────────────────────────────────── */
|
|
75
|
+
|
|
76
|
+
*,
|
|
77
|
+
*::before,
|
|
78
|
+
*::after {
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
margin: 0;
|
|
81
|
+
padding: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
21
84
|
html {
|
|
22
85
|
scroll-behavior: smooth;
|
|
23
86
|
}
|
|
24
87
|
|
|
25
|
-
|
|
26
|
-
font-family:
|
|
88
|
+
body {
|
|
89
|
+
font-family: var(--font-body);
|
|
27
90
|
font-weight: 300;
|
|
91
|
+
font-size: 1rem;
|
|
92
|
+
line-height: 1.65;
|
|
93
|
+
background-color: var(--bg);
|
|
94
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
|
|
95
|
+
background-size: 200px 200px;
|
|
96
|
+
color: var(--text);
|
|
97
|
+
transition:
|
|
98
|
+
background-color var(--duration-base) var(--ease-out),
|
|
99
|
+
color var(--duration-base) var(--ease-out);
|
|
100
|
+
-webkit-font-smoothing: antialiased;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
h1 {
|
|
104
|
+
font-family: var(--font-display);
|
|
105
|
+
font-weight: 400;
|
|
106
|
+
line-height: 1.1;
|
|
107
|
+
letter-spacing: -0.015em;
|
|
108
|
+
color: var(--text);
|
|
28
109
|
}
|
|
29
110
|
|
|
30
|
-
h1,
|
|
31
111
|
h2,
|
|
32
|
-
h3
|
|
33
|
-
|
|
34
|
-
font-
|
|
112
|
+
h3 {
|
|
113
|
+
font-family: var(--font-display);
|
|
114
|
+
font-weight: 400;
|
|
115
|
+
line-height: 1.2;
|
|
116
|
+
color: var(--text);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
a {
|
|
120
|
+
color: inherit;
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
button {
|
|
125
|
+
font-family: var(--font-body);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* ── Global form styles ─────────────────────────────────────────────────── */
|
|
129
|
+
|
|
130
|
+
.field {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 0.375rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.field-label {
|
|
137
|
+
display: flex;
|
|
138
|
+
justify-content: space-between;
|
|
139
|
+
font-size: 0.8125rem;
|
|
140
|
+
font-weight: 400;
|
|
141
|
+
color: var(--text-muted);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.field-hint {
|
|
145
|
+
font-size: 0.75rem;
|
|
146
|
+
color: var(--text-muted);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.field-input {
|
|
150
|
+
width: 100%;
|
|
151
|
+
padding: 0.6rem 0.875rem;
|
|
152
|
+
border: 1px solid var(--border);
|
|
153
|
+
border-radius: var(--radius-md);
|
|
154
|
+
background: var(--bg-subtle);
|
|
155
|
+
color: var(--text);
|
|
156
|
+
font-family: var(--font-body);
|
|
157
|
+
font-size: 0.875rem;
|
|
158
|
+
font-weight: 300;
|
|
159
|
+
outline: none;
|
|
160
|
+
transition:
|
|
161
|
+
border-color var(--duration-fast),
|
|
162
|
+
box-shadow var(--duration-fast);
|
|
163
|
+
appearance: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.field-input:focus {
|
|
167
|
+
border-color: var(--accent);
|
|
168
|
+
box-shadow: 0 0 0 3px var(--accent-soft);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.field-input:disabled {
|
|
172
|
+
opacity: 0.5;
|
|
173
|
+
cursor: not-allowed;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.field-input::placeholder {
|
|
177
|
+
color: var(--text-muted);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* ── Global table ───────────────────────────────────────────────────────── */
|
|
181
|
+
|
|
182
|
+
.data-table {
|
|
183
|
+
width: 100%;
|
|
184
|
+
border-collapse: collapse;
|
|
185
|
+
font-size: 0.875rem;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.data-table th {
|
|
189
|
+
text-align: left;
|
|
190
|
+
padding: 0.5rem 1rem;
|
|
191
|
+
font-family: var(--font-body);
|
|
192
|
+
font-weight: 500;
|
|
193
|
+
font-size: 0.7rem;
|
|
194
|
+
letter-spacing: 0.07em;
|
|
195
|
+
text-transform: uppercase;
|
|
196
|
+
color: var(--text-muted);
|
|
197
|
+
border-bottom: 1px solid var(--border);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.data-table td {
|
|
201
|
+
padding: 0.875rem 1rem;
|
|
202
|
+
border-bottom: 1px solid var(--border);
|
|
203
|
+
color: var(--text);
|
|
204
|
+
vertical-align: middle;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.data-table tbody tr:last-child td {
|
|
208
|
+
border-bottom: none;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* ── Card ───────────────────────────────────────────────────────────────── */
|
|
212
|
+
|
|
213
|
+
.card {
|
|
214
|
+
background: var(--bg-elevated);
|
|
215
|
+
border: 1px solid var(--border);
|
|
216
|
+
border-radius: var(--radius-lg);
|
|
217
|
+
padding: 1.5rem;
|
|
218
|
+
transition:
|
|
219
|
+
background var(--duration-base) var(--ease-out),
|
|
220
|
+
border-color var(--duration-base) var(--ease-out);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.card-title {
|
|
224
|
+
font-family: var(--font-display);
|
|
225
|
+
font-size: 1.25rem;
|
|
226
|
+
font-weight: 400;
|
|
227
|
+
color: var(--text);
|
|
228
|
+
margin-bottom: 0.25rem;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.card-subtitle {
|
|
232
|
+
font-size: 0.8125rem;
|
|
233
|
+
color: var(--text-muted);
|
|
234
|
+
margin-bottom: 1.25rem;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* ── Alert ──────────────────────────────────────────────────────────────── */
|
|
238
|
+
|
|
239
|
+
.alert {
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
gap: 0.625rem;
|
|
243
|
+
padding: 0.75rem 1rem;
|
|
244
|
+
border-radius: var(--radius-md);
|
|
245
|
+
font-size: 0.875rem;
|
|
246
|
+
font-weight: 400;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.alert-success {
|
|
250
|
+
background: var(--pass-soft);
|
|
251
|
+
color: var(--pass);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.alert-error {
|
|
255
|
+
background: var(--fail-soft);
|
|
256
|
+
color: var(--fail);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* ── Animations ─────────────────────────────────────────────────────────── */
|
|
260
|
+
|
|
261
|
+
@keyframes fadeUp {
|
|
262
|
+
from {
|
|
263
|
+
opacity: 0;
|
|
264
|
+
transform: translateY(10px);
|
|
265
|
+
}
|
|
266
|
+
to {
|
|
267
|
+
opacity: 1;
|
|
268
|
+
transform: translateY(0);
|
|
269
|
+
}
|
|
35
270
|
}
|
package/frontend/src/app.html
CHANGED
|
@@ -15,11 +15,24 @@ You should have received a copy of the GNU General Public License
|
|
|
15
15
|
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
-->
|
|
17
17
|
<!doctype html>
|
|
18
|
-
<html lang="en">
|
|
18
|
+
<html lang="en" data-theme="light">
|
|
19
19
|
<head>
|
|
20
20
|
<meta charset="utf-8" />
|
|
21
21
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
|
22
22
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
23
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
24
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
25
|
+
<link
|
|
26
|
+
href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap"
|
|
27
|
+
rel="stylesheet"
|
|
28
|
+
/>
|
|
29
|
+
<!-- Prevent theme flash before Svelte hydrates -->
|
|
30
|
+
<script>
|
|
31
|
+
try {
|
|
32
|
+
const t = localStorage.getItem('plum-theme');
|
|
33
|
+
if (t) document.documentElement.setAttribute('data-theme', t);
|
|
34
|
+
} catch (e) {}
|
|
35
|
+
</script>
|
|
23
36
|
%sveltekit.head%
|
|
24
37
|
</head>
|
|
25
38
|
<body data-sveltekit-preload-data="hover">
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
This file is part of Plum.
|
|
20
|
+
|
|
21
|
+
Plum is free software: you can redistribute it and/or modify
|
|
22
|
+
it under the terms of the GNU General Public License as published by
|
|
23
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
(at your option) any later version.
|
|
25
|
+
|
|
26
|
+
Plum is distributed in the hope that it will be useful,
|
|
27
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
GNU General Public License for more details.
|
|
30
|
+
|
|
31
|
+
You should have received a copy of the GNU General Public License
|
|
32
|
+
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const BASE = 'http://localhost:3001';
|
|
36
|
+
|
|
37
|
+
export async function fetchReports() {
|
|
38
|
+
const res = await fetch(`${BASE}/reports`);
|
|
39
|
+
const { reports } = await res.json();
|
|
40
|
+
return reports.map(parseReport).filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function fetchLatestReport() {
|
|
44
|
+
const res = await fetch(`${BASE}/reports/latest`);
|
|
45
|
+
const { latestReport } = await res.json();
|
|
46
|
+
return latestReport;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function reportUrl(fileName) {
|
|
50
|
+
return `/reports/${encodeURIComponent(fileName)}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function fetchReportDetail(fileName) {
|
|
54
|
+
const res = await fetch(`${BASE}/reports/${encodeURIComponent(fileName)}/detail`);
|
|
55
|
+
if (!res.ok) throw new Error('Report not found');
|
|
56
|
+
return res.json();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function parseReport(fileName) {
|
|
60
|
+
const match = fileName.match(
|
|
61
|
+
/(PASS|FAIL)_cucumber_report_(.+?)_\(([^)]+)\)(?:_runners_(\d+))?_(\d{4})_(\d{2})_(\d{2})T(\d{2})_(\d{2})_(\d{2})_\d{3}Z\.json/
|
|
62
|
+
);
|
|
63
|
+
if (!match) return null;
|
|
64
|
+
const [, status, triggerType, tags, runners = '1', year, month, day, hour, minute, second] =
|
|
65
|
+
match;
|
|
66
|
+
const date = new Date(`${year}-${month}-${day}T${hour}:${minute}:${second}Z`).toLocaleString();
|
|
67
|
+
return { fileName, status, triggerType, tags, runners: Number(runners), date };
|
|
68
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
This file is part of Plum.
|
|
20
|
+
|
|
21
|
+
Plum is free software: you can redistribute it and/or modify
|
|
22
|
+
it under the terms of the GNU General Public License as published by
|
|
23
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
(at your option) any later version.
|
|
25
|
+
|
|
26
|
+
Plum is distributed in the hope that it will be useful,
|
|
27
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
GNU General Public License for more details.
|
|
30
|
+
|
|
31
|
+
You should have received a copy of the GNU General Public License
|
|
32
|
+
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const BASE = 'http://localhost:3001';
|
|
36
|
+
|
|
37
|
+
export async function fetchSchedules() {
|
|
38
|
+
const res = await fetch(`${BASE}/schedules`);
|
|
39
|
+
const { schedules } = await res.json();
|
|
40
|
+
return schedules ?? [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function fetchCronJobs() {
|
|
44
|
+
const res = await fetch(`${BASE}/cron-jobs`);
|
|
45
|
+
const { cronJobs } = await res.json();
|
|
46
|
+
return cronJobs ?? [];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function saveCronJob({ taskName, cronExpression, tags, isEditing, editTaskName }) {
|
|
50
|
+
const formattedTags = tags.replace(/\sOR\s/gi, (m) => m.toLowerCase());
|
|
51
|
+
const url = isEditing ? `${BASE}/cron-jobs/${editTaskName}` : `${BASE}/cron-jobs`;
|
|
52
|
+
const method = isEditing ? 'PUT' : 'POST';
|
|
53
|
+
const res = await fetch(url, {
|
|
54
|
+
method,
|
|
55
|
+
headers: { 'Content-Type': 'application/json' },
|
|
56
|
+
body: JSON.stringify({ cronExpression, taskName, tags: formattedTags })
|
|
57
|
+
});
|
|
58
|
+
return res.json();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function deleteCronJob(taskName) {
|
|
62
|
+
const res = await fetch(`${BASE}/cron-jobs/${taskName}`, { method: 'DELETE' });
|
|
63
|
+
return res.json();
|
|
64
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
This file is part of Plum.
|
|
20
|
+
|
|
21
|
+
Plum is free software: you can redistribute it and/or modify
|
|
22
|
+
it under the terms of the GNU General Public License as published by
|
|
23
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
(at your option) any later version.
|
|
25
|
+
|
|
26
|
+
Plum is distributed in the hope that it will be useful,
|
|
27
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
GNU General Public License for more details.
|
|
30
|
+
|
|
31
|
+
You should have received a copy of the GNU General Public License
|
|
32
|
+
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const BASE = 'http://localhost:3001';
|
|
36
|
+
|
|
37
|
+
export async function fetchSuites() {
|
|
38
|
+
const res = await fetch(`${BASE}/tests`);
|
|
39
|
+
const { suites } = await res.json();
|
|
40
|
+
return suites.suites ?? [];
|
|
41
|
+
}
|