Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BD-05] [BB-2963] Improve Instructor dashboard #2

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

shimulch
Copy link

@shimulch shimulch commented Nov 23, 2020

This PR introduces a couple of improvements for the instructor dashboard in MFE -

  • Uses edx/paragon components to display data and loading spinner
  • Summary table values are generated
  • Table can be sorted by column value
  • ORA block embedded in an iframe inside a Modal.

JIRA tickets:

Discussions:

Dependencies: None

Screenshots:
Screenshot from 2020-11-23 23-55-58

Embed Staff Grading -
Screenshot from 2020-11-23 23-56-20

Sandbox URL:

Merge deadline: None

Testing instructions:

  1. Run local devstack
  2. Clone this repo and checkout this PR
  3. Add ORA blocks in local devstack
  4. Go to http://localhost:2003/<course_key>
  5. Statistics for ORA blocks will be shown.
  6. Clicking on the Manage button should show embedded xblock and staff grading can be done from there.

Author notes and concerns:

  1. This PR uses edx/paragon Table component which is not stable yet. https://edx.github.io/paragon/components/table
  2. I couldn't find any API that will only embed staff grading as those templates have some dependency with JS. Rather I've embedded full xblock from LMS. But that might mean a possible issue with X-frame-options due to cross-site iframe embedding in production.

Reviewers

@shimulch shimulch marked this pull request as ready for review November 23, 2020 18:03
Copy link
Contributor

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's working well enough, I just have mostly minor concerns.

I'm just not sure of the iframe-based implementation. I assumed that would also be moved to React, but perhaps @giovannicimolin can answer that.

@@ -11,7 +11,7 @@ function LoadingOrValue({ value }) {
}

LoadingOrValue.propTypes = {
value: PropType.element,
value: PropType.oneOfType([PropType.element, PropType.number]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having it be a node means it can be anything that can be rendered, so it will match, numbers, strings and other react elements.

Suggested change
value: PropType.oneOfType([PropType.element, PropType.number]),
value: PropType.node,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

<DataTable data={data} />
{status === RequestStatus.IN_PROGRESS && <Spinner animation="border" variant="primary" />}
{status === RequestStatus.SUCCESSFUL && (
<div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this div isn't adding anything, you can remove it and just <> instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing that, yes a fragment would be better.

* @param {string} key
* @param {string} direction
*/
const sort = function sort(firstElement, secondElement, key, direction) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think naming the function twice is a bit redundant.

Suggested change
const sort = function sort(firstElement, secondElement, key, direction) {
function sort(firstElement, secondElement, key, direction) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this seems like a utility function, so can probably moved to a common places and imported as such.

},
];

console.log(sortableData.map(i => i.id));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(sortableData.map(i => i.id));

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


function OraDashboard({ data }) {
return (
<main>
<div className="container-fluid">
<h1>Open Responses</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be translatable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's translatable.

columns={columns.map(column => ({
...column,
onSort(direction) {
console.log('Sort in direction ', direction, column);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('Sort in direction ', direction, column);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

}, [courseId, data]);

// create a copy of data for sortable Table
const sortableData = Object.values(data).slice().map(item => ({ ...item, actions: (<EmbedORAModal usageKey={item.id} title={item.name} buttonText="Manage" />) }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the action here should only show up based on certain criterion, such as the availability of gradable items and staff access.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I'm not sure "Manage" is a good enough label. Perhaps the column header can have a verbose anme, and this button can just be an icon.

Also make this translatable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but to accommodate this condition we need staff_assessment flag available. Details on the ticket.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000, as we will be creating instructor API's to support this on MFE, I guess this Manage button will not be here anymore. It will be the same as the current instructor dashboard (clicking on numbers in Staff column). I will do that change after the APIs are created.

@shimulch shimulch marked this pull request as draft November 28, 2020 04:14
@jnlapierre
Copy link
Owner

@giovannicimolin , does this PR have an associated Open edX JIRA ticket?

Copy link
Owner

@jnlapierre jnlapierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants