mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Check for updates: edge cases when the message on the dashboard doesn't make sense.
This commit is contained in:
@@ -7,6 +7,21 @@
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.VersionCheck = Discourse.Model.extend({
|
||||
|
||||
noCheckPerformed: function() {
|
||||
return this.get('updated_at') === null;
|
||||
}.property('updated_at'),
|
||||
|
||||
dataIsOld: function() {
|
||||
return moment().diff(moment(this.get('updated_at')), 'hours') >= 48;
|
||||
}.property('updated_at'),
|
||||
|
||||
staleData: function() {
|
||||
return ( this.get('dataIsOld') ||
|
||||
(this.get('installed_version') !== this.get('latest_version') && this.get('missing_versions_count') === 0) ||
|
||||
(this.get('installed_version') === this.get('latest_version') && this.get('missing_versions_count') !== 0) );
|
||||
}.property('dataIsOld', 'missing_versions_count', 'installed_version', 'latest_version'),
|
||||
|
||||
upToDate: function() {
|
||||
return this.get('missing_versions_count') === 0 || this.get('missing_versions_count') === null;
|
||||
}.property('missing_versions_count'),
|
||||
|
||||
@@ -49,29 +49,50 @@
|
||||
<tbody>
|
||||
<td class="title">{{i18n admin.dashboard.version}}</td>
|
||||
<td class="version-number"><a {{bindAttr href="versionCheck.gitLink"}} target="_blank">{{ versionCheck.installed_version }}</a></td>
|
||||
<td class="version-number">{{ versionCheck.latest_version }}</td>
|
||||
<td class="face">
|
||||
{{#if versionCheck.upToDate }}
|
||||
<span class='icon update-to-date'>☻</span>
|
||||
|
||||
{{#if versionCheck.noCheckPerformed}}
|
||||
<td class="version-number"> </td>
|
||||
<td class="face">
|
||||
<span class="icon critical-updates-available">☹</span>
|
||||
</td>
|
||||
<td class="version-notes">
|
||||
<span class="normal-note">{{i18n admin.dashboard.no_check_performed}}</span>
|
||||
</td>
|
||||
{{else}}
|
||||
{{#if versionCheck.staleData}}
|
||||
<td class="version-number"> </td>
|
||||
<td class="face">
|
||||
<span class="icon critical-updates-available">☹</span>
|
||||
</td>
|
||||
<td class="version-notes">
|
||||
<span class="normal-note">{{i18n admin.dashboard.stale_data}}</span>
|
||||
</td>
|
||||
{{else}}
|
||||
<span {{bindAttr class=":icon versionCheck.critical_updates:critical-updates-available:updates-available"}}>
|
||||
{{#if versionCheck.behindByOneVersion}}
|
||||
☺
|
||||
<td class="version-number">{{ versionCheck.latest_version }}</td>
|
||||
<td class="face">
|
||||
{{#if versionCheck.upToDate }}
|
||||
<span class='icon update-to-date'>☻</span>
|
||||
{{else}}
|
||||
☹
|
||||
<span {{bindAttr class=":icon versionCheck.critical_updates:critical-updates-available:updates-available"}}>
|
||||
{{#if versionCheck.behindByOneVersion}}
|
||||
☺
|
||||
{{else}}
|
||||
☹
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
</span>
|
||||
</td>
|
||||
<td class="version-notes">
|
||||
{{#if versionCheck.upToDate }}
|
||||
{{i18n admin.dashboard.up_to_date}}
|
||||
{{else}}
|
||||
<span class="critical-note">{{i18n admin.dashboard.critical_available}}</span>
|
||||
<span class="normal-note">{{i18n admin.dashboard.updates_available}}</span>
|
||||
{{i18n admin.dashboard.please_upgrade}}
|
||||
{{/if}}
|
||||
</td>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="version-notes">
|
||||
{{#if versionCheck.upToDate }}
|
||||
{{i18n admin.dashboard.up_to_date}}
|
||||
{{else}}
|
||||
<span class="critical-note">{{i18n admin.dashboard.critical_available}}</span>
|
||||
<span class="normal-note">{{i18n admin.dashboard.updates_available}}</span>
|
||||
{{i18n admin.dashboard.please_upgrade}}
|
||||
{{/if}}
|
||||
</td>
|
||||
{{/if}}
|
||||
</tbody>
|
||||
{{/unless}}
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user