Skip to content

Commit

Permalink
Bug 1078700 - Add a tree state for when treestatus is unreachable r=camd
Browse files Browse the repository at this point in the history
  • Loading branch information
KWierso committed Jul 16, 2015
1 parent b6b0e1a commit 99d19e8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ui/js/directives/treeherder/top_nav_bar.js
Expand Up @@ -48,6 +48,11 @@ treeherder.directive('thWatchedRepo', [
icon: "fa-spinner",
color: "treeUnavailable",
btnClass: "btn-view-nav"
},
"error": {
icon: "fa-question",
color: "treeUnavailable",
btnClass: "btn-view-nav"
}
};

Expand Down
19 changes: 18 additions & 1 deletion ui/js/models/repository.js
Expand Up @@ -230,6 +230,19 @@ treeherder.factory('ThRepositoryModel', [
};
};

/**
* if there's an error fetching data from treestatus, make that obvious
* in the treestatus field in treeherder
*/
var getErrorTreeStatus = function(repoName) {
return {
status: "error",
message_of_the_day: 'Error reaching <a href="https://treestatus.mozilla.org">treestatus.mozilla.org</a>',
reason: 'Error reaching <a href="https://treestatus.mozilla.org">treestatus.mozilla.org</a>',
tree: repoName
};
};

/**
* Update the status for ``repoName``. If it's not passed in,
* then update all ``watchedRepos`` status.
Expand Down Expand Up @@ -259,7 +272,11 @@ treeherder.factory('ThRepositoryModel', [
newStatuses[repo] = data.data;
updateStatusesIfDone();
}, function(data) {
newStatuses[repo] = getUnsupportedTreeStatus(repo);
if (data.data != null) {
newStatuses[repo] = getUnsupportedTreeStatus(repo);
} else {
newStatuses[repo] = getErrorTreeStatus(repo);
}
updateStatusesIfDone();
});

Expand Down

0 comments on commit 99d19e8

Please sign in to comment.