lhcb-ntuple-wizard-test 2.0.1 → 2.0.2
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.
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
-
|
|
3
|
-
disabled: boolean;
|
|
2
|
+
disabledMessage: string | null;
|
|
4
3
|
onSubmit: () => void;
|
|
5
4
|
submitLocation?: string;
|
|
6
5
|
hideDownloadButtons?: boolean;
|
|
7
6
|
requestReasonMessage?: string;
|
|
8
7
|
csrfToken?: string;
|
|
9
8
|
}
|
|
10
|
-
export declare function SubmitRequestButton({
|
|
9
|
+
export declare function SubmitRequestButton({ disabledMessage, onSubmit, submitLocation, hideDownloadButtons, requestReasonMessage, csrfToken, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
11
10
|
export {};
|
|
@@ -6,7 +6,7 @@ import { ReasonForRequestModal } from "./modals/ReasonForRequestModal";
|
|
|
6
6
|
import { downloadZip } from "../utils/utils";
|
|
7
7
|
import { useRows } from "../providers/RowsProvider";
|
|
8
8
|
import { useRequest } from "../providers/RequestProvider";
|
|
9
|
-
export function SubmitRequestButton({
|
|
9
|
+
export function SubmitRequestButton({ disabledMessage, onSubmit, submitLocation, hideDownloadButtons, requestReasonMessage, csrfToken, }) {
|
|
10
10
|
const { generateAllFiles } = useRows();
|
|
11
11
|
const { productionName } = useRequest();
|
|
12
12
|
const [showReasonForRequestModal, setShowReasonForRequestModal] = useState(false);
|
|
@@ -15,11 +15,7 @@ export function SubmitRequestButton({ allRowsHaveDtt, disabled, onSubmit, submit
|
|
|
15
15
|
return downloadZip(allFiles, `${productionName}.zip`);
|
|
16
16
|
};
|
|
17
17
|
if (submitLocation) {
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children:
|
|
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) => {
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx(OverlayTrigger, { show: !!disabledMessage, overlay: _jsx(Tooltip, { children: disabledMessage }), children: _jsx("span", { children: _jsxs(Button, { className: "align-items-center d-flex gap-1", disabled: !!disabledMessage, onClick: () => setShowReasonForRequestModal(true), children: [_jsx(Send, {}), " Submit"] }) }) }), showReasonForRequestModal && (_jsx(ReasonForRequestModal, { submitLocation: submitLocation, requestReasonMessage: requestReasonMessage, onClose: (submitted) => {
|
|
23
19
|
setShowReasonForRequestModal(false);
|
|
24
20
|
if (submitted) {
|
|
25
21
|
onSubmit();
|
|
@@ -27,11 +23,7 @@ export function SubmitRequestButton({ allRowsHaveDtt, disabled, onSubmit, submit
|
|
|
27
23
|
}, csrfToken: csrfToken }))] }));
|
|
28
24
|
}
|
|
29
25
|
if (!hideDownloadButtons) {
|
|
30
|
-
return (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children:
|
|
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: () => {
|
|
26
|
+
return (_jsx(OverlayTrigger, { show: !!disabledMessage, overlay: _jsx(Tooltip, { children: disabledMessage }), children: _jsx("span", { children: _jsxs(Button, { className: "align-items-center d-flex gap-1", disabled: !!disabledMessage, onClick: () => {
|
|
35
27
|
downloadAllFiles().catch(console.error);
|
|
36
28
|
}, children: [_jsx(Download, {}), " Download"] }) }) }));
|
|
37
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Alert, Button, FormControl, InputGroup, Modal, OverlayTrigger, Spinner, Tooltip } from "react-bootstrap";
|
|
3
3
|
import { useRequest } from "../../providers/RequestProvider";
|
|
4
4
|
import { useState } from "react";
|
|
@@ -45,5 +45,5 @@ export function ReasonForRequestModal({ submitLocation, onClose, requestReasonMe
|
|
|
45
45
|
setRequestLoading(false);
|
|
46
46
|
});
|
|
47
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" }) })] }));
|
|
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", disabled: !reasonForRequest || requestLoading, onClick: () => submitRequest(submitLocation), children: requestLoading ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { animation: "border", size: "sm" }), " Submitting..."] })) : ("Submit request") }) })] }));
|
|
49
49
|
}
|
|
@@ -111,10 +111,15 @@ export function LinesTablePage({ submitLocation, hideDownloadButtons, hideUpload
|
|
|
111
111
|
}
|
|
112
112
|
return (_jsxs("div", { className: "d-flex flex-column gap-3", children: [rows.map((row) => (_jsx(LineTableRow, { row: row, hideDownloadButtons: hideDownloadButtons ?? false, hideUploadButtons: hideUploadButtons ?? false, variablesPath: variablesPath }, row.id))), prodUploadLoading && _jsx(ConfigFilesUploadingAlert, {}), requestSubmitted && (_jsx(Row, { className: "mt-3", children: _jsx(Col, { children: _jsxs(Alert, { variant: "success", dismissible: true, onClose: () => setRequestSubmitted(false), children: [_jsx(Alert.Heading, { children: "Request submitted!" }), requestSubmittedMessage] }) }) })), _jsx(Row, { children: _jsx(Col, { xs: "auto", children: _jsxs(ButtonGroup, { children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Select decays" }), children: _jsxs(Button, { type: "submit", variant: "success", onClick: () => void navigate(decaysPath), className: "align-items-center d-flex gap-1", children: [_jsx(PlusLg, {}), " Select decays"] }) }), !hideUploadButtons && (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Upload Production configuration file" }), children: _jsx(Button, { className: "ms-auto align-items-center d-flex", type: "button", onClick: () => setShowProdUploadModal(true), children: _jsx(Upload, {}) }) })), showProdUploadModal && _jsx(UploadProdConfigModal, { onClose: () => setShowProdUploadModal(false) }), _jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Configure all DecayTreeTuples" }), children: _jsxs(Button, { type: "submit", variant: "secondary", onClick: () => {
|
|
113
113
|
handleSubmitRows().catch(console.error);
|
|
114
|
-
}, disabled: !allRowsHaveDtt, className: "align-items-center d-flex gap-1", children: [_jsx(GearWideConnected, {}), " ", _jsx(Badge, { pill: true, bg: "primary", children: configuredRows.length })] }) }), !hideDownloadButtons && (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Download Analysis Production configuration file (info.yaml)" }), children: _jsx(Button, { variant: "primary", type: "button", onClick: () => downloadText(YamlFile.createInfoYaml(rows, metadata)), disabled: !allRowsHaveDtt || !allRowsHavePaths || !isEmailValid, className: "align-items-center d-flex", children: _jsx(Download, {}) }) }))] }) }) }), _jsx(Row, { children: _jsxs(Col, { xs: 4, children: [_jsxs(InputGroup, { hasValidation: true, children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Name of this production. This will become the subdirectory in AnalysisProductions" }), children: _jsx(InputGroup.Text, { children: "Production name" }) }), _jsx(FormControl, { value: request.productionName, onChange: updateProductionName, isValid: !!request.productionName, placeholder: "MyAnalysis" })] }), !emailIsKnown && (_jsxs(InputGroup, { hasValidation: true, className: "mt-1", children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Email addresses to notify (comma-separated)" }), children: _jsx(InputGroup.Text, { children: "Email" }) }), _jsx(FormControl, { value: request.contactEmails.join(", "), onChange: updateContactEmails, isInvalid: !isEmailValid && request.contactEmails.length > 0, placeholder: "name@example.com" }), _jsx(FormControl.Feedback, { type: "invalid", children: "Please enter valid email addresses" })] })), _jsxs(Stack, { direction: "horizontal", gap: 1, className: "mt-3", children: [_jsx(SubmitRequestButton, {
|
|
115
|
-
|
|
116
|
-
!
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
}, disabled: !allRowsHaveDtt, className: "align-items-center d-flex gap-1", children: [_jsx(GearWideConnected, {}), " ", _jsx(Badge, { pill: true, bg: "primary", children: configuredRows.length })] }) }), !hideDownloadButtons && (_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Download Analysis Production configuration file (info.yaml)" }), children: _jsx(Button, { variant: "primary", type: "button", onClick: () => downloadText(YamlFile.createInfoYaml(rows, metadata)), disabled: !allRowsHaveDtt || !allRowsHavePaths || !isEmailValid, className: "align-items-center d-flex", children: _jsx(Download, {}) }) }))] }) }) }), _jsx(Row, { children: _jsxs(Col, { xs: 4, children: [_jsxs(InputGroup, { hasValidation: true, children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Name of this production. This will become the subdirectory in AnalysisProductions" }), children: _jsx(InputGroup.Text, { children: "Production name" }) }), _jsx(FormControl, { value: request.productionName, onChange: updateProductionName, isValid: !!request.productionName, placeholder: "MyAnalysis" })] }), !emailIsKnown && (_jsxs(InputGroup, { hasValidation: true, className: "mt-1", children: [_jsx(OverlayTrigger, { overlay: _jsx(Tooltip, { children: "Email addresses to notify (comma-separated)" }), children: _jsx(InputGroup.Text, { children: "Email" }) }), _jsx(FormControl, { value: request.contactEmails.join(", "), onChange: updateContactEmails, isInvalid: !isEmailValid && request.contactEmails.length > 0, placeholder: "name@example.com" }), _jsx(FormControl.Feedback, { type: "invalid", children: "Please enter valid email addresses" })] })), _jsxs(Stack, { direction: "horizontal", gap: 1, className: "mt-3", children: [_jsx(SubmitRequestButton, { disabledMessage: !allRowsHaveDtt
|
|
115
|
+
? "Please configure a DecayTreeTuple for each selected decay before submitting"
|
|
116
|
+
: !allRowsHavePaths
|
|
117
|
+
? "Please select at least one Bookkeeping path for each decay before submitting"
|
|
118
|
+
: !request.productionName
|
|
119
|
+
? "Please enter a production name before submitting"
|
|
120
|
+
: !(emailIsKnown || isEmailValid)
|
|
121
|
+
? "Please enter valid email addresses before submitting"
|
|
122
|
+
: !validDttNames
|
|
123
|
+
? "Please make sure all DecayTreeTuple names are unique before submitting"
|
|
124
|
+
: null, onSubmit: () => setRequestSubmitted(true), submitLocation: submitLocation, hideDownloadButtons: hideDownloadButtons, requestReasonMessage: requestReasonMessage, csrfToken: csrfToken }), _jsx(DeleteButton, { action: clearAll, disabled: isEmptySession, outline: undefined, children: "Clear all" })] })] }) })] }));
|
|
120
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lhcb-ntuple-wizard-test",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "An application to access large-scale open data from LHCb",
|
|
5
5
|
"url": "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend/issues",
|
|
6
6
|
"private": false,
|