fix(panel): handle refresh better

master
Brian Ford 9 years ago
parent ca0dc695e5
commit f2a9044e3b

@ -63,6 +63,7 @@ function inspectedAppService($rootScope, $q) {
$rootScope.$applyAsync(function () {
if (msg === 'refresh') {
onRefreshMessage();
$rootScope.$broadcast('refresh');
} else if (typeof msg === 'string') {
var hint = JSON.parse(msg);
onHintMessage(hint);

@ -42,6 +42,13 @@ function batJsonTreeDirective() {
scope.$watch('batModel', function (val) {
if (!val) {
root = angular.element(BAT_JSON_TREE_TEMPLATE);
element.html('');
element.append(root);
branches = {
'': root
};
return;
}
Object.

@ -36,6 +36,11 @@ function batScopeTreeDirective($compile) {
renderScopeDescriptorElement(data.id, data.descriptor);
});
scope.$on('refresh', function () {
map = {};
element.html('');
});
function renderScopeElement (id, parentId) {
if (map[id]) {
return;

@ -16,13 +16,18 @@ function ScopesController($scope, inspectedApp) {
$scope.inspectedScope = null;
$scope.$on('refresh', function () {
$scope.inspectedScope = null;
});
// expand models the fist time we inspect a scope
var cancelWatch = $scope.$watch('inspectedScope', function (newScope) {
if (newScope) {
$scope.modelsExpanded = true;
cancelWatch();
}
})
});
$scope.$on('inspected-scope:change', function (ev, data) {
inspectScope(data.id);