discourse/app/assets/javascripts/admin/addon/models/version-check.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-11-08 14:13:35 -05:00
import EmberObject from "@ember/object";
2016-06-30 13:55:44 -04:00
import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse-common/utils/decorators";
2016-08-03 10:13:02 -04:00
2019-11-08 14:13:35 -05:00
const VersionCheck = EmberObject.extend({
@discourseComputed("updated_at")
2016-08-03 10:13:02 -04:00
noCheckPerformed(updatedAt) {
return updatedAt === null;
},
@discourseComputed("missing_versions_count")
2016-08-03 10:13:02 -04:00
upToDate(missingVersionsCount) {
return missingVersionsCount === 0 || missingVersionsCount === null;
},
@discourseComputed("missing_versions_count")
2016-08-03 10:13:02 -04:00
behindByOneVersion(missingVersionsCount) {
return missingVersionsCount === 1;
},
@discourseComputed("installed_sha")
gitLink(installedSHA) {
if (installedSHA) {
return `https://github.com/discourse/discourse/commits/${installedSHA}`;
2016-08-03 10:13:02 -04:00
}
},
@discourseComputed("installed_sha")
2016-08-03 10:13:02 -04:00
shortSha(installedSHA) {
if (installedSHA) {
return installedSHA.slice(0, 10);
}
2016-08-03 10:13:02 -04:00
},
});
VersionCheck.reopenClass({
2016-08-03 10:13:02 -04:00
find() {
return ajax("/admin/version_check").then((json) =>
VersionCheck.create(json)
);
},
});
export default VersionCheck;