@activecollab/components 2.0.478 → 2.0.480
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/cjs/components/ConfirmDialog/ConfirmDialog.js +2 -2
- package/dist/cjs/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/cjs/presentation/shared/index.js +156 -0
- package/dist/cjs/presentation/shared/index.js.map +1 -1
- package/dist/cjs/presentation/shared/selfHostedSettings.js +277 -0
- package/dist/cjs/presentation/shared/selfHostedSettings.js.map +1 -0
- package/dist/cjs/presentation/shared/selfHostedUpgrade.js +1440 -0
- package/dist/cjs/presentation/shared/selfHostedUpgrade.js.map +1 -0
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.js +2 -2
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/esm/presentation/shared/index.d.ts +4 -0
- package/dist/esm/presentation/shared/index.d.ts.map +1 -1
- package/dist/esm/presentation/shared/index.js +2 -0
- package/dist/esm/presentation/shared/index.js.map +1 -1
- package/dist/esm/presentation/shared/selfHostedSettings.d.ts +83 -0
- package/dist/esm/presentation/shared/selfHostedSettings.d.ts.map +1 -0
- package/dist/esm/presentation/shared/selfHostedSettings.js +253 -0
- package/dist/esm/presentation/shared/selfHostedSettings.js.map +1 -0
- package/dist/esm/presentation/shared/selfHostedUpgrade.d.ts +235 -0
- package/dist/esm/presentation/shared/selfHostedUpgrade.d.ts.map +1 -0
- package/dist/esm/presentation/shared/selfHostedUpgrade.js +1329 -0
- package/dist/esm/presentation/shared/selfHostedUpgrade.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase B building blocks for the Self-Hosted Settings concept: the redesigned
|
|
3
|
+
* Version row as the entry point to an in-app, tokenized upgrade.
|
|
4
|
+
*
|
|
5
|
+
* These are DESIGN-CONCEPT helpers, not shipped code. They compose DS
|
|
6
|
+
* components (`Dialog`, `InfoBox`, `StepSequence`, `ProgressBar`, `RadioGroup`,
|
|
7
|
+
* `Input`, `Button`, `Link`, `Dot`, `Chip`) with a few local layout wrappers.
|
|
8
|
+
*
|
|
9
|
+
* DRAFT API: the payload types below are NOT shipped. They mirror the draft
|
|
10
|
+
* shapes proposed in the task (a future GET /system-status/upgrade + an
|
|
11
|
+
* UpgradeRun resource), so the concept can be wired without inventing fields
|
|
12
|
+
* ad hoc. Marked `// DRAFT API: not shipped`.
|
|
13
|
+
*
|
|
14
|
+
* Gaps recorded here (see handover):
|
|
15
|
+
* - `ReleaseNotesHtml` renders server HTML via dangerouslySetInnerHTML; DS
|
|
16
|
+
* `PortableText` takes a structured block model, not an HTML string, so it
|
|
17
|
+
* is not the right renderer for `release_notes[].html`.
|
|
18
|
+
* - `LogPanel` / `CommandBlock` stand in for a DS LogViewer / CodeBlock, which
|
|
19
|
+
* do not exist.
|
|
20
|
+
* - `PreflightGate` is built on the base `Dialog` (not DS `ConfirmDialog`)
|
|
21
|
+
* because ConfirmDialog cannot disable its confirm button on a blocking
|
|
22
|
+
* check — it only gates via a checkbox or `isLoading`.
|
|
23
|
+
* - Error states use `InfoBox type="warning"`; InfoBox has no error/danger
|
|
24
|
+
* variant.
|
|
25
|
+
*/
|
|
26
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
27
|
+
import styled from "styled-components";
|
|
28
|
+
import { CommandCode } from "./selfHostedSettings";
|
|
29
|
+
import { MONO } from "./tokens";
|
|
30
|
+
import { Accordion, AccordionItem, AccordionItemBody, AccordionItemHead } from "../../components/Accordion";
|
|
31
|
+
import { Button } from "../../components/Button";
|
|
32
|
+
import { Chip } from "../../components/Chip";
|
|
33
|
+
import { ConfirmDialog } from "../../components/ConfirmDialog";
|
|
34
|
+
import { Dialog } from "../../components/Dialog";
|
|
35
|
+
import { Dot } from "../../components/Dot";
|
|
36
|
+
import { ArrowRightIcon, CancelCrossIcon, CheckIcon, InfoIcon, WarningTriangleIcon } from "../../components/Icons";
|
|
37
|
+
import { InfoBox } from "../../components/InfoBox";
|
|
38
|
+
import { Input } from "../../components/Input";
|
|
39
|
+
import { Label } from "../../components/Label";
|
|
40
|
+
import { Link } from "../../components/Links";
|
|
41
|
+
import { LinearLoader, SpinnerLoader } from "../../components/Loaders";
|
|
42
|
+
import { ProgressBar } from "../../components/ProgressBar";
|
|
43
|
+
import { RadioGroup } from "../../components/RadioGroup";
|
|
44
|
+
import { StepSequence } from "../../components/StepSequence";
|
|
45
|
+
import { Textarea } from "../../components/Textarea";
|
|
46
|
+
import { Body2, Caption1, Header3 } from "../../components/Typography";
|
|
47
|
+
|
|
48
|
+
/* ================================================================== */
|
|
49
|
+
/* DRAFT payload types (from the task; not shipped) */
|
|
50
|
+
/* ================================================================== */
|
|
51
|
+
|
|
52
|
+
// DRAFT API: not shipped
|
|
53
|
+
|
|
54
|
+
// DRAFT API: not shipped
|
|
55
|
+
|
|
56
|
+
// DRAFT API: not shipped
|
|
57
|
+
|
|
58
|
+
// DRAFT API: not shipped
|
|
59
|
+
|
|
60
|
+
// DRAFT API: not shipped
|
|
61
|
+
|
|
62
|
+
// DRAFT API: not shipped
|
|
63
|
+
|
|
64
|
+
// DRAFT API: not shipped. "info" is an addition to the draft: a neutral fact
|
|
65
|
+
// that is neither good nor a risk (e.g. whether real-time updates exist).
|
|
66
|
+
|
|
67
|
+
// DRAFT API: not shipped
|
|
68
|
+
|
|
69
|
+
// DRAFT API: not shipped
|
|
70
|
+
// DRAFT API: not shipped. How a run is executed; preflight picks the best
|
|
71
|
+
// one the server allows. Pusher only speeds up progress display, it never
|
|
72
|
+
// changes the driver.
|
|
73
|
+
|
|
74
|
+
// DRAFT API: not shipped
|
|
75
|
+
|
|
76
|
+
// DRAFT API: not shipped
|
|
77
|
+
|
|
78
|
+
// DRAFT API: not shipped
|
|
79
|
+
|
|
80
|
+
// DRAFT API: not shipped
|
|
81
|
+
|
|
82
|
+
// DRAFT API: not shipped
|
|
83
|
+
|
|
84
|
+
// DRAFT API: not shipped
|
|
85
|
+
|
|
86
|
+
// DRAFT API: not shipped
|
|
87
|
+
|
|
88
|
+
// DRAFT API: not shipped
|
|
89
|
+
|
|
90
|
+
/* ================================================================== */
|
|
91
|
+
/* Render-time helpers (never precomputed into a payload field) */
|
|
92
|
+
/* ================================================================== */
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The four owner-facing phases of a run. The ten technical steps only appear
|
|
96
|
+
* in the log; the spine and the current-step line speak in phases.
|
|
97
|
+
*/
|
|
98
|
+
const PHASES = [{
|
|
99
|
+
key: "preparing",
|
|
100
|
+
label: "Preparing",
|
|
101
|
+
steps: ["preflight"]
|
|
102
|
+
}, {
|
|
103
|
+
key: "downloading",
|
|
104
|
+
label: "Downloading",
|
|
105
|
+
steps: ["download", "verify", "unpack"]
|
|
106
|
+
}, {
|
|
107
|
+
key: "database",
|
|
108
|
+
label: "Updating database",
|
|
109
|
+
steps: ["env_check", "backup", "migrations"]
|
|
110
|
+
}, {
|
|
111
|
+
key: "finishing",
|
|
112
|
+
label: "Finishing",
|
|
113
|
+
steps: ["assets", "switch", "cleanup"]
|
|
114
|
+
}];
|
|
115
|
+
const phaseIndex = step => PHASES.findIndex(phase => phase.steps.includes(step));
|
|
116
|
+
|
|
117
|
+
/** What the current step is doing, as the line under the phase name. */
|
|
118
|
+
const STEP_ACTIVITY = {
|
|
119
|
+
preflight: "Running preflight checks",
|
|
120
|
+
download: "Downloading the release",
|
|
121
|
+
verify: "Verifying the download",
|
|
122
|
+
unpack: "Unpacking the release",
|
|
123
|
+
env_check: "Checking the environment",
|
|
124
|
+
backup: "Backing up the database",
|
|
125
|
+
migrations: "Running migrations",
|
|
126
|
+
assets: "Rebuilding assets",
|
|
127
|
+
switch: "Switching to the new version",
|
|
128
|
+
cleanup: "Cleaning up"
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** A heartbeat older than this means the runner stopped responding. */
|
|
132
|
+
const STALLED_AFTER_SECONDS = 5 * 60;
|
|
133
|
+
|
|
134
|
+
/** "3 s", "4 min 12 s", "1 h 5 min". */
|
|
135
|
+
const formatDuration = seconds => {
|
|
136
|
+
const total = Math.max(0, Math.round(seconds));
|
|
137
|
+
if (total < 60) {
|
|
138
|
+
return total + " s";
|
|
139
|
+
}
|
|
140
|
+
if (total < 3600) {
|
|
141
|
+
const rest = total % 60;
|
|
142
|
+
return Math.floor(total / 60) + " min" + (rest ? " " + rest + " s" : "");
|
|
143
|
+
}
|
|
144
|
+
return Math.floor(total / 3600) + " h " + Math.floor(total % 3600 / 60) + " min";
|
|
145
|
+
};
|
|
146
|
+
const formatDateTime = unixSeconds => new Date(unixSeconds * 1000).toLocaleString("en-US", {
|
|
147
|
+
day: "numeric",
|
|
148
|
+
month: "short",
|
|
149
|
+
year: "numeric",
|
|
150
|
+
hour: "2-digit",
|
|
151
|
+
minute: "2-digit"
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
/** Date-only fields (expiry dates), like the app's formatDateSmart. */
|
|
155
|
+
export const formatDate = unixSeconds => new Date(unixSeconds * 1000).toLocaleDateString("en-US", {
|
|
156
|
+
day: "numeric",
|
|
157
|
+
month: "short",
|
|
158
|
+
year: "numeric"
|
|
159
|
+
});
|
|
160
|
+
const formatClock = unixSeconds => new Date(unixSeconds * 1000).toLocaleTimeString("en-US", {
|
|
161
|
+
hour: "2-digit",
|
|
162
|
+
minute: "2-digit",
|
|
163
|
+
second: "2-digit",
|
|
164
|
+
hour12: false
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
/** "312 / 905" or "48 / 120 MB"; the step's activity line names the unit. */
|
|
168
|
+
const formatStepProgress = progress => {
|
|
169
|
+
// A step with no measurable progress reports total 0.
|
|
170
|
+
if (progress.total === 0) {
|
|
171
|
+
return "";
|
|
172
|
+
}
|
|
173
|
+
if (progress.unit === "bytes") {
|
|
174
|
+
const toMb = n => Math.round(n / 1000000);
|
|
175
|
+
return toMb(progress.done) + " / " + toMb(progress.total) + " MB";
|
|
176
|
+
}
|
|
177
|
+
return progress.done + " / " + progress.total;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/* ================================================================== */
|
|
181
|
+
/* CommandBlock — a full-width code block (stands in for a DS CodeBlock) */
|
|
182
|
+
/* ================================================================== */
|
|
183
|
+
|
|
184
|
+
const CommandBlockWrap = styled.div.withConfig({
|
|
185
|
+
displayName: "selfHostedUpgrade__CommandBlockWrap",
|
|
186
|
+
componentId: "sc-1dxkjfk-0"
|
|
187
|
+
})(["display:flex;align-items:center;justify-content:space-between;align-self:stretch;gap:12px;padding:8px 12px;border:1px solid var(--color-theme-400);border-radius:var(--ac-br-6);background-color:var(--color-theme-200);overflow-x:auto;margin-top:4px;"]);
|
|
188
|
+
|
|
189
|
+
/** The inline CommandCode face, without its chip background. */
|
|
190
|
+
const CommandBlockText = styled(CommandCode).withConfig({
|
|
191
|
+
displayName: "selfHostedUpgrade__CommandBlockText",
|
|
192
|
+
componentId: "sc-1dxkjfk-1"
|
|
193
|
+
})(["background:none;padding:0;border-radius:0;white-space:pre;word-break:normal;"]);
|
|
194
|
+
|
|
195
|
+
/** Copies text (a no-op where the clipboard API is unavailable). */
|
|
196
|
+
const copyText = text => {
|
|
197
|
+
var _navigator$clipboard;
|
|
198
|
+
if ((_navigator$clipboard = navigator.clipboard) != null && _navigator$clipboard.writeText) {
|
|
199
|
+
navigator.clipboard.writeText(text).catch(() => undefined);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/** A command or config snippet with a Copy button ("Copied" for a moment). */
|
|
204
|
+
export const CommandBlock = _ref => {
|
|
205
|
+
let children = _ref.children;
|
|
206
|
+
const _useState = useState(false),
|
|
207
|
+
copied = _useState[0],
|
|
208
|
+
setCopied = _useState[1];
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (!copied) {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const timer = window.setTimeout(() => setCopied(false), 1500);
|
|
214
|
+
return () => window.clearTimeout(timer);
|
|
215
|
+
}, [copied]);
|
|
216
|
+
return /*#__PURE__*/React.createElement(CommandBlockWrap, null, /*#__PURE__*/React.createElement(CommandBlockText, null, children), /*#__PURE__*/React.createElement(Button, {
|
|
217
|
+
variant: "text colored",
|
|
218
|
+
size: "small",
|
|
219
|
+
onClick: () => {
|
|
220
|
+
copyText(children);
|
|
221
|
+
setCopied(true);
|
|
222
|
+
}
|
|
223
|
+
}, copied ? "Copied" : "Copy"));
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/* ================================================================== */
|
|
227
|
+
/* Small shared pieces */
|
|
228
|
+
/* ================================================================== */
|
|
229
|
+
|
|
230
|
+
const ON_SOLID = "var(--only-white)";
|
|
231
|
+
const Panel = styled.div.withConfig({
|
|
232
|
+
displayName: "selfHostedUpgrade__Panel",
|
|
233
|
+
componentId: "sc-1dxkjfk-2"
|
|
234
|
+
})(["display:flex;flex-direction:column;gap:16px;width:100%;"]);
|
|
235
|
+
const Row = styled.div.withConfig({
|
|
236
|
+
displayName: "selfHostedUpgrade__Row",
|
|
237
|
+
componentId: "sc-1dxkjfk-3"
|
|
238
|
+
})(["display:flex;align-items:center;gap:8px;flex-wrap:wrap;"]);
|
|
239
|
+
|
|
240
|
+
/** Numbered instruction line (avoids serif <ol> markers — there is no reset). */
|
|
241
|
+
const NumberedStep = styled.div.withConfig({
|
|
242
|
+
displayName: "selfHostedUpgrade__NumberedStep",
|
|
243
|
+
componentId: "sc-1dxkjfk-4"
|
|
244
|
+
})(["display:flex;gap:8px;.n{flex-shrink:0;}.body{display:flex;flex-direction:column;align-items:flex-start;gap:8px;flex:1;min-width:0;}"]);
|
|
245
|
+
|
|
246
|
+
/* --- Release notes: render server HTML (no DS HTML renderer) -------------- */
|
|
247
|
+
|
|
248
|
+
const ReleaseNotesWrap = styled.div.withConfig({
|
|
249
|
+
displayName: "selfHostedUpgrade__ReleaseNotesWrap",
|
|
250
|
+
componentId: "sc-1dxkjfk-5"
|
|
251
|
+
})(["display:flex;flex-direction:column;gap:12px;.rn-version{margin-bottom:4px;}.rn-html{color:var(--color-theme-800);font-size:13px;line-height:20px;}.rn-html p{margin:0 0 8px;}.rn-html ul{margin:0 0 8px;padding-left:18px;}.rn-html li{margin-bottom:4px;}.rn-html strong{font-weight:600;}.rn-html a{color:var(--color-primary);}"]);
|
|
252
|
+
export const ReleaseNotesHtml = _ref2 => {
|
|
253
|
+
let notes = _ref2.notes;
|
|
254
|
+
return /*#__PURE__*/React.createElement(ReleaseNotesWrap, null, notes.map(note => /*#__PURE__*/React.createElement("div", {
|
|
255
|
+
key: note.version
|
|
256
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
257
|
+
className: "rn-version",
|
|
258
|
+
color: "secondary",
|
|
259
|
+
weight: "bold"
|
|
260
|
+
}, note.version), /*#__PURE__*/React.createElement("div", {
|
|
261
|
+
className: "rn-html"
|
|
262
|
+
// eslint-disable-next-line react/no-danger
|
|
263
|
+
,
|
|
264
|
+
dangerouslySetInnerHTML: {
|
|
265
|
+
__html: note.html
|
|
266
|
+
}
|
|
267
|
+
}))));
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/* --- Collapsible log (stands in for a DS LogViewer) ---------------------- */
|
|
271
|
+
|
|
272
|
+
const LogWrap = styled.div.withConfig({
|
|
273
|
+
displayName: "selfHostedUpgrade__LogWrap",
|
|
274
|
+
componentId: "sc-1dxkjfk-6"
|
|
275
|
+
})(["display:flex;flex-direction:column;gap:4px;.log-header{display:flex;align-items:center;justify-content:space-between;min-height:24px;}"]);
|
|
276
|
+
|
|
277
|
+
// ds-exception: monospace log body uses the shared MONO face (AGENTS rule 4 —
|
|
278
|
+
// log lines are machine output, not prose).
|
|
279
|
+
const LogPre = styled.pre.withConfig({
|
|
280
|
+
displayName: "selfHostedUpgrade__LogPre",
|
|
281
|
+
componentId: "sc-1dxkjfk-7"
|
|
282
|
+
})(["margin:0;padding:12px 14px;border:1px solid var(--color-theme-400);border-radius:var(--ac-br-6);background-color:var(--color-theme-200);font-family:", ";font-size:12px;line-height:18px;max-height:220px;overflow:auto;white-space:pre-wrap;word-break:break-word;.lg-info{color:var(--color-theme-700);}.lg-warn{color:var(--warning);}.lg-error{color:var(--red-alert);}"], MONO);
|
|
283
|
+
const LEVEL_TAG = {
|
|
284
|
+
info: "INFO",
|
|
285
|
+
warn: "WARN",
|
|
286
|
+
error: "ERR "
|
|
287
|
+
};
|
|
288
|
+
const logText = log => log.map(entry => formatClock(entry.at) + " [" + LEVEL_TAG[entry.level] + "] " + entry.message).join("\n");
|
|
289
|
+
|
|
290
|
+
/** Copies the run log (a no-op where the clipboard API is unavailable). */
|
|
291
|
+
const copyLog = log => copyText(logText(log));
|
|
292
|
+
export const LogPanel = _ref3 => {
|
|
293
|
+
let log = _ref3.log,
|
|
294
|
+
_ref3$defaultOpen = _ref3.defaultOpen,
|
|
295
|
+
defaultOpen = _ref3$defaultOpen === void 0 ? false : _ref3$defaultOpen;
|
|
296
|
+
const _useState2 = useState(defaultOpen),
|
|
297
|
+
open = _useState2[0],
|
|
298
|
+
setOpen = _useState2[1];
|
|
299
|
+
return /*#__PURE__*/React.createElement(LogWrap, null, /*#__PURE__*/React.createElement("div", {
|
|
300
|
+
className: "log-header"
|
|
301
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
302
|
+
color: "secondary",
|
|
303
|
+
weight: "bold"
|
|
304
|
+
}, "Log"), /*#__PURE__*/React.createElement(Button, {
|
|
305
|
+
variant: "text colored",
|
|
306
|
+
size: "small",
|
|
307
|
+
onClick: () => setOpen(value => !value)
|
|
308
|
+
}, open ? "Hide log" : "Show log")), open ? /*#__PURE__*/React.createElement(LogPre, null, log.map((entry, index) => /*#__PURE__*/React.createElement("div", {
|
|
309
|
+
key: index,
|
|
310
|
+
className: "lg-" + entry.level
|
|
311
|
+
}, formatClock(entry.at), " [", LEVEL_TAG[entry.level], "] ", entry.message))) : null);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/* ================================================================== */
|
|
315
|
+
/* Version-row panels (states 1–7) */
|
|
316
|
+
/* ================================================================== */
|
|
317
|
+
|
|
318
|
+
/* --- 1. Token setup (a reusable dialog + the "not set up" entry) --------- */
|
|
319
|
+
|
|
320
|
+
const CONFIG_SNIPPET = "const AUTO_UPGRADE_TOKEN = 'sh1_…';";
|
|
321
|
+
const ENV_SNIPPET = "AUTO_UPGRADE_TOKEN=sh1_…";
|
|
322
|
+
const TokenSetupBody = styled.div.withConfig({
|
|
323
|
+
displayName: "selfHostedUpgrade__TokenSetupBody",
|
|
324
|
+
componentId: "sc-1dxkjfk-8"
|
|
325
|
+
})(["display:flex;flex-direction:column;gap:16px;"]);
|
|
326
|
+
|
|
327
|
+
// DRAFT API: not shipped — the error the token-save endpoint returns when
|
|
328
|
+
// ActiveCollab rejects the pasted token.
|
|
329
|
+
|
|
330
|
+
/** idle → verifying → (closed on success | failed); invalid = bad format. */
|
|
331
|
+
|
|
332
|
+
const TOKEN_PREFIX = "sh1_";
|
|
333
|
+
const VERIFY_DELAY_MS = 1200;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* The token setup steps as a reusable dialog. It is opened from the "not set
|
|
337
|
+
* up yet" Version row, from the token strip's Replace AND from the token
|
|
338
|
+
* check-failure states (expired / revoked / bound elsewhere). Rendered through
|
|
339
|
+
* the DS `Dialog` portal, so it layers above the Self-Hosted Settings dialog.
|
|
340
|
+
*/
|
|
341
|
+
export const TokenSetupDialog = _ref4 => {
|
|
342
|
+
let open = _ref4.open,
|
|
343
|
+
onClose = _ref4.onClose,
|
|
344
|
+
_ref4$mode = _ref4.mode,
|
|
345
|
+
mode = _ref4$mode === void 0 ? "add" : _ref4$mode,
|
|
346
|
+
_ref4$verifyResult = _ref4.verifyResult,
|
|
347
|
+
verifyResult = _ref4$verifyResult === void 0 ? "ok" : _ref4$verifyResult,
|
|
348
|
+
_ref4$initialToken = _ref4.initialToken,
|
|
349
|
+
initialToken = _ref4$initialToken === void 0 ? "" : _ref4$initialToken,
|
|
350
|
+
_ref4$initialState = _ref4.initialState,
|
|
351
|
+
initialState = _ref4$initialState === void 0 ? "idle" : _ref4$initialState;
|
|
352
|
+
const _useState3 = useState(initialToken),
|
|
353
|
+
token = _useState3[0],
|
|
354
|
+
setToken = _useState3[1];
|
|
355
|
+
const _useState4 = useState(initialState),
|
|
356
|
+
state = _useState4[0],
|
|
357
|
+
setState = _useState4[1];
|
|
358
|
+
const timer = useRef();
|
|
359
|
+
const replace = mode === "replace";
|
|
360
|
+
useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
361
|
+
const close = () => {
|
|
362
|
+
window.clearTimeout(timer.current);
|
|
363
|
+
setToken("");
|
|
364
|
+
setState("idle");
|
|
365
|
+
onClose();
|
|
366
|
+
};
|
|
367
|
+
const verify = () => {
|
|
368
|
+
if (!token.trim().startsWith(TOKEN_PREFIX)) {
|
|
369
|
+
setState("invalid");
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
setState("verifying");
|
|
373
|
+
timer.current = window.setTimeout(() => {
|
|
374
|
+
if (verifyResult === "ok") {
|
|
375
|
+
close();
|
|
376
|
+
} else {
|
|
377
|
+
setState("failed");
|
|
378
|
+
}
|
|
379
|
+
}, VERIFY_DELAY_MS);
|
|
380
|
+
};
|
|
381
|
+
const verifying = state === "verifying";
|
|
382
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
383
|
+
open: open,
|
|
384
|
+
size: "m",
|
|
385
|
+
onClose: close,
|
|
386
|
+
enableBackgroundClick: true
|
|
387
|
+
}, /*#__PURE__*/React.createElement(Dialog.Title, {
|
|
388
|
+
onClose: close
|
|
389
|
+
}, replace ? "Replace upgrade token" : "Set up upgrade token"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(TokenSetupBody, null, /*#__PURE__*/React.createElement(Body2, null, replace ? "Create a new token in your ActiveCollab account and replace the current one." : "Set an upgrade token to enable in-app upgrades. It links this installation to your ActiveCollab licence."), /*#__PURE__*/React.createElement(NumberedStep, null, /*#__PURE__*/React.createElement(Body2, {
|
|
390
|
+
className: "n",
|
|
391
|
+
weight: "bold"
|
|
392
|
+
}, "1."), /*#__PURE__*/React.createElement("div", {
|
|
393
|
+
className: "body"
|
|
394
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Sign in to your ActiveCollab account and open ", /*#__PURE__*/React.createElement("b", null, "Profile"), "."), /*#__PURE__*/React.createElement(Link, {
|
|
395
|
+
href: "https://activecollab.com/profile",
|
|
396
|
+
target: "_blank",
|
|
397
|
+
rel: "noreferrer",
|
|
398
|
+
variant: "text link-primary",
|
|
399
|
+
isExternal: true
|
|
400
|
+
}, "Open your ActiveCollab account"))), /*#__PURE__*/React.createElement(NumberedStep, null, /*#__PURE__*/React.createElement(Body2, {
|
|
401
|
+
className: "n",
|
|
402
|
+
weight: "bold"
|
|
403
|
+
}, "2."), /*#__PURE__*/React.createElement("div", {
|
|
404
|
+
className: "body"
|
|
405
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Choose ", /*#__PURE__*/React.createElement("b", null, "Create a New Token"), " and copy it \u2014 it looks like", " ", /*#__PURE__*/React.createElement(CommandCode, null, "sh1_\u2026"), "."))), /*#__PURE__*/React.createElement(NumberedStep, null, /*#__PURE__*/React.createElement(Body2, {
|
|
406
|
+
className: "n",
|
|
407
|
+
weight: "bold"
|
|
408
|
+
}, "3."), /*#__PURE__*/React.createElement("div", {
|
|
409
|
+
className: "body"
|
|
410
|
+
}, /*#__PURE__*/React.createElement(Body2, null, replace ? "Paste the new token:" : "Paste it here:"), /*#__PURE__*/React.createElement(Input, {
|
|
411
|
+
value: token,
|
|
412
|
+
placeholder: "sh1_\u2026",
|
|
413
|
+
invalid: state === "invalid",
|
|
414
|
+
disabled: verifying,
|
|
415
|
+
onChange: event => {
|
|
416
|
+
setToken(event.target.value);
|
|
417
|
+
if (state === "invalid" || state === "failed") {
|
|
418
|
+
setState("idle");
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}), state === "invalid" ? /*#__PURE__*/React.createElement(Caption1, {
|
|
422
|
+
color: "alert"
|
|
423
|
+
}, "Upgrade tokens start with sh1_. Check that you copied the whole token.") : /*#__PURE__*/React.createElement(Caption1, {
|
|
424
|
+
color: "tertiary"
|
|
425
|
+
}, "Stored encrypted in the database."))), state === "failed" && verifyResult !== "ok" ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
426
|
+
type: "warning",
|
|
427
|
+
showIcon: true,
|
|
428
|
+
title: "The token couldn\u2019t be verified"
|
|
429
|
+
}, /*#__PURE__*/React.createElement(Body2, null, verifyResult.message), /*#__PURE__*/React.createElement(Caption1, {
|
|
430
|
+
color: "tertiary"
|
|
431
|
+
}, "Error code: ", verifyResult.code)) : null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Label, null, "Or set it in configuration instead"), /*#__PURE__*/React.createElement(Body2, {
|
|
432
|
+
color: "tertiary",
|
|
433
|
+
style: {
|
|
434
|
+
margin: "6px 0 4px"
|
|
435
|
+
}
|
|
436
|
+
}, "Add it to config/config.php:"), /*#__PURE__*/React.createElement(CommandBlock, null, CONFIG_SNIPPET), /*#__PURE__*/React.createElement(Body2, {
|
|
437
|
+
color: "tertiary",
|
|
438
|
+
style: {
|
|
439
|
+
margin: "12px 0 4px"
|
|
440
|
+
}
|
|
441
|
+
}, "\u2026or set an environment variable:"), /*#__PURE__*/React.createElement(CommandBlock, null, ENV_SNIPPET)), /*#__PURE__*/React.createElement(InfoBox, {
|
|
442
|
+
type: "warning",
|
|
443
|
+
showIcon: true,
|
|
444
|
+
title: "Keep the token private"
|
|
445
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Don\u2019t bake the token into a Docker image and don\u2019t share it \u2014 anyone with it can upgrade this installation.")))), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Actions, null, /*#__PURE__*/React.createElement(Button, {
|
|
446
|
+
variant: "primary",
|
|
447
|
+
disabled: token.trim() === "" || verifying,
|
|
448
|
+
onClick: verify,
|
|
449
|
+
endAdornment: verifying ? /*#__PURE__*/React.createElement(SpinnerLoader, {
|
|
450
|
+
radius: 7,
|
|
451
|
+
stroke: 2,
|
|
452
|
+
activeStrokeColor: ON_SOLID,
|
|
453
|
+
inactiveStrokeColor: "transparent"
|
|
454
|
+
}) : undefined
|
|
455
|
+
}, verifying ? "Verifying…" : replace ? "Verify & replace" : "Verify & save"), /*#__PURE__*/React.createElement(Button, {
|
|
456
|
+
variant: "secondary",
|
|
457
|
+
onClick: close
|
|
458
|
+
}, "Cancel")));
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
/** The "not set up yet" Version row: a short explainer + the setup dialog. */
|
|
462
|
+
export const TokenMissingPanel = () => {
|
|
463
|
+
const _useState5 = useState(false),
|
|
464
|
+
open = _useState5[0],
|
|
465
|
+
setOpen = _useState5[1];
|
|
466
|
+
return /*#__PURE__*/React.createElement(Panel, null, /*#__PURE__*/React.createElement(Body2, null, "In-app upgrades aren\u2019t set up yet. Add an ActiveCollab upgrade token to enable one-click upgrades from here."), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Button, {
|
|
467
|
+
variant: "primary",
|
|
468
|
+
onClick: () => setOpen(true)
|
|
469
|
+
}, "Set up upgrade token")), /*#__PURE__*/React.createElement(TokenSetupDialog, {
|
|
470
|
+
open: open,
|
|
471
|
+
onClose: () => setOpen(false),
|
|
472
|
+
mode: "add"
|
|
473
|
+
}));
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
/* --- 2. Token strip (bottom of the Version row) --------------------------- */
|
|
477
|
+
|
|
478
|
+
const TOKEN_SOURCE_LABEL = {
|
|
479
|
+
db: "Saved here",
|
|
480
|
+
config: "config.php",
|
|
481
|
+
env: "env"
|
|
482
|
+
};
|
|
483
|
+
const StripWrap = styled.div.withConfig({
|
|
484
|
+
displayName: "selfHostedUpgrade__StripWrap",
|
|
485
|
+
componentId: "sc-1dxkjfk-9"
|
|
486
|
+
})(["display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;margin-top:16px;padding-top:12px;border-top:1px solid var(--color-theme-300);"]);
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* `Upgrade token · sh1_Xa…7f · Saved here · expires Dec 31, 2026 · Replace`.
|
|
490
|
+
* Shown in every Version-row state that has a token. Only a token saved on
|
|
491
|
+
* this screen can be replaced here; config/env tokens are changed at source.
|
|
492
|
+
*/
|
|
493
|
+
export const TokenStrip = _ref5 => {
|
|
494
|
+
let token = _ref5.token;
|
|
495
|
+
const _useState6 = useState(false),
|
|
496
|
+
replaceOpen = _useState6[0],
|
|
497
|
+
setReplaceOpen = _useState6[1];
|
|
498
|
+
const parts = [/*#__PURE__*/React.createElement(Caption1, {
|
|
499
|
+
key: "label",
|
|
500
|
+
weight: "bold"
|
|
501
|
+
}, "Upgrade token"), /*#__PURE__*/React.createElement(Caption1, {
|
|
502
|
+
key: "masked",
|
|
503
|
+
color: "tertiary"
|
|
504
|
+
}, token.masked)];
|
|
505
|
+
if (token.source) {
|
|
506
|
+
parts.push(/*#__PURE__*/React.createElement(Caption1, {
|
|
507
|
+
key: "source",
|
|
508
|
+
color: "tertiary"
|
|
509
|
+
}, TOKEN_SOURCE_LABEL[token.source]));
|
|
510
|
+
}
|
|
511
|
+
if (token.expires_on) {
|
|
512
|
+
parts.push(/*#__PURE__*/React.createElement(Caption1, {
|
|
513
|
+
key: "expires",
|
|
514
|
+
color: "tertiary"
|
|
515
|
+
}, "expires ", formatDate(token.expires_on)));
|
|
516
|
+
}
|
|
517
|
+
parts.push(token.source === "db" ? /*#__PURE__*/React.createElement(Button, {
|
|
518
|
+
key: "action",
|
|
519
|
+
variant: "text colored",
|
|
520
|
+
size: "small",
|
|
521
|
+
onClick: () => setReplaceOpen(true)
|
|
522
|
+
}, "Replace") : /*#__PURE__*/React.createElement(Caption1, {
|
|
523
|
+
key: "action",
|
|
524
|
+
color: "tertiary"
|
|
525
|
+
}, token.source === "env" ? "Change it in env" : "Change it in config.php"));
|
|
526
|
+
return /*#__PURE__*/React.createElement(StripWrap, null, parts.map((part, index) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
527
|
+
key: index
|
|
528
|
+
}, index > 0 ? /*#__PURE__*/React.createElement(Caption1, {
|
|
529
|
+
color: "tertiary"
|
|
530
|
+
}, "\xB7") : null, part)), /*#__PURE__*/React.createElement(TokenSetupDialog, {
|
|
531
|
+
open: replaceOpen,
|
|
532
|
+
onClose: () => setReplaceOpen(false),
|
|
533
|
+
mode: "replace"
|
|
534
|
+
}));
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
/* --- 3. Up to date ------------------------------------------------------- */
|
|
538
|
+
|
|
539
|
+
export const UpToDatePanel = _ref6 => {
|
|
540
|
+
let status = _ref6.status;
|
|
541
|
+
return /*#__PURE__*/React.createElement(Panel, null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Dot, {
|
|
542
|
+
color: "var(--color-sucess-green)",
|
|
543
|
+
size: 12
|
|
544
|
+
}), /*#__PURE__*/React.createElement(Body2, null, "You\u2019re on the latest available version (", status.latest_available_version, ").")), status.last_checked_on ? /*#__PURE__*/React.createElement(Caption1, {
|
|
545
|
+
color: "tertiary"
|
|
546
|
+
}, "Last checked ", formatDateTime(status.last_checked_on), ".") : null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Button, {
|
|
547
|
+
variant: "secondary"
|
|
548
|
+
}, "Check now")));
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
/* --- 4 & 5. Update available (with optional renew-for-newer) -------------- */
|
|
552
|
+
|
|
553
|
+
const VersionJump = styled.div.withConfig({
|
|
554
|
+
displayName: "selfHostedUpgrade__VersionJump",
|
|
555
|
+
componentId: "sc-1dxkjfk-10"
|
|
556
|
+
})(["display:flex;align-items:center;gap:10px;flex-wrap:wrap;svg{fill:var(--color-theme-600);}"]);
|
|
557
|
+
export const UpdateAvailablePanel = _ref7 => {
|
|
558
|
+
var _status$next_step_ver;
|
|
559
|
+
let status = _ref7.status,
|
|
560
|
+
_ref7$offerChain = _ref7.offerChain,
|
|
561
|
+
offerChain = _ref7$offerChain === void 0 ? false : _ref7$offerChain,
|
|
562
|
+
onUpgrade = _ref7.onUpgrade,
|
|
563
|
+
dockerImage = _ref7.dockerImage;
|
|
564
|
+
// On a stepped path this run installs the next step, not the final version.
|
|
565
|
+
const target = (_status$next_step_ver = status.next_step_version) != null ? _status$next_step_ver : status.latest_available_version;
|
|
566
|
+
const multiStep = status.steps_remaining > 1;
|
|
567
|
+
const renewForNewer = status.latest_available_version !== status.latest_version;
|
|
568
|
+
return /*#__PURE__*/React.createElement(Panel, null, /*#__PURE__*/React.createElement(VersionJump, null, /*#__PURE__*/React.createElement(Header3, null, status.current_version), /*#__PURE__*/React.createElement(ArrowRightIcon, {
|
|
569
|
+
width: 20,
|
|
570
|
+
height: 20
|
|
571
|
+
}), /*#__PURE__*/React.createElement(Header3, null, target), multiStep ? /*#__PURE__*/React.createElement(Chip, {
|
|
572
|
+
label: "Step 1 of " + status.steps_remaining,
|
|
573
|
+
backgroundColor: "var(--color-theme-300)",
|
|
574
|
+
color: "var(--color-theme-900)",
|
|
575
|
+
size: "regular"
|
|
576
|
+
}) : null), multiStep ? /*#__PURE__*/React.createElement(Body2, {
|
|
577
|
+
color: "tertiary"
|
|
578
|
+
}, "ActiveCollab upgrades one release line at a time.", " ", status.latest_available_version, " will be offered right after ", target, ".") : null, /*#__PURE__*/React.createElement(ReleaseNotesHtml, {
|
|
579
|
+
notes: status.release_notes
|
|
580
|
+
}), dockerImage ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Body2, null, "This installation runs in a container. Pull the new image to upgrade:"), /*#__PURE__*/React.createElement(CommandBlock, null, "docker pull " + dockerImage), /*#__PURE__*/React.createElement(Caption1, {
|
|
581
|
+
color: "tertiary",
|
|
582
|
+
style: {
|
|
583
|
+
marginTop: 8,
|
|
584
|
+
display: "block"
|
|
585
|
+
}
|
|
586
|
+
}, "Migrations run automatically when the container starts.")) : null, !dockerImage && renewForNewer ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
587
|
+
type: "note",
|
|
588
|
+
showIcon: true,
|
|
589
|
+
title: status.latest_version + " isn\u2019t included"
|
|
590
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "You can upgrade to ", target, ". ", status.latest_version, " was released after your subscription ended on", " ", new Date(status.support_expires_on * 1000).toLocaleDateString("en-US", {
|
|
591
|
+
day: "numeric",
|
|
592
|
+
month: "long",
|
|
593
|
+
year: "numeric"
|
|
594
|
+
}), ".", " ", /*#__PURE__*/React.createElement(Link, {
|
|
595
|
+
href: status.support_renewal_url,
|
|
596
|
+
target: "_blank",
|
|
597
|
+
rel: "noreferrer",
|
|
598
|
+
variant: "text link-primary",
|
|
599
|
+
isExternal: true
|
|
600
|
+
}, "Renew"), " ", "to get it.")) : null, !dockerImage ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Button, {
|
|
601
|
+
variant: "primary",
|
|
602
|
+
onClick: onUpgrade
|
|
603
|
+
}, "Upgrade to " + target), multiStep && offerChain ? /*#__PURE__*/React.createElement(Button, {
|
|
604
|
+
variant: "secondary",
|
|
605
|
+
onClick: onUpgrade
|
|
606
|
+
}, "Upgrade all the way to " + status.latest_available_version + " (" + status.steps_remaining + " steps)") : null), multiStep && offerChain ? /*#__PURE__*/React.createElement(Caption1, {
|
|
607
|
+
color: "tertiary"
|
|
608
|
+
}, "All the way runs the steps back to back; preflight runs once.") : null) : null);
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
/* --- 6. Support expired, no update --------------------------------------- */
|
|
612
|
+
|
|
613
|
+
export const SupportExpiredPanel = _ref8 => {
|
|
614
|
+
let status = _ref8.status;
|
|
615
|
+
return /*#__PURE__*/React.createElement(Panel, null, /*#__PURE__*/React.createElement(InfoBox, {
|
|
616
|
+
type: "warning",
|
|
617
|
+
showIcon: true,
|
|
618
|
+
title: "Upgrade subscription expired"
|
|
619
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "No new versions are available. Your upgrade and support subscription expired on ", formatDate(status.support_expires_on), ". Renew to get access to future releases.")), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Link, {
|
|
620
|
+
href: status.support_renewal_url,
|
|
621
|
+
target: "_blank",
|
|
622
|
+
rel: "noreferrer",
|
|
623
|
+
variant: "primary",
|
|
624
|
+
isExternal: true
|
|
625
|
+
}, "Renew subscription")));
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
/* --- 7. Check failed ------------------------------------------------------ */
|
|
629
|
+
|
|
630
|
+
const CHECK_FAILED_UI = {
|
|
631
|
+
token_expired: {
|
|
632
|
+
title: "Upgrade token expired",
|
|
633
|
+
action: "token"
|
|
634
|
+
},
|
|
635
|
+
token_revoked: {
|
|
636
|
+
title: "Upgrade token revoked",
|
|
637
|
+
action: "token"
|
|
638
|
+
},
|
|
639
|
+
token_bound_elsewhere: {
|
|
640
|
+
title: "Token is bound to another installation",
|
|
641
|
+
action: "token"
|
|
642
|
+
},
|
|
643
|
+
license_inactive: {
|
|
644
|
+
title: "Licence is inactive",
|
|
645
|
+
action: "support"
|
|
646
|
+
},
|
|
647
|
+
license_compromised: {
|
|
648
|
+
title: "Licence was flagged",
|
|
649
|
+
action: "support"
|
|
650
|
+
},
|
|
651
|
+
network_error: {
|
|
652
|
+
title: "Couldn’t reach the update server",
|
|
653
|
+
action: "retry"
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
export const CheckFailedPanel = _ref9 => {
|
|
657
|
+
var _error$help_url, _error$help_url2;
|
|
658
|
+
let error = _ref9.error;
|
|
659
|
+
const ui = CHECK_FAILED_UI[error.code];
|
|
660
|
+
const _useState7 = useState(false),
|
|
661
|
+
replaceOpen = _useState7[0],
|
|
662
|
+
setReplaceOpen = _useState7[1];
|
|
663
|
+
return /*#__PURE__*/React.createElement(Panel, null, /*#__PURE__*/React.createElement(InfoBox, {
|
|
664
|
+
type: "warning",
|
|
665
|
+
showIcon: true,
|
|
666
|
+
title: ui.title
|
|
667
|
+
}, /*#__PURE__*/React.createElement(Body2, null, error.message)), /*#__PURE__*/React.createElement(Row, null, ui.action === "token" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
668
|
+
variant: "primary",
|
|
669
|
+
onClick: () => setReplaceOpen(true)
|
|
670
|
+
}, "Replace token"), /*#__PURE__*/React.createElement(Link, {
|
|
671
|
+
href: (_error$help_url = error.help_url) != null ? _error$help_url : "https://activecollab.com/",
|
|
672
|
+
target: "_blank",
|
|
673
|
+
rel: "noreferrer",
|
|
674
|
+
variant: "text link-primary",
|
|
675
|
+
isExternal: true
|
|
676
|
+
}, "Open your ActiveCollab account")) : ui.action === "retry" ? /*#__PURE__*/React.createElement(Button, {
|
|
677
|
+
variant: "secondary"
|
|
678
|
+
}, "Try again") : /*#__PURE__*/React.createElement(Link, {
|
|
679
|
+
href: (_error$help_url2 = error.help_url) != null ? _error$help_url2 : "https://activecollab.com/help",
|
|
680
|
+
target: "_blank",
|
|
681
|
+
rel: "noreferrer",
|
|
682
|
+
variant: "text link-primary",
|
|
683
|
+
isExternal: true
|
|
684
|
+
}, "Contact support")), /*#__PURE__*/React.createElement(TokenSetupDialog, {
|
|
685
|
+
open: replaceOpen,
|
|
686
|
+
onClose: () => setReplaceOpen(false),
|
|
687
|
+
mode: "replace"
|
|
688
|
+
}));
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
/* ================================================================== */
|
|
692
|
+
/* 8. Preflight gate (base Dialog — needs a disable-on-block button) */
|
|
693
|
+
/* ================================================================== */
|
|
694
|
+
|
|
695
|
+
const PreflightBody = styled.div.withConfig({
|
|
696
|
+
displayName: "selfHostedUpgrade__PreflightBody",
|
|
697
|
+
componentId: "sc-1dxkjfk-11"
|
|
698
|
+
})(["display:flex;flex-direction:column;gap:16px;"]);
|
|
699
|
+
const CheckList = styled.div.withConfig({
|
|
700
|
+
displayName: "selfHostedUpgrade__CheckList",
|
|
701
|
+
componentId: "sc-1dxkjfk-12"
|
|
702
|
+
})(["display:flex;flex-direction:column;gap:8px;"]);
|
|
703
|
+
const CheckLine = styled.div.withConfig({
|
|
704
|
+
displayName: "selfHostedUpgrade__CheckLine",
|
|
705
|
+
componentId: "sc-1dxkjfk-13"
|
|
706
|
+
})(["display:flex;align-items:flex-start;gap:8px;.glyph{flex-shrink:0;display:inline-flex;margin-top:2px;}"]);
|
|
707
|
+
const PreflightGlyph = _ref0 => {
|
|
708
|
+
let status = _ref0.status;
|
|
709
|
+
if (status === "ok") {
|
|
710
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
711
|
+
className: "glyph"
|
|
712
|
+
}, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
713
|
+
width: 16,
|
|
714
|
+
height: 16,
|
|
715
|
+
style: {
|
|
716
|
+
fill: "var(--color-sucess-green)"
|
|
717
|
+
}
|
|
718
|
+
}));
|
|
719
|
+
}
|
|
720
|
+
if (status === "info") {
|
|
721
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
722
|
+
className: "glyph"
|
|
723
|
+
}, /*#__PURE__*/React.createElement(InfoIcon, {
|
|
724
|
+
width: 16,
|
|
725
|
+
height: 16,
|
|
726
|
+
style: {
|
|
727
|
+
fill: "var(--color-progress-blue)"
|
|
728
|
+
}
|
|
729
|
+
}));
|
|
730
|
+
}
|
|
731
|
+
if (status === "warn") {
|
|
732
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
733
|
+
className: "glyph"
|
|
734
|
+
}, /*#__PURE__*/React.createElement(WarningTriangleIcon, {
|
|
735
|
+
width: 16,
|
|
736
|
+
height: 16,
|
|
737
|
+
style: {
|
|
738
|
+
fill: "var(--warning)"
|
|
739
|
+
}
|
|
740
|
+
}));
|
|
741
|
+
}
|
|
742
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
743
|
+
className: "glyph"
|
|
744
|
+
}, /*#__PURE__*/React.createElement(CancelCrossIcon, {
|
|
745
|
+
width: 16,
|
|
746
|
+
height: 16,
|
|
747
|
+
style: {
|
|
748
|
+
fill: "var(--red-alert)"
|
|
749
|
+
}
|
|
750
|
+
}));
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
/** "How the upgrade will run", per driver. */
|
|
754
|
+
const DRIVER_COPY = {
|
|
755
|
+
background: "In the background. You can close this tab.",
|
|
756
|
+
cron: "By the cron worker, starting within a minute. You can close this tab.",
|
|
757
|
+
browser: "In this browser tab. Keep it open until the upgrade finishes. Closing it pauses the upgrade.",
|
|
758
|
+
cli: "From the command line. Progress still shows here."
|
|
759
|
+
};
|
|
760
|
+
const DriverRow = _ref1 => {
|
|
761
|
+
let result = _ref1.result,
|
|
762
|
+
onSetUpCron = _ref1.onSetUpCron;
|
|
763
|
+
const browser = result.driver === "browser";
|
|
764
|
+
return /*#__PURE__*/React.createElement(InfoBox
|
|
765
|
+
// DS InfoBox: "note" is the yellow warn look, "warning" the red error one.
|
|
766
|
+
, {
|
|
767
|
+
type: browser ? "note" : "neutral",
|
|
768
|
+
showIcon: true,
|
|
769
|
+
title: "How the upgrade will run"
|
|
770
|
+
}, /*#__PURE__*/React.createElement(Body2, null, DRIVER_COPY[result.driver]), /*#__PURE__*/React.createElement(Caption1, {
|
|
771
|
+
color: "tertiary"
|
|
772
|
+
}, result.driver_reason), browser ? /*#__PURE__*/React.createElement("div", {
|
|
773
|
+
style: {
|
|
774
|
+
marginTop: 8
|
|
775
|
+
}
|
|
776
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
777
|
+
href: "#cron-jobs",
|
|
778
|
+
variant: "text link-primary",
|
|
779
|
+
onClick: event => {
|
|
780
|
+
event.preventDefault();
|
|
781
|
+
onSetUpCron == null || onSetUpCron();
|
|
782
|
+
}
|
|
783
|
+
}, "Set up cron to run upgrades in the background")) : null);
|
|
784
|
+
};
|
|
785
|
+
export const PreflightGate = _ref10 => {
|
|
786
|
+
let _ref10$open = _ref10.open,
|
|
787
|
+
open = _ref10$open === void 0 ? true : _ref10$open,
|
|
788
|
+
result = _ref10.result,
|
|
789
|
+
onCancel = _ref10.onCancel,
|
|
790
|
+
onConfirm = _ref10.onConfirm,
|
|
791
|
+
onSetUpCron = _ref10.onSetUpCron;
|
|
792
|
+
const _useState8 = useState("db"),
|
|
793
|
+
backup = _useState8[0],
|
|
794
|
+
setBackup = _useState8[1];
|
|
795
|
+
const cancel = onCancel != null ? onCancel : () => undefined;
|
|
796
|
+
const confirm = onConfirm != null ? onConfirm : () => undefined;
|
|
797
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
798
|
+
open: open,
|
|
799
|
+
size: "l",
|
|
800
|
+
onClose: cancel,
|
|
801
|
+
enableBackgroundClick: true
|
|
802
|
+
}, /*#__PURE__*/React.createElement(Dialog.Title, {
|
|
803
|
+
onClose: cancel
|
|
804
|
+
}, "Before upgrading"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(PreflightBody, null, /*#__PURE__*/React.createElement(Body2, {
|
|
805
|
+
color: "tertiary"
|
|
806
|
+
}, "We checked your server. Review these before starting."), /*#__PURE__*/React.createElement(DriverRow, {
|
|
807
|
+
result: result,
|
|
808
|
+
onSetUpCron: onSetUpCron
|
|
809
|
+
}), /*#__PURE__*/React.createElement(CheckList, null, result.checks.map(check => /*#__PURE__*/React.createElement(CheckLine, {
|
|
810
|
+
key: check.key
|
|
811
|
+
}, /*#__PURE__*/React.createElement(PreflightGlyph, {
|
|
812
|
+
status: check.status
|
|
813
|
+
}), /*#__PURE__*/React.createElement(Body2, {
|
|
814
|
+
color: check.status === "fail" ? "alert" : undefined
|
|
815
|
+
}, check.message, check.help_url ? /*#__PURE__*/React.createElement(React.Fragment, null, " ", /*#__PURE__*/React.createElement(Link, {
|
|
816
|
+
href: check.help_url,
|
|
817
|
+
target: "_blank",
|
|
818
|
+
rel: "noreferrer",
|
|
819
|
+
variant: "text link-primary"
|
|
820
|
+
}, "Learn more")) : null)))), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Label, null, "Backup"), /*#__PURE__*/React.createElement("div", {
|
|
821
|
+
style: {
|
|
822
|
+
marginTop: 8
|
|
823
|
+
}
|
|
824
|
+
}, /*#__PURE__*/React.createElement(RadioGroup, {
|
|
825
|
+
value: backup,
|
|
826
|
+
onChange: setBackup,
|
|
827
|
+
options: [{
|
|
828
|
+
id: "db",
|
|
829
|
+
name: "Back up the database first (recommended)"
|
|
830
|
+
}, {
|
|
831
|
+
id: "own",
|
|
832
|
+
name: "I already have my own backup"
|
|
833
|
+
}]
|
|
834
|
+
}))), !result.can_start ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
835
|
+
type: "warning",
|
|
836
|
+
showIcon: true,
|
|
837
|
+
title: "Can\u2019t start yet"
|
|
838
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Resolve the failing checks above before starting the upgrade.")) : null)), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Actions, null, /*#__PURE__*/React.createElement(Button, {
|
|
839
|
+
variant: "primary",
|
|
840
|
+
disabled: !result.can_start,
|
|
841
|
+
onClick: confirm
|
|
842
|
+
}, "Start upgrade"), /*#__PURE__*/React.createElement(Button, {
|
|
843
|
+
variant: "secondary",
|
|
844
|
+
onClick: cancel
|
|
845
|
+
}, "Cancel")));
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
/* ================================================================== */
|
|
849
|
+
/* 9–12. Upgrade console (content takeover) */
|
|
850
|
+
/* ================================================================== */
|
|
851
|
+
|
|
852
|
+
const stepSpine = (run, stalled) => {
|
|
853
|
+
const current = phaseIndex(run.current_step);
|
|
854
|
+
return PHASES.map((_ref11, index) => {
|
|
855
|
+
let key = _ref11.key,
|
|
856
|
+
label = _ref11.label;
|
|
857
|
+
if (run.status === "completed" || index < current) {
|
|
858
|
+
return {
|
|
859
|
+
key,
|
|
860
|
+
tone: "success",
|
|
861
|
+
fill: "solid",
|
|
862
|
+
icon: /*#__PURE__*/React.createElement(CheckIcon, {
|
|
863
|
+
fill: ON_SOLID,
|
|
864
|
+
width: 12,
|
|
865
|
+
height: 12
|
|
866
|
+
}),
|
|
867
|
+
tooltip: label
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
if (index === current) {
|
|
871
|
+
if (run.status === "failed") {
|
|
872
|
+
return {
|
|
873
|
+
key,
|
|
874
|
+
tone: "danger",
|
|
875
|
+
fill: "solid",
|
|
876
|
+
icon: /*#__PURE__*/React.createElement(CancelCrossIcon, {
|
|
877
|
+
fill: ON_SOLID,
|
|
878
|
+
width: 12,
|
|
879
|
+
height: 12
|
|
880
|
+
}),
|
|
881
|
+
tooltip: label
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
if (run.status === "paused") {
|
|
885
|
+
return {
|
|
886
|
+
key,
|
|
887
|
+
tone: "info",
|
|
888
|
+
fill: "outline",
|
|
889
|
+
tooltip: label
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
if (stalled) {
|
|
893
|
+
return {
|
|
894
|
+
key,
|
|
895
|
+
tone: "warning",
|
|
896
|
+
fill: "solid",
|
|
897
|
+
icon: /*#__PURE__*/React.createElement(WarningTriangleIcon, {
|
|
898
|
+
fill: ON_SOLID,
|
|
899
|
+
width: 12,
|
|
900
|
+
height: 12
|
|
901
|
+
}),
|
|
902
|
+
tooltip: label
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
return {
|
|
906
|
+
key,
|
|
907
|
+
tone: "info",
|
|
908
|
+
fill: "solid",
|
|
909
|
+
pulse: run.status === "running",
|
|
910
|
+
tooltip: label
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
return {
|
|
914
|
+
key,
|
|
915
|
+
tone: "neutral",
|
|
916
|
+
fill: "outline",
|
|
917
|
+
tooltip: label
|
|
918
|
+
};
|
|
919
|
+
});
|
|
920
|
+
};
|
|
921
|
+
const ConsoleWrap = styled.div.withConfig({
|
|
922
|
+
displayName: "selfHostedUpgrade__ConsoleWrap",
|
|
923
|
+
componentId: "sc-1dxkjfk-14"
|
|
924
|
+
})(["display:flex;flex-direction:column;gap:20px;width:100%;.console-head{display:flex;flex-direction:column;gap:4px;}.spine{padding:4px 0;}.current{display:flex;flex-direction:column;gap:8px;}.current-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px;}.actions{display:flex;gap:8px;flex-wrap:wrap;}.context{display:flex;flex-direction:column;gap:4px;padding:8px 0 0;}.context-row{display:flex;gap:8px;}.context-row .k{min-width:120px;}.fix{display:flex;flex-direction:column;gap:8px;}"]);
|
|
925
|
+
|
|
926
|
+
/** Phase name, "Running migrations · 312 / 905", the bar and the timings. */
|
|
927
|
+
const CurrentStep = _ref12 => {
|
|
928
|
+
let run = _ref12.run,
|
|
929
|
+
now = _ref12.now;
|
|
930
|
+
const progress = formatStepProgress(run.step_progress);
|
|
931
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
932
|
+
className: "current"
|
|
933
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
934
|
+
className: "current-row"
|
|
935
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
936
|
+
weight: "bold"
|
|
937
|
+
}, PHASES[phaseIndex(run.current_step)].label), /*#__PURE__*/React.createElement(Caption1, {
|
|
938
|
+
color: "tertiary"
|
|
939
|
+
}, STEP_ACTIVITY[run.current_step], progress ? " \xB7 " + progress : "")), /*#__PURE__*/React.createElement(ProgressBar, {
|
|
940
|
+
progress: run.total_progress,
|
|
941
|
+
stroke: 6,
|
|
942
|
+
progressColor: "var(--color-secondary)",
|
|
943
|
+
backgroundColor: "var(--color-theme-300)"
|
|
944
|
+
}), /*#__PURE__*/React.createElement(Caption1, {
|
|
945
|
+
color: "tertiary"
|
|
946
|
+
}, "Last activity ", formatDuration(now - run.heartbeat_on), " ago \xB7 Elapsed", " ", formatDuration(now - run.started_on)));
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Codes whose fix is to continue somewhere else: restoring the backup would
|
|
951
|
+
* only throw away finished work, so the console doesn't offer it.
|
|
952
|
+
*/
|
|
953
|
+
// Failures where nothing on disk changed, so there is no backup to restore.
|
|
954
|
+
const NO_RESTORE_CODES = new Set(["web_memory_exhausted", "package_signature_invalid"]);
|
|
955
|
+
|
|
956
|
+
// Failures where the fix is to start over, not resume mid-run (nothing after the
|
|
957
|
+
// download ran), so the primary action reads "Try again" rather than "Resume".
|
|
958
|
+
const RETRY_CODES = new Set(["package_signature_invalid"]);
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Owner-facing fix steps per run error code. The code comes from the payload;
|
|
962
|
+
* the steps are UI copy. Codes without an entry show only the error box.
|
|
963
|
+
*/
|
|
964
|
+
const RESUME_COMMAND = "php tasks/activecollab-cli.php upgrade --resume";
|
|
965
|
+
const HOW_TO_FIX = {
|
|
966
|
+
web_memory_exhausted: [/*#__PURE__*/React.createElement(React.Fragment, {
|
|
967
|
+
key: "cli"
|
|
968
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Continue from the command line. Progress stays visible here."), /*#__PURE__*/React.createElement(CommandBlock, null, RESUME_COMMAND)), /*#__PURE__*/React.createElement(Body2, {
|
|
969
|
+
key: "cron"
|
|
970
|
+
}, "Or set up cron, then click Resume.")],
|
|
971
|
+
migration_memory_exhausted: [/*#__PURE__*/React.createElement(Body2, {
|
|
972
|
+
key: "raise"
|
|
973
|
+
}, "Raise ", /*#__PURE__*/React.createElement(CommandCode, null, "memory_limit"), " for PHP CLI to 1G (in the CLI\u2019s php.ini), or set", " ", /*#__PURE__*/React.createElement(CommandCode, null, "UPGRADE_MEMORY_LIMIT"), " in config.php or the environment."), /*#__PURE__*/React.createElement(Body2, {
|
|
974
|
+
key: "resume"
|
|
975
|
+
}, "Click Resume. Migrations that already finished aren\u2019t repeated.")]
|
|
976
|
+
};
|
|
977
|
+
const HowToFix = _ref13 => {
|
|
978
|
+
let code = _ref13.code;
|
|
979
|
+
const steps = HOW_TO_FIX[code];
|
|
980
|
+
if (!steps) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
984
|
+
className: "fix"
|
|
985
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
986
|
+
weight: "bold"
|
|
987
|
+
}, "How to fix"), steps.map((step, index) => /*#__PURE__*/React.createElement(NumberedStep, {
|
|
988
|
+
key: index
|
|
989
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
990
|
+
className: "n",
|
|
991
|
+
weight: "bold"
|
|
992
|
+
}, index + 1, "."), /*#__PURE__*/React.createElement("div", {
|
|
993
|
+
className: "body"
|
|
994
|
+
}, step))));
|
|
995
|
+
};
|
|
996
|
+
const STATUS_COMMAND = "php tasks/activecollab-cli.php upgrade:status";
|
|
997
|
+
const RESET_COMMAND = "php tasks/activecollab-cli.php upgrade:reset";
|
|
998
|
+
// TODO: the "Upgrade got stuck" help article doesn't exist yet; real URL TBD.
|
|
999
|
+
const STUCK_HELP_URL = "https://activecollab.com/help";
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Collapsed-by-default support section for a stalled or failed run: the CLI
|
|
1003
|
+
* commands support asks for, the help article and where the run log lives.
|
|
1004
|
+
*/
|
|
1005
|
+
const Troubleshooting = _ref14 => {
|
|
1006
|
+
let run = _ref14.run;
|
|
1007
|
+
return /*#__PURE__*/React.createElement(Accordion, {
|
|
1008
|
+
allowZeroExpanded: true,
|
|
1009
|
+
className: "troubleshooting"
|
|
1010
|
+
}, /*#__PURE__*/React.createElement(AccordionItem, {
|
|
1011
|
+
id: "troubleshooting"
|
|
1012
|
+
}, /*#__PURE__*/React.createElement(AccordionItemHead, null, /*#__PURE__*/React.createElement(Body2, {
|
|
1013
|
+
weight: "bold"
|
|
1014
|
+
}, "Troubleshooting")), /*#__PURE__*/React.createElement(AccordionItemBody, null, /*#__PURE__*/React.createElement("div", {
|
|
1015
|
+
className: "fix"
|
|
1016
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Body2, null, "Show the upgrade\u2019s state, its lock and the last activity:"), /*#__PURE__*/React.createElement(CommandBlock, null, STATUS_COMMAND)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Body2, null, "Reset a stuck upgrade. Finished steps aren\u2019t repeated and the log is kept:"), /*#__PURE__*/React.createElement(CommandBlock, null, RESET_COMMAND)), /*#__PURE__*/React.createElement(Body2, null, "Run log: ", /*#__PURE__*/React.createElement(CommandCode, null, run.log_path)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Link, {
|
|
1017
|
+
href: STUCK_HELP_URL,
|
|
1018
|
+
target: "_blank",
|
|
1019
|
+
rel: "noreferrer",
|
|
1020
|
+
variant: "text link-primary",
|
|
1021
|
+
isExternal: true
|
|
1022
|
+
}, "Upgrade got stuck"))))));
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
/* ================================================================== */
|
|
1026
|
+
/* Send to support dialog (opened from failed / stalled consoles) */
|
|
1027
|
+
/* ================================================================== */
|
|
1028
|
+
|
|
1029
|
+
const SUPPORT_EMAIL = "support@activecollab.com";
|
|
1030
|
+
const SupportSummary = styled.div.withConfig({
|
|
1031
|
+
displayName: "selfHostedUpgrade__SupportSummary",
|
|
1032
|
+
componentId: "sc-1dxkjfk-15"
|
|
1033
|
+
})(["display:flex;flex-direction:column;gap:6px;padding:12px 14px;border:1px solid var(--color-theme-400);border-radius:var(--ac-br-6);background-color:var(--color-theme-200);.row{display:flex;gap:8px;}.row .k{min-width:110px;flex-shrink:0;}"]);
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* A form field wrapper: the DS Input wrapper is a fixed 360px, so force it to
|
|
1037
|
+
* fill the dialog so the Reply email field matches the Message textarea width.
|
|
1038
|
+
*/
|
|
1039
|
+
const SupportField = styled.div.withConfig({
|
|
1040
|
+
displayName: "selfHostedUpgrade__SupportField",
|
|
1041
|
+
componentId: "sc-1dxkjfk-16"
|
|
1042
|
+
})([".c-input-wrapper{width:100%;max-width:100%;margin-top:4px;}"]);
|
|
1043
|
+
export const SendToSupportDialog = _ref15 => {
|
|
1044
|
+
var _run$error$code, _run$error;
|
|
1045
|
+
let open = _ref15.open,
|
|
1046
|
+
onClose = _ref15.onClose,
|
|
1047
|
+
run = _ref15.run,
|
|
1048
|
+
ownerEmail = _ref15.ownerEmail,
|
|
1049
|
+
_ref15$initialState = _ref15.initialState,
|
|
1050
|
+
initialState = _ref15$initialState === void 0 ? "form" : _ref15$initialState;
|
|
1051
|
+
const _useState9 = useState(initialState),
|
|
1052
|
+
state = _useState9[0],
|
|
1053
|
+
setState = _useState9[1];
|
|
1054
|
+
const _useState0 = useState(""),
|
|
1055
|
+
message = _useState0[0],
|
|
1056
|
+
setMessage = _useState0[1];
|
|
1057
|
+
const _useState1 = useState(ownerEmail),
|
|
1058
|
+
email = _useState1[0],
|
|
1059
|
+
setEmail = _useState1[1];
|
|
1060
|
+
const reference = "UPG-" + run.id;
|
|
1061
|
+
const send = () => {
|
|
1062
|
+
setState("sending");
|
|
1063
|
+
// Mock backend: settle to "sent" so the flow is clickable in Storybook.
|
|
1064
|
+
window.setTimeout(() => setState("sent"), 1200);
|
|
1065
|
+
};
|
|
1066
|
+
const included = [["Run", "#" + run.id], ["Versions", run.from_version + " \u2192 " + run.to_version], ["Server check", "Passed"], ["Error code", (_run$error$code = (_run$error = run.error) == null ? void 0 : _run$error.code) != null ? _run$error$code : "—"], ["Step", PHASES[phaseIndex(run.current_step)].label], ["Log", run.log_path]];
|
|
1067
|
+
const busy = state === "sending";
|
|
1068
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
1069
|
+
open: open,
|
|
1070
|
+
size: "m",
|
|
1071
|
+
onClose: onClose,
|
|
1072
|
+
enableBackgroundClick: true
|
|
1073
|
+
}, /*#__PURE__*/React.createElement(Dialog.Title, {
|
|
1074
|
+
onClose: onClose
|
|
1075
|
+
}, "Send to support"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(Panel, null, state === "sent" ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1076
|
+
type: "success",
|
|
1077
|
+
showIcon: true,
|
|
1078
|
+
title: "Sent to support"
|
|
1079
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Support will reply to ", email, ". Reference: ", reference)) : state === "failed" ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1080
|
+
type: "warning",
|
|
1081
|
+
showIcon: true,
|
|
1082
|
+
title: "Couldn\u2019t reach support"
|
|
1083
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Download the diagnostics and email them to", " ", /*#__PURE__*/React.createElement(CommandCode, null, SUPPORT_EMAIL), ".")) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Body2, null, "We\u2019ll send this diagnostic bundle to support:"), /*#__PURE__*/React.createElement(SupportSummary, null, included.map(_ref16 => {
|
|
1084
|
+
let key = _ref16[0],
|
|
1085
|
+
value = _ref16[1];
|
|
1086
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1087
|
+
className: "row",
|
|
1088
|
+
key: key
|
|
1089
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
1090
|
+
className: "k",
|
|
1091
|
+
color: "secondary",
|
|
1092
|
+
weight: "bold"
|
|
1093
|
+
}, key), /*#__PURE__*/React.createElement(Caption1, {
|
|
1094
|
+
color: "tertiary"
|
|
1095
|
+
}, value));
|
|
1096
|
+
})), /*#__PURE__*/React.createElement(Caption1, {
|
|
1097
|
+
color: "tertiary"
|
|
1098
|
+
}, "Tokens and passwords are never included."), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Label, null, "Message (optional)"), /*#__PURE__*/React.createElement(Textarea, {
|
|
1099
|
+
value: message,
|
|
1100
|
+
onChange: event => setMessage(event.target.value),
|
|
1101
|
+
placeholder: "Anything that helps us look into it\u2026",
|
|
1102
|
+
rows: 3,
|
|
1103
|
+
disabled: busy,
|
|
1104
|
+
style: {
|
|
1105
|
+
width: "100%",
|
|
1106
|
+
marginTop: 4
|
|
1107
|
+
}
|
|
1108
|
+
})), /*#__PURE__*/React.createElement(SupportField, null, /*#__PURE__*/React.createElement(Label, null, "Reply email"), /*#__PURE__*/React.createElement(Input, {
|
|
1109
|
+
type: "email",
|
|
1110
|
+
value: email,
|
|
1111
|
+
onChange: event => setEmail(event.target.value),
|
|
1112
|
+
disabled: busy
|
|
1113
|
+
}))))), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Actions, null, state === "sent" ? /*#__PURE__*/React.createElement(Button, {
|
|
1114
|
+
variant: "primary",
|
|
1115
|
+
onClick: onClose
|
|
1116
|
+
}, "Close") : state === "failed" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1117
|
+
variant: "primary"
|
|
1118
|
+
}, "Download diagnostics"), /*#__PURE__*/React.createElement(Button, {
|
|
1119
|
+
variant: "secondary",
|
|
1120
|
+
onClick: () => setState("form")
|
|
1121
|
+
}, "Back")) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1122
|
+
variant: "primary",
|
|
1123
|
+
onClick: send,
|
|
1124
|
+
disabled: busy
|
|
1125
|
+
}, busy ? "Sending…" : "Send"), /*#__PURE__*/React.createElement(Button, {
|
|
1126
|
+
variant: "secondary",
|
|
1127
|
+
onClick: onClose,
|
|
1128
|
+
disabled: busy
|
|
1129
|
+
}, "Cancel"))));
|
|
1130
|
+
};
|
|
1131
|
+
export const UpgradeConsole = _ref17 => {
|
|
1132
|
+
let run = _ref17.run,
|
|
1133
|
+
releaseNotes = _ref17.releaseNotes,
|
|
1134
|
+
_ref17$stepsRemaining = _ref17.stepsRemaining,
|
|
1135
|
+
stepsRemaining = _ref17$stepsRemaining === void 0 ? 0 : _ref17$stepsRemaining,
|
|
1136
|
+
nextStepVersion = _ref17.nextStepVersion,
|
|
1137
|
+
now = _ref17.now,
|
|
1138
|
+
onClose = _ref17.onClose,
|
|
1139
|
+
onResume = _ref17.onResume,
|
|
1140
|
+
onSetUpCron = _ref17.onSetUpCron,
|
|
1141
|
+
_ref17$ownerEmail = _ref17.ownerEmail,
|
|
1142
|
+
ownerEmail = _ref17$ownerEmail === void 0 ? "owner@example.com" : _ref17$ownerEmail;
|
|
1143
|
+
const close = onClose != null ? onClose : () => undefined;
|
|
1144
|
+
const _useState10 = useState(false),
|
|
1145
|
+
restoreOpen = _useState10[0],
|
|
1146
|
+
setRestoreOpen = _useState10[1];
|
|
1147
|
+
const _useState11 = useState(false),
|
|
1148
|
+
supportOpen = _useState11[0],
|
|
1149
|
+
setSupportOpen = _useState11[1];
|
|
1150
|
+
// Stalled is derived, not a status: running with a stale heartbeat.
|
|
1151
|
+
const stalled = run.status === "running" && now - run.heartbeat_on > STALLED_AFTER_SECONDS;
|
|
1152
|
+
const heading = run.status === "completed" ? "Upgrade complete" : run.status === "failed" ? "Upgrade failed" : run.status === "paused" ? "Upgrade paused" : "Upgrading ActiveCollab";
|
|
1153
|
+
const inBrowser = run.driver === "browser";
|
|
1154
|
+
// Only a background process or the cron worker survive a closed tab.
|
|
1155
|
+
const tabCanClose = run.driver === "background" || run.driver === "cron";
|
|
1156
|
+
const pausedProgress = formatStepProgress(run.step_progress);
|
|
1157
|
+
return /*#__PURE__*/React.createElement(ConsoleWrap, null, /*#__PURE__*/React.createElement("div", {
|
|
1158
|
+
className: "console-head"
|
|
1159
|
+
}, /*#__PURE__*/React.createElement(Header3, null, heading), /*#__PURE__*/React.createElement(Body2, {
|
|
1160
|
+
color: "tertiary"
|
|
1161
|
+
}, run.from_version, " \u2192 ", run.to_version)), inBrowser && run.status === "running" ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1162
|
+
type: "note",
|
|
1163
|
+
showIcon: true,
|
|
1164
|
+
title: "Keep this tab open"
|
|
1165
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "The upgrade runs in this tab; closing it pauses the upgrade.")) : null, /*#__PURE__*/React.createElement("div", {
|
|
1166
|
+
className: "spine"
|
|
1167
|
+
}, /*#__PURE__*/React.createElement(StepSequence, {
|
|
1168
|
+
ariaLabel: "Upgrade phases",
|
|
1169
|
+
steps: stepSpine(run, stalled)
|
|
1170
|
+
})), stalled ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1171
|
+
type: "warning",
|
|
1172
|
+
showIcon: true,
|
|
1173
|
+
title: "The upgrade stopped responding"
|
|
1174
|
+
}, /*#__PURE__*/React.createElement(Body2, null, tabCanClose ? "It will resume automatically via cron, or you can resume now." : "It won’t resume on its own. Resume now.")) : null, run.status === "running" ? /*#__PURE__*/React.createElement(CurrentStep, {
|
|
1175
|
+
run: run,
|
|
1176
|
+
now: now
|
|
1177
|
+
}) : null, run.status === "paused" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfoBox, {
|
|
1178
|
+
type: "note",
|
|
1179
|
+
showIcon: true,
|
|
1180
|
+
title: "Upgrade paused at " + PHASES[phaseIndex(run.current_step)].label + (pausedProgress ? " \xB7 " + pausedProgress : "")
|
|
1181
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "The tab running the upgrade was closed. Nothing is lost; it continues where it stopped.")), /*#__PURE__*/React.createElement("div", {
|
|
1182
|
+
className: "actions"
|
|
1183
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1184
|
+
variant: "primary",
|
|
1185
|
+
onClick: onResume
|
|
1186
|
+
}, "Continue in this tab")), /*#__PURE__*/React.createElement("div", {
|
|
1187
|
+
className: "fix"
|
|
1188
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
1189
|
+
weight: "bold"
|
|
1190
|
+
}, "Or finish it without keeping a tab open"), /*#__PURE__*/React.createElement(Body2, null, "From the command line (progress still shows here):"), /*#__PURE__*/React.createElement(CommandBlock, null, RESUME_COMMAND), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Link, {
|
|
1191
|
+
href: "#cron-jobs",
|
|
1192
|
+
variant: "text link-primary",
|
|
1193
|
+
onClick: event => {
|
|
1194
|
+
event.preventDefault();
|
|
1195
|
+
onSetUpCron == null || onSetUpCron();
|
|
1196
|
+
}
|
|
1197
|
+
}, "Set up cron to finish in the background")))) : null, run.status === "queued" ? /*#__PURE__*/React.createElement(React.Fragment, null, run.driver === "cli" ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1198
|
+
type: "note",
|
|
1199
|
+
showIcon: true,
|
|
1200
|
+
title: "Waiting for you to start it from the command line"
|
|
1201
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "Run this on the server, in the ActiveCollab directory. Progress shows here while it runs.")) : /*#__PURE__*/React.createElement(InfoBox, {
|
|
1202
|
+
type: "note",
|
|
1203
|
+
showIcon: true,
|
|
1204
|
+
title: "Scheduled \u2014 waiting for the cron worker"
|
|
1205
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "The upgrade is queued but the background worker hasn\u2019t picked it up yet. If cron is not running, start it from the CLI:")), /*#__PURE__*/React.createElement(CommandBlock, null, "php tasks/activecollab-cli.php upgrade --run=" + run.id)) : null, run.status === "failed" && run.error ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1206
|
+
type: "warning",
|
|
1207
|
+
showIcon: true,
|
|
1208
|
+
title: run.error.message
|
|
1209
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
1210
|
+
color: "tertiary"
|
|
1211
|
+
}, "Error code: ", run.error.code), run.error.context ? /*#__PURE__*/React.createElement("div", {
|
|
1212
|
+
className: "context"
|
|
1213
|
+
}, Object.entries(run.error.context).map(_ref18 => {
|
|
1214
|
+
let key = _ref18[0],
|
|
1215
|
+
value = _ref18[1];
|
|
1216
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1217
|
+
className: "context-row",
|
|
1218
|
+
key: key
|
|
1219
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
1220
|
+
className: "k",
|
|
1221
|
+
color: "secondary",
|
|
1222
|
+
weight: "bold"
|
|
1223
|
+
}, key), /*#__PURE__*/React.createElement(Caption1, {
|
|
1224
|
+
color: "tertiary"
|
|
1225
|
+
}, value));
|
|
1226
|
+
})) : null) : null, run.status === "failed" && run.error ? /*#__PURE__*/React.createElement(HowToFix, {
|
|
1227
|
+
code: run.error.code
|
|
1228
|
+
}) : null, run.status === "completed" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfoBox, {
|
|
1229
|
+
type: "success",
|
|
1230
|
+
showIcon: true,
|
|
1231
|
+
title: "Now running " + run.to_version
|
|
1232
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "The upgrade finished. Reload the app to pick up the new version.")), releaseNotes && releaseNotes.length > 0 ? /*#__PURE__*/React.createElement(ReleaseNotesHtml, {
|
|
1233
|
+
notes: releaseNotes
|
|
1234
|
+
}) : null) : null, /*#__PURE__*/React.createElement(LogPanel, {
|
|
1235
|
+
log: run.log,
|
|
1236
|
+
defaultOpen: run.status !== "running"
|
|
1237
|
+
}), run.status === "running" && !stalled && tabCanClose ? /*#__PURE__*/React.createElement(Caption1, {
|
|
1238
|
+
color: "tertiary"
|
|
1239
|
+
}, "You can close this tab \u2014 the upgrade keeps running on the server.") : null, /*#__PURE__*/React.createElement("div", {
|
|
1240
|
+
className: "actions"
|
|
1241
|
+
}, run.status === "completed" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1242
|
+
variant: "primary",
|
|
1243
|
+
onClick: close
|
|
1244
|
+
}, "Reload"), stepsRemaining > 0 && nextStepVersion ? /*#__PURE__*/React.createElement(Button, {
|
|
1245
|
+
variant: "secondary"
|
|
1246
|
+
}, "Continue to " + nextStepVersion) : null) : null, stalled ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1247
|
+
variant: "primary",
|
|
1248
|
+
onClick: onResume
|
|
1249
|
+
}, "Resume"), /*#__PURE__*/React.createElement(Button, {
|
|
1250
|
+
variant: "secondary",
|
|
1251
|
+
onClick: () => copyLog(run.log)
|
|
1252
|
+
}, "Copy log"), /*#__PURE__*/React.createElement(Button, {
|
|
1253
|
+
variant: "secondary",
|
|
1254
|
+
onClick: () => setSupportOpen(true)
|
|
1255
|
+
}, "Send to support")) : null, run.status === "failed" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1256
|
+
variant: "primary",
|
|
1257
|
+
onClick: onResume
|
|
1258
|
+
}, run.error && RETRY_CODES.has(run.error.code) ? "Try again" : "Resume"), /*#__PURE__*/React.createElement(Button, {
|
|
1259
|
+
variant: "secondary",
|
|
1260
|
+
onClick: () => copyLog(run.log)
|
|
1261
|
+
}, "Copy log"), run.error && NO_RESTORE_CODES.has(run.error.code) ? null : /*#__PURE__*/React.createElement(Button, {
|
|
1262
|
+
variant: "secondary",
|
|
1263
|
+
onClick: () => setRestoreOpen(true)
|
|
1264
|
+
}, "Restore backup"), /*#__PURE__*/React.createElement(Button, {
|
|
1265
|
+
variant: "secondary",
|
|
1266
|
+
onClick: () => setSupportOpen(true)
|
|
1267
|
+
}, "Send to support")) : null), stalled || run.status === "failed" ? /*#__PURE__*/React.createElement(Troubleshooting, {
|
|
1268
|
+
run: run
|
|
1269
|
+
}) : null, /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
1270
|
+
open: restoreOpen,
|
|
1271
|
+
dialogTitle: "Restore the backup?",
|
|
1272
|
+
dialogContent: /*#__PURE__*/React.createElement(Body2, null, "This puts the database back to ", run.from_version, " from the backup taken before the upgrade. Anything people changed since the upgrade started is lost. Resume keeps your data and is usually the better fix."),
|
|
1273
|
+
confirmBtnText: "Restore backup",
|
|
1274
|
+
onCancel: () => setRestoreOpen(false),
|
|
1275
|
+
onConfirm: () => setRestoreOpen(false)
|
|
1276
|
+
}), /*#__PURE__*/React.createElement(SendToSupportDialog, {
|
|
1277
|
+
open: supportOpen,
|
|
1278
|
+
onClose: () => setSupportOpen(false),
|
|
1279
|
+
run: run,
|
|
1280
|
+
ownerEmail: ownerEmail
|
|
1281
|
+
}));
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
/* ================================================================== */
|
|
1285
|
+
/* 13. Maintenance screen (non-owners, app-wide) */
|
|
1286
|
+
/* ================================================================== */
|
|
1287
|
+
|
|
1288
|
+
const MaintenanceWrap = styled.div.withConfig({
|
|
1289
|
+
displayName: "selfHostedUpgrade__MaintenanceWrap",
|
|
1290
|
+
componentId: "sc-1dxkjfk-17"
|
|
1291
|
+
})(["box-sizing:border-box;min-height:100vh;width:100%;display:flex;align-items:center;justify-content:center;padding:24px;background-color:var(--body-bg-main);.card{box-sizing:border-box;width:100%;max-width:460px;display:flex;flex-direction:column;align-items:center;gap:16px;padding:40px 32px;text-align:center;background-color:var(--page-paper-main);border-radius:var(--ac-br-8);box-shadow:var(--shadow-tertiary);}.glyph{display:inline-flex;width:56px;height:56px;align-items:center;justify-content:center;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-200);}.glyph svg{fill:var(--color-secondary);}"]);
|
|
1292
|
+
export const MaintenanceScreen = _ref19 => {
|
|
1293
|
+
let toVersion = _ref19.toVersion,
|
|
1294
|
+
_ref19$viewer = _ref19.viewer,
|
|
1295
|
+
viewer = _ref19$viewer === void 0 ? "member" : _ref19$viewer,
|
|
1296
|
+
driver = _ref19.driver,
|
|
1297
|
+
onViewProgress = _ref19.onViewProgress;
|
|
1298
|
+
const owner = viewer === "owner";
|
|
1299
|
+
// A browser-driver run only advances while a tab runs it.
|
|
1300
|
+
const pausedInBrowser = owner && driver === "browser";
|
|
1301
|
+
return /*#__PURE__*/React.createElement(MaintenanceWrap, null, /*#__PURE__*/React.createElement("div", {
|
|
1302
|
+
className: "card"
|
|
1303
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
1304
|
+
className: "glyph"
|
|
1305
|
+
}, /*#__PURE__*/React.createElement(WarningTriangleIcon, {
|
|
1306
|
+
width: 28,
|
|
1307
|
+
height: 28
|
|
1308
|
+
})), /*#__PURE__*/React.createElement(Header3, null, "We\u2019ll be right back"), /*#__PURE__*/React.createElement(Body2, {
|
|
1309
|
+
color: "tertiary"
|
|
1310
|
+
}, owner ? "ActiveCollab is being upgraded to " + toVersion + ". Everyone else sees this screen until the upgrade finishes." : "ActiveCollab is being upgraded to " + toVersion + ". This usually takes a few minutes. Only the owner can access the app while the upgrade runs."), pausedInBrowser ? /*#__PURE__*/React.createElement(InfoBox, {
|
|
1311
|
+
type: "note",
|
|
1312
|
+
showIcon: true,
|
|
1313
|
+
title: "Waiting for you"
|
|
1314
|
+
}, /*#__PURE__*/React.createElement(Body2, null, "The upgrade is paused until you continue it.")) :
|
|
1315
|
+
/*#__PURE__*/
|
|
1316
|
+
// Indeterminate: this screen doesn't show the run's progress.
|
|
1317
|
+
React.createElement("div", {
|
|
1318
|
+
style: {
|
|
1319
|
+
width: "60%"
|
|
1320
|
+
}
|
|
1321
|
+
}, /*#__PURE__*/React.createElement(LinearLoader, {
|
|
1322
|
+
activeStrokeColor: "var(--color-secondary)",
|
|
1323
|
+
inactiveStrokeColor: "var(--color-theme-300)"
|
|
1324
|
+
})), owner ? /*#__PURE__*/React.createElement(Button, {
|
|
1325
|
+
variant: "primary",
|
|
1326
|
+
onClick: onViewProgress
|
|
1327
|
+
}, "View upgrade progress") : null));
|
|
1328
|
+
};
|
|
1329
|
+
//# sourceMappingURL=selfHostedUpgrade.js.map
|