document adding new reports to PHP frontend

RESOLVED FIXED

Status

Socorro
General
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: rhelmer, Assigned: rhelmer)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Updated

6 years ago
Assignee: nobody → rhelmer
(Assignee)

Comment 1

6 years ago
Brandon, Lonnen, r? 
http://socorro.readthedocs.org/en/latest/ui.html#adding-new-reports

This is much easier to read with syntax highlighting and such, and since it's new I just pushed it instead of making you look at an RST diff.
Status: NEW → ASSIGNED

Comment 2

6 years ago
As we discussed in IRC, there already is a method in the base controller class for dealing with missing versions. It is not pretty, and it may have bugs, but it is used in some of the controllers. This should be used, rather than encouraging devs to include a boilerplate workaround in each controller.

The problems of the base class should be fixed independently of this bug.
(Assignee)

Comment 3

6 years ago
(In reply to Chris Lonnen :lonnen from comment #2)
> As we discussed in IRC, there already is a method in the base controller
> class for dealing with missing versions. It is not pretty, and it may have
> bugs, but it is used in some of the controllers. This should be used, rather
> than encouraging devs to include a boilerplate workaround in each controller.
> 
> The problems of the base class should be fixed independently of this bug.

Makes sense, will do.

Something else I just thought of is that this should probably cover adding a link to the "report_select" select box, too.

I'll test that this is free of syntax errors and actually works too, before we close the bug out.. in general I'd like to make this example as concise and self-explanatory as possible, but I accept that there are limits (at least until we move to the new frontend!)

Comment 4

6 years ago
I just looked through the default controller and many of the individual controllers... and maybe I was wrong? From what I've seen each implements a different handler for empty versions anyway. I don't know if there's something about the framework that encourages this sort of behavior or what, because it seems like code that should / could be common between the classes.
Hey [:rhelmer], [:lonnen],

Thanks so much for the effort that has been put into this already. I have looked over the docs and have a couple of questions ;) In this comment I want to cover the first one.

In the current code samples there is a lot of code that I am sure not every report will need. For my purposes, at the moment in general, I really only need the barebones for adding a new report.

With that, I looked over the code and did the folowing:

1) In terms of directory structure, you will have something like:

webapp-php
-- application
---- controllers
------ newreport_controller.php
---- models
------ newreport.php
---- views
------ newreport
-------- newreport_view.php

2) In terms of the bare minimum these files needs to contain to be of any value. To demostrate what I create a public gist here: https://gist.github.com/1354596

Would love to get your feedback and additions/fixes where I went wrong. Thanks again.

Updated

6 years ago
Target Milestone: --- → 2.3.3

Comment 6

6 years ago
Filled the example in just a bit. I added a sample controller method to demonstrate how to tie the model, url request, and view together.

https://gist.github.com/1356011
Target Milestone: 2.3.3 → ---
Thanks [:lonnen]
So the below is a standard require when using the Kohana framework?

require_once(Kohanna::find_file('libraries', 'somelib', TRUE 'php'));
(Assignee)

Comment 10

6 years ago
(In reply to Schalk Neethling from comment #5)
> 
> 2) In terms of the bare minimum these files needs to contain to be of any
> value. To demostrate what I create a public gist .here:
> https://gist.github.com/1354596
> 
> Would love to get your feedback and additions/fixes where I went wrong.
> Thanks again.

Hah I thought mine was minimal, given the example I started with :) I tried to leave in enough detail so you could have a basic working example that:

1) pulls JSON from a middleware service
2) displays that JSON as an HTML table with pagination and such

Point taken though, I think it's fine if you want to trim this down. 

(In reply to Chris Lonnen :lonnen from comment #6)
> Filled the example in just a bit. I added a sample controller method to
> demonstrate how to tie the model, url request, and view together.
> 
> https://gist.github.com/1356011

This looks ok to me, I guess we should probably mention routes.php too.
[:rhelmer] Your's was totally awesome, just wanted to have another sample of a real barebones report. Agree on routes, I was wondering how, when you added the new report, you will go about accessing it. I assume routes is where this is configured.
(Assignee)

Comment 12

6 years ago
I've been thinking about this, how about:

1) we have a stripped-down skeleton example like comment 6
2) we have a mention in the doc and simple example of how to request JSON via the middleware service API (with appropriate links to the middleware docs)
[:rhelmer] +1(In reply to Robert Helmer [:rhelmer] from comment #12)
> I've been thinking about this, how about:
> 
> 1) we have a stripped-down skeleton example like comment 6
> 2) we have a mention in the doc and simple example of how to request JSON
> via the middleware service API (with appropriate links to the middleware
> docs)

[:rhelmer] +1

Comment 14

6 years ago
Commits pushed to https://github.com/mozilla/socorro

https://github.com/mozilla/socorro/commit/128dfa11a30d4d5d7ecddca442e761651589bc47
bug 701156 - simplify newreport example per schalk and lonnen

https://github.com/mozilla/socorro/commit/a391c7f0a66897da5aa7b09f9984034b3e6020fa
Merge pull request #182 from rhelmer/bug701156-simplify-newreport

bug 701156 - simplify newreport example per schalk and lonnen
(Assignee)

Comment 15

6 years ago
(In reply to Schalk Neethling from comment #13)
> [:rhelmer] +1(In reply to Robert Helmer [:rhelmer] from comment #12)
> > I've been thinking about this, how about:
> > 
> > 1) we have a stripped-down skeleton example like comment 6
> > 2) we have a mention in the doc and simple example of how to request JSON
> > via the middleware service API (with appropriate links to the middleware
> > docs)
> 
> [:rhelmer] +1

OK stripped this down to bare minimum:
https://github.com/mozilla/socorro/commit/a391c7f0a66897da5aa7b09f9984034b3e6020fa

Now that we have decent middleware docs on how to add a service, just added a reference.

Feel free to hack on this if there's anything you'd like to see!
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Component: Socorro → General
Product: Webtools → Socorro
You need to log in before you can comment on or make changes to this bug.