From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id EAFD0E00CB4; Mon, 25 Apr 2016 04:13:59 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.176 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-f176.google.com (mail-pf0-f176.google.com [209.85.192.176]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id A68F5E00C9D for ; Mon, 25 Apr 2016 04:13:56 -0700 (PDT) Received: by mail-pf0-f176.google.com with SMTP id 206so16093714pfu.0 for ; Mon, 25 Apr 2016 04:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Qc9WU4OeAcusFTtwu+HQFS18TwTiF5Njq1yuoKG1vpA=; b=XXpG3jCu2I61sAnSXXLeZPtvCO7EyyDT1g22MqgDX7Dt5J3DfLkru/R6EZ2GuWtUnm A7aJgk+U0MOpLDciEfL+IZZea5KawQ8MCMmH0FnDXFQNdcp1erf26DeCmcKUP4aeAohj uY0Jsi9I8KyaiupZ3qB6SRqFwtD7ecP0bNvdTKdphS26+sqJvSG8tQE35m8eVVz/30wa /IEUAO0OKHojL7RiNQIPV7HUYBD+kKxjESzv+vVBO6spIV0zgyUQYvVlZDsesctQmH7l LBG7mcudZDkOpYwaj9fm3Pa2U5WKdu2lwMWPUIMl39m3NwxEkb7LJ6+5KhsPVt51F7dq U89A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Qc9WU4OeAcusFTtwu+HQFS18TwTiF5Njq1yuoKG1vpA=; b=dDoewaMzJ+AWZjUdP1P77sVJdxBxooGVrGxDTF/FhgwiXkDtol1b+uDFQ6VN6B56x1 G9bnWuoF44CsXpVZiMAeSR/v9Qu6mocpDyVw0EwqiYL/p4DeEr8bhXshUj2Cgh9ZRr62 x0BllxJMCk9No8Mp8fl3NsiyIJkh5OWXsaFCbyFddtYUPZPmfJg8SGNAINCVZbj8YpOT 076GChbfmRxJHLEc+JGyRsn/kM+1s54jfXuHPSRaRC3wo6EVi1nEDFNMm0MMVv95w+lA oWMmssMPkJt/imXavwywuPTBM9kj4cMgfCQ2OQApm1AvJiYqdB4TXF8110x04oSTpC1w I/XQ== X-Gm-Message-State: AOPr4FUhyIkAgM2wjscnfPNiVESl1f8Tz/KveqAh2rXcjdhdBzl6nLvaH0bPr+6F2/kn7rQk X-Received: by 10.98.35.212 with SMTP id q81mr27210016pfj.108.1461582835606; Mon, 25 Apr 2016 04:13:55 -0700 (PDT) Received: from [192.168.0.44] (host109-150-176-203.range109-150.btcentralplus.com. [109.150.176.203]) by smtp.googlemail.com with ESMTPSA id n10sm29131272pax.18.2016.04.25.04.13.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Apr 2016 04:13:54 -0700 (PDT) To: "Barros Pena, Belen" , sujith h References: <56FD3DB9.8030601@intel.com> From: Michael Wood Message-ID: <571DFBEF.7010908@intel.com> Date: Mon, 25 Apr 2016 12:13:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Cc: "toaster@yoctoproject.org" Subject: Re: Review required for patches related to bug 7005 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: Mon, 25 Apr 2016 11:14:00 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Sujith, Thanks for the patches here is some code-review, it's mostly cosmetic issues: http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=sujith/toaster-unique-projectname&id=17739189416e444d8dce7cb7c64aaf776f85d1ff From 17739189416e444d8dce7cb7c64aaf776f85d1ff Mon Sep 17 00:00:00 2001 From: Sujith H Date: Mon, 25 Apr 2016 06:27:35 +0000 Subject: toaster: projectNameValidation API added The projectNameValidation API would help users to validate if a project name exists or not. This API is added to libtoaster. [YOCTO #7005] Signed-off-by: Sujith H diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index 43930a2..e8c14cd 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -374,6 +374,46 @@ var libtoaster = (function (){ }); } + /* Validate project names. Use unique project names */ + /* Arguments include projectnameid, hinterrorid, validateprojectnameid, enableordisablebtnid */ - MW - Good that you're documenting the function but we need to know what the arguments are, not just listing the variable names, that doesn't really help as the names are already below in the function definition anyway. We need to have a short description of what the variables are expecting and the type if it's not obvious e.g. string or jquery Element. + function _projectNameValidation(projectnameid, hinterrorid, + ctrlgrpvalidateprojectnameid, enableordisablebtnid ) { + - MW - The variables are all called somethingid, but you're not passing an id, you're passing a jQuery element. Either is fine really but make sure what you're passing in and the variable names match, e.g. if it's going to be an id string "the-element-id" then it would be something like projectNameElementId, or if you're going to pass in jQuery object it could be projectName and then in the documentation string make sure you say it's a jQuery object expected. Don't forget that in javascript we use camelCaseLikeThis for variable names and functions. https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster#Javascript We should also name the function something more like makeProjectNameValidation because this function isn't going to return anything, like 'invalid' or 'valid' as you'd expect from a validation function, it is in fact setting up/making the event handlers for the inputs. + /* The moment user types project name remove the error */ + projectnameid.on("input", function() { + ctrlgrpvalidateprojectnameid.removeClass('control-group error'); + hinterrorid.hide(); + }); + + /* Validate new project name */ + projectnameid.on("blur",function() { + var projectname = $(this).val(); + $.ajax({ + type: "GET", + url: libtoaster.ctx.projectsTypeAheadUrl, + data: { 'search' : projectname }, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function( data ) { + if (data.results.length > 0 && + data.results[0].name === projectname) { + // This project name exists hence show the error and disable + // the save button + ctrlgrpvalidateprojectnameid.addClass('control-group error'); + hinterrorid.show(); + enableordisablebtnid.attr('disabled', 'disabled'); + } else { + ctrlgrpvalidateprojectnameid.removeClass('control-group error'); + hinterrorid.hide(); + enableordisablebtnid.removeAttr('disabled'); + } + }, + error: function (data) { + console.log(data); + }, + }); + }); + } + - MW - All this needs to be indented by 2 spaces as you're inside the projectNameValidation function. return { reload_params : reload_params, @@ -390,6 +430,7 @@ var libtoaster = (function (){ makeLayerAddRmAlertMsg : _makeLayerAddRmAlertMsg, showChangeNotification : _showChangeNotification, createCustomRecipe: _createCustomRecipe, + projectNameValidation: _projectNameValidation, }; })(); -- cgit v0.10.2 http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=sujith/toaster-unique-projectname&id=8d3b47ec15dbd93e077ec10cd928648258b84181 From 8d3b47ec15dbd93e077ec10cd928648258b84181 Mon Sep 17 00:00:00 2001 From: Sujith H Date: Mon, 25 Apr 2016 06:29:19 +0000 Subject: toaster: ui handles duplicate project name in new project page When already existing project name is typed by user, the ui pops up message regarding the existance of the project name. [YOCTO #7005] Signed-off-by: Sujith H diff --git a/bitbake/lib/toaster/toastergui/templates/newproject.html b/bitbake/lib/toaster/toastergui/templates/newproject.html index e83b2be..19ab749 100644 --- a/bitbake/lib/toaster/toastergui/templates/newproject.html +++ b/bitbake/lib/toaster/toastergui/templates/newproject.html @@ -21,7 +21,10 @@
- +
+ +
+
- MW - hint-error-project-name not hintError-project-name no camel case for HTML elements https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster#HTML