aboutsummaryrefslogtreecommitdiffstats
path: root/client/client-editor/src/main/resources/webapp/js/ApexAjax.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/client-editor/src/main/resources/webapp/js/ApexAjax.js')
-rw-r--r--client/client-editor/src/main/resources/webapp/js/ApexAjax.js31
1 files changed, 28 insertions, 3 deletions
diff --git a/client/client-editor/src/main/resources/webapp/js/ApexAjax.js b/client/client-editor/src/main/resources/webapp/js/ApexAjax.js
index b682136ec..c241a4459 100644
--- a/client/client-editor/src/main/resources/webapp/js/ApexAjax.js
+++ b/client/client-editor/src/main/resources/webapp/js/ApexAjax.js
@@ -1,19 +1,20 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -33,6 +34,30 @@ function ajax_get(requestURL, callback) {
});
}
+function ajax_getWithKeyInfo(requestURL, objectType, callback, keyName) {
+ var keyName = keyName || "key";
+ var keyInfoURL = restRootURL + "/KeyInformation/Get?name=&version=";
+ ajax_get(keyInfoURL, function(dataKeyInfos) {
+ ajax_get(requestURL, function(data) {
+ var keyInfos = [];
+ for ( var i = 0; i < dataKeyInfos.messages.message.length; i++) {
+ var ki = JSON.parse(dataKeyInfos.messages.message[i]).apexKeyInfo;
+ keyInfos.push(ki);
+ }
+ var object = JSON.parse(data.messages.message[0])[objectType];
+ var keyInfo = keyInfos.filter(function(ki) {
+ return ki.key.name === object[keyName].name
+ && ki.key.version === object[keyName].version;
+ });
+ if (keyInfo.length > 0) {
+ object.uuid = keyInfo[0].UUID;
+ object.description = keyInfo[0].description;
+ }
+ callback(object);
+ });
+ });
+}
+
function ajax_getOKOrFail(requestURL, callback) {
$.ajax({
type : 'GET',