blob: 3b167045216a27fe696b7a7da241c9d67c89a700 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright 2016 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!--
The alert-remove-box element provides the functionality of dis-associating
an alert from an issue on the issue tracker.
-->
<link rel="import" href="/components/paper-spinner/paper-spinner.html">
<link rel="import" href="/dashboard/static/simple_xhr.html">
<polymer-element name="alert-remove-box" attributes="xsrfToken key">
<template>
<style>
.close-icon {
padding: 1px;
margin: 1px;
cursor: pointer;
display: inline-block;
}
.spinner {
height: 14px;
width: 14px;
}
.spinner:not([active]) {
display: none;
}
</style>
<div class="close-icon" hidden?="{{loading}}" on-click="{{onRemoveBug}}">
<!-- cross mark U+274C -->
</div>
<paper-spinner class="spinner" active?="{{loading}}"></paper-spinner>
</template>
<script>
'use strict';
Polymer('alert-remove-box', {
/**
* Sends a request to /edit_anomalies to reset the bug ID of this alert.
*/
onRemoveBug: function(event, detail, sender) {
event.preventDefault();
this.loading = true;
var params = {
'keys': this.key,
'bug_id': 'REMOVE',
xsrf_token: this.xsrfToken
};
simple_xhr.send('/edit_anomalies', params,
function(info) {
this.loading = false;
this.fire('untriaged', {'key': this.key});
}.bind(this),
function(msg) {
this.loading = false;
alert(msg);
}.bind(this)
);
}
});
</script>
</polymer-element>