lhcb-ntuple-wizard-test 1.3.3 → 2.0.0

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 (39) hide show
  1. package/README.md +1 -2
  2. package/package.json +42 -21
  3. package/dist/components/App.js +0 -99
  4. package/dist/components/ConfigDict.js +0 -103
  5. package/dist/components/ConfigList.js +0 -94
  6. package/dist/components/ConfigNode.js +0 -320
  7. package/dist/components/ConfigValue.js +0 -86
  8. package/dist/components/Dataset.js +0 -67
  9. package/dist/components/Decay.js +0 -50
  10. package/dist/components/DecayItem.js +0 -101
  11. package/dist/components/DecayTag.js +0 -52
  12. package/dist/components/DecayTree.js +0 -451
  13. package/dist/components/DecaysList.js +0 -107
  14. package/dist/components/DeleteButton.js +0 -56
  15. package/dist/components/DescriptorsSearch.js +0 -352
  16. package/dist/components/EventTypeBadge.js +0 -45
  17. package/dist/components/ItemSearch.js +0 -120
  18. package/dist/components/LinesTable.js +0 -1105
  19. package/dist/components/NtupleWizard.js +0 -142
  20. package/dist/components/ParticleTag.js +0 -54
  21. package/dist/components/PolarityBadge.js +0 -35
  22. package/dist/components/SearchItem.js +0 -99
  23. package/dist/components/SelectParticle.js +0 -61
  24. package/dist/components/SelectTag.js +0 -66
  25. package/dist/components/SelectTool.js +0 -59
  26. package/dist/components/SelectVariables.js +0 -106
  27. package/dist/components/StrippingBadge.js +0 -64
  28. package/dist/components/StrippingLine.js +0 -50
  29. package/dist/components/TupleTool.js +0 -46
  30. package/dist/components/VariablesSearch.js +0 -128
  31. package/dist/components/YearBadge.js +0 -35
  32. package/dist/config.json +0 -72
  33. package/dist/contexts/MetadataContext.js +0 -135
  34. package/dist/index.js +0 -20
  35. package/dist/lib/BKPath.js +0 -58
  36. package/dist/lib/DTTConfig.js +0 -178
  37. package/dist/lib/mathjax.js +0 -35
  38. package/dist/lib/utils.js +0 -191
  39. package/dist/style/DecaysList.css +0 -15
@@ -1,1105 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _emailValidator = _interopRequireDefault(require("email-validator"));
8
- var _jsYaml = _interopRequireDefault(require("js-yaml"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _reactBootstrap = require("react-bootstrap");
12
- var _reactBootstrapIcons = require("react-bootstrap-icons");
13
- var _reactRouterDom = require("react-router-dom");
14
- var _reactSelect = _interopRequireDefault(require("react-select"));
15
- var _creatable = _interopRequireDefault(require("react-select/creatable"));
16
- var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
17
- var _BKPath = _interopRequireDefault(require("../lib/BKPath"));
18
- var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
19
- var _utils = require("../lib/utils");
20
- var _Dataset = _interopRequireDefault(require("./Dataset"));
21
- var _Decay = _interopRequireDefault(require("./Decay"));
22
- var _DeleteButton = _interopRequireDefault(require("./DeleteButton"));
23
- var _StrippingLine = _interopRequireDefault(require("./StrippingLine"));
24
- var _jsxRuntime = require("react/jsx-runtime");
25
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
29
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
30
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
31
- * (c) Copyright 2021-2024 CERN for the benefit of the LHCb Collaboration *
32
- * *
33
- * This software is distributed under the terms of the GNU General Public *
34
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
35
- * *
36
- * In applying this licence, CERN does not waive the privileges and immunities *
37
- * granted to it by virtue of its status as an Intergovernmental Organization *
38
- * or submit itself to any jurisdiction. *
39
- \*****************************************************************************/
40
- function streamLinesToOption(row) {
41
- let opts = {};
42
- let streamArr = [];
43
- let lineArr = [];
44
- let groups = [];
45
- Object.keys(row.decay.lines).forEach(streamLine => {
46
- const [stream, line] = streamLine.split("/");
47
- streamArr.push(stream);
48
- lineArr.push(line);
49
- });
50
- const uniqStreamArr = [...new Set(streamArr)];
51
- uniqStreamArr.forEach(uniq => {
52
- opts[uniq] = [];
53
- lineArr.forEach((element, index) => {
54
- if (streamArr[index] === uniq) {
55
- let dup = false;
56
- const opt = {
57
- value: element,
58
- label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
59
- line: element,
60
- stream: uniq,
61
- versions: row.decay.lines[uniq + "/" + element]
62
- }),
63
- group: uniq
64
- };
65
- opts[uniq].forEach(obj => {
66
- if (obj["label"] === element) {
67
- dup = true;
68
- }
69
- });
70
- if (!dup) {
71
- opts[uniq].push(opt);
72
- }
73
- }
74
- });
75
- groups.push({
76
- label: uniq,
77
- options: opts[uniq]
78
- });
79
- });
80
- return groups;
81
- }
82
- function pathToOption(path) {
83
- return Object({
84
- value: path,
85
- label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dataset.default, {
86
- path: path
87
- })
88
- });
89
- }
90
- class LinesTable extends _react.default.Component {
91
- constructor(props) {
92
- super(props);
93
- _defineProperty(this, "state", {
94
- rows: this.props.rows.map(row => _objectSpread(_objectSpread({}, row), {}, {
95
- dtt: row.dtt ? new _DTTConfig.default(row.dtt, []) : false
96
- })),
97
- showUploadModal: false,
98
- showProdUploadModal: false,
99
- prodUploadLoading: false,
100
- modalID: -99,
101
- productionName: this.props.name,
102
- contactEmail: this.props.email,
103
- reasonForRequest: this.props.reasonForRequest,
104
- submitLocation: this.props.submitLocation,
105
- hideDownloadButtons: this.props.hideDownloadButtons,
106
- hideUploadButtons: this.props.hideUploadButtons,
107
- requestLoading: false,
108
- requestSubmitted: false,
109
- emailIsKnown: this.props.emailIsKnown,
110
- csrfToken: this.props.csrfToken,
111
- showReasonForRequestModal: false,
112
- requestReasonMessage: this.props.requestReasonMessage,
113
- requestSubmittedMessage: this.props.requestSubmittedMessage
114
- });
115
- _defineProperty(this, "handleSubmitRows", history => {
116
- let rows = [...this.state.rows];
117
- rows.forEach(row => {
118
- row.editTree = true;
119
- });
120
- this.props.parentCallbackRows(rows);
121
- this.props.parentCallbackInfo(this.state.productionName, this.state.contactEmail, this.state.reasonForRequest);
122
- history.push(this.propsVar.variablesPath);
123
- });
124
- _defineProperty(this, "handleSubmitSpecificRow", (history, idx) => {
125
- let rows = [...this.state.rows];
126
- rows.forEach(row => {
127
- row.editTree = row.id === idx;
128
- });
129
- this.props.parentCallbackRows(rows);
130
- this.props.parentCallbackInfo(this.state.productionName, this.state.contactEmail, this.state.reasonForRequest);
131
- history.push(this.propsVar.variablesPath);
132
- });
133
- _defineProperty(this, "handleAddRow", history => {
134
- let rows = [...this.state.rows];
135
- this.props.parentCallbackRows(rows);
136
- this.props.parentCallbackInfo(this.state.productionName, this.state.contactEmail, this.state.reasonForRequest);
137
- history.push(this.propsVar.decaysPath);
138
- });
139
- _defineProperty(this, "handleRemoveSpecificRow", id => () => {
140
- let rows = [...this.state.rows];
141
- rows = rows.filter(row => row.id !== id);
142
- this.setState({
143
- rows
144
- });
145
- this.props.parentCallbackRows(rows);
146
- });
147
- _defineProperty(this, "handleRemoveSpecificRowDTT", id => () => {
148
- let rows = [...this.state.rows];
149
- const index = this.state.rows.findIndex(item => item.id === id);
150
- rows[index].dtt = false;
151
- this.setState({
152
- rows
153
- });
154
- this.props.parentCallbackRows(rows);
155
- });
156
- _defineProperty(this, "handleCreateDTT", id => () => {
157
- let rows = [...this.state.rows];
158
- const index = this.state.rows.findIndex(item => item.id === id);
159
- rows[index].dtt = _DTTConfig.default.createDTT(rows[index].decay.descriptors.template, rows[index].decay.descriptors.mapped_list.flat(Infinity), [], "", this.context.metadata.tupleTools.tupleTools);
160
- this.setInputs(id, rows[index].lines);
161
- this.setState({
162
- rows
163
- });
164
- this.props.parentCallbackRows(rows);
165
- });
166
- _defineProperty(this, "validateDTTIsSetForAllRows", () => {
167
- return this.state.rows.every(row => row.dtt);
168
- });
169
- _defineProperty(this, "setInputs", (id, lines) => {
170
- let rows = [...this.state.rows];
171
- const index = this.state.rows.findIndex(item => item.id === id);
172
- const inputs = lines.map(_ref => {
173
- let {
174
- stream,
175
- line
176
- } = _ref;
177
- const lineLocation = String(line).replace("Stripping", "");
178
- return "/Event/".concat(stream, "/Phys/").concat(lineLocation, "/Particles");
179
- });
180
- rows[index].dtt.setInputs(inputs);
181
- this.setState({
182
- rows
183
- });
184
- this.props.parentCallbackRows(rows);
185
- });
186
- _defineProperty(this, "changeSelStrLines", id => choices => {
187
- let rows = [...this.state.rows];
188
- const index = this.state.rows.findIndex(item => item.id === id); // All choices have the same value (row.id)
189
-
190
- if (choices.length > 1) {
191
- 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.");
192
- choices.pop();
193
- }
194
- rows[index].lines = choices.map(choice => Object({
195
- stream: choice.group,
196
- line: choice.value,
197
- versions: this.state.rows[index].decay.lines[choice.group + "/" + choice.value]
198
- }));
199
- this.setState({
200
- rows
201
- });
202
- this.pathChoiceHandler(id)(rows[index].paths.map(path => ({
203
- value: path
204
- })));
205
- if (rows[index].dtt) {
206
- this.setInputs(id, rows[index].lines);
207
- }
208
- });
209
- _defineProperty(this, "validatePath", (choice, lines) => {
210
- const path = new _BKPath.default(choice);
211
- if (!path.isValid()) {
212
- return false;
213
- }
214
- return lines.every(line => {
215
- const streamName = line.stream.toLowerCase();
216
- const filename = path.getFilename().split(".")[0].toLowerCase();
217
- const matchingVersion = line.versions.some(version => path.getStrippingVersion() === version);
218
- return ["allstreams", streamName].includes(filename) && matchingVersion;
219
- });
220
- });
221
- _defineProperty(this, "pathChoiceHandler", id => choices => {
222
- let rows = [...this.state.rows];
223
- const index = this.state.rows.findIndex(item => item.id === id); // All choices have the same value (row.id)
224
- const validPaths = choices.filter(choice => this.validatePath(choice.value, this.state.rows[index].lines)).map(choice => choice.value);
225
- const validPathOptions = rows[index].pathOptions.filter(choice => this.validatePath(choice, this.state.rows[index].lines));
226
- rows[index].paths = validPaths;
227
- rows[index].pathOptions = validPathOptions;
228
- this.setState({
229
- rows
230
- });
231
- this.props.parentCallbackRows(rows);
232
- });
233
- _defineProperty(this, "pathCreateHandler", id => choice => {
234
- let rows = [...this.state.rows];
235
- const index = this.state.rows.findIndex(item => item.id === id); // All choices have the same value (row.id)
236
- if (this.validatePath(choice.value, this.state.rows[index].lines)) {
237
- rows[index].paths.push(choice.value);
238
- rows[index].pathOptions.push(choice.value);
239
- }
240
- this.setState({
241
- rows
242
- });
243
- });
244
- _defineProperty(this, "setRowName", id => _ref2 => {
245
- let {
246
- target
247
- } = _ref2;
248
- let rows = [...this.state.rows];
249
- const index = this.state.rows.findIndex(item => item.id === id);
250
- rows[index].dtt.setName(target.value);
251
- this.setState({
252
- rows
253
- });
254
- this.props.parentCallbackRows(rows);
255
- });
256
- _defineProperty(this, "setProductionName", _ref3 => {
257
- let {
258
- target
259
- } = _ref3;
260
- const safeName = target.value.replaceAll(/[^\w]/g, "");
261
- this.setState({
262
- productionName: safeName
263
- });
264
- this.props.parentCallbackInfo(safeName, this.state.contactEmail, this.state.reasonForRequest);
265
- });
266
- _defineProperty(this, "setContactEmail", _ref4 => {
267
- let {
268
- target
269
- } = _ref4;
270
- const emails = target.value.split(/[\s,]+/);
271
- this.setState({
272
- contactEmail: emails
273
- });
274
- const validEmails = emails.filter(email => _emailValidator.default.validate(email));
275
- this.props.parentCallbackInfo(this.state.productionName, validEmails, this.state.reasonForRequest);
276
- });
277
- _defineProperty(this, "setReasonForRequest", _ref5 => {
278
- let {
279
- target
280
- } = _ref5;
281
- const reasonForRequest = target.value;
282
- this.setState({
283
- reasonForRequest: reasonForRequest
284
- });
285
- this.props.parentCallbackInfo(this.state.productionName, this.state.contactEmail, reasonForRequest);
286
- });
287
- _defineProperty(this, "clearAll", () => {
288
- this.setState({
289
- productionName: "",
290
- contactEmail: [],
291
- rows: [],
292
- reasonForRequest: ""
293
- });
294
- this.props.parentCallbackRows([]);
295
- this.props.parentCallbackInfo("", [], "");
296
- });
297
- _defineProperty(this, "getBKPaths", id => {
298
- const index = this.state.rows.findIndex(item => item.id === id);
299
- const row = this.state.rows[index];
300
- const options = row.paths.map(path => pathToOption(path));
301
- return options;
302
- });
303
- _defineProperty(this, "defaultBKPaths", id => {
304
- const index = this.state.rows.findIndex(item => item.id === id);
305
- const row = this.state.rows[index];
306
- const defaultOptions = this.context.loaded.dataset ? this.context.metadata.dataset.filter(path => this.validatePath(path, row.lines)).map(path => pathToOption(path)) : [];
307
- const options = row.pathOptions.map(path => pathToOption(path));
308
- return [].concat(defaultOptions, options);
309
- });
310
- _defineProperty(this, "createInfoYaml", () => {
311
- const rows = [...this.state.rows];
312
- const uniquePaths = new Set([].concat(...rows.map(row => row.paths)));
313
- const uniquePathList = [...uniquePaths].sort();
314
- let info = {
315
- defaults: {
316
- application: "DaVinci/" + this.context.metadata.tupleTools.applicationInfo["DaVinci"],
317
- wg: "OpenData",
318
- // TODO: get input from (LHCb) user. keep "OpenData" if open data
319
- inform: [],
320
- automatically_configure: true,
321
- output: "DVNtuple.root" // Probably okay to leave this as the default
322
- }
323
- };
324
- rows.forEach(row => {
325
- row.paths.forEach((path, _index) => {
326
- const jobID = uniquePathList.findIndex(otherPath => otherPath === path);
327
- const key = "job".concat(jobID);
328
- const dttFile = row.dtt.getSafeName();
329
- if (key in info) {
330
- info[key].options.push(dttFile);
331
- } else {
332
- info[key] = {
333
- input: {
334
- bk_query: path
335
- },
336
- options: [dttFile] // TODO: figure out the actual syntax that AnaProd needs to indicate that this is to be parsed into a DecayTreeTuple
337
- };
338
- if (path.includes("MDST")) {
339
- const stream = row.lines[0].stream; // XXX: in the validation we enforce that each BK location be compatible with every line, so effectively forcing one stream per row
340
- info[key].root_in_tes = "/Event/".concat(stream);
341
- }
342
- }
343
- });
344
- });
345
- return info;
346
- });
347
- _defineProperty(this, "uploadConfig", (e, id) => {
348
- let rows = [...this.state.rows];
349
- const index = this.state.rows.findIndex(item => item.id === id);
350
- e.preventDefault();
351
- const reader = new FileReader();
352
- reader.onload = async e => {
353
- const text = e.target.result;
354
- const config = _jsYaml.default.load(text);
355
- if (config.descriptorTemplate === rows[index].decay.descriptors.template) {
356
- rows[index].dtt = new _DTTConfig.default(config, []);
357
- this.setInputs(id, rows[index].lines);
358
- this.setState({
359
- rows,
360
- showUploadModal: false
361
- });
362
- this.props.parentCallbackRows(rows);
363
- } else {
364
- alert("Make sure to upload a previously downloaded configuration file for the same decay.");
365
- }
366
- };
367
- reader.readAsText(e.target.files[0]);
368
- });
369
- _defineProperty(this, "uploadProductionConfig", async (e, isClone) => {
370
- let rows = [];
371
- let decays = Object.values(this.context.metadata.decays);
372
- let email = [];
373
- //let descriptorTemplates = decays.descriptors.template
374
-
375
- let filelist = e.target.files || [];
376
- let files = [].slice.call(filelist);
377
- if (files.length) {
378
- for (let index = 0; index < files.length; index++) {
379
- if (files[index].name === "info.yaml") {
380
- files.push(files.splice(index, 1)[0]);
381
- break;
382
- }
383
- }
384
- for (let index = 0; index < files.length; index++) {
385
- let text;
386
- if (isClone) {
387
- text = await this.readFileAsync(files[index].blob);
388
- } else {
389
- text = await this.readFileAsync(files[index]);
390
- }
391
- const config = _jsYaml.default.load(text);
392
- if (files[index].name !== "info.yaml") {
393
- decays.forEach(decay => {
394
- if (config.descriptorTemplate === decay.descriptors.template) {
395
- let row = Object({
396
- id: index,
397
- decay: decay,
398
- lines: config.inputs.map(input => Object({
399
- stream: input.split("/")[2],
400
- line: "Stripping" + input.split("/")[4],
401
- versions: decay.lines[input.split("/")[2] + "/" + "Stripping" + input.split("/")[4]]
402
- })),
403
- paths: [],
404
- // Currently-selected paths
405
- pathOptions: [],
406
- // Keep a history of valid paths
407
- dtt: new _DTTConfig.default(config, [])
408
- });
409
- rows.push(row);
410
- }
411
- });
412
- } else {
413
- rows.forEach(row => {
414
- Object.keys(config).forEach(job => {
415
- if (job !== "defaults" && job !== "name" && job !== "blob") {
416
- config[job].options.forEach(option => {
417
- let optionName = option.split(".")[0];
418
- let dttname = row.dtt.config.name.split("/")[1];
419
- if (optionName === dttname) {
420
- row.paths.push(config[job].input.bk_query);
421
- }
422
- });
423
- }
424
- });
425
- });
426
- }
427
- }
428
- }
429
- this.setState({
430
- rows: rows
431
- });
432
- if (!isClone) {
433
- this.setState({
434
- contactEmail: email
435
- });
436
- }
437
- this.props.parentCallbackRows(rows);
438
- this.props.parentCallbackInfo(this.state.productionName, this.state.contactEmail, this.state.reasonForRequest);
439
- // this.handleCloseProdUploadModal();
440
- });
441
- _defineProperty(this, "readFileAsync", file => {
442
- return new Promise((resolve, reject) => {
443
- const reader = new FileReader();
444
- reader.onload = function () {
445
- resolve(reader.result);
446
- };
447
- reader.onerror = function (error) {
448
- reject(error);
449
- };
450
- reader.readAsText(file);
451
- });
452
- });
453
- _defineProperty(this, "handleShowUploadModal", id => {
454
- this.setState({
455
- showUploadModal: true,
456
- modalID: id
457
- });
458
- });
459
- _defineProperty(this, "handleCloseUploadModal", () => {
460
- this.setState({
461
- showUploadModal: false
462
- });
463
- });
464
- _defineProperty(this, "handleShowProdUploadModal", () => {
465
- this.setState({
466
- showProdUploadModal: true
467
- });
468
- });
469
- _defineProperty(this, "handleCloseProdUploadModal", () => {
470
- this.setState({
471
- showProdUploadModal: false
472
- });
473
- });
474
- _defineProperty(this, "processSubmission", () => {
475
- if (this.state.submitLocation) {
476
- this.setState({
477
- showReasonForRequestModal: true
478
- });
479
- } else {
480
- this.downloadAll();
481
- }
482
- });
483
- _defineProperty(this, "downloadAll", () => {
484
- const allFiles = this.generateAllFiles();
485
- return (0, _utils.downloadZip)(allFiles, "".concat(this.state.productionName, ".zip"));
486
- });
487
- _defineProperty(this, "generateAllFiles", () => {
488
- return [...this.state.rows.map(row => ["".concat(row.dtt.getSafeName(), ".yaml"), _jsYaml.default.dump(row.dtt.config)]), ["info.yaml", _jsYaml.default.dump(this.createInfoYaml())]];
489
- });
490
- _defineProperty(this, "submitRequest", url => {
491
- this.setState({
492
- requestLoading: true,
493
- showReasonForRequestModal: false,
494
- requestError: "",
495
- requestSubmitted: false
496
- });
497
- const allFiles = this.generateAllFiles();
498
- const formData = new FormData();
499
- allFiles.forEach(file => {
500
- formData.append("generatedFiles[]", new Blob([file[1]], {
501
- type: "text/plain"
502
- }), file[0]);
503
- });
504
- formData.append("email", localStorage.getItem("email") || "");
505
- formData.append("name", this.state.productionName);
506
- formData.append("reasonForRequest", this.state.reasonForRequest);
507
- let headers = {};
508
- if (this.state.csrfToken !== "") {
509
- headers = {
510
- "X-Csrf-Token": this.state.csrfToken
511
- };
512
- }
513
- fetch(url, {
514
- method: "POST",
515
- body: formData,
516
- credentials: "include",
517
- headers: headers
518
- }).then(response => {
519
- if (!response.ok) {
520
- throw new Error("HTTP error! Status: ".concat(response.status));
521
- }
522
- this.setState({
523
- requestLoading: false,
524
- requestSubmitted: true
525
- });
526
- }).catch(error => {
527
- console.error("Fetch error:", error);
528
- this.setState({
529
- requestLoading: false,
530
- requestError: "Something went wrong while submitting your request. Please try again later or contact support."
531
- });
532
- });
533
- });
534
- _defineProperty(this, "handleShowReasonForRequestModal", () => {
535
- this.setState({
536
- showReasonForRequestModal: true
537
- });
538
- });
539
- _defineProperty(this, "handleCloseReasonForRequestModal", () => {
540
- this.setState({
541
- showReasonForRequestModal: false
542
- });
543
- });
544
- _defineProperty(this, "dismissSubmitSuccess", () => {
545
- this.setState({
546
- requestSubmitted: false
547
- });
548
- });
549
- _defineProperty(this, "dismissSubmitError", () => {
550
- this.setState({
551
- requestError: ""
552
- });
553
- });
554
- this.propsVar = this.props;
555
- }
556
- componentDidMount() {
557
- const urlParams = new URLSearchParams(window.location.search);
558
- const isCloneParam = urlParams.get("clone");
559
- if (isCloneParam === "1") {
560
- if (!localStorage.getItem("yamlFilesToClone")) {
561
- window.history.replaceState({}, document.title, window.location.pathname);
562
- return;
563
- }
564
- this.setState({
565
- prodUploadLoading: true,
566
- rows: []
567
- });
568
- let files = JSON.parse(localStorage.getItem("yamlFilesToClone"));
569
- for (let i = 0; i < files.length; i++) {
570
- if (files[i].defaults) {
571
- files[i].name = "info.yaml";
572
- }
573
- files[i].blob = new Blob([_jsYaml.default.dump(files[i])]);
574
- }
575
- this.uploadProductionConfig({
576
- target: {
577
- files
578
- }
579
- }, true);
580
- setTimeout(() => {
581
- this.uploadProductionConfig({
582
- target: {
583
- files
584
- }
585
- }, true);
586
- this.setState({
587
- prodUploadLoading: false
588
- });
589
- localStorage.removeItem("yamlFilesToClone");
590
- }, 5000);
591
- }
592
- }
593
- render() {
594
- const emptySession = !this.state.productionName && this.state.contactEmail.length === 0 && this.state.rows.length === 0;
595
- const validEmail = this.state.contactEmail.length > 0 && this.state.contactEmail.every(email => _emailValidator.default.validate(email));
596
- const nRows = this.state.rows.filter(row => row.dtt).length;
597
- const ready = nRows > 0 && nRows === this.state.rows.length;
598
- const readyPaths = this.state.rows.every(row => row.paths.length > 0);
599
-
600
- // add a check for each row to see if it has an empty name or if it has a name that is not unique
601
- const hasValidNames = this.state.rows.every(row => {
602
- const safeName = row.dtt ? row.dtt.getSafeName() : "";
603
- const allSafeNames = this.state.rows.filter(otherRow => otherRow.dtt).map(otherRow => otherRow.dtt.getSafeName());
604
- return safeName.trim().length > 0 && allSafeNames.filter(name => name === safeName).length === 1;
605
- });
606
- const tableContent = this.state.rows.map(row => {
607
- const safeName = row.dtt ? row.dtt.getSafeName() : "";
608
- const allSafeNames = this.state.rows.filter(otherRow => otherRow.dtt).map(otherRow => otherRow.dtt.getSafeName());
609
- const hasValidName = safeName.trim().length > 0 && allSafeNames.filter(name => name === safeName).length === 1;
610
- const urls = row.lines.map(strline => /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
611
- line: strline.line,
612
- stream: strline.stream,
613
- versions: strline.versions,
614
- showlink: true
615
- }, "".concat(strline.line)));
616
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Row, {
617
- className: "align-items-center",
618
- style: {
619
- marginBottom: 10
620
- },
621
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
622
- lg: true,
623
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card, {
624
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Header, {
625
- className: "d-flex justify-content-between align-items-start",
626
- children: [row.dtt ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
627
- hasValidation: true,
628
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
629
- placeholder: "DecayTree",
630
- value: row.dtt.getName(),
631
- onChange: this.setRowName(row.id),
632
- isInvalid: !hasValidName
633
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl.Feedback, {
634
- type: "invalid",
635
- children: row.dtt.getName().trim() === "" ? "Name cannot be empty" : "Must give a unique name"
636
- })]
637
- }) : "", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
638
- children: row.dtt ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
639
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
640
- render: _ref6 => {
641
- let {
642
- history
643
- } = _ref6;
644
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
645
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
646
- children: "Configure this DecayTreeTuple"
647
- }),
648
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
649
- type: "submit",
650
- variant: "secondary",
651
- onClick: () => {
652
- this.handleSubmitSpecificRow(history, row.id);
653
- },
654
- disabled: !hasValidName && !this.context.loaded.tupleTools,
655
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PencilSquare, {})
656
- })
657
- });
658
- }
659
- }), this.state.hideDownloadButtons ? "" : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
660
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
661
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
662
- children: "Download DecayTreeTuple YAML configuration file"
663
- }),
664
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
665
- className: "ms-auto",
666
- type: "button",
667
- onClick: () => {
668
- (0, _utils.download)(_jsYaml.default.dump(row.dtt.config), "".concat(row.dtt.getSafeName(), ".yaml"));
669
- },
670
- disabled: !hasValidName,
671
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Download, {})
672
- })
673
- })
674
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
675
- action: this.handleRemoveSpecificRowDTT(row.id)
676
- })]
677
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
678
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
679
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
680
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
681
- children: "Please add a DecayTreeTuple in order to complete the production configuration"
682
- }),
683
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.ExclamationCircle, {
684
- width: 20,
685
- height: 20,
686
- style: {
687
- verticalAlign: "middle"
688
- },
689
- className: "text-danger me-2"
690
- })
691
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
692
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
693
- children: "Add a DecayTreeTuple"
694
- }),
695
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
696
- type: "submit",
697
- variant: "success",
698
- onClick: this.handleCreateDTT(row.id),
699
- disabled: !this.context.loaded.tupleTools,
700
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
701
- })
702
- }), !this.state.hideUploadButtons && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
703
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
704
- children: "Upload DecayTreeTuple configuration file"
705
- }),
706
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
707
- className: "ms-auto",
708
- type: "button",
709
- onClick: () => {
710
- this.handleShowUploadModal(row.id);
711
- },
712
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Upload, {})
713
- })
714
- })]
715
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal, {
716
- show: this.state.showUploadModal,
717
- animation: false,
718
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Header, {
719
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Title, {
720
- children: " Upload configuration file "
721
- })
722
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Body, {
723
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Group, {
724
- controlId: "formFile1",
725
- className: "mb-3",
726
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
727
- type: "file",
728
- onChange: event => {
729
- this.uploadConfig(event, this.state.modalID);
730
- }
731
- //onClick={(event) => {
732
- // event.target.value = null;
733
- //}}
734
- })
735
- })
736
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Footer, {
737
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
738
- variant: "secondary",
739
- onClick: this.handleCloseUploadModal,
740
- children: "Close"
741
- })
742
- })]
743
- })]
744
- })
745
- })]
746
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card.Body, {
747
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Decay.default, {
748
- decay: row.decay,
749
- display: false
750
- })
751
- })]
752
- })
753
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
754
- lg: true,
755
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
756
- isMulti: true,
757
- options: streamLinesToOption(row),
758
- defaultValue: row.lines.map(lineInfo => Object({
759
- value: lineInfo.line,
760
- label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
761
- line: lineInfo.line,
762
- stream: lineInfo.stream,
763
- versions: lineInfo.versions,
764
- showlink: false
765
- }),
766
- group: lineInfo.stream
767
- })),
768
- placeholder: "Stripping line",
769
- onChange: this.changeSelStrLines(row.id)
770
- })
771
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
772
- xs: "auto",
773
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
774
- trigger: "click",
775
- placement: "right",
776
- rootClose: true,
777
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
778
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
779
- children: urls
780
- })
781
- }),
782
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
783
- className: "ms-auto",
784
- type: "button",
785
- disabled: urls.length === 0,
786
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.QuestionCircle, {})
787
- })
788
- })
789
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
790
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_creatable.default, {
791
- isMulti: true,
792
- options: this.defaultBKPaths(row.id) /*TODO: use ODP records when ready*/,
793
- value: this.getBKPaths(row.id),
794
- isDisabled: row.lines.length === 0,
795
- placeholder: "Bookkeeping path",
796
- onChange: this.pathChoiceHandler(row.id),
797
- onCreateOption: this.pathCreateHandler(row.id),
798
- closeMenuOnSelect: false
799
- })
800
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
801
- xs: "auto",
802
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
803
- action: this.handleRemoveSpecificRow(row.id)
804
- })
805
- })]
806
- }, row.id);
807
- });
808
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
809
- children: [tableContent, this.state.requestLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
810
- animation: "border",
811
- role: "status",
812
- className: "mt-1 mb-2"
813
- }) : "", this.state.prodUploadLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
814
- className: "mt-3",
815
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
816
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
817
- variant: "primary",
818
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Row, {
819
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
820
- xs: 1,
821
- style: {
822
- width: "50px",
823
- verticalAlign: "middle"
824
- },
825
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
826
- animation: "border",
827
- role: "status",
828
- className: "mt-1 mb-2"
829
- })
830
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Col, {
831
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert.Heading, {
832
- children: "Uploading configuration files..."
833
- }), "Please wait while the cloned configuration files are being uploaded."]
834
- })]
835
- })
836
- })
837
- })
838
- }) : "", this.state.requestSubmitted ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
839
- className: "mt-3",
840
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
841
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
842
- variant: "success",
843
- dismissible: true,
844
- onClose: this.dismissSubmitSuccess,
845
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert.Heading, {
846
- children: "Request submitted!"
847
- }), this.state.requestSubmittedMessage]
848
- })
849
- })
850
- }) : "", this.state.requestError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
851
- className: "mt-3",
852
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
853
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
854
- variant: "danger",
855
- dismissible: true,
856
- onClose: this.dismissSubmitError,
857
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert.Heading, {
858
- children: "An error occurred!"
859
- }), this.state.requestError]
860
- })
861
- })
862
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
863
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
864
- xs: "auto",
865
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
866
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
867
- render: _ref7 => {
868
- let {
869
- history
870
- } = _ref7;
871
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
872
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
873
- children: "Select decays"
874
- }),
875
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
876
- type: "submit",
877
- variant: "success",
878
- onClick: () => this.handleAddRow(history),
879
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
880
- style: {
881
- verticalAlign: "middle"
882
- },
883
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {}), " Select decays"]
884
- })
885
- })
886
- });
887
- }
888
- }), !this.state.hideUploadButtons && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
889
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
890
- children: "Upload Production configuration file"
891
- }),
892
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
893
- className: "ms-auto",
894
- type: "button",
895
- onClick: () => {
896
- this.handleShowProdUploadModal();
897
- },
898
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Upload, {})
899
- })
900
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal, {
901
- show: this.state.showProdUploadModal,
902
- animation: false,
903
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Header, {
904
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Title, {
905
- children: " Upload configuration file "
906
- })
907
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Body, {
908
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Group, {
909
- controlId: "formFile2",
910
- className: "mb-3",
911
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
912
- type: "file",
913
- multiple: true,
914
- onChange: event => {
915
- this.uploadProductionConfig(event);
916
- }
917
- //onClick={(event) => {
918
- // event.target.value = null;
919
- //}}
920
- })
921
- })
922
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Footer, {
923
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
924
- variant: "secondary",
925
- onClick: this.handleCloseProdUploadModal,
926
- children: "Close"
927
- })
928
- })]
929
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
930
- render: _ref8 => {
931
- let {
932
- history
933
- } = _ref8;
934
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
935
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
936
- children: "Configure all DecayTreeTuples"
937
- }),
938
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
939
- type: "submit",
940
- variant: "secondary",
941
- onClick: () => this.handleSubmitRows(history),
942
- disabled: !ready,
943
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PencilSquare, {}), " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
944
- pill: true,
945
- bg: "primary",
946
- children: nRows
947
- })]
948
- })
949
- });
950
- }
951
- }), this.state.hideDownloadButtons ? "" : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
952
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
953
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
954
- children: "Download Analysis Production configuration file (info.yaml)"
955
- }),
956
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
957
- type: "download",
958
- onClick: () => (0, _utils.download)(_jsYaml.default.dump(this.createInfoYaml()), "info.yaml"),
959
- disabled: !ready || !readyPaths || !validEmail,
960
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Download, {})
961
- })
962
- })
963
- })]
964
- })
965
- })
966
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
967
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Col, {
968
- xs: 4,
969
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
970
- hasValidation: true,
971
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
972
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
973
- children: "Name of this production. This will become the subdirectory in AnalysisProductions"
974
- }),
975
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
976
- children: "Production name"
977
- })
978
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
979
- value: this.state.productionName,
980
- onChange: this.setProductionName,
981
- isValid: this.state.productionName,
982
- placeholder: "MyAnalysis"
983
- })]
984
- }), this.state.emailIsKnown ? "" : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
985
- hasValidation: true,
986
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
987
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
988
- children: "Email addresses to notify (comma-separated)"
989
- }),
990
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
991
- children: "Email"
992
- })
993
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
994
- type: "email",
995
- value: this.state.contactEmail.join(","),
996
- onChange: this.setContactEmail,
997
- isValid: validEmail,
998
- placeholder: "name@example.com"
999
- })]
1000
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
1001
- children: [this.state.hideDownloadButtons ? "" : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1002
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
1003
- overlay: this.validateDTTIsSetForAllRows() ? !ready || !readyPaths || !this.state.productionName || !(this.state.emailIsKnown ? true : validEmail) || !hasValidNames ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1004
- children: "Please make sure all fields are filled in before downloading"
1005
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1006
- children: "Download all DecayTreeTuple configurations"
1007
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1008
- children: "Please configure a DecayTreeTuple for each selected decay before downloading"
1009
- }),
1010
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1011
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
1012
- disabled: !ready || !readyPaths || !this.state.productionName || !(this.state.emailIsKnown ? true : validEmail) || !hasValidNames,
1013
- onClick: this.downloadAll,
1014
- type: "info",
1015
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Download, {}), " Download"]
1016
- })
1017
- })
1018
- })
1019
- }), this.state.submitLocation ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1020
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
1021
- overlay: this.validateDTTIsSetForAllRows() ? !ready || !readyPaths || !this.state.productionName || !(this.state.emailIsKnown ? true : validEmail) || !hasValidNames ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1022
- children: "Please make sure all fields are filled in before submitting"
1023
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1024
- children: "Submit a request with the chosen configuration"
1025
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1026
- children: "Please configure a DecayTreeTuple for each selected decay before submitting"
1027
- }),
1028
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1029
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
1030
- disabled: !ready || !readyPaths || !this.state.productionName || !(this.state.emailIsKnown ? true : validEmail) || !hasValidNames,
1031
- onClick: this.handleShowReasonForRequestModal,
1032
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Send, {}), " Submit"]
1033
- })
1034
- })
1035
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal, {
1036
- show: this.state.showReasonForRequestModal,
1037
- onHide: this.handleCloseReasonForRequestModal,
1038
- size: "lg",
1039
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Header, {
1040
- closeButton: true,
1041
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Title, {
1042
- children: "Reason for request"
1043
- })
1044
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal.Body, {
1045
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
1046
- children: this.state.requestReasonMessage
1047
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
1048
- hasValidation: true,
1049
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
1050
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
1051
- children: "Reason for requesting the chosen ntuples"
1052
- }),
1053
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
1054
- children: "Reason for request"
1055
- })
1056
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
1057
- as: "textarea",
1058
- rows: 3,
1059
- value: this.state.reasonForRequest,
1060
- onChange: this.setReasonForRequest,
1061
- isValid: this.state.reasonForRequest,
1062
- placeholder: "I need these ntuples for..."
1063
- })]
1064
- })]
1065
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Footer, {
1066
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
1067
- variant: "primary",
1068
- onClick: () => this.submitRequest(this.state.submitLocation),
1069
- disabled: !ready || !readyPaths || !this.state.productionName || !this.state.reasonForRequest || !(this.state.emailIsKnown ? true : validEmail) || !hasValidNames,
1070
- children: "Submit request"
1071
- })
1072
- })]
1073
- })]
1074
- }) : "", /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
1075
- action: this.clearAll,
1076
- disabled: emptySession,
1077
- children: "Clear"
1078
- })]
1079
- })]
1080
- })
1081
- })]
1082
- });
1083
- }
1084
- }
1085
- _defineProperty(LinesTable, "contextType", _MetadataContext.default);
1086
- LinesTable.propTypes = {
1087
- rows: _propTypes.default.arrayOf(_propTypes.default.object),
1088
- name: _propTypes.default.string,
1089
- email: _propTypes.default.arrayOf(_propTypes.default.string),
1090
- reasonForRequest: _propTypes.default.string,
1091
- parentCallbackInfo: _propTypes.default.func,
1092
- parentCallbackRows: _propTypes.default.func,
1093
- decaysPath: _propTypes.default.string.isRequired,
1094
- submitLocation: _propTypes.default.string,
1095
- hideDownloadButtons: _propTypes.default.bool,
1096
- hideUploadButtons: _propTypes.default.bool,
1097
- emailIsKnown: _propTypes.default.bool,
1098
- requestReasonMessage: _propTypes.default.string,
1099
- requestSubmittedMessage: _propTypes.default.object,
1100
- csrfToken: _propTypes.default.string
1101
- };
1102
- LinesTable.defaultProps = {
1103
- csrfToken: ""
1104
- };
1105
- var _default = exports.default = LinesTable;