lhcb-ntuple-wizard-test 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/App.d.ts +12 -0
  2. package/dist/App.js +22 -0
  3. package/dist/components/ConfigFilesUploadingAlert.d.ts +1 -0
  4. package/dist/components/ConfigFilesUploadingAlert.js +5 -0
  5. package/dist/components/DatasetEventTypeBadge.d.ts +5 -0
  6. package/dist/components/DatasetEventTypeBadge.js +23 -0
  7. package/dist/components/DatasetInfo.d.ts +5 -0
  8. package/dist/components/DatasetInfo.js +21 -0
  9. package/dist/components/DecayLatex.d.ts +7 -0
  10. package/dist/components/DecayLatex.js +103 -0
  11. package/dist/components/DecayList.d.ts +8 -0
  12. package/dist/components/DecayList.js +37 -0
  13. package/dist/components/DecayListItem.d.ts +11 -0
  14. package/dist/components/DecayListItem.js +23 -0
  15. package/dist/components/DecayTagBadge.d.ts +5 -0
  16. package/dist/components/DecayTagBadge.js +21 -0
  17. package/dist/components/DecayTreeCard.d.ts +7 -0
  18. package/dist/components/DecayTreeCard.js +43 -0
  19. package/dist/components/DecayTreeCardHeader.d.ts +7 -0
  20. package/dist/components/DecayTreeCardHeader.js +5 -0
  21. package/dist/components/DecayTreeGraph.d.ts +9 -0
  22. package/dist/components/DecayTreeGraph.js +89 -0
  23. package/dist/components/DeleteButton.d.ts +9 -0
  24. package/dist/components/DeleteButton.js +19 -0
  25. package/dist/components/DttNameInput.d.ts +9 -0
  26. package/dist/components/DttNameInput.js +73 -0
  27. package/dist/components/LineTableRow.d.ts +9 -0
  28. package/dist/components/LineTableRow.js +123 -0
  29. package/dist/components/LoadingIndicator.d.ts +6 -0
  30. package/dist/components/LoadingIndicator.js +5 -0
  31. package/dist/components/NtupleWizard.d.ts +26 -0
  32. package/dist/components/NtupleWizard.js +33 -0
  33. package/dist/components/NumStrippingLinesBadge.d.ts +8 -0
  34. package/dist/components/NumStrippingLinesBadge.js +10 -0
  35. package/dist/components/ParticleDropdown.d.ts +8 -0
  36. package/dist/components/ParticleDropdown.js +33 -0
  37. package/dist/components/ParticleTagBadge.d.ts +9 -0
  38. package/dist/components/ParticleTagBadge.js +22 -0
  39. package/dist/components/ParticleTagFilters.d.ts +6 -0
  40. package/dist/components/ParticleTagFilters.js +51 -0
  41. package/dist/components/PolarityBadge.d.ts +5 -0
  42. package/dist/components/PolarityBadge.js +15 -0
  43. package/dist/components/StrippingLineBadge.d.ts +7 -0
  44. package/dist/components/StrippingLineBadge.js +29 -0
  45. package/dist/components/StrippingLineInfo.d.ts +8 -0
  46. package/dist/components/StrippingLineInfo.js +17 -0
  47. package/dist/components/SubmitRequestButton.d.ts +11 -0
  48. package/dist/components/SubmitRequestButton.js +39 -0
  49. package/dist/components/TagDropdown.d.ts +12 -0
  50. package/dist/components/TagDropdown.js +31 -0
  51. package/dist/components/TupleToolDocsAccordion.d.ts +5 -0
  52. package/dist/components/TupleToolDocsAccordion.js +14 -0
  53. package/dist/components/TupleToolDropdown.d.ts +21 -0
  54. package/dist/components/TupleToolDropdown.js +29 -0
  55. package/dist/components/TupleToolGroup.d.ts +6 -0
  56. package/dist/components/TupleToolGroup.js +22 -0
  57. package/dist/components/TupleToolLabel.d.ts +6 -0
  58. package/dist/components/TupleToolLabel.js +20 -0
  59. package/dist/components/TupleToolList.d.ts +7 -0
  60. package/dist/components/TupleToolList.js +38 -0
  61. package/dist/components/YearBadge.d.ts +5 -0
  62. package/dist/components/YearBadge.js +15 -0
  63. package/dist/components/modals/AddTupleToolModal.d.ts +7 -0
  64. package/dist/components/modals/AddTupleToolModal.js +32 -0
  65. package/dist/components/modals/ConfigureTupleToolModal.d.ts +8 -0
  66. package/dist/components/modals/ConfigureTupleToolModal.js +43 -0
  67. package/dist/components/modals/ReasonForRequestModal.d.ts +8 -0
  68. package/dist/components/modals/ReasonForRequestModal.js +49 -0
  69. package/dist/components/modals/UploadDttConfigModal.d.ts +7 -0
  70. package/dist/components/modals/UploadDttConfigModal.js +35 -0
  71. package/dist/components/modals/UploadProdConfigModal.d.ts +5 -0
  72. package/dist/components/modals/UploadProdConfigModal.js +27 -0
  73. package/dist/components/tupleToolParams/BoolParamInput.d.ts +16 -0
  74. package/dist/components/tupleToolParams/BoolParamInput.js +15 -0
  75. package/dist/components/tupleToolParams/DictParamInput.d.ts +14 -0
  76. package/dist/components/tupleToolParams/DictParamInput.js +31 -0
  77. package/dist/components/tupleToolParams/ListParamInput.d.ts +14 -0
  78. package/dist/components/tupleToolParams/ListParamInput.js +46 -0
  79. package/dist/components/tupleToolParams/NumParamInput.d.ts +18 -0
  80. package/dist/components/tupleToolParams/NumParamInput.js +25 -0
  81. package/dist/components/tupleToolParams/StrParamInput.d.ts +19 -0
  82. package/dist/components/tupleToolParams/StrParamInput.js +22 -0
  83. package/dist/config.d.ts +78 -0
  84. package/dist/config.js +72 -0
  85. package/dist/index.d.ts +11 -0
  86. package/dist/index.js +11 -0
  87. package/dist/models/bkPath.d.ts +11 -0
  88. package/dist/models/bkPath.js +40 -0
  89. package/dist/models/blobFile.d.ts +12 -0
  90. package/dist/models/blobFile.js +1 -0
  91. package/dist/models/decayData.d.ts +15 -0
  92. package/dist/models/decayData.js +1 -0
  93. package/dist/models/dropdownOption.d.ts +5 -0
  94. package/dist/models/dropdownOption.js +1 -0
  95. package/dist/models/dtt.d.ts +108 -0
  96. package/dist/models/dtt.js +149 -0
  97. package/dist/models/jobConfig.d.ts +7 -0
  98. package/dist/models/jobConfig.js +1 -0
  99. package/dist/models/particle.d.ts +12 -0
  100. package/dist/models/particle.js +1 -0
  101. package/dist/models/particleTag.d.ts +4 -0
  102. package/dist/models/particleTag.js +1 -0
  103. package/dist/models/rowData.d.ts +15 -0
  104. package/dist/models/rowData.js +1 -0
  105. package/dist/models/strippingLine.d.ts +5 -0
  106. package/dist/models/strippingLine.js +1 -0
  107. package/dist/models/strippingLineOption.d.ts +6 -0
  108. package/dist/models/strippingLineOption.js +1 -0
  109. package/dist/models/tupleTool.d.ts +8 -0
  110. package/dist/models/tupleTool.js +18 -0
  111. package/dist/models/tupleTreeGraphData.d.ts +20 -0
  112. package/dist/models/tupleTreeGraphData.js +1 -0
  113. package/dist/models/yamlFile.d.ts +11 -0
  114. package/dist/models/yamlFile.js +78 -0
  115. package/dist/pages/DecaySearchPage.d.ts +5 -0
  116. package/dist/pages/DecaySearchPage.js +197 -0
  117. package/dist/pages/DecayTreeConfigPage.d.ts +5 -0
  118. package/dist/pages/DecayTreeConfigPage.js +63 -0
  119. package/dist/pages/LinesTablePage.d.ts +14 -0
  120. package/dist/pages/LinesTablePage.js +120 -0
  121. package/dist/providers/DttProvider.d.ts +24 -0
  122. package/dist/providers/DttProvider.js +77 -0
  123. package/dist/providers/MetadataProvider.d.ts +87 -0
  124. package/dist/providers/MetadataProvider.js +50 -0
  125. package/dist/providers/ProductionConfigProvider.d.ts +14 -0
  126. package/dist/providers/ProductionConfigProvider.js +76 -0
  127. package/dist/providers/RequestProvider.d.ts +15 -0
  128. package/dist/providers/RequestProvider.js +35 -0
  129. package/dist/providers/RowsProvider.d.ts +14 -0
  130. package/dist/providers/RowsProvider.js +31 -0
  131. package/dist/utils/mathjaxUtils.d.ts +12 -0
  132. package/dist/utils/mathjaxUtils.js +24 -0
  133. package/dist/utils/utils.d.ts +31 -0
  134. package/dist/utils/utils.js +80 -0
  135. package/package.json +3 -2
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import Select from "react-select";
13
+ import { TupleToolLabel } from "./TupleToolLabel";
14
+ import { useMetadata } from "../providers/MetadataProvider.js";
15
+ import { TupleTool } from "../models/tupleTool";
16
+ export function TupleToolDropdown({ filterToolTags, ...props }) {
17
+ const metadata = useMetadata();
18
+ const options = metadata
19
+ ? filterToolTags.map((allowedTag) => ({
20
+ label: allowedTag,
21
+ options: Object.keys(metadata.tupleTools.tupleTools)
22
+ .sort()
23
+ .map(TupleTool.fromString)
24
+ .map((tool) => ({ value: tool.toString(), label: _jsx(TupleToolLabel, { tool: tool }) }))
25
+ .filter((tool) => metadata.tupleTools.tupleTools[tool.value].tags.includes(allowedTag)),
26
+ }))
27
+ : [];
28
+ return (_jsx("div", { className: "react-select form-control p-0", children: _jsx(Select, { options: options, isLoading: !metadata, ...props }) }));
29
+ }
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ branch: string[];
3
+ onGroupSelected: (group: string) => void;
4
+ }
5
+ export declare function TupleToolGroup({ branch, onGroupSelected }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,22 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button, Card, ListGroup, OverlayTrigger, Popover } from "react-bootstrap";
3
+ import { PencilSquare } from "react-bootstrap-icons";
4
+ import { DecayLatex } from "./DecayLatex";
5
+ import { useDtt } from "../providers/DttProvider";
6
+ export function TupleToolGroup({ branch, onGroupSelected }) {
7
+ const { dtt, decay } = useDtt();
8
+ let groups = {};
9
+ if (branch.length === 0) {
10
+ groups = dtt.config.groups;
11
+ }
12
+ else if (branch.length === 1) {
13
+ const filteredGroups = Object.entries(dtt.config.groups).filter(([key]) => key.includes(branch[0]));
14
+ groups = Object.fromEntries(filteredGroups);
15
+ }
16
+ const groupKeys = Object.keys(groups);
17
+ function ToolCount({ group }) {
18
+ const tools = dtt.listTools(group);
19
+ return (_jsx(OverlayTrigger, { overlay: _jsx(Popover, { children: _jsx(ListGroup, { children: tools.map((tool) => (_jsx(ListGroup.Item, { children: tool.toString() }, tool.toString()))) }) }), children: _jsxs("div", { children: [tools.length, " TupleTool", tools.length === 1 ? "" : "s"] }) }));
20
+ }
21
+ return (_jsxs(Card, { className: "mt-2", children: [_jsxs(Card.Header, { children: [groupKeys.length, " group", groupKeys.length === 1 ? "" : "s"] }), _jsx(ListGroup, { variant: "flush", children: groupKeys.map((selection) => (_jsxs(ListGroup.Item, { className: "d-flex justify-content-between align-items-start", children: [_jsx(DecayLatex, { decay: decay, selection: selection.split(",") }), _jsx(ToolCount, { group: selection.split(",") }), _jsx(Button, { variant: "outline-secondary", size: "sm", onClick: () => onGroupSelected(selection), children: _jsx(PencilSquare, {}) })] }, selection))) })] }));
22
+ }
@@ -0,0 +1,6 @@
1
+ import { TupleTool } from "../models/tupleTool";
2
+ interface Props {
3
+ tool: TupleTool;
4
+ }
5
+ export declare function TupleToolLabel({ tool }: Props): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { OverlayTrigger, Tooltip } from "react-bootstrap";
13
+ import { useMetadata } from "../providers/MetadataProvider.js";
14
+ export function TupleToolLabel({ tool }) {
15
+ const metadata = useMetadata();
16
+ if (!metadata) {
17
+ return null;
18
+ }
19
+ return (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: metadata.tupleTools.tupleTools[tool.class].description }), children: _jsx("span", { children: tool.toString() }) }));
20
+ }
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ branch: string[];
3
+ onGroupSelected: (group: string) => void;
4
+ onSave: () => void;
5
+ }
6
+ export declare function TupleToolList({ branch, onGroupSelected, onSave }: Props): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,38 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { TupleToolLabel } from "./TupleToolLabel";
13
+ import { DeleteButton } from "./DeleteButton.js";
14
+ import { Button, ButtonGroup, Card, ListGroup, OverlayTrigger, Tooltip } from "react-bootstrap";
15
+ import { PencilSquare, PlusLg } from "react-bootstrap-icons";
16
+ import { useMetadata } from "../providers/MetadataProvider.js";
17
+ import { useState } from "react";
18
+ import { TupleToolGroup } from "./TupleToolGroup";
19
+ import { AddTupleToolModal } from "./modals/AddTupleToolModal";
20
+ import { ConfigureTupleToolModal } from "./modals/ConfigureTupleToolModal";
21
+ import { useDtt } from "../providers/DttProvider";
22
+ export function TupleToolList({ branch, onGroupSelected, onSave }) {
23
+ const metadata = useMetadata();
24
+ const { dtt, dirty, save, revert, removeTool } = useDtt();
25
+ const [showAddModal, setShowAddModal] = useState(false);
26
+ const [showConfigModalWithTool, setShowConfigModalWithTool] = useState(null);
27
+ if (!metadata) {
28
+ return null;
29
+ }
30
+ const tools = dtt.listTools(branch);
31
+ const filterToolTags = branch.length === 0 ? ["IParticleTupleTool", "IEventTupleTool"] : ["IParticleTupleTool"];
32
+ return (_jsxs(_Fragment, { children: [_jsxs(Card, { children: [_jsxs(Card.Header, { className: "d-flex justify-content-between align-items-start", children: [_jsxs("span", { children: [tools.length, " TupleTool", tools.length === 1 ? "" : "s"] }), _jsx(Button, { variant: "success", size: "sm", onClick: () => setShowAddModal(true), children: _jsx(PlusLg, {}) })] }), _jsx(ListGroup, { variant: "flush", children: tools.map((tool) => {
33
+ return (_jsxs(ListGroup.Item, { className: "d-flex justify-content-between align-items-start", variant: showConfigModalWithTool?.equals(tool) ? "secondary" : "", children: [_jsx(TupleToolLabel, { tool: tool }), _jsxs(ButtonGroup, { size: "sm", children: [_jsx(Button, { variant: "outline-secondary", onClick: () => setShowConfigModalWithTool(tool), children: _jsx(PencilSquare, {}) }), _jsx(DeleteButton, { outline: true, action: () => removeTool(branch, tool) })] })] }, tool.toString()));
34
+ }) })] }), showAddModal && (_jsx(AddTupleToolModal, { branch: branch, filterToolTags: filterToolTags, onClose: () => setShowAddModal(false) })), showConfigModalWithTool && (_jsx(ConfigureTupleToolModal, { branch: branch, tool: showConfigModalWithTool, onClose: () => setShowConfigModalWithTool(null) })), branch.length === 0 && Object.keys(dtt.config.groups).length > 0 && (_jsx(TupleToolGroup, { branch: branch, onGroupSelected: onGroupSelected })), _jsxs(ButtonGroup, { className: "mt-2", children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Save changes to this DecayTreeTuple" }), children: _jsx(Button, { onClick: () => {
35
+ save();
36
+ onSave();
37
+ }, disabled: !dirty, children: "Save" }) }), _jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Discard changes to this DecayTreeTuple" }), children: _jsx(Button, { variant: "outline-danger", onClick: revert, disabled: !dirty, children: "Revert" }) })] })] }));
38
+ }
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ year: string;
3
+ }
4
+ export declare function YearBadge({ year }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { Badge } from "react-bootstrap";
13
+ export function YearBadge({ year }) {
14
+ return (_jsx(Badge, { pill: true, bg: "success", children: year }));
15
+ }
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ branch: string[];
3
+ filterToolTags: string[];
4
+ onClose: () => void;
5
+ }
6
+ export declare function AddTupleToolModal({ branch, filterToolTags, onClose }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, FormControl, InputGroup, Modal } from "react-bootstrap";
3
+ import { TupleToolDropdown } from "../TupleToolDropdown";
4
+ import { TupleToolDocsAccordion } from "../TupleToolDocsAccordion";
5
+ import { useDtt } from "../../providers/DttProvider";
6
+ import { TupleTool } from "../../models/tupleTool";
7
+ import { useEffect, useRef, useState } from "react";
8
+ export function AddTupleToolModal({ branch, filterToolTags, onClose }) {
9
+ const { dtt, addTool } = useDtt();
10
+ const nameInputRef = useRef(null);
11
+ const [selectedTool, setSelectedTool] = useState(null);
12
+ useEffect(() => {
13
+ nameInputRef.current?.focus();
14
+ }, [selectedTool]);
15
+ return (_jsxs(Modal, { show: true, onHide: onClose, children: [_jsx(Modal.Header, { closeButton: true, children: "Add TupleTool" }), _jsxs(Modal.Body, { className: "gap-3 d-flex flex-column", children: [_jsxs(InputGroup, { hasValidation: true, children: [_jsx(TupleToolDropdown, { filterToolTags: filterToolTags, placeholder: "TupleTool class", onChange: (option) => {
16
+ if (option) {
17
+ setSelectedTool((prev) => new TupleTool(option.value, prev?.name || ""));
18
+ }
19
+ }, value: selectedTool ? { value: selectedTool.class, label: selectedTool.class } : null }), _jsx(FormControl, { ref: nameInputRef, placeholder: "TupleTool name", onChange: (event) => {
20
+ // Remove all non-word characters
21
+ const name = event.target.value.replaceAll(/[^\w]/g, "");
22
+ setSelectedTool((prev) => new TupleTool(prev.class, name));
23
+ }, value: selectedTool?.name || "", disabled: !selectedTool, isInvalid: !!selectedTool && dtt.toolExists(selectedTool, branch), onKeyDown: (event) => {
24
+ if (event.key === "Enter") {
25
+ addTool(branch, selectedTool);
26
+ onClose();
27
+ }
28
+ } }), selectedTool && (_jsxs(FormControl.Feedback, { type: "invalid", children: ["A ", selectedTool.class, " with the name \"", selectedTool.name, "\" already exists"] }))] }), selectedTool && _jsx(TupleToolDocsAccordion, { toolClass: selectedTool.class }), _jsx(Button, { className: "align-self-end", variant: "success", disabled: !selectedTool || dtt.toolExists(selectedTool, branch), onClick: () => {
29
+ addTool(branch, selectedTool);
30
+ onClose();
31
+ }, children: "Add tool" })] })] }));
32
+ }
@@ -0,0 +1,8 @@
1
+ import { TupleTool } from "../../models/tupleTool";
2
+ interface Props {
3
+ branch: string[];
4
+ tool: TupleTool;
5
+ onClose: () => void;
6
+ }
7
+ export declare function ConfigureTupleToolModal({ branch, tool, onClose }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,43 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button, Col, Form, Modal, OverlayTrigger, Row, Tooltip } from "react-bootstrap";
3
+ import { StrParamInput } from "../tupleToolParams/StrParamInput";
4
+ import { BoolParamInput } from "../tupleToolParams/BoolParamInput";
5
+ import { NumParamInput } from "../tupleToolParams/NumParamInput";
6
+ import { ListParamInput } from "../tupleToolParams/ListParamInput";
7
+ import { DictParamInput } from "../tupleToolParams/DictParamInput";
8
+ import { QuestionCircle } from "react-bootstrap-icons";
9
+ import { TupleToolDocsAccordion } from "../TupleToolDocsAccordion";
10
+ import { useDtt } from "../../providers/DttProvider";
11
+ export function ConfigureTupleToolModal({ branch, tool, onClose }) {
12
+ const { dtt, updateToolParam } = useDtt();
13
+ return (_jsxs(Modal, { show: true, size: "xl", fullscreen: "lg-down", onHide: onClose, children: [_jsxs(Modal.Header, { closeButton: true, children: ["Configure ", tool.toString()] }), _jsxs(Modal.Body, { className: "gap-3 d-flex flex-column", children: [tool ? (_jsx(Form, { children: Object.entries(dtt.getToolConfig(branch, tool)).map(([paramName, param]) => {
14
+ const { description, type, default: defaultValue, value } = param;
15
+ let inputComponent;
16
+ switch (type) {
17
+ case "str":
18
+ inputComponent = (_jsx(StrParamInput, { value: value, defaultValue: defaultValue, onChange: (newValue) => updateToolParam(branch, tool, paramName, newValue), param: paramName }));
19
+ break;
20
+ case "bool":
21
+ inputComponent = (_jsx(BoolParamInput, { value: value, onChange: (newValue) => updateToolParam(branch, tool, paramName, newValue) }));
22
+ break;
23
+ case "int":
24
+ case "uint":
25
+ case "float":
26
+ inputComponent = (_jsx(NumParamInput, { type: type, value: value, defaultValue: defaultValue, onChange: (newValue) => updateToolParam(branch, tool, paramName, newValue) }));
27
+ break;
28
+ case "text":
29
+ inputComponent = (_jsx(ListParamInput, { initialValues: value, defaultValues: defaultValue, newItemValue: "", onChange: (newValue) => updateToolParam(branch, tool, paramName, newValue), buildInnerInput: (props) => _jsx(StrParamInput, { ...props, param: paramName }) }));
30
+ break;
31
+ case "[int]":
32
+ case "[uint]":
33
+ case "[float]":
34
+ inputComponent = (_jsx(ListParamInput, { initialValues: value, defaultValues: defaultValue, newItemValue: 0, onChange: (newValue) => updateToolParam(branch, tool, paramName, newValue), buildInnerInput: (props) => (_jsx(NumParamInput, { type: type.slice(1, -1), ...props })) }));
35
+ break;
36
+ case "{str:str}":
37
+ case "{str:[str]}":
38
+ inputComponent = (_jsx(DictParamInput, { value: value, onChange: (newValue) => updateToolParam(branch, tool, paramName, newValue) }));
39
+ break;
40
+ }
41
+ return (_jsxs(Form.Group, { as: Row, className: "mb-2", children: [_jsxs(Form.Label, { column: true, sm: 3, children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: description }), children: _jsx(QuestionCircle, {}) }), _jsxs("code", { children: [" ", paramName, " "] })] }), _jsx(Form.Label, { column: true, sm: 2, children: _jsxs("code", { children: [" ", type, " "] }) }), _jsx(Col, { sm: 7, children: inputComponent })] }, paramName));
42
+ }) })) : ("No tool selected"), _jsx(TupleToolDocsAccordion, { toolClass: tool.class }), _jsx(Button, { className: "align-self-end", onClick: onClose, children: "Save & close" })] })] }));
43
+ }
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ submitLocation: string;
3
+ onClose: (submitted: boolean) => void;
4
+ requestReasonMessage?: string;
5
+ csrfToken?: string;
6
+ }
7
+ export declare function ReasonForRequestModal({ submitLocation, onClose, requestReasonMessage, csrfToken }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert, Button, FormControl, InputGroup, Modal, OverlayTrigger, Spinner, Tooltip } from "react-bootstrap";
3
+ import { useRequest } from "../../providers/RequestProvider";
4
+ import { useState } from "react";
5
+ import { useRows } from "../../providers/RowsProvider";
6
+ export function ReasonForRequestModal({ submitLocation, onClose, requestReasonMessage, csrfToken }) {
7
+ const { generateAllFiles } = useRows();
8
+ const { productionName, reasonForRequest, setReasonForRequest } = useRequest();
9
+ const [requestLoading, setRequestLoading] = useState(false);
10
+ const [requestError, setRequestError] = useState(null);
11
+ const submitRequest = (url) => {
12
+ setRequestLoading(true);
13
+ setRequestError(null);
14
+ const allFiles = generateAllFiles();
15
+ const formData = new FormData();
16
+ allFiles.forEach((file) => {
17
+ formData.append("generatedFiles[]", new Blob([file.content], { type: "text/plain" }), file.name);
18
+ });
19
+ formData.append("email", localStorage.getItem("email") || "");
20
+ formData.append("name", productionName);
21
+ formData.append("reasonForRequest", reasonForRequest);
22
+ let headers = {};
23
+ if (csrfToken) {
24
+ headers = {
25
+ "X-Csrf-Token": csrfToken,
26
+ };
27
+ }
28
+ fetch(url, {
29
+ method: "POST",
30
+ body: formData,
31
+ credentials: "include",
32
+ headers: headers,
33
+ })
34
+ .then((response) => {
35
+ if (!response.ok) {
36
+ throw new Error(`HTTP error! Status: ${response.status}`);
37
+ }
38
+ onClose(true);
39
+ })
40
+ .catch((error) => {
41
+ console.error("Fetch error:", error);
42
+ setRequestError("Something went wrong while submitting your request. Please try again later or contact support.");
43
+ })
44
+ .finally(() => {
45
+ setRequestLoading(false);
46
+ });
47
+ };
48
+ return (_jsxs(Modal, { show: true, onHide: () => onClose(false), size: "lg", children: [_jsx(Modal.Header, { closeButton: true, children: _jsx(Modal.Title, { children: "Reason for request" }) }), _jsxs(Modal.Body, { children: [_jsx(Alert, { children: requestReasonMessage }), requestError && _jsx(Alert, { variant: "danger", children: requestError }), _jsxs(InputGroup, { hasValidation: true, children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Reason for requesting the chosen ntuples" }), children: _jsx(InputGroup.Text, { children: "Reason for request" }) }), _jsx(FormControl, { as: "textarea", rows: 3, value: reasonForRequest, onChange: (event) => setReasonForRequest(event.target.value), isValid: !!reasonForRequest, placeholder: "I need these ntuples for..." })] })] }), _jsx(Modal.Footer, { children: _jsx(Button, { variant: "primary", onClick: () => submitRequest(submitLocation), children: requestLoading ? _jsx(Spinner, { animation: "border" }) : "Submit" }) })] }));
49
+ }
@@ -0,0 +1,7 @@
1
+ import { RowData } from "../../models/rowData";
2
+ interface Props {
3
+ row: RowData;
4
+ onClose: () => void;
5
+ }
6
+ export declare function UploadDttConfigModal({ row, onClose }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Form, Modal } from "react-bootstrap";
3
+ import yaml from "js-yaml";
4
+ import Dtt from "../../models/dtt";
5
+ import { useRows } from "../../providers/RowsProvider";
6
+ export function UploadDttConfigModal({ row, onClose }) {
7
+ const { setRows } = useRows();
8
+ const uploadConfig = (files) => {
9
+ const reader = new FileReader();
10
+ reader.onload = (e) => {
11
+ if (!e.target) {
12
+ return;
13
+ }
14
+ const text = e.target.result;
15
+ const config = yaml.load(text);
16
+ if (config.descriptorTemplate === row.decay.descriptors.template) {
17
+ const dtt = new Dtt(config, {});
18
+ setRows((prev) => {
19
+ return prev.map((r) => (r.id === row.id ? { ...r, dtt: dtt.withInputsFromLines(row.lines) } : r));
20
+ });
21
+ onClose();
22
+ }
23
+ else {
24
+ alert("Make sure to upload a previously downloaded configuration file for the same decay.");
25
+ }
26
+ };
27
+ reader.readAsText(files[0]);
28
+ };
29
+ return (_jsxs(Modal, { show: true, animation: false, children: [_jsx(Modal.Header, { children: _jsx(Modal.Title, { children: " Upload configuration file " }) }), _jsx(Modal.Body, { children: _jsx(Form.Group, { controlId: "formFile1", className: "mb-3", children: _jsx(Form.Control, { type: "file", onChange: (event) => {
30
+ if (!event.target.files)
31
+ return;
32
+ event.preventDefault();
33
+ uploadConfig(event.target.files);
34
+ } }) }) }), _jsx(Modal.Footer, { children: _jsx(Button, { variant: "secondary", onClick: onClose, children: "Close" }) })] }));
35
+ }
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ onClose: () => void;
3
+ }
4
+ export declare function UploadProdConfigModal({ onClose }: Props): import("react/jsx-runtime").JSX.Element | null;
5
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Form, Modal } from "react-bootstrap";
3
+ import { useMetadata } from "../../providers/MetadataProvider";
4
+ import { useProductionConfig } from "../../providers/ProductionConfigProvider";
5
+ import { useRows } from "../../providers/RowsProvider";
6
+ import { useRequest } from "../../providers/RequestProvider";
7
+ export function UploadProdConfigModal({ onClose }) {
8
+ const metadata = useMetadata();
9
+ const { parseProductionFiles } = useProductionConfig();
10
+ const { setRows } = useRows();
11
+ const { setContactEmails } = useRequest();
12
+ if (!metadata) {
13
+ return null;
14
+ }
15
+ return (_jsxs(Modal, { show: true, animation: false, children: [_jsx(Modal.Header, { children: _jsx(Modal.Title, { children: " Upload configuration file " }) }), _jsx(Modal.Body, { children: _jsx(Form.Group, { controlId: "formFile2", className: "mb-3", children: _jsx(Form.Control, { type: "file", multiple: true, onChange: (event) => {
16
+ const files = event.target.files;
17
+ if (!files) {
18
+ return;
19
+ }
20
+ parseProductionFiles(Array.from(files), metadata)
21
+ .then(({ rows, emails }) => {
22
+ setRows(rows);
23
+ setContactEmails(emails);
24
+ })
25
+ .catch(console.error);
26
+ } }) }) }), _jsx(Modal.Footer, { children: _jsx(Button, { variant: "secondary", onClick: onClose, children: "Close" }) })] }));
27
+ }
@@ -0,0 +1,16 @@
1
+ /*****************************************************************************\
2
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
3
+ * *
4
+ * This software is distributed under the terms of the GNU General Public *
5
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
6
+ * *
7
+ * In applying this licence, CERN does not waive the privileges and immunities *
8
+ * granted to it by virtue of its status as an Intergovernmental Organization *
9
+ * or submit itself to any jurisdiction. *
10
+ \*****************************************************************************/
11
+ interface Props {
12
+ value: boolean;
13
+ onChange: (v: boolean) => void;
14
+ }
15
+ export declare function BoolParamInput({ onChange, value }: Props): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { Form } from "react-bootstrap";
13
+ export function BoolParamInput({ onChange, value }) {
14
+ return _jsx(Form.Check, { type: "switch", checked: value, onChange: () => onChange(!value) });
15
+ }
@@ -0,0 +1,14 @@
1
+ interface Props {
2
+ value: {
3
+ [key: string]: string;
4
+ } | {
5
+ [key: string]: string[];
6
+ };
7
+ onChange: (value: {
8
+ [key: string]: string;
9
+ } | {
10
+ [key: string]: string[];
11
+ }) => void;
12
+ }
13
+ export declare function DictParamInput({ onChange, ...props }: Props): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { useState } from "react";
13
+ import { Alert, Button, ButtonGroup, Card, FormControl } from "react-bootstrap";
14
+ export function DictParamInput({ onChange, ...props }) {
15
+ const [value, setValue] = useState(JSON.stringify(props.value, null, 2));
16
+ const [editMode, setEditMode] = useState(false);
17
+ const [error, setError] = useState(null);
18
+ const handleSave = () => {
19
+ try {
20
+ const json = JSON.parse(value);
21
+ onChange(json);
22
+ setError(null);
23
+ setEditMode(false);
24
+ }
25
+ catch (e) {
26
+ console.error("JSON parsing error:", e);
27
+ setError("Invalid JSON");
28
+ }
29
+ };
30
+ return (_jsx(Card, { children: _jsxs(Card.Body, { children: [error && _jsx(Alert, { variant: "danger", children: error }), _jsx(FormControl, { as: "textarea", value: value, onChange: (e) => setValue(e.target.value), disabled: !editMode }), _jsxs(ButtonGroup, { children: [editMode && (_jsx(Button, { variant: "primary", onClick: handleSave, children: "Save" })), _jsx(Button, { variant: "outline-secondary", onClick: () => setEditMode(!editMode), children: editMode ? "Cancel" : "Edit" })] })] }) }));
31
+ }
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ interface Props<T> {
3
+ onChange: (value: T[]) => void;
4
+ initialValues: T[];
5
+ defaultValues: T[];
6
+ newItemValue: T;
7
+ buildInnerInput: (props: {
8
+ value: T;
9
+ onChange: (value: T) => void;
10
+ defaultValue?: T;
11
+ }) => ReactNode;
12
+ }
13
+ export declare function ListParamInput<T>({ onChange, initialValues, defaultValues, newItemValue, buildInnerInput }: Props<T>): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { Button, CloseButton, InputGroup, ListGroup } from "react-bootstrap";
13
+ import { PlusLg } from "react-bootstrap-icons";
14
+ import { useEffect, useState } from "react";
15
+ export function ListParamInput({ onChange, initialValues, defaultValues, newItemValue, buildInnerInput }) {
16
+ const [value, setValue] = useState(initialValues);
17
+ useEffect(() => {
18
+ // Don't run on the first render
19
+ if (initialValues === value) {
20
+ return;
21
+ }
22
+ onChange(value);
23
+ }, [value]);
24
+ const handleAdd = () => {
25
+ if (value.length < defaultValues.length) {
26
+ setValue((prev) => [...prev, defaultValues[prev.length]]);
27
+ }
28
+ else {
29
+ setValue((prev) => [...prev, newItemValue]);
30
+ }
31
+ };
32
+ const handleRemove = (index) => {
33
+ setValue((prev) => prev.filter((_, i) => i !== index));
34
+ };
35
+ return (_jsxs(_Fragment, { children: [_jsx(ListGroup, { variant: "flush", children: value.map((value, i) => (_jsx(ListGroup.Item, { children: _jsxs(InputGroup, { children: [buildInnerInput({
36
+ value,
37
+ onChange: (newValue) => {
38
+ setValue((prev) => {
39
+ const next = [...prev];
40
+ next[i] = newValue;
41
+ return next;
42
+ });
43
+ },
44
+ defaultValue: i < defaultValues.length ? defaultValues[i] : undefined,
45
+ }), _jsx(CloseButton, { onClick: () => handleRemove(i) })] }) }, i))) }), _jsx(Button, { variant: "success", size: "sm", onClick: handleAdd, children: _jsx(PlusLg, {}) })] }));
46
+ }
@@ -0,0 +1,18 @@
1
+ /*****************************************************************************\
2
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
3
+ * *
4
+ * This software is distributed under the terms of the GNU General Public *
5
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
6
+ * *
7
+ * In applying this licence, CERN does not waive the privileges and immunities *
8
+ * granted to it by virtue of its status as an Intergovernmental Organization *
9
+ * or submit itself to any jurisdiction. *
10
+ \*****************************************************************************/
11
+ interface Props {
12
+ type: "int" | "uint" | "float";
13
+ value: number;
14
+ defaultValue?: number;
15
+ onChange: (v: number) => void;
16
+ }
17
+ export declare function NumParamInput({ type, onChange, value, defaultValue }: Props): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*****************************************************************************\
3
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
4
+ * *
5
+ * This software is distributed under the terms of the GNU General Public *
6
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
7
+ * *
8
+ * In applying this licence, CERN does not waive the privileges and immunities *
9
+ * granted to it by virtue of its status as an Intergovernmental Organization *
10
+ * or submit itself to any jurisdiction. *
11
+ \*****************************************************************************/
12
+ import { Form } from "react-bootstrap";
13
+ export function NumParamInput({ type, onChange, value, defaultValue }) {
14
+ return (_jsx(Form.Control, { type: "number", value: value, placeholder: defaultValue?.toString(), onChange: (event) => {
15
+ const value = event.target.value;
16
+ let n = Number(value);
17
+ if (type === "int") {
18
+ n = Math.trunc(n);
19
+ }
20
+ else if (type === "uint") {
21
+ n = Math.trunc(Math.abs(n));
22
+ }
23
+ onChange(n);
24
+ }, ...(type === "int" || type === "uint" ? { step: 1 } : {}), ...(type === "uint" ? { min: 0 } : {}) }));
25
+ }
@@ -0,0 +1,19 @@
1
+ /*****************************************************************************\
2
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
3
+ * *
4
+ * This software is distributed under the terms of the GNU General Public *
5
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
6
+ * *
7
+ * In applying this licence, CERN does not waive the privileges and immunities *
8
+ * granted to it by virtue of its status as an Intergovernmental Organization *
9
+ * or submit itself to any jurisdiction. *
10
+ \*****************************************************************************/
11
+ export declare function sanitizeStrTupleToolParam(value: string): string;
12
+ interface Props {
13
+ value: string;
14
+ defaultValue?: string;
15
+ onChange: (value: string) => void;
16
+ param?: string;
17
+ }
18
+ export declare function StrParamInput({ onChange, value, defaultValue, param }: Props): import("react/jsx-runtime").JSX.Element;
19
+ export {};