diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 73cc86e0f5..92129ec624 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -608,8 +608,7 @@ tabs: MarketPlace.delete: true marketplaceapps-tab: panel_tabs: - #marketplaces_info_tab: true - #marketplaces_apps_tab: true + marketplaceapp_info_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 251fa4d62e..4c17853ab5 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -603,8 +603,7 @@ tabs: MarketPlace.delete: true marketplaceapps-tab: panel_tabs: - #marketplaces_info_tab: true - #marketplaces_apps_tab: true + marketplaceapp_info_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab.js b/src/sunstone/public/app/tabs/marketplaceapps-tab.js index 57839aefc1..9a7ef6b7e0 100644 --- a/src/sunstone/public/app/tabs/marketplaceapps-tab.js +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab.js @@ -27,7 +27,7 @@ define(function(require) { ]; var _panels = [ - //require('./marketplaceapps-tab/panels/info') + require('./marketplaceapps-tab/panels/info') ]; var _panelsHooks = [ diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info.js b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info.js new file mode 100644 index 0000000000..96dce6fa3e --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info.js @@ -0,0 +1,96 @@ +/* -------------------------------------------------------------------------- */ +/* 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 Humanize = require('utils/humanize'); + var RenameTr = require('utils/panel/rename-tr'); + var TemplateTable = require('utils/panel/template-table'); + var PermissionsTable = require('utils/panel/permissions-table'); + var OpenNebulaMarketPlaceApp = require('opennebula/marketplaceapp'); + + /* + TEMPLATES + */ + + var TemplateInfo = require('hbs!./info/html'); + + /* + CONSTANTS + */ + + var TAB_ID = require('../tabId'); + var PANEL_ID = require('./info/panelId'); + var RESOURCE = "MarketPlaceApp" + var XML_ROOT = "MARKETPLACEAPP" + + /* + CONSTRUCTOR + */ + + function Panel(info) { + this.title = Locale.tr("Info"); + this.icon = "fa-info-circle"; + + this.element = info[XML_ROOT]; + + return this; + }; + + Panel.PANEL_ID = PANEL_ID; + Panel.prototype.html = _html; + Panel.prototype.setup = _setup; + + return Panel; + + /* + FUNCTION DEFINITIONS + */ + + + function _html() { + var renameTrHTML = RenameTr.html(TAB_ID, RESOURCE, this.element.NAME); + var templateTableHTML = TemplateTable.html( + this.element.TEMPLATE, RESOURCE, + Locale.tr("Attributes")); + var permissionsTableHTML = PermissionsTable.html(TAB_ID, RESOURCE, this.element); + var stateStr = OpenNebulaMarketPlaceApp.stateStr(this.element.STATE); + var typeStr = OpenNebulaMarketPlaceApp.typeStr(this.element.TYPE); + var sizeStr = Humanize.sizeFromMB(this.element.SIZE); + + + return TemplateInfo({ + 'element': this.element, + 'renameTrHTML': renameTrHTML, + 'templateTableHTML': templateTableHTML, + 'permissionsTableHTML': permissionsTableHTML, + 'stateStr': stateStr, + 'typeStr': typeStr, + 'sizeStr': sizeStr + }); + } + + function _setup(context) { + RenameTr.setup(TAB_ID, RESOURCE, this.element.ID, context); + TemplateTable.setup(this.element.TEMPLATE, RESOURCE, this.element.ID, context); + PermissionsTable.setup(TAB_ID, RESOURCE, this.element, context); + return false; + } +}); diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/html.hbs new file mode 100644 index 0000000000..9bb4b7b48b --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/html.hbs @@ -0,0 +1,64 @@ +{{! -------------------------------------------------------------------------- }} +{{! 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. }} +{{! -------------------------------------------------------------------------- }} + +
+
+ + + + + + + + + + + + {{{renameTrHTML}}} + + + + + + + + + + + + + + + + + + + + + + + + + +
{{tr "Information"}}
{{tr "ID"}}{{element.ID}}
{{tr "MarketPlace"}}{{element.MARKETPLACE}}
{{tr "Register time"}}{{prettyRegTime}}
{{tr "Type"}}{{typeStr}}
{{tr "Size"}}{{sizeStr}}
{{tr "State"}}{{stateStr}}
+
+
+ {{{permissionsTableHTML}}} +
+
+
+
{{{templateTableHTML}}}
+
diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/panelId.js b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/panelId.js new file mode 100644 index 0000000000..938ea72f7b --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/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 'marketplaceapp_info_tab'; +});