-
Notifications
You must be signed in to change notification settings - Fork 136
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 Cost Functionality to Goldilocks #524
Conversation
* developed the UI for the email-box * added validation and query params * removed CSS comments, unusded class attribute, and changed the scripts order * updated css for the email input * removed the validator library * changed div to aside and used the form tag * used accent-color, added label * removed outline:none * updated the outline css for the email input * changed h2 to p * make the privacy policy text as a link * updated the background color for the submit button * updated the text color for the email label * updated the accent-color for the checkbox * updated the text color the actived button and its outline * moved the link outside the label * remove toggleSubmitBtn logic and updated css * moved the link outside label * added required for the checkbox * udpdated the text color for the privacy link and added the underline * used the visually-hidden class
* developed the UI for the email-box * added validation and query params * removed CSS comments, unusded class attribute, and changed the scripts order * updated css for the email input * removed the validator library * changed div to aside and used the form tag * used accent-color, added label * removed outline:none * updated the outline css for the email input * changed h2 to p * make the privacy policy text as a link * updated the background color for the submit button * updated the text color for the email label * updated the accent-color for the checkbox * updated the text color the actived button and its outline * moved the link outside the label * remove toggleSubmitBtn logic and updated css * moved the link outside label * added required for the checkbox * udpdated the text color for the privacy link and added the underline * integrated with the api to get the API token * chnaged insightshost to insights-host * used the visually-hidden class * updated the usage message for the insights-host flag
* updated the footer * updated the font size for the email box toggle title'
* developed the UI for the email-box * added validation and query params * removed CSS comments, unusded class attribute, and changed the scripts order * updated css for the email input * removed the validator library * changed div to aside and used the form tag * used accent-color, added label * removed outline:none * updated the outline css for the email input * changed h2 to p * make the privacy policy text as a link * updated the background color for the submit button * updated the text color for the email label * updated the accent-color for the checkbox * updated the text color the actived button and its outline * moved the link outside the label * remove toggleSubmitBtn logic and updated css * moved the link outside label * added required for the checkbox * udpdated the text color for the privacy link and added the underline * integrated with the api to get the API token * chnaged insightshost to insights-host * developed the api token section * changed the default value for insights-host * updated the text, added the disable cost settings button * add css to disable the buttons when the forms are invalid
* developed the UI for the email-box * added validation and query params * removed CSS comments, unusded class attribute, and changed the scripts order * updated css for the email input * removed the validator library * changed div to aside and used the form tag * used accent-color, added label * removed outline:none * updated the outline css for the email input * changed h2 to p * make the privacy policy text as a link * updated the background color for the submit button * updated the text color for the email label * updated the accent-color for the checkbox * updated the text color the actived button and its outline * moved the link outside the label * remove toggleSubmitBtn logic and updated css * moved the link outside label * added required for the checkbox * udpdated the text color for the privacy link and added the underline * integrated with the api to get the API token * chnaged insightshost to insights-host * developed the api token section * changed the default value for insights-host * updated the text, added the disable cost settings button * add css to disable the buttons when the forms are invalid * developed the cost settings section * updated dashboard.go * refactored the code * refactored the code * updated the initQueryParams function * updated the code based on feedback * shown invalid api token message and updated the step for the input element * updated the step for the input element
* developed the UI for the email-box * added validation and query params * removed CSS comments, unusded class attribute, and changed the scripts order * updated css for the email input * removed the validator library * changed div to aside and used the form tag * used accent-color, added label * removed outline:none * updated the outline css for the email input * changed h2 to p * make the privacy policy text as a link * updated the background color for the submit button * updated the text color for the email label * updated the accent-color for the checkbox * updated the text color the actived button and its outline * moved the link outside the label * remove toggleSubmitBtn logic and updated css * moved the link outside label * added required for the checkbox * udpdated the text color for the privacy link and added the underline * integrated with the api to get the API token * chnaged insightshost to insights-host * developed the api token section * changed the default value for insights-host * updated the text, added the disable cost settings button * add css to disable the buttons when the forms are invalid * developed the cost settings section * updated dashboard.go * refactored the code * refactored the code * updated the initQueryParams function * updated the code based on feedback * shown invalid api token message and updated the step for the input element * updated the step for the input element * calculated the cost * refactored the code based on feedback * refactored the code * updated the code based on feedback * updated the code based on feedback * updated the code based on feedback * updated calculating the container cost * transformed the recommended cost * sorted the instance types, created the default values * updated the code based on feedback * updated label name * fix CPU values Co-authored-by: Robert Brennan <contact@rbren.io>
Fairwinds Insights CI Report✅ No new Action Items detected! |
Can you please fill out the PR description? Also, has this been tested with a screen reader for accessibility? |
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.
Please remove the banner ad for the benchmark report
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.
Once the cost data is added, every time I click on a namespace, the screen flashes several times as the javascript hides/shows elements. Is it possible to smooth this out?
<label for="cloud-providers">Cloud Provider</label> | ||
<div class="cost-settings-box__select-container"> | ||
<select name="cloud-providers" id="cost-settings-box__cloud-providers"> |
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.
This label doesn't actually relate to the selector. You can see this in the accessibility section of the dev-tools inspector
<div class="cost-settings-box__select-container"> | ||
<select name="instance-types" id="cost-settings-box__instance-types"> | ||
</select> | ||
<img src="/static/images/triangle.svg" alt="Select Icon" /> |
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.
Since this is purely a visual enhancement, and isn't needed for usability, should it be hidden from screen readers?
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.
(this applies to the other box as well)
@hieptl when you have some time, can you address Andy's feedback? |
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.
When I disable javascript, we still see all the forms, but they are un-usable and have no functionality. We should set this so that all the forms are hidden by default, and javascript enables them. This will greatly improve the usability if javascript isn't working or enabled.
Re: accessibility, I will see if I can enlist Ivan to help us surface any issues. |
<script defer src="static/js/email.js"></script> | ||
<script defer src="static/js/api-token.js"></script> | ||
<script defer src="static/js/cost_settings.js"></script> |
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.
Putting these here is an outdated pattern that may affect performance negatively on "large sites" which may be triggered when we have a large amount of data.
An old-fashioned solution to this problem used to be to put your script element right at the bottom of the body (e.g. just before the tag), so that it would load after all the HTML has been parsed. The problem with this solution is that loading/parsing of the script is completely blocked until the HTML DOM has been loaded. On larger sites with lots of JavaScript, this can cause a major performance issue, slowing down your site.
pkg/dashboard/dashboard.go
Outdated
cpuRequests = 0 | ||
memRequests = 0 | ||
cpuLimits = 0 | ||
memLimits = 0 |
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 believe the zero-value of a float in go is zero, and it's not nillable, so these are unnecessary after declaring the vars.
</div> | ||
</div> | ||
<div class="cost-settings-box__instance-types"> | ||
<label for="instance-types">Instance Type</label> |
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.
Same with this label, it doesn't select the cost settings box, so the screen reader never reads it.
><i aria-hidden="true" class="fas fa-fw fa-angle-up --showWhenOpen"></i> | ||
</p> | ||
<div> | ||
<button id="cost-settings__disable-cost-settings">Disable Cost Settings</button> |
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.
This button living inside of the summary element isn't semantic HTML because it puts a button inside of a button. The "Disable Cost Settings" button needs to be outside of this summary element.
You can notice the negative effects of this both visually when you go to click the button and it looks like you're collapsing the form, as well as when you use a screenreader and it reads "Cost settings - disable cost settings" all at once.
There's another instance of this in another form as well.
Hi @sudermanjr : I updated the code based on your feedback. Thank you for your feedback! |
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.
Thanks for all the updates!
This PR adds cost functionality to goldilocks
Checklist
Description
What's the goal of this PR?
Add the ability to show workload costs and cost changes
What changes did you make?
Lots of frontend updates, as well as some backend changes
What alternative solution should we consider, if any?