@yadsh/dsh-qa-integrations 0.8.1 → 0.8.3
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/lib/client/operator-card.js +72 -38
- package/lib/client/operator-card.js.map +1 -1
- package/lib/client/operator-controls.js +120 -47
- package/lib/client/operator-controls.js.map +1 -1
- package/lib/client/operator-drafts.js +62 -0
- package/lib/client/operator-drafts.js.map +1 -0
- package/lib/client.js +309 -139
- package/lib/client.js.map +1 -1
- package/lib/types/client/operator-controls.d.ts +20 -0
- package/lib/types/client/operator-drafts.d.ts +44 -0
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -10196,6 +10196,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10196
10196
|
};
|
|
10197
10197
|
}
|
|
10198
10198
|
//#endregion
|
|
10199
|
+
//#region src/client/operator-drafts.ts
|
|
10200
|
+
/** Id rule of the Host (`service-credentials/config.ts`, `providers/<id>/config.ts`). */
|
|
10201
|
+
const ROW_ID = /^[a-z0-9][a-z0-9-]*$/u;
|
|
10202
|
+
/** Absolute http(s) address, the only shape a provider resolver accepts. */
|
|
10203
|
+
const HTTP_URL = /^https?:\/\/[^\s/]+/u;
|
|
10204
|
+
/** What an instance row is still missing; empty when the Host would take it. */
|
|
10205
|
+
function instanceDraftMissing(row) {
|
|
10206
|
+
const missing = [];
|
|
10207
|
+
const id = row.id.trim();
|
|
10208
|
+
if (id === "") missing.push("id");
|
|
10209
|
+
else if (!ROW_ID.test(id)) missing.push("id строчными латинскими буквами, цифрами и дефисом");
|
|
10210
|
+
const baseUrl = row.baseUrl.trim();
|
|
10211
|
+
if (baseUrl === "") missing.push("адрес");
|
|
10212
|
+
else if (!HTTP_URL.test(baseUrl)) missing.push("абсолютный адрес http(s)://");
|
|
10213
|
+
return missing;
|
|
10214
|
+
}
|
|
10215
|
+
/** What a profile row is still missing; empty when the Host would take it. */
|
|
10216
|
+
function profileDraftMissing(row) {
|
|
10217
|
+
const missing = [];
|
|
10218
|
+
const id = row.id.trim();
|
|
10219
|
+
if (id === "") missing.push("id");
|
|
10220
|
+
else if (!ROW_ID.test(id)) missing.push("id строчными латинскими буквами, цифрами и дефисом");
|
|
10221
|
+
if (row.provider.trim() === "") missing.push("провайдер");
|
|
10222
|
+
if (row.instance.trim() === "") missing.push("инстанс");
|
|
10223
|
+
if (!row.resources.some(([key, value]) => key.trim() !== "" && value.trim() !== "")) missing.push("ограничение ресурсов");
|
|
10224
|
+
return missing;
|
|
10225
|
+
}
|
|
10226
|
+
/**
|
|
10227
|
+
* What the card says about a row it has not committed: the missing fields, or —
|
|
10228
|
+
* when nothing is missing and the Host still did not take the row — that the
|
|
10229
|
+
* write did not land, which is the one thing the operator must never be left
|
|
10230
|
+
* guessing about.
|
|
10231
|
+
*/
|
|
10232
|
+
function draftNote(missing) {
|
|
10233
|
+
if (missing.length === 0) return "не сохранено — Хост не принял запись";
|
|
10234
|
+
return `не сохранено — нужно: ${missing.join(", ")}`;
|
|
10235
|
+
}
|
|
10236
|
+
//#endregion
|
|
10199
10237
|
//#region src/client/operator-controls.tsx
|
|
10200
10238
|
/**
|
|
10201
10239
|
* Shared controls of the operator card body.
|
|
@@ -10362,13 +10400,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10362
10400
|
*/
|
|
10363
10401
|
function StringListField(props) {
|
|
10364
10402
|
const [draft, setDraft] = (0, react.useState)("");
|
|
10403
|
+
const [notice, setNotice] = (0, react.useState)(null);
|
|
10404
|
+
const addInput = (0, react.useRef)(null);
|
|
10365
10405
|
const commit = (next) => {
|
|
10366
10406
|
if (next.length === 0) props.unset(props.path);
|
|
10367
10407
|
else props.write(props.path, next);
|
|
10368
10408
|
};
|
|
10409
|
+
/**
|
|
10410
|
+
* A click always answers. The button used to be disabled while the input was
|
|
10411
|
+
* empty, which reads as a dead button: now it says what it is waiting for and
|
|
10412
|
+
* puts the caret where the missing value goes.
|
|
10413
|
+
*/
|
|
10369
10414
|
const add = () => {
|
|
10370
10415
|
const value = draft.trim();
|
|
10371
|
-
if (value === ""
|
|
10416
|
+
if (value === "") {
|
|
10417
|
+
setNotice("введите значение");
|
|
10418
|
+
addInput.current?.focus();
|
|
10419
|
+
return;
|
|
10420
|
+
}
|
|
10421
|
+
if (props.values.includes(value)) {
|
|
10422
|
+
setNotice("такое значение уже есть в списке");
|
|
10423
|
+
return;
|
|
10424
|
+
}
|
|
10425
|
+
setNotice(null);
|
|
10372
10426
|
commit([...props.values, value]);
|
|
10373
10427
|
setDraft("");
|
|
10374
10428
|
};
|
|
@@ -10396,28 +10450,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10396
10450
|
}, `${index}:${row}`))
|
|
10397
10451
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
10398
10452
|
className: "qai-op__row-add",
|
|
10399
|
-
children: [
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10453
|
+
children: [
|
|
10454
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10455
|
+
className: "qai-op__input",
|
|
10456
|
+
type: "text",
|
|
10457
|
+
ref: addInput,
|
|
10458
|
+
value: draft,
|
|
10459
|
+
placeholder: props.placeholder,
|
|
10460
|
+
disabled: props.disabled,
|
|
10461
|
+
onChange: (event) => {
|
|
10462
|
+
setDraft(event.currentTarget.value);
|
|
10463
|
+
},
|
|
10464
|
+
onKeyDown: (event) => {
|
|
10465
|
+
if (event.key === "Enter") {
|
|
10466
|
+
event.preventDefault();
|
|
10467
|
+
add();
|
|
10468
|
+
}
|
|
10412
10469
|
}
|
|
10413
|
-
}
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10470
|
+
}),
|
|
10471
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10472
|
+
type: "button",
|
|
10473
|
+
className: "qai-op__button",
|
|
10474
|
+
disabled: props.disabled,
|
|
10475
|
+
onClick: add,
|
|
10476
|
+
children: "добавить"
|
|
10477
|
+
}),
|
|
10478
|
+
notice === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10479
|
+
className: "qai-op__pending",
|
|
10480
|
+
children: notice
|
|
10481
|
+
})
|
|
10482
|
+
]
|
|
10421
10483
|
})]
|
|
10422
10484
|
});
|
|
10423
10485
|
}
|
|
@@ -10425,19 +10487,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10425
10487
|
* Deployment instances (GitLab, Confluence, Jira sites, Test IT, Weblate): a
|
|
10426
10488
|
* row edits id, label and address, and every committed edit writes the whole
|
|
10427
10489
|
* list, because a partially stored row would fail the resolvers anyway.
|
|
10490
|
+
*
|
|
10491
|
+
* The providers that host both a Cloud product and a self-hosted one pass
|
|
10492
|
+
* `deployments` as well, and the row then carries a fourth control: the row is
|
|
10493
|
+
* written with the key it selects, and a row nobody touched keeps the key out
|
|
10494
|
+
* of the payload the other providers' rows must keep clean.
|
|
10428
10495
|
*/
|
|
10429
10496
|
function InstanceListField(props) {
|
|
10497
|
+
const deployments = props.deployments;
|
|
10430
10498
|
const [drafts, setDrafts] = (0, react.useState)(() => props.instances.map((row) => ({ ...row })));
|
|
10499
|
+
const storedCount = (0, react.useRef)(props.instances.length);
|
|
10431
10500
|
(0, react.useEffect)(() => {
|
|
10432
|
-
setDrafts(
|
|
10501
|
+
setDrafts((current) => {
|
|
10502
|
+
const accepted = Math.max(0, props.instances.length - storedCount.current);
|
|
10503
|
+
const pending = current.slice(storedCount.current + accepted);
|
|
10504
|
+
storedCount.current = props.instances.length;
|
|
10505
|
+
return [...props.instances.map((row) => ({ ...row })), ...pending];
|
|
10506
|
+
});
|
|
10433
10507
|
}, [props.instances]);
|
|
10434
|
-
|
|
10508
|
+
/**
|
|
10509
|
+
* Writes the rows the Host can take — every stored row, plus the drafts that
|
|
10510
|
+
* are complete. An unfinished draft stays local: committing it is what used
|
|
10511
|
+
* to make the Host refuse the whole array, which is why «добавить» looked
|
|
10512
|
+
* like it did nothing.
|
|
10513
|
+
*/
|
|
10514
|
+
const commit = (next, unsetWhenEmpty = next.length === 0) => {
|
|
10435
10515
|
setDrafts(next);
|
|
10436
|
-
|
|
10437
|
-
|
|
10516
|
+
const takeable = next.filter((row, at) => at < storedCount.current || instanceDraftMissing(row).length === 0);
|
|
10517
|
+
if (takeable.length === 0) {
|
|
10518
|
+
if (unsetWhenEmpty) props.unset(props.path);
|
|
10519
|
+
return;
|
|
10520
|
+
}
|
|
10521
|
+
props.write(props.path, takeable.map((row) => ({ ...row })));
|
|
10438
10522
|
};
|
|
10439
10523
|
const edit = (index, patch) => {
|
|
10440
|
-
commit(
|
|
10524
|
+
commit(drafts.map((row, at) => at === index ? {
|
|
10441
10525
|
...row,
|
|
10442
10526
|
...patch
|
|
10443
10527
|
} : row));
|
|
@@ -10449,102 +10533,132 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10449
10533
|
hint: props.hint,
|
|
10450
10534
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
10451
10535
|
className: "qai-op__instances",
|
|
10452
|
-
children:
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
className: "qai-op__instance-
|
|
10459
|
-
children: "
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
className: "qai-op__instance-
|
|
10482
|
-
children: "
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
className: "qai-op__instance-
|
|
10505
|
-
children: "
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10536
|
+
children: drafts.map((row, index) => {
|
|
10537
|
+
const stored = index < storedCount.current ? props.instances[index] : void 0;
|
|
10538
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
10539
|
+
className: "qai-op__instance",
|
|
10540
|
+
children: [
|
|
10541
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
10542
|
+
className: "qai-op__instance-cell",
|
|
10543
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10544
|
+
className: "qai-op__instance-key",
|
|
10545
|
+
children: "id"
|
|
10546
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10547
|
+
className: "qai-op__input",
|
|
10548
|
+
type: "text",
|
|
10549
|
+
value: drafts[index]?.id ?? "",
|
|
10550
|
+
placeholder: "corp",
|
|
10551
|
+
disabled: props.disabled,
|
|
10552
|
+
onChange: (event) => {
|
|
10553
|
+
setDrafts(drafts.map((draft, at) => at === index ? {
|
|
10554
|
+
...draft,
|
|
10555
|
+
id: event.currentTarget.value
|
|
10556
|
+
} : draft));
|
|
10557
|
+
},
|
|
10558
|
+
onBlur: () => {
|
|
10559
|
+
const id = drafts[index]?.id.trim() ?? "";
|
|
10560
|
+
if (id !== "" && id !== (stored?.id ?? "")) edit(index, { id });
|
|
10561
|
+
}
|
|
10562
|
+
})]
|
|
10563
|
+
}),
|
|
10564
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
10565
|
+
className: "qai-op__instance-cell",
|
|
10566
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10567
|
+
className: "qai-op__instance-key",
|
|
10568
|
+
children: "название"
|
|
10569
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10570
|
+
className: "qai-op__input",
|
|
10571
|
+
type: "text",
|
|
10572
|
+
value: drafts[index]?.label ?? "",
|
|
10573
|
+
placeholder: "Корпоративный GitLab",
|
|
10574
|
+
disabled: props.disabled,
|
|
10575
|
+
onChange: (event) => {
|
|
10576
|
+
setDrafts(drafts.map((draft, at) => at === index ? {
|
|
10577
|
+
...draft,
|
|
10578
|
+
label: event.currentTarget.value
|
|
10579
|
+
} : draft));
|
|
10580
|
+
},
|
|
10581
|
+
onBlur: () => {
|
|
10582
|
+
const label = drafts[index]?.label.trim() ?? "";
|
|
10583
|
+
if (label !== "" && label !== (stored?.label ?? "")) edit(index, { label });
|
|
10584
|
+
}
|
|
10585
|
+
})]
|
|
10586
|
+
}),
|
|
10587
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
10588
|
+
className: "qai-op__instance-cell qai-op__instance-cell--wide",
|
|
10589
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10590
|
+
className: "qai-op__instance-key",
|
|
10591
|
+
children: "адрес"
|
|
10592
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10593
|
+
className: "qai-op__input",
|
|
10594
|
+
type: "text",
|
|
10595
|
+
value: drafts[index]?.baseUrl ?? "",
|
|
10596
|
+
placeholder: "https://gitlab.example.corp",
|
|
10597
|
+
disabled: props.disabled,
|
|
10598
|
+
onChange: (event) => {
|
|
10599
|
+
setDrafts(drafts.map((draft, at) => at === index ? {
|
|
10600
|
+
...draft,
|
|
10601
|
+
baseUrl: event.currentTarget.value
|
|
10602
|
+
} : draft));
|
|
10603
|
+
},
|
|
10604
|
+
onBlur: () => {
|
|
10605
|
+
const baseUrl = drafts[index]?.baseUrl.trim() ?? "";
|
|
10606
|
+
if (baseUrl !== "" && baseUrl !== (stored?.baseUrl ?? "")) edit(index, { baseUrl });
|
|
10607
|
+
}
|
|
10608
|
+
})]
|
|
10609
|
+
}),
|
|
10610
|
+
deployments === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
10611
|
+
className: "qai-op__instance-cell",
|
|
10612
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10613
|
+
className: "qai-op__instance-key",
|
|
10614
|
+
children: "развёртывание"
|
|
10615
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
10616
|
+
className: "qai-op__input",
|
|
10617
|
+
value: drafts[index]?.deploymentType ?? deployments[0]?.value ?? "",
|
|
10618
|
+
disabled: props.disabled,
|
|
10619
|
+
onChange: (event) => {
|
|
10620
|
+
edit(index, { deploymentType: event.currentTarget.value });
|
|
10621
|
+
},
|
|
10622
|
+
children: deployments.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
10623
|
+
value: option.value,
|
|
10624
|
+
children: option.label
|
|
10625
|
+
}, option.value))
|
|
10626
|
+
})]
|
|
10627
|
+
}),
|
|
10628
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10629
|
+
type: "button",
|
|
10630
|
+
className: "qai-op__row-remove",
|
|
10511
10631
|
disabled: props.disabled,
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
} : draft));
|
|
10632
|
+
onClick: () => {
|
|
10633
|
+
const removedStored = index < storedCount.current;
|
|
10634
|
+
if (removedStored) storedCount.current -= 1;
|
|
10635
|
+
commit(drafts.filter((_, at) => at !== index), removedStored);
|
|
10517
10636
|
},
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
onClick: () => {
|
|
10529
|
-
commit(props.instances.filter((_, at) => at !== index));
|
|
10530
|
-
},
|
|
10531
|
-
children: "убрать"
|
|
10532
|
-
})
|
|
10533
|
-
]
|
|
10534
|
-
}, `${index}:${row.id}`))
|
|
10535
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10637
|
+
children: "убрать"
|
|
10638
|
+
}),
|
|
10639
|
+
index >= storedCount.current ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10640
|
+
className: "qai-op__pending",
|
|
10641
|
+
children: draftNote(instanceDraftMissing(row))
|
|
10642
|
+
}) : null
|
|
10643
|
+
]
|
|
10644
|
+
}, `${index}:${row.id}`);
|
|
10645
|
+
})
|
|
10646
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10536
10647
|
type: "button",
|
|
10537
10648
|
className: "qai-op__button",
|
|
10538
10649
|
disabled: props.disabled,
|
|
10539
10650
|
onClick: () => {
|
|
10540
|
-
commit([...
|
|
10651
|
+
commit([...drafts, {
|
|
10541
10652
|
id: "",
|
|
10542
10653
|
label: "",
|
|
10543
10654
|
baseUrl: ""
|
|
10544
10655
|
}]);
|
|
10545
10656
|
},
|
|
10546
10657
|
children: "добавить"
|
|
10547
|
-
})
|
|
10658
|
+
}), drafts.length === 0 && props.disabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10659
|
+
className: "qai-op__pending",
|
|
10660
|
+
children: "не сохранено — Хост не принимает правки из этого браузера"
|
|
10661
|
+
}) : null] })]
|
|
10548
10662
|
});
|
|
10549
10663
|
}
|
|
10550
10664
|
/**
|
|
@@ -10556,6 +10670,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10556
10670
|
function RecordField(props) {
|
|
10557
10671
|
const [keyDraft, setKeyDraft] = (0, react.useState)("");
|
|
10558
10672
|
const [valueDraft, setValueDraft] = (0, react.useState)("");
|
|
10673
|
+
const [notice, setNotice] = (0, react.useState)(null);
|
|
10674
|
+
const keyInput = (0, react.useRef)(null);
|
|
10675
|
+
const valueInput = (0, react.useRef)(null);
|
|
10559
10676
|
const commit = (next) => {
|
|
10560
10677
|
if (next.length === 0) {
|
|
10561
10678
|
props.unset(props.path);
|
|
@@ -10565,11 +10682,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10565
10682
|
for (const [key, value] of next) record[key] = props.fixedValue ?? value;
|
|
10566
10683
|
props.write(props.path, record);
|
|
10567
10684
|
};
|
|
10685
|
+
/** A click always answers: the button is never the silent kind. */
|
|
10568
10686
|
const add = () => {
|
|
10569
10687
|
const key = keyDraft.trim();
|
|
10570
|
-
if (key === ""
|
|
10688
|
+
if (key === "") {
|
|
10689
|
+
setNotice("введите ключ");
|
|
10690
|
+
keyInput.current?.focus();
|
|
10691
|
+
return;
|
|
10692
|
+
}
|
|
10693
|
+
if (props.entries.some(([rowKey]) => rowKey === key)) {
|
|
10694
|
+
setNotice("такой ключ уже есть в списке");
|
|
10695
|
+
return;
|
|
10696
|
+
}
|
|
10571
10697
|
const value = props.fixedValue ?? valueDraft.trim();
|
|
10572
|
-
if (value === "")
|
|
10698
|
+
if (value === "") {
|
|
10699
|
+
setNotice("введите значение");
|
|
10700
|
+
valueInput.current?.focus();
|
|
10701
|
+
return;
|
|
10702
|
+
}
|
|
10703
|
+
setNotice(null);
|
|
10573
10704
|
commit([...props.entries, [key, value]]);
|
|
10574
10705
|
setKeyDraft("");
|
|
10575
10706
|
setValueDraft("");
|
|
@@ -10625,6 +10756,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10625
10756
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10626
10757
|
className: "qai-op__input",
|
|
10627
10758
|
type: "text",
|
|
10759
|
+
ref: keyInput,
|
|
10628
10760
|
value: keyDraft,
|
|
10629
10761
|
placeholder: props.keyPlaceholder,
|
|
10630
10762
|
disabled: props.disabled,
|
|
@@ -10641,6 +10773,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10641
10773
|
props.fixedValue === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10642
10774
|
className: "qai-op__input",
|
|
10643
10775
|
type: "text",
|
|
10776
|
+
ref: valueInput,
|
|
10644
10777
|
value: valueDraft,
|
|
10645
10778
|
placeholder: props.valuePlaceholder,
|
|
10646
10779
|
disabled: props.disabled,
|
|
@@ -10657,9 +10790,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10657
10790
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
10658
10791
|
type: "button",
|
|
10659
10792
|
className: "qai-op__button",
|
|
10660
|
-
disabled: props.disabled
|
|
10793
|
+
disabled: props.disabled,
|
|
10661
10794
|
onClick: add,
|
|
10662
10795
|
children: "добавить"
|
|
10796
|
+
}),
|
|
10797
|
+
notice === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10798
|
+
className: "qai-op__pending",
|
|
10799
|
+
children: notice
|
|
10663
10800
|
})
|
|
10664
10801
|
]
|
|
10665
10802
|
})]
|
|
@@ -10820,13 +10957,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10820
10957
|
}
|
|
10821
10958
|
return parts.join(" · ");
|
|
10822
10959
|
}
|
|
10960
|
+
/**
|
|
10961
|
+
* The one spelling the row control offers for a self-hosted product: the Host
|
|
10962
|
+
* resolver folds `data-center` and `datacenter` into the same value, so a stored
|
|
10963
|
+
* row reads as the value the control can show and writes back canonically.
|
|
10964
|
+
*/
|
|
10965
|
+
function deploymentTypeOf(value) {
|
|
10966
|
+
const folded = value.trim().toLowerCase();
|
|
10967
|
+
return folded === "server" || folded === "data-center" || folded === "datacenter" ? "server" : "cloud";
|
|
10968
|
+
}
|
|
10823
10969
|
function instanceRows(value) {
|
|
10824
10970
|
return rawArray(value).map(rawObject).map((row) => ({
|
|
10825
10971
|
id: rawString(row.id),
|
|
10826
10972
|
label: rawString(row.label),
|
|
10827
|
-
baseUrl: rawString(row.baseUrl)
|
|
10973
|
+
baseUrl: rawString(row.baseUrl),
|
|
10974
|
+
...typeof row.deploymentType === "string" && row.deploymentType.trim() !== "" ? { deploymentType: deploymentTypeOf(row.deploymentType) } : {}
|
|
10828
10975
|
}));
|
|
10829
10976
|
}
|
|
10977
|
+
/**
|
|
10978
|
+
* The products a Jira site or a Confluence instance can answer as, with the
|
|
10979
|
+
* Host resolver's default (`cloud`) first: an absent value is read as it.
|
|
10980
|
+
*/
|
|
10981
|
+
const DEPLOYMENT_OPTIONS = [{
|
|
10982
|
+
value: "cloud",
|
|
10983
|
+
label: "Cloud"
|
|
10984
|
+
}, {
|
|
10985
|
+
value: "server",
|
|
10986
|
+
label: "Server / Data Center"
|
|
10987
|
+
}];
|
|
10830
10988
|
function profileDrafts(value) {
|
|
10831
10989
|
return rawArray(value).map(rawObject).map((row) => {
|
|
10832
10990
|
const credential = rawObject(row.credential);
|
|
@@ -10877,34 +11035,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10877
11035
|
*/
|
|
10878
11036
|
function ServiceProfilesField(props) {
|
|
10879
11037
|
const [drafts, setDrafts] = (0, react.useState)(props.profiles);
|
|
11038
|
+
const storedCount = (0, react.useRef)(props.profiles.length);
|
|
10880
11039
|
(0, react.useEffect)(() => {
|
|
10881
|
-
setDrafts(
|
|
11040
|
+
setDrafts((current) => {
|
|
11041
|
+
const accepted = Math.max(0, props.profiles.length - storedCount.current);
|
|
11042
|
+
const pending = current.slice(storedCount.current + accepted);
|
|
11043
|
+
storedCount.current = props.profiles.length;
|
|
11044
|
+
return [...props.profiles, ...pending];
|
|
11045
|
+
});
|
|
10882
11046
|
}, [props.profiles]);
|
|
10883
|
-
const commit = (next) => {
|
|
11047
|
+
const commit = (next, unsetWhenEmpty = next.length === 0) => {
|
|
10884
11048
|
setDrafts(next);
|
|
10885
|
-
|
|
10886
|
-
|
|
11049
|
+
const persisted = next.slice(0, storedCount.current);
|
|
11050
|
+
if (persisted.some((row) => profileDraftMissing(row).length > 0)) return;
|
|
11051
|
+
const takeable = [...persisted, ...next.slice(storedCount.current).filter((row) => profileDraftMissing(row).length === 0)];
|
|
11052
|
+
if (takeable.length === 0) {
|
|
11053
|
+
if (unsetWhenEmpty) props.unset(["managedServiceCredentials", "profiles"]);
|
|
10887
11054
|
return;
|
|
10888
11055
|
}
|
|
10889
|
-
props.write(["managedServiceCredentials", "profiles"],
|
|
11056
|
+
props.write(["managedServiceCredentials", "profiles"], takeable.map(profileWire));
|
|
10890
11057
|
};
|
|
10891
11058
|
const edit = (index, patch) => {
|
|
10892
|
-
commit(
|
|
11059
|
+
commit(drafts.map((row, at) => at === index ? {
|
|
10893
11060
|
...row,
|
|
10894
11061
|
...patch
|
|
10895
11062
|
} : row));
|
|
10896
11063
|
};
|
|
10897
11064
|
const commitRecord = (index, key, rows) => {
|
|
10898
11065
|
if (rows.length === 0) {
|
|
10899
|
-
commit(
|
|
11066
|
+
commit(drafts.map((row, at) => at === index ? {
|
|
10900
11067
|
...row,
|
|
10901
11068
|
[key]: []
|
|
10902
11069
|
} : row));
|
|
10903
11070
|
return;
|
|
10904
11071
|
}
|
|
10905
|
-
commit(
|
|
11072
|
+
commit(drafts.map((row, at) => at === index ? {
|
|
10906
11073
|
...row,
|
|
10907
|
-
[key]:
|
|
11074
|
+
[key]: rows
|
|
10908
11075
|
} : row));
|
|
10909
11076
|
};
|
|
10910
11077
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -10919,7 +11086,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10919
11086
|
}),
|
|
10920
11087
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
10921
11088
|
className: "qai-op__profiles",
|
|
10922
|
-
children:
|
|
11089
|
+
children: drafts.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
10923
11090
|
className: "qai-op__profile",
|
|
10924
11091
|
children: [
|
|
10925
11092
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -10943,7 +11110,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10943
11110
|
className: "qai-op__row-remove",
|
|
10944
11111
|
disabled: props.disabled,
|
|
10945
11112
|
onClick: () => {
|
|
10946
|
-
|
|
11113
|
+
const removedStored = index < storedCount.current;
|
|
11114
|
+
if (removedStored) storedCount.current -= 1;
|
|
11115
|
+
commit(drafts.filter((_, at) => at !== index), removedStored);
|
|
10947
11116
|
},
|
|
10948
11117
|
children: "убрать"
|
|
10949
11118
|
})
|
|
@@ -10970,9 +11139,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10970
11139
|
} : draft));
|
|
10971
11140
|
},
|
|
10972
11141
|
onBlur: () => {
|
|
10973
|
-
const id = row.id.trim();
|
|
10974
11142
|
const next = drafts[index]?.id.trim() ?? "";
|
|
10975
|
-
|
|
11143
|
+
edit(index, { id: next });
|
|
10976
11144
|
}
|
|
10977
11145
|
})]
|
|
10978
11146
|
}),
|
|
@@ -11012,9 +11180,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11012
11180
|
} : draft));
|
|
11013
11181
|
},
|
|
11014
11182
|
onBlur: () => {
|
|
11015
|
-
const instance = row.instance.trim();
|
|
11016
11183
|
const next = drafts[index]?.instance.trim() ?? "";
|
|
11017
|
-
|
|
11184
|
+
edit(index, { instance: next });
|
|
11018
11185
|
}
|
|
11019
11186
|
})]
|
|
11020
11187
|
}),
|
|
@@ -11036,9 +11203,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11036
11203
|
} : draft));
|
|
11037
11204
|
},
|
|
11038
11205
|
onBlur: () => {
|
|
11039
|
-
const label = row.label.trim();
|
|
11040
11206
|
const next = drafts[index]?.label.trim() ?? "";
|
|
11041
|
-
|
|
11207
|
+
edit(index, { label: next });
|
|
11042
11208
|
}
|
|
11043
11209
|
})]
|
|
11044
11210
|
}),
|
|
@@ -11060,9 +11226,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11060
11226
|
} : draft));
|
|
11061
11227
|
},
|
|
11062
11228
|
onBlur: () => {
|
|
11063
|
-
const secretFile = row.secretFile.trim();
|
|
11064
11229
|
const next = drafts[index]?.secretFile.trim() ?? "";
|
|
11065
|
-
|
|
11230
|
+
edit(index, { secretFile: next });
|
|
11066
11231
|
}
|
|
11067
11232
|
})]
|
|
11068
11233
|
}),
|
|
@@ -11084,9 +11249,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11084
11249
|
} : draft));
|
|
11085
11250
|
},
|
|
11086
11251
|
onBlur: () => {
|
|
11087
|
-
const secretEnv = row.secretEnv.trim();
|
|
11088
11252
|
const next = drafts[index]?.secretEnv.trim() ?? "";
|
|
11089
|
-
|
|
11253
|
+
edit(index, { secretEnv: next });
|
|
11090
11254
|
}
|
|
11091
11255
|
})]
|
|
11092
11256
|
})
|
|
@@ -11123,7 +11287,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11123
11287
|
commitRecord(index, "policy", []);
|
|
11124
11288
|
},
|
|
11125
11289
|
overridden: props.overridden
|
|
11126
|
-
})
|
|
11290
|
+
}),
|
|
11291
|
+
index >= storedCount.current || profileDraftMissing(row).length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11292
|
+
className: "qai-op__pending",
|
|
11293
|
+
children: draftNote(profileDraftMissing(row))
|
|
11294
|
+
}) : null
|
|
11127
11295
|
]
|
|
11128
11296
|
}, `${index}:${row.id}`))
|
|
11129
11297
|
}),
|
|
@@ -11132,7 +11300,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11132
11300
|
className: "qai-op__button",
|
|
11133
11301
|
disabled: props.disabled,
|
|
11134
11302
|
onClick: () => {
|
|
11135
|
-
commit([...
|
|
11303
|
+
commit([...drafts, {
|
|
11136
11304
|
id: "",
|
|
11137
11305
|
provider: "gitlab",
|
|
11138
11306
|
instance: "",
|
|
@@ -11312,7 +11480,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11312
11480
|
disabled: !writable,
|
|
11313
11481
|
write,
|
|
11314
11482
|
overridden: overridden(path)
|
|
11315
|
-
});
|
|
11483
|
+
}, path.join("."));
|
|
11316
11484
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardShell, {
|
|
11317
11485
|
title: "Интеграции — конфигурация",
|
|
11318
11486
|
description: "Операторские настройки подключений: провайдеры, адреса, возможности и сервисные доступы. Правка применяется к запущенному сервису сразу.",
|
|
@@ -11492,6 +11660,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11492
11660
|
hint: "пользователь выбирает сайт из списка и вводит e-mail с токеном",
|
|
11493
11661
|
path: ["confluence", "instances"],
|
|
11494
11662
|
instances: instanceRows(rawObject(config.confluence).instances),
|
|
11663
|
+
deployments: DEPLOYMENT_OPTIONS,
|
|
11495
11664
|
...control
|
|
11496
11665
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StringListField, {
|
|
11497
11666
|
label: "Разрешённые пространства",
|
|
@@ -11814,6 +11983,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11814
11983
|
hint: "пользователь выбирает сайт из списка, произвольный хост ввести нельзя",
|
|
11815
11984
|
path: ["jira", "sites"],
|
|
11816
11985
|
instances: instanceRows(rawObject(config.jira).sites),
|
|
11986
|
+
deployments: DEPLOYMENT_OPTIONS,
|
|
11817
11987
|
...control
|
|
11818
11988
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RecordField, {
|
|
11819
11989
|
label: "Псевдонимы полей",
|