Right.
Ian,
You are trying to call different dialog boxes.
I suggest you call the same dialog box, but show/hide different fields in the
same dialog box depending on the count number of listView.
Like this:
=================================================================================================
add: {
label: 'Add Account',
messages: {
notification:
function(args) {
return 'Add Account';
}
},
createForm: {
title: 'Add Account',
preFilter:
function(args) {
//if
count number in listView is less than 1, hide field A/C/E, show field B/D.
//otherwise, show field A/C/E, hide field B/D.
},
fields: {
A: { label: 'A' },
B: { label: 'B' },
C: { label: 'C' },
D: { label: 'D' },
E: { label: 'E' }
}
action:
function(args) {
~~~
},
notification: {
~~~
}
}
}
From: Pranav Saxena [mailto:[email protected]]
Sent: Thursday, July 25, 2013 10:59 AM
To: [email protected]; Jessica Wang; Brian Federle
Subject: Re: Switch dialog actions based on result from API call.
Unless and until the dialog box is the same and it's just about adding/removing
more fields from the dialog box , it should be pretty much possible by adding
"preFilters" and then using the count returned by that API to hide/remove those
fields under the preFilter sections. Basically a if/else check under the
preFilters block.
If it's about triggering a new dialog box all together , then it might require
you to do little more work . This might not be supported by the widget right
now as Jessica pointed out.
Thanks,
Pranav
On Thu, Jul 25, 2013 at 11:23 PM, Jessica Wang
<[email protected]<mailto:[email protected]>> wrote:
Ian,
I don't think current widget code support it (that calls different dialogs for
Add action depending on count number in listView).
Brian,
Please confirm it.
Jessica
-----Original Message-----
From: Ian Duffy [mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, July 25, 2013 7:36 AM
To: CloudStack Dev
Subject: Switch dialog actions based on result from API call.
Hi,
How would I go about modifying the UI to allow me to change the "Add
Account" screen to:
1) When listLdapConfigurations returns a count of less than 1 the
default cloudstack add account screen is given.
2) When listLdapConfigurations returns a count of greater than one my
custom LDAP add account screen is given.
What I have so far can be seen at:
https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/accounts.js;h=e3e28e47a305bb53151a6e7c749cad355b872736;hb=ldapplugin
Thanks,
Ian