-
-
Notifications
You must be signed in to change notification settings - Fork 28
Add information to the extensions overview that a new version of an extension is available #113
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
Comments
this can technically also be achieved with the blueprint api which already has access to all required urls |
Yeah it does work when changing the file https://github.com/BlueprintFramework/framework/blob/main/resources/views/blueprint/admin/entry.blade.php to: @if(isset($EXTENSION_ID))
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 text-center" style="padding-left: 0px; padding-right: 17px;">
<a href="{{ route('admin.extensions.'.$EXTENSION_ID.'.index') }}">
<button class="btn extension-btn" style="width:100%;margin-bottom:17px;">
<div class="extension-btn-overlay"></div>
<img src="{{ $EXTENSION_ICON }}" alt="{{ $EXTENSION_ID }}" class="extension-btn-image2"/>
<img src="{{ $EXTENSION_ICON }}" alt="" class="extension-btn-image"/>
<p class="extension-btn-text">{{ $EXTENSION_NAME }}</p>
@if($EXTENSION_VERSION != $EXTENSION_LATEST_VERSION)
<p class="extension-btn-version" data-toggle="tooltip" data-placement="top" data-original-title="Update available">{{ $EXTENSION_VERSION }} <i class="bi bi-info-circle-fill text-danger"></i></p>
@else
<p class="extension-btn-version">{{ $EXTENSION_VERSION }}</p>
@endif
<i class="bi bi-arrow-right-short" style="font-size: 34px;position: absolute;top: 15px;right: 30px;"></i>
</button>
</a>
</div>
@endif and in the file https://github.com/BlueprintFramework/framework/blob/main/resources/views/admin/extensions.blade.php at line 8/9 adding the function I wrote and changing the part starting at line 110 to: @foreach($blueprint->extensions() as $extension)
@include("blueprint.admin.entry", [
'EXTENSION_ID' => $extension['identifier'],
'EXTENSION_NAME' => $extension['name'],
'EXTENSION_VERSION' => $extension['version'],
'EXTENSION_ICON' => !empty($extension['icon'])
? '/assets/extensions/'.$extension['identifier'].'/icon.'.pathinfo($extension['icon'], PATHINFO_EXTENSION)
: '/assets/extensions/'.$extension['identifier'].'/icon.jpg',
'EXTENSION_LATEST_VERSION' => getVersionFromUrl($extension['website'])
])
@endforeach will check if a new version is available. |
It will probably be implemented natively in the API so it requires way less calls |
If emma allows me to |
This feature idea is getting a green light from me and will be on the backlog for next release. Updates should be fetched by the Blueprint API and properly handled. Version info should be periodically fetched by Blueprint, ideally in one request. Version checking should be able to be turned on or off through a flag. Version info will be fetched daily, through a timestamp generated through the telemetry UUID. |
Very nice to hear. yeah doing it somehwere inside the php files was just some trying out on my part on how this could look like 😄 |
Uh oh!
There was an error while loading. Please reload this page.
Scope
Extension development
Explanation
To do that, extension would need a configuration inside the
conf.yml
that points to a url that contains version informations.For now, that could be a link to the extension from
builtbybit.com
,sourcexchange.net
or just to thegithub
release section.With that link, the current available version can be parsed and compared against the current installed version.
If the version does not match, then a small icon could be displayed in the extension overview at the extension, which informs the admin that a new version is available for this extension.
Edit:
website
parameter inside theconf.yml
should already have that information I guess.With a get request to that website and a simple query you can already get the current version pretty fast:
builtbybit.com:
document.getElementsByClassName("resourceVersion")[0].innerHTML
;sourcexchange.nat:
document.getElementById("information-heading").nextElementSibling.innerHTML.match(/v([^\s]+)/)[1];
github.com:
Add
/releases/latest
to the url and change the first part fromhttps://github.com/
tohttps://api.github.com/repos/
.Example:
https://github.com/BlueprintFramework/framework/
will behttps://api.github.com/repos/BlueprintFramework/framework/releases/latest
.This API call will have the latest version inside the
tag_name
property.Another Edit:
I am not a php guy but something like that should work. Maybe this could be binded to a button "Check for extension updates" in the overview to not throw a bunch of requests every time you access the extension overview.
This will return the latest version if a valid url is given. Will return
null
if the website isn't valid or can't be reached.Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: