Mercurial > bugzilla-dashboard
comparison js/black-box.js @ 111:00d6b3149165 default tip
added addFailMsg() global.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Fri, 30 Apr 2010 05:32:54 -0700 |
parents | 4567dc69cb3e |
children |
comparison
equal
deleted
inserted
replaced
110:4567dc69cb3e | 111:00d6b3149165 |
---|---|
73 | 73 |
74 function setDashboardLoaded(delegate, window) { | 74 function setDashboardLoaded(delegate, window) { |
75 window.onDashboardLoaded = function onDashboardLoaded(dashboard, options) { | 75 window.onDashboardLoaded = function onDashboardLoaded(dashboard, options) { |
76 $(dashboard).error( | 76 $(dashboard).error( |
77 function(event) { | 77 function(event) { |
78 if (window.console) | 78 addFailMsg("An error occurred in the dashboard iframe."); |
79 window.console.warn("An error occurred in the dashboard iframe."); | |
80 }); | 79 }); |
81 | 80 |
82 delegate("blackBox.onDashboardLoaded", [dashboard, options]); | 81 delegate("blackBox.onDashboardLoaded", [dashboard, options]); |
83 | 82 |
84 var require = Require.build(Require.modules, {window: window}); | 83 var require = Require.build(Require.modules, {window: window}); |
109 setDashboardLoaded(delegate, window); | 108 setDashboardLoaded(delegate, window); |
110 var iframe = $("#dashboard").get(0); | 109 var iframe = $("#dashboard").get(0); |
111 iframe.src = "index.html?testing=1"; | 110 iframe.src = "index.html?testing=1"; |
112 } | 111 } |
113 | 112 |
113 function addFailMsg(msg) { | |
114 var msgElem = $('<p class="fail"></p>').text(msg); | |
115 msgElem.hide(); | |
116 $("#messages").append(msgElem); | |
117 msgElem.slideDown(); | |
118 } | |
119 | |
114 function initialize() { | 120 function initialize() { |
115 $(".test-button").click( | 121 $(".test-button").click( |
116 function() { | 122 function() { |
117 var testButton = this; | 123 var testButton = this; |
118 var testFunc = window[testButton.id]; | 124 var testFunc = window[testButton.id]; |
119 var auto; | 125 var auto; |
120 | 126 |
121 $(testButton).addClass("running"); | 127 $(testButton).addClass("running"); |
122 function onFail(reason) { | 128 function onFail(reason) { |
123 $(testButton).addClass("fail"); | 129 $(testButton).addClass("fail"); |
124 var msg = ("Failure in " + $(testButton).text() + ": " + | 130 addFailMsg("Failure in " + $(testButton).text() + ": " + |
125 reason); | 131 reason); |
126 var msgElem = $('<p class="fail"></p>').text(msg); | |
127 msgElem.hide(); | |
128 $("#messages").append(msgElem); | |
129 msgElem.slideDown(); | |
130 } | 132 } |
131 function onDone() { | 133 function onDone() { |
132 $(testButton).removeClass("running"); | 134 $(testButton).removeClass("running"); |
133 if (!$(testButton).hasClass("fail")) | 135 if (!$(testButton).hasClass("fail")) |
134 $(testButton).addClass("success"); | 136 $(testButton).addClass("success"); |