Check plugins version
This commit is contained in:
parent
92c2682419
commit
762b3322b8
|
@ -510,7 +510,8 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
|
||||||
isEdit = me.appOptions.isEdit,
|
isEdit = me.appOptions.isEdit,
|
||||||
editor = me.editor;
|
editor = me.editor,
|
||||||
|
apiVersion = me.api.GetVersion();
|
||||||
if ( pluginsdata instanceof Array ) {
|
if ( pluginsdata instanceof Array ) {
|
||||||
var arr = [], arrUI = [],
|
var arr = [], arrUI = [],
|
||||||
lang = me.appOptions.lang.split(/[\-_]/)[0];
|
lang = me.appOptions.lang.split(/[\-_]/)[0];
|
||||||
|
@ -564,6 +565,9 @@ define([
|
||||||
if (typeof item.nameLocale == 'object')
|
if (typeof item.nameLocale == 'object')
|
||||||
name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
|
name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
|
||||||
|
|
||||||
|
if (pluginVisible)
|
||||||
|
pluginVisible = me.checkPluginVersion(apiVersion, item.minVersion);
|
||||||
|
|
||||||
arr.push(new Common.Models.Plugin({
|
arr.push(new Common.Models.Plugin({
|
||||||
name : name,
|
name : name,
|
||||||
guid: item.guid,
|
guid: item.guid,
|
||||||
|
@ -609,6 +613,25 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkPluginVersion: function(apiVersion, pluginVersion) {
|
||||||
|
if (apiVersion && apiVersion!=='develop' && pluginVersion && typeof pluginVersion == 'string') {
|
||||||
|
var res = pluginVersion.match(/^([0-9]+)(?:.([0-9]+))?(?:.([0-9]+))?$/),
|
||||||
|
apires = apiVersion.match(/^([0-9]+)(?:.([0-9]+))?(?:.([0-9]+))?$/);
|
||||||
|
if (res && res.length>1 && apires && apires.length>1) {
|
||||||
|
for (var i=0; i<3; i++) {
|
||||||
|
var pluginVer = res[i+1] ? parseInt(res[i+1]) : 0,
|
||||||
|
apiVer = apires[i+1] ? parseInt(apires[i+1]) : 0;
|
||||||
|
if (pluginVer>apiVer)
|
||||||
|
return false;
|
||||||
|
if (pluginVer<apiVer)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
getPlugins: function(pluginsData, fetchFunction) {
|
getPlugins: function(pluginsData, fetchFunction) {
|
||||||
if (!pluginsData || pluginsData.length<1)
|
if (!pluginsData || pluginsData.length<1)
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
|
|
Loading…
Reference in a new issue