| 1572 | const currentId = button.dataset.id; |
| 1573 | |
| 1574 | const create = () => { |
| 1575 | let requestUrl = OC.generateUrl('apps/analytics/threshold'); |
| 1576 | fetch(requestUrl, { |
| 1577 | method: 'POST', |
| 1578 | headers: OCA.Analytics.headers(), |
| 1579 | body: JSON.stringify({ |
| 1580 | reportId: reportId, |
| 1581 | dimension: document.getElementById('thresholdDimension').value, |
| 1582 | option: document.getElementById('thresholdOption').value, |
| 1583 | value: document.getElementById('thresholdValue').value, |
| 1584 | severity: document.getElementById('thresholdSeverity').value, |
| 1585 | coloring: document.getElementById('thresholdColoring').value, |
| 1586 | }) |
| 1587 | }) |
| 1588 | .then(response => response.json()) |
| 1589 | .then(data => { |
| 1590 | delete button.dataset.id; |
| 1591 | OCA.Analytics.Threshold.getThreholdList(reportId); |
| 1592 | OCA.Analytics.Threshold.resetThresholdInputs(); |
| 1593 | if (!OCA.Analytics.isDataset) { |
| 1594 | OCA.Analytics.Report.resetContentArea(); |
| 1595 | OCA.Analytics.Report.Backend.getData(); |
| 1596 | } |
| 1597 | }); |
| 1598 | }; |
| 1599 | |
| 1600 | if (currentId) { |
| 1601 | let delUrl = OC.generateUrl('apps/analytics/threshold/') + currentId; |