| Index: dashboard/dashboard/elements/alert-remove-box.html
|
| diff --git a/dashboard/dashboard/elements/alert-remove-box.html b/dashboard/dashboard/elements/alert-remove-box.html
|
| index 64cd75f9725b6036e023b6ed9daa149fb8191c81..0b2604b828b07097a74584ab3444fe2889252e2e 100644
|
| --- a/dashboard/dashboard/elements/alert-remove-box.html
|
| +++ b/dashboard/dashboard/elements/alert-remove-box.html
|
| @@ -30,11 +30,27 @@ an alert from an issue on the issue tracker.
|
| .spinner:not([active]) {
|
| display: none;
|
| }
|
| +
|
| + .class {
|
| + color: blue;
|
| + }
|
| </style>
|
| - <div class="close-icon" hidden$="{{loading}}" on-click="onRemoveBug">
|
| + <div class="close-icon" hidden$="{{loading}}" on-click="onRemoveBug"
|
| + title="Remove bug id">
|
| ❌ <!-- cross mark U+274C -->
|
| </div>
|
| <paper-spinner class="spinner" active$="{{loading}}"></paper-spinner>
|
| +
|
| + <div id="toasts" hidden>
|
| + <div id="bugRemoved">
|
| + Bug removed.
|
| + <a id="undo" href="javascript:void(0);" onclick="document.querySelector('alert-remove-box').onUndo()">Redo</a>
|
| + </div>
|
| + </div>
|
| +
|
| + <!-- <paper-toast id="toast2" text="WOO." duration="0">
|
| + <a href="#" on-click="onUndo">Read</a>
|
| + </paper-toast> -->
|
| </template>
|
| <script>
|
| 'use strict';
|
| @@ -43,8 +59,14 @@ an alert from an issue on the issue tracker.
|
| is: 'alert-remove-box',
|
| properties: {
|
| key: { notify: true },
|
| - xsrfToken: { notify: true }
|
| + xsrfToken: { notify: true },
|
| + bugId: {notify: true},
|
| },
|
| +
|
| + // ready: function() {
|
| + // document.getElementById('undo').addEventListener('click', this.onUndo());
|
| + // },
|
| +
|
| /**
|
| * Sends a request to /edit_anomalies to reset the bug ID of this alert.
|
| */
|
| @@ -56,6 +78,7 @@ an alert from an issue on the issue tracker.
|
| 'bug_id': 'REMOVE',
|
| 'xsrf_token': this.xsrfToken
|
| };
|
| + console.log(this.key);
|
| simple_xhr.send('/edit_anomalies', params,
|
| function(info) {
|
| this.loading = false;
|
| @@ -66,7 +89,56 @@ an alert from an issue on the issue tracker.
|
| alert(msg);
|
| }.bind(this)
|
| );
|
| + if (window.location.href.includes('report'))
|
| + var page = 'chart-container';
|
| + else if (window.location.href.includes('alerts'))
|
| + var page = 'alerts-table';
|
| + if (page) {
|
| + this.fire('display-toast', {'content': this.$.bugRemoved});
|
| + }
|
| + document.querySelector(page).deletedBugId = this.bugId;
|
| + document.querySelector(page).deletedBugKey = this.key;
|
| + console.log('removing');
|
| + },
|
| +
|
| + onUndo: function() {
|
| + console.log('redoing');
|
| + // event.preventDefault();
|
| + if (window.location.href.includes('report'))
|
| + var page = 'chart-container';
|
| + else if (window.location.href.includes('alerts'))
|
| + var page = 'alerts-table';
|
| + var bugId = document.querySelector(page).deletedBugId;
|
| + var bugKey = document.querySelector(page).deletedBugKey;
|
| + console.log(bugId);
|
| + console.log(bugKey);
|
| + this.loading = true;
|
| + var params = {
|
| + 'keys': bugKey,
|
| + 'bug_id': bugId,
|
| + 'xsrf_token': this.xsrfToken,
|
| + };
|
| + simple_xhr.send('/edit_anomalies', params,
|
| + function(info) {
|
| + this.loading = false;
|
| + if (page === 'chart-container') {
|
| + window.location.reload();
|
| + // TODO THIS IS AWFUL.
|
| + // TODO TESTING
|
| + // TODO PRINT STATEMENTS ERRYWHERE
|
| + }
|
| + else if (page === 'alerts-table') {
|
| + this.fire('undountriaged', {'key': bugKey, 'bugId': bugId});
|
| + }
|
| + console.log('success?');
|
| + }.bind(this),
|
| + function(msg) {
|
| + this.loading = false;
|
| + alert(msg);
|
| + }.bind(this)
|
| + );
|
| }
|
| +
|
| });
|
| </script>
|
| </dom-module>
|
|
|