Plugins in Cockpit 7.5-alpha

Hey guys.

I encounter problems with existing plugins which worked fine on 7.4.x but cause errors on 7.5 (alpha1 or alpha2).

E.g. this line here: https://github.com/camunda/camunda-consulting/blob/master/snippets/cockpit-plugin-reporting/src/main/resources/plugin-webapp/reporting-process-count/app/plugin.js#L167:
$('#lineChart').highcharts({

causes a JavaScript error:

ReferenceError: $ is not defined
    at printStartedInstances (plugin.js:167)
    at plugin.js:10
    at camunda-cockpit-ui.js:2
    at k (camunda-cockpit-ui.js:2)
    at k (camunda-cockpit-ui.js:2)
    at camunda-cockpit-ui.js:2
    at k.$eval (camunda-cockpit-ui.js:3)
    at k.$digest (camunda-cockpit-ui.js:3)
    at k.$apply (camunda-cockpit-ui.js:3)
    at i (camunda-cockpit-ui.js:2)

Any ideas?

Cheers
Bernd

Yep, very likely due to the change from requirejs to browserify, $ a.k.a. jQuery is not available on the window object.
If you replace $('#lineChart') by jQuery('#lineChart') it should work again.

Cheers!

Hi Vale.

Will this be mentioned in the release notes (and is it unavoidable)? I think this might break a lot of plugins.

Cheers
Bernd

PS: With this change - does it still work on < 7.5?

If you do the replacement from $ to jQuery, it should still work (I had a quick check in a previous distro).

I believe it should be mentionned we could easily fix that by adding something like that

window.$ = jQuery;
// or
window.$ = jQuery.noConflict();

but it should be discussed a bit further I think

We didn’t implicitly added the $ (jQuery) variable to the window object… it is, historically (good’ol times), the way jQuery bound itself…

maybe this would help you to make it 7.5 and 7.4 compatible?

if(!window.$)
{
    if(jquery)
    {
        window.$ = jquery;
    }
    else
    {
        alert("no jquery!");
    }
 }

or the other way around :slight_smile: always use jquery(...) and put window.jquery on it if not defined …

https://app.camunda.com/jira/browse/CAM-5649

This should do the trick

Great – thanks!

Von: Valentin Vago [mailto:forum@camunda.com]

Gesendet: Donnerstag, 24. März 2016 08:59

An: Bernd Rücker <bernd.ruecker@camunda.com>

Betreff: [Camunda BPM Forum] [Cockpit / Tasklist / Admin & Web] Plugins in Cockpit 7.5-alpha

vale

March 24

This should do the trick

github.com/camunda/camunda-bpm-webapp

zeropaper

fix(missing-jQuery): expose jQuery and $ on the window

and load placeholders polyfill when jQuery is available

Related to CAM-5680

by zeropaper on 07:35AM - 24 Mar 16

changed 6 files with 57 additions and 28 deletions.


Visit Topic or reply to this email to respond.

To stop receiving notifications for this particular topic, click here. To unsubscribe from these emails, change your user preferences