Added Admin Panel About Tab

New update system for main code (About tab)
This commit is contained in:
RainLoop Team 2014-05-22 05:08:47 +04:00
parent b6a06d74a9
commit e63037d7e2
27 changed files with 978 additions and 625 deletions

View file

@ -5,12 +5,72 @@
*/
function AdminAbout()
{
var oData = RL.data();
this.version = ko.observable(RL.settingsGet('Version'));
this.access = ko.observable(!!RL.settingsGet('CoreAccess'));
this.errorDesc = ko.observable('');
this.coreReal = oData.coreReal;
this.coreUpdatable = oData.coreUpdatable;
this.coreAccess = oData.coreAccess;
this.coreChecking = oData.coreChecking;
this.coreUpdating = oData.coreUpdating;
this.coreRemoteVersion = oData.coreRemoteVersion;
this.coreRemoteRelease = oData.coreRemoteRelease;
this.coreVersionCompare = oData.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);
}
Utils.addSettingsViewModel(AdminAbout, 'AdminSettingsAbout', 'About', 'about');
//AdminAbout.prototype.onBuild = function ()
//{
//
//};
AdminAbout.prototype.onBuild = function ()
{
if (this.access())
{
RL.reloadCoreData();
}
};
AdminAbout.prototype.updateCoreData = function ()
{
if (!this.coreUpdating())
{
RL.updateCoreData();
}
};

View file

@ -102,28 +102,28 @@ AdminApp.prototype.reloadPackagesList = function ()
{
RL.data().packagesLoading(true);
RL.data().packagesReal(true);
RL.remote().packagesList(function (sResult, oData) {
RL.data().packagesLoading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
RL.data().packagesReal(!!oData.Result.Real);
RL.data().packagesMainUpdatable(!!oData.Result.MainUpdatable);
var
var
aList = [],
aLoading = {}
;
_.each(RL.data().packages(), function (oItem) {
if (oItem && oItem['loading']())
{
aLoading[oItem['file']] = oItem;
}
});
if (Utils.isArray(oData.Result.List))
{
aList = _.compact(_.map(oData.Result.List, function (oItem) {
@ -145,6 +145,61 @@ AdminApp.prototype.reloadPackagesList = function ()
});
};
AdminApp.prototype.updateCoreData = function ()
{
var oRainData = RL.data();
oRainData.coreUpdating(true);
RL.remote().updateCoreData(function (sResult, oData) {
oRainData.coreUpdating(false);
oRainData.coreRemoteVersion('');
oRainData.coreRemoteRelease('');
oRainData.coreVersionCompare(-2);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
oRainData.coreReal(true);
window.location.reload();
}
else
{
oRainData.coreReal(false);
}
});
};
AdminApp.prototype.reloadCoreData = function ()
{
var oRainData = RL.data();
oRainData.coreChecking(true);
oRainData.coreReal(true);
RL.remote().coreData(function (sResult, oData) {
oRainData.coreChecking(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
oRainData.coreReal(!!oData.Result.Real);
oRainData.coreUpdatable(!!oData.Result.Updatable);
oRainData.coreAccess(!!oData.Result.Access);
oRainData.coreRemoteVersion(oData.Result.RemoteVersion || '');
oRainData.coreRemoteRelease(oData.Result.RemoteRelease || '');
oRainData.coreVersionCompare(Utils.pInt(oData.Result.VersionCompare));
}
else
{
oRainData.coreReal(false);
oRainData.coreRemoteVersion('');
oRainData.coreRemoteRelease('');
oRainData.coreVersionCompare(-2);
}
});
};
/**
*
* @param {boolean=} bForce = false
@ -163,7 +218,7 @@ AdminApp.prototype.reloadLicensing = function (bForce)
RL.data().licenseValid(true);
RL.data().licenseExpired(Utils.pInt(oData.Result['Expired']));
RL.data().licenseError('');
RL.data().licensing(true);
}
else
@ -212,8 +267,8 @@ AdminApp.prototype.bootstart = function ()
}
else
{
Utils.removeSettingsViewModel(AdminAbout);
// Utils.removeSettingsViewModel(AdminAbout);
if (!RL.capa(Enums.Capa.Prem))
{
Utils.removeSettingsViewModel(AdminBranding);

View file

@ -16,7 +16,5 @@ _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
AdminSettingsScreen.prototype.onShow = function ()
{
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle('');
};

View file

@ -23,8 +23,6 @@ _.extend(SettingsScreen.prototype, AbstractSettings.prototype);
SettingsScreen.prototype.onShow = function ()
{
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle(this.sSettingsTitle);
RL.data().keyScope(Enums.KeyState.Settings);
};

View file

@ -7,7 +7,7 @@
function AdminAjaxRemoteStorage()
{
AbstractAjaxRemoteStorage.call(this);
this.oRequests = {};
}
@ -67,6 +67,22 @@ AdminAjaxRemoteStorage.prototype.packagesList = function (fCallback)
this.defaultRequest(fCallback, 'AdminPackagesList');
};
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.coreData = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminCoreData');
};
/**
* @param {?Function} fCallback
*/
AdminAjaxRemoteStorage.prototype.updateCoreData = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
};
/**
* @param {?Function} fCallback
* @param {Object} oPackage

View file

@ -7,24 +7,33 @@
function AdminDataStorage()
{
AbstractData.call(this);
this.domainsLoading = ko.observable(false).extend({'throttle': 100});
this.domains = ko.observableArray([]);
this.pluginsLoading = ko.observable(false).extend({'throttle': 100});
this.plugins = ko.observableArray([]);
this.packagesReal = ko.observable(true);
this.packagesMainUpdatable = ko.observable(true);
this.packagesLoading = ko.observable(false).extend({'throttle': 100});
this.packages = ko.observableArray([]);
this.coreReal = ko.observable(true);
this.coreUpdatable = ko.observable(true);
this.coreAccess = ko.observable(true);
this.coreChecking = ko.observable(false).extend({'throttle': 100});
this.coreUpdating = ko.observable(false).extend({'throttle': 100});
this.coreRemoteVersion = ko.observable('');
this.coreRemoteRelease = ko.observable('');
this.coreVersionCompare = ko.observable(-2);
this.licensing = ko.observable(false);
this.licensingProcess = ko.observable(false);
this.licenseValid = ko.observable(false);
this.licenseExpired = ko.observable(0);
this.licenseError = ko.observable('');
this.licenseTrigger = ko.observable(false);
this.adminManLoading = ko.computed(function () {

View file

@ -1,101 +1,102 @@
.b-admin-left {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px 0 0 @rlLowMargin;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin + 10px;
bottom: @rlLowMargin;
left: 0;
right: 0;
overflow: hidden;
.content {
-webkit-overflow-scrolling: touch;
}
}
}
.b-admin-menu {
.e-item {
overflow: hidden;
text-decoration: none;
outline: 0;
}
.e-link {
position: relative;
display: block;
height: 30px;
line-height: 29px;
cursor: pointer;
font-size: 18px;
z-index: 1;
cursor: default;
background-color: transparent;
color: #888;
padding: 4px 10px;
outline: 0;
text-decoration: none;
}
.e-item.selectable .e-link {
cursor: pointer;
}
.e-item.selectable {
&:hover .e-link, &.selected .e-link {
background-color: #555;
color: #fff;
}
}
}
.b-admin-right {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px @rlLowMargin;
color: #fff;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin;
bottom: @rlLowMargin;
left: 0;
right: @rlLowMargin;
overflow-y: auto;
z-index: 2;
background-color: #fff;
border: @rlMainBorderSize solid @rlMainDarkColor;
.box-shadow(@rlMainShadow);
.border-radius(@rlMainBorderRadius);
.content {
-webkit-overflow-scrolling: touch;
}
}
.b-settings-content {
padding: 20px;
}
}
.b-admin-left {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px 0 0 @rlLowMargin;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin + 10px;
bottom: @rlLowMargin;
left: 0;
right: 0;
overflow: hidden;
.content {
-webkit-overflow-scrolling: touch;
}
}
}
.b-admin-menu {
.e-item {
overflow: hidden;
text-decoration: none;
outline: 0;
}
.e-link {
position: relative;
display: block;
height: 30px;
line-height: 29px;
cursor: pointer;
font-size: 18px;
z-index: 1;
cursor: default;
background-color: transparent;
color: #888;
padding: 4px 10px;
outline: 0;
text-decoration: none;
}
.e-item.selectable .e-link {
cursor: pointer;
}
.e-item.selectable {
&:hover .e-link, &.selected .e-link {
background-color: #555;
color: #fff;
}
}
}
.b-admin-right {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px @rlLowMargin;
color: #fff;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin;
bottom: @rlLowMargin;
left: 0;
right: @rlLowMargin;
overflow-y: auto;
z-index: 2;
background-color: #fff;
border: @rlMainBorderSize solid @rlMainDarkColor;
.box-shadow(@rlMainShadow);
.border-radius(@rlMainBorderRadius);
.content {
-webkit-overflow-scrolling: touch;
}
}
.b-settings-content {
padding: 20px;
padding-left: 30px;
}
}

View file

@ -4,7 +4,13 @@
display: inline-block;
width: 250px;
height: 250px;
margin-top: -10px;
margin-bottom: -10px;
background-image: url("images/rainloop-logo.png");
}
.rl-desc {
margin-top: 20px;
margin-left: -20px;
}
}

View file

@ -1,99 +1,100 @@
.b-settins-left {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px 0 0 @rlLowMargin;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin + 10px;
bottom: @rlLowMargin;
left: 0;
right: 0;
overflow: hidden;
.content {
-webkit-overflow-scrolling: touch;
}
}
}
.b-settings-menu {
.e-item {
overflow: hidden;
text-decoration: none;
outline: 0;
}
.e-link {
position: relative;
display: block;
height: 30px;
line-height: 29px;
font-size: 18px;
z-index: 1;
cursor: default;
background-color: transparent;
color: #888;
padding: 4px 10px;
outline: 0;
text-decoration: none;
}
.e-item.selectable .e-link {
cursor: pointer;
}
.e-item.selectable {
&:hover .e-link, &.selected .e-link {
background-color: #555;
color: #fff;
}
}
}
.b-settins-right {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px 5px;
color: #fff;
}
.b-content {
position: absolute;
top: 50px;
bottom: @rlLowMargin;
left: 0;
right: @rlLowMargin;
overflow-y: auto;
z-index: 2;
background-color: #fff;
border: @rlMainBorderSize solid @rlMainDarkColor;
.box-shadow(@rlMainShadow);
.border-radius(@rlMainBorderRadius);
.content {
-webkit-overflow-scrolling: touch;
}
}
.b-settings-content {
padding: 20px;
}
}
.b-settins-left {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px 0 0 @rlLowMargin;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin + 10px;
bottom: @rlLowMargin;
left: 0;
right: 0;
overflow: hidden;
.content {
-webkit-overflow-scrolling: touch;
}
}
}
.b-settings-menu {
.e-item {
overflow: hidden;
text-decoration: none;
outline: 0;
}
.e-link {
position: relative;
display: block;
height: 30px;
line-height: 29px;
font-size: 18px;
z-index: 1;
cursor: default;
background-color: transparent;
color: #888;
padding: 4px 10px;
outline: 0;
text-decoration: none;
}
.e-item.selectable .e-link {
cursor: pointer;
}
.e-item.selectable {
&:hover .e-link, &.selected .e-link {
background-color: #555;
color: #fff;
}
}
}
.b-settins-right {
.b-toolbar {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 34px;
padding: 8px 5px;
color: #fff;
}
.b-content {
position: absolute;
top: 50px;
bottom: @rlLowMargin;
left: 0;
right: @rlLowMargin;
overflow-y: auto;
z-index: 2;
background-color: #fff;
border: @rlMainBorderSize solid @rlMainDarkColor;
.box-shadow(@rlMainShadow);
.border-radius(@rlMainBorderRadius);
.content {
-webkit-overflow-scrolling: touch;
}
}
.b-settings-content {
padding: 20px;
padding-left: 30px;
}
}