Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js |
| index 9d2e5f0081f64ee6279a9911d0cd4f6220045f38..c8119652200ae756697d72fdddd6fbd342da30f7 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js |
| @@ -14,10 +14,7 @@ WebInspector.NetworkLogViewColumns = function(networkLogView, timeCalculator, du |
| if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) { |
| var timelineColumn = WebInspector.NetworkLogViewColumns._defaultColumns.find(columnConfig => columnConfig.id === "timeline"); |
| timelineColumn.visible = false; |
| - timelineColumn.hideable = true; |
| - timelineColumn.sortConfig = { |
| - sortingFunction: WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "startTime") |
| - }; |
| + timelineColumn.hideable = false; |
| } |
| this._networkLogView = networkLogView; |
| @@ -369,6 +366,17 @@ WebInspector.NetworkLogViewColumns._defaultColumns = [ |
| WebInspector.NetworkLogViewColumns._filmStripDividerColor = "#fccc49"; |
| /** |
| + * @enum {string} |
| + */ |
| +WebInspector.NetworkLogViewColumns.TimelineSortIds = { |
| + StartTime: "startTime", |
| + ResponseTime: "responseReceivedTime", |
| + EndTime: "endTime", |
| + Duration: "duration", |
| + Latency: "latency" |
| +}; |
| + |
| +/** |
| * @param {!WebInspector.NetworkLogViewColumns.Descriptor} columnConfig |
| * @return {!WebInspector.DataGrid.ColumnDescriptor} |
| */ |
| @@ -443,6 +451,7 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| this._setupDropdownColumns(); |
| + this._activeTimelineSortId = WebInspector.NetworkLogViewColumns.TimelineSortIds.StartTime; |
| this._dataGrid.markColumnAsSortedBy(WebInspector.NetworkLogViewColumns._initialSortColumn, WebInspector.DataGrid.Order.Ascending); |
| if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) { |
| @@ -641,6 +650,21 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| _sortHandler: function() |
| { |
| var columnId = this._dataGrid.sortColumnId(); |
| + this._networkLogView.removeAllNodeHighlights(); |
| + if (Runtime.experiments.isEnabled("canvasNetworkTimeline") && columnId === "timeline") { |
| + this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-descending"); |
| + |
| + if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascending) |
| + this._timelineColumnSortIcon.classList.add("sort-ascending"); |
| + else |
| + this._timelineColumnSortIcon.classList.add("sort-descending"); |
| + |
| + this._timelineRequestsAreStale = true; |
| + var sortFunction = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, this._activeTimelineSortId); |
| + this._dataGrid.sortNodes(sortFunction, !this._dataGrid.isSortOrderAscending()); |
| + return; |
| + } |
| + |
| var columnConfig = this._columns.find(columnConfig => columnConfig.id === columnId); |
| if (!columnConfig) |
| return; |
| @@ -651,24 +675,8 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| if (!columnConfig.sortConfig.sortingFunction) |
| return; |
| - this._networkLogView.removeAllNodeHighlights(); |
| this._dataGrid.sortNodes(columnConfig.sortConfig.sortingFunction, !this._dataGrid.isSortOrderAscending()); |
| this._networkLogView.dataGridSorted(); |
| - |
| - if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| - return; |
| - |
| - this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-descending"); |
| - |
| - if (this._dataGrid.sortColumnId() === "timeline") { |
| - if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascending) |
| - this._timelineColumnSortIcon.classList.add("sort-ascending"); |
| - else |
| - this._timelineColumnSortIcon.classList.add("sort-descending"); |
| - } |
| - |
| - this._timelineRequestsAreStale = true; |
| - |
| }, |
| /** |
| @@ -691,21 +699,6 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| columnConfig.selectBox.options[0].label = selectedItemConfig.title; |
| columnConfig.selectBox.selectedIndex = 0; |
| this._networkLogView.dataGridSorted(); |
| - |
| - // TODO(allada) This entire function will be removed when the timeline comes out of exp, so copying code above for now. |
| - if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
| - return; |
| - |
| - this._timelineColumnSortIcon.classList.remove("sort-ascending", "sort-descending"); |
| - |
| - if (this._dataGrid.sortColumnId() === "timeline") { |
| - if (this._dataGrid.sortOrder() === WebInspector.DataGrid.Order.Ascending) |
| - this._timelineColumnSortIcon.classList.add("sort-ascending"); |
| - else |
| - this._timelineColumnSortIcon.classList.add("sort-descending"); |
| - } |
| - |
| - this._timelineRequestsAreStale = true; |
| }, |
| _updateColumns: function() |
| @@ -715,7 +708,7 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| var visibleColumns = /** @type {!Object.<string, boolean>} */ ({}); |
| if (this._gridMode) { |
| for (var columnConfig of this._columns) |
| - visibleColumns[columnConfig.id] = (columnConfig.visible || !columnConfig.hideable); |
|
dgozman
2016/10/28 19:04:28
What about name column? It's not hideable as well.
allada
2016/10/28 21:11:04
This is already handled by not allowing it to be h
|
| + visibleColumns[columnConfig.id] = columnConfig.visible; |
| } else { |
| visibleColumns.name = true; |
| } |
| @@ -818,6 +811,16 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| */ |
| _innerHeaderContextMenu: function(contextMenu) |
| { |
| + if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) { |
| + var timelineSortIds = WebInspector.NetworkLogViewColumns.TimelineSortIds; |
| + var timelineSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Timeline Views")); |
| + timelineSubMenu.appendCheckboxItem(WebInspector.UIString("Start Time"), setTimelineMode.bind(this, timelineSortIds.StartTime), this._activeTimelineSortId === timelineSortIds.StartTime); |
| + timelineSubMenu.appendCheckboxItem(WebInspector.UIString("Response Time"), setTimelineMode.bind(this, timelineSortIds.ResponseTime), this._activeTimelineSortId === timelineSortIds.ResponseTime); |
| + timelineSubMenu.appendCheckboxItem(WebInspector.UIString("End Time"), setTimelineMode.bind(this, timelineSortIds.EndTime), this._activeTimelineSortId === timelineSortIds.EndTime); |
| + timelineSubMenu.appendCheckboxItem(WebInspector.UIString("Total Duration"), setTimelineMode.bind(this, timelineSortIds.Duration), this._activeTimelineSortId === timelineSortIds.Duration); |
| + timelineSubMenu.appendCheckboxItem(WebInspector.UIString("Latency"), setTimelineMode.bind(this, timelineSortIds.Latency), this._activeTimelineSortId === timelineSortIds.Latency); |
| + contextMenu.appendSeparator(); |
| + } |
| var columnConfigs = this._columns.filter(columnConfig => columnConfig.hideable); |
| var nonResponseHeaders = columnConfigs.filter(columnConfig => !columnConfig.isResponseHeader); |
| for (var columnConfig of nonResponseHeaders) |
| @@ -834,6 +837,23 @@ WebInspector.NetworkLogViewColumns.prototype = { |
| responseSubMenu.appendItem(WebInspector.UIString("Manage Header Columns\u2026"), this._manageCustomHeaderDialog.bind(this)); |
| contextMenu.show(); |
| + |
| + /** |
| + * @param {!WebInspector.NetworkLogViewColumns.TimelineSortIds} sortId |
| + * @this {WebInspector.NetworkLogViewColumns} |
| + */ |
| + function setTimelineMode(sortId) |
| + { |
| + var calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewColumns._calculatorTypes.Time); |
| + var timelineSortIds = WebInspector.NetworkLogViewColumns.TimelineSortIds; |
| + if (sortId === timelineSortIds.Duration || sortId === timelineSortIds.Latency) |
| + calculator = this._calculatorsMap.get(WebInspector.NetworkLogViewColumns._calculatorTypes.Duration); |
| + this._networkLogView.setCalculator(calculator); |
| + |
| + this._activeTimelineSortId = sortId; |
| + this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Order.Ascending); |
| + this._sortHandler(); |
| + } |
| }, |
| _manageCustomHeaderDialog: function() |