Commit 037138b1 authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

added json-tree for formatted json as output

parent 50f2756a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ module.exports = function(grunt) {
    concat: {
      vendorjs: {
        src: [
            'src/lib/*/*.js'
        ],
        dest: 'public/lib.js'
      },
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
        <script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.locate("angular.min.js"))'></script>
        <script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.locate("angular-route.min.js"))'></script>
        <script src='@routes.Assets.versioned("app.js")'></script>
        <script src='@routes.Assets.versioned("lib.js")'></script>
    </head>
    <body class="bg-inverse">
        <div ng-include src="'alerts.html'" ng-controller="AlertsController" class="alerts"></div>
+25 −8
Original line number Diff line number Diff line
@@ -908,21 +908,38 @@ angular.module('cerebro').factory('DataService', function ($rootScope, $timeout,
angular.module('cerebro').factory('ModalService', ['$sce', function ($sce) {

  this.text = undefined;
  this.confirm = undefined;

  this.info = undefined;

  this.promptConfirmation = function (body, confirmCallback) {
  var confirmCallback = undefined;

  this.promptConfirmation = function (body, callback) {
    this.text = body;
    this.confirm = confirmCallback;
    this.info = undefined;
    confirmCallback = callback;
  };

  this.showInfo = function (info) {
    this.info = $sce.trustAsHtml(JSON.stringify(info, '', 2));
    //$scope.body= $sce.trustAsHtml(JSONTree.create(info));
    this.confirm = undefined;
    this.info = $sce.trustAsHtml(JSONTree.create(info));
  };

  this.close = function() {
    this.clean();
  };

  this.confirm = function() {
    if (confirmCallback) {
      confirmCallback();
    }
    this.clean();
  };

  this.needsConfirmation = function() {
    return confirmCallback ? true : false;
  };

  this.clean = function() {
    this.text = undefined;
    this.info = undefined;
    confirmCallback = undefined;
  };

  return this;
+49 −0
Original line number Diff line number Diff line
@@ -380,3 +380,52 @@ table.shard-map {
.navbar-dark .navbar-nav .nav-link {
    font-weight: 300 !important;
}

/* JSON TREE CSS */
.jstValue {
    white-space: pre-wrap;
    font-size: 12px;
    font-weight: 400;
    font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
    line-height: normal;
    display: block;
}
.jstComma {
    white-space: pre-wrap;
}
.jstProperty {
    color: #D0D0D0;
    word-wrap: break-word;
}
.jstBracket {
    white-space: pre-wrap;
}
.jstBool {
    color: #2525CC;
}
.jstNum {
    color: #D036D0;
}
.jstNull {
    color: gray;
}
.jstStr {
    color: #2DB669;
}
.jstFold:after {
    content: ' -';
    cursor: pointer;
}
.jstExpand {
    white-space: normal;
}
.jstExpand:after {
    content: ' +';
    cursor: pointer;
}
.jstFolded {
    white-space: normal !important;
}
.jstHiddenBlock {
    display: none;
}
+2 −0
Original line number Diff line number Diff line
/*! json-tree - v0.2.0 - 2015-06-23 */
var JSONTree=function(){var a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"},b=0,c=0;this.create=function(a,b){return c+=1,p(f(a,0,!1),{"class":"jstValue"})};var d=function(b){return b.replace(/[&<>'"]/g,function(b){return a[b]})},e=function(){return c+"_"+b++},f=function(a,b,c){if(null===a)return l(c?b:0);var d=typeof a;switch(d){case"boolean":return k(a,c?b:0);case"number":return j(a,c?b:0);case"string":return i(a,c?b:0);default:return a instanceof Array?h(a,b,c):g(a,b,c)}},g=function(a,b,c){var d=e(),f=Object.keys(a).map(function(c){return m(c,a[c],b+1,!0)}).join(o()),g=[r("{",c?b:0,d),p(f,{id:d}),s("}",b)].join("\n");return p(g,{})},h=function(a,b,c){var d=e(),g=a.map(function(a){return f(a,b+1,!0)}).join(o()),h=[r("[",c?b:0,d),p(g,{id:d}),s("]",b)].join("\n");return h},i=function(a,b){return p(t(n(d(a)),b),{"class":"jstStr"})},j=function(a,b){return p(t(a,b),{"class":"jstNum"})},k=function(a,b){return p(t(a,b),{"class":"jstBool"})},l=function(a){return p(t("null",a),{"class":"jstNull"})},m=function(a,b,c){var e=t(n(d(a))+": ",c),g=p(f(b,c,!1),{});return p(e+g,{"class":"jstProperty"})},n=function(a){return'"'+a+'"'},o=function(){return p(",\n",{"class":"jstComma"})},p=function(a,b){return q("span",b,a)},q=function(a,b,c){return"<"+a+Object.keys(b).map(function(a){return" "+a+'="'+b[a]+'"'}).join("")+">"+c+"</"+a+">"},r=function(a,b,c){return p(t(a,b),{"class":"jstBracket"})+p("",{"class":"jstFold",onclick:"JSONTree.toggle('"+c+"')"})};this.toggle=function(a){var b=document.getElementById(a),c=b.parentNode,d=b.previousElementSibling;""===b.className?(b.className="jstHiddenBlock",c.className="jstFolded",d.className="jstExpand"):(b.className="",c.className="",d.className="jstFold")};var s=function(a,b){return p(t(a,b),{})},t=function(a,b){return Array(2*b+1).join(" ")+a};return this}();
Loading