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,9 @@
1
+ import { RowData } from "../models/rowData";
2
+ interface Props {
3
+ row: RowData;
4
+ hideDownloadButtons: boolean;
5
+ hideUploadButtons: boolean;
6
+ variablesPath: string;
7
+ }
8
+ export declare function LineTableRow({ row, hideDownloadButtons, hideUploadButtons, variablesPath }: Props): import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,123 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Col, OverlayTrigger, Popover, Row } from "react-bootstrap";
3
+ import { StrippingLineInfo } from "./StrippingLineInfo";
4
+ import { useMetadata } from "../providers/MetadataProvider";
5
+ import { useRows } from "../providers/RowsProvider";
6
+ import { DatasetInfo } from "./DatasetInfo";
7
+ import BkPath from "../models/bkPath";
8
+ import { QuestionCircle } from "react-bootstrap-icons";
9
+ import { DeleteButton } from "./DeleteButton";
10
+ import Select from "react-select";
11
+ import Creatable from "react-select/creatable";
12
+ import { DttNameInput } from "./DttNameInput";
13
+ export function LineTableRow({ row, hideDownloadButtons, hideUploadButtons, variablesPath }) {
14
+ const metadata = useMetadata();
15
+ const { rows, setRows } = useRows();
16
+ if (!metadata) {
17
+ return null;
18
+ }
19
+ function getStrippingLineOptions() {
20
+ let opts = {};
21
+ let streams = [];
22
+ let lines = [];
23
+ let groups = [];
24
+ Object.keys(row.decay.lines).forEach((streamLine) => {
25
+ const [stream, line] = streamLine.split("/");
26
+ streams.push(stream);
27
+ lines.push(line);
28
+ });
29
+ const uniqueStreams = [...new Set(streams)];
30
+ uniqueStreams.forEach((uniqueStream) => {
31
+ opts[uniqueStream] = [];
32
+ lines.forEach((line, i) => {
33
+ if (streams[i] === uniqueStream) {
34
+ let duplicate = false;
35
+ const option = {
36
+ value: line,
37
+ label: (_jsx(StrippingLineInfo, { line: line, stream: uniqueStream, versions: row.decay.lines[uniqueStream + "/" + line] })),
38
+ group: uniqueStream,
39
+ };
40
+ // Check for duplicates
41
+ for (const option of opts[uniqueStream]) {
42
+ if (option.label === line) {
43
+ duplicate = true;
44
+ }
45
+ }
46
+ if (!duplicate) {
47
+ opts[uniqueStream].push(option);
48
+ }
49
+ }
50
+ });
51
+ groups.push({ label: uniqueStream, options: opts[uniqueStream] });
52
+ });
53
+ return groups;
54
+ }
55
+ function getOptionFromPath(path) {
56
+ return {
57
+ value: path,
58
+ label: _jsx(DatasetInfo, { pathString: path }),
59
+ };
60
+ }
61
+ const validatePath = (choice) => {
62
+ const path = new BkPath(choice);
63
+ if (!path.isValid()) {
64
+ return false;
65
+ }
66
+ return row.lines.every((line) => {
67
+ const streamName = line.stream.toLowerCase();
68
+ const fileName = path.getFilename().split(".")[0].toLowerCase();
69
+ const matchingVersion = line.versions.some((version) => path.getStrippingVersion() === version);
70
+ return ["allstreams", streamName].includes(fileName) && matchingVersion;
71
+ });
72
+ };
73
+ const handlePathChoice = (choices) => {
74
+ const validPaths = choices.filter((choice) => validatePath(choice)).map((choice) => choice);
75
+ const validPathOptions = row.pathOptions.filter((choice) => validatePath(choice));
76
+ setRows((prev) => {
77
+ return prev.map((r) => (r.id === row.id ? { ...r, paths: validPaths, pathOptions: validPathOptions } : r));
78
+ });
79
+ };
80
+ const handleRemoveRow = () => {
81
+ setRows(rows.filter((r) => r.id !== row.id));
82
+ };
83
+ const changeSelStrLines = (choices) => {
84
+ if (choices.length > 1) {
85
+ alert("Choosing multiple stripping lines per row can result in duplication of candidates within a given event and is therefore forbidden. To choose a different stripping line, remove the current selection.");
86
+ choices.pop();
87
+ }
88
+ const lines = choices.map((choice) => ({
89
+ stream: choice.group,
90
+ line: choice.value,
91
+ versions: row.decay.lines[choice.group + "/" + choice.value],
92
+ }));
93
+ setRows((prev) => {
94
+ return prev.map((r) => r.id === row.id ? { ...r, lines, dtt: r.dtt ? r.dtt.withInputsFromLines(lines) : null } : r);
95
+ });
96
+ handlePathChoice(row.paths);
97
+ };
98
+ const handleCreatePath = (choice) => {
99
+ if (!validatePath(choice)) {
100
+ return;
101
+ }
102
+ const paths = [...row.paths, choice];
103
+ const pathOptions = [...row.pathOptions, choice];
104
+ setRows((prev) => {
105
+ return prev.map((r) => (r.id === row.id ? { ...r, paths, pathOptions } : r));
106
+ });
107
+ };
108
+ const getDefaultBkPaths = () => {
109
+ const defaultOptions = metadata.dataset
110
+ .filter((path) => validatePath(path))
111
+ .map((path) => getOptionFromPath(path));
112
+ return [...defaultOptions, ...row.pathOptions.map(getOptionFromPath)];
113
+ };
114
+ return (_jsxs(Row, { className: "align-items-center", children: [_jsx(Col, { lg: true, children: _jsx(DttNameInput, { row: row, hideDownloadButtons: hideDownloadButtons, hideUploadButtons: hideUploadButtons, variablesPath: variablesPath }) }), _jsx(Col, { lg: true, children: _jsx(Select, { isMulti: true, options: getStrippingLineOptions(), defaultValue: row.lines.map((lineInfo) => ({
115
+ value: lineInfo.line,
116
+ label: (_jsx(StrippingLineInfo, { line: lineInfo.line, stream: lineInfo.stream, versions: lineInfo.versions, showLink: false })),
117
+ group: lineInfo.stream,
118
+ })), placeholder: "Stripping line", onChange: (newValue) => changeSelStrLines(newValue),
119
+ // Display the dropdown above text inputs and other elements
120
+ menuPortalTarget: document.body, menuPosition: "fixed", styles: {
121
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
122
+ } }) }), _jsx(Col, { xs: "auto", children: _jsx(OverlayTrigger, { trigger: "click", placement: "right", rootClose: true, overlay: _jsx(Popover, { children: _jsx(Popover.Body, { children: row.lines.map((line) => (_jsx(StrippingLineInfo, { line: line.line, stream: line.stream, versions: line.versions, showLink: true }, `${line.line}`))) }) }), children: _jsx(Button, { className: "ms-auto", type: "button", disabled: row.lines.length === 0, children: _jsx(QuestionCircle, {}) }) }) }), _jsx(Col, { children: _jsx(Creatable, { isMulti: true, options: getDefaultBkPaths() /*TODO: use ODP records when ready*/, value: row.paths.map(getOptionFromPath), isDisabled: row.lines.length === 0, placeholder: "Bookkeeping path", onChange: (newValue) => handlePathChoice(newValue.map((item) => item.value)), onCreateOption: (inputValue) => handleCreatePath(inputValue), closeMenuOnSelect: false }) }), _jsx(Col, { xs: "auto", children: _jsx(DeleteButton, { action: handleRemoveRow }) })] }, row.id));
123
+ }
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ message?: string;
3
+ height?: string;
4
+ }
5
+ export declare function LoadingIndicator({ message, height }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Spinner } from "react-bootstrap";
3
+ export function LoadingIndicator({ message, height }) {
4
+ return (_jsx("div", { className: "d-flex justify-content-center align-items-center", style: { height: height || "auto" }, children: _jsxs("div", { className: "d-flex flex-column align-items-center", children: [_jsx(Spinner, { "data-testid": "loading-spinner", animation: "border", role: "status" }), message && _jsx("p", { className: "mt-2", children: message })] }) }));
5
+ }
@@ -0,0 +1,26 @@
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
+ import "bootstrap/dist/css/bootstrap.css";
12
+ import { ReactNode } from "react";
13
+ interface Props {
14
+ basePath: string;
15
+ decaysPath: string;
16
+ variablesPath: string;
17
+ contactEmail?: string;
18
+ submitLocation?: string;
19
+ hideDownloadButtons?: boolean;
20
+ hideUploadButtons?: boolean;
21
+ requestReasonMessage?: string;
22
+ requestSubmittedMessage?: ReactNode;
23
+ csrfToken?: string;
24
+ }
25
+ export declare function NtupleWizard({ basePath, decaysPath, variablesPath, submitLocation, hideDownloadButtons, hideUploadButtons, requestReasonMessage, requestSubmittedMessage, csrfToken, ...props }: Props): import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,33 @@
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 "bootstrap/dist/css/bootstrap.css";
13
+ import { useLocation } from "react-router-dom";
14
+ import { MetadataProvider } from "../providers/MetadataProvider.js";
15
+ import { DecaySearchPage } from "../pages/DecaySearchPage";
16
+ import { DecayTreeConfigPage } from "../pages/DecayTreeConfigPage";
17
+ import { LinesTablePage } from "../pages/LinesTablePage";
18
+ import { MathJaxContext } from "better-react-mathjax";
19
+ import { RowsProvider } from "../providers/RowsProvider.js";
20
+ import { RequestProvider } from "../providers/RequestProvider";
21
+ import { ProductionConfigProvider } from "../providers/ProductionConfigProvider";
22
+ export function NtupleWizard({ basePath, decaysPath, variablesPath, submitLocation, hideDownloadButtons, hideUploadButtons, requestReasonMessage, requestSubmittedMessage, csrfToken = "", ...props }) {
23
+ const { pathname } = useLocation();
24
+ let emailIsKnown = false;
25
+ if (props.contactEmail) {
26
+ localStorage.setItem("email", props.contactEmail);
27
+ emailIsKnown = true;
28
+ }
29
+ if (!submitLocation) {
30
+ hideDownloadButtons = false;
31
+ }
32
+ return (_jsx(MetadataProvider, { children: _jsx(ProductionConfigProvider, { children: _jsx(RowsProvider, { children: _jsx(RequestProvider, { children: _jsx(MathJaxContext, { children: pathname.endsWith("/select-decays") ? (_jsx(DecaySearchPage, { basePath: basePath })) : pathname.endsWith("/variables") ? (_jsx(DecayTreeConfigPage, { basePath: basePath })) : (_jsx(LinesTablePage, { decaysPath: decaysPath, variablesPath: variablesPath, submitLocation: submitLocation, hideDownloadButtons: hideDownloadButtons, hideUploadButtons: hideUploadButtons, emailIsKnown: emailIsKnown, requestReasonMessage: requestReasonMessage, requestSubmittedMessage: requestSubmittedMessage, csrfToken: csrfToken })) }) }) }) }) }));
33
+ }
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ strippingLines: {
3
+ [key: string]: string[];
4
+ };
5
+ selected: boolean;
6
+ }
7
+ export declare function NumStrippingLinesBadge({ strippingLines, selected }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Badge, OverlayTrigger, Popover } from "react-bootstrap";
3
+ import { StrippingLineInfo } from "./StrippingLineInfo.js";
4
+ export function NumStrippingLinesBadge({ strippingLines, selected }) {
5
+ const numStrippingLines = Object.keys(strippingLines).length;
6
+ return (_jsx(OverlayTrigger, { placement: "right", overlay: _jsxs(Popover, { children: [_jsx(Popover.Header, { children: "Stripping lines" }), _jsx(Popover.Body, { children: Object.keys(strippingLines).map((line) => {
7
+ const [stream, name] = line.split("/");
8
+ return (_jsx(StrippingLineInfo, { line: name, stream: stream, versions: strippingLines[line] }, line));
9
+ }) })] }), children: _jsxs(Badge, { pill: true, bg: selected ? "primary" : "secondary", children: [numStrippingLines, " stripping line", numStrippingLines === 1 ? "" : "s"] }) }));
10
+ }
@@ -0,0 +1,8 @@
1
+ import { Props as SelectProps } from "react-select";
2
+ import { DropdownOption } from "../models/dropdownOption";
3
+ interface Props extends SelectProps<DropdownOption> {
4
+ onlyHeads?: boolean;
5
+ onlyKnown?: boolean;
6
+ }
7
+ export declare function ParticleDropdown({ onlyHeads, onlyKnown, ...props }: Props): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,33 @@
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 { MathJax } from "better-react-mathjax";
13
+ import Select from "react-select";
14
+ import { useMetadata } from "../providers/MetadataProvider.js";
15
+ export function ParticleDropdown({ onlyHeads, onlyKnown, ...props }) {
16
+ const metadata = useMetadata();
17
+ if (!metadata) {
18
+ return null;
19
+ }
20
+ const allowedParticles = () => onlyHeads
21
+ ? [...new Set(Object.values(metadata.decays).map((decay) => decay.descriptors.list[0]))]
22
+ : onlyKnown
23
+ ? Object.keys(metadata.particleProperties).filter((key) => !metadata.particleProperties[key].hide)
24
+ : Object.keys(metadata.particleProperties);
25
+ const loaded = metadata && (!onlyHeads || metadata.decays);
26
+ const options = loaded
27
+ ? allowedParticles().map((key) => ({
28
+ value: key,
29
+ label: _jsx(MathJax, { inline: true, children: `\\(${metadata.particleProperties[key]["latex"]}\\)` }),
30
+ }))
31
+ : [];
32
+ return (_jsx("div", { className: "react-select form-control p-0", children: _jsx(Select, { options: options, isLoading: !loaded, filterOption: (candidate, input) => candidate.value.toLowerCase().startsWith(input.toLowerCase()), ...props }) }));
33
+ }
@@ -0,0 +1,9 @@
1
+ import { ElementType } from "react";
2
+ import { ParticleTag } from "../models/particleTag";
3
+ interface Props {
4
+ tag: ParticleTag;
5
+ as?: ElementType;
6
+ onClick?: () => void;
7
+ }
8
+ export declare function ParticleTagBadge({ tag, as, onClick }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,22 @@
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, OverlayTrigger, Spinner, Tooltip } from "react-bootstrap";
13
+ import { useMetadata } from "../providers/MetadataProvider.js";
14
+ import { config } from "../config.js";
15
+ export function ParticleTagBadge({ tag, as, onClick }) {
16
+ const metadata = useMetadata();
17
+ const background = metadata
18
+ ? config.particleTagGroupStyles[tag.group]
19
+ : "dark";
20
+ const description = metadata ? (metadata.userHints.particleTags[tag.label].description) : (_jsx(Spinner, { animation: "border" }));
21
+ return (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: description }), children: _jsx(Badge, { pill: true, bg: background, text: "light", as: as, onClick: onClick, children: tag.label }) }));
22
+ }
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ branch: string[];
3
+ onSelectTag: (branches: string[]) => void;
4
+ }
5
+ export declare function ParticleTagFilters({ branch, onSelectTag }: Props): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card, Stack } from "react-bootstrap";
3
+ import { ParticleTagBadge } from "./ParticleTagBadge";
4
+ import { useMetadata } from "../providers/MetadataProvider";
5
+ import { useDtt } from "../providers/DttProvider";
6
+ import { useCallback, useMemo } from "react";
7
+ export function ParticleTagFilters({ branch, onSelectTag }) {
8
+ const metadata = useMetadata();
9
+ const { dtt } = useDtt();
10
+ if (!metadata) {
11
+ return null;
12
+ }
13
+ const selectAllByTag = useCallback((tag) => {
14
+ if (!metadata)
15
+ return;
16
+ const allBranches = dtt.config.branches;
17
+ const matchingBranches = Object.keys(allBranches)
18
+ .filter((branch) => {
19
+ const particle = allBranches[branch].particle;
20
+ const particleTags = metadata.particleProperties[particle].tags;
21
+ return particleTags.includes(tag.label);
22
+ })
23
+ .sort();
24
+ onSelectTag(matchingBranches);
25
+ }, [dtt, metadata]);
26
+ const particleTags = useMemo(() => {
27
+ const tagInfo = metadata.userHints.particleTags;
28
+ let particleTags;
29
+ if (branch.length > 0) {
30
+ const allParticles = dtt
31
+ .getParticlesByBranchId(branch)
32
+ .map((particle) => metadata.particleProperties[particle]);
33
+ const allTags = new Set(allParticles.map((particle) => particle.tags.filter((tag) => !tagInfo[tag].hide)).flat());
34
+ particleTags = Array.from(allTags)
35
+ .map((tag) => ({ label: tag, group: tagInfo[tag].group }))
36
+ .filter((tag) => allParticles.every((particle) => particle.tags.includes(tag.label)));
37
+ }
38
+ else {
39
+ const allBranches = dtt.config.branches;
40
+ const allParticles = Object.keys(allBranches).map((branch) => metadata.particleProperties[allBranches[branch].particle]);
41
+ const uniqueTags = new Set(allParticles.map((particle) => particle.tags.filter((tag) => !tagInfo[tag].hide)).flat());
42
+ particleTags = Array.from(uniqueTags).map((tag) => ({ label: tag, group: tagInfo[tag].group }));
43
+ }
44
+ return particleTags;
45
+ }, [dtt, metadata, branch]);
46
+ if (particleTags.length === 0) {
47
+ return null;
48
+ }
49
+ const groupedTags = Object.groupBy([...particleTags].sort((a, b) => a.group.localeCompare(b.group)), (tag) => tag.group);
50
+ return (_jsxs(_Fragment, { children: [_jsx(Card.Title, { children: "Select by category" }), _jsx(Stack, { className: "mt-1", direction: "horizontal", style: { flexWrap: "wrap", justifyContent: "center" }, gap: 2, children: Object.entries(groupedTags).map(([group, tags]) => (_jsx(Stack, { direction: "horizontal", style: { flexWrap: "wrap" }, gap: 1, children: tags.map((tag) => (_jsx(ParticleTagBadge, { as: "button", tag: tag, onClick: () => selectAllByTag(tag) }, tag.label))) }, group))) })] }));
51
+ }
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ polarity: string;
3
+ }
4
+ export declare function PolarityBadge({ polarity }: 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 PolarityBadge({ polarity }) {
14
+ return (_jsx(Badge, { pill: true, bg: "danger", children: polarity }));
15
+ }
@@ -0,0 +1,7 @@
1
+ export interface StrippingBadgeProps {
2
+ version: string;
3
+ line?: string;
4
+ stream?: string;
5
+ showLink?: boolean;
6
+ }
7
+ export declare function StrippingLineBadge({ version, line, stream, showLink }: StrippingBadgeProps): import("react/jsx-runtime").JSX.Element;
@@ -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 { Badge, OverlayTrigger, Spinner, Tooltip } from "react-bootstrap";
13
+ import { useMetadata } from "../providers/MetadataProvider.js";
14
+ export function StrippingLineBadge({ version, line, stream, showLink }) {
15
+ const metadata = useMetadata();
16
+ // TODO: configurable baseURL, remove baseURL from metadata (or make it a top-level key)
17
+ const url = line && metadata && stream
18
+ ? metadata.stripping[version][line].url[stream]
19
+ : `http://lhcbdoc.web.cern.ch/lhcbdoc/stripping/config/stripping${version}/index.html`;
20
+ const { description } = metadata ? metadata.strippingHints[version] : { description: _jsx(Spinner, { animation: "border" }) };
21
+ const badgeProps = showLink
22
+ ? {
23
+ as: "a",
24
+ href: url,
25
+ target: "_blank",
26
+ }
27
+ : {};
28
+ return (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: description }), children: _jsx(Badge, { pill: true, bg: "info", ...badgeProps, children: "S" + version }) }));
29
+ }
@@ -0,0 +1,8 @@
1
+ import { StrippingBadgeProps } from "./StrippingLineBadge";
2
+ interface Props extends Omit<StrippingBadgeProps, "version"> {
3
+ versions: string[];
4
+ line: string;
5
+ showLink?: boolean;
6
+ }
7
+ export declare function StrippingLineInfo({ versions, line, showLink, ...props }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,17 @@
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 { Stack } from "react-bootstrap";
13
+ import { StrippingLineBadge } from "./StrippingLineBadge";
14
+ export function StrippingLineInfo({ versions, line, showLink, ...props }) {
15
+ const strippingInfo = versions.map((version) => (_jsx(StrippingLineBadge, { version: version, line: line, showLink: showLink, ...props }, `${line}-S${version}-badge`)));
16
+ return (_jsxs("span", { children: [line, _jsx("br", {}), _jsx(Stack, { direction: "horizontal", style: { flexWrap: "wrap" }, gap: 1, children: strippingInfo })] }));
17
+ }
@@ -0,0 +1,11 @@
1
+ interface Props {
2
+ allRowsHaveDtt: boolean;
3
+ disabled: boolean;
4
+ onSubmit: () => void;
5
+ submitLocation?: string;
6
+ hideDownloadButtons?: boolean;
7
+ requestReasonMessage?: string;
8
+ csrfToken?: string;
9
+ }
10
+ export declare function SubmitRequestButton({ allRowsHaveDtt, disabled, onSubmit, submitLocation, hideDownloadButtons, requestReasonMessage, csrfToken, }: Props): import("react/jsx-runtime").JSX.Element | null;
11
+ export {};
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Button, OverlayTrigger, Tooltip } from "react-bootstrap";
3
+ import { Download, Send } from "react-bootstrap-icons";
4
+ import { useState } from "react";
5
+ import { ReasonForRequestModal } from "./modals/ReasonForRequestModal";
6
+ import { downloadZip } from "../utils/utils";
7
+ import { useRows } from "../providers/RowsProvider";
8
+ import { useRequest } from "../providers/RequestProvider";
9
+ export function SubmitRequestButton({ allRowsHaveDtt, disabled, onSubmit, submitLocation, hideDownloadButtons, requestReasonMessage, csrfToken, }) {
10
+ const { generateAllFiles } = useRows();
11
+ const { productionName } = useRequest();
12
+ const [showReasonForRequestModal, setShowReasonForRequestModal] = useState(false);
13
+ const downloadAllFiles = () => {
14
+ const allFiles = generateAllFiles();
15
+ return downloadZip(allFiles, `${productionName}.zip`);
16
+ };
17
+ if (submitLocation) {
18
+ return (_jsxs(_Fragment, { children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: allRowsHaveDtt
19
+ ? disabled
20
+ ? "Please make sure all fields are filled in before submitting"
21
+ : "Submit a request with the chosen configuration"
22
+ : "Please configure a DecayTreeTuple for each selected decay before submitting" }), children: _jsx("span", { children: _jsxs(Button, { className: "align-items-center d-flex gap-1", disabled: disabled, onClick: () => setShowReasonForRequestModal(true), children: [_jsx(Send, {}), " Submit"] }) }) }), showReasonForRequestModal && (_jsx(ReasonForRequestModal, { submitLocation: submitLocation, requestReasonMessage: requestReasonMessage, onClose: (submitted) => {
23
+ setShowReasonForRequestModal(false);
24
+ if (submitted) {
25
+ onSubmit();
26
+ }
27
+ }, csrfToken: csrfToken }))] }));
28
+ }
29
+ if (!hideDownloadButtons) {
30
+ return (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: allRowsHaveDtt
31
+ ? disabled
32
+ ? "Please make sure all fields are filled in before downloading"
33
+ : "Download all DecayTreeTuple configurations"
34
+ : "Please configure a DecayTreeTuple for each selected decay before downloading" }), children: _jsx("span", { children: _jsxs(Button, { className: "align-items-center d-flex gap-1", disabled: disabled, onClick: () => {
35
+ downloadAllFiles().catch(console.error);
36
+ }, children: [_jsx(Download, {}), " Download"] }) }) }));
37
+ }
38
+ return null;
39
+ }
@@ -0,0 +1,12 @@
1
+ import { TagHint } from "../providers/MetadataProvider.js";
2
+ import { Props as SelectProps } from "react-select";
3
+ import { DropdownOption } from "../models/dropdownOption.js";
4
+ export declare function getSelectTagOptions(tags: {
5
+ [key: string]: TagHint;
6
+ }, filter?: (tag: TagHint) => boolean): DropdownOption[];
7
+ interface Props extends SelectProps<DropdownOption, true> {
8
+ type: "decayTags" | "particleTags";
9
+ filter?: (tag: TagHint) => boolean;
10
+ }
11
+ export declare function TagDropdown({ type, filter, ...props }: Props): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,31 @@
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
+ import Select from "react-select";
15
+ export function getSelectTagOptions(tags, filter = () => true) {
16
+ return Object.keys(tags)
17
+ .filter((key) => filter(tags[key]))
18
+ .map((key) => ({
19
+ value: key,
20
+ label: (_jsx(OverlayTrigger, { placement: "bottom", overlay: _jsx(Tooltip, { children: tags[key].description }), children: _jsx("span", { children: key }) })),
21
+ }));
22
+ }
23
+ export function TagDropdown({ type, filter, ...props }) {
24
+ const metadata = useMetadata();
25
+ const options = getSelectTagOptions(metadata ? metadata.userHints[type] : {}, filter);
26
+ return (_jsx("div", { className: "react-select form-control p-0", children: _jsx(Select, { isMulti: true, options: options, isLoading: !metadata, ...props,
27
+ // Display the dropdown above text inputs and other elements
28
+ menuPortalTarget: document.body, menuPosition: "fixed", styles: {
29
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
30
+ } }) }));
31
+ }
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ toolClass: string;
3
+ }
4
+ export declare function TupleToolDocsAccordion({ toolClass }: Props): import("react/jsx-runtime").JSX.Element | null;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Accordion, Spinner } from "react-bootstrap";
3
+ import { useMetadata } from "../providers/MetadataProvider";
4
+ import DOMPurify from "dompurify";
5
+ export function TupleToolDocsAccordion({ toolClass }) {
6
+ const metadata = useMetadata();
7
+ if (!metadata) {
8
+ return null;
9
+ }
10
+ const documentation = metadata.tupleTools.tupleTools[toolClass].documentation;
11
+ return (_jsx(Accordion, { children: _jsxs(Accordion.Item, { eventKey: "0", children: [_jsxs(Accordion.Header, { children: ["Documentation for ", toolClass] }), _jsx(Accordion.Body, { children: toolClass ? (_jsx("div", { dangerouslySetInnerHTML: {
12
+ __html: DOMPurify.sanitize(documentation),
13
+ } })) : (_jsx(Spinner, { animation: "border" })) })] }) }));
14
+ }
@@ -0,0 +1,21 @@
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
+ import { GroupBase, Props as SelectProps } from "react-select";
12
+ import { ReactNode } from "react";
13
+ type ToolOption = {
14
+ value: string;
15
+ label: ReactNode;
16
+ };
17
+ interface Props extends SelectProps<ToolOption, false, GroupBase<ToolOption>> {
18
+ filterToolTags: string[];
19
+ }
20
+ export declare function TupleToolDropdown({ filterToolTags, ...props }: Props): import("react/jsx-runtime").JSX.Element;
21
+ export {};