diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 79966f13a1..a6bbfc4192 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -180,6 +180,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: Template.refresh: true Template.create_dialog: true @@ -219,6 +220,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: ServiceTemplate.refresh: true ServiceTemplate.create_dialog: true @@ -244,6 +246,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: VirtualRouterTemplate.refresh: true VirtualRouterTemplate.create_dialog: true @@ -299,6 +302,7 @@ tabs: - 11 # VNC #- 12 # Hidden Template #- 13 # Labels + #- 14 # Search data actions: VM.refresh: true VM.create_dialog: true @@ -386,6 +390,7 @@ tabs: - 4 # Name - 5 # State #- 6 # Labels + #- 7 # Search data actions: Service.refresh: true Service.chown: true @@ -408,6 +413,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: VirtualRouter.refresh: true VirtualRouter.create_dialog: true @@ -469,6 +475,7 @@ tabs: #- 11 # VM MAD #- 12 # Last monitored on #- 13 # Labels + #- 14 # Search data actions: Host.refresh: true Host.create_dialog: true @@ -518,6 +525,7 @@ tabs: - 10 # Type - 11 # Status #- 12 # Labels + #- 13 # Search data actions: Datastore.refresh: true Datastore.create_dialog: true @@ -552,6 +560,7 @@ tabs: - 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: Image.refresh: true Image.create_dialog: true @@ -590,6 +599,7 @@ tabs: #- 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: File.refresh: true File.create_dialog: true @@ -617,6 +627,7 @@ tabs: - 7 # Driver - 8 # Zone #- 9 # Labels + #- 10 # Search data actions: MarketPlace.refresh: true MarketPlace.create_dialog: true @@ -646,6 +657,7 @@ tabs: - 10 # Marketplace - 11 # Zone #- 12 # Labels + #- 13 # Search data actions: MarketPlaceApp.refresh: true MarketPlaceApp.create_dialog: true @@ -683,6 +695,7 @@ tabs: - 8 # Leases #- 9 # VLAN ID #- 10 # Labels + #- 11 # Search data actions: Network.refresh: true Network.create_dialog: true @@ -720,6 +733,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: SecurityGroup.refresh: true SecurityGroup.create_dialog: true diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 5edd7a3e16..b52dd1d57e 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -116,6 +116,7 @@ tabs: - 5 # Memory - 6 # CPU #- 7 # Labels + #- 8 # Search data actions: Group.refresh: true Group.create_dialog: true @@ -140,6 +141,7 @@ tabs: - 6 # VNets - 7 # Datastores #- 8 # Labels + #- 9 # Search data actions: Vdc.refresh: true Vdc.create_dialog: true @@ -178,6 +180,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: Template.refresh: true Template.create_dialog: true @@ -217,6 +220,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: ServiceTemplate.refresh: true ServiceTemplate.create_dialog: true @@ -242,6 +246,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: VirtualRouterTemplate.refresh: true VirtualRouterTemplate.create_dialog: true @@ -297,6 +302,7 @@ tabs: - 11 # VNC #- 12 # Hidden Template #- 13 # Labels + #- 14 # Search data actions: VM.refresh: true VM.create_dialog: true @@ -384,6 +390,7 @@ tabs: - 4 # Name - 5 # State #- 6 # Labels + #- 7 # Search data actions: Service.refresh: true Service.chown: true @@ -444,6 +451,7 @@ tabs: #- 11 # VM MAD #- 12 # Last monitored on #- 13 # Labels + #- 14 # Search data actions: Host.refresh: true Host.create_dialog: true @@ -493,6 +501,7 @@ tabs: - 10 # Type - 11 # Status #- 12 # Labels + #- 13 # Search data actions: Datastore.refresh: true Datastore.create_dialog: true @@ -527,6 +536,7 @@ tabs: - 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: Image.refresh: true Image.create_dialog: true @@ -565,6 +575,7 @@ tabs: #- 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: File.refresh: true File.create_dialog: true @@ -592,6 +603,7 @@ tabs: - 7 # Driver - 8 # Zone #- 9 # Labels + #- 10 # Search data actions: MarketPlace.refresh: true MarketPlace.create_dialog: true @@ -621,6 +633,7 @@ tabs: - 10 # Marketplace - 11 # Zone #- 12 # Labels + #- 13 # Search data actions: MarketPlaceApp.refresh: true MarketPlaceApp.create_dialog: true @@ -658,6 +671,7 @@ tabs: - 8 # Leases #- 9 # VLAN ID #- 10 # Labels + #- 11 # Search data actions: Network.refresh: true Network.create_dialog: true @@ -688,6 +702,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: VirtualRouter.refresh: true VirtualRouter.create_dialog: true @@ -718,6 +733,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: SecurityGroup.refresh: true SecurityGroup.create_dialog: true diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 59d15005e1..c213bc7fe9 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -116,6 +116,7 @@ tabs: - 5 # Memory - 6 # CPU #- 7 # Labels + #- 6 # Search data actions: Group.refresh: true Group.create_dialog: false @@ -140,6 +141,7 @@ tabs: - 6 # VNets - 7 # Datastores #- 8 # Labels + #- 9 # Search data actions: Vdc.refresh: true Vdc.create_dialog: true @@ -178,6 +180,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: Template.refresh: true Template.create_dialog: false @@ -217,6 +220,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: ServiceTemplate.refresh: true ServiceTemplate.create_dialog: false @@ -242,6 +246,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: VirtualRouterTemplate.refresh: true VirtualRouterTemplate.create_dialog: false @@ -297,6 +302,7 @@ tabs: - 11 # VNC #- 12 # Hidden Template #- 13 # Labels + #- 14 # Search data actions: VM.refresh: true VM.create_dialog: true @@ -384,6 +390,7 @@ tabs: - 4 # Name - 5 # State #- 6 # Labels + #- 7 # Search data actions: Service.refresh: true Service.chown: true @@ -444,6 +451,7 @@ tabs: #- 11 # VM MAD #- 12 # Last monitored on #- 13 # Labels + #- 14 # Search data actions: Host.refresh: true Host.create_dialog: true @@ -493,6 +501,7 @@ tabs: - 10 # Type - 11 # Status #- 12 # Labels + #- 13 # Search data actions: Datastore.refresh: true Datastore.create_dialog: true @@ -527,6 +536,7 @@ tabs: - 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: Image.refresh: true Image.create_dialog: true @@ -565,6 +575,7 @@ tabs: #- 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: File.refresh: true File.create_dialog: true @@ -592,6 +603,7 @@ tabs: - 7 # Driver - 8 # Zone #- 9 # Labels + #- 10 # Search data actions: MarketPlace.refresh: true MarketPlace.create_dialog: true @@ -621,6 +633,7 @@ tabs: - 10 # Marketplace - 11 # Zone #- 12 # Labels + #- 13 # Search data actions: MarketPlaceApp.refresh: true MarketPlaceApp.create_dialog: true @@ -658,6 +671,7 @@ tabs: #- 8 # Leases #- 9 # VLAN ID #- 10 # Labels + #- 11 # Search data actions: Network.refresh: true Network.create_dialog: false @@ -688,6 +702,7 @@ tabs: #- 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: VirtualRouter.refresh: true VirtualRouter.create_dialog: true @@ -718,6 +733,7 @@ tabs: #- 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: SecurityGroup.refresh: true SecurityGroup.create_dialog: false diff --git a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml index ed271c5f6e..647734d53c 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml @@ -118,6 +118,7 @@ tabs: - 5 # Memory - 6 # CPU #- 7 # Labels + #- 8 # Search data actions: Group.refresh: true Group.create_dialog: false @@ -142,6 +143,7 @@ tabs: - 6 # VNets - 7 # Datastores #- 8 # Labels + #- 9 # Search data actions: Vdc.refresh: true Vdc.create_dialog: true @@ -180,6 +182,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: Template.refresh: true Template.create_dialog: false @@ -219,6 +222,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: ServiceTemplate.refresh: true ServiceTemplate.create_dialog: false @@ -244,6 +248,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: VirtualRouterTemplate.refresh: true VirtualRouterTemplate.create_dialog: false @@ -299,6 +304,7 @@ tabs: - 11 # VNC #- 12 # Hidden Template #- 13 # Labels + #- 14 # Search data actions: VM.refresh: true VM.create_dialog: true @@ -386,6 +392,7 @@ tabs: - 4 # Name - 5 # State #- 6 # Labels + #- 7 # Search data actions: Service.refresh: true Service.chown: true @@ -446,6 +453,7 @@ tabs: #- 11 # VM MAD #- 12 # Last monitored on #- 13 # Labels + #- 14 # Search data actions: Host.refresh: true Host.create_dialog: true @@ -495,6 +503,7 @@ tabs: - 10 # Type - 11 # Status #- 12 # Labels + #- 13 # Search data actions: Datastore.refresh: true Datastore.create_dialog: true @@ -528,6 +537,7 @@ tabs: - 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: Image.refresh: true Image.create_dialog: true @@ -566,6 +576,7 @@ tabs: #- 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: File.refresh: true File.create_dialog: true @@ -593,6 +604,7 @@ tabs: - 7 # Driver - 8 # Zone #- 9 # Labels + #- 10 # Search data actions: MarketPlace.refresh: true MarketPlace.create_dialog: true @@ -622,6 +634,7 @@ tabs: - 10 # Marketplace - 11 # Zone #- 12 # Labels + #- 13 # Search data actions: MarketPlaceApp.refresh: true MarketPlaceApp.create_dialog: true @@ -659,6 +672,7 @@ tabs: #- 8 # Leases #- 9 # VLAN ID #- 10 # Labels + #- 11 # Search data actions: Network.refresh: true Network.create_dialog: false @@ -689,6 +703,7 @@ tabs: #- 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: VirtualRouter.refresh: true VirtualRouter.create_dialog: true @@ -719,6 +734,7 @@ tabs: #- 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: SecurityGroup.refresh: true SecurityGroup.create_dialog: false diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index b87c2ae1d8..5d897485c6 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -117,6 +117,7 @@ tabs: - 5 # Memory - 6 # CPU #- 7 # Labels + #- 8 # Search data actions: Group.refresh: true Group.create_dialog: true @@ -141,6 +142,7 @@ tabs: - 6 # VNets - 7 # Datastores #- 8 # Labels + #- 9 # Search data actions: Vdc.refresh: true Vdc.create_dialog: true @@ -179,6 +181,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: Template.refresh: true Template.create_dialog: true @@ -218,6 +221,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: ServiceTemplate.refresh: true ServiceTemplate.create_dialog: true @@ -243,6 +247,7 @@ tabs: - 4 # Name - 5 # Registration time #- 6 # Labels + #- 7 # Search data actions: VirtualRouterTemplate.refresh: true VirtualRouterTemplate.create_dialog: true @@ -298,6 +303,7 @@ tabs: - 11 # VNC #- 12 # Hidden Template #- 13 # Labels + #- 14 # Search data actions: VM.refresh: true VM.create_dialog: true @@ -385,6 +391,7 @@ tabs: - 4 # Name - 5 # State #- 6 # Labels + #- 7 # Search data actions: Service.refresh: true Service.chown: false @@ -445,6 +452,7 @@ tabs: #- 11 # VM MAD #- 12 # Last monitored on #- 13 # Labels + #- 14 # Search data actions: Host.refresh: true Host.create_dialog: true @@ -494,6 +502,7 @@ tabs: #- 10 # Type #- 11 # Status #- 12 # Labels + #- 13 # Search data actions: Datastore.refresh: true Datastore.create_dialog: false @@ -528,6 +537,7 @@ tabs: - 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: Image.refresh: true Image.create_dialog: true @@ -566,6 +576,7 @@ tabs: #- 11 # #VMs #- 12 # Target #- 13 # Labels + #- 14 # Search data actions: File.refresh: true File.create_dialog: true @@ -593,6 +604,7 @@ tabs: - 7 # Driver - 8 # Zone #- 9 # Labels + #- 10 # Search data actions: MarketPlace.refresh: true MarketPlace.create_dialog: true @@ -622,6 +634,7 @@ tabs: - 10 # Marketplace - 11 # Zone #- 12 # Labels + #- 13 # Search data actions: MarketPlaceApp.refresh: true MarketPlaceApp.create_dialog: true @@ -659,6 +672,7 @@ tabs: - 8 # Leases #- 9 # VLAN ID #- 10 # Labels + #- 11 # Search data actions: Network.refresh: true Network.create_dialog: false @@ -689,6 +703,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: VirtualRouter.refresh: true VirtualRouter.create_dialog: true @@ -719,6 +734,7 @@ tabs: - 3 # Group - 4 # Name #- 5 # Labels + #- 6 # Search data actions: SecurityGroup.refresh: true SecurityGroup.create_dialog: true diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js index 9ec5b6188c..afdf542c36 100644 --- a/src/sunstone/public/app/opennebula/vm.js +++ b/src/sunstone/public/app/opennebula/vm.js @@ -20,6 +20,8 @@ define(function(require) { OpenNebulaError = require('./error'); Locale = require('utils/locale'); + var OpenNebulaCluster = require('./cluster'); + var RESOURCE = "VM"; var STATES_STR = [ @@ -575,6 +577,18 @@ define(function(require) { return hostname; }, + "clusterStr": function(element) { + var state = element.STATE; + var cluster = "--"; + if (state == STATES.ACTIVE || state == STATES.SUSPENDED || state == STATES.POWEROFF) { + var history = retrieveLastHistoryRecord(element) + if (history) { + cluster = history.CID; + }; + }; + + return OpenNebulaCluster.getName(cluster); + }, "migrateActionStr": function(stateId) { return MIGRATE_ACTION_STR[stateId]; }, diff --git a/src/sunstone/public/app/tabs/datastores-tab/datatable.js b/src/sunstone/public/app/tabs/datastores-tab/datatable.js index dd30c5e7f7..d0e9e7322d 100644 --- a/src/sunstone/public/app/tabs/datastores-tab/datatable.js +++ b/src/sunstone/public/app/tabs/datastores-tab/datatable.js @@ -25,6 +25,7 @@ define(function(require) { var OpenNebulaDatastore = require('opennebula/datastore'); var DatastoreCapacityBar = require('./utils/datastore-capacity-bar'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -34,6 +35,7 @@ define(function(require) { var XML_ROOT = "DATASTORE"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 12; + var SEARCH_COLUMN = 13; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -87,7 +89,8 @@ define(function(require) { Locale.tr("DS MAD"), Locale.tr("Type"), Locale.tr("Status"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ] this.selectOptions = { @@ -100,6 +103,9 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following datastores:") } + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); }; @@ -121,6 +127,17 @@ define(function(require) { clusters = $.isArray(element.CLUSTERS.ID) ? element.CLUSTERS.ID.join(",") : element.CLUSTERS.ID; } + var state = OpenNebulaDatastore.stateStr(element.STATE); + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + STATE: state, + TM_MAD: element.TM_MAD, + DS_MAD: element.DS_MAD + } + return [ ' +
+ + + + +
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/hosts-tab/datatable.js b/src/sunstone/public/app/tabs/hosts-tab/datatable.js index cbc46f1647..8280d284c0 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/datatable.js +++ b/src/sunstone/public/app/tabs/hosts-tab/datatable.js @@ -27,6 +27,7 @@ define(function(require) { var MemoryBars = require('./utils/memory-bars'); var OpenNebulaHost = require('opennebula/host'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* @@ -37,6 +38,7 @@ define(function(require) { var XML_ROOT = "HOST"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 13; + var SEARCH_COLUMN = 14; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -76,7 +78,8 @@ define(function(require) { Locale.tr("IM MAD"), Locale.tr("VM MAD"), Locale.tr("Last monitored on"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; this.selectOptions = { @@ -99,6 +102,9 @@ define(function(require) { this.allocatedMemory = 0; this.realMemory = 0; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); }; @@ -148,6 +154,16 @@ define(function(require) { this.allocatedMemory += parseInt(element.HOST_SHARE.MEM_USAGE); this.realMemory += parseInt(element.HOST_SHARE.USED_MEM); + var state = OpenNebulaHost.simpleStateStr(element.STATE); + + var search = { + NAME: element.NAME, + CLUSTER: element.CLUSTER, + STATE: state, + IM_MAD: element.IM_MAD, + VM_MAD: element.VM_MAD + } + return [ ' +
+ + + + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/images-tab/datatable-common.js b/src/sunstone/public/app/tabs/images-tab/datatable-common.js index 2e3b0698a1..260df997fe 100644 --- a/src/sunstone/public/app/tabs/images-tab/datatable-common.js +++ b/src/sunstone/public/app/tabs/images-tab/datatable-common.js @@ -25,6 +25,7 @@ define(function(require) { var Humanize = require('utils/humanize'); var OpenNebulaImage = require('opennebula/image'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -32,6 +33,7 @@ define(function(require) { var XML_ROOT = "IMAGE" var LABELS_COLUMN = 13; + var SEARCH_COLUMN = 14; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -72,9 +74,13 @@ define(function(require) { Locale.tr("Status"), Locale.tr("#VMS"), Locale.tr("Target"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ] + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); }; @@ -91,6 +97,20 @@ define(function(require) { function _elementArray(element_json) { var element = element_json.IMAGE; + var type = OpenNebulaImage.typeStr(element.TYPE); + var state = OpenNebulaImage.stateStr(element.STATE); + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + DATASTORE: element.DATASTORE, + TYPE: type, + STATE: state, + REGTIME_AFTER: element.REGTIME, + REGTIME_BEFORE: element.REGTIME + } + return [ ' +
+ + + + + + +
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/datatable.js b/src/sunstone/public/app/tabs/marketplaceapps-tab/datatable.js index ae3fdbe43d..c31e07ab96 100644 --- a/src/sunstone/public/app/tabs/marketplaceapps-tab/datatable.js +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/datatable.js @@ -27,6 +27,7 @@ define(function(require) { var OpenNebulaZone = require('opennebula/zone'); var LabelsUtils = require('utils/labels/utils'); var Humanize = require('utils/humanize'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -36,6 +37,7 @@ define(function(require) { var XML_ROOT = "MARKETPLACEAPP"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 12; + var SEARCH_COLUMN = 13; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -89,7 +91,8 @@ define(function(require) { Locale.tr("Registration Time"), Locale.tr("Marketplace"), Locale.tr("Zone"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ] this.selectOptions = { @@ -102,6 +105,9 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following appliances:") } + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); }; @@ -118,6 +124,20 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var state = OpenNebulaMarketPlaceApp.stateStr(element.STATE); + var zone = OpenNebulaZone.getName(element.ZONE_ID); + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + STATE: state, + MARKETPLACE: element.MARKETPLACE, + ZONE: zone, + REGTIME_AFTER: element.REGTIME, + REGTIME_BEFORE: element.REGTIME + } + return [ ' +
+ + + + + + +
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js b/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js index f8a34225b6..6c5720cc24 100644 --- a/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js +++ b/src/sunstone/public/app/tabs/marketplaces-tab/datatable.js @@ -26,6 +26,7 @@ define(function(require) { var OpenNebulaZone = require('opennebula/zone'); var DatastoreCapacityBar = require('../datastores-tab/utils/datastore-capacity-bar'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -35,6 +36,7 @@ define(function(require) { var XML_ROOT = "MARKETPLACE"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 9; + var SEARCH_COLUMN = 10; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -85,7 +87,8 @@ define(function(require) { Locale.tr("Apps"), Locale.tr("Driver"), Locale.tr("Zone"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ] this.selectOptions = { @@ -98,6 +101,9 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following marketplaces:") } + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); }; @@ -114,6 +120,16 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var zone = OpenNebulaZone.getName(element.ZONE_ID); + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + MARKET_MAD: element.MARKET_MAD, + ZONE: zone + } + return [ ' +
+ + + + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/datatable.js b/src/sunstone/public/app/tabs/oneflow-services-tab/datatable.js index 3f2182bdc9..b3dbba062f 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/datatable.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/datatable.js @@ -24,6 +24,7 @@ define(function(require) { var Locale = require('utils/locale'); var OpenNebulaService = require('opennebula/service'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -33,6 +34,7 @@ define(function(require) { var XML_ROOT = "DOCUMENT"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 6; + var SEARCH_COLUMN = 7; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -65,7 +67,8 @@ define(function(require) { Locale.tr("Group"), Locale.tr("Name"), Locale.tr("State"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; this.selectOptions = { @@ -77,6 +80,9 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following Services:") }; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); } @@ -93,6 +99,15 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var state = OpenNebulaService.stateStr(element.TEMPLATE.BODY.state); + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + STATE: state + } + return [ ' +
+ + + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/datatable.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/datatable.js index 5f8f6a8437..b93d71904d 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/datatable.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/datatable.js @@ -23,6 +23,7 @@ define(function(require) { var SunstoneConfig = require('sunstone-config'); var Locale = require('utils/locale'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -32,6 +33,7 @@ define(function(require) { var XML_ROOT = "DOCUMENT"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 5; + var SEARCH_COLUMN = 6; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -63,7 +65,8 @@ define(function(require) { Locale.tr("Owner") , Locale.tr("Group"), Locale.tr("Name"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; this.selectOptions = { @@ -75,6 +78,9 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following Templates:") }; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); } @@ -91,6 +97,12 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME + } + return [ ' +
+ + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/secgroups-tab/datatable.js b/src/sunstone/public/app/tabs/secgroups-tab/datatable.js index 39afbcddb6..7058bb8de1 100644 --- a/src/sunstone/public/app/tabs/secgroups-tab/datatable.js +++ b/src/sunstone/public/app/tabs/secgroups-tab/datatable.js @@ -23,6 +23,7 @@ define(function(require) { var SunstoneConfig = require('sunstone-config'); var Locale = require('utils/locale'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -32,6 +33,7 @@ define(function(require) { var XML_ROOT = "SECURITY_GROUP"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 5; + var SEARCH_COLUMN = 6; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -63,7 +65,8 @@ define(function(require) { Locale.tr("Owner"), Locale.tr("Group"), Locale.tr("Name"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; this.selectOptions = { @@ -75,6 +78,9 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following security groups:") }; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); } @@ -91,6 +97,12 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME + } + return [ ' +
+ + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/templates-tab/datatable-common.js b/src/sunstone/public/app/tabs/templates-tab/datatable-common.js index 5267da3592..c54aca836d 100644 --- a/src/sunstone/public/app/tabs/templates-tab/datatable-common.js +++ b/src/sunstone/public/app/tabs/templates-tab/datatable-common.js @@ -27,6 +27,7 @@ define(function(require) { var Humanize = require('utils/humanize'); var Notifier = require('utils/notifier'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -34,6 +35,7 @@ define(function(require) { var XML_ROOT = "VMTEMPLATE"; var LABELS_COLUMN = 6; + var SEARCH_COLUMN = 7; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -66,7 +68,8 @@ define(function(require) { Locale.tr("Group"), Locale.tr("Name"), Locale.tr("Registration time"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; this.selectOptions = { @@ -78,7 +81,8 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following Templates:"), }; - this.labels = []; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; TabDataTable.call(this); }; @@ -98,6 +102,14 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + REGTIME_AFTER: element.REGTIME, + REGTIME_BEFORE: element.REGTIME + } + return [ ' +
+ + + +
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/users-tab/datatable.js b/src/sunstone/public/app/tabs/users-tab/datatable.js index 22c4e1af07..2ddefb5c07 100644 --- a/src/sunstone/public/app/tabs/users-tab/datatable.js +++ b/src/sunstone/public/app/tabs/users-tab/datatable.js @@ -89,10 +89,8 @@ define(function(require) { this.totalUsers = 0; - this.conf.searchDropdownHTML = SearchDropdown(); - - this.searchFields = ["NAME", "GNAME", "PASSWORD", "AUTH_DRIVER"]; - this.searchVals = {"NAME": "", "GNAME": "", "PASSWORD": "", "AUTH_DRIVER": ""}; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; TabDataTable.call(this); } @@ -102,7 +100,6 @@ define(function(require) { Table.prototype.elementArray = _elementArray; Table.prototype.preUpdateView = _preUpdateView; Table.prototype.postUpdateView = _postUpdateView; - Table.prototype.setupSearch = _setupSearch; return Table; @@ -110,66 +107,7 @@ define(function(require) { FUNCTION DEFINITIONS */ - function _setupSearch(context) { - var that = this; - - $("[search-field]", context).on('input change', function(){ - that.searchVals[$(this).attr("search-field")] = $(this).val(); - }); - - this.dataTable.on('search.dt', function() { - var empty = true; - - for(var i=0; i < that.searchFields.length; i++){ - var name = that.searchFields[i]; - empty = $("[search-field="+name+"]", context).val() == ""; - - if(!empty){ - break; - } - } - - if(empty){ - $("button.search-dropdown", context).addClass("hollow"); - } else { - $("button.search-dropdown", context).removeClass("hollow"); - } - }); - - $.fn.dataTable.ext.search.push( - function( settings, data, dataIndex ) { - // This is a global search function, we need to apply it only if the - // search is triggered for the current table - if(that.dataTableId != settings.nTable.id){ - return true; - } - - try { - var data = JSON.parse(atob(data[SEARCH_COLUMN])); - - var match = true; - - for(var i=0; i < that.searchFields.length; i++){ - var name = that.searchFields[i]; - - match = (data[name].match( that.searchVals[name] ) != null); - - if (!match){ - break; - } - } - - return match; - } catch (err) {} - - return true; - } - ); - } - function _elementArray(element_json) { - var that = this; - this.totalUsers++; var element = element_json[XML_ROOT]; @@ -209,12 +147,6 @@ define(function(require) { AUTH_DRIVER: element.AUTH_DRIVER } - try{ - that.searchFields.forEach(function(name){ - that.searchSets[name].add(search[name]); - }); - }catch(e){} - return [ ''; - }); - - $("datalist[search-datalist="+name+"]", $("#"+TAB_NAME)).html(st); - }); - } catch(e){} } }); diff --git a/src/sunstone/public/app/tabs/users-tab/datatable/search.hbs b/src/sunstone/public/app/tabs/users-tab/datatable/search.hbs index aa2d3af39d..dfbc2108ed 100644 --- a/src/sunstone/public/app/tabs/users-tab/datatable/search.hbs +++ b/src/sunstone/public/app/tabs/users-tab/datatable/search.hbs @@ -2,26 +2,26 @@
diff --git a/src/sunstone/public/app/tabs/vms-tab/datatable.js b/src/sunstone/public/app/tabs/vms-tab/datatable.js index e1c6ad43c3..9c9d336c54 100644 --- a/src/sunstone/public/app/tabs/vms-tab/datatable.js +++ b/src/sunstone/public/app/tabs/vms-tab/datatable.js @@ -29,6 +29,7 @@ define(function(require) { var Vnc = require('utils/vnc'); var Spice = require('utils/spice'); var Notifier = require('utils/notifier'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -38,6 +39,7 @@ define(function(require) { var XML_ROOT = "VM"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 13; + var SEARCH_COLUMN = 14; /* @@ -81,6 +83,9 @@ define(function(require) { this.failedVms = 0; this.offVms = 0; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; + TabDataTable.call(this); }; diff --git a/src/sunstone/public/app/tabs/vms-tab/datatable/search.hbs b/src/sunstone/public/app/tabs/vms-tab/datatable/search.hbs new file mode 100644 index 0000000000..a0b107a752 --- /dev/null +++ b/src/sunstone/public/app/tabs/vms-tab/datatable/search.hbs @@ -0,0 +1,58 @@ +
+
+ + + + +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js index 6073bcb991..7252553692 100644 --- a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js +++ b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js @@ -39,7 +39,8 @@ define(function(require) { Locale.tr("Start Time"), "", Locale.tr("Hidden Template"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; return { @@ -80,7 +81,20 @@ define(function(require) { memoryMonitoring = element.MONITORING.MEMORY } } - + + var hostname = OpenNebulaVM.hostnameStr(element); + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + STATUS: state, + HOST: hostname, + CLUSTER: OpenNebulaVM.clusterStr(element), + STIME_AFTER: element.STIME, + STIME_BEFORE: element.STIME + } + return [ ' 0){ + parent_net = OpenNebulaNetwork.getName(element.PARENT_NETWORK_ID); + } + + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME, + VLAN_ID: (element.VLAN_ID.length ? element.VLAN_ID : ""), + PARENT_NETWORK: parent_net + } + return [ ' +
+ + + + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/vrouters-tab/datatable.js b/src/sunstone/public/app/tabs/vrouters-tab/datatable.js index 7430baec11..d40a8d05eb 100644 --- a/src/sunstone/public/app/tabs/vrouters-tab/datatable.js +++ b/src/sunstone/public/app/tabs/vrouters-tab/datatable.js @@ -23,6 +23,7 @@ define(function(require) { var SunstoneConfig = require('sunstone-config'); var Locale = require('utils/locale'); var LabelsUtils = require('utils/labels/utils'); + var SearchDropdown = require('hbs!./datatable/search'); /* CONSTANTS @@ -32,6 +33,7 @@ define(function(require) { var XML_ROOT = "VROUTER"; var TAB_NAME = require('./tabId'); var LABELS_COLUMN = 5; + var SEARCH_COLUMN = 6; var TEMPLATE_ATTR = 'TEMPLATE'; /* @@ -63,7 +65,8 @@ define(function(require) { Locale.tr("Owner"), Locale.tr("Group"), Locale.tr("Name"), - Locale.tr("Labels") + Locale.tr("Labels"), + "search_data" ]; this.selectOptions = { @@ -75,7 +78,8 @@ define(function(require) { "you_selected_multiple": Locale.tr("You selected the following virtual routers:") }; - this.labels = []; + this.conf.searchDropdownHTML = SearchDropdown({tableId: this.dataTableId}); + this.searchColumn = SEARCH_COLUMN; TabDataTable.call(this); } @@ -93,6 +97,12 @@ define(function(require) { function _elementArray(element_json) { var element = element_json[XML_ROOT]; + var search = { + NAME: element.NAME, + UNAME: element.UNAME, + GNAME: element.GNAME + } + return [ ' +
+ + + +
+ \ No newline at end of file diff --git a/src/sunstone/public/app/utils/tab-datatable.js b/src/sunstone/public/app/utils/tab-datatable.js index d2465e62ab..9cfbc53021 100644 --- a/src/sunstone/public/app/utils/tab-datatable.js +++ b/src/sunstone/public/app/utils/tab-datatable.js @@ -219,10 +219,14 @@ define(function(require) { if(that.conf.searchDropdownHTML != undefined){ var context = $('#' + this.dataTableId + 'Search-wrapper'); - that.setupSearch(context); + if (that.setupSearch != undefined){ + that.setupSearch(context); + } else { + _setupSearch(that, context); + } $("a.advanced-search-clear", context).on('click', function(){ - $("input", context).val("").trigger("change"); + $("input", context).val("").trigger("input"); $("button.advanced-search", context).click(); }); @@ -277,6 +281,121 @@ define(function(require) { Foundation.reflow($('#' + this.dataTableId + 'Search-dropdown'), 'dropdown'); } + + function _setupSearch(that, context) { + that.searchFields = []; + + $("[search-field]", context).each(function(){ + that.searchFields.push( $(this).attr("search-field") ); + }); + + that.searchVals = {}; + that.searchFields.forEach(function(name){ + that.searchVals[name] = ""; + }); + + that.searchOps = {}; + that.searchFields.forEach(function(name){ + var op = $("[search-field="+name+"]", context).attr("search-operation"); + + if (op == undefined){ + op = "match"; + } + + that.searchOps[name] = op; + }); + + $("[search-field]", context).on('input change', function(){ + var name = $(this).attr("search-field"); + + if($(this).attr("type") == "date"){ + var val = $(this).val(); + + if(val == ""){ + that.searchVals[name] = ""; + } else { + that.searchVals[name] = parseInt( new Date(val).getTime() ) / 1000; + } + }else{ + that.searchVals[name] = $(this).val(); + } + }); + + that.dataTable.on('search.dt', function() { + var empty = true; + + for(var i=0; i < that.searchFields.length; i++){ + var name = that.searchFields[i]; + empty = $("[search-field="+name+"]", context).val() == ""; + + if(!empty){ + break; + } + } + + if(empty){ + $("button.search-dropdown", context).addClass("hollow"); + } else { + $("button.search-dropdown", context).removeClass("hollow"); + } + }); + + $.fn.dataTable.ext.search.push( + function( settings, data, dataIndex ) { + // This is a global search function, we need to apply it only if the + // search is triggered for the current table + if(that.dataTableId != settings.nTable.id){ + return true; + } + + try { + var values = JSON.parse(atob(data[that.searchColumn])); + + var match = true; + + for(var i=0; i < that.searchFields.length; i++){ + var name = that.searchFields[i]; + + switch(that.searchOps[name]){ + case "match": + match = (values[name].match( that.searchVals[name] ) != null); + break; + case "<=": + match = (that.searchVals[name] == "") || + (values[name] <= that.searchVals[name]); + break; + case ">=": + match = (that.searchVals[name] == "") || + (values[name] >= that.searchVals[name]); + break; + case ">": + match = (that.searchVals[name] == "") || + (values[name] > that.searchVals[name]); + break; + case "<": + match = (that.searchVals[name] == "") || + (values[name] < that.searchVals[name]); + break; + case "==": + match = (that.searchVals[name] == "") || + (values[name] == that.searchVals[name]); + break; + } + + if (!match){ + break; + } + } + + return match; + } catch (err) {} + + return true; + } + ); + } + + function _defaultTrListener(tableObj, tr) { var aData = tableObj.dataTable.fnGetData(tr); if (!aData) return true; @@ -436,6 +555,15 @@ define(function(require) { that.preUpdateView(); } + if(that.conf.searchDropdownHTML != undefined){ + that.searchSets = {}; + try { + that.searchFields.forEach(function(name){ + that.searchSets[name] = new Set(); + }); + } catch(e){} + } + that.dataTable.DataTable().page.len(parseInt(config['user_config']['page_length'])); var row_id_index = this.dataTable.attr("row_id"); @@ -479,6 +607,16 @@ define(function(require) { var item = that.elementArray(this); if (item){ item_list.push(item); + + if(that.searchColumn != undefined){ + try{ + var values = JSON.parse(atob(item[that.searchColumn])); + + that.searchFields.forEach(function(name){ + that.searchSets[name].add(values[name]); + }); + }catch(e){} + } } }); } @@ -543,6 +681,24 @@ define(function(require) { if (that.postUpdateView) { that.postUpdateView(); } + + if(that.conf.searchDropdownHTML != undefined){ + try { + that.searchFields.forEach(function(name){ + var st = ""; + + var dlist = $("datalist[search-datalist="+name+"]", $("#"+that.tabId)); + + if(dlist.length > 0){ + that.searchSets[name].forEach(function(val){ + st += '