diff --git a/install.sh b/install.sh index 3b44c1cf32..0c12de176e 100755 --- a/install.sh +++ b/install.sh @@ -1476,7 +1476,8 @@ SUNSTONE_ETC_FILES="src/sunstone/etc/sunstone-server.conf \ src/sunstone/etc/sunstone-oneflow.conf" SUNSTONE_ETC_VIEW_FILES="src/sunstone/etc/sunstone-views/admin.yaml \ - src/sunstone/etc/sunstone-views/user.yaml" + src/sunstone/etc/sunstone-views/user.yaml \ + src/sunstone/etc/sunstone-views/cloud.yaml" SUNSTONE_MODELS_FILES="src/sunstone/models/OpenNebulaJSON.rb \ src/sunstone/models/SunstoneServer.rb \ diff --git a/src/sunstone/etc/sunstone-views.yaml b/src/sunstone/etc/sunstone-views.yaml index 329b4d0211..a710f056f3 100644 --- a/src/sunstone/etc/sunstone-views.yaml +++ b/src/sunstone/etc/sunstone-views.yaml @@ -1,6 +1,25 @@ --- logo: images/opennebula-sunstone-v4.0.png +available_tabs: + - dashboard-tab + - system-tab + - users-tab + - groups-tab + - acls-tab + - vresources-tab + - vms-tab + - templates-tab + - images-tab + - files-tab + - infra-tab + - clusters-tab + - hosts-tab + - datastores-tab + - vnets-tab + - marketplace-tab users: + cloud: + - cloud groups: oneadmin: - admin diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index a7d99e82fd..44d3f0a3d2 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -1,24 +1,24 @@ small_logo: images/opennebula-sunstone-v4.0-small.png enabled_tabs: - - dashboard-tab - - system-tab - - users-tab - - groups-tab - - acls-tab - - vresources-tab - - vms-tab - - templates-tab - - images-tab - - files-tab - - infra-tab - - clusters-tab - - hosts-tab - - datastores-tab - - vnets-tab - - marketplace-tab - #- oneflow-dashboard - #- oneflow-services - #- oneflow-templates + dashboard-tab: true + system-tab: true + users-tab: true + groups-tab: true + acls-tab: true + vresources-tab: true + vms-tab: true + templates-tab: true + images-tab: true + files-tab: true + infra-tab: true + clusters-tab: true + hosts-tab: true + datastores-tab: true + vnets-tab: true + marketplace-tab: true + oneflow-dashboard: false + oneflow-services: false + oneflow-templates: false tabs: dashboard-tab: panel_tabs: @@ -116,6 +116,7 @@ tabs: actions: VM.refresh: true VM.create_dialog: true + VM.easy_provision: false VM.chown: true VM.chgrp: true VM.chmod: true @@ -163,6 +164,7 @@ tabs: actions: Template.refresh: true Template.create_dialog: true + Template.easy_provision: false Template.update_dialog: true Template.instantiate_vms: true Template.chown: true diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml new file mode 100644 index 0000000000..31d5eb8735 --- /dev/null +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -0,0 +1,349 @@ +small_logo: images/opennebula-sunstone-v4.0-small.png +enabled_tabs: + dashboard-tab: true + system-tab: false + users-tab: false + groups-tab: false + acls-tab: false + vresources-tab: false + vms-tab: true + templates-tab: false + images-tab: false + files-tab: false + infra-tab: false + clusters-tab: false + hosts-tab: false + datastores-tab: false + vnets-tab: false + marketplace-tab: false + oneflow-dashboard: false + oneflow-services: false + oneflow-templates: false +tabs: + dashboard-tab: + panel_tabs: + actions: + widgets_three_per_row: + #- users + widgets_two_per_row: + #- network + #- storage + #- hosts + #- vms + widgets_one_per_row: + - vms + system-tab: + panel_tabs: + actions: + users-tab: + panel_tabs: + user_info_panel: true + user_quotas_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Name + - 3 # Group + - 4 # Auth driver + - 5 # VMs + - 6 # Memory + - 7 # CPU + #- 8 # Group ID + actions: + User.refresh: true + User.create_dialog: true + User.update_password: true + User.quotas_dialog: true + User.chgrp: true + User.chauth: true + User.delete: true + groups-tab: + panel_tabs: + group_quotas_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Name + - 3 # Users + - 4 # VMs + - 5 # Memory + - 6 # CPU + actions: + Group.refresh: true + Group.create_dialog: true + Group.quotas_dialog: true + Group.delete: true + acls-tab: + panel_tabs: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Applies to + - 3 # Affected resources + - 4 # Resource ID / Owned by + - 5 # Allowed operations + #- 6 # ACL String + actions: + Acl.refresh: true + Acl.create_dialog: true + Acl.delete: true + vresources-tab: + panel_tabs: + actions: + vms-tab: + panel_tabs: + vm_info_tab: true + vm_capacity_tab: true + vm_hotplugging_tab: true + vm_network_tab: true + vm_snapshot_tab: true + vm_placement_tab: false + vm_actions_tab: true + vm_template_tab: false + vm_log_tab: false + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Status + #- 6 # Used CPU + #- 7 # Used Memory + - 8 # Host + - 9 # IPs + #- 10 # Start Time + - 11 # VNC + actions: + VM.refresh: true + VM.create_dialog: false + VM.easy_provision: true + VM.chown: false + VM.chgrp: false + VM.chmod: true + VM.deploy: false + VM.migrate: false + VM.migrate_live: false + VM.hold: true + VM.release: true + VM.suspend: true + VM.resume: true + VM.stop: true + VM.boot: true + VM.reboot: true + VM.reboot_hard: true + VM.poweroff: true + VM.poweroff_hard: true + VM.undeploy: true + VM.undeploy_hard: true + VM.shutdown: true + VM.shutdown_hard: true + VM.delete: true + VM.delete_recreate: true + VM.resize: true + VM.attachdisk: true + VM.detachdisk: true + VM.saveas: true + VM.attachnic: true + VM.detachnic: true + VM.snapshot_create: true + VM.snapshot_revert: true + VM.snapshot_delete: true + VM.resched: false + VM.unresched: false + templates-tab: + panel_tabs: + template_info_tab: true + template_template_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Registration time + actions: + Template.refresh: true + Template.create_dialog: false + Template.easy_provision: true + Template.update_dialog: true + Template.instantiate_vms: true + Template.chown: false + Template.chgrp: false + Template.chmod: true + Template.clone_dialog: true + Template.delete: true + template_creation_tabs: + general: true + storage: true + network: true + os_booting: true + features: true + input_output: true + context: true + scheduling: false + images-tab: + panel_tabs: + image_info_panel: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Datastore + #- 6 # Size + - 7 # Type + #- 8 # Registration time + #- 9 # Persistent + - 10 # Status + - 11 # #VMs + #- 12 # Target + actions: + Image.refresh: true + Image.create_dialog: true + Image.chown: false + Image.chgrp: false + Image.chmod: true + Image.enable: true + Image.disable: true + Image.persistent: true + Image.nonpersistent: true + Image.clone_dialog: true + Image.delete: true + files-tab: + panel_tabs: + file_info_panel: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Datastore + #- 6 # Size + - 7 # Type + #- 8 # Registration time + #- 9 # Persistent + - 10 # Status + #- 11 # #VMs + #- 12 # Target + actions: + File.refresh: true + File.create_dialog: true + File.chown: false + File.chgrp: false + File.chmod: true + File.enable: true + File.disable: true + File.delete: true + infra-tab: + panel_tabs: + actions: + clusters-tab: + panel_tabs: + cluster_info_tab: true + cluster_host_tab: true + cluster_vnet_tab: true + cluster_datastore_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Name + - 3 # Hosts + - 4 # VNets + - 5 # Datastores + actions: + Cluster.refresh: true + Cluster.create_dialog: true + Cluster.update_dialog: true + Cluster.delete: true + hosts-tab: + panel_tabs: + host_info_tab: true + host_monitoring_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Name + - 3 # Cluster + - 4 # RVMs + #- 5 # Real CPU + - 6 # Allocated CPU + #- 7 # Real MEM + - 8 # Allocated MEM + - 9 # Status + #- 10 # IM MAD + #- 11 # VM MAD + #- 12 # Last monitored on + actions: + Host.refresh: true + Host.create_dialog: true + Host.addtocluster: true + Host.enable: true + Host.disable: true + Host.delete: true + datastores-tab: + panel_tabs: + datastore_info_tab: false + datastore_image_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Cluster + #- 6 # Basepath + #- 7 # TM + #- 8 # DS + #- 9 # Type + actions: + Datastore.refresh: true + Datastore.create_dialog: false + Datastore.addtocluster: false + Datastore.chown: false + Datastore.chgrp: false + Datastore.chmod: true + Datastore.delete: false + vnets-tab: + panel_tabs: + vnet_info_tab: false + vnet_leases_tab: true + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Cluster + - 6 # Type + #- 7 # Bridge + - 8 # Leases + actions: + Network.refresh: true + Network.create_dialog: false + Network.addtocluster: false + Network.chown: false + Network.chgrp: false + Network.chmod: true + Network.delete: false + Network.addleases: false + Network.hold_lease: false + Network.remove_lease: false + Network.release_lease: false + marketplace-tab: + panel_tabs: + marketplace_info_tab: true + table_columns: + - 0 # Checkbox + #- 1 # ID + - 2 # Name + - 3 # Publisher + - 4 # Hypervisor + - 5 # Arch + - 6 # Format + #- 7 # Tags + actions: + Marketplace.refresh: true + Marketplace.import: true diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index 066feb7dfb..121ffb9590 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -1,24 +1,24 @@ small_logo: images/opennebula-sunstone-v4.0-small.png enabled_tabs: - - dashboard-tab - #- system-tab - #- users-tab - #- groups-tab - #- acls-tab - - vresources-tab - - vms-tab - - templates-tab - - images-tab - - files-tab - - infra-tab - #- clusters-tab - #- hosts-tab - - datastores-tab - - vnets-tab - - marketplace-tab - #- oneflow-dashboard - #- oneflow-services - #- oneflow-templates + dashboard-tab: true + system-tab: false + users-tab: false + groups-tab: false + acls-tab: false + vresources-tab: true + vms-tab: true + templates-tab: true + images-tab: true + files-tab: true + infra-tab: true + clusters-tab: false + hosts-tab: false + datastores-tab: true + vnets-tab: true + marketplace-tab: true + oneflow-dashboard: false + oneflow-services: false + oneflow-templates: false tabs: dashboard-tab: panel_tabs: @@ -117,6 +117,7 @@ tabs: actions: VM.refresh: true VM.create_dialog: true + VM.easy_provision: false VM.chown: false VM.chgrp: false VM.chmod: true @@ -164,6 +165,7 @@ tabs: actions: Template.refresh: true Template.create_dialog: true + Template.easy_provision: false Template.update_dialog: true Template.instantiate_vms: true Template.chown: false diff --git a/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb b/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb index 03bbe9a90e..461006eeb7 100644 --- a/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb @@ -78,7 +78,12 @@ module OpenNebulaJSON end def instantiate(params=Hash.new) - super(params['vm_name']) + if params['template'] + template = template_to_str(params['template']) + super(params['vm_name'], false, template) + else + super(params['vm_name']) + end end def clone(params=Hash.new) diff --git a/src/sunstone/models/SunstoneViews.rb b/src/sunstone/models/SunstoneViews.rb index 8d6aae27f4..ce7797f529 100644 --- a/src/sunstone/models/SunstoneViews.rb +++ b/src/sunstone/models/SunstoneViews.rb @@ -56,6 +56,10 @@ class SunstoneViews return available_views end + def available_tabs + @views_config['available_tabs'] + end + def logo @views_config['logo'] end diff --git a/src/sunstone/public/css/app.css b/src/sunstone/public/css/app.css index f1ed398f8c..3cf0f7a0bd 100644 --- a/src/sunstone/public/css/app.css +++ b/src/sunstone/public/css/app.css @@ -6654,19 +6654,20 @@ ul.button-group { /* line 611, ../sass/app.scss */ .value_td { text-overflow: ellipsis; + word-break: break-all; } -/* line 615, ../sass/app.scss */ +/* line 616, ../sass/app.scss */ small { color: #b6b6b6 !important; } -/* line 619, ../sass/app.scss */ +/* line 620, ../sass/app.scss */ .header-dashboard { margin-top: -5px; } -/* line 623, ../sass/app.scss */ +/* line 624, ../sass/app.scss */ .span-dashboard { background: #fcfcfc; color: #6f6f6f; @@ -6674,43 +6675,43 @@ small { box-shadow: 0 0 2px 0px #6f6f6f; } -/* line 632, ../sass/app.scss */ +/* line 633, ../sass/app.scss */ .button.dropdown.small::after { border-color: #9f9f9f transparent transparent transparent; border-width: 4px; } -/* line 637, ../sass/app.scss */ +/* line 638, ../sass/app.scss */ .footer-opennebula { font-size: 10px; color: #b6b6b6 !important; } -/* line 642, ../sass/app.scss */ +/* line 643, ../sass/app.scss */ a.footer.button { margin: 5px; } -/* line 647, ../sass/app.scss */ +/* line 648, ../sass/app.scss */ .user-login { float: right; } -/* line 651, ../sass/app.scss */ +/* line 652, ../sass/app.scss */ .user-login i.header-icon { color: #6f6f6f; font-weight: 300; font-size: 23px; } -/* line 657, ../sass/app.scss */ +/* line 658, ../sass/app.scss */ .user-login .button { color: #6f6f6f; font-size: 60%; line-height: 0; } -/* line 663, ../sass/app.scss */ +/* line 664, ../sass/app.scss */ .user-login .button.secondary { background: #f2f2f2; border: 0px; @@ -6718,100 +6719,100 @@ a.footer.button { font-weight: 300; } -/* line 671, ../sass/app.scss */ +/* line 672, ../sass/app.scss */ .user-login .button.secondary:hover, .user-login .button.secondary:focus { background-color: #d0d0d0; color: #6f6f6f; } -/* line 676, ../sass/app.scss */ +/* line 677, ../sass/app.scss */ .user-login .button.dropdown.tiny::after { border: solid 5px; border-color: #b6b6b6 transparent transparent transparent; right: 7px; } -/* line 682, ../sass/app.scss */ +/* line 683, ../sass/app.scss */ .header-resource { text-align: center; } -/* line 686, ../sass/app.scss */ +/* line 687, ../sass/app.scss */ .header-resource { float: left; } -/* line 690, ../sass/app.scss */ +/* line 691, ../sass/app.scss */ .header { text-align: center; } -/* line 694, ../sass/app.scss */ +/* line 695, ../sass/app.scss */ .button.dropdown.tiny ul.no-hover.show-dropdown { top: 34px !important; } -/* line 698, ../sass/app.scss */ +/* line 699, ../sass/app.scss */ .graph_legend { text-align: center; } -/* line 702, ../sass/app.scss */ +/* line 703, ../sass/app.scss */ .graph_legend table { background: inherit; border: 0px; width: 100%; } -/* line 708, ../sass/app.scss */ +/* line 709, ../sass/app.scss */ .graph_legend h3 { margin-top: 0px; } -/* line 712, ../sass/app.scss */ +/* line 713, ../sass/app.scss */ .graph_legend .subheader { margin-bottom: 5px; } -/* line 716, ../sass/app.scss */ +/* line 717, ../sass/app.scss */ .dashboard hr { margin: 0; margin-bottom: 8px; } -/* line 721, ../sass/app.scss */ +/* line 722, ../sass/app.scss */ .graph { margin-bottom: 15px !important; } -/* line 725, ../sass/app.scss */ +/* line 726, ../sass/app.scss */ .dashboard-panel { height: 450px; } -/* line 729, ../sass/app.scss */ +/* line 730, ../sass/app.scss */ .vm_log_error { color: #ff8d81; } -/* line 733, ../sass/app.scss */ +/* line 734, ../sass/app.scss */ .noUiSlider { margin: 10px; } -/* line 737, ../sass/app.scss */ +/* line 738, ../sass/app.scss */ .log-tab { background: #6f6f6f; color: #f2f2f2; padding: 20px; } -/* line 743, ../sass/app.scss */ +/* line 744, ../sass/app.scss */ .reveal-modal ul.tabs-content { margin: 0 0 0px; } -/* line 747, ../sass/app.scss */ +/* line 748, ../sass/app.scss */ .reveal-body { height: 80%; overflow-y: overlay; @@ -6819,28 +6820,28 @@ a.footer.button { padding: 5px 20px; } -/* line 754, ../sass/app.scss */ +/* line 755, ../sass/app.scss */ .reveal-footer { position: absolute; bottom: 20px; width: 90%; } -/* line 760, ../sass/app.scss */ +/* line 761, ../sass/app.scss */ .max-height { max-height: 85%; position: absolute; height: 100%; } -/* line 766, ../sass/app.scss */ +/* line 767, ../sass/app.scss */ .ui-layout-content { overflow-y: overlay; overflow-x: hidden; padding: 0; } -/* line 774, ../sass/app.scss */ +/* line 775, ../sass/app.scss */ div.time-picker { position: absolute; height: 191px; @@ -6853,20 +6854,20 @@ div.time-picker { margin: 0; } -/* line 784, ../sass/app.scss */ +/* line 785, ../sass/app.scss */ div.time-picker-12hours { width: 6em; /* needed for IE */ } -/* line 788, ../sass/app.scss */ +/* line 789, ../sass/app.scss */ div.time-picker ul { list-style-type: none; margin: 0; padding: 0; } -/* line 793, ../sass/app.scss */ +/* line 794, ../sass/app.scss */ div.time-picker li { cursor: pointer; height: 20px; @@ -6874,124 +6875,124 @@ div.time-picker li { padding: 4px 3px; } -/* line 799, ../sass/app.scss */ +/* line 800, ../sass/app.scss */ div.time-picker li.selected { background: #0063CE; color: #fff; } -/* line 805, ../sass/app.scss */ +/* line 806, ../sass/app.scss */ .timepicker { float: left; width: 50px !important; } -/* line 810, ../sass/app.scss */ +/* line 811, ../sass/app.scss */ .jdpicker { float: left; width: 90px !important; } -/* line 815, ../sass/app.scss */ +/* line 816, ../sass/app.scss */ .columns { line-height: 2; } -/* line 819, ../sass/app.scss */ +/* line 820, ../sass/app.scss */ .transparent_table, .transparent_table tr { background: none !important; border: 0px !important; } -/* line 824, ../sass/app.scss */ +/* line 825, ../sass/app.scss */ form { margin: 0 !important; } -/* line 828, ../sass/app.scss */ +/* line 829, ../sass/app.scss */ #template_create_tabs { width: 180px; } -/* line 833, ../sass/app.scss */ +/* line 834, ../sass/app.scss */ .dataTables_scrollHead { height: 30px; } -/* line 837, ../sass/app.scss */ +/* line 838, ../sass/app.scss */ .dataTables_scrollBody { margin-top: -3px; } -/* line 841, ../sass/app.scss */ +/* line 842, ../sass/app.scss */ .show_hide { cursor: pointer; } -/* line 845, ../sass/app.scss */ +/* line 846, ../sass/app.scss */ .show_hide:hover > h4 > small { color: #6f6f6f !important; } -/* line 849, ../sass/app.scss */ +/* line 850, ../sass/app.scss */ .label.allocated { background-color: #2ba6cb; } -/* line 852, ../sass/app.scss */ +/* line 853, ../sass/app.scss */ .label.real { background-color: #707d85; } -/* line 855, ../sass/app.scss */ +/* line 856, ../sass/app.scss */ .label.total { background-color: #ac5a62; } -/* line 859, ../sass/app.scss */ +/* line 860, ../sass/app.scss */ .tabs dd a, .tabs li a { padding: 0px 13px; } -/* line 863, ../sass/app.scss */ +/* line 864, ../sass/app.scss */ .ui-layout-resizer-west { background: none; } -/* line 868, ../sass/app.scss */ +/* line 869, ../sass/app.scss */ .ui-layout-resizer-west:hover { background: none; width: 30px !important; } -/* line 874, ../sass/app.scss */ +/* line 875, ../sass/app.scss */ .ui-layout-toggler-west:hover { width: 30px !important; background: #2ba6cb !important; } -/* line 879, ../sass/app.scss */ +/* line 880, ../sass/app.scss */ .ui-layout-resizer-south:hover { height: 25px !important; } -/* line 883, ../sass/app.scss */ +/* line 884, ../sass/app.scss */ .ui-layout-resizer-south:hover .ui-layout-toggler-south { height: 25px !important; } -/* line 889, ../sass/app.scss */ +/* line 890, ../sass/app.scss */ .ui-layout-toggler-south:hover { height: 25px !important; background: #2ba6cb !important; } -/* line 900, ../sass/app.scss */ +/* line 901, ../sass/app.scss */ div.dataTables_wrapper { margin-bottom: 1.25em; } -/* line 906, ../sass/app.scss */ +/* line 907, ../sass/app.scss */ div.dataTables_length label, div.dataTables_filter label, div.dataTables_info { @@ -6999,46 +7000,46 @@ div.dataTables_info { font-weight: normal; } -/* line 911, ../sass/app.scss */ +/* line 912, ../sass/app.scss */ div.dataTables_length { padding-top: 0px; } -/* line 914, ../sass/app.scss */ +/* line 915, ../sass/app.scss */ div.dataTables_length label { float: left; text-align: left; } -/* line 919, ../sass/app.scss */ +/* line 920, ../sass/app.scss */ div.dataTables_length select { width: 75px; } -/* line 923, ../sass/app.scss */ +/* line 924, ../sass/app.scss */ div.dataTables_filter label { float: right; } -/* line 926, ../sass/app.scss */ +/* line 927, ../sass/app.scss */ div.dataTables_filter input { display: inline-block !important; width: auto !important; } -/* line 931, ../sass/app.scss */ +/* line 932, ../sass/app.scss */ div.dataTables_info { padding-top: 1px; } -/* line 935, ../sass/app.scss */ +/* line 936, ../sass/app.scss */ div.dataTables_paginate { float: right; margin: 0; padding-top: 2px; } -/* line 941, ../sass/app.scss */ +/* line 942, ../sass/app.scss */ table.dataTable { clear: both; margin-bottom: 0.5em !important; @@ -7046,7 +7047,7 @@ table.dataTable { width: 100%; } -/* line 952, ../sass/app.scss */ +/* line 953, ../sass/app.scss */ table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc, @@ -7056,50 +7057,50 @@ table.dataTable thead .sorting_desc_disabled { *cursor: hand; } -/* line 957, ../sass/app.scss */ +/* line 958, ../sass/app.scss */ table.dataTable thead .sorting_asc { background: url("../images/sort_asc_disabled.png") no-repeat center right; } -/* line 958, ../sass/app.scss */ +/* line 959, ../sass/app.scss */ table.dataTable thead .sorting_desc { background: url("../images/sort_desc_disabled.png") no-repeat center right; } -/* line 960, ../sass/app.scss */ +/* line 961, ../sass/app.scss */ table.dataTable thead .sorting_asc_disabled { background: url("../images/sort_asc_disabled.png") no-repeat center right; } -/* line 961, ../sass/app.scss */ +/* line 962, ../sass/app.scss */ table.dataTable thead .sorting_desc_disabled { background: url("../images/sort_desc_disabled.png") no-repeat center right; } -/* line 963, ../sass/app.scss */ +/* line 964, ../sass/app.scss */ table.dataTable th:active { outline: none; } /* Scrolling */ -/* line 968, ../sass/app.scss */ +/* line 969, ../sass/app.scss */ div.dataTables_scrollHead table { margin-bottom: 0 !important; } -/* line 972, ../sass/app.scss */ +/* line 973, ../sass/app.scss */ div.dataTables_scrollBody table { border-top: none; margin-bottom: 0 !important; } -/* line 978, ../sass/app.scss */ +/* line 979, ../sass/app.scss */ div.dataTables_scrollBody tbody tr:first-child th, div.dataTables_scrollBody tbody tr:first-child td { border-top: none; } -/* line 982, ../sass/app.scss */ +/* line 983, ../sass/app.scss */ div.dataTables_scrollFoot table { border-top: none; } @@ -7107,42 +7108,42 @@ div.dataTables_scrollFoot table { /* * TableTools styles */ -/* line 993, ../sass/app.scss */ +/* line 994, ../sass/app.scss */ .table tbody tr.active td, .table tbody tr.active th { background-color: #08C; color: white; } -/* line 999, ../sass/app.scss */ +/* line 1000, ../sass/app.scss */ .table tbody tr.active:hover td, .table tbody tr.active:hover th { background-color: #0075b0 !important; } -/* line 1004, ../sass/app.scss */ +/* line 1005, ../sass/app.scss */ .table-striped tbody tr.active:nth-child(odd) td, .table-striped tbody tr.active:nth-child(odd) th { background-color: #017ebc; } -/* line 1011, ../sass/app.scss */ +/* line 1012, ../sass/app.scss */ table.policies_table th, table.policies_table td { font-size: 13px; } -/* line 1014, ../sass/app.scss */ +/* line 1015, ../sass/app.scss */ table.policies_table input { margin: 0px !important; height: 23px !important; font-size: 13px; } -/* line 1021, ../sass/app.scss */ +/* line 1022, ../sass/app.scss */ .key_td { font-weight: bold; } -/* line 1025, ../sass/app.scss */ +/* line 1026, ../sass/app.scss */ .detach-vnc-icon { top: 11px; right: 40px; @@ -7150,7 +7151,7 @@ table.policies_table input { color: #aaa; } -/* line 1032, ../sass/app.scss */ +/* line 1033, ../sass/app.scss */ .detach-vnc-icon:hover { color: #222; } diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 1c71cc5301..fcf9378390 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -1066,8 +1066,7 @@ var OpenNebula = { OpenNebula.Action.simple_action(params,OpenNebula.Template.resource,"unpublish"); }, "instantiate" : function(params) { - var vm_name = params.data.extra_param ? params.data.extra_param : ""; - var action_obj = { "vm_name" : vm_name }; + var action_obj = params.data.extra_param ? params.data.extra_param : {}; OpenNebula.Action.simple_action(params,OpenNebula.Template.resource, "instantiate",action_obj); }, diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index 689a9622d9..eb485a439f 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -599,35 +599,37 @@ function setAclAutorefresh(){ $(document).ready(function(){ var tab_name = 'acls-tab'; - //if we are not oneadmin, our tab will not even be in the DOM. - dataTable_acls = $("#datatable_acls",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check",2,3,4,5,6] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + //if we are not oneadmin, our tab will not even be in the DOM. + dataTable_acls = $("#datatable_acls",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check",2,3,4,5,6] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#acl_search').keyup(function(){ - dataTable_acls.fnFilter( $(this).val() ); - }) + $('#acl_search').keyup(function(){ + dataTable_acls.fnFilter( $(this).val() ); + }) - dataTable_acls.on('draw', function(){ - recountCheckboxes(dataTable_acls); - }) + dataTable_acls.on('draw', function(){ + recountCheckboxes(dataTable_acls); + }) - Sunstone.runAction("Acl.list"); + Sunstone.runAction("Acl.list"); - setupCreateAclDialog(); - setAclAutorefresh(); + setupCreateAclDialog(); + setAclAutorefresh(); - initCheckAllBoxes(dataTable_acls); - tableCheckboxesListener(dataTable_acls); - //shortenedInfoFields('#datatable_acls'); + initCheckAllBoxes(dataTable_acls); + tableCheckboxesListener(dataTable_acls); + //shortenedInfoFields('#datatable_acls'); - infoListener(dataTable_acls); + infoListener(dataTable_acls); - $('div#acls_tab div.legend_div').hide(); + $('div#acls_tab div.legend_div').hide(); + } }) diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index 6fbeb8f26c..0aff397a78 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -1407,32 +1407,34 @@ function clusters_sel() { $(document).ready(function(){ var tab_name = "clusters-tab" - //prepare host datatable - dataTable_clusters = $("#datatable_clusters",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + //prepare host datatabl + dataTable_clusters = $("#datatable_clusters",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#cluster_search').keyup(function(){ - dataTable_clusters.fnFilter( $(this).val() ); - }) + $('#cluster_search').keyup(function(){ + dataTable_clusters.fnFilter( $(this).val() ); + }) - dataTable_clusters.on('draw', function(){ - recountCheckboxes(dataTable_clusters); - }) + dataTable_clusters.on('draw', function(){ + recountCheckboxes(dataTable_clusters); + }) - Sunstone.runAction("Cluster.list"); + Sunstone.runAction("Cluster.list"); - dialogs_context.append('
'); + dialogs_context.append('
'); - setClusterAutorefresh(); - clusterResourceViewListeners(); + setClusterAutorefresh(); + clusterResourceViewListeners(); - initCheckAllBoxes(dataTable_clusters); - tableCheckboxesListener(dataTable_clusters); - infoListener(dataTable_clusters, "Cluster.showinfo"); + initCheckAllBoxes(dataTable_clusters); + tableCheckboxesListener(dataTable_clusters); + infoListener(dataTable_clusters, "Cluster.showinfo"); + } }); diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index e3cd2bbe41..585244c2fb 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -34,7 +34,7 @@ setInterval(function(){ Config = { "isTabEnabled": function(tab_name){ - var enabled = config['view']['tabs'][tab_name]['enabled']; + var enabled = config['view']['enabled_tabs'][tab_name]; return enabled; }, "isTabActionEnabled": function(tab_name, action_name, panel_name){ diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 6fc68e08b4..858e6b8996 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -1082,38 +1082,41 @@ function setDatastoreAutorefresh(){ } $(document).ready(function(){ + var tab_name = 'datastores-tab'; - dataTable_datastores = $("#datatable_datastores",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": config['view']['tabs']['datastores-tab']['table_columns']}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_datastores = $("#datatable_datastores",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#datastore_search').keyup(function(){ - dataTable_datastores.fnFilter( $(this).val() ); - }) + $('#datastore_search').keyup(function(){ + dataTable_datastores.fnFilter( $(this).val() ); + }) - dataTable_datastores.on('draw', function(){ - recountCheckboxes(dataTable_datastores); - }) + dataTable_datastores.on('draw', function(){ + recountCheckboxes(dataTable_datastores); + }) - Sunstone.runAction("Datastore.list"); + Sunstone.runAction("Datastore.list"); - setupCreateDatastoreDialog(); - setDatastoreAutorefresh(); + setupCreateDatastoreDialog(); + setDatastoreAutorefresh(); - initCheckAllBoxes(dataTable_datastores); - tableCheckboxesListener(dataTable_datastores); - infoListener(dataTable_datastores,'Datastore.showinfo'); + initCheckAllBoxes(dataTable_datastores); + tableCheckboxesListener(dataTable_datastores); + infoListener(dataTable_datastores,'Datastore.showinfo'); - // Reset filter in case the view was filtered because it was accessed - // from a single cluster. - $('div#menu li#li_datastores_tab').live('click',function(){ - dataTable_datastores.fnFilter('',5); - }); + // Reset filter in case the view was filtered because it was accessed + // from a single cluster. + $('div#menu li#li_datastores_tab').live('click',function(){ + dataTable_datastores.fnFilter('',5); + }); - $('div#datastores_tab div.legend_div').hide(); + $('div#datastores_tab div.legend_div').hide(); + } }) diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index 6737248253..4c3ef7bff5 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -969,32 +969,34 @@ function is_persistent_file(id){ $(document).ready(function(){ var tab_name = 'files-tab'; - dataTable_files = $("#datatable_files",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_files = $("#datatable_files",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#file_search').keyup(function(){ - dataTable_files.fnFilter( $(this).val() ); - }) + $('#file_search').keyup(function(){ + dataTable_files.fnFilter( $(this).val() ); + }) - dataTable_files.on('draw', function(){ - recountCheckboxes(dataTable_files); - }) + dataTable_files.on('draw', function(){ + recountCheckboxes(dataTable_files); + }) - Sunstone.runAction("File.list"); + Sunstone.runAction("File.list"); - setupCreateFileDialog(); - setupTips($create_file_dialog); - setFileAutorefresh(); + setupCreateFileDialog(); + setupTips($create_file_dialog); + setFileAutorefresh(); - initCheckAllBoxes(dataTable_files); - tableCheckboxesListener(dataTable_files); - infoListener(dataTable_files,'File.showinfo'); + initCheckAllBoxes(dataTable_files); + tableCheckboxesListener(dataTable_files); + infoListener(dataTable_files,'File.showinfo'); - $('div#files_tab div.legend_div').hide(); + $('div#files_tab div.legend_div').hide(); + } }); diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 4ab6400285..8a96583f97 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -609,32 +609,34 @@ function setGroupAutorefresh(){ $(document).ready(function(){ var tab_name = 'groups-tab'; - dataTable_groups = $("#datatable_groups",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check",4,5,6] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_groups = $("#datatable_groups",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check",4,5,6] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#group_search').keyup(function(){ - dataTable_groups.fnFilter( $(this).val() ); - }) + $('#group_search').keyup(function(){ + dataTable_groups.fnFilter( $(this).val() ); + }) - dataTable_groups.on('draw', function(){ - recountCheckboxes(dataTable_groups); - }) + dataTable_groups.on('draw', function(){ + recountCheckboxes(dataTable_groups); + }) - Sunstone.runAction("Group.list"); - setupCreateGroupDialog(); - setupGroupQuotasDialog(); - setGroupAutorefresh(); + Sunstone.runAction("Group.list"); + setupCreateGroupDialog(); + setupGroupQuotasDialog(); + setGroupAutorefresh(); - initCheckAllBoxes(dataTable_groups); - tableCheckboxesListener(dataTable_groups); - infoListener(dataTable_groups, 'Group.showinfo'); + initCheckAllBoxes(dataTable_groups); + tableCheckboxesListener(dataTable_groups); + infoListener(dataTable_groups, 'Group.showinfo'); - $('div#groups_tab div.legend_div').hide(); - $('div#groups_tab_non_admin div.legend_div').hide(); + $('div#groups_tab div.legend_div').hide(); + $('div#groups_tab_non_admin div.legend_div').hide(); + } }) diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 638ba81011..2ef52deb31 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -968,42 +968,44 @@ function hostMonitorError(req,error_json){ $(document).ready(function(){ var tab_name = 'hosts-tab'; - //prepare host datatable - dataTable_hosts = $("#datatable_hosts",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check",5,6,7,8] }, - { "sWidth": "35px", "aTargets": [0] }, //check, ID, RVMS, Status, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + //prepare host datatable + dataTable_hosts = $("#datatable_hosts",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check",5,6,7,8] }, + { "sWidth": "35px", "aTargets": [0] }, //check, ID, RVMS, Status, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#hosts_search').keyup(function(){ - dataTable_hosts.fnFilter( $(this).val() ); - }) + $('#hosts_search').keyup(function(){ + dataTable_hosts.fnFilter( $(this).val() ); + }) - dataTable_hosts.on('draw', function(){ - recountCheckboxes(dataTable_hosts); - }) + dataTable_hosts.on('draw', function(){ + recountCheckboxes(dataTable_hosts); + }) - Sunstone.runAction("Host.list"); + Sunstone.runAction("Host.list"); - setupCreateHostDialog(); + setupCreateHostDialog(); - setHostAutorefresh(); + setHostAutorefresh(); - initCheckAllBoxes(dataTable_hosts); - tableCheckboxesListener(dataTable_hosts); - infoListener(dataTable_hosts, "Host.showinfo"); + initCheckAllBoxes(dataTable_hosts); + tableCheckboxesListener(dataTable_hosts); + infoListener(dataTable_hosts, "Host.showinfo"); - // This listener removes any filter on hosts table when its menu item is - // selected. The cluster plugins will filter hosts when the hosts - // in a cluster are shown. So we have to make sure no filter has been - // left in place when we want to see all hosts. - $('div#menu li#li_hosts_tab').live('click',function(){ - dataTable_hosts.fnFilter('',3); - }); + // This listener removes any filter on hosts table when its menu item is + // selected. The cluster plugins will filter hosts when the hosts + // in a cluster are shown. So we have to make sure no filter has been + // left in place when we want to see all hosts. + $('div#menu li#li_hosts_tab').live('click',function(){ + dataTable_hosts.fnFilter('',3); + }); - // Hide help - $('div#hosts_tab div.legend_div',main_tabs_context).hide(); + // Hide help + $('div#hosts_tab div.legend_div',main_tabs_context).hide(); + } }); diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index fd4dd22d5a..8ae95e92cd 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -16,6 +16,8 @@ /*Images tab plugin*/ +size_images = 0; + var images_tab_content = '\
\
\ @@ -1349,32 +1351,34 @@ function popUpImageCloneDialog(){ $(document).ready(function(){ var tab_name = 'images-tab'; - dataTable_images = $("#datatable_images",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_images = $("#datatable_images",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#image_search').keyup(function(){ - dataTable_images.fnFilter( $(this).val() ); - }) + $('#image_search').keyup(function(){ + dataTable_images.fnFilter( $(this).val() ); + }) - dataTable_images.on('draw', function(){ - recountCheckboxes(dataTable_images); - }) + dataTable_images.on('draw', function(){ + recountCheckboxes(dataTable_images); + }) - Sunstone.runAction("Image.list"); + Sunstone.runAction("Image.list"); - setupCreateImageDialog(); - setupImageCloneDialog(); - setImageAutorefresh(); + setupCreateImageDialog(); + setupImageCloneDialog(); + setImageAutorefresh(); - initCheckAllBoxes(dataTable_images); - tableCheckboxesListener(dataTable_images); - infoListener(dataTable_images,'Image.showinfo'); + initCheckAllBoxes(dataTable_images); + tableCheckboxesListener(dataTable_images); + infoListener(dataTable_images,'Image.showinfo'); - $('div#images_tab div.legend_div').hide(); + $('div#images_tab div.legend_div').hide(); + } }); diff --git a/src/sunstone/public/js/plugins/marketplace-tab.js b/src/sunstone/public/js/plugins/marketplace-tab.js index 6ead38aff1..8b511dfc46 100644 --- a/src/sunstone/public/js/plugins/marketplace-tab.js +++ b/src/sunstone/public/js/plugins/marketplace-tab.js @@ -292,46 +292,48 @@ function onlyOneCheckboxListener(dataTable) { $(document).ready(function(){ var tab_name = 'marketplace-tab'; - dataTable_marketplace = $("#datatable_marketplace", main_tabs_context).dataTable({ - "bSortClasses": true, - "aoColumns": [ - { "bSortable": false, - "mData": function ( o, val, data ) { - //we render 1st column as a checkbox directly - return '' + if (Config.isTabEnabled(tab_name)) { + dataTable_marketplace = $("#datatable_marketplace", main_tabs_context).dataTable({ + "bSortClasses": true, + "aoColumns": [ + { "bSortable": false, + "mData": function ( o, val, data ) { + //we render 1st column as a checkbox directly + return '' + }, + "sWidth" : "60px" }, - "sWidth" : "60px" - }, - { "mDataProp": "_id.$oid", "sWidth" : "200px" }, - { "mDataProp": "name" }, - { "mDataProp": "publisher" }, - { "mDataProp": "files.0.hypervisor", "sWidth" : "100px"}, - { "mDataProp": "files.0.os-arch", "sWidth" : "100px"}, - { "mDataProp": "files.0.format", "sWidth" : "100px"}, - { "mDataProp": "tags"} - ], - "aoColumnDefs": [ - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + { "mDataProp": "_id.$oid", "sWidth" : "200px" }, + { "mDataProp": "name" }, + { "mDataProp": "publisher" }, + { "mDataProp": "files.0.hypervisor", "sWidth" : "100px"}, + { "mDataProp": "files.0.os-arch", "sWidth" : "100px"}, + { "mDataProp": "files.0.format", "sWidth" : "100px"}, + { "mDataProp": "tags"} + ], + "aoColumnDefs": [ + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#marketplace_search').keyup(function(){ - dataTable_marketplace.fnFilter( $(this).val() ); - }) + $('#marketplace_search').keyup(function(){ + dataTable_marketplace.fnFilter( $(this).val() ); + }) - dataTable_marketplace.on('draw', function(){ - recountCheckboxes(dataTable_marketplace); - }) + dataTable_marketplace.on('draw', function(){ + recountCheckboxes(dataTable_marketplace); + }) - tableCheckboxesListener(dataTable_marketplace); - onlyOneCheckboxListener(dataTable_marketplace); + tableCheckboxesListener(dataTable_marketplace); + onlyOneCheckboxListener(dataTable_marketplace); - infoListenerMarket(dataTable_marketplace); + infoListenerMarket(dataTable_marketplace); - Sunstone.runAction('Marketplace.list'); + Sunstone.runAction('Marketplace.list'); + } }); diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index da069139c3..37dfdc66cd 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -15,144 +15,295 @@ /* -------------------------------------------------------------------------- */ /*Templates tab plugin*/ - var templates_tab_content = '\ \ -
\ -
\ -
\ -

\ - \ - '+tr("Templates")+'\ - \ - \ -  \ - \ - \ -

\ -
\ -
\ -
\ -
\ -
\ +
\ +
\ +
\ +

\ + \ + '+tr("Templates")+'\ + \ + \ +  \ + \ + \ +

\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + \ +
\ +
\ +
\
\
\ -
\ - \ -
\ -
\ -
\ -
\ -
\
\
\ -\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
'+tr("ID")+''+tr("Owner")+''+tr("Group")+''+tr("Name")+''+tr("Registration time")+'
\ -
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("ID")+''+tr("Owner")+''+tr("Group")+''+tr("Name")+''+tr("Registration time")+'
\ +
\
\ '; -var create_template_tmpl = '
'+ - '

'+tr("Create VM Template")+'

'+ - '
'+ - '
'+ - '
' + - '
'+tr("Wizard")+'
' + - '
'+tr("Advanced mode")+'
' + - '
' + - '
    ' + - '
  • ' + - '
    '+ - '
    '+ - '
    '+ - '
    '+ - '
    '+ - '
    '+ - '
    '+ - '
      '+ - '
    '+ - '
    '+ +var create_template_tmpl = '\ +
    '+ + '

    '+tr("Create VM Template")+'

    '+ +'
    '+ +'
    '+ + '
    ' + + '
    '+tr("Wizard")+'
    ' + + '
    '+tr("Advanced mode")+'
    ' + + '
    ' + + '
      ' + + '
    • ' + + ''+ + '
      '+ + '
      '+ + '
      '+ + '
      '+ '
      '+ - '
    • ' + - '
    • ' + - '
      ' + - '

      '+tr("Write the Virtual Machine template here")+'

      ' + - '' + - ''+ + ''+ + '
      '+ + '
    • ' + + '
    • ' + + '
      ' + + '

      '+tr("Write the Virtual Machine template here")+'

      ' + + '' + + '
    • ' + - '
    ' + - '
    '+ - '×'; + '
    ' + + '' + + '
  • ' + + '
' + +'
'+ +'×'; var instantiate_vm_template_tmpl ='\ -
\ -

\ - '+tr("Instantiate VM Template")+'\ -

\ -
\ -
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
'+tr("Defaults to template name when emtpy")+'.
\ -
\ -
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
'+tr("You can use the wildcard %i. When creating several VMs, %i will be replaced with a different number starting from 0 in each of them")+'.
\ -
\ -
\ -
\ -
\ - \ - \ -
\ -×\ +
\ +

\ + '+tr("Instantiate VM Template")+'\ +

\ +
\ +\ +
\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
'+tr("Defaults to template name when emtpy. You can use the wildcard %i. When creating several VMs, %i will be replaced with a different number starting from 0 in each of them")+'.
\ +
\ +
\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
'+tr("Number of Virtual Machines that will be created using this template")+'.
\ +
\ +
\ +
\ +
\ +
\ + \ + \ +
\ + ×\
'; +var easy_provision_vm_template_tmpl ='\ +
\ +

\ + '+tr("Instantiate VM Template")+'\ +

\ +
\ +
\ +
\ +
\ +
\ + '+tr("Step 1: Specify a name and the number of instances")+'\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
'+tr("Defaults to template name when emtpy. You can use the wildcard %i. When creating several VMs, %i will be replaced with a different number starting from 0 in each of them")+'.
\ +
\ +
\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
'+tr("Number of Virtual Machines that will be created using this template")+'.
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + '+tr("Step 3: Select an instance type")+'\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("ID")+''+tr("Owner")+''+tr("Group")+''+tr("Name")+''+tr("Registration time")+'
\ + \ +
\ +
\ + '+tr("Please select a template from the list")+'\ + \ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + '+tr("Step 3: Select an operating system")+'\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("ID")+''+tr("Owner")+''+tr("Group")+''+tr("Name")+''+tr("Datastore")+''+tr("Size")+''+tr("Type")+''+tr("Registration time")+''+tr("Persistent")+''+tr("Status")+''+tr("#VMS")+''+tr("Target")+'
\ + \ +
\ +
\ + '+tr("Please select an image from the list")+'\ + \ + \ +
\ +
\ +
\ + \ + ×\ + \ +
'; + var dataTable_templates; var $create_template_dialog; @@ -171,6 +322,13 @@ var template_actions = { call: popUpCreateTemplateDialog }, + "Template.easy_provision" : { + type: "custom", + call: function() { + popUpInstantiateVMTemplateDialog(true); + } + }, + "Template.list" : { type: "list", call: OpenNebula.Template.list, @@ -289,13 +447,29 @@ var template_actions = { nodes = getSelectedNodes(dataTable_templates); if (nodes.length == 1) { - popUpInstantiateVMTemplateDialog(); + popUpInstantiateVMTemplateDialog(false); } else { Sunstone.runAction("Template.instantiate", nodes); } + Sunstone.runAction("VM.refresh"); + } + }, + "Template.instantiate_and_merge" : { + type: "custom", + call: function(){ + nodes = getSelectedNodes(dataTable_templates); + if (nodes.length == 1) + { + popUpMergeVMTemplateDialog(); + } + else + { + notifyError(tr("Please select only one template in the table")) + } + Sunstone.runAction("VM.refresh"); } }, @@ -350,6 +524,11 @@ var template_buttons = { type: "create_dialog", layout: "create" }, + "Template.easy_provision" : { + type: "create_dialog", + text: "Launch", + layout: "create" + }, "Template.update_dialog" : { type: "action", layout: "more_select", @@ -1151,9 +1330,7 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){ '
'; $("#refresh_template_images_table_button_class"+str_disk_tab_id).die(); - $("#refresh_template_images_table_button_class"+str_disk_tab_id).live('click', function(){ - // Retrieve the images to fill the datatable update_datatable_template_images($('table[id='+str_datatable_id+']').dataTable()); }); @@ -1223,6 +1400,27 @@ function update_datatable_template_images(datatable, fnDrawCallback) { }); } +function update_datatable_template_templates(datatable, fnDrawCallback) { + if (fnDrawCallback) { + datatable.on('draw', fnDrawCallback); + } + + OpenNebula.Template.list({ + timeout: true, + success: function (request, templates_list){ + var template_list_array = []; + + $.each(templates_list,function(){ + var template_element_array = templateElementArray(this); + if (template_element_array) + template_list_array.push(template_element_array); + }); + + updateView(template_list_array, datatable); + } + }); +} + function update_datatable_template_files(datatable, fnDrawCallback) { if (fnDrawCallback) { datatable.on('draw', fnDrawCallback); @@ -4496,15 +4694,120 @@ function setTemplateAutorefresh() { // Instantiate dialog // Sets up the instiantiate template dialog and all the processing associated to it -function setupInstantiateTemplateDialog(){ +function setupInstantiateTemplateDialog(easy_provision){ dialogs_context.append('
'); //Insert HTML in place $instantiate_vm_template_dialog = $('#instantiate_vm_template_dialog') var dialog = $instantiate_vm_template_dialog; - dialog.html(instantiate_vm_template_tmpl); - dialog.addClass("reveal-modal"); + if (easy_provision) { + dialog.html(easy_provision_vm_template_tmpl); + dialog.addClass("reveal-modal large max-height"); + + var dataTable_template_images = $('#template_images_table', dialog).dataTable({ + "iDisplayLength": 4, + "bAutoWidth":false, + "sDom" : '<"H">t<"F"p>', + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0,1] }, + { "bVisible": false, "aTargets": [2,3,7,8,5,9,12]} + ], + "fnDrawCallback": function(oSettings) { + var nodes = this.fnGetNodes(); + $.each(nodes, function(){ + if ($(this).find("td:eq(1)").html() == $('#IMAGE_ID', dialog).val()) { + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + } + }) + } + }); + + // Retrieve the images to fill the datatable + update_datatable_template_images(dataTable_template_images); + + $('#template_images_table_search', dialog).keyup(function(){ + dataTable_template_images.fnFilter( $(this).val() ); + }) + + $('#template_images_table tbody', dialog).delegate("tr", "click", function(e){ + var aData = dataTable_template_images.fnGetData(this); + + $("td.markrow", dataTable_template_images).removeClass('markrow'); + $('tbody input.check_item', dataTable_template_images).removeAttr('checked'); + + $('#image_selected', dialog).show(); + $('#select_image', dialog).hide(); + $('.alert-box', dialog).hide(); + + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + + $('#IMAGE_NAME', dialog).text(aData[4]); + $('#IMAGE_ID', dialog).val(aData[1]); + return true; + }); + + $("#refresh_template_images_table_button_class").die(); + $("#refresh_template_images_table_button_class").live('click', function(){ + update_datatable_template_images($('#template_images_table').dataTable()); + }); + + var dataTable_template_templates = $('#template_templates_table', dialog).dataTable({ + "iDisplayLength": 4, + "bAutoWidth":false, + "sDom" : '<"H">t<"F"p>', + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0,1] }, + { "bVisible": false, "aTargets": [1,2,3,5]} + ], + "fnDrawCallback": function(oSettings) { + var nodes = this.fnGetNodes(); + $.each(nodes, function(){ + if ($(this).find("td:eq(1)").html() == $('#TEMPLATE_ID', dialog).val()) { + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + } + }) + } + }); + + // Retrieve the images to fill the datatable + update_datatable_template_templates(dataTable_template_templates); + + $('#template_templates_table_search', dialog).keyup(function(){ + dataTable_template_templates.fnFilter( $(this).val() ); + }) + + $('#template_templates_table tbody', dialog).delegate("tr", "click", function(e){ + var aData = dataTable_template_templates.fnGetData(this); + + $("td.markrow", dataTable_template_templates).removeClass('markrow'); + $('tbody input.check_item', dataTable_template_templates).removeAttr('checked'); + + $('#template_selected', dialog).show(); + $('#select_template', dialog).hide(); + $('.alert-box', dialog).hide(); + + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + + $('#TEMPLATE_NAME', dialog).text(aData[4]); + $('#TEMPLATE_ID', dialog).val(aData[1]); + return true; + }); + + $("#refresh_template_templates_table_button_class").die(); + $("#refresh_template_templates_table_button_class").live('click', function(){ + update_datatable_template_templates($('#template_templates_table').dataTable()); + }); + } else { + dialog.html(instantiate_vm_template_tmpl); + dialog.addClass("reveal-modal large"); + dialog.removeClass("max-height") + } + setupTips(dialog); @@ -4513,36 +4816,53 @@ function setupInstantiateTemplateDialog(){ var n_times = $('#vm_n_times',this).val(); var n_times_int=1; - var selected_nodes = getSelectedNodes(dataTable_templates); - var template_id = ""+selected_nodes[0]; + var template_id + if ($("#TEMPLATE_ID", this).val()) { + template_id = $("#TEMPLATE_ID", this).val(); + } else { + var selected_nodes = getSelectedNodes(dataTable_templates); + template_id = ""+selected_nodes[0]; + } + if (n_times.length){ n_times_int=parseInt(n_times,10); }; - var extra_info = ""; + var extra_msg = ""; if (n_times_int > 1) { - extra_info = n_times_int+" times"; + extra_msg = n_times_int+" times"; } - notifySubmit("Template.instantiate",template_id, extra_info); + notifySubmit("Template.instantiate",template_id, extra_msg); + + var extra_info = {}; + if ($("#IMAGE_ID", this).val()) { + image_id = $("#IMAGE_ID", this).val(); + extra_info['template'] = { + 'disk': { + 'image_id': image_id + } + } + } if (!vm_name.length){ //empty name use OpenNebula core default for (var i=0; i< n_times_int; i++){ - Sunstone.runAction("Template.instantiate_quiet", template_id, ""); + extra_info['vm_name'] = ""; + Sunstone.runAction("Template.instantiate_quiet", template_id, extra_info); }; } else { if (vm_name.indexOf("%i") == -1){//no wildcard, all with the same name for (var i=0; i< n_times_int; i++){ - Sunstone.runAction("Template.instantiate_quiet", template_id, vm_name); + extra_info['vm_name'] = vm_name; + Sunstone.runAction("Template.instantiate_quiet", template_id, extra_info); }; } else { //wildcard present: replace wildcard - var name = ""; for (var i=0; i< n_times_int; i++){ - name = vm_name.replace(/%i/gi,i); - Sunstone.runAction("Template.instantiate_quiet", template_id, name); + extra_info['vm_name'] = vm_name.replace(/%i/gi,i); + Sunstone.runAction("Template.instantiate_quiet", template_id, extra_info); }; }; } @@ -4553,7 +4873,8 @@ function setupInstantiateTemplateDialog(){ } // Open creation dialog -function popUpInstantiateVMTemplateDialog(){ +function popUpInstantiateVMTemplateDialog(easy_provision){ + setupInstantiateTemplateDialog(easy_provision); $instantiate_vm_template_dialog.reveal(); } @@ -4561,34 +4882,34 @@ function popUpInstantiateVMTemplateDialog(){ $(document).ready(function(){ var tab_name = 'templates-tab'; - dataTable_templates = $("#datatable_templates",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_templates = $("#datatable_templates",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#template_search').keyup(function(){ - dataTable_templates.fnFilter( $(this).val() ); - }) + $('#template_search').keyup(function(){ + dataTable_templates.fnFilter( $(this).val() ); + }) - dataTable_templates.on('draw', function(){ - recountCheckboxes(dataTable_templates); - }) + dataTable_templates.on('draw', function(){ + recountCheckboxes(dataTable_templates); + }) - Sunstone.runAction("Template.list"); - setupInstantiateTemplateDialog(); - setupCreateTemplateDialog(); - setupTemplateCloneDialog(); - setTemplateAutorefresh(); + Sunstone.runAction("Template.list"); + setupCreateTemplateDialog(); + setupTemplateCloneDialog(); + setTemplateAutorefresh(); - initCheckAllBoxes(dataTable_templates); - tableCheckboxesListener(dataTable_templates); - infoListener(dataTable_templates,'Template.showinfo'); - - $('div#templates_tab div.legend_div').hide(); + initCheckAllBoxes(dataTable_templates); + tableCheckboxesListener(dataTable_templates); + infoListener(dataTable_templates,'Template.showinfo'); + $('div#templates_tab div.legend_div').hide(); + } }); diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index 6b0b9f90cf..cac9a55453 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -913,40 +913,42 @@ function setUserAutorefresh(){ $(document).ready(function(){ var tab_name = 'users-tab'; - //if we are not oneadmin, our tab will not even be in the DOM. - dataTable_users = $("#datatable_users",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check",5,6,7] }, - { "sWidth": "35px", "aTargets": [0] }, - { "sWidth": "150px", "aTargets": [5,6,7] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + //if we are not oneadmin, our tab will not even be in the DOM. + dataTable_users = $("#datatable_users",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check",5,6,7] }, + { "sWidth": "35px", "aTargets": [0] }, + { "sWidth": "150px", "aTargets": [5,6,7] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#user_search').keyup(function(){ - dataTable_users.fnFilter( $(this).val() ); - }) + $('#user_search').keyup(function(){ + dataTable_users.fnFilter( $(this).val() ); + }) - dataTable_users.on('draw', function(){ - recountCheckboxes(dataTable_users); - }) + dataTable_users.on('draw', function(){ + recountCheckboxes(dataTable_users); + }) - Sunstone.runAction("User.list"); + Sunstone.runAction("User.list"); - setupCreateUserDialog(); - setupUpdatePasswordDialog(); - setupChangeAuthenticationDialog(); - setupUserQuotasDialog(); - setUserAutorefresh(); - //Setup quota icons - //Also for group tab - setupQuotaIcons(); + setupCreateUserDialog(); + setupUpdatePasswordDialog(); + setupChangeAuthenticationDialog(); + setupUserQuotasDialog(); + setUserAutorefresh(); + //Setup quota icons + //Also for group tab + setupQuotaIcons(); - initCheckAllBoxes(dataTable_users); - tableCheckboxesListener(dataTable_users); - infoListener(dataTable_users,'User.showinfo'); + initCheckAllBoxes(dataTable_users); + tableCheckboxesListener(dataTable_users); + infoListener(dataTable_users,'User.showinfo'); - $('div#users_tab div.legend_div').hide(); - $('div#users_tab_non_admin div.legend_div').hide(); + $('div#users_tab div.legend_div').hide(); + $('div#users_tab_non_admin div.legend_div').hide(); + } }); diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 8d6bd32afc..110004ffea 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -89,54 +89,203 @@ var vms_tab_content = '\ \ '; +//var create_vm_tmpl ='\ +//
\ +//

\ +// '+tr("Create Virtual Machine")+'\ +//

\ +//
\ +//
\ +//
\ +//
\ +// \ +//
\ +//
\ +// \ +//
\ +//
\ +//
'+tr("Defaults to template name when emtpy")+'.
\ +//
\ +//
\ +//
\ +//
\ +// \ +//
\ +//
\ +// \ +//
\ +//
\ +//
\ +//
\ +//
\ +//
\ +//
\ +// \ +//
\ +//
\ +// \ +//
\ +//
\ +//
'+tr("You can use the wildcard %i. When creating several VMs, %i will be replaced with a different number starting from 0 in each of them")+'.
\ +//
\ +//
\ +//
\ +//
\ +// \ +// \ +//
\ +//×\ +//
'; + var create_vm_tmpl ='\ -
\ -

\ - '+tr("Create Virtual Machine")+'\ -

\ +
\ +

\ + '+tr("Create Virtual Machine")+'\ +

\ +
\ +
\ +
\ +
\ +
\ + '+tr("Step 1: Specify a name and the number of instances")+'\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
'+tr("Defaults to template name when emtpy. You can use the wildcard %i. When creating several VMs, %i will be replaced with a different number starting from 0 in each of them")+'.
\ +
\
\ - \ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
'+tr("Defaults to template name when emtpy")+'.
\ -
\ +
\ +
\ + \
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
\ -
\ +
\ + \
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
'+tr("You can use the wildcard %i. When creating several VMs, %i will be replaced with a different number starting from 0 in each of them")+'.
\ -
\ +
\ +
'+tr("Number of Virtual Machines that will be created using this template")+'.
\
\ -
\ -
\ - \ - \
\ -×\ -'; +
\ +
\ +
\ +
\ +
\ +
\ +
\ + '+tr("Step 2: Select an instance type")+'\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("ID")+''+tr("Owner")+''+tr("Group")+''+tr("Name")+''+tr("Registration time")+'
\ + \ +
\ +
\ + '+tr("Please select a template from the list")+'\ + \ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + '+tr("Step 3: Select an operating system")+'\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
'+tr("ID")+''+tr("Owner")+''+tr("Group")+''+tr("Name")+''+tr("Datastore")+''+tr("Size")+''+tr("Type")+''+tr("Registration time")+''+tr("Persistent")+''+tr("Status")+''+tr("#VMS")+''+tr("Target")+'
\ + \ +
\ +
\ + '+tr("Please select an image from the list")+'\ + \ + \ +
\ +
\ +
\ + \ + ×\ + \ +
'; var vmachine_list_json = {}; var dataTable_vMachines; @@ -157,7 +306,16 @@ var vm_actions = { "VM.create_dialog" : { type: "custom", - call: popUpCreateVMDialog + call: function(){ + popUpCreateVMDialog(false); + } + }, + + "VM.easy_provision" : { + type: "custom", + call: function(){ + popUpCreateVMDialog(true); + } }, "VM.list" : { @@ -692,6 +850,12 @@ var vm_buttons = { layout: "create", alwaysActive: true }, + "VM.easy_provision" : { + type: "action", + layout: "create", + text: tr("Launch"), + alwaysActive: true + }, "VM.chown" : { type: "confirm_with_select", text: tr("Change owner"), @@ -2732,28 +2896,123 @@ function setup_vm_snapshot_tab(){ // Sets up the create-template dialog and all the processing associated to it, // which is a lot. -function setupCreateVMDialog(){ +function setupCreateVMDialog(include_select_image){ dialogs_context.append('
'); //Insert HTML in place $create_vm_dialog = $('#create_vm_dialog') var dialog = $create_vm_dialog; dialog.html(create_vm_tmpl); + dialog.addClass("reveal-modal large max-height"); - //Prepare jquery dialog - //dialog.dialog({ - // autoOpen: false, - // modal: true, - // width: 400 - //}); - dialog.addClass("reveal-modal"); + var dataTable_template_templates = $('#template_templates_table', dialog).dataTable({ + "iDisplayLength": 4, + "bAutoWidth":false, + "sDom" : '<"H">t<"F"p>', + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0,1] }, + { "bVisible": false, "aTargets": [1,2,3,5]} + ], + "fnDrawCallback": function(oSettings) { + var nodes = this.fnGetNodes(); + $.each(nodes, function(){ + if ($(this).find("td:eq(1)").html() == $('#TEMPLATE_ID', dialog).val()) { + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + } + }) + } + }); + + // Retrieve the images to fill the datatable + update_datatable_template_templates(dataTable_template_templates); + + $('#template_templates_table_search', dialog).keyup(function(){ + dataTable_template_templates.fnFilter( $(this).val() ); + }) + + $('#template_templates_table tbody', dialog).delegate("tr", "click", function(e){ + var aData = dataTable_template_templates.fnGetData(this); + + $("td.markrow", dataTable_template_templates).removeClass('markrow'); + $('tbody input.check_item', dataTable_template_templates).removeAttr('checked'); + + $('#template_selected', dialog).show(); + $('#select_template', dialog).hide(); + $('.alert-box', dialog).hide(); + + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + + $('#TEMPLATE_NAME', dialog).text(aData[4]); + $('#TEMPLATE_ID', dialog).val(aData[1]); + return true; + }); + + $("#refresh_template_templates_table_button_class").die(); + $("#refresh_template_templates_table_button_class").live('click', function(){ + update_datatable_template_templates($('#template_templates_table').dataTable()); + }); + + if (include_select_image) { + $("#select_image_step", dialog).show(); + var dataTable_template_images = $('#template_images_table', dialog).dataTable({ + "iDisplayLength": 4, + "bAutoWidth":false, + "sDom" : '<"H">t<"F"p>', + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0,1] }, + { "bVisible": false, "aTargets": [2,3,7,8,5,9,12]} + ], + "fnDrawCallback": function(oSettings) { + var nodes = this.fnGetNodes(); + $.each(nodes, function(){ + if ($(this).find("td:eq(1)").html() == $('#IMAGE_ID', dialog).val()) { + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + } + }) + } + }); + + // Retrieve the images to fill the datatable + update_datatable_template_images(dataTable_template_images); + + $('#template_images_table_search', dialog).keyup(function(){ + dataTable_template_images.fnFilter( $(this).val() ); + }) + + $('#template_images_table tbody', dialog).delegate("tr", "click", function(e){ + var aData = dataTable_template_images.fnGetData(this); + + $("td.markrow", dataTable_template_images).removeClass('markrow'); + $('tbody input.check_item', dataTable_template_images).removeAttr('checked'); + + $('#image_selected', dialog).show(); + $('#select_image', dialog).hide(); + $('.alert-box', dialog).hide(); + + $("td", this).addClass('markrow'); + $('input.check_item', this).attr('checked','checked'); + + $('#IMAGE_NAME', dialog).text(aData[4]); + $('#IMAGE_ID', dialog).val(aData[1]); + return true; + }); + + $("#refresh_template_images_table_button_class").die(); + $("#refresh_template_images_table_button_class").live('click', function(){ + update_datatable_template_images($('#template_images_table').dataTable()); + }); + } else { + $("#select_image_step", dialog).hide(); + } - //$('button',dialog).button(); setupTips(dialog); $('#create_vm_form',dialog).submit(function(){ var vm_name = $('#vm_name',this).val(); - var template_id = $('#template_id',this).val(); + var template_id = $('#TEMPLATE_ID',this).val(); var n_times = $('#vm_n_times',this).val(); var n_times_int=1; @@ -2766,29 +3025,40 @@ function setupCreateVMDialog(){ n_times_int=parseInt(n_times,10); }; - var extra_info = ""; + var extra_msg = ""; if (n_times_int > 1) { - extra_info = n_times_int+" times"; + extra_msg = n_times_int+" times"; } - notifySubmit("Template.instantiate",template_id, extra_info); + notifySubmit("Template.instantiate",template_id, extra_msg); + + var extra_info = {}; + if ($("#IMAGE_ID", this).val()) { + image_id = $("#IMAGE_ID", this).val(); + extra_info['template'] = { + 'disk': { + 'image_id': image_id + } + } + } if (!vm_name.length){ //empty name use OpenNebula core default for (var i=0; i< n_times_int; i++){ - Sunstone.runAction("Template.instantiate_quiet", template_id, ""); + extra_info['vm_name'] = ""; + Sunstone.runAction("Template.instantiate_quiet", template_id, extra_info); }; } else { - if (vm_name.indexOf("%i") == -1){ //no wildcard + if (vm_name.indexOf("%i") == -1){//no wildcard, all with the same name for (var i=0; i< n_times_int; i++){ - Sunstone.runAction("Template.instantiate_quiet", template_id, vm_name); + extra_info['vm_name'] = vm_name; + Sunstone.runAction("Template.instantiate_quiet", template_id, extra_info); }; } else { //wildcard present: replace wildcard - var name = ""; for (var i=0; i< n_times_int; i++){ - name = vm_name.replace(/%i/gi,i); - Sunstone.runAction("Template.instantiate_quiet", template_id, name); + extra_info['vm_name'] = vm_name.replace(/%i/gi,i); + Sunstone.runAction("Template.instantiate_quiet", template_id, extra_info); }; }; } @@ -2802,7 +3072,8 @@ function setupCreateVMDialog(){ } // Open creation dialog -function popUpCreateVMDialog(){ +function popUpCreateVMDialog(include_select_image){ + setupCreateVMDialog(include_select_image); $create_vm_dialog.reveal(); } @@ -2970,41 +3241,43 @@ function vmMonitorError(req,error_json){ $(document).ready(function(){ var tab_name = 'vms-tab'; - dataTable_vMachines = $("#datatable_vmachines",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check",6,7,9,11] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_vMachines = $("#datatable_vmachines",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check",6,7,9,11] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#vms_search').keyup(function(){ - dataTable_vMachines.fnFilter( $(this).val() ); - }) + $('#vms_search').keyup(function(){ + dataTable_vMachines.fnFilter( $(this).val() ); + }) - dataTable_vMachines.on('draw', function(){ - recountCheckboxes(dataTable_vMachines); - }) + dataTable_vMachines.on('draw', function(){ + recountCheckboxes(dataTable_vMachines); + }) - //addElement([ - // spinner, - // '','','','','','','','','','',''],dataTable_vMachines); - Sunstone.runAction("VM.list"); + //addElement([ + // spinner, + // '','','','','','','','','','',''],dataTable_vMachines); + Sunstone.runAction("VM.list"); - setupCreateVMDialog(); - setVMAutorefresh(); - setupVNC(); - hotpluggingOps(); - setup_vm_network_tab(); - setup_vm_capacity_tab(); - setup_vm_snapshot_tab(); + //setupCreateVMDialog(); + setVMAutorefresh(); + setupVNC(); + hotpluggingOps(); + setup_vm_network_tab(); + setup_vm_capacity_tab(); + setup_vm_snapshot_tab(); - initCheckAllBoxes(dataTable_vMachines); - tableCheckboxesListener(dataTable_vMachines); - infoListener(dataTable_vMachines,'VM.showinfo'); + initCheckAllBoxes(dataTable_vMachines); + tableCheckboxesListener(dataTable_vMachines); + infoListener(dataTable_vMachines,'VM.showinfo'); - $('div#vms_tab div.legend_div').hide(); + $('div#vms_tab div.legend_div').hide(); + } }) diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index e33a8a29f0..2c673bdbfd 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -1563,38 +1563,40 @@ function setVNetAutorefresh() { $(document).ready(function(){ var tab_name = 'vnets-tab'; - dataTable_vNetworks = $("#datatable_vnetworks",main_tabs_context).dataTable({ - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "35px", "aTargets": [0] }, - { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, - { "bVisible": false, "aTargets": ['_all']} - ] - }); + if (Config.isTabEnabled(tab_name)) { + dataTable_vNetworks = $("#datatable_vnetworks",main_tabs_context).dataTable({ + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "35px", "aTargets": [0] }, + { "bVisible": true, "aTargets": Config.tabTableColumns(tab_name)}, + { "bVisible": false, "aTargets": ['_all']} + ] + }); - $('#vnet_search').keyup(function(){ - dataTable_vNetworks.fnFilter( $(this).val() ); - }) + $('#vnet_search').keyup(function(){ + dataTable_vNetworks.fnFilter( $(this).val() ); + }) - dataTable_vNetworks.on('draw', function(){ - recountCheckboxes(dataTable_vNetworks); - }) + dataTable_vNetworks.on('draw', function(){ + recountCheckboxes(dataTable_vNetworks); + }) - Sunstone.runAction("Network.list"); + Sunstone.runAction("Network.list"); - setupCreateVNetDialog(); - setupLeasesOps(); - setVNetAutorefresh(); + setupCreateVNetDialog(); + setupLeasesOps(); + setVNetAutorefresh(); - initCheckAllBoxes(dataTable_vNetworks); - tableCheckboxesListener(dataTable_vNetworks); - infoListener(dataTable_vNetworks,'Network.showinfo'); + initCheckAllBoxes(dataTable_vNetworks); + tableCheckboxesListener(dataTable_vNetworks); + infoListener(dataTable_vNetworks,'Network.showinfo'); - // Reset list filter in case it was set because we were lookin - // at a single cluster view - $('div#menu li#li_vnets_tab').live('click',function(){ - dataTable_vNetworks.fnFilter('',5); - }); + // Reset list filter in case it was set because we were lookin + // at a single cluster view + $('div#menu li#li_vnets_tab').live('click',function(){ + dataTable_vNetworks.fnFilter('',5); + }); - $('div#vnets_tab div.legend_div').hide(); + $('div#vnets_tab div.legend_div').hide(); + } }); diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 127c7ae4ab..b2513403ea 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -64,10 +64,12 @@ var Sunstone = { //Adds a new main tab. Refreshes the dom if wanted. "addMainTab" : function(tab_id,tab_obj,refresh) { - SunstoneCfg["tabs"][tab_id] = tab_obj; - if (refresh){ - insertTab(tab_id); - //$(document).foundationCustomForms(); + if (Config.isTabEnabled(tab_id)) { + SunstoneCfg["tabs"][tab_id] = tab_obj; + if (refresh){ + insertTab(tab_id); + //$(document).foundationCustomForms(); + } } }, @@ -548,21 +550,16 @@ function insertTab(tab_name){ var li_item = '
  • '+tab_info.title+'
  • '; + $('div#menu ul#navigation').append(li_item); + //if this is a submenu... if (parent.length) { - var children = $('div#menu ul#navigation li.'+parent); + var children = $('div#menu ul#navigation #li_'+parent); //if there are other submenus, insert after last of them - if (children.length) - $(children[children.length-1]).after(li_item); - else //instert after parent menu - $('div#menu ul#navigation li#li_'+parent).after(li_item); - } else { //not a submenu, instert in the end - $('div#menu ul#navigation').append(li_item); - }; - - if (parent){ //this is a subtab - $('div#menu li#li_'+tab_name).hide();//hide by default - $('div#menu li#li_'+parent+' span').css("display","inline-block"); + if (children.length) { + $('div#menu li#li_'+tab_name).hide();//hide by default + $('div#menu li#li_'+parent+' span').css("display","inline-block"); + } }; if (showOnTop){ diff --git a/src/sunstone/public/sass/app.scss b/src/sunstone/public/sass/app.scss index 0cbf858bf0..dfcd5860e3 100644 --- a/src/sunstone/public/sass/app.scss +++ b/src/sunstone/public/sass/app.scss @@ -610,6 +610,7 @@ ul.button-group { .value_td { text-overflow:ellipsis; + word-break: break-all; } small { diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index 8609adb2f3..7c04d305ee 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -64,7 +64,7 @@ - <%- view['enabled_tabs'].each do |tab_name| -%> + <%- $views_config.available_tabs.each do |tab_name| -%> <%- end -%>