From d80688ddce08869c84eaf27151ea34459bb835a5 Mon Sep 17 00:00:00 2001 From: bfederle Date: Mon, 30 Apr 2012 10:32:43 -0700 Subject: [PATCH] CS-14461: Add more infrastructure page shortcuts -Add additional shortcuts for: -Primary storage -Secondary storgage -Virtual routers -System VMs -Replace host stats with the new shortcuts -Add 'zone' dropdown to create form for the newly added-shortcuts' sections, to support creating these items without a zone context Conflicts: ui/index.jsp --- .../classes/resources/messages.properties | 6 +- ui/css/cloudstack3.css | 21 +- ui/images/bg-gradients.png | Bin 6326 -> 8322 bytes ui/index.jsp | 83 +- ui/scripts/system.js | 1119 ++++++++++++++++- ui/scripts/ui-custom/physicalResources.js | 2 +- 6 files changed, 1167 insertions(+), 64 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index c60f5a79777..00090fa0d81 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -1,5 +1,9 @@ #new labels (begin) ********************************************************************************************** -label.action.register.template=Register template +label.virtual.routers=Virtual Routers +label.primary.storage.count=Primary Storage Pools +label.secondary.storage.count=Secondary Storage Pools +label.number.of.system.vms=Number of System VMs +label.number.of.virtual.routers=Number of Virtual Routers label.action.register.iso=Register ISO label.isolation.method=Isolation method #new labels (end) ************************************************************************************************ diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index 40246a0c1a7..2a42d471136 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -3472,7 +3472,7 @@ Dialogs*/ margin: 6px 9px 9px; padding: 9px; color: #FFFFFF; - /* Adjusting the font size for proper display */ +/*Adjusting the font size for proper display*/ font-size: 10px; border-left: 1px solid #6A6A6A; border-right: 1px solid #6A6A6A; @@ -5966,7 +5966,7 @@ label.error { width: 59px; height: 23px; padding: 2px 9px 0 12px; - background: url(../images/bg-gradients.png) 0px 53px; + background: url(../images/bg-gradients.png) 0px -1342px; border: 1px solid #C4C4C4; /*+border-radius:4px;*/ -moz-border-radius: 4px; @@ -7248,6 +7248,12 @@ div.panel.ui-dialog div.list-view div.fixed-header { font-weight: bold; } +.system-dashboard.zone { + height: 609px; + background-position: 0px -1423px; + background-color: #FFFFFF; +} + .system-dashboard-view .toolbar { position: relative; } @@ -7346,6 +7352,13 @@ div.panel.ui-dialog div.list-view div.fixed-header { float: left; } +.system-dashboard.zone .status_box li { + margin-bottom: 120px; + height: 176px; + background-position: 0px -1005px; + background-color: #35404B; +} + .system-dashboard .status_box li span { color: #FFFFFF; /*+text-shadow:0px 1px 1px #000000;*/ @@ -7387,6 +7400,10 @@ div.panel.ui-dialog div.list-view div.fixed-header { text-shadow: 0px 1px 2px #000000; } +.system-dashboard.zone .status_box li span.header { + font-size: 13px; +} + .system-dashboard .status_box li span.status { font-size: 27px; /*+placement:shift 13px 141px;*/ diff --git a/ui/images/bg-gradients.png b/ui/images/bg-gradients.png index a3851a8781c31e0172878946e6959644effcfc6f..2ef74540bbf8aa6c7001afa9575456b65552db1f 100644 GIT binary patch delta 5637 zcmb_gYgAL$wkA9zQG{*b6k0_S!1y3&5#LCO0ZR}NAwHTaAQ%Lt!jVBlMA<=u#5xLr zYEV#Ysfe*!Ftt*nz?DXgMzkO`2PATeP&EZC_y7U%&b6~6K|99%a|eUL+R0vP&GpUi z`{rC+@Z7Uh`r$a5iaN&3%xq}WmCffE#bfb*oelI~x@t#rr!Mrs)V0pn|KL@+Ut@ER z4uw&VNEUy<-7w#UN^$&2_{ZXh%m2;jRy3sk_gdEUYFfa0tCWuxGY*`Y^NC>0`dcn} zH@IGVe?4_>@WJWM(xfW~g+)&nz1S7W@fo^Ze!J_wPWMB>?A&FZFSM;0_jz3Ni^&~d zm0^w7a93)PG}>uNmYa0j`Ma4^iL;A+3`f8TmWUQA1jHa%LYsgE$cR4_iVOYF-j>U0 zcX`y)6Tjx(6Mq>R>XY^Du1alq0gY196tHHSAgc?z^FMi0llV-3rb?_%DAz_F!R%e& zr){!JfXp=reJb9e$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cvY$Ud33hAf!D-PVK&&CMNz_gNZk;GF)4yFBYSCGsOKW_ zu+7znE#x?)`YBoI@weLlBHyrt3@Oeq>UZUQ*ZSF*(6jf)7=QIx z2`#K^i;U-JmC8)|#DXNw*csk}5Yx+ok9pShIu-VuR|vRa8u3${Q{zZUFxA-3jyPWO z4swd~^trg9mHVvw=hp+os)n06G{xy1ONJBU*$9--Jhv%{CXG4zn3?G;oN!>mQ~W9J z>!h8wgAlFu>y-voh@Q(;t!mz@YLI z4&#$LN`!SQykj{?;CNQgGwwSKtRL|k-|g4GrEPm#g;1UdNb%GIi#zQ$!m0Vm7w#BwpN{lgb~&R(o)(MP1hV2bXjhisYlgj)WY0T8Qif`)iN02OwMP!jI1XZf5$6pBulvyOpwZg*^ z=v#ev6wrIFe2v1iYsHuF+luy*X=sCOlRAy6D!u!~bmIn_A@_Z`INgOqrf?Y-Ai|n* zD;z3NwKFN|3j=orU(& z_)eGuYc*z6Rr>kkxHT9^ac8Cj=PFuWZzEc4g#ylH>yv3lW;(UKxkfk6K*f+J=u^iN zbBOEpONiQOMq`1ZeIhge=D`FJruFa4s!xN6mzA#ip~5{@oX!(N2La_>xJi8+=3JP~ z#`sd@xzfqdRW_gT%TM3*Sx1zI&r3A3Wj7u}6 zjFDYM&Ff~;!$Y6gU$-p@rkJ9ltZ#cy{Sl`%ym?aSQ$wCYI$BmNJ1hcpLx-erazw4! zjy>dg=q6P_5w0(~*7(VwR=a#!QJGM%PIr`7*eqB2ir3A#EBNT-dyS6b{(o$0Z2GgC z5Br0dH~8d4C$>Hrza)eH)O&Fbi1YRBo22$sW~Eg^T4o_B`wd~JA)HZ9W<4lqP@qN9 zhxJM>iJaIeZ#4SUANnLj<)?QJHJyEY%zCBLIsw>3`2$umr2?jDl(e$n5%38> -
+
- -
+ +
  • - + - + " + view-all-target="zones">
  • - + - + " + view-all-target="pods">
  • - + - + " + view-all-target="clusters">
  • - + - + " + view-all-target="hosts">
  • -
-
- - -
-
- -
-
-
  • - - + + + " + view-all-target="primaryStorage">
  • -
  • - - +
  • + + + " + view-all-target="secondaryStorage">
  • -
  • - - -
  • -
  • - - +
  • + + + " + view-all-target="systemVms">
  • +
  • + + + " + view-all-target="virtualRouters"> +
@@ -1666,6 +1678,11 @@ dictionary = { 'message.edit.traffic.type': '', 'label.label': '', 'message.configure.all.traffic.types': '', +'label.virtual.routers': '', +'label.primary.storage.count': '', +'label.secondary.storage.count': '', +'label.number.of.system.vms': '', +'label.number.of.virtual.routers': '', 'label.max.networks': '', 'label.latest.events': '', 'state.Enabled': '', diff --git a/ui/scripts/system.js b/ui/scripts/system.js index f3b54ff0bca..f355059daa4 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -202,7 +202,7 @@ type: 'routing' }, success: function(json) { - dataFns.capacity($.extend(data, { + dataFns.primaryStorageCount($.extend(data, { hostCount: json.listhostsresponse.count ? json.listhostsresponse.count : 0 })); @@ -210,6 +210,60 @@ }); }, + primaryStorageCount: function(data) { + $.ajax({ + url: createURL('listStoragePools'), + success: function(json) { + dataFns.secondaryStorageCount($.extend(data, { + primaryStorageCount: json.liststoragepoolsresponse.count ? + json.liststoragepoolsresponse.count : 0 + })); + } + }); + }, + + secondaryStorageCount: function(data) { + $.ajax({ + url: createURL('listHosts'), + data: { + type: 'SecondaryStorage' + }, + success: function(json) { + dataFns.systemVmCount($.extend(data, { + secondaryStorageCount: json.listhostsresponse.count ? + json.listhostsresponse.count : 0 + })); + } + }); + }, + + systemVmCount: function(data) { + $.ajax({ + url: createURL('listSystemVms'), + success: function(json) { + dataFns.virtualRouterCount($.extend(data, { + systemVmCount: json.listsystemvmsresponse.count ? + json.listsystemvmsresponse.count : 0 + })); + } + }); + }, + + virtualRouterCount: function(data) { + $.ajax({ + url: createURL('listRouters'), + data: { + listAll: true + }, + success: function(json) { + dataFns.capacity($.extend(data, { + virtualRouterCount: json.listroutersresponse.count ? + json.listroutersresponse.count : 0 + })); + } + }); + }, + capacity: function(data) { if (data.zoneCount) { $.ajax({ @@ -880,7 +934,7 @@ action: function(args) { var array1 = []; array1.push("&podid=" + args.data.podid); - array1.push("&networkid=" + selectedGuestNetworkObj.id) + array1.push("&networkid=" + selectedGuestNetworkObj.id); array1.push("&gateway=" + args.data.gateway); array1.push("&netmask=" + args.data.netmask); array1.push("&startip=" + args.data.startip); @@ -1836,7 +1890,7 @@ state: { label: 'label.state' }, physicalnetworkid: { label: 'label.physical.network.ID' }, destinationphysicalnetworkid: { label: 'label.destination.physical.network.id' }, - supportedServices: { label: 'label.supported.services' }, + supportedServices: { label: 'label.supported.services' } } ], dataProvider: function(args) { @@ -3854,18 +3908,18 @@ activeviewersessions: { label: 'label.active.sessions' } } ], - dataProvider: function(args) { - $.ajax({ - url: createURL("listSystemVms&id=" + args.context.systemVMs[0].id), - dataType: "json", - async: true, - success: function(json) { - args.response.success({ - actionFilter: systemvmActionfilter, - data: json.listsystemvmsresponse.systemvm[0] - }); - } - }); + dataProvider: function(args) { + $.ajax({ + url: createURL("listSystemVms&id=" + args.context.systemVMs[0].id), + dataType: "json", + async: true, + success: function(json) { + args.response.success({ + actionFilter: systemvmActionfilter, + data: json.listsystemvmsresponse.systemvm[0] + }); + } + }); } } } @@ -3878,9 +3932,12 @@ pods: function() { var listView = $.extend(true, {}, cloudStack.sections.system.subsections.pods.listView, { dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + $.ajax({ - url: createURL('listPods'), - data: { listAll: true }, + url: createURL('listPods' + searchByArgs), + data: { page: args.page, pageSize: pageSize, listAll: true }, success: function (json) { args.response.success({ data: json.listpodsresponse.pod }); }, @@ -3917,9 +3974,12 @@ clusters: function() { var listView = $.extend(true, {}, cloudStack.sections.system.subsections.clusters.listView, { dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + $.ajax({ - url: createURL('listClusters'), - data: { listAll: true }, + url: createURL('listClusters' + searchByArgs), + data: { page: args.page, pageSize: pageSize, listAll: true }, success: function (json) { args.response.success({ data: json.listclustersresponse.cluster }); }, @@ -3956,9 +4016,12 @@ hosts: function() { var listView = $.extend(true, {}, cloudStack.sections.system.subsections.hosts.listView, { dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + $.ajax({ - url: createURL('listHosts'), - data: { type: 'routing', listAll: true }, + url: createURL('listHosts' + searchByArgs), + data: { page: args.page, pageSize: pageSize, type: 'routing', listAll: true }, success: function (json) { args.response.success({ data: json.listhostsresponse.host }); }, @@ -3990,6 +4053,174 @@ } }); + return listView; + }, + primaryStorage: function() { + var listView = $.extend(true, {}, cloudStack.sections.system.subsections['primary-storage'].listView, { + dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + + $.ajax({ + url: createURL('listStoragePools' + searchByArgs), + data: { page: args.page, pageSize: pageSize, listAll: true }, + success: function (json) { + args.response.success({ data: json.liststoragepoolsresponse.storagepool }); + }, + error: function (json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + }, + + detailView: { + updateContext: function (args) { + var zone; + + $.ajax({ + url: createURL('listZones'), + data: { id: args.context.primarystorages[0].zoneid }, + async: false, + success: function (json) { + zone = json.listzonesresponse.zone[0]; + } + }); + + selectedZoneObj = zone; + + return { + zones: [zone] + }; + } + } + }); + + return listView; + }, + secondaryStorage: function() { + var listView = $.extend(true, {}, cloudStack.sections.system.subsections['secondary-storage'].listView, { + dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + + $.ajax({ + url: createURL('listHosts' + searchByArgs), + data: { type: 'SecondaryStorage', page: args.page, pageSize: pageSize, listAll: true }, + success: function (json) { + args.response.success({ data: json.listhostsresponse.host }); + }, + error: function (json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + }, + + detailView: { + updateContext: function (args) { + var zone; + + $.ajax({ + url: createURL('listZones'), + data: { id: args.context.secondarystorages[0].zoneid }, + async: false, + success: function (json) { + zone = json.listzonesresponse.zone[0]; + } + }); + + selectedZoneObj = zone; + + return { + zones: [zone] + }; + } + } + }); + + return listView; + }, + systemVms: function() { + var listView = $.extend(true, {}, cloudStack.sections.system.subsections.systemVms.listView, { + dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + + $.ajax({ + url: createURL('listSystemVms' + searchByArgs), + data: { page: args.page, pageSize: pageSize, listAll: true }, + success: function (json) { + args.response.success({ data: json.listsystemvmsresponse.systemvm }); + }, + error: function (json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + }, + + detailView: { + updateContext: function (args) { + var zone; + + $.ajax({ + url: createURL('listZones'), + data: { id: args.context.systemVMs[0].zoneid }, + async: false, + success: function (json) { + zone = json.listzonesresponse.zone[0]; + } + }); + + selectedZoneObj = zone; + + return { + zones: [zone] + }; + } + } + }); + + return listView; + }, + virtualRouters: function() { + var listView = $.extend(true, {}, cloudStack.sections.system.subsections.virtualRouters.listView, { + dataProvider: function (args) { + var searchByArgs = args.filterBy.search.value.length ? + '&name=' + args.filterBy.search.value : ''; + + $.ajax({ + url: createURL('listRouters' + searchByArgs), + data: { page: args.page, pageSize: pageSize, listAll: true }, + success: function (json) { + args.response.success({ data: json.listroutersresponse.router }); + }, + error: function (json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + }, + + detailView: { + updateContext: function (args) { + var zone; + + $.ajax({ + url: createURL('listZones'), + data: { id: args.context.routers[0].zoneid }, + async: false, + success: function (json) { + zone = json.listzonesresponse.zone[0]; + } + }); + + selectedZoneObj = zone; + + return { + zones: [zone] + }; + } + } + }); + return listView; } } @@ -3997,7 +4228,791 @@ } }), subsections: { - // netscaler devices listView + virtualRouters: { + listView: { + label: 'label.virtual.appliances', + id: 'routers', + fields: { + name: { label: 'label.name' }, + zonename: { label: 'label.zone' }, + state: { + converter: function(str) { + // For localization + return str; + }, + label: 'label.status', + indicator: { + 'Running': 'on', + 'Stopped': 'off', + 'Error': 'off' + } + } + }, + dataProvider: function(args) { + var array1 = []; + if(args.filterBy != null) { + if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { + switch(args.filterBy.search.by) { + case "name": + if(args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; + } + } + } + + $.ajax({ + url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), + dataType: 'json', + async: true, + success: function(json) { + var items = json.listroutersresponse.router; + args.response.success({ + actionFilter: routerActionfilter, + data: items + }); + } + }); + + // Get project routers + $.ajax({ + url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), + dataType: 'json', + async: true, + success: function(json) { + var items = json.listroutersresponse.router; + args.response.success({ + actionFilter: routerActionfilter, + data: items + }); + } + }); + }, + detailView: { + name: 'Virtual applicance details', + actions: { + start: { + label: 'label.action.start.router', + messages: { + confirm: function(args) { + return 'message.action.start.router'; + }, + notification: function(args) { + return 'label.action.start.router'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('startRouter&id=' + args.context.routers[0].id), + dataType: 'json', + async: true, + success: function(json) { + var jid = json.startrouterresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.domainrouter; + }, + getActionFilter: function() { + return routerActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + stop: { + label: 'label.action.stop.router', + createForm: { + title: 'label.action.stop.router', + desc: 'message.action.stop.router', + fields: { + forced: { + label: 'force.stop', + isBoolean: true, + isChecked: false + } + } + }, + messages: { + notification: function(args) { + return 'label.action.stop.router'; + } + }, + action: function(args) { + var array1 = []; + array1.push("&forced=" + (args.data.forced == "on")); + $.ajax({ + url: createURL('stopRouter&id=' + args.context.routers[0].id + array1.join("")), + dataType: 'json', + async: true, + success: function(json) { + var jid = json.stoprouterresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.domainrouter; + }, + getActionFilter: function() { + return routerActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + 'remove': { + label: 'label.destroy.router', + messages: { + confirm: function(args) { + return 'message.confirm.destroy.router'; + }, + notification: function(args) { + return 'label.destroy.router'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("destroyRouter&id=" + args.context.routers[0].id), + dataType: "json", + async: true, + success: function(json) { + var jid = json.destroyrouterresponse.jobid; + args.response.success({ + _custom: { + jobId: jid + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + /* + changeService: { + label: 'label.change.service.offering', + createForm: { + title: 'label.change.service.offering', + desc: '', + fields: { + serviceOfferingId: { + label: 'label.compute.offering', + select: function(args) { + $.ajax({ + url: createURL("listServiceOfferings&issystem=true&systemvmtype=domainrouter"), + dataType: "json", + async: true, + success: function(json) { + var serviceofferings = json.listserviceofferingsresponse.serviceoffering; + var items = []; + $(serviceofferings).each(function() { + if(this.id != args.context.routers[0].serviceofferingid) { + items.push({id: this.id, description: this.displaytext}); + } + }); + args.response.success({data: items}); + } + }); + } + } + } + }, + messages: { + notification: function(args) { + return 'label.change.service.offering'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("changeServiceForRouter&id=" + args.context.routers[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), + dataType: "json", + async: true, + success: function(json) { + var jsonObj = json.changeserviceforrouterresponse.domainrouter; + args.response.success({data: jsonObj}); + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + args.response.error(errorMsg); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } + }, + */ + + migrate: { + label: 'label.action.migrate.router', + createForm: { + title: 'label.action.migrate.router', + desc: '', + fields: { + hostId: { + label: 'label.host', + validation: { required: true }, + select: function(args) { + $.ajax({ + url: createURL("listHosts&VirtualMachineId=" + args.context.routers[0].id), + //url: createURL("listHosts"), //for testing only, comment it out before checking in. + dataType: "json", + async: true, + success: function(json) { + var hostObjs = json.listhostsresponse.host; + var items = []; + $(hostObjs).each(function() { + items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); + }); + args.response.success({data: items}); + } + }); + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + args.response.error(errorMsg); + } + } + } + }, + messages: { + notification: function(args) { + return 'label.action.migrate.router'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.routers[0].id), + dataType: "json", + async: true, + success: function(json) { + var jid = json.migratesystemvmresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance + $.ajax({ + url: createURL("listRouters&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), + dataType: "json", + async: false, + success: function(json) { + var items = json.listroutersresponse.router; + if(items != null && items.length > 0) { + return items[0]; + } + } + }); + }, + getActionFilter: function() { + return routerActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + viewConsole: { + label: 'label.view.console', + action: { + externalLink: { + url: function(args) { + return clientConsoleUrl + '?cmd=access&vm=' + args.context.routers[0].id; + }, + title: function(args) { + return args.context.routers[0].id.substr(0,8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + }, + width: 820, + height: 640 + } + } + } + }, + tabs: { + details: { + title: 'label.details', + preFilter: function(args) { + var hiddenFields = []; + if (!args.context.routers[0].project) { + hiddenFields.push('project'); + hiddenFields.push('projectid'); + } + if(selectedZoneObj.networktype == 'Basic') { + hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. + } + return hiddenFields; + }, + fields: [ + { + name: { label: 'label.name' }, + project: { label: 'label.project' } + }, + { + id: { label: 'label.id' }, + projectid: { label: 'label.project.id' }, + state: { label: 'label.state' }, + publicip: { label: 'label.public.ip' }, + guestipaddress: { label: 'label.guest.ip' }, + linklocalip: { label: 'label.linklocal.ip' }, + hostname: { label: 'label.host' }, + serviceofferingname: { label: 'label.compute.offering' }, + networkdomain: { label: 'label.network.domain' }, + domain: { label: 'label.domain' }, + account: { label: 'label.account' }, + created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }, + isredundantrouter: { + label: 'label.redundant.router', + converter: cloudStack.converters.toBooleanText + }, + redundantRouterState: { label: 'label.redundant.state' } + } + ], + dataProvider: function(args) { + $.ajax({ + url: createURL("listRouters&id=" + args.context.routers[0].id), + dataType: 'json', + async: true, + success: function(json) { + var jsonObj = json.listroutersresponse.router[0]; + addExtraPropertiesToRouterInstanceObject(jsonObj); + args.response.success({ + actionFilter: routerActionfilter, + data: jsonObj + }); + } + }); + } + } + } + } + } + }, + systemVms: { + listView: { + label: 'label.system.vms', + id: 'systemVMs', + fields: { + name: { label: 'label.name' }, + systemvmtype: { + label: 'label.type', + converter: function(args) { + if(args == "consoleproxy") + return "Console Proxy VM"; + else if(args == "secondarystoragevm") + return "Secondary Storage VM"; + else + return args; + } + }, + zonename: { label: 'label.zone' }, + state: { + label: 'label.status', + converter: function(str) { + // For localization + return str; + }, + indicator: { + 'Running': 'on', + 'Stopped': 'off', + 'Error': 'off', + 'Destroyed': 'off' + } + } + }, + dataProvider: function(args) { + var array1 = []; + if(args.filterBy != null) { + if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { + switch(args.filterBy.search.by) { + case "name": + if(args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; + } + } + } + + var selectedZoneObj = args.context.physicalResources[0]; + $.ajax({ + url: createURL("listSystemVms&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), + dataType: "json", + async: true, + success: function(json) { + var items = json.listsystemvmsresponse.systemvm; + args.response.success({ + actionFilter: systemvmActionfilter, + data: items + }); + } + }); + }, + + detailView: { + name: 'System VM details', + actions: { + start: { + label: 'label.action.start.systemvm', + messages: { + confirm: function(args) { + return 'message.action.start.systemvm'; + }, + notification: function(args) { + return 'label.action.start.systemvm'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('startSystemVm&id=' + args.context.systemVMs[0].id), + dataType: 'json', + async: true, + success: function(json) { + var jid = json.startsystemvmresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.systemvm; + }, + getActionFilter: function() { + return systemvmActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + stop: { + label: 'label.action.stop.systemvm', + messages: { + confirm: function(args) { + return 'message.action.stop.systemvm'; + }, + notification: function(args) { + return 'label.action.stop.systemvm'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('stopSystemVm&id=' + args.context.systemVMs[0].id), + dataType: 'json', + async: true, + success: function(json) { + var jid = json.stopsystemvmresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.systemvm; + }, + getActionFilter: function() { + return systemvmActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + restart: { + label: 'label.action.reboot.systemvm', + messages: { + confirm: function(args) { + return 'message.action.reboot.systemvm'; + }, + notification: function(args) { + return 'label.action.reboot.systemvm'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('rebootSystemVm&id=' + args.context.systemVMs[0].id), + dataType: 'json', + async: true, + success: function(json) { + var jid = json.rebootsystemvmresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.systemvm; + }, + getActionFilter: function() { + return systemvmActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + changeService: { + label: 'label.change.service.offering', + createForm: { + title: 'label.change.service.offering', + desc: '', + fields: { + serviceOfferingId: { + label: 'label.compute.offering', + select: function(args) { + var apiCmd = "listServiceOfferings&issystem=true"; + if(args.context.systemVMs[0].systemvmtype == "secondarystoragevm") + apiCmd += "&systemvmtype=secondarystoragevm"; + else if(args.context.systemVMs[0].systemvmtype == "consoleproxy") + apiCmd += "&systemvmtype=consoleproxy"; + $.ajax({ + url: createURL(apiCmd), + dataType: "json", + async: true, + success: function(json) { + var serviceofferings = json.listserviceofferingsresponse.serviceoffering; + var items = []; + $(serviceofferings).each(function() { + if(this.id != args.context.systemVMs[0].serviceofferingid) { + items.push({id: this.id, description: this.displaytext}); + } + }); + args.response.success({data: items}); + } + }); + } + } + } + }, + messages: { + notification: function(args) { + return 'label.change.service.offering'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("changeServiceForSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), + dataType: "json", + async: true, + success: function(json) { + var jsonObj = json.changeserviceforsystemvmresponse.systemvm; + args.response.success({data: jsonObj}); + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + args.response.error(errorMsg); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } + }, + + remove: { + label: 'label.action.destroy.systemvm', + messages: { + confirm: function(args) { + return 'message.action.destroy.systemvm'; + }, + notification: function(args) { + return 'label.action.destroy.systemvm'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('destroySystemVm&id=' + args.context.systemVMs[0].id), + dataType: 'json', + async: true, + success: function(json) { + var jid = json.destroysystemvmresponse.jobid; + args.response.success({ + _custom: { + getUpdatedItem: function() { + return { state: 'Destroyed' }; + }, + jobId: jid + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + migrate: { + label: 'label.action.migrate.systemvm', + messages: { + notification: function(args) { + return 'label.action.migrate.systemvm'; + } + }, + createForm: { + title: 'label.action.migrate.systemvm', + desc: '', + fields: { + hostId: { + label: 'label.host', + validation: { required: true }, + select: function(args) { + $.ajax({ + url: createURL("listHosts&VirtualMachineId=" + args.context.systemVMs[0].id), + //url: createURL("listHosts"), //for testing only, comment it out before checking in. + dataType: "json", + async: true, + success: function(json) { + var hostObjs = json.listhostsresponse.host; + var items = []; + $(hostObjs).each(function() { + items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); + }); + args.response.success({data: items}); + } + }); + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + args.response.error(errorMsg); + } + } + } + }, + action: function(args) { + $.ajax({ + url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.systemVMs[0].id), + dataType: "json", + async: true, + success: function(json) { + var jid = json.migratesystemvmresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance + $.ajax({ + url: createURL("listSystemVms&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), + dataType: "json", + async: false, + success: function(json) { + var items = json.listsystemvmsresponse.systemvm; + if(items != null && items.length > 0) { + return items[0]; + } + } + }); + }, + getActionFilter: function() { + return systemvmActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + + viewConsole: { + label: 'label.view.console', + action: { + externalLink: { + url: function(args) { + return clientConsoleUrl + '?cmd=access&vm=' + args.context.systemVMs[0].id; + }, + title: function(args) { + return args.context.systemVMs[0].id.substr(0,8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + }, + width: 820, + height: 640 + } + } + } + }, + tabs: { + details: { + title: 'label.details', + fields: [ + { + name: { label: 'label.name' } + }, + { + id: { label: 'label.id' }, + state: { label: 'label.state' }, + systemvmtype: { + label: 'label.type', + converter: function(args) { + if(args == "consoleproxy") + return "Console Proxy VM"; + else if(args == "secondarystoragevm") + return "Secondary Storage VM"; + else + return args; + } + }, + zonename: { label: 'label.zone' }, + publicip: { label: 'label.public.ip' }, + privateip: { label: 'label.private.ip' }, + linklocalip: { label: 'label.linklocal.ip' }, + hostname: { label: 'label.host' }, + gateway: { label: 'label.gateway' }, + created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }, + activeviewersessions: { label: 'label.active.sessions' } + } + ], + dataProvider: function(args) { + $.ajax({ + url: createURL("listSystemVms&id=" + args.context.systemVMs[0].id), + dataType: "json", + async: true, + success: function(json) { + args.response.success({ + actionFilter: systemvmActionfilter, + data: json.listsystemvmsresponse.systemvm[0] + }); + } + }); + } + } + } + } + } + }, + // netscaler devices listView netscalerDevices: { id: 'netscalerDevices', title: 'label.devices', @@ -6129,13 +7144,38 @@ createForm: { title: 'label.add.primary.storage', fields: { - //always appear (begin) + zoneid: { + label: 'Zone', + validation: { required: true }, + select: function(args) { + var data = args.context.zones ? + { id: args.context.zones[0].id } : { listAll: true }; + + $.ajax({ + url: createURL('listZones'), + data: data, + success: function(json) { + var zones = json.listzonesresponse.zone; + + args.response.success({ + data: $.map(zones, function(zone) { + return { + id: zone.id, + description: zone.name + }; + }) + }); + } + }); + } + }, podId: { label: 'label.pod', + dependsOn: 'zoneid', validation: { required: true }, select: function(args) { $.ajax({ - url: createURL("listPods&zoneid=" + args.context.zones[0].id), + url: createURL("listPods&zoneid=" + args.zoneid), dataType: "json", async: true, success: function(json) { @@ -6460,7 +7500,7 @@ action: function(args) { var array1 = []; - array1.push("&zoneid=" + args.context.zones[0].id); + array1.push("&zoneid=" + args.data.zoneid); array1.push("&podId=" + args.data.podId); array1.push("&clusterid=" + args.data.clusterId); array1.push("&name=" + todb(args.data.name)); @@ -6810,6 +7850,31 @@ createForm: { title: 'label.add.secondary.storage', fields: { + zoneid: { + label: 'Zone', + validation: { required: true }, + select: function(args) { + var data = args.context.zones ? + { id: args.context.zones[0].id } : { listAll: true }; + + $.ajax({ + url: createURL('listZones'), + data: data, + success: function(json) { + var zones = json.listzonesresponse.zone; + + args.response.success({ + data: $.map(zones, function(zone) { + return { + id: zone.id, + description: zone.name + }; + }) + }); + } + }); + } + }, nfsServer: { label: 'label.nfs.server', validation: { required: true } @@ -6822,7 +7887,7 @@ }, action: function(args) { - var zoneId = args.context.zones[0].id; + var zoneId = args.data.zoneid; var nfs_server = args.data.nfsServer; var path = args.data.path; var url = nfsURL(nfs_server, path); @@ -7581,7 +8646,7 @@ }); } }); - } + }; //action filters (begin) var zoneActionfilter = function(args) { diff --git a/ui/scripts/ui-custom/physicalResources.js b/ui/scripts/ui-custom/physicalResources.js index 257843f838e..8acdec60188 100644 --- a/ui/scripts/ui-custom/physicalResources.js +++ b/ui/scripts/ui-custom/physicalResources.js @@ -41,7 +41,7 @@ if ($target.closest('[view-all-target]').size()) { var targetID = $target.closest('[view-all-target]').attr('view-all-target'); args.$browser.cloudBrowser('addPanel', { - title: targetID.charAt(0).toUpperCase() + targetID.substr(1).toLowerCase(), + title: $target.closest('[view-all-title]').attr('view-all-title'), data: '', noSelectPanel: true, maximizeIfSelected: true,