PK DaO# ! Squirro/SquirroApp/Definition.xml
PK F~de " Squirro/SquirroApp/Properties.qvpp
Server Url
Project ID
Query
ID Field
Extension version: 2.1.5-20150618
PK F- ' Squirro/SquirroApp/Properties.qvpp.vbak
Server Url
Project ID
Query
ID Field
Extension version: {__VERSION__}
PK ÄfD}/ Squirro/SquirroApp/script.jsfunction squirro_init() {
var squirros = {};
Qv.AddExtension('Squirro/SquirroApp', function () {
try {
if (squirros[this.Name]) {
squirros[this.Name].render(this);
} else {
squirros[this.Name] = new SquirroApp_Widget(this);
}
} catch (e) {
if (console) {
console.log(e);
}
}
});
}
var libs = [
'Extensions/Squirro/SquirroApp/squirro-app.js'
];
Qv.LoadExtensionScripts(libs, squirro_init);
Qva.LoadCSS(Qva.Remote + (Qva.Remote.indexOf('?') >= 0 ? '&' : '?') + 'public=only&name=Extensions/Squirro/SquirroApp/squirro-app.css');
PK ÄfDFPp p " Squirro/SquirroApp/squirro-app.css.squirro-app, .squirro-app iframe {
width: 100%;
height: 100%;
}
.squirro-app iframe {
border: 0;
}
PK D22 ! Squirro/SquirroApp/squirro-app.js/**
* Property Mapping:
* Layout.Text0 URL
**/
function SquirroApp_Widget(qv) {
this.qv = qv;
this.$qv = $(qv.Element);
this.DEBUG = false;
this.render(qv);
}
SquirroApp_Widget.prototype.render = function (qv) {
if (qv && this.qv !== qv) {
// Re-render if it's a new QV context…
this.el = null;
this.qv = qv;
this.$qv = $(qv.Element);
}
this._getUrl()
.done($.proxy(this._renderIFrame, this));
if (! this.listensForMessages) {
$(window).on('message', $.proxy(function (e) {
var ev = e.originalEvent;
this._getUrl()
.done($.proxy(function (url) {
// We process only origin events.
if (ev.origin === this.url) {
if (this.query !== ev.data.query || ev.data.created_before || ev.data.created_after) {
Qv.GetCurrentDocument().Clear();
this.qv.Data.SelectTextsInColumn(0, false, ev.data.items);
}
}
}, this));
}, this));
this.listensForMessages = true;
}
};
SquirroApp_Widget.prototype._renderIFrame = function (url) {
var params = this._getParams();
if (! this.el || this.url !== url || this.query !== params.query) {
var fullUrl = [
url,
'/app/qv/full#reader/',
params.project_id,
'?q=',
encodeURIComponent(params.query || '')
].join('');
this.el = $('');
this.$qv.html(this.el);
this.$el = $(this.el);
this.url = url;
this.query = params.query;
}
};
/**
* Returns a promise that will resolve the the last verified url.
*
* @return {Promise} Will resolve to the last verified url.
*/
SquirroApp_Widget.prototype._getUrl = function () {
var that = this,
deferred = $.Deferred(),
params = this._getParams();
if (params.verified_url === params.cluster_url) {
deferred.resolve(params.verified_url);
} else {
// Server URL has changed, validate it
this._validateUrl(params.cluster_url)
.done(function () {
// Server is alive, set verified URL
that.qv.Layout.Text1.text = params.cluster_url;
that.qv.Layout.SetProperty('Chart.Text.1.Content',
params.cluster_url);
deferred.resolve(params.cluster_url);
})
.fail(function () {
deferred.reject('Could not verify URL');
});
}
return deferred.promise();
};
/**
* Returns the extension's configuration.
*/
SquirroApp_Widget.prototype._getParams = function () {
var url = this._getValue(0),
len = url.length - 1;
if (url[len] === '/') {
url = url.substr(0, len);
}
return {
cluster_url: url,
verified_url: this._getValue(1),
project_id: this._getValue(2),
query: this._getValue(3) || ''
};
};
/**
* Returns configuration options of a given index.
*/
SquirroApp_Widget.prototype._getValue = function (idx) {
var data = this.qv.Layout['Text' + idx],
retval = null;
if (data && data.text && data.text !== '-') {
retval = $.trim(data.text);
}
return retval;
};
SquirroApp_Widget.prototype._validateUrl = function (url) {
return $.ajax({
url: url + '/app/bulk/iframe_isalive',
type: 'GET',
dataType: 'jsonp',
jsonp: false, // Do not add ?callback to the URL
jsonpCallback: 'jsonp',
timeout: 5000
});
};
PK DaO# ! Squirro/SquirroApp/Definition.xmlPK F~de "
Squirro/SquirroApp/Properties.qvppPK F- ' 8
Squirro/SquirroApp/Properties.qvpp.vbakPK ÄfD}/ j Squirro/SquirroApp/script.jsPK ÄfDFPp p " H Squirro/SquirroApp/squirro-app.cssPK D22 ! Squirro/SquirroApp/squirro-app.jsPK =*