Skip to content

Commit ee956fb

Browse files
author
p01
committed
Refactoring of the visibility of the resources
1 parent 9d398ca commit ee956fb

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/resource-manager/resource_service.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ cls.ResourceInspector = function(network_logger)
8585
// build the context
8686
var ctx = {};
8787

88-
// get the order of the groups of resources
89-
ctx.group_order = this.tree_view.get_group_order();
90-
9188
// get list of window_contexts for which we saw the main_document
9289
ctx.window_list = (this._network_logger.get_window_contexts() || []).filter(function(w) {
9390
return w.saw_main_document;
@@ -100,6 +97,13 @@ cls.ResourceInspector = function(network_logger)
10097
return !this._suppress_uids.hasOwnProperty(v.uid) && v.responsecode != 204;
10198
}, this);
10299

100+
ctx.selected_resource_uid = this._selected_resource_uid;
101+
ctx.collapsed = this._collapsed_hash;
102+
ctx.document_resources = this._document_resources;
103+
104+
// get the order of the groups of resources,
105+
ctx.group_order = this.tree_view.get_group_order();
106+
103107
ctx.document_resource_hash = {};
104108

105109
// mapping of the WindowIDs in the debugging context
@@ -174,6 +178,7 @@ cls.ResourceInspector = function(network_logger)
174178

175179
r.full_id = d.pivot_id + "_" + ctx.group_order.indexOf(r.group) + r.group + "_" + r.uid;
176180
r.pivot_id = d.pivot_id + "_" + r.group;
181+
r.is_hidden = ctx.collapsed[r.pivot_id] == true;
177182

178183
return true;
179184
}, this);
@@ -197,9 +202,6 @@ cls.ResourceInspector = function(network_logger)
197202
if (!ctx.document_list.length || unknown_document_id || null_document_id)
198203
this._list_documents();
199204

200-
ctx._selected_resource_uid = this._selected_resource_uid;
201-
ctx.document_resources = this._document_resources;
202-
ctx.collapsed = this._collapsed_hash;
203205
this._context = ctx;
204206
}
205207
else
@@ -291,7 +293,7 @@ cls.ResourceInspector = function(network_logger)
291293

292294
while (list[i] != null && list[i].uid != this._selected_resource_uid)
293295
{
294-
if (list[i].is_visible)
296+
if (!list[i].is_hidden)
295297
uid = list[i].uid;
296298

297299
i += inc;

src/resource-manager/resource_templates.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
4747
if (context.search_term != "")
4848
Object.keys(context.collapsed).forEach(function(v) { context.collapsed[v] = false; });
4949

50-
// filter the list of resources, set their is_visible flag and push the ones matching
50+
// filter the list of resources, set their is_hidden flag and push the ones matching
5151
context.resources = [];
5252
context.resource_list.forEach(function(r) {
53-
var matches = (context.search_term == "" || r.url.contains(context.search_term));
54-
r.is_visible = matches && !context.collapsed[r.pivot_id]
53+
r.is_hidden = context.collapsed[r.pivot_id] == true &&
54+
(context.search_term != "" && !r.url.contains(context.search_term));
5555

56-
if (matches)
56+
if (!r.is_hidden)
5757
context.resources.push(r);
5858
});
5959

0 commit comments

Comments
 (0)