-
Notifications
You must be signed in to change notification settings - Fork 15
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
Warn the user if they forgot to set install/abandon date #806
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #806 +/- ##
=======================================
Coverage 94.88% 94.88%
=======================================
Files 89 89
Lines 3809 3816 +7
=======================================
+ Hits 3614 3621 +7
Misses 195 195 ☔ View full report in Codecov by Sentry. |
const saveCurrentDateButton = document.createElement("a"); | ||
saveCurrentDateButton.className = "button"; | ||
saveCurrentDateButton.onclick = function () { | ||
dateField.val(getCurrentISODate()) | ||
submitAdminForm(saveAction); | ||
return false; | ||
} | ||
saveCurrentDateButton.style = "padding: 10px 15px; display: inline-block; text-decoration: none;"; | ||
saveCurrentDateButton.href = "#"; | ||
saveCurrentDateButton.innerText = "Use today's date"; | ||
|
||
const saveNoDateButton = document.createElement("a"); | ||
saveNoDateButton.className = "button"; | ||
saveNoDateButton.onclick = function () { | ||
submitAdminForm(saveAction); | ||
return false; | ||
} | ||
saveNoDateButton.style = "padding: 10px 15px; display: inline-block; margin-left: 10px; text-decoration: none;"; | ||
saveNoDateButton.href = "#"; | ||
saveNoDateButton.innerText = "Continue without setting date"; | ||
|
||
const errorNotice = document.createElement("div"); | ||
errorNotice.id = "dateMissingWarning"; | ||
errorNotice.className = "warning-box"; | ||
errorNotice.innerHTML = ` | ||
<p><b>Warning</b>: Status set to "${statusField.val()}" without setting ${dateType} Date</p> | ||
`; | ||
errorNotice.appendChild(saveCurrentDateButton); | ||
errorNotice.appendChild(saveNoDateButton); | ||
|
||
saveButtons.each((i, button) => { | ||
$(button).addClass("disabled-button"); | ||
}) | ||
|
||
$(errorNotice).insertBefore($('.submit-row').first()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it really easier to do this than to create another html template? I guess if it works, but this isn't terribly readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll try to implement a template based solution tonight and see how it looks. The nice thing about this approach is that it’s modular and could be used alongside other form widgets
Adds a bit of javascript to the Install and Node admin forms which reminds the admin to set the install/abandon date as appropriate if they forget to set it. It's just a reminder but should hopefully encourage folks to actually set these fields
Screen.Recording.2025-01-10.at.00.37.58.mov