-
-
Notifications
You must be signed in to change notification settings - Fork 429
UI: show badges for new releases and deprecations #791
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9aedcff
UI: show a badge if a new release is available
bkeepers 96174f1
Show deprecation warning for Ruby < 3.0
bkeepers 7e84775
Show deprecation warning for Rails < 6.1.0
bkeepers 67b556e
Move rails constants
bkeepers f27295c
Use flippercloud.io API, don't retry failures
bkeepers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Get the latest release from RubyGems.org and show a badge if it's not the current version | ||
| function checkLatestRelease() { | ||
| // Skip check if last check was less than 1 day ago | ||
| if(localStorage.getItem('flipper.releaseCheckedAt') > new Date().getTime() - 86400000) return | ||
|
|
||
| // store the last time we checked for a new version | ||
| localStorage.setItem('flipper.releaseCheckedAt', new Date().getTime()) | ||
|
|
||
| fetch('https://www.flippercloud.io/release.json').then(response => { | ||
| // Something went wrong, so just give up | ||
| if(!response.ok) return | ||
|
|
||
| response.json().then(release => { | ||
| localStorage.setItem('flipper.release', JSON.stringify(release)) | ||
| showReleaseBadge() | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| // Show a badge if a new release is available | ||
| function showReleaseBadge() { | ||
| const badge = document.querySelector('#new-version-badge') | ||
| const release = JSON.parse(localStorage.getItem('flipper.release') || false) | ||
|
|
||
| if(!badge || !release || badge.dataset.version === release.version) return | ||
|
|
||
| badge.innerText = `${release.version} available!` | ||
| badge.setAttribute('href', release.changelog_uri) | ||
| badge.classList.remove('d-none') | ||
| } | ||
|
|
||
| checkLatestRelease() | ||
| showReleaseBadge() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,13 @@ | ||
| module Flipper | ||
| VERSION = '1.1.2'.freeze | ||
|
|
||
| REQUIRED_RUBY_VERSION = '2.6'.freeze | ||
| NEXT_REQUIRED_RUBY_VERSION = '3.0'.freeze | ||
|
|
||
| REQUIRED_RAILS_VERSION = '5.2'.freeze | ||
| NEXT_REQUIRED_RAILS_VERSION = '6.1.0'.freeze | ||
|
|
||
| def self.deprecated_ruby_version? | ||
| Gem::Version.new(RUBY_VERSION) < Gem::Version.new(NEXT_REQUIRED_RUBY_VERSION) | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.