Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 45D4810C89 for ; Thu, 31 Oct 2013 20:40:02 +0000 (UTC) Received: (qmail 97960 invoked by uid 500); 31 Oct 2013 20:40:02 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 97869 invoked by uid 500); 31 Oct 2013 20:40:02 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 97729 invoked by uid 99); 31 Oct 2013 20:40:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Oct 2013 20:40:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CED256805; Thu, 31 Oct 2013 20:40:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Thu, 31 Oct 2013 20:40:02 -0000 Message-Id: <9696b874c00142f3a8103341919d19f3@git.apache.org> In-Reply-To: <6f766804447e4625852447dba669ba3c@git.apache.org> References: <6f766804447e4625852447dba669ba3c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: updated refs/heads/master to 0db10ad VM snapshot: Make multi-select action Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0db10ad5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0db10ad5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0db10ad5 Branch: refs/heads/master Commit: 0db10ad55cd15d00e8fe09d48ae6af671bba7da6 Parents: f930ccd Author: Brian Federle Authored: Thu Oct 31 13:39:40 2013 -0700 Committer: Brian Federle Committed: Thu Oct 31 13:39:40 2013 -0700 ---------------------------------------------------------------------- ui/scripts/instances.js | 147 ++++++++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 64 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0db10ad5/ui/scripts/instances.js ---------------------------------------------------------------------- diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index a3d4ca5..625be51 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -16,10 +16,90 @@ // under the License. (function($, cloudStack) { var vmMigrationHostObjs; + + var vmSnapshotAction = function(args) { + var action = { + messages: { + notification: function(args) { + return 'label.action.vmsnapshot.create'; + } + }, + label: 'label.action.vmsnapshot.create', + addRow: 'false', + createForm: { + title: 'label.action.vmsnapshot.create', + fields: { + name: { + label: 'label.name', + isInput: true + }, + description: { + label: 'label.description', + isTextarea: true + }, + snapshotMemory: { + label: 'label.vmsnapshot.memory', + isBoolean: true, + isChecked: false + } + } + }, + action: function(args) { + var instances = args.context.instances; + + $(instances).map(function(index, instance) { + var array1 = []; + array1.push("&snapshotmemory=" + (args.data.snapshotMemory == "on")); + var displayname = args.data.name; + if (displayname != null && displayname.length > 0) { + array1.push("&name=" + todb(displayname)); + } + var description = args.data.description; + if (description != null && description.length > 0) { + array1.push("&description=" + todb(description)); + } + $.ajax({ + url: createURL("createVMSnapshot&virtualmachineid=" + instance.id + array1.join("")), + dataType: "json", + async: true, + success: function(json) { + var jid = json.createvmsnapshotresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.virtualmachine; + }, + getActionFilter: function() { + return vmActionfilter; + } + } + }); + } + }); + }); + + }, + notification: { + poll: pollAsyncJobResult + } + }; + + if (args && args.listView) { + $.extend(action, { + isHeader: true, + isMultiSelectAction: true + }); + } + + return action; + }; + cloudStack.sections.instances = { title: 'label.instances', id: 'instances', listView: { + multiSelect: true, section: 'instances', filters: { all: { @@ -181,7 +261,8 @@ notification: { poll: pollAsyncJobResult } - } + }, + snapshot: vmSnapshotAction({ listView: true }) }, dataProvider: function(args) { @@ -246,7 +327,6 @@ success: function(json) { var items = json.listvirtualmachinesresponse.virtualmachine; args.response.success({ - actionFilter: vmActionfilter, data: items }); } @@ -470,68 +550,7 @@ poll: pollAsyncJobResult } }, - snapshot: { - messages: { - notification: function(args) { - return 'label.action.vmsnapshot.create'; - } - }, - label: 'label.action.vmsnapshot.create', - addRow: 'false', - createForm: { - title: 'label.action.vmsnapshot.create', - fields: { - name: { - label: 'label.name', - isInput: true - }, - description: { - label: 'label.description', - isTextarea: true - }, - snapshotMemory: { - label: 'label.vmsnapshot.memory', - isBoolean: true, - isChecked: false - } - } - }, - action: function(args) { - var array1 = []; - array1.push("&snapshotmemory=" + (args.data.snapshotMemory == "on")); - var displayname = args.data.name; - if (displayname != null && displayname.length > 0) { - array1.push("&name=" + todb(displayname)); - } - var description = args.data.description; - if (description != null && description.length > 0) { - array1.push("&description=" + todb(description)); - } - $.ajax({ - url: createURL("createVMSnapshot&virtualmachineid=" + args.context.instances[0].id + array1.join("")), - dataType: "json", - async: true, - success: function(json) { - var jid = json.createvmsnapshotresponse.jobid; - args.response.success({ - _custom: { - jobId: jid, - getUpdatedItem: function(json) { - return json.queryasyncjobresultresponse.jobresult.virtualmachine; - }, - getActionFilter: function() { - return vmActionfilter; - } - } - }); - } - }); - - }, - notification: { - poll: pollAsyncJobResult - } - }, + snapshot: vmSnapshotAction(), destroy: { label: 'label.action.destroy.instance', compactLabel: 'label.destroy',