Skip to content

Commit 9ba6b5b

Browse files
author
p01
committed
Fix DFL-3718, Do no localize the classname in the Resource Tree
1 parent 00f1f67 commit 9ba6b5b

File tree

4 files changed

+37
-31
lines changed

4 files changed

+37
-31
lines changed

src/resource-manager/resource_service.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ cls.ResourceInspector = function(network_logger)
1212
var HIGHLIGHT_CLASSNAME = "resource-highlight";
1313

1414
var THROTTLE_DELAY = 250;
15-
var TYPE_GROUP_MAPPING = {
16-
"markup": ui_strings.S_HTTP_LABEL_FILTER_MARKUP,
17-
"css": ui_strings.S_HTTP_LABEL_FILTER_STYLESHEETS,
18-
"script": ui_strings.S_HTTP_LABEL_FILTER_SCRIPTS,
19-
"image": ui_strings.S_HTTP_LABEL_FILTER_IMAGES,
20-
"font": ui_strings.S_HTTP_LABEL_FILTER_FONTS,
21-
"*": ui_strings.S_HTTP_LABEL_FILTER_OTHER
22-
};
2315

2416
this._network_logger = network_logger;
2517

@@ -56,6 +48,19 @@ cls.ResourceInspector = function(network_logger)
5648
this.detail_view = window.views.resource_detail_view;
5749
};
5850

51+
this.get_group_order = function()
52+
{
53+
this.get_views();
54+
if (this.group_order == null && this.tree_view != null)
55+
{
56+
this.group_order = this.tree_view.get_group_order();
57+
this.group_order_type_index = {};
58+
this.group_order.forEach( function(g, i) {
59+
this.group_order_type_index[g.type] = i;
60+
}, this);
61+
}
62+
}
63+
5964
this._update = function(msg)
6065
{
6166
this.get_views();
@@ -95,7 +100,8 @@ cls.ResourceInspector = function(network_logger)
95100
ctx.collapsed = this._collapsed_hash;
96101

97102
// get the order of the groups of resources,
98-
ctx.group_order = this.tree_view.get_group_order();
103+
this.get_group_order();
104+
ctx.group_order = this.group_order;
99105

100106
ctx.document_resource_hash = {};
101107

@@ -136,7 +142,7 @@ cls.ResourceInspector = function(network_logger)
136142
if (!hash.hasOwnProperty(id))
137143
{
138144
hash[id] = d.depth > 1;
139-
ctx.group_order.forEach(function(g) { hash[id + "_" + g] = true; });
145+
ctx.group_order.forEach(function(g) { hash[id + "_" + g.type] = true; });
140146
}
141147
}
142148

@@ -166,10 +172,10 @@ cls.ResourceInspector = function(network_logger)
166172
return false;
167173
}
168174

169-
r.group = TYPE_GROUP_MAPPING[r.type] || TYPE_GROUP_MAPPING["*"];
175+
r.group = this.group_order_type_index.hasOwnProperty(r.type) ? r.type : ctx.group_order.last.type;
170176
r.same_origin = cls.ResourceUtil.sameOrigin(d.url, r);
171177

172-
r.full_id = d.pivot_id + "_" + ctx.group_order.indexOf(r.group) + r.group + "_" + r.uid;
178+
r.full_id = d.pivot_id + "_" + this.group_order_type_index[r.group] + r.group + "_" + r.uid;
173179
r.pivot_id = d.pivot_id + "_" + r.group;
174180
r.is_hidden = ctx.collapsed[r.pivot_id] == true;
175181

src/resource-manager/resource_style.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ h2 .resource-different-origin
382382
.resource-tree-window-label,
383383
.resource-tree-document-label,
384384
.resource-tree-group-markup-label,
385-
.resource-tree-group-stylesheets-label,
386-
.resource-tree-group-scripts-label,
387-
.resource-tree-group-images-label,
388-
.resource-tree-group-fonts-label,
385+
.resource-tree-group-css-label,
386+
.resource-tree-group-script-label,
387+
.resource-tree-group-image-label,
388+
.resource-tree-group-font-label,
389389
.resource-tree-group-other-label
390390
{
391391
font-weight: bold;
@@ -415,22 +415,22 @@ h2 .resource-different-origin
415415
background-image: url("../ui-images/type_markup.png");
416416
}
417417

418-
.resource-tree-group-stylesheets-label
418+
.resource-tree-group-css-label
419419
{
420420
background-image: url("../ui-images/type_style.png");
421421
}
422422

423-
.resource-tree-group-scripts-label
423+
.resource-tree-group-script-label
424424
{
425425
background-image: url("../ui-images/type_script.png");
426426
}
427427

428-
.resource-tree-group-images-label
428+
.resource-tree-group-image-label
429429
{
430430
background-image: url("../ui-images/type_picture.png");
431431
}
432432

433-
.resource-tree-group-fonts-label
433+
.resource-tree-group-font-label
434434
{
435435
background-image: url("../ui-images/type_font.png");
436436
}

src/resource-manager/resource_templates.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
165165
this.resource_group = function(context, resources, d, g)
166166
{
167167
var resources = resources.filter(function(r) {
168-
return r.group == g;
168+
return r.group == g.type;
169169
});
170170

171171
var resource_count = resources.length;
@@ -181,22 +181,22 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
181181
return;
182182

183183
var depth = d.depth + 1;
184-
var extras = this._expander_extras(context, d.pivot_id + "_" + g, depth);
184+
var extras = this._expander_extras(context, d.pivot_id + "_" + g.type, depth);
185185

186186
flat_list.push(
187187
["li",
188188
["h2",
189189
extras.tpl.button,
190190
["span",
191-
g,
192-
"class", "resource-tree-group-" + g.toLowerCase() + "-label"
191+
g.ui_string,
192+
"class", "resource-tree-group-" + g.type.toLowerCase() + "-label"
193193
],
194194
" ",
195195
["span",
196196
String(resource_count),
197197
"class", "resource-tree-count"
198198
],
199-
"class", "resource-tree-group resource-tree-group-" + g.toLowerCase()
199+
"class", "resource-tree-group resource-tree-group-" + g.type.toLowerCase()
200200
].concat(extras.tpl.h2),
201201
].concat(extras.tpl.li)
202202
);

src/resource-manager/resource_tree_view.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ cls.ResourceTreeView = function(id, name, container_class, html, default_handler
1111
// const
1212
var THROTTLE_DELAY = 250;
1313
var GROUP_ORDER = [
14-
ui_strings.S_HTTP_LABEL_FILTER_MARKUP,
15-
ui_strings.S_HTTP_LABEL_FILTER_STYLESHEETS,
16-
ui_strings.S_HTTP_LABEL_FILTER_SCRIPTS,
17-
ui_strings.S_HTTP_LABEL_FILTER_IMAGES,
18-
ui_strings.S_HTTP_LABEL_FILTER_FONTS,
19-
ui_strings.S_HTTP_LABEL_FILTER_OTHER
14+
{"type": "markup", "ui_string": ui_strings.S_HTTP_LABEL_FILTER_MARKUP},
15+
{"type": "css", "ui_string": ui_strings.S_HTTP_LABEL_FILTER_STYLESHEETS},
16+
{"type": "script", "ui_string": ui_strings.S_HTTP_LABEL_FILTER_SCRIPTS},
17+
{"type": "image", "ui_string": ui_strings.S_HTTP_LABEL_FILTER_IMAGES},
18+
{"type": "font", "ui_string": ui_strings.S_HTTP_LABEL_FILTER_FONTS},
19+
{"type": "other", "ui_string": ui_strings.S_HTTP_LABEL_FILTER_OTHER}
2020
];
2121

2222
this._next_render_time = 0;

0 commit comments

Comments
 (0)