Yangman - show history with html response correctly 26/43026/7
authorLubomir Balogh <lubalogh@cisco.com>
Thu, 4 Aug 2016 13:09:00 +0000 (15:09 +0200)
committerLubomir Balogh <lubalogh@cisco.com>
Tue, 9 Aug 2016 12:45:51 +0000 (14:45 +0200)
Change-Id: Ic8a545377349cd4a8ddd667f895746be7147ab7e
Signed-off-by: Stanislav Jamrich <sjamrich@cisco.com>
Signed-off-by: Lubomir Balogh <lubalogh@cisco.com>
modules/yangman-resources/src/main/resources/yangman/controllers/request-header.controller.js
modules/yangman-resources/src/main/resources/yangman/models/history-request.model.js

index 4bc167948ed3f51423f61cc8f04e3632476c801a..10b3f8f100b52276c3dddebac74469eb16d331c9 100644 (file)
@@ -206,7 +206,10 @@ define([
          * @param data
          */
         function sendRequestData(data, type){
-            $scope.rootBroadcast('YANGMAN_SET_CODEMIRROR_DATA_' + type, { data: JSON.stringify(data, null, 4) });
+            $scope.rootBroadcast(
+                'YANGMAN_SET_CODEMIRROR_DATA_' + type,
+                { data: data instanceof Object ? JSON.stringify(data, null, 4) : data }
+            );
         }
 
         function sendErrorData(response) {
index 0cb1fadd34400e78ccf05db7ad430633755a06fd..4af7bb800adaabe1e1f1ea3a1c9c7dc7d0dc9ba2 100644 (file)
@@ -124,14 +124,24 @@ define([], function (){
          * @returns {string}
          */
         function setDataForView(data){
-            var newData = {},
-                parsedData = '';
+            var result = '';
+
+            if (data instanceof Object) {
+                result = JSON.stringify(
+                    YangUtilsService.stripAngularGarbage(
+                        angular.copy(data),
+                        self.getLastPathDataElemName()
+                    ),
+                    null,
+                    4
+                );
+            }
+            else {
+                result = data;
+            }
 
-            angular.copy(data, newData);
-            parsedData = JSON.stringify(
-                YangUtilsService.stripAngularGarbage(newData, self.getLastPathDataElemName()), null, 4);
+            return result;
 
-            return parsedData;
         }