<link rel="import" href="/about_tracing/xhr_based_tracing_controller_client.html">
<link rel="import" href="/about_tracing/features.html">
<link rel="import" href="/tracing/timeline_view.html">
-<link rel="import" href="/tvcm/key_event_manager.html">
-<link rel="import" href="/tvcm/ui.html">
-<link rel="import" href="/tvcm/ui/info_bar.html">
-<link rel="import" href="/tvcm/ui/overlay.html">
+<link rel="import" href="/base/key_event_manager.html">
+<link rel="import" href="/base/ui.html">
+<link rel="import" href="/base/ui/info_bar.html">
+<link rel="import" href="/base/ui/overlay.html">
<style>
x-profiling-view {
x-profiling-view > x-timeline-view {
-webkit-flex: 1 1 auto;
}
+
+.report-id-message {
+ -webkit-user-select: text;
+}
</style>
<template id="profiling-view-template">
* @fileoverview ProfilingView glues the View control to
* TracingController.
*/
-tvcm.exportTo('about_tracing', function() {
+tv.exportTo('about_tracing', function() {
function readFile(file) {
return new Promise(function(resolve, reject) {
var reader = new FileReader();
* @constructor
* @extends {HTMLUnknownElement}
*/
- var ProfilingView = tvcm.ui.define('x-profiling-view');
+ var ProfilingView = tv.ui.define('x-profiling-view');
var THIS_DOC = document.currentScript.ownerDocument;
+ var REPORT_UPLOAD_URL = 'http://crash-staging/';
ProfilingView.prototype = {
__proto__: HTMLUnknownElement.prototype,
decorate: function(tracingControllerClient) {
- this.appendChild(tvcm.instantiateTemplate('#profiling-view-template',
+ this.appendChild(tv.instantiateTemplate('#profiling-view-template',
THIS_DOC));
this.timelineView_ = this.querySelector('x-timeline-view');
this.infoBarGroup_ = this.querySelector('x-info-bar-group');
- tvcm.ui.decorate(this.infoBarGroup_, tvcm.ui.InfoBarGroup);
- tvcm.ui.decorate(this.timelineView_, tracing.TimelineView);
+ tv.ui.decorate(this.infoBarGroup_, tv.ui.InfoBarGroup);
+ tv.ui.decorate(this.timelineView_, tracing.TimelineView);
// Detach the buttons. We will reattach them to the timeline view.
// TODO(nduca): Make <timeline-view> have a <content select="x-buttons">
this.timelineView_.leftControls.appendChild(buttons);
this.initButtons_(buttons);
- tvcm.KeyEventManager.instance.addListener(
+ tv.KeyEventManager.instance.addListener(
'keypress', this.onKeypress_, this);
this.initDragAndDrop_();
}.bind(this);
window.onUploadError = function(error_message) {
- this.onUploadStatusUpdate_('Trace upload failed: ' + error_message);
+ this.setUploadOverlayText_(['Trace upload failed: ' + error_message]);
}.bind(this);
window.onUploadProgress = function(percent, currentAsString,
totalAsString) {
- this.onUploadStatusUpdate_(
- 'Upload progress: ' + percent + '% (' + currentAsString + ' of ' +
- currentAsString + ' bytes)');
+ this.setUploadOverlayText_(
+ ['Upload progress: ' + percent + '% (' + currentAsString + ' of ' +
+ currentAsString + ' bytes)']);
}.bind(this);
- window.onUploadComplete = function(report_id) {
- this.onUploadStatusUpdate_(
- 'Trace uploaded successfully. Report id: ' + report_id);
+ window.onUploadComplete = function(reportId) {
+ var messageDiv = document.createElement('div');
+ var textNode = document.createTextNode(
+ 'Trace uploaded successfully. Report id: ');
+ messageDiv.appendChild(textNode);
+ var reportLink = document.createElement('a');
+ messageDiv.appendChild(reportLink);
+ reportLink.href = REPORT_UPLOAD_URL + reportId;
+ reportLink.text = reportId;
+ reportLink.className = 'report-id-message';
+ reportLink.target = '_blank';
+ this.setUploadOverlayContent_(messageDiv);
}.bind(this);
this.getMonitoringStatus();
buttons.querySelector('#monitor-checkbox').disabled = false;
if (err instanceof about_tracing.UserCancelledError)
return;
- tvcm.ui.Overlay.showError('Error while recording', err);
+ tv.ui.Overlay.showError('Error while recording', err);
}.bind(this));
return resultPromise;
},
function(err) {
if (err instanceof about_tracing.UserCancelledError)
return;
- tvcm.ui.Overlay.showError('Error while monitoring', err);
+ tv.ui.Overlay.showError('Error while monitoring', err);
}.bind(this));
return resultPromise;
},
function(err) {
if (err instanceof about_tracing.UserCancelledError)
return;
- tvcm.ui.Overlay.showError('Error while monitoring', err);
+ tv.ui.Overlay.showError('Error while monitoring', err);
}.bind(this));
return resultPromise;
},
function(err) {
if (err instanceof about_tracing.UserCancelledError)
return;
- tvcm.ui.Overlay.showError('Error while monitoring', err);
+ tv.ui.Overlay.showError('Error while monitoring', err);
}.bind(this));
return resultPromise;
},
function(err) {
if (err instanceof about_tracing.UserCancelledError)
return;
- tvcm.ui.Overlay.showError('Error while updating tracing states',
+ tv.ui.Overlay.showError('Error while updating tracing states',
err);
}.bind(this));
return resultPromise;
this.timelineView_.model = m;
}.bind(this),
function(err) {
- tvcm.ui.Overlay.showError('While importing: ', err);
+ tv.ui.Overlay.showError('While importing: ', err);
}.bind(this));
},
this.uploadButton_.style.display = 'inline-block';
}
this.uploadButton_.disabled = true;
+ this.uploadOverlay_ = null;
},
onSaveClicked_: function() {
},
initUploadStatusOverlay_: function() {
- this.uploadOverlay_ = tvcm.ui.Overlay();
+ this.uploadOverlay_ = tv.ui.Overlay();
this.uploadOverlay_.title = 'Uploading trace...';
this.uploadOverlay_.userCanClose = false;
this.uploadOverlay_.visible = true;
this.uploadOverlay_.buttons.appendChild(cancelButton);
},
- onUploadStatusUpdate_: function(message) {
- this.setUploadOverlayText_([message]);
- },
-
- setUploadOverlayText_: function(messages) {
+ setUploadOverlayContent_: function(content) {
if (!this.uploadOverlay_)
throw new Error('Not uploading');
this.uploadOverlay_.textContent = '';
+ this.uploadOverlay_.appendChild(content);
+ },
+
+ setUploadOverlayText_: function(messages) {
+ var contentDiv = document.createElement('div');
for (var i = 0; i < messages.length; ++i) {
- this.uploadOverlay_.msgEl = document.createElement('div');
- this.uploadOverlay_.appendChild(this.uploadOverlay_.msgEl);
- this.uploadOverlay_.msgEl.style.margin = '20px';
- this.uploadOverlay_.msgEl.textContent = messages[i];
+ var messageDiv = document.createElement('div');
+ messageDiv.textContent = messages[i];
+ contentDiv.appendChild(messageDiv);
}
+ this.setUploadOverlayContent_(contentDiv);
},
doTraceUpload_: function() {
this.setActiveTrace(file.name, data);
}.bind(this),
function(err) {
- tvcm.ui.Overlay.showError('Error while loading file: ' + err);
+ tv.ui.Overlay.showError('Error while loading file: ' + err);
});
}.bind(this), false);
inputElement.click();
var files = e.dataTransfer.files;
if (files.length !== 1) {
- tvcm.ui.Overlay.showError('1 file supported at a time.');
+ tv.ui.Overlay.showError('1 file supported at a time.');
return;
}
this.setActiveTrace(files[0].name, data);
}.bind(this),
function(err) {
- tvcm.ui.Overlay.showError('Error while loading file: ' + err);
+ tv.ui.Overlay.showError('Error while loading file: ' + err);
});
return false;
}