@flamingo-stack/openframe-frontend-core 0.0.739 → 0.0.741
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/build/export-map.json +1 -1
- package/dist/{chunk-ENCAIAMY.cjs → chunk-4XL4YEZM.cjs} +3 -3
- package/dist/{chunk-FL6UO7IR.cjs → chunk-5SVOGLNK.cjs} +2 -2
- package/dist/{chunk-WFPCCBOM.cjs → chunk-7AM3AFM4.cjs} +10 -10
- package/dist/{chunk-S2CA5WE4.cjs → chunk-CWRVTQUO.cjs} +9 -1
- package/dist/{chunk-KHXZFLIN.cjs → chunk-DKOLQPE7.cjs} +8 -2
- package/dist/{chunk-UXFJXIUT.cjs → chunk-EKGL5K5K.cjs} +2 -2
- package/dist/{chunk-DTLHY2ZF.cjs → chunk-FQN6STIM.cjs} +12 -155
- package/dist/{chunk-V2ZFH42N.cjs → chunk-HYBMADYO.cjs} +3 -3
- package/dist/{chunk-NX6JQT25.cjs → chunk-I6UE6YVM.cjs} +4 -4
- package/dist/{chunk-SB4VWA5V.cjs → chunk-IK2RJUEA.cjs} +2118 -268
- package/dist/{chunk-CUDTMCXK.cjs → chunk-ITPEFCQ2.cjs} +13 -13
- package/dist/{chunk-WMKNZI4G.cjs → chunk-JFS6TZDX.cjs} +22 -22
- package/dist/{chunk-RGFT3P3L.cjs → chunk-LZ6NOVXX.cjs} +55 -55
- package/dist/{chunk-TF7J6VXG.cjs → chunk-QEUGYHFB.cjs} +9 -9
- package/dist/{chunk-II4QMH26.cjs → chunk-STEJZPIO.cjs} +3 -3
- package/dist/{chunk-UI3HROSI.cjs → chunk-XJ36TEGE.cjs} +33 -33
- package/dist/{chunk-UYP3G6PB.cjs → chunk-YQ37ZCD2.cjs} +2 -2
- package/dist/{chunk-Q7GG3WC5.cjs → chunk-ZJPDGVA6.cjs} +5 -5
- package/dist/{chunk-EGN4I5Q7.cjs → chunk-ZYOS7LVQ.cjs} +134 -46
- package/dist/{cloud-tenants-QSFSO3PA.cjs → cloud-tenants-MVJK52I2.cjs} +13 -13
- package/dist/components/case-studies/index.cjs +11 -11
- package/dist/components/chat/index.cjs +2 -2
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/features/capability-explorer.d.ts +9 -2
- package/dist/components/features/capability-explorer.d.ts.map +1 -1
- package/dist/components/features/capability-explorer.js +113 -6
- package/dist/components/features/index.cjs +141 -3
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/index.js +1 -0
- package/dist/components/features/scripts/execution-cells.d.ts +65 -0
- package/dist/components/features/scripts/execution-cells.d.ts.map +1 -0
- package/dist/components/features/scripts/execution-cells.js +75 -0
- package/dist/components/features/scripts/execution-status.d.ts +48 -0
- package/dist/components/features/scripts/execution-status.d.ts.map +1 -0
- package/dist/components/features/scripts/execution-status.js +15 -0
- package/dist/components/features/scripts/index.d.ts +20 -0
- package/dist/components/features/scripts/index.d.ts.map +1 -0
- package/dist/components/features/scripts/index.js +59 -0
- package/dist/components/features/scripts/schedule-form/index.d.ts +18 -0
- package/dist/components/features/scripts/schedule-form/index.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/index.js +84 -0
- package/dist/components/features/scripts/schedule-form/schedule-enums.d.ts +24 -0
- package/dist/components/features/scripts/schedule-form/schedule-enums.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-enums.js +18 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-fields.d.ts +57 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-fields.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-fields.js +169 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-types.d.ts +138 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-types.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-types.js +72 -0
- package/dist/components/features/scripts/schedule-form/schedule-interval-input.d.ts +54 -0
- package/dist/components/features/scripts/schedule-form/schedule-interval-input.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-interval-input.js +60 -0
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.d.ts +29 -0
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.js +124 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.d.ts +52 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.js +244 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-search-field.d.ts +35 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-search-field.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-search-field.js +58 -0
- package/dist/components/features/scripts/schedule-form/schedule-scripts-field.d.ts +25 -0
- package/dist/components/features/scripts/schedule-form/schedule-scripts-field.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-scripts-field.js +66 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.d.ts +77 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.js +262 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing.d.ts +288 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing.js +165 -0
- package/dist/components/features/scripts/script-cells.d.ts +11 -0
- package/dist/components/features/scripts/script-cells.d.ts.map +1 -0
- package/dist/components/features/scripts/script-cells.js +19 -0
- package/dist/components/features/scripts/script-executions-table.d.ts +58 -0
- package/dist/components/features/scripts/script-executions-table.d.ts.map +1 -0
- package/dist/components/features/scripts/script-executions-table.js +88 -0
- package/dist/components/features/scripts/script-schedules-table.d.ts +38 -0
- package/dist/components/features/scripts/script-schedules-table.d.ts.map +1 -0
- package/dist/components/features/scripts/script-schedules-table.js +71 -0
- package/dist/components/features/scripts/script-shell-badge.d.ts +9 -0
- package/dist/components/features/scripts/script-shell-badge.d.ts.map +1 -0
- package/dist/components/features/scripts/script-shell-badge.js +15 -0
- package/dist/components/features/scripts/scripts-table-columns.d.ts +162 -0
- package/dist/components/features/scripts/scripts-table-columns.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-table-columns.js +69 -0
- package/dist/components/features/scripts/scripts-table-shared.d.ts +19 -0
- package/dist/components/features/scripts/scripts-table-shared.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-table-shared.js +35 -0
- package/dist/components/features/scripts/scripts-table.d.ts +40 -0
- package/dist/components/features/scripts/scripts-table.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-table.js +84 -0
- package/dist/components/features/scripts/scripts-tabs.d.ts +5 -0
- package/dist/components/features/scripts/scripts-tabs.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-tabs.js +10 -0
- package/dist/components/features/scripts/shell-types.d.ts +13 -0
- package/dist/components/features/scripts/shell-types.d.ts.map +1 -0
- package/dist/components/features/scripts/shell-types.js +21 -0
- package/dist/components/help-center-pages/index.cjs +53 -53
- package/dist/components/index.cjs +178 -34
- package/dist/components/meeting-scheduler/index.cjs +17 -17
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/product-demo/fixtures/scripts.d.ts +34 -0
- package/dist/components/product-demo/fixtures/scripts.d.ts.map +1 -0
- package/dist/components/product-demo/fixtures/scripts.js +123 -0
- package/dist/components/product-demo/fixtures/shared.d.ts +8 -0
- package/dist/components/product-demo/fixtures/shared.d.ts.map +1 -1
- package/dist/components/product-demo/fixtures/shared.js +7 -1
- package/dist/components/product-demo/fixtures/software-update.d.ts.map +1 -1
- package/dist/components/product-demo/fixtures/software-update.js +1 -5
- package/dist/components/product-demo/index.cjs +16 -13
- package/dist/components/product-demo/product-screen.d.ts.map +1 -1
- package/dist/components/product-demo/product-screen.js +2 -1
- package/dist/components/product-demo/registry.d.ts.map +1 -1
- package/dist/components/product-demo/registry.js +2 -1
- package/dist/components/product-demo/screen-keys.cjs +2 -1
- package/dist/components/product-demo/screen-keys.d.ts +1 -0
- package/dist/components/product-demo/screen-keys.d.ts.map +1 -1
- package/dist/components/product-demo/screen-keys.js +2 -1
- package/dist/components/product-demo/screens/scripts.d.ts +11 -0
- package/dist/components/product-demo/screens/scripts.d.ts.map +1 -0
- package/dist/components/product-demo/screens/scripts.js +130 -0
- package/dist/components/shared/legal-document/index.d.ts +2 -1
- package/dist/components/shared/legal-document/index.d.ts.map +1 -1
- package/dist/components/shared/legal-document/index.js +10 -2
- package/dist/components/shared/legal-document/legal-document-page.d.ts +35 -23
- package/dist/components/shared/legal-document/legal-document-page.d.ts.map +1 -1
- package/dist/components/shared/legal-document/legal-document-page.js +27 -10
- package/dist/components/shared/legal-document/use-legal-docs.d.ts +7 -3
- package/dist/components/shared/legal-document/use-legal-docs.d.ts.map +1 -1
- package/dist/components/shared/legal-document/use-legal-docs.js +7 -0
- package/dist/components/shared/legal-document/use-legal-documents.d.ts +31 -0
- package/dist/components/shared/legal-document/use-legal-documents.d.ts.map +1 -0
- package/dist/components/shared/legal-document/use-legal-documents.js +67 -0
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/ui/index.cjs +3 -3
- package/dist/{devices-C7XLWJFC.cjs → devices-W3S7Q2PG.cjs} +9 -9
- package/dist/index.cjs +150 -8
- package/dist/{knowledge-3QKWTOE7.cjs → knowledge-AIYQ4FC3.cjs} +7 -7
- package/dist/{logs-JXD75NR4.cjs → logs-7SHJ2ARE.cjs} +25 -25
- package/dist/{policies-ZPN53PFQ.cjs → policies-EIZJ5SUP.cjs} +10 -10
- package/dist/{remote-session-DNFZ5OLY.cjs → remote-session-BZMNE6D2.cjs} +5 -5
- package/dist/scripts-J2FWC7E4.cjs +2112 -0
- package/dist/{software-update-CRSIBS3K.cjs → software-update-QAMNASVF.cjs} +14 -18
- package/dist/{tickets-board-CKZRB6YV.cjs → tickets-board-CEDHD3KB.cjs} +17 -17
- package/dist/utils/index.cjs +8 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/legal-documents.d.ts +18 -0
- package/dist/utils/legal-documents.d.ts.map +1 -0
- package/dist/utils/legal-documents.js +8 -0
- package/package.json +1 -1
- package/src/components/features/capability-explorer.tsx +134 -7
- package/src/components/features/index.ts +1 -0
- package/src/components/features/scripts/execution-cells.tsx +149 -0
- package/src/components/features/scripts/execution-status.ts +42 -0
- package/src/components/features/scripts/index.ts +42 -0
- package/src/components/features/scripts/schedule-form/index.ts +59 -0
- package/src/components/features/scripts/schedule-form/schedule-enums.ts +26 -0
- package/src/components/features/scripts/schedule-form/schedule-form-fields.tsx +249 -0
- package/src/components/features/scripts/schedule-form/schedule-form-types.ts +189 -0
- package/src/components/features/scripts/schedule-form/schedule-interval-input.tsx +121 -0
- package/src/components/features/scripts/schedule-form/schedule-offline-fields.tsx +218 -0
- package/src/components/features/scripts/schedule-form/schedule-script-picker-card.tsx +321 -0
- package/src/components/features/scripts/schedule-form/schedule-script-search-field.tsx +115 -0
- package/src/components/features/scripts/schedule-form/schedule-scripts-field.tsx +97 -0
- package/src/components/features/scripts/schedule-form/schedule-timing-fields.tsx +482 -0
- package/src/components/features/scripts/schedule-form/schedule-timing.ts +484 -0
- package/src/components/features/scripts/script-cells.tsx +29 -0
- package/src/components/features/scripts/script-executions-table.tsx +145 -0
- package/src/components/features/scripts/script-schedules-table.tsx +113 -0
- package/src/components/features/scripts/script-shell-badge.tsx +25 -0
- package/src/components/features/scripts/scripts-table-columns.ts +95 -0
- package/src/components/features/scripts/scripts-table-shared.tsx +43 -0
- package/src/components/features/scripts/scripts-table.tsx +124 -0
- package/src/components/features/scripts/scripts-tabs.ts +11 -0
- package/src/components/features/scripts/shell-types.ts +26 -0
- package/src/components/product-demo/fixtures/scripts.ts +186 -0
- package/src/components/product-demo/fixtures/shared.ts +7 -0
- package/src/components/product-demo/fixtures/software-update.ts +1 -7
- package/src/components/product-demo/product-screen.tsx +3 -1
- package/src/components/product-demo/registry.ts +1 -0
- package/src/components/product-demo/screen-keys.ts +1 -0
- package/src/components/product-demo/screens/scripts.tsx +192 -0
- package/src/components/shared/legal-document/index.ts +8 -0
- package/src/components/shared/legal-document/legal-document-page.tsx +83 -44
- package/src/components/shared/legal-document/use-legal-docs.ts +18 -3
- package/src/components/shared/legal-document/use-legal-documents.ts +113 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/legal-documents.ts +21 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { Input } from "../../../ui/input.js";
|
|
5
|
+
function ScheduleIntervalInput({
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
onBlur,
|
|
9
|
+
disabled,
|
|
10
|
+
invalid,
|
|
11
|
+
error,
|
|
12
|
+
min,
|
|
13
|
+
className,
|
|
14
|
+
"aria-label": ariaLabel,
|
|
15
|
+
"data-invalid-focus": invalidFocus
|
|
16
|
+
}) {
|
|
17
|
+
const [text, setText] = useState(() => value === null ? "" : String(value));
|
|
18
|
+
const focused = useRef(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (focused.current) return;
|
|
21
|
+
const next = value === null ? "" : String(value);
|
|
22
|
+
setText((current) => current === next ? current : next);
|
|
23
|
+
}, [value]);
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Input,
|
|
26
|
+
{
|
|
27
|
+
type: "number",
|
|
28
|
+
min,
|
|
29
|
+
inputMode: "numeric",
|
|
30
|
+
"aria-label": ariaLabel,
|
|
31
|
+
"data-invalid-focus": invalidFocus || void 0,
|
|
32
|
+
className,
|
|
33
|
+
value: text,
|
|
34
|
+
onFocus: () => {
|
|
35
|
+
focused.current = true;
|
|
36
|
+
},
|
|
37
|
+
onBlur: () => {
|
|
38
|
+
focused.current = false;
|
|
39
|
+
setText(value === null ? "" : String(value));
|
|
40
|
+
onBlur?.();
|
|
41
|
+
},
|
|
42
|
+
onChange: (e) => {
|
|
43
|
+
const raw = e.target.value;
|
|
44
|
+
setText(raw);
|
|
45
|
+
if (raw.trim() === "") {
|
|
46
|
+
onChange(null);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const parsed = Number(raw);
|
|
50
|
+
onChange(Number.isFinite(parsed) ? parsed : null);
|
|
51
|
+
},
|
|
52
|
+
disabled,
|
|
53
|
+
invalid,
|
|
54
|
+
error
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
ScheduleIntervalInput
|
|
60
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "If device is offline at scheduled time" — Skip this Run vs Run when device
|
|
3
|
+
* comes back online, plus the reconnect window the second one needs
|
|
4
|
+
* (design node 460:63425).
|
|
5
|
+
*
|
|
6
|
+
* Maps to `offlineBehavior` (`SKIP` | `RETRY_ON_RECONNECT`) and
|
|
7
|
+
* `reconnectWindowSeconds`. The window is submitted ONLY alongside
|
|
8
|
+
* RETRY_ON_RECONNECT — the schema documents it as "set only when offlineBehavior
|
|
9
|
+
* is RETRY_ON_RECONNECT" — which is also why it is required rather than
|
|
10
|
+
* optional-meaning-forever: nothing in the contract says a null window queues a
|
|
11
|
+
* run indefinitely, so the form never offers a reading it cannot back up.
|
|
12
|
+
*
|
|
13
|
+
* The block presupposes a scheduled time the device can be absent FOR, so it
|
|
14
|
+
* collapses for DEVICE_ONLINE — which fires on the reconnect already — and
|
|
15
|
+
* submits the SKIP default instead of what the collapsed controls hold.
|
|
16
|
+
* DEVICE_LOCAL keeps it: its scheduled moment is the device's own wall clock.
|
|
17
|
+
*
|
|
18
|
+
* It collapses with the `0fr → 1fr` grid-rows technique, staying MOUNTED so
|
|
19
|
+
* toggling the trigger back restores what was picked, `inert` to drop the
|
|
20
|
+
* collapsed controls out of the tab order, and a padding/negative-margin pair:
|
|
21
|
+
* the bottom padding is the room the absolutely-positioned error renders into,
|
|
22
|
+
* and the constant negative margin cancels it so a collapsed block leaves no
|
|
23
|
+
* hole.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ScheduleOfflineFields({ showErrors, disabled }: {
|
|
26
|
+
showErrors: boolean;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=schedule-offline-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-offline-fields.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-offline-fields.tsx"],"names":[],"mappings":"AA+FA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,UAAU,EAAE,QAAgB,EAAE,EAAE;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,+BAkGlH"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use no memo";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useController, useFormContext, useWatch } from "react-hook-form";
|
|
5
|
+
import { cn } from "../../../../utils/cn.js";
|
|
6
|
+
import { Label } from "../../../ui/label.js";
|
|
7
|
+
import { RadioGroupBlock } from "../../../ui/radio-group.js";
|
|
8
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../ui/select.js";
|
|
9
|
+
import { TruncateText } from "../../../ui/truncate-text.js";
|
|
10
|
+
import { SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS } from "./schedule-form-types.js";
|
|
11
|
+
import { ScheduleIntervalInput } from "./schedule-interval-input.js";
|
|
12
|
+
import {
|
|
13
|
+
DURATION_UNIT_OPTIONS,
|
|
14
|
+
isEventTrigger,
|
|
15
|
+
isRetryOnReconnect,
|
|
16
|
+
MIN_RECONNECT_MINUTES,
|
|
17
|
+
snapReconnectInterval
|
|
18
|
+
} from "./schedule-timing.js";
|
|
19
|
+
function ReconnectWindowFields({
|
|
20
|
+
interval,
|
|
21
|
+
unit,
|
|
22
|
+
onIntervalChange,
|
|
23
|
+
onIntervalBlur,
|
|
24
|
+
onUnitChange,
|
|
25
|
+
disabled,
|
|
26
|
+
invalid,
|
|
27
|
+
fluid = false,
|
|
28
|
+
className
|
|
29
|
+
}) {
|
|
30
|
+
const controlWidth = fluid ? "flex-1 min-w-0" : "w-[120px]";
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-[var(--spacing-system-xsf)]", className), children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: cn("shrink-0 text-h4", disabled ? "text-ods-text-disabled" : "text-ods-text-secondary"), children: "Stop Retry after" }),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
ScheduleIntervalInput,
|
|
35
|
+
{
|
|
36
|
+
min: unit === "minute" ? MIN_RECONNECT_MINUTES : 1,
|
|
37
|
+
"aria-label": "Stop retry after",
|
|
38
|
+
className: controlWidth,
|
|
39
|
+
value: interval,
|
|
40
|
+
onChange: onIntervalChange,
|
|
41
|
+
onBlur: onIntervalBlur,
|
|
42
|
+
"data-invalid-focus": true,
|
|
43
|
+
disabled,
|
|
44
|
+
invalid
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsxs(Select, { value: unit, onValueChange: (next) => onUnitChange(next), disabled, children: [
|
|
48
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: controlWidth, "aria-label": "Stop retry after unit", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
49
|
+
/* @__PURE__ */ jsx(SelectContent, { children: DURATION_UNIT_OPTIONS.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
50
|
+
] })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function ScheduleOfflineFields({ showErrors, disabled = false }) {
|
|
54
|
+
const { control } = useFormContext();
|
|
55
|
+
const trigger = useWatch({ control, name: "trigger" });
|
|
56
|
+
const collapsed = isEventTrigger(trigger);
|
|
57
|
+
const { field: behaviorField } = useController({ control, name: "offlineBehavior" });
|
|
58
|
+
const { field: intervalField, fieldState: intervalState } = useController({ control, name: "reconnectInterval" });
|
|
59
|
+
const { field: unitField } = useController({ control, name: "reconnectUnit" });
|
|
60
|
+
const windowDisabled = disabled || !isRetryOnReconnect(behaviorField.value);
|
|
61
|
+
const intervalError = showErrors ? intervalState.error?.message : void 0;
|
|
62
|
+
const handleUnitChange = (next) => {
|
|
63
|
+
unitField.onChange(next);
|
|
64
|
+
const snapped = snapReconnectInterval(intervalField.value, next);
|
|
65
|
+
if (snapped !== intervalField.value) intervalField.onChange(snapped);
|
|
66
|
+
};
|
|
67
|
+
const windowFieldsFor = (fluid) => /* @__PURE__ */ jsx(
|
|
68
|
+
ReconnectWindowFields,
|
|
69
|
+
{
|
|
70
|
+
interval: intervalField.value,
|
|
71
|
+
unit: unitField.value,
|
|
72
|
+
onIntervalChange: intervalField.onChange,
|
|
73
|
+
onIntervalBlur: intervalField.onBlur,
|
|
74
|
+
onUnitChange: handleUnitChange,
|
|
75
|
+
disabled: windowDisabled,
|
|
76
|
+
invalid: !!intervalError,
|
|
77
|
+
fluid
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
const options = SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS.map(
|
|
81
|
+
(option) => isRetryOnReconnect(option.value) ? (
|
|
82
|
+
// Desktop only. Below `md` the caption plus two controls cannot share a
|
|
83
|
+
// row with the option's own label without squeezing it to nothing, so
|
|
84
|
+
// the same fields render full-width under the group instead.
|
|
85
|
+
{ ...option, trailing: /* @__PURE__ */ jsx("div", { className: "hidden content-md:flex", children: windowFieldsFor(false) }) }
|
|
86
|
+
) : option
|
|
87
|
+
);
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
inert: collapsed,
|
|
92
|
+
style: {
|
|
93
|
+
gridTemplateRows: collapsed ? "0fr" : "1fr",
|
|
94
|
+
opacity: collapsed ? 0 : 1
|
|
95
|
+
},
|
|
96
|
+
className: "mb-[calc(-1*var(--spacing-system-lf))] grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none",
|
|
97
|
+
children: /* @__PURE__ */ jsx("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "pb-[var(--spacing-system-lf)]", children: /* @__PURE__ */ jsxs(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: "relative flex flex-col gap-[var(--spacing-system-xxs)]",
|
|
101
|
+
"data-invalid": intervalError ? true : void 0,
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx(Label, { className: "text-h4", children: "If device is offline at scheduled time" }),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
RadioGroupBlock,
|
|
106
|
+
{
|
|
107
|
+
variant: "grouped",
|
|
108
|
+
value: behaviorField.value,
|
|
109
|
+
onValueChange: behaviorField.onChange,
|
|
110
|
+
disabled,
|
|
111
|
+
options
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ jsx("div", { className: "pt-[var(--spacing-system-xs)] content-md:hidden", children: windowFieldsFor(true) }),
|
|
115
|
+
intervalError && /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 translate-y-full", children: /* @__PURE__ */ jsx(TruncateText, { variant: "h6", className: "text-ods-error", children: intervalError }) })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) }) })
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
ScheduleOfflineFields
|
|
124
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type RenderScheduleScriptSearch } from './schedule-form-types';
|
|
2
|
+
interface ScheduleScriptPickerCardProps {
|
|
3
|
+
index: number;
|
|
4
|
+
/** How many cards the list has — disables the move buttons at the ends. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** UI platform ids the schedule targets — what the host narrows its script search by. */
|
|
7
|
+
supportedPlatforms: string[];
|
|
8
|
+
/** The card's "Select Script" field: the host's search over its script library. */
|
|
9
|
+
renderScriptSearch: RenderScheduleScriptSearch;
|
|
10
|
+
onRemove: () => void;
|
|
11
|
+
canRemove: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Controls inline error visibility — the parent flips this true once the
|
|
15
|
+
* user attempts Save, so errors stay hidden on a pristine form (mirrors
|
|
16
|
+
* `ScriptFormFields.showErrors`).
|
|
17
|
+
*/
|
|
18
|
+
showErrors?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The script's arguments and environment variables under the first row.
|
|
21
|
+
* Default true; false is the card as one row (the script and its timeout).
|
|
22
|
+
*/
|
|
23
|
+
showParams?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One card of the schedule's ordered script list: drag handle, script
|
|
27
|
+
* autocomplete, timeout and the script's arguments / environment variables.
|
|
28
|
+
*
|
|
29
|
+
* **Order is the payload.** The card index IS the run order — the backend
|
|
30
|
+
* stores `scriptIds: [ID!]` in run order, so reordering rewrites that array.
|
|
31
|
+
*
|
|
32
|
+
* Sorting runs on the core library's `SortableList` (`useSortableItem`), the
|
|
33
|
+
* same Pragmatic stack the ticket board uses. Only the handle starts a drag,
|
|
34
|
+
* so text selection inside the fields keeps working, and the handle carries
|
|
35
|
+
* the keyboard path (Arrow Up / Arrow Down, one press one move) with
|
|
36
|
+
* live-region announcements wired up by the list. On touch/narrow viewports
|
|
37
|
+
* no drag exists at all — an up/down button pair renders beside the delete
|
|
38
|
+
* button instead.
|
|
39
|
+
*
|
|
40
|
+
* Arguments and env vars ARE persisted, as this schedule's per-script override
|
|
41
|
+
* (`scriptCustomParams`): they seed from the picked script's defaults, and only
|
|
42
|
+
* a half the user moves off those defaults is written back — so leaving a card
|
|
43
|
+
* untouched keeps the schedule following later edits to the script itself.
|
|
44
|
+
*
|
|
45
|
+
* ⚠ **Timeout is still editable but not persisted**: the override input carries
|
|
46
|
+
* args and env vars only. It is
|
|
47
|
+
* seeded from the script's own default, which is what the run actually uses, so
|
|
48
|
+
* the card shows the truth — it just cannot be changed per schedule yet.
|
|
49
|
+
*/
|
|
50
|
+
export declare function ScheduleScriptPickerCard({ index, count, supportedPlatforms, renderScriptSearch, onRemove, canRemove, disabled, showErrors, showParams, }: ScheduleScriptPickerCardProps): import("react").JSX.Element;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=schedule-script-picker-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-script-picker-card.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-script-picker-card.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,0BAA0B,EAGhC,MAAM,uBAAuB,CAAC;AAK/B,UAAU,6BAA6B;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,yFAAyF;IACzF,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,mFAAmF;IACnF,kBAAkB,EAAE,0BAA0B,CAAC;IAC/C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,QAAgB,EAChB,UAAiB,EACjB,UAAiB,GAClB,EAAE,6BAA6B,+BA6O/B"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use no memo";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
5
|
+
import { useContentMdUp } from "../../../../hooks/ui/use-content-breakpoint.js";
|
|
6
|
+
import { DraggerIcon } from "../../../icons-v2-generated/interface/dragger-icon.js";
|
|
7
|
+
import { TrashIcon } from "../../../icons-v2-generated/interface/trash-icon.js";
|
|
8
|
+
import { ScriptArguments } from "../../../platform/ScriptArguments.js";
|
|
9
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../../../ui/accordion.js";
|
|
10
|
+
import { Button } from "../../../ui/button/index.js";
|
|
11
|
+
import { Input } from "../../../ui/input.js";
|
|
12
|
+
import { Label } from "../../../ui/label.js";
|
|
13
|
+
import { SortableMoveButtons } from "../../sortable-list/sortable-move-buttons.js";
|
|
14
|
+
import { useSortableItem } from "../../sortable-list/use-sortable-item.js";
|
|
15
|
+
import {
|
|
16
|
+
EMPTY_SCHEDULE_SCRIPT_ROW
|
|
17
|
+
} from "./schedule-form-types.js";
|
|
18
|
+
const UNSET_TIMEOUT = 0;
|
|
19
|
+
function ScheduleScriptPickerCard({
|
|
20
|
+
index,
|
|
21
|
+
count,
|
|
22
|
+
supportedPlatforms,
|
|
23
|
+
renderScriptSearch,
|
|
24
|
+
onRemove,
|
|
25
|
+
canRemove,
|
|
26
|
+
disabled = false,
|
|
27
|
+
showErrors = true,
|
|
28
|
+
showParams = true
|
|
29
|
+
}) {
|
|
30
|
+
const { control, setValue, watch } = useFormContext();
|
|
31
|
+
const selected = watch(`scripts.${index}`);
|
|
32
|
+
const runParamsLocked = disabled || !selected?.scriptId;
|
|
33
|
+
const { itemRef, dragHandleProps, isDragging, dragAndDropEnabled } = useSortableItem();
|
|
34
|
+
const isMdUp = useContentMdUp();
|
|
35
|
+
const handleScriptPick = (row) => {
|
|
36
|
+
if (!row) {
|
|
37
|
+
setValue(`scripts.${index}`, EMPTY_SCHEDULE_SCRIPT_ROW, { shouldValidate: true });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setValue(`scripts.${index}`, row, { shouldValidate: true, shouldDirty: true });
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
ref: itemRef,
|
|
46
|
+
className: `flex flex-col gap-[var(--spacing-system-sf)] rounded-[6px] border bg-ods-bg p-[var(--spacing-system-l)] content-md:gap-[var(--spacing-system-lf)] ${isDragging ? "relative z-10 border-ods-accent shadow-lg" : "border-ods-border"}`,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: `flex flex-col gap-[var(--spacing-system-sf)] content-md:gap-[var(--spacing-system-lf)] ${dragAndDropEnabled ? "content-md:flex-row content-md:items-end" : ""}`,
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: `flex min-w-0 flex-1 items-end ${dragAndDropEnabled ? "gap-[var(--spacing-system-xs)]" : "gap-[var(--spacing-system-xsf)]"}`,
|
|
57
|
+
children: [
|
|
58
|
+
dragAndDropEnabled && /* @__PURE__ */ jsx(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
...dragHandleProps,
|
|
63
|
+
disabled,
|
|
64
|
+
"aria-label": `Reorder ${selected?.name || `script ${index + 1}`}`,
|
|
65
|
+
className: `flex size-12 shrink-0 items-center justify-center rounded-[6px] text-ods-text-secondary hover:text-ods-text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-ods-border-focus disabled:cursor-not-allowed disabled:opacity-30 ${isDragging ? "cursor-grabbing text-ods-text-primary" : "cursor-grab"}`,
|
|
66
|
+
children: /* @__PURE__ */ jsx(DraggerIcon, { size: 24 })
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Controller,
|
|
71
|
+
{
|
|
72
|
+
name: `scripts.${index}.scriptId`,
|
|
73
|
+
control,
|
|
74
|
+
render: ({ fieldState }) => /* @__PURE__ */ jsx(Fragment, { children: renderScriptSearch({
|
|
75
|
+
scriptId: selected?.scriptId ?? "",
|
|
76
|
+
name: selected?.name ?? "",
|
|
77
|
+
supportedPlatforms,
|
|
78
|
+
onPick: handleScriptPick,
|
|
79
|
+
disabled,
|
|
80
|
+
error: showErrors ? fieldState.error?.message : void 0,
|
|
81
|
+
invalid: showErrors && !!fieldState.error
|
|
82
|
+
}) })
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
!dragAndDropEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ jsx(SortableMoveButtons, { index, count, label: selected?.name || `script ${index + 1}` }),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
Button,
|
|
89
|
+
{
|
|
90
|
+
variant: "outline",
|
|
91
|
+
size: "icon",
|
|
92
|
+
onClick: onRemove,
|
|
93
|
+
disabled: !canRemove || disabled,
|
|
94
|
+
"aria-label": "Remove script from schedule",
|
|
95
|
+
className: "text-ods-error disabled:opacity-30",
|
|
96
|
+
children: /* @__PURE__ */ jsx(TrashIcon, { size: 20 })
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-end gap-[var(--spacing-system-xs)]", children: [
|
|
104
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-[var(--spacing-system-xxs)]", children: [
|
|
105
|
+
/* @__PURE__ */ jsx(Label, { className: "text-h4", children: "Timeout" }),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
Controller,
|
|
108
|
+
{
|
|
109
|
+
name: `scripts.${index}.timeoutSeconds`,
|
|
110
|
+
control,
|
|
111
|
+
render: ({ field, fieldState }) => (
|
|
112
|
+
// Locked until a script is picked: the timeout belongs to the
|
|
113
|
+
// script, so the field stays EMPTY until there is one — the
|
|
114
|
+
// sentinel is a "nothing here yet" marker, and rendering it as
|
|
115
|
+
// a literal 0 would read as a real (and invalid) timeout.
|
|
116
|
+
// Picking a script writes its own timeout in.
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
Input,
|
|
119
|
+
{
|
|
120
|
+
type: "number",
|
|
121
|
+
min: 1,
|
|
122
|
+
className: "w-full",
|
|
123
|
+
value: field.value ? String(field.value) : "",
|
|
124
|
+
onChange: (e) => field.onChange(e.target.value ? Number(e.target.value) : UNSET_TIMEOUT),
|
|
125
|
+
disabled: runParamsLocked,
|
|
126
|
+
endAdornment: /* @__PURE__ */ jsx("span", { className: "text-ods-text-secondary text-h6", children: "Seconds" }),
|
|
127
|
+
error: showErrors ? fieldState.error?.message : void 0,
|
|
128
|
+
invalid: showErrors && !!fieldState.error
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
] }),
|
|
135
|
+
dragAndDropEnabled && /* @__PURE__ */ jsx(
|
|
136
|
+
Button,
|
|
137
|
+
{
|
|
138
|
+
variant: "outline",
|
|
139
|
+
size: "icon",
|
|
140
|
+
onClick: onRemove,
|
|
141
|
+
disabled: !canRemove || disabled,
|
|
142
|
+
"aria-label": "Remove script from schedule",
|
|
143
|
+
className: "text-ods-error disabled:opacity-30",
|
|
144
|
+
children: /* @__PURE__ */ jsx(TrashIcon, { size: 20 })
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
!showParams ? null : isMdUp === false ? /* @__PURE__ */ jsxs(Accordion, { type: "multiple", className: "overflow-hidden rounded-[6px] border border-ods-border", children: [
|
|
152
|
+
/* @__PURE__ */ jsxs(AccordionItem, { value: "args", className: "border-ods-border data-[state=closed]:bg-ods-card", children: [
|
|
153
|
+
/* @__PURE__ */ jsx(AccordionTrigger, { className: "h-14 px-[var(--spacing-system-sf)] py-0 text-ods-text-primary text-h6 hover:no-underline [&>svg]:text-ods-text-secondary", children: "Edit Default Script Arguments" }),
|
|
154
|
+
/* @__PURE__ */ jsx(AccordionContent, { className: "px-[var(--spacing-system-sf)] [&_label:empty]:hidden", children: /* @__PURE__ */ jsx(
|
|
155
|
+
Controller,
|
|
156
|
+
{
|
|
157
|
+
name: `scripts.${index}.args`,
|
|
158
|
+
control,
|
|
159
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
160
|
+
ScriptArguments,
|
|
161
|
+
{
|
|
162
|
+
arguments: field.value,
|
|
163
|
+
onArgumentsChange: field.onChange,
|
|
164
|
+
keyPlaceholder: "Key",
|
|
165
|
+
valuePlaceholder: "Enter Value (empty=flag)",
|
|
166
|
+
addButtonLabel: "Add Script Argument",
|
|
167
|
+
titleLabel: "",
|
|
168
|
+
disabled: runParamsLocked
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
) })
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ jsxs(AccordionItem, { value: "env", className: "border-b-0 border-ods-border data-[state=closed]:bg-ods-card", children: [
|
|
175
|
+
/* @__PURE__ */ jsx(AccordionTrigger, { className: "h-14 px-[var(--spacing-system-sf)] py-0 text-ods-text-primary text-h6 hover:no-underline [&>svg]:text-ods-text-secondary", children: "Edit Default Environment Vars" }),
|
|
176
|
+
/* @__PURE__ */ jsx(AccordionContent, { className: "px-[var(--spacing-system-sf)] [&_label:empty]:hidden", children: /* @__PURE__ */ jsx(
|
|
177
|
+
Controller,
|
|
178
|
+
{
|
|
179
|
+
name: `scripts.${index}.envVars`,
|
|
180
|
+
control,
|
|
181
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
182
|
+
ScriptArguments,
|
|
183
|
+
{
|
|
184
|
+
arguments: field.value,
|
|
185
|
+
onArgumentsChange: field.onChange,
|
|
186
|
+
keyPlaceholder: "Key",
|
|
187
|
+
valuePlaceholder: "Enter Value",
|
|
188
|
+
addButtonLabel: "Add Environment Var",
|
|
189
|
+
addSecretButtonLabel: "Add Secret",
|
|
190
|
+
titleLabel: "",
|
|
191
|
+
disabled: runParamsLocked
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
) })
|
|
196
|
+
] })
|
|
197
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-[var(--spacing-system-lf)] content-md:flex-row", children: [
|
|
198
|
+
/* @__PURE__ */ jsx("div", { className: "w-full min-w-0 flex-1 [&_label]:text-h4", children: /* @__PURE__ */ jsx(
|
|
199
|
+
Controller,
|
|
200
|
+
{
|
|
201
|
+
name: `scripts.${index}.args`,
|
|
202
|
+
control,
|
|
203
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
204
|
+
ScriptArguments,
|
|
205
|
+
{
|
|
206
|
+
arguments: field.value,
|
|
207
|
+
onArgumentsChange: field.onChange,
|
|
208
|
+
keyPlaceholder: "Key",
|
|
209
|
+
valuePlaceholder: "Enter Value (empty=flag)",
|
|
210
|
+
addButtonLabel: "Add Script Argument",
|
|
211
|
+
titleLabel: "Script Arguments",
|
|
212
|
+
disabled: runParamsLocked
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
) }),
|
|
217
|
+
/* @__PURE__ */ jsx("div", { className: "w-full min-w-0 flex-1 [&_label]:text-h4", children: /* @__PURE__ */ jsx(
|
|
218
|
+
Controller,
|
|
219
|
+
{
|
|
220
|
+
name: `scripts.${index}.envVars`,
|
|
221
|
+
control,
|
|
222
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
223
|
+
ScriptArguments,
|
|
224
|
+
{
|
|
225
|
+
arguments: field.value,
|
|
226
|
+
onArgumentsChange: field.onChange,
|
|
227
|
+
keyPlaceholder: "Key",
|
|
228
|
+
valuePlaceholder: "Enter Value",
|
|
229
|
+
addButtonLabel: "Add Environment Var",
|
|
230
|
+
addSecretButtonLabel: "Add Secret",
|
|
231
|
+
titleLabel: "Environment Vars",
|
|
232
|
+
disabled: runParamsLocked
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
) })
|
|
237
|
+
] })
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
ScheduleScriptPickerCard
|
|
244
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** One script a search offers. */
|
|
2
|
+
export interface ScheduleScriptSearchResult {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
/** UI platform ids the script runs on — the icons beside its name. */
|
|
6
|
+
supportedPlatforms: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ScheduleScriptSearchFieldProps {
|
|
9
|
+
/** The card's script: `''` while nothing is picked. */
|
|
10
|
+
scriptId: string;
|
|
11
|
+
/** Its name — the label shown when the script is not on the current search page. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** The current page of the host's search. */
|
|
14
|
+
scripts: ScheduleScriptSearchResult[];
|
|
15
|
+
isLoading?: boolean;
|
|
16
|
+
/** What is typed in the field; decides which "nothing found" reading shows. */
|
|
17
|
+
inputValue?: string;
|
|
18
|
+
onInputChange?: (value: string) => void;
|
|
19
|
+
/** Focus entered the field: a lazy search starts here. */
|
|
20
|
+
onOpen?: () => void;
|
|
21
|
+
/** Focus left the whole field. */
|
|
22
|
+
onClose?: () => void;
|
|
23
|
+
/** A script of `scripts` was picked (its id), or the field was cleared (null). */
|
|
24
|
+
onChange: (scriptId: string | null) => void;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
error?: string;
|
|
27
|
+
invalid?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* "Select Script": the autocomplete of a schedule's script card. The search is
|
|
31
|
+
* the host's (server-side, so the field does no filtering of its own); this is
|
|
32
|
+
* the field every host draws around it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ScheduleScriptSearchField({ scriptId, name, scripts, isLoading, inputValue, onInputChange, onOpen, onClose, onChange, disabled, error, invalid, }: ScheduleScriptSearchFieldProps): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=schedule-script-search-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-script-search-field.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-script-search-field.tsx"],"names":[],"mappings":"AAQA,kCAAkC;AAClC,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,8BAA8B;IAC7C,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kFAAkF;IAClF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAYD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAiB,EACjB,UAAe,EACf,aAAa,EACb,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,KAAK,EACL,OAAe,GAChB,EAAE,8BAA8B,+BAgDhC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { OS_PLATFORMS } from "../../../../utils/os-platforms.js";
|
|
4
|
+
import { Autocomplete } from "../../../ui/autocomplete.js";
|
|
5
|
+
import { Label } from "../../../ui/label.js";
|
|
6
|
+
import { TruncateText } from "../../../ui/truncate-text.js";
|
|
7
|
+
function ScriptPlatformIcons({ platforms }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 items-center gap-0.5", children: OS_PLATFORMS.filter((p) => platforms.includes(p.id)).map((p) => /* @__PURE__ */ jsx(p.icon, { className: "h-3.5 w-3.5 text-ods-text-secondary opacity-60" }, p.id)) });
|
|
9
|
+
}
|
|
10
|
+
function ScheduleScriptSearchField({
|
|
11
|
+
scriptId,
|
|
12
|
+
name,
|
|
13
|
+
scripts,
|
|
14
|
+
isLoading = false,
|
|
15
|
+
inputValue = "",
|
|
16
|
+
onInputChange,
|
|
17
|
+
onOpen,
|
|
18
|
+
onClose,
|
|
19
|
+
onChange,
|
|
20
|
+
disabled = false,
|
|
21
|
+
error,
|
|
22
|
+
invalid = false
|
|
23
|
+
}) {
|
|
24
|
+
const handleBlur = (e) => {
|
|
25
|
+
if (!e.currentTarget.contains(e.relatedTarget)) onClose?.();
|
|
26
|
+
};
|
|
27
|
+
const options = scripts.map((s) => ({ label: s.name, value: s.id }));
|
|
28
|
+
if (scriptId && !options.some((o) => o.value === scriptId)) {
|
|
29
|
+
options.unshift({ label: name, value: scriptId });
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-[var(--spacing-system-xxs)]", onFocus: onOpen, onBlur: handleBlur, children: [
|
|
32
|
+
/* @__PURE__ */ jsx(Label, { className: "text-h4", children: "Select Script" }),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Autocomplete,
|
|
35
|
+
{
|
|
36
|
+
options,
|
|
37
|
+
value: scriptId || null,
|
|
38
|
+
onChange,
|
|
39
|
+
placeholder: "Select a script...",
|
|
40
|
+
disableClientFilter: true,
|
|
41
|
+
onInputChange,
|
|
42
|
+
loading: isLoading,
|
|
43
|
+
loadingText: "Searching scripts...",
|
|
44
|
+
noOptionsText: inputValue ? "No scripts match your search" : "No scripts available",
|
|
45
|
+
disabled,
|
|
46
|
+
error,
|
|
47
|
+
invalid,
|
|
48
|
+
renderOption: (option, isSelected) => /* @__PURE__ */ jsxs("span", { className: "flex w-full min-w-0 items-center gap-[var(--spacing-system-xsf)]", children: [
|
|
49
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(TruncateText, { className: isSelected ? "text-ods-accent" : void 0, children: option.label }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(ScriptPlatformIcons, { platforms: scripts.find((s) => s.id === option.value)?.supportedPlatforms ?? [] })
|
|
51
|
+
] })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
ScheduleScriptSearchField
|
|
58
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type RenderScheduleScriptSearch } from './schedule-form-types';
|
|
2
|
+
export interface ScheduleScriptsFieldProps {
|
|
3
|
+
showErrors: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** The "Select Script" field of each card. */
|
|
6
|
+
renderScriptSearch: RenderScheduleScriptSearch;
|
|
7
|
+
/** The "Scheduled Scripts" heading over the cards. Default true. */
|
|
8
|
+
showHeading?: boolean;
|
|
9
|
+
/** Each card's arguments and environment variables. Default true; false is one row per card. */
|
|
10
|
+
showScriptParams?: boolean;
|
|
11
|
+
/** Offer "Add Script" (several scripts in one schedule). Default true. */
|
|
12
|
+
addScripts?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* "Scheduled Scripts" — the ordered list of script cards. Card order IS the run
|
|
16
|
+
* order: it is submitted as `scriptIds` verbatim, so a reorder is a real,
|
|
17
|
+
* persisted change.
|
|
18
|
+
*
|
|
19
|
+
* Reordering runs on the core library's `SortableList` (Pragmatic drag and
|
|
20
|
+
* drop): drag on desktop, an up/down button pair per card on touch/narrow
|
|
21
|
+
* viewports, where no DnD is initialized at all. The list owns the live-region
|
|
22
|
+
* announcements (`getItemLabel`) and the keyboard path on the handle.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ScheduleScriptsField({ showErrors, disabled, renderScriptSearch, showHeading, showScriptParams, addScripts, }: ScheduleScriptsFieldProps): import("react").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=schedule-scripts-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-scripts-field.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-scripts-field.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,0BAA0B,EAEhC,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,kBAAkB,EAAE,0BAA0B,CAAC;IAC/C,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gGAAgG;IAChG,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0EAA0E;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,QAAgB,EAChB,kBAAkB,EAClB,WAAkB,EAClB,gBAAuB,EACvB,UAAiB,GAClB,EAAE,yBAAyB,+BAoD3B"}
|