Customization plugins refactoring
This commit is contained in:
parent
bf8dafb914
commit
2e16e770e8
|
@ -467,13 +467,20 @@ define([
|
|||
},
|
||||
|
||||
applyUICustomization: function () {
|
||||
if ( this.customPluginsComplete && this.configPlugins.UIplugins ) {
|
||||
this.configPlugins.UIplugins.forEach(function (c) {
|
||||
if ( c.code ) eval(c.code);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
var me = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var timer_sl = setInterval(function() {
|
||||
if ( me.customPluginsComplete ) {
|
||||
clearInterval(timer_sl);
|
||||
try {
|
||||
me.configPlugins.UIplugins && me.configPlugins.UIplugins.forEach(function (c) {
|
||||
if ( c.code ) eval(c.code);
|
||||
});
|
||||
} catch (e) {}
|
||||
resolve();
|
||||
}
|
||||
}, 10);
|
||||
});
|
||||
},
|
||||
|
||||
parsePlugins: function(pluginsdata, uiCustomize) {
|
||||
|
@ -646,8 +653,9 @@ define([
|
|||
},
|
||||
|
||||
getAppCustomPlugins: function (plugins) {
|
||||
var me = this,
|
||||
funcComplete = function() {me.customPluginsComplete = true;};
|
||||
if ( plugins.config ) {
|
||||
var me = this;
|
||||
this.getPlugins(plugins.config.UIpluginsData)
|
||||
.then(function(loaded)
|
||||
{
|
||||
|
@ -662,20 +670,10 @@ define([
|
|||
item.code = text;
|
||||
return text;
|
||||
});
|
||||
}).then(function ()
|
||||
{
|
||||
me.customPluginsComplete = true;
|
||||
}).catch(function(err)
|
||||
{
|
||||
me.customPluginsComplete = true;
|
||||
});
|
||||
}).catch(function(err)
|
||||
{
|
||||
me.customPluginsComplete = true;
|
||||
});
|
||||
|
||||
}).then(funcComplete, funcComplete);
|
||||
}, funcComplete);
|
||||
} else
|
||||
this.customPluginsComplete = true;
|
||||
funcComplete();
|
||||
}
|
||||
}, Common.Controllers.Plugins || {}));
|
||||
});
|
||||
|
|
|
@ -1678,7 +1678,7 @@ define([
|
|||
},
|
||||
|
||||
hidePreloader: function() {
|
||||
var UICustomizationComplete = true;
|
||||
var promise;
|
||||
if (!this._state.customizationDone) {
|
||||
this._state.customizationDone = true;
|
||||
if (this.appOptions.customization) {
|
||||
|
@ -1690,21 +1690,17 @@ define([
|
|||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements);
|
||||
if (this.appOptions.canBrandingExt) {
|
||||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements);
|
||||
UICustomizationComplete = this.getApplication().getController('Common.Controllers.Plugins').applyUICustomization();
|
||||
promise = this.getApplication().getController('Common.Controllers.Plugins').applyUICustomization();
|
||||
}
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('layout:changed', 'main');
|
||||
|
||||
var me = this;
|
||||
var timer_sl = setInterval(function() {
|
||||
(!UICustomizationComplete) && (UICustomizationComplete = me.getApplication().getController('Common.Controllers.Plugins').applyUICustomization());
|
||||
if (UICustomizationComplete) {
|
||||
clearInterval(timer_sl);
|
||||
$('#loading-mask').hide().remove();
|
||||
Common.Controllers.Desktop.process('preloader:hide');
|
||||
}
|
||||
}, 10);
|
||||
(promise || (new Promise(function(resolve, reject) {
|
||||
resolve();
|
||||
}))).then(function() {
|
||||
$('#loading-mask').hide().remove();
|
||||
Common.Controllers.Desktop.process('preloader:hide');
|
||||
});
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url) {
|
||||
|
|
|
@ -1388,7 +1388,7 @@ define([
|
|||
},
|
||||
|
||||
hidePreloader: function() {
|
||||
var UICustomizationComplete = true;
|
||||
var promise;
|
||||
if (!this._state.customizationDone) {
|
||||
this._state.customizationDone = true;
|
||||
if (this.appOptions.customization) {
|
||||
|
@ -1400,21 +1400,17 @@ define([
|
|||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements);
|
||||
if (this.appOptions.canBrandingExt) {
|
||||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements);
|
||||
UICustomizationComplete = this.getApplication().getController('Common.Controllers.Plugins').applyUICustomization();
|
||||
promise = this.getApplication().getController('Common.Controllers.Plugins').applyUICustomization();
|
||||
}
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('layout:changed', 'main');
|
||||
|
||||
var me = this;
|
||||
var timer_sl = setInterval(function() {
|
||||
(!UICustomizationComplete) && (UICustomizationComplete = me.getApplication().getController('Common.Controllers.Plugins').applyUICustomization());
|
||||
if (UICustomizationComplete) {
|
||||
clearInterval(timer_sl);
|
||||
$('#loading-mask').hide().remove();
|
||||
Common.Controllers.Desktop.process('preloader:hide');
|
||||
}
|
||||
}, 10);
|
||||
(promise || (new Promise(function(resolve, reject) {
|
||||
resolve();
|
||||
}))).then(function() {
|
||||
$('#loading-mask').hide().remove();
|
||||
Common.Controllers.Desktop.process('preloader:hide');
|
||||
});
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url) {
|
||||
|
|
|
@ -1524,7 +1524,7 @@ define([
|
|||
},
|
||||
|
||||
hidePreloader: function() {
|
||||
var UICustomizationComplete = true;
|
||||
var promise;
|
||||
if (!this._state.customizationDone) {
|
||||
this._state.customizationDone = true;
|
||||
if (this.appOptions.customization) {
|
||||
|
@ -1536,21 +1536,19 @@ define([
|
|||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationElements);
|
||||
if (this.appOptions.canBrandingExt) {
|
||||
Common.Utils.applyCustomization(this.appOptions.customization, mapCustomizationExtElements);
|
||||
UICustomizationComplete = this.getApplication().getController('Common.Controllers.Plugins').applyUICustomization();
|
||||
promise = this.getApplication().getController('Common.Controllers.Plugins').applyUICustomization();
|
||||
}
|
||||
}
|
||||
|
||||
this.stackLongActions.pop({id: InitApplication, type: Asc.c_oAscAsyncActionType.BlockInteraction});
|
||||
Common.NotificationCenter.trigger('layout:changed', 'main');
|
||||
var me = this;
|
||||
var timer_sl = setInterval(function() {
|
||||
(!UICustomizationComplete) && (UICustomizationComplete = me.getApplication().getController('Common.Controllers.Plugins').applyUICustomization());
|
||||
if (UICustomizationComplete) {
|
||||
clearInterval(timer_sl);
|
||||
$('#loading-mask').hide().remove();
|
||||
Common.Controllers.Desktop.process('preloader:hide');
|
||||
}
|
||||
}, 10);
|
||||
|
||||
(promise || (new Promise(function(resolve, reject) {
|
||||
resolve();
|
||||
}))).then(function() {
|
||||
$('#loading-mask').hide().remove();
|
||||
Common.Controllers.Desktop.process('preloader:hide');
|
||||
});
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url) {
|
||||
|
|
Loading…
Reference in a new issue