siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
111 lines (94 loc) • 3.6 kB
JavaScript
/*
Siesta 5.6.1
Copyright(c) 2009-2022 Bryntum AB
https://bryntum.com/contact
https://bryntum.com/products/siesta/license
*/
Ext.define('Siesta.Project.Browser.UI.VersionUpdateButton', {
extend : 'Ext.Button',
xtype : 'versionupdatebutton',
text : Siesta.Resource('Siesta.Project.Browser.UI.VersionUpdateButton', 'newUpdateText'),
action : 'upgrade-siesta',
hidden : true,
latestVersion : null,
scale : 'medium',
constructor : function () {
this.callParent(arguments);
this.scope = this;
if (Siesta.meta.VERSION) {
this.fetchVersionInfo();
}
},
fetchVersionInfo : function () {
Ext.data.JsonP.request({
url : 'https://bryntum.com/siesta_version',
params : { v : Siesta.meta.VERSION },
scope : this,
callback : this.onRequestCompleted
});
},
onRequestCompleted : function (success, data) {
if (success &&
data &&
data.name &&
new Ext.Version(data.name).isGreaterThan(Siesta.meta.VERSION || '1.0.0')) {
this.latestVersion = data.name;
this.show();
}
},
handler : function () {
var me = this;
var R = Siesta.Resource('Siesta.Project.Browser.UI.VersionUpdateButton');
var win = new Ext.Window({
cls : 'changelog-window',
title : R.get('updateWindowTitleText') + (Siesta.meta.VERSION || '1.0.0'),
modal : true,
width : 500,
height : 380,
closeAction : 'destroy',
plain : true,
autoScroll : true,
buttons : {
padding : '10 13',
style : 'background: transparent',
items : [
{
cls : 'light-button',
href : 'https://www.npmjs.com/package/siesta-lite',
hrefTarget : '_blank',
scale : 'medium',
text : R.get('downloadText') + this.latestVersion + R.get('liteText')
},
{
cls : 'light-button',
href : 'https://customerzone.bryntum.com',
hrefTarget : '_blank',
scale : 'medium',
text : R.get('downloadText') + this.latestVersion + R.get('standardText')
},
{
text : R.get('cancelText'),
scale : 'medium',
handler : function () {
win.close();
}
}
]
}
})
win.show();
win.body.mask(R.get('loadingChangelogText'));
Ext.Ajax.request({
useDefaultXhrHeader : false,
url : 'https://bryntum.com/changelogs/_siesta.php',
callback : function (o, success, response) {
win.body.unmask();
if (success && response && response.responseText) {
win.update(response.responseText);
} else {
win.update(Siesta.Resource('Siesta.Project.Browser.UI.VersionUpdateButton', 'changelogLoadFailedText'));
}
}
})
}
});