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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/EventSourceMessagesView.js

Issue 2623743002: DevTools: extract modules (non-extensions) (Closed)
Patch Set: rebaseline Created 3 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Network.EventSourceMessagesView = class extends UI.VBox { 7 Network.EventSourceMessagesView = class extends UI.VBox {
8 /** 8 /**
9 * @param {!SDK.NetworkRequest} request 9 * @param {!SDK.NetworkRequest} request
10 */ 10 */
11 constructor(request) { 11 constructor(request) {
12 super(); 12 super();
13 this.registerRequiredCSS('network/eventSourceMessagesView.css'); 13 this.registerRequiredCSS('network/eventSourceMessagesView.css');
14 this.element.classList.add('event-source-messages-view'); 14 this.element.classList.add('event-source-messages-view');
15 this._request = request; 15 this._request = request;
16 16
17 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([ 17 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([
18 {id: 'id', title: Common.UIString('Id'), sortable: true, weight: 8}, 18 {id: 'id', title: Common.UIString('Id'), sortable: true, weight: 8},
19 {id: 'type', title: Common.UIString('Type'), sortable: true, weight: 8}, 19 {id: 'type', title: Common.UIString('Type'), sortable: true, weight: 8},
20 {id: 'data', title: Common.UIString('Data'), sortable: false, weight: 88}, 20 {id: 'data', title: Common.UIString('Data'), sortable: false, weight: 88},
21 {id: 'time', title: Common.UIString('Time'), sortable: true, weight: 8} 21 {id: 'time', title: Common.UIString('Time'), sortable: true, weight: 8}
22 ]); 22 ]);
23 23
24 this._dataGrid = new UI.SortableDataGrid(columns); 24 this._dataGrid = new DataGrid.SortableDataGrid(columns);
25 this._dataGrid.setStickToBottom(true); 25 this._dataGrid.setStickToBottom(true);
26 this._dataGrid.markColumnAsSortedBy('time', UI.DataGrid.Order.Ascending); 26 this._dataGrid.markColumnAsSortedBy('time', DataGrid.DataGrid.Order.Ascendin g);
27 this._sortItems(); 27 this._sortItems();
28 this._dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sor tItems, this); 28 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi s._sortItems, this);
29 29
30 this._dataGrid.setName('EventSourceMessagesView'); 30 this._dataGrid.setName('EventSourceMessagesView');
31 this._dataGrid.asWidget().show(this.element); 31 this._dataGrid.asWidget().show(this.element);
32 } 32 }
33 33
34 /** 34 /**
35 * @override 35 * @override
36 */ 36 */
37 wasShown() { 37 wasShown() {
38 this._dataGrid.rootNode().removeChildren(); 38 this._dataGrid.rootNode().removeChildren();
(...skipping 26 matching lines...) Expand all
65 var comparator = Network.EventSourceMessageNode.Comparators[sortColumnId]; 65 var comparator = Network.EventSourceMessageNode.Comparators[sortColumnId];
66 if (!comparator) 66 if (!comparator)
67 return; 67 return;
68 this._dataGrid.sortNodes(comparator, !this._dataGrid.isSortOrderAscending()) ; 68 this._dataGrid.sortNodes(comparator, !this._dataGrid.isSortOrderAscending()) ;
69 } 69 }
70 }; 70 };
71 71
72 /** 72 /**
73 * @unrestricted 73 * @unrestricted
74 */ 74 */
75 Network.EventSourceMessageNode = class extends UI.SortableDataGridNode { 75 Network.EventSourceMessageNode = class extends DataGrid.SortableDataGridNode {
76 /** 76 /**
77 * @param {!SDK.NetworkRequest.EventSourceMessage} message 77 * @param {!SDK.NetworkRequest.EventSourceMessage} message
78 */ 78 */
79 constructor(message) { 79 constructor(message) {
80 var time = new Date(message.time * 1000); 80 var time = new Date(message.time * 1000);
81 var timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMin utes()).substr(-2) + ':' + 81 var timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMin utes()).substr(-2) + ':' +
82 ('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMillisecond s()).substr(-3); 82 ('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMillisecond s()).substr(-3);
83 var timeNode = createElement('div'); 83 var timeNode = createElement('div');
84 timeNode.createTextChild(timeText); 84 timeNode.createTextChild(timeText);
85 timeNode.title = time.toLocaleString(); 85 timeNode.title = time.toLocaleString();
(...skipping 13 matching lines...) Expand all
99 var bValue = b._message[field]; 99 var bValue = b._message[field];
100 return aValue < bValue ? -1 : aValue > bValue ? 1 : 0; 100 return aValue < bValue ? -1 : aValue > bValue ? 1 : 0;
101 }; 101 };
102 102
103 /** @type {!Object.<string, function(!Network.EventSourceMessageNode, !Network.E ventSourceMessageNode):number>} */ 103 /** @type {!Object.<string, function(!Network.EventSourceMessageNode, !Network.E ventSourceMessageNode):number>} */
104 Network.EventSourceMessageNode.Comparators = { 104 Network.EventSourceMessageNode.Comparators = {
105 'id': Network.EventSourceMessageNodeComparator.bind(null, 'eventId'), 105 'id': Network.EventSourceMessageNodeComparator.bind(null, 'eventId'),
106 'type': Network.EventSourceMessageNodeComparator.bind(null, 'eventName'), 106 'type': Network.EventSourceMessageNodeComparator.bind(null, 'eventName'),
107 'time': Network.EventSourceMessageNodeComparator.bind(null, 'time') 107 'time': Network.EventSourceMessageNodeComparator.bind(null, 'time')
108 }; 108 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698