airavata-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suresh Marru <sma...@apache.org>
Subject Re: Integrating a thrift javascript client sdk with angularjs
Date Mon, 17 Mar 2014 19:24:35 GMT
Thanks Supun for taking the initiative. I echo Shameera that this seem to be a good working
stop-gap strategy. But I am not knowledgable enough to judge on this topic and would like
to listen critical feedback from others.

Suresh

On Mar 17, 2014, at 2:58 PM, Shameera Rathnayaka <shameerainfo@gmail.com> wrote:

> Hi Supun, 
> 
> This is great, I too found this $scope.apply()[1] would solve our issue . And i was going
to follow this[2] and come up with a sample demo but you already have done it :) (didn't check
it, will do).  For now we can wrap exiting javaScript client as angular service and use it
inside the angular. But for long run It would be good to use Thrift generated JS client instead
exiting JS client. @Sanchit and all WDYT?
> 
> [1] https://github.com/angular/angular.js/wiki/When-to-use-$scope.$apply%28%29 
> [2] http://jimhoskins.com/2012/12/17/angularjs-and-apply.html
> 
> 
> Thanks, 
> Shameera.
> 
> 
> 
> 
> On Tue, Mar 18, 2014 at 12:07 AM, Supun Nakandala <supun.nakandala@gmail.com> wrote:
> Hi All,
> 
> I was able to do successful POC on the $subject (the source code is available at [1]).
I implemented a simple thrift API (thrift descriptor [2]) for echo function. The server side
was implemented in java and for the client side I used javascript.
> 
> Important points WRT to thrift
>     ->Thrift javascript client can be used only against a http server. So I wrapped
the EchoServiceHandler.java[3] inside EchoServlet.java[4] and deployed in tomcat server.
>     ->Thrift client sdk currently supports only AJAX based communication.
> 
> Important points WRT to thrift client and angular integration
>     ->Thrift js client can be used for the communication with the server within angular.
But the problem is, since thrift client is not part of angular, when we do the ajax communication
and update the model the changes will not be updated in the DOM. The reason is angular is
not aware of the events triggered outside of the framework. But this can be overcome by wrapping
thrift client inside an angular service and using promises in angular to notify the success
of ajax calls and then manually updating the DOM.
> 
> The thrift client that I created for this service can be found at[5]. This thrift client
is wrapped inside this angular service[6] and that service is used in controller [7]. I have
also attached screen shots of the demo.
> 
> Hope Shameera, Sanchit, Viknes or Vijayendra can provide feedback on this POC and evaluate
whether this POC is sound enough to guaranty that web based experiment builder can be integrated
with the thrift client sdk.
> 
> Thank you.
> Supun Nakandala
> 
> [1] - https://github.com/scnakandala/echo_service
> [2] - https://github.com/scnakandala/echo_service/blob/master/Echo.thrift
> [3] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServiceHandler.java
> [4] - https://github.com/scnakandala/echo_service/blob/master/src/echo/EchoServlet.java
> [5] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/lib/echo_service/echo_client.js
> 
> [6] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/services.js
> 
> [7] - https://github.com/scnakandala/echo_service/blob/master/WebContent/Web/app/js/controllers.js
> 
> 
> 
> 
> 
> -- 
> Best Regards,
> Shameera Rathnayaka.
> 
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/


Mime
View raw message