diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 1028213ae1..73cc86e0f5 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -586,7 +586,7 @@ tabs: marketplaces-tab: panel_tabs: marketplace_info_tab: true - #marketplaces_apps_tab: true + marketplace_apps_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index b060c30a8e..251fa4d62e 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -581,7 +581,7 @@ tabs: marketplaces-tab: panel_tabs: marketplace_info_tab: true - #marketplaces_apps_tab: true + marketplaces_app_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/public/app/tabs/marketplaces-tab.js b/src/sunstone/public/app/tabs/marketplaces-tab.js index 03297e9cac..69c90b4bae 100644 --- a/src/sunstone/public/app/tabs/marketplaces-tab.js +++ b/src/sunstone/public/app/tabs/marketplaces-tab.js @@ -27,7 +27,8 @@ define(function(require) { ]; var _panels = [ - require('./marketplaces-tab/panels/info') + require('./marketplaces-tab/panels/info'), + require('./marketplaces-tab/panels/apps') ]; var _panelsHooks = [ diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/panels/apps.js b/src/sunstone/public/app/tabs/marketplaces-tab/panels/apps.js new file mode 100644 index 0000000000..88ede739d0 --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplaces-tab/panels/apps.js @@ -0,0 +1,87 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with 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. */ +/* -------------------------------------------------------------------------- */ + +define(function(require){ + /* + DEPENDENCIES + */ + + var Locale = require('utils/locale'); + var MarketPlaceAppsTable = require('tabs/marketplaceapps-tab/datatable'); + + /* + CONSTANTS + */ + + var PANEL_ID = require('./apps/panelId'); + var MARKETPLACEAPPS_TABLE_ID = PANEL_ID + "MarketPlaceAppsTable" + var XML_ROOT = "MARKETPLACE" + + /* + CONSTRUCTOR + */ + + function Panel(info) { + this.title = Locale.tr("Apps"); + this.icon = "fa-shopping-cart"; + + this.element = info[XML_ROOT.toUpperCase()]; + + return this; + }; + + Panel.PANEL_ID = PANEL_ID; + Panel.prototype.html = _html; + Panel.prototype.setup = _setup; + + return Panel; + + /* + FUNCTION DEFINITIONS + */ + + function _html() { + var marketPlaceApps = []; + + if (this.element.MARKETPLACEAPPS.ID != undefined){ + marketPlaceApps = this.element.MARKETPLACEAPPS.ID; + + if (!$.isArray(marketPlaceApps)){ + marketPlaceApps = [marketPlaceApps]; + } + } + + var opts = { + info: true, + select: true, + selectOptions: { + read_only: true, + fixed_ids: marketPlaceApps + } + }; + + this.marketPlaceAppsDataTable = new MarketPlaceAppsTable(MARKETPLACEAPPS_TABLE_ID, opts); + + return this.marketPlaceAppsDataTable.dataTableHTML; + } + + function _setup(context) { + this.marketPlaceAppsDataTable.initialize(); + this.marketPlaceAppsDataTable.refreshResourceTableSelect(); + + return false; + } +}) diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/panels/apps/panelId.js b/src/sunstone/public/app/tabs/marketplaces-tab/panels/apps/panelId.js new file mode 100644 index 0000000000..5dfeee8972 --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplaces-tab/panels/apps/panelId.js @@ -0,0 +1,19 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with 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. */ +/* -------------------------------------------------------------------------- */ + +define(function(require){ + return 'marketplace_apps_tab'; +});