Rename widget 'plugins' to 'pluginListing' For better clarity on its function, rename the 'plugins' widget to 'pluginListing,' as it does not handle the actual plugin logic.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fca7b3ef Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fca7b3ef Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fca7b3ef Branch: refs/heads/ui-cisco-asa1000v-support Commit: fca7b3ef22b00f6003fbb6fa601c9b7c1a79dcec Parents: 7a4f70f Author: Brian Federle <[email protected]> Authored: Thu Apr 18 10:38:03 2013 -0700 Committer: Brian Federle <[email protected]> Committed: Thu Apr 18 10:49:45 2013 -0700 ---------------------------------------------------------------------- ui/index.jsp | 2 +- ui/scripts/plugins.js | 4 +- ui/scripts/ui-custom/pluginListing.js | 109 ++++++++++++++++++++++++++++ ui/scripts/ui-custom/plugins.js | 109 ---------------------------- 4 files changed, 111 insertions(+), 113 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fca7b3ef/ui/index.jsp ---------------------------------------------------------------------- diff --git a/ui/index.jsp b/ui/index.jsp index 46f49f0..550661e 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1681,7 +1681,7 @@ under the License. <script type="text/javascript" src="scripts/vm_snapshots.js?t=<%=now%>"></script> <!-- Plugins --> - <script type="text/javascript" src="scripts/ui-custom/plugins.js?t=<%=now%>"></script> + <script type="text/javascript" src="scripts/ui-custom/pluginListing.js?t=<%=now%>"></script> <script type="text/javascript" src="plugins/plugins.js?t=<%=now%>"></script> <script type="text/javascript" src="scripts/plugins.js?t=<%=now%>"></script> </body> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fca7b3ef/ui/scripts/plugins.js ---------------------------------------------------------------------- diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 5a33d56..d3e0705 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -51,7 +51,7 @@ cloudStack.sections.plugins = { title: 'label.plugins', - show: cloudStack.uiCustom.plugins + show: cloudStack.uiCustom.pluginListing }; // Load plugins @@ -70,7 +70,5 @@ ui: pluginAPI }); }); - - // Load CSS }); }(jQuery, cloudStack, require)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fca7b3ef/ui/scripts/ui-custom/pluginListing.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/pluginListing.js b/ui/scripts/ui-custom/pluginListing.js new file mode 100644 index 0000000..3dcce98 --- /dev/null +++ b/ui/scripts/ui-custom/pluginListing.js @@ -0,0 +1,109 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +(function($, cloudStack) { + var elems = { + pluginItem: function(args) { + var id = args.id; + var title = args.title; + var desc = args.desc; + var iconURL = args.iconURL; + var $pluginItem = $('<li>').addClass('plugin-item').addClass(id); + var $title = $('<span>').addClass('title').html(title); + var $desc = $('<span>').addClass('desc').html(desc); + var $icon = $('<span>').addClass('icon').append( + $('<img>').attr({ src: iconURL }) + ); + + $pluginItem.append( + $icon, $title, $desc + ); + + return $pluginItem; + }, + pluginListing: function(args) { + var plugins = args.plugins; + var $plugins = $('<ul>'); + var $pluginsListing = $('<div>').addClass('plugins-listing'); + + $(plugins).each(function() { + var plugin = this; + var $plugin = elems.pluginItem({ + id: plugin.id, + title: plugin.title, + desc: plugin.desc, + iconURL: 'plugins/' + plugin.id + '/icon.png' + }); + var $browser = $('#browser .container'); + + $plugin.click(function() { + $browser.cloudBrowser('addPanel', { + title: plugin.title, + $parent: $('.panel:first'), + complete: function($panel) { + $panel.detailView({ + name: 'Plugin details', + tabs: { + details: { + title: 'label.plugin.details', + fields: [ + { + name: { label: 'label.name' } + }, + { + desc: { label: 'label.description' }, + externalLink: { + isExternalLink: true, + label: 'label.external.link' + } + }, + { + authorName: { label: 'label.author.name' }, + authorEmail: { label: 'label.author.email' }, + id: { label: 'label.id' } + } + ], + dataProvider: function(args) { + args.response.success({ data: plugin }); + } + } + } + }); + } + }); + }); + + $plugin.appendTo($plugins); + }); + + $pluginsListing.append($plugins); + + return $pluginsListing; + } + }; + + cloudStack.uiCustom.pluginListing = function() { + var plugins = cloudStack.plugins; + + return elems.pluginListing({ + plugins: $(plugins).map(function(index, pluginID) { + var plugin = cloudStack.plugins[pluginID].config; + + return $.extend(plugin, { id: pluginID }); + }) + }); + }; +}(jQuery, cloudStack)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fca7b3ef/ui/scripts/ui-custom/plugins.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/plugins.js b/ui/scripts/ui-custom/plugins.js deleted file mode 100644 index aaf9531..0000000 --- a/ui/scripts/ui-custom/plugins.js +++ /dev/null @@ -1,109 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -(function($, cloudStack) { - var elems = { - pluginItem: function(args) { - var id = args.id; - var title = args.title; - var desc = args.desc; - var iconURL = args.iconURL; - var $pluginItem = $('<li>').addClass('plugin-item').addClass(id); - var $title = $('<span>').addClass('title').html(title); - var $desc = $('<span>').addClass('desc').html(desc); - var $icon = $('<span>').addClass('icon').append( - $('<img>').attr({ src: iconURL }) - ); - - $pluginItem.append( - $icon, $title, $desc - ); - - return $pluginItem; - }, - pluginListing: function(args) { - var plugins = args.plugins; - var $plugins = $('<ul>'); - var $pluginsListing = $('<div>').addClass('plugins-listing'); - - $(plugins).each(function() { - var plugin = this; - var $plugin = elems.pluginItem({ - id: plugin.id, - title: plugin.title, - desc: plugin.desc, - iconURL: 'plugins/' + plugin.id + '/icon.png' - }); - var $browser = $('#browser .container'); - - $plugin.click(function() { - $browser.cloudBrowser('addPanel', { - title: plugin.title, - $parent: $('.panel:first'), - complete: function($panel) { - $panel.detailView({ - name: 'Plugin details', - tabs: { - details: { - title: 'label.plugin.details', - fields: [ - { - name: { label: 'label.name' } - }, - { - desc: { label: 'label.description' }, - externalLink: { - isExternalLink: true, - label: 'label.external.link' - } - }, - { - authorName: { label: 'label.author.name' }, - authorEmail: { label: 'label.author.email' }, - id: { label: 'label.id' } - } - ], - dataProvider: function(args) { - args.response.success({ data: plugin }); - } - } - } - }); - } - }); - }); - - $plugin.appendTo($plugins); - }); - - $pluginsListing.append($plugins); - - return $pluginsListing; - } - }; - - cloudStack.uiCustom.plugins = function() { - var plugins = cloudStack.plugins; - - return elems.pluginListing({ - plugins: $(plugins).map(function(index, pluginID) { - var plugin = cloudStack.plugins[pluginID].config; - - return $.extend(plugin, { id: pluginID }); - }) - }); - }; -}(jQuery, cloudStack));
