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

Manage students tab: show data with new UI under experiment #19948

Merged
merged 6 commits into from Jan 12, 2018

Conversation

caleybrock
Copy link
Contributor

screen shot 2018-01-11 at 2 01 23 pm

Still lots to do here - next step, redux.

@caleybrock caleybrock changed the title Manage students tab showing data with new table under experiment Manage students tab: show data with new UI under experiment Jan 11, 2018
@@ -9,6 +9,8 @@ import teacherSections, {
import SyncOmniAuthSectionControl from '@cdo/apps/lib/ui/SyncOmniAuthSectionControl';
Copy link
Contributor

Choose a reason for hiding this comment

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

This file does not appear to be an entry point, so it probably should not be in sites/code.org/pages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where else would it go, just apps/src/code-studio/?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably /templates/teacherDashboard/ (it's where I've been putting my stuff)

@@ -69,6 +71,34 @@ export function renderLoginTypeAndSharingControls(sectionId) {
);
}

export function renderSectionTable(sectionId, loginType) {
if (experiments.MANAGE_STUDENTS) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will always be true. Need to check if it's enabled.

dataType: 'json'
}).done(sectionData => {
console.log(sectionData);
sectionData = sectionData.map((section) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might this more accurately be called studentData?

<ManageStudentsTable
studentData={sectionData}
id={sectionId}
loginType={loginType}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we both need to glom loginType onto sectionData AND provide it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember being told that formatters for react-tabular should be const, meaning they don't have access to props, only rowData, but the table itself also needs the loginType because it toggles what columns and text to show.

If the formatters can be part of the class, which now thinking about it I don't see why not, we could just use the info from the top level component.

formatters now: https://github.com/code-dot-org/code-dot-org/blob/staging/apps/src/templates/manageStudents/ManageStudentsTable.jsx#L38

Copy link
Contributor

Choose a reason for hiding this comment

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

If we were to leave it as is, we would also presumably want to add loginType to studentSectionDataPropType?

@caleybrock
Copy link
Contributor Author

updated

url: dataUrl,
dataType: 'json'
}).done(studentData => {
studentData = studentData.map((section) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Each element in this array is a student, not a section, right? (Possible I'm misunderstanding)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no you're right, I just missed that one apparently

<ManageStudentsTable
studentData={studentData}
id={sectionId}
loginType={loginType}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to be embedding loginType onto each student, should we just have ManageStudentsTable extract it from studentData (i.e. studentData[0].loginType) rather than also passing it in separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

then when we have zero students, we won't have information we need to display the table headers properly

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahhh. I wonder if the better option would be to have ManageStudentsTable own sticking loginType onto studentData?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about I only do a mapping once, and I just be really explicit about everything I need and what I want the names to be? See above

secretPicturePath: PropTypes.string,
secret_words: PropTypes.string,
secret_picture_name: PropTypes.string,
secret_picture_path: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

whats the reason for changing these to snake_case? Why are some of these fields snake_case and some camelCase (i.e. sectionId/loginType)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what they're named in the API - I could also map the names before I pass them in.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's what I might do. I always find it confusing to have a mixture of different naming conventions in a single object.

unmountLoginTypeAndSharingControls
} from './sections';
unmountLoginTypeAndSharingControls,
renderSectionTable,
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a little strange that some of our tab render functions we have inlined (renderSectionProjects, renderSectionProgress), and this one we import. Seems like it would be good for us to be consistent. Not something that needs to be fixed in this PR, but something to keep in mind.

FWIW, I think your approach of having it be imported might be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was following how some react buttons get loaded onto the page already. I think it makes a little more sense than defining it in index.

@caleybrock
Copy link
Contributor Author

got an offline 👍

@caleybrock caleybrock merged commit 6757b3e into staging Jan 12, 2018
@caleybrock caleybrock deleted the edit-button-action branch January 12, 2018 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants