| 1719 | const currentId = button.dataset.id; |
| 1720 | |
| 1721 | const create = () => { |
| 1722 | let requestUrl = OC.generateUrl('apps/analytics/threshold'); |
| 1723 | fetch(requestUrl, { |
| 1724 | method: 'POST', |
| 1725 | headers: OCA.Analytics.headers(), |
| 1726 | body: JSON.stringify({ |
| 1727 | reportId: reportId, |
| 1728 | dimension: document.getElementById('thresholdDimension').value, |
| 1729 | option: document.getElementById('thresholdOption').value, |
| 1730 | value: document.getElementById('thresholdValue').value, |
| 1731 | severity: document.getElementById('thresholdSeverity').value, |
| 1732 | coloring: document.getElementById('thresholdColoring').value, |
| 1733 | }) |
| 1734 | }) |
| 1735 | .then(response => response.json()) |
| 1736 | .then(data => { |
| 1737 | delete button.dataset.id; |
| 1738 | OCA.Analytics.Threshold.getThreholdList(reportId); |
| 1739 | OCA.Analytics.Threshold.resetThresholdInputs(); |
| 1740 | if (!OCA.Analytics.isDataset) { |
| 1741 | OCA.Analytics.Report.resetContentArea(); |
| 1742 | OCA.Analytics.Report.Backend.getData(); |
| 1743 | } |
| 1744 | }); |
| 1745 | }; |
| 1746 | |
| 1747 | if (currentId) { |
| 1748 | let delUrl = OC.generateUrl('apps/analytics/threshold/') + currentId; |