From 53072af8f79dd42809877c300cf18644d3d0fdae Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 1 Nov 2012 12:17:09 -0700 Subject: [PATCH] CS-16295: Fix select project search box Adds search functionality to 'select project' dialog's input box, which was not sending value to the listProjects API --- ui/scripts/projects.js | 13 +++++++++---- ui/scripts/ui-custom/projects.js | 7 +++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js index 34c57c6aae7..8310ecf0e4c 100644 --- a/ui/scripts/projects.js +++ b/ui/scripts/projects.js @@ -569,13 +569,18 @@ // Project listing data provider dataProvider: function(args) { var user = args.context.users[0]; + var data = { + accountId: user.userid, + listAll: true + }; + + if (args.projectName) { + data.keyword = args.projectName; + } $.ajax({ url: createURL('listProjects', { ignoreProject: true }), - data: { - accountId: user.userid, - listAll: true - }, + data: data, dataType: 'json', async: true, success: function(data) { diff --git a/ui/scripts/ui-custom/projects.js b/ui/scripts/ui-custom/projects.js index 221d834d29f..117c4337726 100644 --- a/ui/scripts/ui-custom/projects.js +++ b/ui/scripts/ui-custom/projects.js @@ -543,8 +543,9 @@ var $cancel = $('
').addClass('button cancel').html(_l('label.cancel')); // Get project data - var loadData = function(complete) { + var loadData = function(complete, options) { cloudStack.projects.dataProvider({ + projectName: options ? options.projectName : null, context: cloudStack.context, response: { success: function(args) { @@ -585,7 +586,9 @@ // Search form $searchForm.submit(function() { $list.find('li').remove(); - loadData(); + loadData(null, { + projectName: $(this).find('input[type=text]').val() + }); return false; });