mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Show which SHA is installed on the admin dashboard
This commit is contained in:
parent
1e794f98a7
commit
8620024798
7 changed files with 27 additions and 19 deletions
|
@ -12,14 +12,14 @@
|
|||
loading: true,
|
||||
versionCheck: null,
|
||||
|
||||
upToDate: (function() {
|
||||
if (this.versionCheck) {
|
||||
return this.versionCheck.latest_version === this.versionCheck.installed_version;
|
||||
upToDate: function() {
|
||||
if (this.get('versionCheck')) {
|
||||
return this.get('versionCheck.latest_version') === this.get('versionCheck.installed_version');
|
||||
}
|
||||
return true;
|
||||
}).property('versionCheck'),
|
||||
}.property('versionCheck'),
|
||||
|
||||
updateIconClasses: (function() {
|
||||
updateIconClasses: function() {
|
||||
var classes;
|
||||
classes = "icon icon-warning-sign ";
|
||||
if (this.get('versionCheck.critical_updates')) {
|
||||
|
@ -28,15 +28,21 @@
|
|||
classes += "updates-available";
|
||||
}
|
||||
return classes;
|
||||
}).property('versionCheck'),
|
||||
}.property('versionCheck.critical_updates'),
|
||||
|
||||
priorityClass: (function() {
|
||||
priorityClass: function() {
|
||||
if (this.get('versionCheck.critical_updates')) {
|
||||
return 'version-check critical';
|
||||
}
|
||||
return 'version-check normal';
|
||||
}).property('versionCheck')
|
||||
}.property('versionCheck.critical_updates'),
|
||||
|
||||
gitLink: function() {
|
||||
return "https://github.com/discourse/discourse/tree/" + this.get('versionCheck.installed_sha');
|
||||
}.property('versionCheck.installed_sha'),
|
||||
|
||||
shortSha: function() {
|
||||
return this.get('versionCheck.installed_sha').substr(0,10);
|
||||
}.property('versionCheck.installed_sha')
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Discourse.VersionCheck.reopenClass({
|
||||
find: function() {
|
||||
var promise = new RSVP.Promise()
|
||||
var promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
url: '/admin/version_check',
|
||||
dataType: 'json',
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
{{else}}
|
||||
{{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span>
|
||||
|
||||
{{log versionCheck}}
|
||||
|
||||
{{#if versionCheck.installed_sha}}
|
||||
<span class="git-version">(<a {{bindAttr href="gitLink"}} target="_blank">{{shortSha}}</a>)</span>
|
||||
{{/if}}
|
||||
|
||||
<span class="version-notes">
|
||||
{{#if upToDate }}
|
||||
|
|
|
@ -87,10 +87,10 @@
|
|||
margin-left: 24px;
|
||||
}
|
||||
|
||||
.critical .version-notes .normal-note {
|
||||
&.critical .version-notes .normal-note {
|
||||
display: none;
|
||||
}
|
||||
.normal .version-notes .critical-note {
|
||||
&.normal .version-notes .critical-note {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class DiscourseVersionCheck
|
|||
include ActiveAttr::MassAssignment
|
||||
include ActiveModel::Serialization
|
||||
|
||||
attr_accessor :latest_version, :installed_version, :critical_updates
|
||||
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha
|
||||
|
||||
def active_model_serializer
|
||||
DiscourseVersionCheckSerializer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DiscourseVersionCheckSerializer < ApplicationSerializer
|
||||
attributes :latest_version, :installed_version, :critical_updates
|
||||
attributes :latest_version, :critical_updates, :installed_version, :installed_sha
|
||||
|
||||
self.root = false
|
||||
end
|
|
@ -5,8 +5,9 @@ module DiscourseUpdates
|
|||
def check_version
|
||||
DiscourseVersionCheck.new(
|
||||
latest_version: latest_version || Discourse::VERSION::STRING,
|
||||
critical_updates: critical_update_available?,
|
||||
installed_version: Discourse::VERSION::STRING,
|
||||
critical_updates: critical_update_available?
|
||||
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version)
|
||||
# TODO: more info, like links and release messages
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue