Skip to content

Commit 321ea74

Browse files
author
p01
committed
Fix for DFL-3350 highlight selected resource in the tree
1 parent 2caff4d commit 321ea74

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/resource-manager/resource_service.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ cls.ResourceManagerService = function(view, network_logger)
135135
)
136136
this._listDocuments();
137137

138+
ctx.selectedResourceID = this._selectedResourceID;
138139
ctx.collapsed = this._collapsedHash;
139140
this._context = ctx;
140141
}
@@ -148,7 +149,6 @@ cls.ResourceManagerService = function(view, network_logger)
148149

149150
this._update_bound = this._update.bind(this);
150151

151-
152152
this._on_debug_context_selected_bound = function()
153153
{
154154
this._documentList = [];
@@ -187,33 +187,26 @@ cls.ResourceManagerService = function(view, network_logger)
187187

188188
this._handle_resource_detail_bound = function(event, target)
189189
{
190-
var resource;
191190
if (!this._context)
192191
return;
193192

194193
var parent = target.get_ancestor('[data-resource-id]');
195194
if (!parent)
196195
return;
197196

198-
199-
if (this._selectedResourceId)
200-
{
201-
resource = this.get_resource(this._selectedResourceId);
202-
if(resource)
203-
resource.selected = false;
204-
}
205-
206197
var id = parent.getAttribute('data-resource-id');
207-
resource = this.get_resource(id);
198+
this.highlight_resource( id );
199+
cls.ResourceDetailView.instance.show_resource(id);
200+
}.bind(this);
208201

209-
if (!resource)
210-
return;
202+
this.highlight_resource = function(id)
203+
{
204+
this._selectedResourceID = id;
211205

212-
this._selectedResourceId = id;
213-
resource.selected = true;
214-
this._view.update();
215-
cls.ResourceDetailView.instance.show_resource(resource);
206+
if (this._context)
207+
this._context.selectedResourceID = id;
216208

209+
this._view.update();
217210
}.bind(this);
218211

219212
// WIP: soon there will be some triggers to display a whole group of resource, e.g. gallery of images, videos, fonts, audios, ...

src/resource-manager/resource_style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ a.external:hover
332332
background-repeat:repeat;
333333
}
334334

335+
h2.resource-highlight
336+
{
337+
background-color:yellow;
338+
}
335339
.resource-tree li > h2:hover
336340
{
337341
background-color:orange;

src/resource-manager/resource_templates.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ templates.resource_tree =
220220
'data-resource-id',''+r.id,
221221
'data-tooltip',!r.url&&'js-script-select',
222222
'data-tooltip-text',!r.url&&JSON.stringify(r),
223-
'class','resource-tree-resource'+(r.sameOrigin?'':' resource-different-origin')+(!r.url?' wat':'')
223+
'class','resource-tree-resource'
224+
+(r.sameOrigin?'':' resource-different-origin')
225+
+(context.selectedResourceID==r.id?' resource-highlight':'')
226+
+(!r.url?' wat':'')
224227
]
225228
]);
226229
}

0 commit comments

Comments
 (0)