[rt-devel] Scrip feedback

Bradley Bell bradleyb at uw.edu
Tue May 21 16:18:50 EDT 2013


On Tue, May 21, 2013 at 12:26 PM, Ruslan Zakirov <ruz at bestpractical.com> wrote:
> On Tue, May 21, 2013 at 11:14 PM, Bradley Bell <bradleyb at uw.edu> wrote:
>>
>> As far as I can tell, there is no easy way for a scrip to provide
>> feedback to end users.
>> For example if I have a scrip that reverts a status change, the
>> scrip's Commit method could return (1, "Feedback Here") and then in
>> the UI, instead of just seeing:
>>
>> * Ticket 8: Status changed from 'open' to 'stalled'
>>
>> They would also see
>> * Ticket 8: Can't be stalled without a Due date. Status changed back to
>> 'open'
>>
>> or whatever.
>>
>> Is there something that already provides this functionality or would a
>> patch be welcomed?
>
>
> 1) Scrips are not best for such things. New RT allows you to prevent
> operations much easily in UI by using checks_failure (grep) and callbacks.

I thought about using callbacks instead, but there are so many places
in the UI to change things it seems like the complexity in maintenance
goes up very fast, and I'd have to keep the scrip around as well
because I'd probably miss one. I do agree that checking beforehand
would be better than reverting transaction afterwards.

> 2) Patch is not bad. I want user visible feedback from Scrips too.
>
> 3) Return value of Prepare/Commit methods is not good candidate. Mostly
> because of backwards compatibility. I think a method in scrip action's class
> can be used, for example AddMessage or something like that.
>
> 4) If you want to see it merged into RT core then it's better to implement
> something dirty and quick, publish it for review and comments on rt-devel@
> list.

I will think about implementing this, I have to figure out if it will
solve my current problems though.

Another half-baked idea: custom conditions in the lifecycle?

        actions => [
            'open -> stalled'  => {
                label  => 'Stall', # loc
                update => 'Comment',
                condition => sub { return $_->CheckOkToStall; }
            },

but of course there are many things other than status to be concerned about.

-- 
Bradley Bell
Classroom Support Services | University of Washington
035 Kane Hall | Box 353095 Seattle, WA 98195-3095
p 206.543.9900 | f 206.685.7892 | www.css.washington.edu


More information about the rt-devel mailing list