opened
justin0022
username_0
Currently there's an option to disable views on the back end, but on the React front-end all views will show up in the side navigation regardless.
Disable views on frontend if disabled on backend in React.
issue
created
justin0022
username_0
@andrew-gardener we'll need an endpoint set up that sends the client info on what views are currently activated. Could you take this on?
comment
created
jonespm
username_1
This should already be available at /api/v1/courses_enabled

It has all of the courses, but it's indexed by course id. 

`{"245664": {"fa": 0, "ap": 0, "gd": 0}, "261521": {"fa": 1, "ap": 1, "gd": 1}, "261632": {"fa": 0, "ap": 0, "gd": 0}}`

If you had this in a var like json, json[245664] would return the views that are enabled/disabled (fa=files, ap=assignments, gd=grades.
comment
created
jonespm
username_1
I guess you could make this api "slightly" more efficient by just asking for the specific course.
comment
created
justin0022
username_0
Thanks @username_1, didn't know this till now.
comment
created
pushyamig
username_2
@username_0 I forgot about the endpoint.  That Endpoint is public
comment
created
justin0022
username_0
No problem, should make it easier to implement now
comment
created
jonespm
username_1
Yeah we recently added this so we can add dynamic links to Canvas. It's cached locally (cache_page) but we're also are "caching" this this URL via cloudfront to reduce traffic to our servers and calling it with jsonp so we can dynamically add links to supported courses in Canvas. It's been working really good!
comment
created
pushyamig
username_2
I suggest not to use this API since URL is cached(in the browser) then we won't be getting the latest info. so if a view is disabled in DB then browser might still show the content.
comment
created
jonespm
username_1
We could just reduce the cache time too. . . I feel like even if we reduced it to 10-15 minutes it should be fine.
comment
created
pushyamig
username_2
The thing is you could you the `course_enabled` endpoint for getting the info about what course/view is enabled/disabled. But that API lacks the information about `Course name` that is needed for display in the UI. We could either add that info for the same endpoint. Or we could create a new endpoint just returning info about a course. 

As Matt mentioned the purpose that endpoint created was for launching Myla from canvas when the view links(assignments/grades/files) was hacked on canvas page using Canvas custom JS. So that student can just access the links from respective pages.
comment
created
jonespm
username_1
I created a PR that also adds this to the 

/api/v1/courses/<courseid>/info feed in #473 / #472. You have to pass the full course ID with the CANVAS_DATA_ID_INCREMENT and this endpoint is currently being used by the "Files Accessed"
comment
created
pushyamig
username_2
With react that is not needed instead it is subtituded in BE in `views.py`
comment
created
justin0022
username_0
Should there be an option on the main `index` page to select which course the user wants to look at?
comment
created
pushyamig
username_2
This is what I am thinking.. the course info is a global piece of info that needs across all the view like `/grades`,`/files`  and to future views. whichever view get that info needs to store as global and can be accessed by other components. Currently, components are not shared between views they are totally different. I have been reading about [React context ](https://medium.freecodecamp.org/how-react-context-can-come-to-the-rescue-if-you-dont-know-redux-5452464642ee) one way to handle this. do we want to consider this approach? or make an API call to get the couse_info for every view?
comment
created
justin0022
username_0
Doesn't `/api/v1/courses_enabled` list all courses for the user that has MyLA turned on?
comment
created
jennlove-um
username_3
I agree that we'll need to find an easy way in the UI for users to switch
between courses.  It might be needed at both the home page and individual
visualization level.  For example, if I'm looking at the grade distribution
visualization in one class, it would be nice to be able to switch to the
grade distribution in another class without having to go back to the home
page and change classes.  If I could do it right from within the grade
distribution page, that would be great.  Same for the other visualizations.

I also anticipate that students will ask for a summary assignment planning
type of view.  The progress bar would make less sense in that kind of view,
but the weekly schedule might be very helpful if it showed assignments for
all classes in a given week.
comment
created
jonespm
username_1
We mentioned this back in #136.

However this hasn't gotten any local priority because this is launched from Canvas and in our limited pilot a student has only been in one pilot course. I have some design ideas for better cross course navigation but that data should probably be in a new user specific api. 

I'd probably be useful to rewrite the backend to djangorestframework (and merge that PR for the models) to better support this effort. But we could just add this in eventually as a new feature .
comment
closed
pushyamig
username_2
issue