blob: c89c0c382192bbecbebba72c41e6dfe1d42b73b6 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 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.
-->
<link rel="import" href="/base/units/time_stamp.html">
<link rel="import" href="/model/event_info.html">
<link rel="import" href="/model/event_set.html">
<link rel="import" href="/model/timed_event.html">
<script>
'use strict';
tr.exportTo('tr.model', function() {
function Alert(info, start, opt_associatedEvents, opt_args) {
tr.model.TimedEvent.call(this, start);
this.info = info;
this.args = opt_args || {};
this.associatedEvents = new tr.model.EventSet(opt_associatedEvents);
this.associatedEvents.forEach(function(event) {
event.associatedAlerts.push(this);
}, this);
}
Alert.prototype = {
__proto__: tr.model.TimedEvent.prototype,
get title() {
return this.info.title;
},
get colorId() {
return this.info.colorId;
},
get userFriendlyName() {
return 'Alert ' + this.title + ' at ' +
tr.b.units.TimeStamp.format(this.start);
}
};
tr.model.EventRegistry.register(
Alert,
{
name: 'alert',
pluralName: 'alerts',
singleViewElementName: 'tr-ui-a-alert-sub-view',
multiViewElementName: 'tr-ui-a-alert-sub-view'
});
return {
Alert: Alert
};
});
</script>