diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml
index 6c86a4eab0..3df41f6a2d 100644
--- a/src/sunstone/etc/sunstone-views/admin.yaml
+++ b/src/sunstone/etc/sunstone-views/admin.yaml
@@ -24,6 +24,7 @@ enabled_tabs:
- oneflow-dashboard
- oneflow-services-tab
- oneflow-templates-tab
+ - marketplaces-tab
- settings-tab
- support-tab
autorefresh: true
@@ -581,3 +582,25 @@ tabs:
user_showback_tab: true
actions:
User.quotas_dialog: false
+ marketplaces-tab:
+ panel_tabs:
+ #marketplaces_info_tab: true
+ #marketplaces_apps_tab: true
+ table_columns:
+ - 0 # Checkbox
+ - 1 # ID
+ - 2 # Owner
+ - 3 # Group
+ - 4 # Name
+ - 5 # Capacity
+ - 6 # Apps
+ - 7 # Driver
+ #- 8 # Labels
+ actions:
+ Datastore.refresh: true
+ #Datastore.create_dialog: true
+ Datastore.rename: true
+ Datastore.chown: true
+ Datastore.chgrp: true
+ Datastore.chmod: true
+ Datastore.delete: true
diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml
index 3c04a2f77a..f1bfb15061 100644
--- a/src/sunstone/etc/sunstone-views/user.yaml
+++ b/src/sunstone/etc/sunstone-views/user.yaml
@@ -23,6 +23,7 @@ enabled_tabs:
- oneflow-dashboard
- oneflow-services-tab
- oneflow-templates-tab
+ - marketplaces-tab
- settings-tab
#- support-tab
autorefresh: true
@@ -576,3 +577,17 @@ tabs:
user_showback_tab: true
actions:
User.quotas_dialog: false
+ marketplaces-tab:
+ panel_tabs:
+ #marketplaces_info_tab: true
+ #marketplaces_apps_tab: true
+ table_columns:
+ - 0 # Checkbox
+ - 1 # ID
+ - 2 # Owner
+ - 3 # Group
+ - 4 # Name
+ - 5 # Capacity
+ - 6 # Apps
+ - 7 # Driver
+ #- 8 # Labels
diff --git a/src/sunstone/public/app/main.js b/src/sunstone/public/app/main.js
index 6ec3eb46fa..3360e6ffe6 100644
--- a/src/sunstone/public/app/main.js
+++ b/src/sunstone/public/app/main.js
@@ -142,6 +142,7 @@ require.config({
'tabs/oneflow-dashboard',
'tabs/oneflow-services-tab',
'tabs/oneflow-templates-tab',
+ 'tabs/marketplaces-tab',
'tabs/settings-tab',
'tabs/support-tab'
]
diff --git a/src/sunstone/public/app/tabs/marketplaces-tab.js b/src/sunstone/public/app/tabs/marketplaces-tab.js
new file mode 100644
index 0000000000..c5bafd992a
--- /dev/null
+++ b/src/sunstone/public/app/tabs/marketplaces-tab.js
@@ -0,0 +1,58 @@
+/* -------------------------------------------------------------------------- */
+/* 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) {
+ var Locale = require('utils/locale');
+ var Buttons = require('./marketplaces-tab/buttons');
+ var Actions = require('./marketplaces-tab/actions');
+ var Table = require('./marketplaces-tab/datatable');
+
+ var TAB_ID = require('./marketplaces-tab/tabId');
+ var DATATABLE_ID = "dataTableMarketplaces";
+
+ var _dialogs = [
+ ];
+
+ var _panels = [
+ //require('./marketplaces-tab/panels/info')
+ ];
+
+ var _panelsHooks = [
+ require('../utils/hooks/header')
+ ];
+
+ var _formPanels = [
+ //require('./datastores-tab/form-panels/create')
+ ];
+
+ var Tab = {
+ tabId: TAB_ID,
+ title: ' ' + Locale.tr("MarketPlaces"),
+ listHeader: ' '+Locale.tr("MarketPlaces"),
+ infoHeader: ' '+Locale.tr("MarketPlace"),
+ subheader: ' ',
+ resource: 'MarketPlace',
+ buttons: Buttons,
+ actions: Actions,
+ dataTable: new Table(DATATABLE_ID, {actions: true, info: true, oneSelection: true}),
+ panels: _panels,
+ panelsHooks: _panelsHooks,
+ formPanels: _formPanels,
+ dialogs: _dialogs
+ };
+
+ return Tab;
+});
diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/actions.js b/src/sunstone/public/app/tabs/marketplaces-tab/actions.js
new file mode 100644
index 0000000000..1a7c25f254
--- /dev/null
+++ b/src/sunstone/public/app/tabs/marketplaces-tab/actions.js
@@ -0,0 +1,48 @@
+/* -------------------------------------------------------------------------- */
+/* 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) {
+ var Sunstone = require('sunstone');
+ var Notifier = require('utils/notifier');
+ var Locale = require('utils/locale');
+ var CommonActions = require('utils/common-actions');
+ var OpenNebulaResource = require('opennebula/marketplace');
+
+ var RESOURCE = "MarketPlace";
+ var XML_ROOT = "MARKETPLACE";
+ var TAB_ID = require('./tabId');
+ //var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId');
+
+ var _commonActions = new CommonActions(OpenNebulaResource, RESOURCE, TAB_ID, XML_ROOT);
+
+ var _actions = {
+ //"MarketPlace.create" : _commonActions.create(CREATE_DIALOG_ID),
+ //"MarketPlace.create_dialog" : _commonActions.showCreate(CREATE_DIALOG_ID),
+ "MarketPlace.list" : _commonActions.list(),
+ "MarketPlace.show" : _commonActions.show(),
+ "MarketPlace.refresh" : _commonActions.refresh(),
+ "MarketPlace.delete" : _commonActions.del(),
+ "MarketPlace.chown": _commonActions.multipleAction('chown'),
+ "MarketPlace.chgrp": _commonActions.multipleAction('chgrp'),
+ "MarketPlace.chmod": _commonActions.singleAction('chmod'),
+ //"MarketPlace.update" : _commonActions.updateTemplate(),
+ //"MarketPlace.update_template" : _commonActions.updateTemplate(),
+ //"MarketPlace.append_template" : _commonActions.appendTemplate(),
+ "MarketPlace.rename": _commonActions.singleAction('rename')
+ }
+
+ return _actions;
+});
diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/buttons.js b/src/sunstone/public/app/tabs/marketplaces-tab/buttons.js
new file mode 100644
index 0000000000..dbebbf948b
--- /dev/null
+++ b/src/sunstone/public/app/tabs/marketplaces-tab/buttons.js
@@ -0,0 +1,52 @@
+/* -------------------------------------------------------------------------- */
+/* 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) {
+ var Locale = require('utils/locale');
+
+ var MarketPlaceButtons = {
+ "MarketPlace.refresh" : {
+ type: "action",
+ layout: "refresh",
+ alwaysActive: true
+ },
+ //"MarketPlace.create_dialog" : {
+ // type: "create_dialog",
+ // layout: "create"
+ //},
+ "MarketPlace.chown" : {
+ type: "confirm_with_select",
+ text: Locale.tr("Change owner"),
+ select: "User",
+ layout: "user_select",
+ tip: Locale.tr("Select the new owner") + ":"
+ },
+ "MarketPlace.chgrp" : {
+ type: "confirm_with_select",
+ text: Locale.tr("Change group"),
+ select: "Group",
+ layout: "user_select",
+ tip: Locale.tr("Select the new group") + ":"
+ },
+ "MarketPlace.delete" : {
+ type: "confirm",
+ text: Locale.tr("Delete"),
+ layout: "del"
+ }
+ };
+
+ return MarketPlaceButtons;
+})
diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js b/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js
new file mode 100644
index 0000000000..8e6b788cac
--- /dev/null
+++ b/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js
@@ -0,0 +1,139 @@
+/* -------------------------------------------------------------------------- */
+/* 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 TabDataTable = require('utils/tab-datatable');
+ var SunstoneConfig = require('sunstone-config');
+ var Locale = require('utils/locale');
+ var OpenNebulaMarketPlace = require('opennebula/marketplace');
+ var DatastoreCapacityBar = require('../datastores-tab/utils/datastore-capacity-bar');
+ var LabelsUtils = require('utils/labels/utils');
+
+ /*
+ CONSTANTS
+ */
+
+ var RESOURCE = "MarketPlace";
+ var XML_ROOT = "MARKETPLACE";
+ var TAB_NAME = require('./tabId');
+ var LABELS_COLUMN = 8;
+ var TEMPLATE_ATTR = 'TEMPLATE';
+
+ /*
+ CONSTRUCTOR
+ */
+
+ /*
+ @dataTableId
+ @param {String} dataTableId unique identifier
+ @param {Object} conf
+ conf = {
+ 'info': true, enable on click row will show the element
+ 'action': true, enable actions on row elements
+ 'select': true, enable selecting elements from the table
+ 'selectOptions': {
+ 'filter_fn': function(ds) { return ds.TYPE == 0; }
+ }
+ }
+ @returns {Table} A new table object
+ */
+ function Table(dataTableId, conf) {
+ this.conf = conf || {};
+ this.tabId = TAB_NAME;
+ this.dataTableId = dataTableId;
+ this.resource = RESOURCE;
+ this.xmlRoot = XML_ROOT;
+ this.labelsColumn = LABELS_COLUMN;
+
+ this.dataTableOptions = {
+ "bAutoWidth": false,
+ "bSortClasses" : false,
+ "bDeferRender": true,
+ "aoColumnDefs": [
+ {"bSortable": false, "aTargets": ["check"]},
+ {"sWidth": "35px", "aTargets": [0]},
+ {"sWidth": "250px", "aTargets": [5]},
+ {"bVisible": true, "aTargets": SunstoneConfig.tabTableColumns(TAB_NAME)},
+ {"bVisible": false, "aTargets": ['_all']}
+ ]
+ }
+
+ this.columns = [
+ Locale.tr("ID"),
+ Locale.tr("Owner"),
+ Locale.tr("Group"),
+ Locale.tr("Name"),
+ Locale.tr("Capacity"),
+ Locale.tr("Apps"),
+ Locale.tr("Driver"),
+ Locale.tr("Labels")
+ ]
+
+ this.selectOptions = {
+ "id_index": 1,
+ "name_index": 4,
+ "uname_index": 2,
+ "select_resource": Locale.tr("Please select a marketplace from the list"),
+ "you_selected": Locale.tr("You selected the following marketplace:"),
+ "select_resource_multiple": Locale.tr("Please select one or more marketplaces from the list"),
+ "you_selected_multiple": Locale.tr("You selected the following marketplaces:")
+ }
+
+ TabDataTable.call(this);
+ };
+
+ Table.prototype = Object.create(TabDataTable.prototype);
+ Table.prototype.constructor = Table;
+ Table.prototype.elementArray = _elementArray;
+
+ return Table;
+
+ /*
+ FUNCTION DEFINITIONS
+ */
+
+ function _elementArray(element_json) {
+ var element = element_json[XML_ROOT];
+
+ return [
+ '',
+ element.ID,
+ element.UNAME,
+ element.GNAME,
+ element.NAME,
+ DatastoreCapacityBar.html(element),
+ _lengthOf(element.MARKETPLACEAPPS.ID),
+ element.MARKET_MAD,
+ (LabelsUtils.labelsStr(element[TEMPLATE_ATTR])||'')
+ ];
+ }
+
+ function _lengthOf(ids){
+ var l = 0;
+ if ($.isArray(ids))
+ l = ids.length;
+ else if (!$.isEmptyObject(ids))
+ l = 1;
+
+ return l;
+ }
+});
diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/tabId.js b/src/sunstone/public/app/tabs/marketplaces-tab/tabId.js
new file mode 100644
index 0000000000..0a309c8e42
--- /dev/null
+++ b/src/sunstone/public/app/tabs/marketplaces-tab/tabId.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 'marketplaces-tab';
+});