Well, I believe the way it works is maxiops is being passed to the converter function with the name args.
The code does work, but I was curious what would happen from a JavaScript standpoint if args was null. On Thu, Mar 6, 2014 at 12:34 AM, Punith S <punit...@cloudbyte.com> wrote: > the first block seems to be fine , but in the second block , (args > 0) > seems to be incorrect because args is an object right ? which inturn > contains the volume properties. > which can be accessed as args.volume.maxiops i guess. > > thanks > > > On Thu, Mar 6, 2014 at 12:52 PM, Mike Tutkowski < > mike.tutkow...@solidfire.com> wrote: > > > Hi, > > > > I'm not nearly as well versed in JavaScript as I am in Java. I was > > wondering if someone could answer these questions for me: > > > > If "memory" is stored in the DB as null, I assume args will be equal to > > undefined below. Is that correct? > > > > memory: { > > label: 'label.memory.mb', > > converter: function(args) { > > if (args == undefined) > > return ''; > > else > > return cloudStack.converters.convertBytes(args * 1024 * > 1024); > > } > > }, > > > > If "maxiops" is stored in the DB as null, will we simply return "N/A" or > is > > there a problem comparing what is essentially an undefined variable with > 0? > > > > maxiops: { > > label: 'label.disk.iops.max', > > converter: function(args) { > > if (args > 0) > > return args; > > else > > return "N/A"; > > } > > }, > > > > Thanks! > > > > -- > > *Mike Tutkowski* > > *Senior CloudStack Developer, SolidFire Inc.* > > e: mike.tutkow...@solidfire.com > > o: 303.746.7302 > > Advancing the way the world uses the > > cloud<http://solidfire.com/solution/overview/?video=play> > > *(tm)* > > > > > > -- > regards, > > punith s > cloudbyte.com > -- *Mike Tutkowski* *Senior CloudStack Developer, SolidFire Inc.* e: mike.tutkow...@solidfire.com o: 303.746.7302 Advancing the way the world uses the cloud<http://solidfire.com/solution/overview/?video=play> *(tm)*