Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 7E779E00C0F; Thu, 22 Sep 2016 09:56:11 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [209.85.192.182 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 15783E00C1E for ; Thu, 22 Sep 2016 09:56:10 -0700 (PDT) Received: by mail-pf0-f182.google.com with SMTP id p64so32457249pfb.1 for ; Thu, 22 Sep 2016 09:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0ho4DsYAtYpcdzaYYpgt8hFRej17TbrKeVPPPV28X+w=; b=vCsHFFVEQhr+y6zltPe140VZO90Zg2vj6cff21GIisZYN4YxBPO81c5rakuD60XmoD y/RMjHEwB604M0HqeJ0I4ocq0k0zbKehY7qn+c8FdjsMb0pqqY5744JEfY4rZFBCCHqS hyLwHqa5+560eHAo1H5Yt+shPFZZ2mOKZN2GwrlS9qZbUBdqMYiI/z6/PkzSacuwDQ3P Irdb6K3MGLFqifElOGeq4/xHBb0iynxDN6f+9i4MiwKD5Zj0eP8Qr7ZZnmGbkTZAIgHh u1z5vaqQmdjrcobcQy37vpjTq1YqTVRxGbOlOhicprM0DZGLO4dC4bGQPewnQ9nnAIwD fj2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0ho4DsYAtYpcdzaYYpgt8hFRej17TbrKeVPPPV28X+w=; b=gZe3QpcRltfen7shXiFCelouMOcTv7J3vwNB61pcsPpimhBYP0Wm0CjZ1xECMutuc2 EHBsAy7SuV/YKHi18RCjB4A66fxB0Ad7ROb0mlWQC+vMJOx7p64Y3LWOYBJ6T8xBZLdx Hyw9mvzrr7TsbD7n8PEVHwfhRj03z8eumIdQ30fWqboM0PXUh3gNcceAOuAh7wYut1tT B6xrAOtbMgbJu1ziyl/alsHbkwyQoYF5B+CaF5DbbsKmNrMoFny/d+wPSZRr+11O4wPu HWpg8B+qe7NsEe5VNUC9IBvoYtMRBEytpoCtWND6g+RYkf1DNg4Nr3Ylu4J95eNmb2Jz ZI9w== X-Gm-Message-State: AE9vXwNh7iT2pdfcR/CqtnBqPDyxoKa3vQv1e6iwr2junAMCqOOZ6eueEQUyye201v0QtM9h X-Received: by 10.98.210.202 with SMTP id c193mr4959942pfg.161.1474563368979; Thu, 22 Sep 2016 09:56:08 -0700 (PDT) Received: from orion.ger.corp.intel.com ([192.55.55.41]) by smtp.gmail.com with ESMTPSA id uj8sm5458889pab.5.2016.09.22.09.56.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 09:56:07 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 22 Sep 2016 17:55:47 +0100 Message-Id: <1474563354-11878-4-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474563354-11878-1-git-send-email-michael.g.wood@intel.com> References: <1474563354-11878-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 03/10] toaster: libtoaster Add a global notification set/show mechanism X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 16:56:11 -0000 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. Signed-off-by: Michael Wood --- .../lib/toaster/toastergui/static/js/libtoaster.js | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index b2099a6..8e2221d 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -449,6 +449,16 @@ var libtoaster = (function () { 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 { enableAjaxLoadingTimer: _enableAjaxLoadingTimer, disableAjaxLoadingTimer: _disableAjaxLoadingTimer, @@ -468,6 +478,7 @@ var libtoaster = (function () { showChangeNotification : _showChangeNotification, createCustomRecipe: _createCustomRecipe, makeProjectNameValidation: _makeProjectNameValidation, + setNotification: _setNotification, }; })(); @@ -502,6 +513,21 @@ function reload_params(params) { /* Things that happen for all pages */ $(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; /* If we don't have a console object which might be the case in some -- 2.7.4