You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Thomas O'Dowd <tp...@cloudian.com> on 2014/05/13 05:00:59 UTC

"Accounts" -> "Add Account" UI Question

When I delete an account, I get a notification. Should the same not work
for adding an account? I'm using 4.3.

I've never really played with javascript, jquery or ajax before but just
looking the the code in the debugger I'm wondering if the following is
not a problem. Maybe something obvious that I don't quite understand :-)

In accountsWizard.js
                    } else {
                        $.ajax({
                            url: createURL('createAccount' + array1.join("")),
                            dataType: "json",
                            async: false,
                            success: function(json) {
                                var item = json.createaccountresponse.account;
                                args.response.success({
                                    data: item
                                });
                            },
                            error: function(XMLHttpResponse) {
                                args.response.error(parseXMLHttpResponse(XMLHttpResponse));
                            }
                        });
                    }

The code calls the function "args.response.success()" but looking at the
debugger args.response has no "success" function. It has
args.response.error() though.

In ui-custom/accountsWizard.js
                                } else {    
                                    args.action({
                                        context: context,
                                        data: data,
                                        isLdap: isLdap,
                                        username: username,
                                        response: {
                                            error: function(message) {
                                                if (message) {
                                                    cloudStack.dialog.notice({
                                                        message: message
                                                    });
                                                }
                                            }
                                        }
                                    });
                                }

It doesn't setup a response.success... Only response.error.

However, I would have expected that the call to the missing function
would cause some kind of javascript error on the console but nothing is
logged.

Tom.
-- 
Cloudian KK - http://www.cloudian.com/get-started.html
Fancy 10TB of full featured S3 Storage?
Checkout the Cloudian® Community Edition!


RE: "Accounts" -> "Add Account" UI Question

Posted by Brian Federle <Br...@citrix.com>.
Yes, from looking at the code, the ui-custom/accountsWizard.js needs to also have a success function. Not sure why it was omitted.

A fix to add a notification could be:

response: {
  success: function() {
    $(window).trigger('cloudStack.addNotification', { ... });\
  }
}

Then add the correct options to trigger a notification. I don't remember the exact options for addNotification, but looking through the code you can find other examples as reference.

-Brian
________________________________
From: Ian Duffy [ian@ianduffy.ie]
Sent: Tuesday, May 13, 2014 2:11 PM
To: CloudStack Dev
Cc: Brian Federle; Jessica Wang; Stephen Turner
Subject: Re: "Accounts" -> "Add Account" UI Question

Hi Thomas,

Looks like a possible bug.

CCing the UI team. They may be able to offer more info.


On 13 May 2014 04:00, Thomas O'Dowd <tp...@cloudian.com>> wrote:
When I delete an account, I get a notification. Should the same not work
for adding an account? I'm using 4.3.

I've never really played with javascript, jquery or ajax before but just
looking the the code in the debugger I'm wondering if the following is
not a problem. Maybe something obvious that I don't quite understand :-)

In accountsWizard.js
                    } else {
                        $.ajax({
                            url: createURL('createAccount' + array1.join("")),
                            dataType: "json",
                            async: false,
                            success: function(json) {
                                var item = json.createaccountresponse.account;
                                args.response.success({
                                    data: item
                                });
                            },
                            error: function(XMLHttpResponse) {
                                args.response.error(parseXMLHttpResponse(XMLHttpResponse));
                            }
                        });
                    }

The code calls the function "args.response.success()" but looking at the
debugger args.response has no "success" function. It has
args.response.error() though.

In ui-custom/accountsWizard.js
                                } else {
                                    args.action({
                                        context: context,
                                        data: data,
                                        isLdap: isLdap,
                                        username: username,
                                        response: {
                                            error: function(message) {
                                                if (message) {
                                                    cloudStack.dialog.notice({
                                                        message: message
                                                    });
                                                }
                                            }
                                        }
                                    });
                                }

It doesn't setup a response.success... Only response.error.

However, I would have expected that the call to the missing function
would cause some kind of javascript error on the console but nothing is
logged.

Tom.
--
Cloudian KK - http://www.cloudian.com/get-started.html
Fancy 10TB of full featured S3 Storage?
Checkout the Cloudian® Community Edition!



Re: "Accounts" -> "Add Account" UI Question

Posted by Ian Duffy <ia...@ianduffy.ie>.
Hi Thomas,

Looks like a possible bug.

CCing the UI team. They may be able to offer more info.


On 13 May 2014 04:00, Thomas O'Dowd <tp...@cloudian.com> wrote:

> When I delete an account, I get a notification. Should the same not work
> for adding an account? I'm using 4.3.
>
> I've never really played with javascript, jquery or ajax before but just
> looking the the code in the debugger I'm wondering if the following is
> not a problem. Maybe something obvious that I don't quite understand :-)
>
> In accountsWizard.js
>                     } else {
>                         $.ajax({
>                             url: createURL('createAccount' +
> array1.join("")),
>                             dataType: "json",
>                             async: false,
>                             success: function(json) {
>                                 var item =
> json.createaccountresponse.account;
>                                 args.response.success({
>                                     data: item
>                                 });
>                             },
>                             error: function(XMLHttpResponse) {
>
> args.response.error(parseXMLHttpResponse(XMLHttpResponse));
>                             }
>                         });
>                     }
>
> The code calls the function "args.response.success()" but looking at the
> debugger args.response has no "success" function. It has
> args.response.error() though.
>
> In ui-custom/accountsWizard.js
>                                 } else {
>                                     args.action({
>                                         context: context,
>                                         data: data,
>                                         isLdap: isLdap,
>                                         username: username,
>                                         response: {
>                                             error: function(message) {
>                                                 if (message) {
>
> cloudStack.dialog.notice({
>                                                         message: message
>                                                     });
>                                                 }
>                                             }
>                                         }
>                                     });
>                                 }
>
> It doesn't setup a response.success... Only response.error.
>
> However, I would have expected that the call to the missing function
> would cause some kind of javascript error on the console but nothing is
> logged.
>
> Tom.
> --
> Cloudian KK - http://www.cloudian.com/get-started.html
> Fancy 10TB of full featured S3 Storage?
> Checkout the Cloudian® Community Edition!
>
>