diff --git a/src/sunstone/public/app/tabs/marketplace-tab.js b/src/sunstone/public/app/tabs/marketplace-tab.js index ccfd454c1c..0c26a4f199 100644 --- a/src/sunstone/public/app/tabs/marketplace-tab.js +++ b/src/sunstone/public/app/tabs/marketplace-tab.js @@ -11,7 +11,7 @@ define(function(require) { ]; var _panels = [ - //require('./marketplace-tab/panels/info') + require('./marketplace-tab/panels/info') ]; var _formPanels = [ diff --git a/src/sunstone/public/app/tabs/marketplace-tab/panels/info.js b/src/sunstone/public/app/tabs/marketplace-tab/panels/info.js new file mode 100644 index 0000000000..c178753546 --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplace-tab/panels/info.js @@ -0,0 +1,70 @@ +define(function(require) { + /* + DEPENDENCIES + */ + + var TemplateInfo = require('hbs!./info/html'); + var Locale = require('utils/locale'); + var Humanize = require('utils/humanize'); + var TemplateUtils = require('utils/template-utils'); + + /* + TEMPLATES + */ + + var TemplateTable = require('utils/panel/template-table'); + + /* + CONSTANTS + */ + + var PANEL_ID = require('./info/panelId'); + var RESOURCE = "Marketplace"; + + /* + CONSTRUCTOR + */ + + function Panel(info) { + this.title = Locale.tr("Info"); + this.icon = "fa-info-circle"; + + this.element = info; + + return this; + } + + Panel.PANEL_ID = PANEL_ID; + Panel.prototype.html = _html; + Panel.prototype.setup = _setup; + + return Panel; + + /* + FUNCTION DEFINITIONS + */ + + function _html() { + var url = this.element.links.download.href; + url = url.replace(/\/download$/, ''); + + var short_description = ""; + + if(this.element.short_description){ + short_description = TemplateUtils.htmlDecode(this.element.short_description).replace(/\n/g, "
"); + } + + var description = TemplateUtils.htmlDecode(this.element.description).replace(/\n/g, "
"); + + return TemplateInfo({ + 'element': this.element, + 'url': url, + 'short_description': short_description, + 'description': description + }); + } + + function _setup(context) { + return false; + } +}); diff --git a/src/sunstone/public/app/tabs/marketplace-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/marketplace-tab/panels/info/html.hbs new file mode 100644 index 0000000000..027ed0f1fe --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplace-tab/panels/info/html.hbs @@ -0,0 +1,134 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + {{#if element.status}} + + + + + {{/if}} + {{#if element.tags}} + + + + + {{/if}} + {{#if element.catalog}} + + + + + {{/if}} + + + + + + + + + {{#if element.files}} + + + + + {{/if}} + + + + + + + + + +
{{tr "Information"}}
{{tr "ID"}}{{element._id.$oid}}
{{tr "Name"}}{{element.name}}
{{tr "URL"}} + {{tr "link"}} +
{{tr "Publisher"}}{{element.publisher}}
{{tr "Downloads"}}{{element.downloads}}
{{tr "Status"}}{{element.status}}
{{tr "Tags"}}{{element.tags}}
{{tr "Catalog"}}{{element.catalog}}
{{tr "OS"}}{{element.os-id}} {{element.os-release}}
{{tr "Arch"}}{{element.os-arch}}
{{tr "Size"}}{{humanizeSize "B" element.files.[0].size}}
{{tr "Hypervisor"}}{{element.hypervisor}}
{{tr "Format"}}{{element.format}}
+
+
+ {{#if short_description}} + + + + + + + + + + + +
{{tr "Short Description"}}
{{{short_description}}}
+ {{/if}} + + + + + + + + + + + +
{{tr "Description"}}
{{{description}}}
+ + + + + + + + {{#each element.files}} + + + + + {{else}} + + + + {{/each}} + +
{{tr "Images"}}
{{name}}{{humanizeSize "B" size}}
{{tr "No Images defined"}}
+ {{#if element.opennebula_template}} + + + + + + + + + + + +
{{tr "OpenNebula Template"}}
{{element.opennebula_template}}
+ {{/if}} +
+
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/marketplace-tab/panels/info/panelId.js b/src/sunstone/public/app/tabs/marketplace-tab/panels/info/panelId.js new file mode 100644 index 0000000000..1f0c5d4722 --- /dev/null +++ b/src/sunstone/public/app/tabs/marketplace-tab/panels/info/panelId.js @@ -0,0 +1,3 @@ +define(function(require){ + return 'marketplace_info_tab'; +}); \ No newline at end of file