Re: Using WebAPIResource from Javascript - need Backbone.Model.extend example

2016-05-06 Thread Christian Hammond
Hi Eric,

The `model` and `uri_object_key` are configurations for a resource's
implementation, and aren't related to the data provided by the caller.

The `model` attribute is optionally used to associate a WebAPIResource
subclass with a particular database model. If set, many of the operations
(GET requests to lists or to objects, DELETEs, etc.) are implemented for
you, but otherwise, you have to implement those yourself (by overriding
get(), get_list(), delete(), etc.).

`uri_object_key` defines the name of the capture group in the URL's regex
that captures the iD used to look up the appropriate object (defined by
`model`) in the database.

You don't need to do anything with Backbone to make use of the API. a
$.post() should be fine. However, it sounds like maybe the WebAPIResource
isn't implemented fully.

Can you show me the code you've written, how you're calling into the API,
and what the results are when you do so? We can help you write the
WebAPIResource to do what you need.

Christian

-- 
Christian Hammond
President/CEO of Beanbag 
Makers of Review Board 

On Wed, May 4, 2016 at 9:04 PM, Eric Holmberg 
wrote:

> I have created a WebAPIResource extension based upon the instructions in
> https://www.reviewboard.org/docs/manual/2.0/extending/extensions/webapi/
> which is called based upon the user clicking on a menu item which was
> created by ReviewRequestDropdownActionHook.
>
> How do I actually do the POST call?
>
> I tried just the usual jQuery $.post(...), but djblets/webapi/
> resources.base.py tries to get the "model" and "uri_object_keys" and
> fails since they are not part of the post data.  It looks like I need to
> create a view and model by deriving from Backbone.View.extend 
> Backbone.Model.extend,
> but I haven't found any concise examples that I can understand well enough
> to use as a template.
>
> My use case:
>
>1. Based upon a UI event, post to the WebAPIResource
>2. In the WebAPIResource.create method:
>   1. Lookup current review, post a comment based upon the approval
>   request (similar to a ship-it comment)
>   2. Log vote into a new database model
>   3. Query the existing votes and if everything looks good, trigger a
>   merge of the change or rejection email
>
>
> Note that I'm not a Javascript or web programmer since my background is
> C++ and Python, so I'm sorry if my question is elementary.
>
> Regards,
> Eric
>
>
>
>
> --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: diffviewer_filediff Table in DB

2016-05-06 Thread john levin
Thanks Alot David. You Saved my Time.

A colleague of mine wrote a sql quicky based on your input and we achieved 
the result.

select D.id,D.status,A.source_file from diffviewer_filediff A , 
diffviewer_diffset B , diffviewer_diffsethistory C,reviews_reviewrequest D 
where A.diffset_id = B.id and B.history_id = C.ID and  D.diffset_history_id 
= C.id and D.id = 57; (57 is the review id)




On Thursday, May 5, 2016 at 5:59:06 AM UTC+5:30, David Trowbridge wrote:
>
> There are many different tables that have foreign key relations to each 
> other.
>
> The FileDiff has a foreign key to DiffSet, which represents a single 
> revision of a diff on a review request. DiffSet in turn has a foreign key 
> to DiffSetHistory, which is all revisions. The ReviewRequest model has a 
> foreign key to DiffSetHistory (a 1:1 relationship).
>
> Therefore, if you want to relate a FileDiff to its ReviewRequest, you'll 
> have to join all the relevant tables together.
>
> -David
>
> On Wed, May 4, 2016 at 6:37 AM john levin  > wrote:
>
>> Could Someone answer my question please ?
>>
>>
>> On Wednesday, May 4, 2016 at 12:39:54 PM UTC+5:30, john levin wrote:
>>>
>>> Hi,
>>>
>>> I could see that diffviewer_filediff Table doesnt Holds the review id 
>>> rather the id is incremental mode whenever the change is happens. So i'm 
>>> Wondering how to Map the Filelist with particular review ID. Any Idea ?
>>>
>>> Note :- I dont have an idea about django, so connecting the DB directly 
>>> to validate some informations.
>>>
>>> Thanks !
>>>
>>> /BR
>>> John
>>>
>> -- 
>> Supercharge your Review Board with Power Pack: 
>> https://www.reviewboard.org/powerpack/
>> Want us to host Review Board for you? Check out RBCommons: 
>> https://rbcommons.com/
>> Happy user? Let us know! https://www.reviewboard.org/users/
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "reviewboard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to reviewboard...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.