(developers) Good UI progress! Can someone help me with my AJAX?

Hi all,

Time to help a bit on the UI project!

As I've mentioned, I'm not a Javascript/UI expert. For starters,
I've got a very basic modal login dialog started here (loving
JQuery+Bootstrap so far), and the intent is to hit "/api" to figure
out if the login is successful or not and to dismiss the dialog. To
do this, I'm trying to use the jQuery .ajax.

https://github.com/ansible/ansible-commander/blob/master/ui/index.html

https://github.com/ansible/ansible-commander/blob/master/ui/commander.js

See the function "api_call" which I'm trying to define and debug.
It's calling the error callback with a code of "0" and not telling me
very much more about what I'm doing wrong.

Can someone help me out here and see why the API is not logging in
successfully? It does not seem to be hitting the REST layer and
Firebug is of limited usefulness. I have added some calls in the API
to log to syslog when things are hit, though logging is not showing up
yet.

I figure once we get past this, and also have some basic REST examples
of some POSTs and DELETEs as well, it will be VERY easy to go to town
on this and implement all the basic object editing.

The idea is it's going to be a one page interface -- the modal goes
away after login, and you see the main commander interface, and there
are different panels/tabs/whatever for working with users, inventory,
and so on.

Anyway, help on getting this first API request working would be very welcome.

Thanks!

--Michael

Is it decided on bootstrap and jquery or might it be possible to influence the use of extjs this early on??

Because of extjs using panels it would make it easy for the.codebase to be reusable and pluggable with other projects like the graphite ui

It's decided.

FWIW, figured out this particular problem -- attempting to use Cross
Site Scripting as a feature is apparently frowned upon :slight_smile:

Checkout jsonp for cross site

What I ended up doing was telling flask to serve the static content,
which was pretty straight forward.

Login now works very well.

I'll probably get the various other resources started in the next few
days, then, like I said, the UI is subject to as many improvements as
people can think of once we get the basics down.

(I have some minor backend things to do also like limit what non-admin
users can do to other users, but this is all listed in the TODO.md
file)

--Michael