diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js
index fe1224cafa..e3faaafbdf 100644
--- a/src/sunstone/public/app/opennebula/vm.js
+++ b/src/sunstone/public/app/opennebula/vm.js
@@ -18,7 +18,8 @@ define(function(require) {
var OpenNebulaAction = require('./action'),
OpenNebulaHelper = require('./helper'),
OpenNebulaError = require('./error');
- Locale = require('utils/locale');
+ Locale = require('utils/locale'),
+ Navigation = require('utils/navigation');
var OpenNebulaCluster = require('./cluster');
@@ -577,6 +578,18 @@ define(function(require) {
return hostname;
},
+ "hostnameStrLink": function(element) {
+ var state = element.STATE;
+ var hostname = "--";
+ if (state == STATES.ACTIVE || state == STATES.SUSPENDED || state == STATES.POWEROFF) {
+ var history = retrieveLastHistoryRecord(element)
+ if (history) {
+ hostname = Navigation.link(history.HOSTNAME, "hosts-tab", history.HID);
+ };
+ };
+
+ return hostname;
+ },
"clusterStr": function(element) {
var state = element.STATE;
var cluster = "--";
diff --git a/src/sunstone/public/app/tabs/images-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/images-tab/panels/info/html.hbs
index 61557430e1..764b795aab 100644
--- a/src/sunstone/public/app/tabs/images-tab/panels/info/html.hbs
+++ b/src/sunstone/public/app/tabs/images-tab/panels/info/html.hbs
@@ -30,7 +30,7 @@
{{{renameTrHTML}}}
{{tr "Datastore"}} |
- {{element.DATASTORE}} |
+ {{navigate element.DATASTORE "datastores-tab" element.DATASTORE_ID}} |
|
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
index 378fc7af11..3401f57ee3 100644
--- a/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/html.hbs
+++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/panels/info/html.hbs
@@ -30,7 +30,7 @@
{{{renameTrHTML}}}
{{tr "MarketPlace"}} |
- {{element.MARKETPLACE}} |
+ {{navigate element.MARKETPLACE "marketplaces-tab" element.MARKETPLACE_ID}} |
|
diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/html.hbs b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/html.hbs
index f5b4d0bb0a..89d54b9ff9 100644
--- a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/html.hbs
+++ b/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/html.hbs
@@ -65,7 +65,7 @@
{{state}} |
{{/if}}
{{cardinality}} |
- {{vm_template}} |
+ {{navigate vm_template "templates-tab" vm_template}} |
{{parents}} |
{{/each}}
diff --git a/src/sunstone/public/app/tabs/users-tab/panels/info/chgrp-tr.hbs b/src/sunstone/public/app/tabs/users-tab/panels/info/chgrp-tr.hbs
index cbf7b10e2b..6df1cb8133 100644
--- a/src/sunstone/public/app/tabs/users-tab/panels/info/chgrp-tr.hbs
+++ b/src/sunstone/public/app/tabs/users-tab/panels/info/chgrp-tr.hbs
@@ -16,7 +16,7 @@
{{tr "Group"}} |
- {{element.GNAME}} |
+ {{navigate element.GNAME "groups-tab" element.GID}} |
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info.js b/src/sunstone/public/app/tabs/vms-tab/panels/info.js
index 19ceea2e36..a7b334a711 100644
--- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js
+++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js
@@ -24,9 +24,10 @@ define(function(require) {
var RenameTr = require('utils/panel/rename-tr');
var PermissionsTable = require('utils/panel/permissions-table');
var TemplateTable = require('utils/panel/template-table');
- var OpenNebulaVM = require('opennebula/vm');
+ var OpenNebula = require('opennebula');
var Sunstone = require('sunstone');
var Config = require('sunstone-config');
+ var Navigation = require('utils/navigation');
/*
TEMPLATES
@@ -71,9 +72,16 @@ define(function(require) {
var permissionsTableHTML = PermissionsTable.html(TAB_ID, RESOURCE, this.element);
var prettyStartTime = Humanize.prettyTime(this.element.STIME);
- var stateStr = OpenNebulaVM.stateStr(this.element.STATE);
- var lcmStateStr = OpenNebulaVM.lcmStateStr(this.element.LCM_STATE);
- var hostname = OpenNebulaVM.hostnameStr(this.element);
+ var stateStr = OpenNebula.VM.stateStr(this.element.STATE);
+ var lcmStateStr = OpenNebula.VM.lcmStateStr(this.element.LCM_STATE);
+ var hostnameHTML = OpenNebula.VM.hostnameStrLink(this.element);
+ var vrouterHTML = '--';
+
+ if (this.element.TEMPLATE.VROUTER_ID != undefined){
+ vrouterHTML = Navigation.link(
+ OpenNebula.VirtualRouter.getName(this.element.TEMPLATE.VROUTER_ID),
+ "vrouters-tab", this.element.TEMPLATE.VROUTER_ID);
+ }
var deployId = (typeof(this.element.DEPLOY_ID) == "object" ? "--" : this.element.DEPLOY_ID);
var resched = (parseInt(this.element.RESCHED) ? Locale.tr("yes") : Locale.tr("no"))
@@ -111,14 +119,14 @@ define(function(require) {
'renameTrHTML': renameTrHTML,
'stateStr': stateStr,
'lcmStateStr': lcmStateStr,
- 'hostname': hostname,
+ 'hostnameHTML': hostnameHTML,
'prettyStartTime': prettyStartTime,
'deployId': deployId,
'resched': resched,
'permissionsTableHTML': permissionsTableHTML,
'templateTableHTML': templateTableHTML,
'monitoringTableContentHTML': monitoringTableContentHTML,
- 'renameTrHTML': renameTrHTML
+ 'vrouterHTML': vrouterHTML
});
}
@@ -126,10 +134,6 @@ define(function(require) {
RenameTr.setup(TAB_ID, RESOURCE, this.element.ID, context);
PermissionsTable.setup(TAB_ID, RESOURCE, this.element, context);
- $("a.vrid", context).on("click", function(){
- Sunstone.showElement("vrouters-tab", $(this).text());
- });
-
// Get rid of the unwanted (for show) SCHED_* keys
var that = this;
var strippedTemplate = {};
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs
index a702cc2d84..10bae54700 100644
--- a/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs
+++ b/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs
@@ -40,7 +40,7 @@
|
{{tr "Host"}} |
- {{hostname}} |
+ {{{hostnameHTML}}} |
|
@@ -59,13 +59,9 @@
|
- {{tr "Virtual Router ID"}} |
+ {{tr "Virtual Router"}} |
- {{#if element.TEMPLATE.VROUTER_ID}}
- {{element.TEMPLATE.VROUTER_ID}}
- {{else}}
- --
- {{/if}}
+ {{{vrouterHTML}}}
|
|
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/network.js b/src/sunstone/public/app/tabs/vms-tab/panels/network.js
index d08177a3d6..a1286d8752 100644
--- a/src/sunstone/public/app/tabs/vms-tab/panels/network.js
+++ b/src/sunstone/public/app/tabs/vms-tab/panels/network.js
@@ -28,6 +28,7 @@ define(function(require) {
var StateActions = require('../utils/state-actions');
var OpenNebulaVM = require('opennebula/vm');
var SecGroupsCommon = require('tabs/secgroups-tab/utils/common');
+ var Navigation = require('utils/navigation');
/*
CONSTANTS
@@ -298,7 +299,7 @@ define(function(require) {
nic_dt_data.push({
NIC_ID : nic.NIC_ID,
- NETWORK : nic.NETWORK,
+ NETWORK : Navigation.link(nic.NETWORK, "vnets-tab", nic.NETWORK_ID),
IP : _ipTr(nic, "IP"),
MAC : nic.MAC,
PCI_ADDRESS: pci_address,
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/placement.js b/src/sunstone/public/app/tabs/vms-tab/panels/placement.js
index 21b77278e6..f33d71ceba 100644
--- a/src/sunstone/public/app/tabs/vms-tab/panels/placement.js
+++ b/src/sunstone/public/app/tabs/vms-tab/panels/placement.js
@@ -23,6 +23,7 @@ define(function(require) {
var Humanize = require('utils/humanize');
var OpenNebulaVM = require('opennebula/vm');
var TemplateUtils = require('utils/template-utils');
+ var Navigation = require('utils/navigation');
/*
CONSTANTS
@@ -113,8 +114,8 @@ define(function(require) {
html += ' \
' + history[i].SEQ + ' | \
- ' + history[i].HOSTNAME + ' | \
- ' + history[i].DS_ID + ' | \
+ ' + Navigation.link(history[i].HOSTNAME, "hosts-tab", history[i].HID) + ' | \
+ ' + Navigation.link(history[i].DS_ID, "datastores-tab", history[i].DS_ID) + ' | \
' + OpenNebulaVM.migrateActionStr(parseInt(history[i].ACTION, 10)) + ' | \
' + OpenNebulaVM.migrateReasonStr(parseInt(history[i].REASON, 10)) + ' | \
' + Humanize.prettyTime(history[i].STIME) + ' | \
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js
index 241ad0d538..b4bfdf4078 100644
--- a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js
+++ b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js
@@ -28,6 +28,7 @@ define(function(require) {
var Tree = require('utils/tree');
var TemplateHtml = require('hbs!./storage/html');
var DiskDetailsHtml = require('hbs!./storage/disk-details');
+ var Navigation = require('utils/navigation');
/*
CONSTANTS
@@ -247,10 +248,22 @@ define(function(require) {
sizeStr += '-';
}
+ var imagetr;
+
+ if (disk.IMAGE != undefined){
+ if (disk.IMAGE_ID != undefined){
+ imagetr = Navigation.link(disk.IMAGE, "images-tab", disk.IMAGE_ID);
+ }else{
+ imagetr = disk.IMAGE;
+ }
+ }else{
+ imagetr = (Humanize.sizeFromMB(disk.SIZE) + (disk.FORMAT ? (' - ' + disk.FORMAT) : ''));
+ }
+
disk_dt_data.push({
DISK_ID : disk.DISK_ID,
TARGET : disk.TARGET,
- IMAGE : (disk.IMAGE ? disk.IMAGE : (Humanize.sizeFromMB(disk.SIZE) + (disk.FORMAT ? (' - ' + disk.FORMAT) : ''))),
+ IMAGE : imagetr,
SIZE: sizeStr,
SAVE : ((disk.SAVE && disk.SAVE == 'YES') ? Locale.tr('YES') : Locale.tr('NO')),
ACTIONS : actions,
diff --git a/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js b/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js
index ee53ad971b..529227b15f 100644
--- a/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js
+++ b/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js
@@ -26,6 +26,7 @@ define(function(require) {
var PermissionsTable = require('utils/panel/permissions-table');
var RenameTr = require('utils/panel/rename-tr');
var OpenNebulaVirtualRouter = require('opennebula/virtualrouter');
+ var Navigation = require('utils/navigation');
/*
TEMPLATES
@@ -84,6 +85,8 @@ define(function(require) {
$.map(nics, function(nic){
if (nic.NETWORK == undefined){
nic.NETWORK = "--";
+ } else if(nic.NETWORK_ID != undefined) {
+ nic.NETWORK = Navigation.link(nic.NETWORK, "vnets-tab", nic.NETWORK_ID)
}
if (nic.FLOATING_IP != undefined && nic.FLOATING_IP.toUpperCase() == "YES"){
diff --git a/src/sunstone/public/app/tabs/vrouters-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/vrouters-tab/panels/info/html.hbs
index 212cb203e2..2a0e7cb84b 100644
--- a/src/sunstone/public/app/tabs/vrouters-tab/panels/info/html.hbs
+++ b/src/sunstone/public/app/tabs/vrouters-tab/panels/info/html.hbs
@@ -60,7 +60,7 @@
{{#each nics}}
{{NIC_ID}} |
- {{NETWORK}} |
+ {{{NETWORK}}} |
{{IP}} |
{{IP6_ULA}} |
{{IP6_GLOBAL}} |
diff --git a/src/sunstone/public/app/templates/helpers/navigate.js b/src/sunstone/public/app/templates/helpers/navigate.js
new file mode 100644
index 0000000000..070bd1c6b7
--- /dev/null
+++ b/src/sunstone/public/app/templates/helpers/navigate.js
@@ -0,0 +1,28 @@
+/* -------------------------------------------------------------------------- */
+/* Copyright 2002-2016, 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 Handlebars = require('hbs/handlebars');
+ var Navigation = require('utils/navigation');
+
+ var navigate = function(text, tabId, elementId, options) {
+ return new Handlebars.SafeString(Navigation.link(text, tabId, elementId));
+ };
+
+ Handlebars.registerHelper('navigate', navigate);
+
+ return navigate;
+});
diff --git a/src/sunstone/public/app/utils/navigation.js b/src/sunstone/public/app/utils/navigation.js
new file mode 100644
index 0000000000..22b48e0204
--- /dev/null
+++ b/src/sunstone/public/app/utils/navigation.js
@@ -0,0 +1,44 @@
+/* -------------------------------------------------------------------------- */
+/* Copyright 2002-2016, 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 TemplateUtils = require('utils/template-utils');
+ var Config = require('sunstone-config');
+
+ /**
+ * Returns an html string with a link to the given tab (and element)
+ *
+ * @param {string} text The text
+ * @param {string} tabId e.g. vms-tab
+ * @param {string} elementId optional. Numeric ID
+ * @return {string} html '' element
+ */
+ function _link(text, tabId, elementId){
+ if (!Config.isTabEnabled(tabId)) {
+ return TemplateUtils.htmlEncode(text);
+ }
+
+ if (elementId != undefined){
+ return ''+TemplateUtils.htmlEncode(text)+'';
+ }else{
+ return ''+TemplateUtils.htmlEncode(text)+'';
+ }
+ }
+
+ return {
+ "link": _link
+ };
+});
\ No newline at end of file
diff --git a/src/sunstone/public/app/utils/panel/permissions-table/group.hbs b/src/sunstone/public/app/utils/panel/permissions-table/group.hbs
index 82c268661f..3f1a3b8be8 100644
--- a/src/sunstone/public/app/utils/panel/permissions-table/group.hbs
+++ b/src/sunstone/public/app/utils/panel/permissions-table/group.hbs
@@ -16,7 +16,7 @@
{{tr "Group"}} |
- {{element.GNAME}} |
+ {{navigate element.GNAME "groups-tab" element.GID}} |
{{#isTabActionEnabled tabName action}}
diff --git a/src/sunstone/public/app/utils/panel/permissions-table/owner.hbs b/src/sunstone/public/app/utils/panel/permissions-table/owner.hbs
index 698c1bfcb6..46498ab289 100644
--- a/src/sunstone/public/app/utils/panel/permissions-table/owner.hbs
+++ b/src/sunstone/public/app/utils/panel/permissions-table/owner.hbs
@@ -16,7 +16,7 @@
{{tr "Owner"}} |
- {{element.UNAME}} |
+ {{navigate element.UNAME "users-tab" element.UID}} |
{{#isTabActionEnabled tabName action}}
| |