mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -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,
|
loading: true,
|
||||||
versionCheck: null,
|
versionCheck: null,
|
||||||
|
|
||||||
upToDate: (function() {
|
upToDate: function() {
|
||||||
if (this.versionCheck) {
|
if (this.get('versionCheck')) {
|
||||||
return this.versionCheck.latest_version === this.versionCheck.installed_version;
|
return this.get('versionCheck.latest_version') === this.get('versionCheck.installed_version');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}).property('versionCheck'),
|
}.property('versionCheck'),
|
||||||
|
|
||||||
updateIconClasses: (function() {
|
updateIconClasses: function() {
|
||||||
var classes;
|
var classes;
|
||||||
classes = "icon icon-warning-sign ";
|
classes = "icon icon-warning-sign ";
|
||||||
if (this.get('versionCheck.critical_updates')) {
|
if (this.get('versionCheck.critical_updates')) {
|
||||||
|
@ -28,15 +28,21 @@
|
||||||
classes += "updates-available";
|
classes += "updates-available";
|
||||||
}
|
}
|
||||||
return classes;
|
return classes;
|
||||||
}).property('versionCheck'),
|
}.property('versionCheck.critical_updates'),
|
||||||
|
|
||||||
priorityClass: (function() {
|
priorityClass: function() {
|
||||||
if (this.get('versionCheck.critical_updates')) {
|
if (this.get('versionCheck.critical_updates')) {
|
||||||
return 'version-check critical';
|
return 'version-check critical';
|
||||||
}
|
}
|
||||||
return 'version-check normal';
|
}.property('versionCheck.critical_updates'),
|
||||||
}).property('versionCheck')
|
|
||||||
|
|
||||||
|
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);
|
}).call(this);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Discourse.VersionCheck.reopenClass({
|
Discourse.VersionCheck.reopenClass({
|
||||||
find: function() {
|
find: function() {
|
||||||
var promise = new RSVP.Promise()
|
var promise = new RSVP.Promise();
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: '/admin/version_check',
|
url: '/admin/version_check',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span>
|
{{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">
|
<span class="version-notes">
|
||||||
{{#if upToDate }}
|
{{#if upToDate }}
|
||||||
|
|
|
@ -87,10 +87,10 @@
|
||||||
margin-left: 24px;
|
margin-left: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.critical .version-notes .normal-note {
|
&.critical .version-notes .normal-note {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.normal .version-notes .critical-note {
|
&.normal .version-notes .critical-note {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class DiscourseVersionCheck
|
||||||
include ActiveAttr::MassAssignment
|
include ActiveAttr::MassAssignment
|
||||||
include ActiveModel::Serialization
|
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
|
def active_model_serializer
|
||||||
DiscourseVersionCheckSerializer
|
DiscourseVersionCheckSerializer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DiscourseVersionCheckSerializer < ApplicationSerializer
|
class DiscourseVersionCheckSerializer < ApplicationSerializer
|
||||||
attributes :latest_version, :installed_version, :critical_updates
|
attributes :latest_version, :critical_updates, :installed_version, :installed_sha
|
||||||
|
|
||||||
self.root = false
|
self.root = false
|
||||||
end
|
end
|
|
@ -5,8 +5,9 @@ module DiscourseUpdates
|
||||||
def check_version
|
def check_version
|
||||||
DiscourseVersionCheck.new(
|
DiscourseVersionCheck.new(
|
||||||
latest_version: latest_version || Discourse::VERSION::STRING,
|
latest_version: latest_version || Discourse::VERSION::STRING,
|
||||||
|
critical_updates: critical_update_available?,
|
||||||
installed_version: Discourse::VERSION::STRING,
|
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
|
# TODO: more info, like links and release messages
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue