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

Add warning banner when editing start blocks for a level with a template #50082

Merged
merged 3 commits into from
Feb 7, 2023

Conversation

molly-moen
Copy link
Contributor

@molly-moen molly-moen commented Feb 4, 2023

If a level has a template, we will now show a warning banner when editing start blocks or start sources. In this previous PR I added a banner to indicate that you are in start blocks mode in Blockly. That banner will now also show up in droplet labs and in Java Lab (although the styling is slightly different in Java Lab.

Screenshots

Start Blocks, Blockly (unchanged)

Screenshot 2023-02-03 at 4 21 43 PM

Start Blocks with template, Blockly

Screenshot 2023-02-07 at 9 08 17 AM

Start Blocks, Droplet

Looks the same as Blockly, but it required a minor CSS change to push down the workspace so I'm including a screenshot
Screenshot 2023-02-03 at 4 12 49 PM

Start Blocks with template, Droplet

Screenshot 2023-02-07 at 9 09 06 AM

Start Sources, Java Lab

The Java Lab banners use the same styling as the code review warning banner, which is a darker yellow
Screenshot 2023-02-03 at 4 13 10 PM

Start Sources with template, Java Lab

Screenshot 2023-02-07 at 9 08 30 AM

Links

Testing story

Tested locally

Follow-up work

As of now this is the only improvement planned in this space. We had discussed making start blocks readonly if the level had a template, but this opened up a can of worms and didn't work for every lab. Slack thread with more details.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen molly-moen requested review from mikeharv and a team February 4, 2023 00:25
@molly-moen molly-moen requested a review from a team as a code owner February 4, 2023 00:25
Copy link
Contributor

@mikeharv mikeharv left a comment

Choose a reason for hiding this comment

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

Code changes look good! I left a comment about possibly clarifying the warning text and a nit/suggestion for renaming a property, but neither feel like merge blockers.

@@ -2071,6 +2071,7 @@
"standardsReportHeader": "Class Standards Report",
"standardsReportNoUnpluggedLessons": "There are no unplugged lessons in this course.",
"standardsReportLessonLengthInfo": "*Lessons in this course offer between 45 and 65 minutes of instruction",
"startBlocksTemplateWarning": "WARNING: You are editing start blocks for a level with a template. Any start blocks defined here will be overwritten by the template.",
Copy link
Contributor

@mikeharv mikeharv Feb 7, 2023

Choose a reason for hiding this comment

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

Any start blocks defined here will be overwritten by the template.

Strictly, I think this is only true when there are start blocks defined in the template. It's possible to define per-level start blocks in a templated progression if you leave them out of the template, but we don't think that you should do that.

Possible alternative:

"WARNING: You are editing start blocks for a level with a template. Start blocks should be defined in the template level."

Copy link
Contributor

Choose a reason for hiding this comment

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

Should there still be a notification that if start blocks are defined in the template, per-level start blocks are over-written?

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually don't think we should say "overwritten" anywhere because that implies to me that we'll be erasing something. If start blocks are defined in both places, we simply ignore any that are defined in the non-template levels.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then should we remind levelbuilders that the level start blocks will be ignored if there are start blocks defined in the template?

Copy link
Contributor

Choose a reason for hiding this comment

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

We do this already near the field on level edit pages where templates are added:
image

I think this banner is primarily meant to be a reminder that you're editing start blocks (rather than working in the level as a student), and secondarily as an extra warning to be careful if you're using a template. As long as the message we add to the banner is accurate and helpful, I don't think it has to explain every detail about the behavior.

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 like your text Mike, I could only make the string so long without it spilling onto a second line and making the banner too big. Hopefully the clarification on the edit page is enough. This is mostly to give a reminder.

@@ -39,7 +40,8 @@ class CodeWorkspace extends React.Component {
showMakerToggle: PropTypes.bool,
autogenerateML: PropTypes.func,
closeWorkspaceAlert: PropTypes.func,
workspaceAlert: PropTypes.object
workspaceAlert: PropTypes.object,
isProjectTemplateLevel: PropTypes.bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I know you didn't choose the name for this property, but to me it suggests that the level is a template (rather than that it uses one).

I feel like hasTemplate or levelHasTemplate better describes what I think this property means.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep I agree, I'm going to leave as-is because changing it would be pretty high risk

bin/oneoff/count_levels_start_and_template.rb Outdated Show resolved Hide resolved
@molly-moen molly-moen merged commit 9285fde into staging Feb 7, 2023
@molly-moen molly-moen deleted the molly/warn-start-blocks-template branch February 7, 2023 21:02
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.

None yet

3 participants