Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: dashboard/dashboard/elements/alert-remove-box.html

Issue 2569523003: wip (Closed)
Patch Set: wip Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dashboard/dashboard/alerts.py ('k') | dashboard/dashboard/elements/alerts-table.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « dashboard/dashboard/alerts.py ('k') | dashboard/dashboard/elements/alerts-table.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698