bitbake: toaster: libtoaster Add a global notification set/show mechanism
We now have a number of places where we show change notifications based on an event in a previous page (imported a layer, deleted a build, deleted a project etc) and we show these notifications on various pages so we add a simple notification utility to libtoaster. (Bitbake rev: c8db313e907918b0df122006046b157d510ecc1d) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
8ba7ccd252
commit
7ca44f53bc
|
@ -449,6 +449,16 @@ var libtoaster = (function () {
|
||||||
ajaxLoadingTimerEnabled = false;
|
ajaxLoadingTimerEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Utility function to set a notification for the next page load */
|
||||||
|
function _setNotification(name, message){
|
||||||
|
var data = {
|
||||||
|
name: name,
|
||||||
|
message: message
|
||||||
|
};
|
||||||
|
|
||||||
|
$.cookie('toaster-notification', JSON.stringify(data), { path: '/'});
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
enableAjaxLoadingTimer: _enableAjaxLoadingTimer,
|
enableAjaxLoadingTimer: _enableAjaxLoadingTimer,
|
||||||
disableAjaxLoadingTimer: _disableAjaxLoadingTimer,
|
disableAjaxLoadingTimer: _disableAjaxLoadingTimer,
|
||||||
|
@ -468,6 +478,7 @@ var libtoaster = (function () {
|
||||||
showChangeNotification : _showChangeNotification,
|
showChangeNotification : _showChangeNotification,
|
||||||
createCustomRecipe: _createCustomRecipe,
|
createCustomRecipe: _createCustomRecipe,
|
||||||
makeProjectNameValidation: _makeProjectNameValidation,
|
makeProjectNameValidation: _makeProjectNameValidation,
|
||||||
|
setNotification: _setNotification,
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -502,6 +513,21 @@ function reload_params(params) {
|
||||||
/* Things that happen for all pages */
|
/* Things that happen for all pages */
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
(function showNotificationRequest(){
|
||||||
|
var cookie = $.cookie('toaster-notification');
|
||||||
|
|
||||||
|
if (!cookie)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var notificationData = JSON.parse(cookie);
|
||||||
|
|
||||||
|
libtoaster.showChangeNotification(notificationData.message);
|
||||||
|
|
||||||
|
$.removeCookie('toaster-notification', { path: "/"});
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var ajaxLoadingTimer;
|
var ajaxLoadingTimer;
|
||||||
|
|
||||||
/* If we don't have a console object which might be the case in some
|
/* If we don't have a console object which might be the case in some
|
||||||
|
|
Loading…
Reference in New Issue