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

[#9255] Migrate Instructor Course Student Details Edit page to Angular #9301

Conversation

tanhengyeow
Copy link
Member

@tanhengyeow tanhengyeow commented Jan 3, 2019

Part of #9255

Summary of PR:

  • Migrated InstructorCourseStudentDetailsEditSaveAction to PutCourseStudentDetailsEditAction
    • Endpoint: /webapi/courses/students/details/edit
    • Requires: 2 non-null query parameters courseid and studentemail to check for current student to edit. Other query parameters are sent through the form and fields are updated accordingly.
    • Returns: any error message if the action fails. If the action is successful, user will be routed to the instructor course details page.
    • Added PutCourseStudentDetailsEditActionTest to test for the new action.

  • Added new action GetStudentEditDetailsAction to fetch required data for the student details edit page. In v6, relevant data is generated at the backend and mapped to the template page (via JSP) to be served to the users. In v7, where both front-end and back-end are separate, a new endpoint is needed to fetch the required data for this page.
    • Endpoint: /webapi/courses/students/editDetails
    • Requires: 2 non-null query parameters courseid and studentemail to check for current student details to fetch.
    • Added GetStudentEditDetailsActionTest to test for the new action.

  • Migrated front-end of this page instructor-course-student-edit-page.*
    • Uses reactive form template to generate the form
    • Uses updated bootstrap styles that matches the old look of v6
    • Included 2 subscriptions that listen for form value changes of the fields Team name and Email
      • Depending on what the user changed, logic for the respective modal boxes is handled in instructor-course-student-edit-page.component.ts

  • InstructorCourseStudentDetailsEditPageAction will not be migrated into a new action as its' purpose is to show the edit page.

To delete (once PR is reviewed):

  • Deprecated routes in src/main/java/teammates/ui/controller/ActionFactory.java
  • InstructorCourseStudentDetailsEdit*.java files (except browsertests and pageobjects related files)
  • WEB-INF/tags/instructor/courseStudentDetailsEdit/studentInformationTable.tag
  • webapp-backup/jsp/instructorCourseStudentEdit.jsp
  • Deprecated JSP paths in Const.java
  • webapp-backup/dev/js/main/instructorCourseStudentEdit.js

Points to note:

  1. In v6, after successful edit of a student, the user is routed to the instructor course details page and a status message is shown, e.g.:
    image In v7, this message has to be passed along to the instructor course details page once it is migrated.

@tanhengyeow tanhengyeow added the s.Ongoing The PR is being worked on by the author(s) label Jan 3, 2019
@wkurniawan07
Copy link
Member

@tanhengyeow see if you can build the front-end on top of instructor course student details page instead (already migrated thanks to @tran-tien-dat's good work).

@tanhengyeow
Copy link
Member Author

@wkurniawan07 AFAIK the current instructor course student details page is just a static page showing the student details with no functionality for edits.

The different user flow for instructor course student details edit is as follow:

  1. instructorCoursesPage -> Click “View” button of any table row entry -> instructorCourseDetailsPage -> Click “Edit” -> instructorCourseStudentDetailsEdit (which shows a separate edit page)
  2. instructorStudentListPage -> Expand Course -> Click “Edit” button of any table row entry -> instructorCourseStudentDetailsEdit

Are you suggesting towards the idea of not having a separate edit page but instead allow edits on instructor course student details page? If that's the case, we need to take note to discontinue the "Edit" button for the current user flow I've mentioned above.

@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch from 0ebd603 to 7060a1b Compare January 6, 2019 19:47
@wkurniawan07
Copy link
Member

Are you suggesting towards the idea of not having a separate edit page but instead allow edits on instructor course student details page? If that's the case, we need to take note to discontinue the "Edit" button for the current user flow I've mentioned above.

Is it too hard to do? The way I see it, it would in fact make your life a lot easier, but I could be wrong on it.

Or alternatively you could just migrate it as is and we can take a look later on whether to merge it.

@wkurniawan07 wkurniawan07 self-requested a review January 9, 2019 16:51
@wkurniawan07 wkurniawan07 self-assigned this Jan 9, 2019
@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch 3 times, most recently from 8a04183 to ceb9e1d Compare January 12, 2019 11:39
@tanhengyeow tanhengyeow added s.ToReview The PR is waiting for review(s) and removed s.Ongoing The PR is being worked on by the author(s) labels Jan 12, 2019
@tanhengyeow
Copy link
Member Author

@wkurniawan07 Ready for review. PR description is updated with the summary of the changes.

Copy link
Member

@wkurniawan07 wkurniawan07 left a comment

Choose a reason for hiding this comment

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

Mostly good work! Some changes requested.
Also, you should remove the action classes, tests, and JS/JSP/tag files that have been migrated.


/**
* Initializes the student details edit form with the fields fetched from the backend.
* Subscriptions are set up to listen to changes in the 'teamname' fields and 'newstudentemail' fields.
Copy link
Member

Choose a reason for hiding this comment

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

👍👍

/**
* Sets the boolean value of `isSessionSummarySendEmail` to true if
* user chooses to resend past session link to the new email.
* Submits the form otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

This is not accurate? It submits the form regardless of the value.

Copy link
Member Author

Choose a reason for hiding this comment

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

@wkurniawan07 This is intended. The default value of isSessionSummarySendEmail is declared false initially.

In the event the user clicks No, just save the changes, the form will still be submitted with the boolean being false. If the user clicks Yes, save changes and resend links, the form will be submitted with the boolean being true.

Copy link
Member

Choose a reason for hiding this comment

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

The point remains that whatever the value is, calling this function will result in the form being submitted?

Copy link
Member Author

Choose a reason for hiding this comment

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

@wkurniawan07 Yup! That's right. When the user reaches this modal, pressing any of the primary-coloured buttons will lead to the form being submitted, which is what this function is doing.
image

Btw, ready for latest review :)

Copy link
Member

Choose a reason for hiding this comment

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

So "Submits the form otherwise." is not accurate because it submits the form always.
Not a big deal since it's just a comment and can be addressed later.

@wkurniawan07 wkurniawan07 added s.Ongoing The PR is being worked on by the author(s) and removed s.ToReview The PR is waiting for review(s) labels Jan 12, 2019
@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch from ceb9e1d to 0fd8d3d Compare January 13, 2019 13:21
@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch 2 times, most recently from 4e9519c to 03cc79b Compare January 13, 2019 13:51
@wkurniawan07
Copy link
Member

@tanhengyeow let's not remove the browser tests yet. We still need them for reference when migrating the E2E tests later on.

@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch 2 times, most recently from f12f784 to 2885d44 Compare January 13, 2019 14:30
@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch from 2885d44 to e9317f7 Compare January 13, 2019 14:49
@tanhengyeow
Copy link
Member Author

@wkurniawan07 Ready for review again 😄

@tanhengyeow tanhengyeow added s.ToReview The PR is waiting for review(s) and removed s.Ongoing The PR is being worked on by the author(s) labels Jan 13, 2019
Copy link
Member

@wkurniawan07 wkurniawan07 left a comment

Choose a reason for hiding this comment

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

Tested, mostly there! Few minor changes requested.

this.router.navigate(['../../', 'details'],
{ relativeTo: this.route },
);
// TODO: Show success status message in courses/details page after successful edit
Copy link
Member

Choose a reason for hiding this comment

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

You can use NavigationService to achieve this.

/**
* Sets the boolean value of `isSessionSummarySendEmail` to true if
* user chooses to resend past session link to the new email.
* Submits the form otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

The point remains that whatever the value is, calling this function will result in the form being submitted?

(click)="modal.dismiss()">×</button>
</div>
<div class="modal-body">
Do you want to resend past session links of this course to the new email {{ editForm.get('newstudentemail') }}?
Copy link
Member

Choose a reason for hiding this comment

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

editForm.get('newstudentemail') results in [object Object]. Need further processing.

@wkurniawan07 wkurniawan07 added s.Ongoing The PR is being worked on by the author(s) and removed s.ToReview The PR is waiting for review(s) labels Jan 13, 2019
@tanhengyeow tanhengyeow force-pushed the 9255-inst-course-student-details-edit branch from 412f49a to b1c58f8 Compare January 13, 2019 16:12
@tanhengyeow tanhengyeow added s.ToReview The PR is waiting for review(s) and removed s.Ongoing The PR is being worked on by the author(s) labels Jan 13, 2019
Copy link
Member

@wkurniawan07 wkurniawan07 left a comment

Choose a reason for hiding this comment

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

Ok, this page is clear to go.

@wkurniawan07 wkurniawan07 added s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging and removed s.ToReview The PR is waiting for review(s) labels Jan 13, 2019
@wkurniawan07 wkurniawan07 merged commit bf91057 into TEAMMATES:teammatesv7 Jan 13, 2019
@wkurniawan07 wkurniawan07 added this to the V7.0.0-alpha.0 milestone Jan 13, 2019
wkurniawan07 pushed a commit that referenced this pull request Jan 16, 2019
#9301)

* Setup new Action that would replace instructorCourseStudentDetailsEditSave

* Changed courseId and studentEmail to use getNonNullRequestParamValue

* Added method verifyInaccessibleWithoutModifyStudentPrivilege for test

* Added test for PutCourseStudentDetailsEditAction

* Initial setup of edit form structure

* Add new action to fetch student edit page details

* Added test for GetStudentEditDetailsAction

* Finish up page migration

* Added relevant imports for spec file and fix lint errors

* Dlt deprecated inst course student edit files except E2E related files

* Fix code according to review

* Use updated test method

* Fix logic bug

* Updated success message and use NavigationService
wkurniawan07 pushed a commit that referenced this pull request Jan 16, 2019
#9301)

* Setup new Action that would replace instructorCourseStudentDetailsEditSave

* Changed courseId and studentEmail to use getNonNullRequestParamValue

* Added method verifyInaccessibleWithoutModifyStudentPrivilege for test

* Added test for PutCourseStudentDetailsEditAction

* Initial setup of edit form structure

* Add new action to fetch student edit page details

* Added test for GetStudentEditDetailsAction

* Finish up page migration

* Added relevant imports for spec file and fix lint errors

* Dlt deprecated inst course student edit files except E2E related files

* Fix code according to review

* Use updated test method

* Fix logic bug

* Updated success message and use NavigationService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s.ToMerge The PR is approved by all reviewers including final reviewer; ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants