<!--
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.
-->

<div>
  <div ng-include src="'app/notebook/paragraph/result/result-chart-selector.html'"></div>
  <div
    ng-mouseout="onMouseOut()"
    ng-mouseover="onMouseOver()"
    id="p{{id}}_resize"
    ng-if="!config.helium.activeApp"
    style="padding-bottom: 5px;"
    resize='{"allowresize": "{{!asIframe && !viewOnly}}", "graphType": "{{type}}"}'
    resizable on-resize="resize(width, height);">

    <div ng-if="type=='TABLE' || type == 'NETWORK'"
         ng-style="getPointerEvent()">
      <!-- setting -->
      <div class="option lightBold" style="overflow: visible;"
           ng-show="config.graph.optionOpen && !asIframe && !viewOnly">
        <div ng-repeat="viz in builtInTableDataVisualizationList track by $index"
             id="trsetting{{id}}_{{viz.id}}"
             ng-show="graphMode == viz.id"></div>
        <div ng-repeat="viz in builtInTableDataVisualizationList track by $index"
             id="vizsetting{{id}}_{{viz.id}}"
             ng-show="graphMode == viz.id"></div>
      </div>

      <div id="p{{id}}_network_header"
           ng-if="type == 'NETWORK' && graphMode == 'network' && networkNodes != null">
         <ul class="list-inline">
           <li>Nodes <span class="badge">{{networkNodes.count}}</span>:</li>
           <li ng-repeat="(labelName, labelColor) in networkNodes.labels" style="padding: 0">
             <span style="background-color: {{labelColor}} !important;" class="label label-default network-badge">
               {{labelName}}
             </span>
           </li>
         </ul>
         <ul class="list-inline">
           <li ng-if="networkRelationships != null">Relationships <span class="badge">{{networkRelationships.count}}</span>:</li>
           <li ng-repeat="type in networkRelationships.types" style="padding: 0">
             <span class="label label-default network-badge">
               {{type}}
             </span>
           </li>
         </ul>
      </div>

      <!-- graph -->
      <div id="p{{id}}_graph"
           class="graphContainer"
           ng-class="{'noOverflow': graphMode=='table'}">
        <div ng-repeat="viz in builtInTableDataVisualizationList track by $index"
             id="p{{id}}_{{viz.id}}"
             ng-show="graphMode == viz.id">
        </div>
      </div>

      <div id="p{{id}}_network_footer"
           ng-if="type == 'NETWORK' && graphMode == 'network'">
        <ul class="list-inline">
        </ul>
      </div>

      <div id="{{id}}_comment"
           class="text"
           ng-if="tableDataComment"
           ng-bind-html="tableDataComment">
      </div>
    </div>

    <div ng-if="type == 'TEXT'"
         class="plainTextContainer"
         ng-style="getPointerEvent()">
      <div class="fa fa-level-down scroll-paragraph-down"
           ng-show="showScrollDownIcon()"
           ng-click="scrollParagraphDown()"
           uib-tooltip="Follow Output"></div>
      <div id="p{{id}}_text"
           style="max-height: {{config.graph.height}}px; overflow: auto"
           class="text plainTextContent"></div>
      <div class="fa fa-chevron-up scroll-paragraph-up"
           ng-show="showScrollUpIcon()"
           ng-click="scrollParagraphUp()"
           uib-tooltip="Scroll Top"></div>
    </div>

    <div id="p{{id}}_custom"
         class="resultContained"
         ng-if="!isDefaultDisplay()"
         ng-style="getPointerEvent()">
    </div>

    <div id="p{{id}}_elem"
         class="resultContained"
         ng-if="type == 'ELEMENT'"
         ng-style="getPointerEvent()">
    </div>

    <div id="p{{id}}_html"
         class="resultContained html-result"
         ng-if="type == 'HTML'"
         ng-style="getPointerEvent()">
    </div>

    <div id="p{{id}}_angular"
         class="resultContained"
         ng-if="type == 'ANGULAR'"
         ng-style="getPointerEvent()">
    </div>

    <img id="{{id}}_img"
         ng-if="type == 'IMG'"
         ng-src="{{getBase64ImageSrc(result.data)}}"
         ng-style="getPointerEvent()" />
  </div>

  <div ng-repeat="app in apps">
    <div id="p{{app.id}}"
         ng-show="config.helium.activeApp == app.id"
         ng-style="getPointerEvent()">
    </div>
  </div>
</div>
