diff --git a/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/commons/js/utils/utils.js b/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/commons/js/utils/utils.js index e7e27089102..cac1b3d727a 100644 --- a/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/commons/js/utils/utils.js +++ b/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/commons/js/utils/utils.js @@ -1,8 +1,8 @@ /** * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 */ -define(['require', 'jquery', 'constants'], - function (require, $, Constants) { +define(['require', 'jquery', 'constants', 'alerts'], + function (require, $, Constants, alerts) { var self = this; var Utils = function () { }; @@ -16,109 +16,6 @@ define(['require', 'jquery', 'constants'], editorUrl: window.location.protocol + "//" + window.location.host + '/editor' }; - // /** - // * getting extension data from back end. - // * @returns {Map|Map} - // */ - // function getExtensionDetails() { // TODO remove - // return new Map(Object.entries({})); - // - // - // - // - // // return new Map(Object.entries({ - // // "kafka": { - // // "extensionStatus": "NOT_INSTALLED", - // // "extensionInfo": { - // // "name": "kafka", - // // "version": "5.0.8-SNAPSHOT" - // // } - // // }, - // // "redis": { - // // "extensionStatus": "NOT_INSTALLED", - // // "extensionInfo": { - // // "name": "redis", - // // "version": "3.1.2-SNAPSHOT" - // // }, - // // "manuallyInstall": [ - // // { - // // "name": "redis-clients", - // // "version": "2.3.0", - // // "download": { - // // "info": { - // // "description": "redis clients is like a one extension", - // // "install": "by using this way we can install redis-clients" - // // }, - // // "autoDownloadable": false, - // // "url": "https://repo1.maven.org/maven2/org/apache/redis/redis_2.11/2.1.1/redis_2.11-2.1.1.jar" - // // }, - // // "type": "BUNDLE", - // // "lookupRegex": "kafka-clients-(.+).jar" - // // }, - // // { - // // "name": "redis-server", - // // "version": "2.3.0", - // // "download": { - // // "info": { - // // "description": "redis clients is like a one extension", - // // "install": "by using this way we can install redis-clients" - // // }, - // // "autoDownloadable": false, - // // "url": "https://repo1.maven.org/maven2/org/apache/redis/redis_2.11/2.1.1/kafka_2.11-2.1.1.jar" - // // }, - // // "type": "BUNDLE", - // // "lookupRegex": "kafka-server-(.+).jar" - // // } - // // ] - // // }, - // // "grpc": { - // // "extensionStatus": "NOT_INSTALLED", - // // "extensionInfo": { - // // "name": "grpc", - // // "version": "3.1.2-SNAPSHOT" - // // }, - // // "manuallyInstall": [ - // // { - // // "name": "grpc-clients", - // // "version": "2.3.0", - // // "download": { - // // "info": { - // // "description": "grpc clients is like a one extension", - // // "install": "by using this way we can install grpc-clients" - // // }, - // // "autoDownloadable": false, - // // "url": "https://repo1.maven.org/maven2/org/apache/grpc/grpc_2.11/2.1.1/grpc_2.11-2.1.1.jar" - // // }, - // // "type": "BUNDLE", - // // "lookupRegex": "grpc-clients-(.+).jar" - // // }, - // // { - // // "name": "grpc-server", - // // "version": "2.3.0", - // // "download": { - // // "info": { - // // "description": "grpc server is like a one extension", - // // "install": "by using this way we can install grpc-server" - // // }, - // // "autoDownloadable": false, - // // "url": "https://repo1.maven.org/maven2/org/apache/grpc/grpc_2.11/2.1.1/grpc_2.11-2.1.1.jar" - // // }, - // // "type": "BUNDLE", - // // "lookupRegex": "grpc-server-(.+).jar" - // // } - // // ] - // // }, - // // "nats": { - // // "extensionStatus": "NOT_INSTALLED", - // // "extensionInfo": { - // // "name": "nats", - // // "version": "3.1.2-SNAPSHOT" - // // }, - // // } - // // })); - // }, - - /** * Installs or un-installs an extension. * @@ -154,7 +51,7 @@ define(['require', 'jquery', 'constants'], "
" + "
" + "
" + - "
" + @@ -194,9 +91,14 @@ define(['require', 'jquery', 'constants'], success: function (response) { handleCallback(extension, response.status, callerObject, response, callerScope); app.utils.extensionStatusListener.reArrangeExtensions(extension, response.status); + alerts.info(`Extension was successfully ${action.toLowerCase()}ed. ` + + `Please restart the editor.`); }, error: function (e) { - throw "Unable to read extension statuses"; // TODO show error message + var message = `Unable to ${action.toLowerCase()} the extension. ` + + `Please check editor console for further information.`; + alerts.error(message); + throw message; } }); }); diff --git a/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/js/operator-finder/operator-finder.js b/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/js/operator-finder/operator-finder.js index 37cdf2b2ae7..c0c28eefc42 100644 --- a/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/js/operator-finder/operator-finder.js +++ b/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/editor/js/operator-finder/operator-finder.js @@ -1,8 +1,8 @@ /** * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 */ -define(['jquery', 'lodash', 'log', 'remarkable', 'handlebar', 'designViewUtils', 'constants', 'app/source-editor/completion-engine'], - function ($, _, log, Remarkable, Handlebars, DesignViewUtils, Constants, CompletionEngine) { +define(['jquery', 'lodash', 'log', 'remarkable', 'handlebar', 'designViewUtils', 'constants', 'app/source-editor/completion-engine', 'alerts'], + function ($, _, log, Remarkable, Handlebars, DesignViewUtils, Constants, CompletionEngine, alerts) { /** * Load operators from the Completion engine. * @@ -328,6 +328,8 @@ define(['jquery', 'lodash', 'log', 'remarkable', 'handlebar', 'designViewUtils', self._application.utils.extensionData = new Map(Object.entries(data)); }, error: function (e) { + alerts.error("Unable to read extension statuses." + + "Please see the editor console for further information.") throw "Unable to read extension statuses"; } }); @@ -408,10 +410,8 @@ define(['jquery', 'lodash', 'log', 'remarkable', 'handlebar', 'designViewUtils', OperatorFinder.prototype.moveInstallationUpdatedExtension = function (extension, currentArray, targetArray) { var index = currentArray.indexOf(extension); if (index > -1) { - console.log("Before Lengths", currentArray.length, targetArray.length); currentArray.splice(index, 1); targetArray.push(extension); - console.log("After Lengths", currentArray.length, targetArray.length); } }; diff --git a/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/index.html b/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/index.html index 23eccd1dd7d..e6c2c35f4e5 100644 --- a/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/index.html +++ b/components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/index.html @@ -2370,7 +2370,7 @@

- + {{/if}}