summaryrefslogtreecommitdiffstats
path: root/client/client-deployment/src/main/resources/webapp/js
diff options
context:
space:
mode:
Diffstat (limited to 'client/client-deployment/src/main/resources/webapp/js')
-rw-r--r--client/client-deployment/src/main/resources/webapp/js/ApexAjax.js84
-rw-r--r--client/client-deployment/src/main/resources/webapp/js/ApexEngineService.js101
-rw-r--r--client/client-deployment/src/main/resources/webapp/js/ApexModelLoading.js63
-rw-r--r--client/client-deployment/src/main/resources/webapp/js/ApexServicesMain.js147
-rw-r--r--client/client-deployment/src/main/resources/webapp/js/ApexTable.js59
-rw-r--r--client/client-deployment/src/main/resources/webapp/js/ApexUtils.js212
6 files changed, 666 insertions, 0 deletions
diff --git a/client/client-deployment/src/main/resources/webapp/js/ApexAjax.js b/client/client-deployment/src/main/resources/webapp/js/ApexAjax.js
new file mode 100644
index 000000000..beb2cb11d
--- /dev/null
+++ b/client/client-deployment/src/main/resources/webapp/js/ApexAjax.js
@@ -0,0 +1,84 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * Send a GET request
+ */
+function ajax_get(requestURL, callback, hostName, port, params, errorCallback) {
+ var data = {
+ hostName : hostName,
+ port : port
+ };
+ for ( var p in params) {
+ data[p] = params[p];
+ }
+ return $.ajax({
+ type : 'GET',
+ url : requestURL,
+ dataType : "json",
+ data : data,
+ success : function(data, textStatus, jqXHR) {
+ if (callback) {
+ callback(data);
+ }
+ },
+ error : function(jqXHR, textStatus, errorThrown) {
+ if (jqXHR.status == 500 || jqXHR.status == 404) {
+ if (jqXHR.responseText.indexOf("cound not handshake with server") !== -1 || jqXHR.status == 404) {
+ clearEngineURL();
+ getEngineURL(jqXHR.responseText);
+ } else {
+ apexErrorDialog_activate(document.body, jqXHR.responseText);
+ }
+ }
+ if (errorCallback) {
+ errorCallback(jqXHR, textStatus, errorThrown);
+ }
+ }
+ });
+}
+
+/*
+ * Send a POST request and add a file to its payload
+ */
+function ajax_upload(requestURL, callback, hostName, port, fileUrl, ignoreConflicts, forceUpdate) {
+ var formData = new FormData();
+ formData.append("hostName", hostName);
+ formData.append("port", port);
+ formData.append("file", fileUrl);
+ formData.append("ignoreConflicts", ignoreConflicts);
+ formData.append("forceUpdate", forceUpdate);
+ return $.ajax({
+ url : requestURL,
+ type : "POST",
+ contentType : false,
+ dataType : "text",
+ processData : false,
+ data : formData,
+ success : function(data, textStatus, jqXHR) {
+ callback(data);
+ },
+ error : function(jqXHR, textStatus, errorThrown) {
+ if (jqXHR.status == 500) {
+ apexErrorDialog_activate(document.body, jqXHR.responseText);
+ }
+ }
+ });
+}
diff --git a/client/client-deployment/src/main/resources/webapp/js/ApexEngineService.js b/client/client-deployment/src/main/resources/webapp/js/ApexEngineService.js
new file mode 100644
index 000000000..f47c98f07
--- /dev/null
+++ b/client/client-deployment/src/main/resources/webapp/js/ApexEngineService.js
@@ -0,0 +1,101 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * Create the Engine Service Table
+ */
+function createEngineServiceTable() {
+ var tableId = config.engineService.tableId;
+ var headers = config.engineService.headers;
+ var table = createEngineTable($("." + config.engineService.parent), tableId, headers.map(function(a) {
+ return a.title;
+ }));
+ var tableRow = document.createElement("tr");
+ var tableData = "";
+ for ( var h in headers) {
+ tableData += "<td id=" + tableId + "_" + headers[h].id + "></td>";
+ }
+ tableRow.innerHTML = tableData;
+ var actionTD = $(tableRow).find("#" + tableId + "_periodic_events");
+ actionTD
+ .html('<input type="text" name="period" id="period" style="display:inline-block"><label class="ebSwitcher"><input type="checkbox" class="ebSwitcher-checkbox" /><div class="ebSwitcher-body"><div class="ebSwitcher-onLabel">Stopped</div><div class="ebSwitcher-switch"></div><div class="ebSwitcher-offLabel">Started</div></div></label>');
+ var period = actionTD.find("#period");
+ var switcher = actionTD.find(".ebSwitcher");
+ switcher.css('display', 'inline-block');
+ switcher.css('margin-left', '5px');
+ switcher.css('vertical-align', 'middle');
+ var checkbox = $(actionTD).find('input:checkbox:first');
+ checkbox.change(function(event) {
+ var startstop;
+ if (checkbox.prop('checked')) {
+ startstop = "Stop";
+ } else {
+ startstop = "Start";
+ }
+ this.servicesCall.abort();
+ ajax_get(restRootURL + "periodiceventstartstop", startStopCallback, this.engineURL.hostname,
+ this.engineURL.port, {
+ engineId : this.engineId,
+ startstop : startstop,
+ period : period.val()
+ }, resetPeriodicEvents);
+ }.bind(this));
+ $(table).children("#engineTableBody").append(tableRow);
+}
+
+/*
+ * Check for any changes in the Engine Service Table data and update only where
+ * necessary
+ */
+function setEngineServiceData(engineId, modelId, server, port, periodicEvents) {
+ this.engineId = engineId;
+ var tableId = config.engineService.tableId;
+ var headers = config.engineService.headers.map(function(a) {
+ return a.id;
+ });
+ var data = [ engineId, server + ":" + port, modelId ];
+
+ var engineServiceTable = $("#engineServicesTable");
+
+ for ( var h in headers) {
+ var td = engineServiceTable.find("#" + tableId + "_" + headers[h]);
+ if (td.html() !== data[h]) {
+ engineServiceTable.find("#" + tableId + "_" + headers[h]).html(data[h]);
+ }
+ }
+
+ var actionTD = engineServiceTable.find("#" + tableId + "_periodic_events");
+ var checkbox = $(actionTD).find('input:checkbox:first');
+ if (checkbox.is(":checked") === periodicEvents) {
+ checkbox.prop("checked", !checkbox.prop("checked"));
+ }
+}
+
+/*
+ * Resets the switcher for Periodic Events in the Engine Service Table
+ */
+function resetPeriodicEvents() {
+ var engineServiceTable = $("#engineServicesTable");
+ var periodicEventsTD = $(engineServiceTable).find("#engineServicesTable_periodic_events");
+ var checkbox = $(periodicEventsTD).find('input:checkbox:first');
+ if (checkbox.is(":checked")) {
+ checkbox.prop("checked", false);
+ }
+}
diff --git a/client/client-deployment/src/main/resources/webapp/js/ApexModelLoading.js b/client/client-deployment/src/main/resources/webapp/js/ApexModelLoading.js
new file mode 100644
index 000000000..8bd051f0f
--- /dev/null
+++ b/client/client-deployment/src/main/resources/webapp/js/ApexModelLoading.js
@@ -0,0 +1,63 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * Create the div for uploading Apex models
+ */
+function createModelLoadingDiv() {
+ var fileLoader = document.createElement("input");
+ fileLoader.setAttribute("type", "file");
+ fileLoader.setAttribute("name", "apexModelFile");
+ fileLoader.setAttribute("label", "Load Apex Model XML file");
+ $('.modelLoading').append(fileLoader);
+
+ var ignoreConflictsCheckbox = document.createElement("input");
+ ignoreConflictsCheckbox.setAttribute("type", "checkbox");
+ ignoreConflictsCheckbox.setAttribute("name", "ignoreContextConflicts");
+ $('.modelLoading').append(ignoreConflictsCheckbox);
+
+ ignoreConflictsLabel = document.createElement("label");
+ ignoreConflictsLabel.setAttribute("class", "ignoreConflictsLabel");
+ ignoreConflictsLabel.innerHTML = "Ignore Context Conflicts";
+ $('.modelLoading').append(ignoreConflictsLabel);
+
+ var forceUpdateCheckbox = document.createElement("input");
+ forceUpdateCheckbox.setAttribute("type", "checkbox");
+ forceUpdateCheckbox.setAttribute("name", "forceUpdate");
+ $('.modelLoading').append(forceUpdateCheckbox);
+
+ forceUpdateLabel = document.createElement("label");
+ forceUpdateLabel.setAttribute("class", "ignoreConflictsLabel");
+ forceUpdateLabel.innerHTML = "Force Update";
+ $('.modelLoading').append(forceUpdateLabel);
+
+ var submitButton = document.createElement("button");
+ submitButton.setAttribute("class", "ebBtn");
+ submitButton.innerHTML = "Load Apex Model XML file";
+ $(submitButton).click(
+ function() {
+ var file = fileLoader.files[0];
+ var ignoreConflicts = $(ignoreConflictsCheckbox).is(":checked");
+ var forceUpdate = $(forceUpdateCheckbox).is(":checked");
+ ajax_upload(restRootURL + "modelupload/", uploadCallback, this.engineURL.hostname, this.engineURL.port,
+ file, ignoreConflicts, forceUpdate);
+ }.bind(this));
+ $('.modelLoading').append(submitButton);
+} \ No newline at end of file
diff --git a/client/client-deployment/src/main/resources/webapp/js/ApexServicesMain.js b/client/client-deployment/src/main/resources/webapp/js/ApexServicesMain.js
new file mode 100644
index 000000000..a54815ab3
--- /dev/null
+++ b/client/client-deployment/src/main/resources/webapp/js/ApexServicesMain.js
@@ -0,0 +1,147 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+var restRootURL;
+
+var config = {
+ refresh : 5000,
+ engineService : {
+ parent : "engineService",
+ tableId : "engineServicesTable",
+ headers : [ {
+ title : "Engine Service ID",
+ id : "engine_id"
+ }, {
+ title : "server:port",
+ id : "server_port"
+ }, {
+ title : "Model ID",
+ id : "model_id"
+ } ]
+ }
+}
+
+/*
+ * Callback for showing model info
+ */
+function servicesCallback(data) {
+ // If engine url in cookie has not been cleared
+ if (localStorage.getItem("apex-monitor-services")) {
+ setEngineServiceData(data.engine_id, data.model_id, data.server, data.port, data.periodic_events);
+
+ // Make content visible after data has been returned for the first time
+ if (!$(".content").is(':visible')) {
+ $(".content").fadeIn();
+ }
+
+ // Repeat the same request
+ setTimeout(function() {
+ this.servicesCall = ajax_get(restRootURL, servicesCallback, this.engineURL.hostname, this.engineURL.port);
+ }, config.refresh);
+ }
+}
+
+/*
+ * Callback for uploading a model
+ */
+function uploadCallback(response) {
+ // Open a dialog showing the response
+ apexSuccessDialog_activate(document.body, response);
+}
+
+/*
+ * Clears and resets all content on the page
+ */
+function setUpPage() {
+ // Clear each div
+ $('#content > div').each(function() {
+ $(this).empty();
+ });
+
+ // Set up content div's
+ createEngineServiceTable();
+ createModelLoadingDiv();
+}
+
+/*
+ * Retrieves the engine URL from the cookie. If it has not been set yet, then a
+ * dialog is shown asking for it
+ */
+function getEngineURL(message) {
+ // The engine URL is stored in a cookie using the key
+ // "apex-monitor-services"
+ var engineURL = localStorage.getItem("apex-monitor-services");
+
+ // This url is used to store the last known engine URL so that the user
+ // doesn't have to retype it every time
+ var oldEngineURL = localStorage.getItem("apex-monitor-services_old");
+
+ // If an engine URL is stored in the cookie
+ if (engineURL) {
+ // Parse the engine URL
+ this.engineURL = JSON.parse(engineURL);
+
+ // Send a request with that engine URL
+ this.servicesCall = ajax_get(restRootURL, servicesCallback, this.engineURL.hostname, this.engineURL.port);
+ } else {
+ // Prompt for engine URL
+ apexDialogForm_activate(document.body, message);
+ }
+}
+
+/*
+ * Clears the cookie and reset the page
+ */
+function clearEngineURL() {
+ // Remove engine URL from cookie
+ localStorage.removeItem("apex-monitor-services");
+
+ // Reset the page
+ setUpPage();
+}
+
+/*
+ * Called after the DOM is ready
+ */
+$(document).ready(
+ function() {
+ restRootURL = location.protocol
+ + "//"
+ + window.location.hostname
+ + (location.port ? ':' + location.port : '')
+ + (location.pathname.endsWith("/deployment/") ? location.pathname.substring(0, location.pathname
+ .indexOf("deployment/")) : location.pathname) + "apexservices/deployment/";
+
+ // Set up the structure of the page
+ setUpPage();
+
+ // Check cookies for engine URL
+ getEngineURL();
+
+ // Add click event to config icon for clearing engine URL
+ $(".ebSystemBar-config").click(function() {
+ // Clear the engine URL
+ clearEngineURL();
+
+ // Request the engine URL
+ getEngineURL();
+ });
+
+ }); \ No newline at end of file
diff --git a/client/client-deployment/src/main/resources/webapp/js/ApexTable.js b/client/client-deployment/src/main/resources/webapp/js/ApexTable.js
new file mode 100644
index 000000000..20e3d08bd
--- /dev/null
+++ b/client/client-deployment/src/main/resources/webapp/js/ApexTable.js
@@ -0,0 +1,59 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * Create a table with given headers
+ */
+function createEngineTable(parent, id, tableHeaders) {
+ var table = createTable(id);
+
+ var tableHead = document.createElement("thead");
+ table.appendChild(tableHead);
+ tableHead.setAttribute("id", "engineTableHeader");
+
+ var tableHeaderRow = document.createElement("tr");
+ tableHead.appendChild(tableHeaderRow);
+ tableHeaderRow.setAttribute("id", "engineTableHeaderRow");
+
+ for ( var t in tableHeaders) {
+ var tableHeader = document.createElement("th");
+ tableHeaderRow.appendChild(tableHeader);
+ tableHeader.setAttribute("id", "engineTableHeader");
+ tableHeader.appendChild(document.createTextNode(tableHeaders[t]));
+ }
+
+ var tableBody = document.createElement("tbody");
+ tableBody.setAttribute("id", "engineTableBody");
+ table.appendChild(tableBody);
+
+ parent.append(table);
+
+ return table;
+}
+
+/*
+ * Create a table and apply UISDK styles to it
+ */
+function createTable(id) {
+ var table = document.createElement("table");
+ table.setAttribute("id", id);
+ table.setAttribute("class", "apexTable ebTable elTablelib-Table-table ebTable_striped");
+ return table;
+} \ No newline at end of file
diff --git a/client/client-deployment/src/main/resources/webapp/js/ApexUtils.js b/client/client-deployment/src/main/resources/webapp/js/ApexUtils.js
new file mode 100644
index 000000000..0f5e689fd
--- /dev/null
+++ b/client/client-deployment/src/main/resources/webapp/js/ApexUtils.js
@@ -0,0 +1,212 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * Crate a dialog with input, attach it to a given parent and show an optional message
+ */
+function apexDialogForm_activate(formParent, message) {
+ apexUtils_removeElement("apexDialogDiv");
+
+ var contentelement = document.createElement("apexDialogDiv");
+ var formDiv = document.createElement("div");
+ var backgroundDiv = document.createElement("div");
+ backgroundDiv.setAttribute("id", "apexDialogDivBackground");
+ backgroundDiv.setAttribute("class", "apexDialogDivBackground");
+
+ backgroundDiv.appendChild(formDiv);
+ contentelement.appendChild(backgroundDiv);
+ formParent.appendChild(contentelement);
+
+ formDiv.setAttribute("id", "apexDialogDiv");
+ formDiv.setAttribute("class", "apexDialogDiv");
+
+ var headingSpan = document.createElement("span");
+ formDiv.appendChild(headingSpan);
+
+ headingSpan.setAttribute("class", "headingSpan");
+ headingSpan.innerHTML = "Apex Engine Configuration";
+
+ var form = document.createElement("apexDialog");
+ formDiv.appendChild(form);
+
+ form.setAttribute("id", "apexDialog");
+ form.setAttribute("class", "form-style-1");
+ form.setAttribute("method", "post");
+
+ if (message) {
+ var messageLI = document.createElement("li");
+ messageLI.setAttribute("class", "dialogMessage");
+ messageLI.innerHTML = message;
+ form.appendChild(messageLI);
+ }
+
+ var urlLI = document.createElement("li");
+ form.appendChild(urlLI);
+
+ var urlLabel = document.createElement("label");
+ urlLI.appendChild(urlLabel);
+
+ urlLabel.setAttribute("for", "apexDialogUrlInput");
+ urlLabel.innerHTML = "Apex Engine rest URL:";
+
+ var urlLabelSpan = document.createElement("span");
+ urlLabel.appendChild(urlLabelSpan);
+
+ urlLabelSpan.setAttribute("class", "required");
+ urlLabelSpan.innerHTML = "*";
+
+ var engineUrl = localStorage.getItem("apex-monitor-services_old");
+
+ var urlInput = document.createElement("input");
+ urlInput.setAttribute("id", "services_url_input");
+ urlInput.setAttribute("placeholder", "localhost:12345");
+ urlInput.value = (engineUrl && engineUrl !== "null") ? JSON.parse(engineUrl).hostname + ":"
+ + JSON.parse(engineUrl).port : "";
+ urlLI.appendChild(urlInput);
+
+ var inputLI = document.createElement("li");
+ form.appendChild(inputLI);
+
+ var submitInput = document.createElement("input");
+ submitInput.setAttribute("id", "submit");
+ submitInput.setAttribute("class", "button ebBtn");
+ submitInput.setAttribute("type", "submit");
+ submitInput.setAttribute("value", "Submit");
+ submitInput.onclick = apexDialogForm_submitPressed;
+ inputLI.appendChild(submitInput);
+
+ // Enter key press triggers submit
+ $(urlInput).keyup(function(event) {
+ if (event.keyCode == 13) {
+ $(submitInput).click();
+ }
+ });
+
+ urlInput.focus();
+}
+
+/*
+ * Create a dialog for displaying text
+ */
+function apexTextDialog_activate(formParent, message, title) {
+ apexUtils_removeElement("apexDialogDiv");
+
+ var contentelement = document.createElement("div");
+ contentelement.setAttribute("id", "apexDialogDiv")
+ var formDiv = document.createElement("div");
+ var backgroundDiv = document.createElement("div");
+ backgroundDiv.setAttribute("id", "apexDialogDivBackground");
+ backgroundDiv.setAttribute("class", "apexDialogDivBackground");
+
+ backgroundDiv.appendChild(formDiv);
+ contentelement.appendChild(backgroundDiv);
+ formParent.appendChild(contentelement);
+
+ formDiv.setAttribute("id", "apexErrorDialogDiv");
+ formDiv.setAttribute("class", "apexDialogDiv apexErrorDialogDiv");
+
+ var headingSpan = document.createElement("span");
+ formDiv.appendChild(headingSpan);
+
+ headingSpan.setAttribute("class", "headingSpan");
+ headingSpan.innerHTML = title;
+
+ var form = document.createElement("div");
+ formDiv.appendChild(form);
+
+ form.setAttribute("id", "apexDialog");
+ form.setAttribute("class", "form-style-1");
+ form.setAttribute("method", "post");
+
+ if (message) {
+ var messageLI = document.createElement("li");
+ messageLI.setAttribute("class", "dialogMessage");
+ messageLI.innerHTML = message;
+ form.appendChild(messageLI);
+ }
+
+ var inputLI = document.createElement("li");
+ form.appendChild(inputLI);
+
+ var cancelInput = document.createElement("input");
+ cancelInput.setAttribute("class", "button ebBtn");
+ cancelInput.setAttribute("type", "submit");
+ cancelInput.setAttribute("value", "Close");
+ cancelInput.onclick = newModelForm_cancelPressed;
+ form.appendChild(cancelInput);
+}
+
+/*
+ * Create a Success dialog
+ */
+function apexSuccessDialog_activate(formParent, message) {
+ apexTextDialog_activate(formParent, message, "Success");
+}
+
+/*
+ * Create an Error dialog
+ */
+function apexErrorDialog_activate(formParent, message) {
+ apexTextDialog_activate(formParent, message, "Error");
+}
+
+/*
+ * Dialog cancel callback
+ */
+function newModelForm_cancelPressed() {
+ apexUtils_removeElement("apexDialogDivBackground");
+}
+
+/*
+ * Dialog submit callback
+ */
+function apexDialogForm_submitPressed() {
+ var url = $('#services_url_input').val();
+ if (url && url.length > 0) {
+ var engineConfig = {
+ hostname : url.split(":")[0],
+ port : url.split(":")[1]
+ };
+ localStorage.setItem("apex-monitor-services_old", JSON.stringify(engineConfig));
+ localStorage.setItem("apex-monitor-services", JSON.stringify(engineConfig));
+ apexUtils_removeElement("apexDialogDivBackground");
+ getEngineURL();
+ }
+}
+
+/*
+ * Remove an element from the page
+ */
+function apexUtils_removeElement(elementname) {
+ var element = document.getElementById(elementname);
+ if (element != null) {
+ element.parentNode.removeChild(element);
+ }
+}
+
+function getHomepageURL() {
+ var homepageURL = location.protocol
+ + "//"
+ + window.location.hostname
+ + (location.port ? ':' + location.port : '')
+ + (location.pathname.endsWith("/deployment/") ? location.pathname.substring(0, location.pathname
+ .indexOf("deployment/")) : location.pathname);
+ location.href = homepageURL;
+} \ No newline at end of file