mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
display upgrade infos directly on the interface
This commit is contained in:
parent
a564ec62b5
commit
1f3d9cf88d
@ -23,7 +23,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
|
||||
|
||||
// Fab-manager's version
|
||||
$scope.version =
|
||||
{ version: '' };
|
||||
{ current: '' };
|
||||
|
||||
// currency symbol for the current locale (cf. angular-i18n)
|
||||
$rootScope.currencySymbol = $locale.NUMBER_FORMATS.CURRENCY_SYM;
|
||||
@ -41,7 +41,7 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
|
||||
if (user.role === 'admin') {
|
||||
return $scope.version = Version.get();
|
||||
} else {
|
||||
return $scope.version = { version: '' };
|
||||
return $scope.version = { current: '' };
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -267,6 +267,16 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
|
||||
toggler.toggleClass('active');
|
||||
};
|
||||
|
||||
$scope.versionModal = function() {
|
||||
$uibModal.open({
|
||||
templateUrl: '<%= asset_path "admin/versions/upgradeModal.html" %>',
|
||||
controller: 'VersionModalController',
|
||||
resolve: {
|
||||
version() { return $scope.version; }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
/**
|
||||
* Kind of constructor: these actions will be realized first when the controller is loaded
|
||||
@ -513,3 +523,14 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco
|
||||
return initialize();
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
Application.Controllers.controller('VersionModalController', ['$scope', '$uibModalInstance', 'version', function ($scope, $uibModalInstance, version) {
|
||||
// version infos (current version + upgrade infos from hub)
|
||||
$scope.version = version;
|
||||
|
||||
// callback to close the modal
|
||||
$scope.close = function () {
|
||||
$uibModalInstance.dismiss();
|
||||
}
|
||||
}]);
|
||||
|
19
app/assets/templates/admin/versions/upgradeModal.html
Normal file
19
app/assets/templates/admin/versions/upgradeModal.html
Normal file
@ -0,0 +1,19 @@
|
||||
<div class="modal-header">
|
||||
<h3 class="text-center red" translate>{{ 'app.public.common.upgrade_fabmanager' }}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="alert alert-danger" ng-show="version.security" translate>{{ 'app.public.common.security_version_html' }}</p>
|
||||
<p translate translate-values="{VERSION:version.current}">{{ 'app.public.common.current_version' }}</p>
|
||||
<p translate translate-values="{VERSION:version.version}">{{ 'app.public.common.upgrade_to' }}</p>
|
||||
<p>
|
||||
<a ng-href="{{version.url}}" target="_blank" translate>{{ 'app.public.common.read_more' }}</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://github.com/sleede/fab-manager/blob/master/doc/docker-compose_readme.md#update-fabmanager" target="_blank" translate>
|
||||
{{ 'app.public.common.how_to' }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" ng-click="close()" translate>{{ 'app.shared.buttons.close' }}</button>
|
||||
</div>
|
@ -7,7 +7,10 @@ class API::VersionController < API::ApiController
|
||||
|
||||
def show
|
||||
authorize :version
|
||||
update_status = Setting.find_by(name: 'hub_last_version')&.value || '{}'
|
||||
|
||||
render json: { version: Version.current }, status: :ok
|
||||
json = JSON.parse(update_status)
|
||||
json['current'] = Version.current
|
||||
render json: json, status: :ok
|
||||
end
|
||||
end
|
||||
|
@ -116,8 +116,10 @@
|
||||
</section> <!-- /.vbox -->
|
||||
|
||||
<div class="app-generator">
|
||||
<span class="app-version" ng-if="currentUser && currentUser.role == 'admin'" uib-tooltip="{{'version' | translate}} {{version.version}}">
|
||||
<i class="fa fa-question-circle" aria-label="Version ?"></i>
|
||||
<span class="app-version" uib-tooltip="{{'app.public.common.version' | translate}} {{version.version}}" ng-if="currentUser && currentUser.role == 'admin'" ng-click="versionModal()">
|
||||
<i class="fa fa-question-circle" aria-label="Version ?" ng-show="version.up_to_date"></i>
|
||||
<i class="fa fa-refresh pointer" aria-label="Upgrade required" ng-show="!version.up_to_date && !version.security"></i>
|
||||
<i class="fa fa-warning pointer" aria-label="Security upgrade required" ng-show="!version.up_to_date && version.security"></i>
|
||||
</span>
|
||||
<span class="text-sm">Powered by <a href="http://www.fab-manager.com" target="_blank">Fab Manager</a></span>
|
||||
</div>
|
||||
|
@ -123,6 +123,12 @@ en:
|
||||
|
||||
# Fab-manager's version
|
||||
version: "Version:"
|
||||
upgrade_fabmanager: "Upgrade Fab-Manager"
|
||||
current_version: "You are currently using version {VERSION} of Fab-Manager."
|
||||
upgrade_to: "A new release is available. You can upgrade up to version {VERSION}."
|
||||
read_more: "View the details of this release"
|
||||
security_version_html: "<strong>Your current version is vulnerable!</strong><br> A later version, currently available, includes security fixes. Upgrade as soon as possible!"
|
||||
how_to: "How to upgrade?
|
||||
|
||||
# Notifications
|
||||
and_NUMBER_other_notifications: "and {NUMBER, plural, =0{no other notifications} =1{one other notification} other{{NUMBER} other notifications}}..."
|
||||
|
@ -123,6 +123,12 @@ es:
|
||||
|
||||
# Fab-manager's version
|
||||
version: "Version:"
|
||||
upgrade_fabmanager: "Upgrade Fab-Manager"
|
||||
current_version: "You are currently using version {VERSION} of Fab-Manager."
|
||||
upgrade_to: "A new release is available. You can upgrade up to version {VERSION}."
|
||||
read_more: "View the details of this release"
|
||||
security_version_html: "<strong>Your current version is vulnerable!</strong><br> A later version, currently available, includes security fixes. Upgrade as soon as possible!"
|
||||
how_to: "How to upgrade?
|
||||
|
||||
# Notifications
|
||||
and_NUMBER_other_notifications: "y {NUMBER, plural, =0{no other notifications} =1{one other notification} otras{{NUMBER} other notifications}}..."
|
||||
|
@ -123,6 +123,12 @@ fr:
|
||||
|
||||
# Fab-manager's version
|
||||
version: "Version :"
|
||||
upgrade_fabmanager: "Mettez à jour Fab-Manager"
|
||||
current_version: "Vous utilisez actuellement la version {VERSION} de Fab-Manager."
|
||||
upgrade_to: "Une nouvelle version est disponible. Vous pouvez mettre à jour vers la version {VERSION}."
|
||||
read_more: "Voir les détails de cette version"
|
||||
security_version_html: "<strong>Votre version actuelle est vulnérable !</strong><br> Une version ultérieure, actuellement disponible, inclut des correctifs de sécurité. Mettez à jour dès que possible !"
|
||||
how_to: "Comment mettre à jour ?"
|
||||
|
||||
# Notifications
|
||||
and_NUMBER_other_notifications: "et {NUMBER, plural, =0{aucune autre notification} =1{une autre notification} other{{NUMBER} autres notifications}}..."
|
||||
|
@ -123,6 +123,12 @@ pt:
|
||||
|
||||
# Fab-manager's version
|
||||
version: "Versão:"
|
||||
upgrade_fabmanager: "Upgrade Fab-Manager"
|
||||
current_version: "You are currently using version {VERSION} of Fab-Manager."
|
||||
upgrade_to: "A new release is available. You can upgrade up to version {VERSION}."
|
||||
read_more: "View the details of this release"
|
||||
security_version_html: "<strong>Your current version is vulnerable!</strong><br> A later version, currently available, includes security fixes. Upgrade as soon as possible!"
|
||||
how_to: "How to upgrade?
|
||||
|
||||
# Notifications
|
||||
and_NUMBER_other_notifications: "and {NUMBER, plural, =0{no other notifications} =1{one other notification} other{{NUMBER} other notifications}}..."
|
||||
|
@ -12,7 +12,7 @@ class Version
|
||||
return unless hub_version
|
||||
|
||||
json = JSON.parse(hub_version)
|
||||
json['status']
|
||||
json['up_to_date']
|
||||
end
|
||||
|
||||
def self.check_and_schedule
|
||||
|
Loading…
x
Reference in New Issue
Block a user