mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
CommonJS (research/2)
This commit is contained in:
parent
56607de87c
commit
586abbb802
115 changed files with 16201 additions and 9943 deletions
87
dev/Admin/AdminSettingsAbout.js
Normal file
87
dev/Admin/AdminSettingsAbout.js
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Data = require('../Storages/AdminDataStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsAbout()
|
||||
{
|
||||
this.version = ko.observable(RL.settingsGet('Version'));
|
||||
this.access = ko.observable(!!RL.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
||||
this.coreReal = Data.coreReal;
|
||||
this.coreUpdatable = Data.coreUpdatable;
|
||||
this.coreAccess = Data.coreAccess;
|
||||
this.coreChecking = Data.coreChecking;
|
||||
this.coreUpdating = Data.coreUpdating;
|
||||
this.coreRemoteVersion = Data.coreRemoteVersion;
|
||||
this.coreRemoteRelease = Data.coreRemoteRelease;
|
||||
this.coreVersionCompare = Data.coreVersionCompare;
|
||||
|
||||
this.statusType = ko.computed(function () {
|
||||
|
||||
var
|
||||
sType = '',
|
||||
iVersionCompare = this.coreVersionCompare(),
|
||||
bChecking = this.coreChecking(),
|
||||
bUpdating = this.coreUpdating(),
|
||||
bReal = this.coreReal()
|
||||
;
|
||||
|
||||
if (bChecking)
|
||||
{
|
||||
sType = 'checking';
|
||||
}
|
||||
else if (bUpdating)
|
||||
{
|
||||
sType = 'updating';
|
||||
}
|
||||
else if (bReal && 0 === iVersionCompare)
|
||||
{
|
||||
sType = 'up-to-date';
|
||||
}
|
||||
else if (bReal && -1 === iVersionCompare)
|
||||
{
|
||||
sType = 'available';
|
||||
}
|
||||
else if (!bReal)
|
||||
{
|
||||
sType = 'error';
|
||||
this.errorDesc('Cannot access the repository at the moment.');
|
||||
}
|
||||
|
||||
return sType;
|
||||
|
||||
}, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsAbout, 'AdminSettingsAbout', 'About', 'about');
|
||||
|
||||
AdminSettingsAbout.prototype.onBuild = function ()
|
||||
{
|
||||
if (this.access())
|
||||
{
|
||||
RL.reloadCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsAbout.prototype.updateCoreData = function ()
|
||||
{
|
||||
if (!this.coreUpdating())
|
||||
{
|
||||
RL.updateCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsAbout;
|
||||
|
||||
}(module));
|
||||
Loading…
Add table
Add a link
Reference in a new issue