<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Plato - src/components/Event/Tag/TagViewer.js</title>

  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="">

  <!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->

  <link href="../../assets/css/vendor/morris.css" rel="stylesheet">
  <link href="../../assets/css/vendor/bootstrap.css" rel="stylesheet">
  <link href="../../assets/css/vendor/font-awesome.css" rel="stylesheet">
  <link href="../../assets/css/vendor/codemirror.css" rel="stylesheet">
  <link href="../../assets/css/plato.css" rel="stylesheet">
  <link href="../../assets/css/plato-file.css" rel="stylesheet">

</head>

<body>

<div class="navbar navbar-fixed-top">
  <div class="container">
    <a class="navbar-brand" href="http://github.com/es-analysis/plato">Plato on Github</a>
    <ul class="nav navbar-nav">
      <li>
        <a href="../../index.html">Report Home</a>
      </li>
    </ul>
  </div>
</div>

<div class="jumbotron">
  <div class="container">
    <h1>src/components/Event/Tag/TagViewer.js</h1>
  </div>
</div>

<div class="container aggregate-stats">
  <div class="row">
    <div class="col-md-6">
      <h2 class="header">Maintainability <a href="http://blogs.msdn.com/b/codeanalysis/archive/2007/11/20/maintainability-index-range-and-meaning.aspx"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="A value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability." data-original-title="Maintainability Index"  data-container="body"></i></a></h2>
      <p class="stat">54.17</p>
    </div>
    <div class="col-md-6">
      <h2 class="header">Lines of code <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code / Logical Lines of Code" data-original-title="SLOC/LSLOC" data-container="body"></i></h2>
      <p class="stat">125</p>
    </div>
  </div>
  <div class="row historical">
    <div class="col-md-6">
      <p id="chart_historical_maint" class="chart"></p>
    </div>
    <div class="col-md-6">
      <p id="chart_historical_sloc" class="chart"></p>
    </div>
  </div>
  <div class="row">
    <div class="col-md-6">
      <h2 class="header">Difficulty  <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="The difficulty measure is related to the difficulty of the program to write or understand." data-original-title="Difficulty" data-container="body"></i></a></h2>
      <p class="stat">21.00</p>
    </div>
    <div class="col-md-6">
      <h2 class="header">Estimated Errors  <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Halstead's delivered bugs is an estimate for the number of errors in the implementation." data-original-title="Delivered Bugs" data-container="body"></i></a></h2>
      <p class="stat">0.69</p>
    </div>
  </div>
</div>

<div class="container charts">
  <div class="row">
    <h2 class="header">Function weight</h2>
  </div>
  <div class="row">
    <div class="col-md-6">
      <h3 class="chart-header">By Complexity <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="This metric counts the number of distinct paths through a block of code. Lower values are better." data-original-title="Cyclomatic Complexity" data-container="body"></i></a></h3>
      <div id="fn-by-complexity" class="stat"></div>
    </div>
    <div class="col-md-6">
      <h3 class="chart-header">By SLOC  <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code / Logical Lines of Code" data-original-title="SLOC/LSLOC" data-container="body"></i></h3>
      <div id="fn-by-sloc" class="stat"></div>
    </div>
  </div>
</div>

<div class="container">
  <div class="row">
    <textarea id="file-source" class="col-md-12">import React from &#039;react&#039;
import PropTypes from &#039;prop-types&#039;;
import { Label, Glyphicon } from &#039;react-bootstrap&#039;;
import { Row, Col, Button } from &quot;react-bootstrap&quot;

import { TAG_MANAGER_CONTEXT, BASIC_EVENT_CONTEXT, DETAILED_EVENT_CONTEXT } from &#039;../../../constants/EventTypes&#039;;

class TagViewer extends React.Component {
    render() {
        let { context, tag } = this.props;

        if (context === DETAILED_EVENT_CONTEXT) {
            return (&lt;div style={{
                marginRight: &#039;4px&#039;,
            }}&gt;
                &lt;Label
                    style={{
                        backgroundColor: tag.color,
                        borderTopLeftRadius: &#039;10px&#039;,
                        borderTopRightRadius: &#039;0px&#039;,
                        borderBottomRightRadius: &#039;0px&#039;,
                        borderBottomLeftRadius: &#039;10px&#039;,
                        display: &#039;inline-block&#039;,
                        marginBottom: &#039;2px&#039;
                    }}&gt;
                    {tag.name}
                &lt;/Label&gt;
                &lt;Label
                    style={{
                        backgroundColor: &#039;#777777&#039;,
                        borderTopLeftRadius: &#039;0px&#039;,
                        borderTopRightRadius: &#039;10px&#039;,
                        borderBottomRightRadius: &#039;10px&#039;,
                        borderBottomLeftRadius: &#039;0px&#039;,
                        display: &#039;inline-block&#039;,
                        marginBottom: &#039;2px&#039;,
                        paddingLeft: &#039;0px&#039;,
                        paddingRight: &#039;1px&#039;
                    }}&gt;
                    &lt;Glyphicon
                        glyph=&quot;remove&quot;
                        bsSize=&quot;xsmall&quot;
                        style={{
                            backgroundColor: &#039;#777777&#039;,
                            color: &#039;#FFFFFF&#039;,
                            verticalAlign: &#039;bottom&#039;
                        }}
                        onClick={() =&gt; this.props.removeTag(tag)}
                    /&gt;
                &lt;/Label&gt;
            &lt;/div&gt;)
        } else if (context === TAG_MANAGER_CONTEXT) {
            let { editTag } = this.props;

            //set the tag scope
            let tagScope = null;
            if (tag.investigationId) {
                tagScope = &lt;span style={{ padding: &#039;5px&#039;, backgroundColor: &#039;#f2f2f2&#039; }}&gt; proposal &lt;/span&gt;
            } else if (tag.beamlineName) {
                tagScope = &lt;span style={{ padding: &#039;5px&#039;, backgroundColor: &#039;#f2f2f2&#039; }}&gt; beamline &lt;/span&gt;
            }

            return (
                &lt;div&gt;
                    &lt;Row&gt;
                        &lt;div style={{ alignItems: &#039;center&#039; }}&gt;
                            &lt;Col xs={12} sm={2} style={{ textAlign: &#039;center&#039; }}&gt;
                                &lt;Label
                                    style={{
                                        backgroundColor: tag.color,
                                        borderRadius: &#039;10px&#039;,
                                        display: &#039;inline-block&#039;,
                                        paddingBottom: &#039;5px&#039;,
                                        fontSize: &#039;14px&#039;
                                    }}&gt;
                                    {tag.name}
                                &lt;/Label&gt;
                            &lt;/Col&gt;

                            &lt;Col xs={12} sm={6} style={{alignItems: &#039;stretch&#039;, }}&gt;
                                {tag.description ? &lt;span&gt; {tag.description} &lt;/span&gt; : &lt;span style={{ color: &#039;gray&#039;, fontStyle: &#039;italic&#039; }}&gt; No description yet&lt;/span&gt;}
                            &lt;/Col&gt;

                            &lt;Col xs={12} sm={3}&gt;
                                {tagScope}
                            &lt;/Col&gt;

                            &lt;Col xs={12} sm={1}&gt;
                                &lt;Button bsStyle=&quot;primary&quot; bsSize=&quot;small&quot; onClick={() =&gt; editTag(tag)}&gt;Edit&lt;/Button&gt;
                            &lt;/Col&gt;
                        &lt;/div&gt;
                    &lt;/Row&gt;
                    &lt;hr /&gt;
                &lt;/div&gt;
            )
        } else if (context === BASIC_EVENT_CONTEXT) {
            return (
                &lt;Label
                    style={{
                        backgroundColor: tag.color,
                        borderTopLeftRadius: &#039;10px&#039;,
                        borderTopRightRadius: &#039;10px&#039;,
                        borderBottomRightRadius: &#039;10px&#039;,
                        borderBottomLeftRadius: &#039;10px&#039;,
                        display: &#039;inline-block&#039;,
                        marginRight: &#039;5px&#039;
                    }}&gt;
                    {tag.name}
                &lt;/Label&gt;)
        }
    }
}

TagViewer.propTypes = {
    /* the context the tag is rendered */
    context: PropTypes.string.isRequired,
    /* callback function which show that page to edit the tag */
    editTag: PropTypes.func,
    /* the tag to render */
    tag: PropTypes.object.isRequired,
    /* Callback function used to remove a tag from the selection. Used in EVENT context only */
    removeTag: PropTypes.func
}

export default TagViewer;</textarea>
  </div>
</div>

<footer class="footer">
  <div class="container">
    <p>.</p>
  </div>
</footer>

<script type="text/html" id="complexity-popover-template">
  <div class="complexity-notice">
    Complexity : {{ cyclomatic }} <br>
    Length : {{ halstead.length }} <br>
    Difficulty : {{ halstead.difficulty.toFixed(2) }} <br>
    Est # bugs : {{ halstead.bugs.toFixed(2) }}<br>
  </div>
</script>

<script type="text/javascript" src="../../assets/scripts/bundles/core-bundle.js"></script>
<script type="text/javascript" src="../../assets/scripts/bundles/codemirror.js"></script>
<script type="text/javascript" src="../../assets/scripts/codemirror.markpopovertext.js"></script>
<script type="text/javascript" src="report.js"></script>
<script type="text/javascript" src="report.history.js"></script>
<script type="text/javascript" src="../../assets/scripts/plato-file.js"></script>
</body>
</html>
