[rt-devel] kanben view in RT 4.2.12

Joachim Schiele js at lastlog.de
Thu Feb 25 17:29:51 EST 2016


On 23.02.2016 19:37, Shawn Moore wrote:
> On 2016年2月18日 at 8:20:28, Joachim Schiele (js at lastlog.de) wrote:
>> dear rt-developers,
> 
> Hi Joachim and Paul,
>
>> we want to add a kanban view for tickets in RT but in order to do that a
>> REST interface with websocket support is required.
> 
> Sounds great! :-)

this is our current state:

**teaser**:
https://lastlog.de/misc/rt4.2-kanban.jpg

- uses REST 1.0 to get the data
- jQuery UI for the GUI
- moving tickets effects its state
- tickets can be assigned to different users (dropdown)
- ticket priority affects the vertical position
- completely embedded in RT 4.2.12 (mason template)

>> the current 1.0 interface does not support JSON (will be fixed with the
>> 2.0 REST API AFAIK)
> 
> That’s correct.
> 
>> which means we have to create java-script objects
>> from the input in the browser manually (without being able to use
>> parseJSON(...))
>>  
>> our initial idea is to use mysql with triggers:
>> http://dev.mysql.com/doc/refman/5.0/en/triggers.html
>>  
>> as this seems to be an easy way to monitor the tickets table for changes
>> and then note these ticket IDs down.
> 
> Please be aware that you’re limiting the potential audience of your extension by tying it to any specific database engine. RT has many users on Postgres and Oracle as well.
> 
> My suggestion would be to add the notification system at the ORM layer. Probably in the guts of RT (RT::Record, RT::SearchBuilder) or possibly in the generic ORM, DBIx::SearchBuilder. Changes to records in the database pass through a very small list of Perl methods (in particular, RT::Record::_Set), so by instrumenting the right place you should be able to see all changes happening.

yes, this is sadly true. but for the moment we will be going with MySQL
and TRIGGER. but once we got the websocket-backend integrated properly
we might look into this again.

>> the websocket REST-interface then sees all attached clients and every
>> time a ticket changes it can push the ticket ID(s) to the client and the
>> client then can apply the change.
>>  
>> === the question ===
>> - where in the RT code would be the best place to add the WEBSOCKET REST
>> extension (into the routing) + it needs an main loop waiting for
>> 'ticket'-table changes
> 
> You’ll probably want to use Plack::App::WebSocket with an event-based PSGI server (probably Twiggy). RT is typically deployed with FastCGI or similar, so you have your work cut out for you there. :) You’ll either want to have good documentation around switching an RT deployment from FastCGI to Twiggy, or have your users deploy a standalone Twiggy server alongside their RT http server.

hm. this leaves me with three more questions:

- could you please point out what i need to do in order to use twiggy
instead of 'the usual' deployment method?

regarding WS:
i've been playing with Plack::App::WebSocket a lot. mainly with this
example:
https://github.com/motemen/Plack-Middleware-WebSocket/blob/master/eg/echo/app.psgi

and i'm currently having trouble with two things:

- how to extend the example to do a mysql query every second and then
send data to all clients (i extended the example so every incoming
string is sent to _all_ clients already)?

  something like this:
    my $w = AnyEvent->timer (after => 3, cb => sub { foo });

  but without this:
    AnyEvent::Loop::run;
  the timer will never be executed. and if i start the loop with the
above code the webserver won't be spinning.

- looking into the rt-extension-rest2 i wonder how to put the above
example code into
https://github.com/bestpractical/rt-extension-rest2/blob/943d8f69ef8e1a0e6d6615fc4f92df0d3fde3cf2/lib/RTx/REST.pm

>> - how to make this a general solution: instead of binding this feature
>> to MYSQL we could also extend the ticket API with various callbacks on:
>> - add/remove/update ticket functionality
> 
> Instrumenting RT::Record::Create and RT::Record::_Set generally, or RT::Ticket::Create and RT::Ticket::_Set specifically, should get you most of the way there.

that is very good information! but i would have to 'modify' the RT-Core
as this can't be done from an extension, right?

>> === /the question ===
>>  
>> we plan to release the kanban as open source once we are done with the
>> implementation.
>>  
>> if you could help us out with implementation details, that'd be a delight.
> 
> Absolutely! This is the best forum for such conversations. :)

very good!

>> thanks in advance,
>> joachim & paul
> 
> Thanks!
> Shawn

thanks very much for your help! it really is appreciated.





More information about the rt-devel mailing list