/*
This file is part of the Juju GUI, which lets users view and manage Juju
environments within a graphical interface (https://launchpad.net/juju-gui).
Copyright (C) 2015 Canonical Ltd.

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License version 3, as published by
the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero
General Public License for more details.

You should have received a copy of the GNU Affero General Public License along
with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

'use strict';

YUI.add('inspector-plan', function() {

  juju.components.InspectorPlan = React.createClass({

    propTypes: {
      acl: React.PropTypes.object.isRequired,
      currentPlan: React.PropTypes.object
    },

    /**
      Generates the elements if the applicaton has a plan selected.

      @method _generatePlanDetails
      @return {Function} The React elements for the UI.
    */
    _generatePlanDetails: function() {
      var currentPlan = this.props.currentPlan;
      return (
        <div className="inspector-plan__details">
          <div className="inspector-plan__title">{currentPlan.url}</div>
          <div className="inspector-plan__price">{currentPlan.price}</div>
          <div className="inspector-plan__description">
            {currentPlan.description}
          </div>
        </div>);
    },

    /**
      Generates the elements if the application does not have a plan selected.

      @method _generateNoPlans
      @return {Function} The React elements for the UI.
    */
    _generateNoPlans: function() {
      return (
        <div className="inspector-plan__no-plan">
          You have no active plan
        </div>);
    },

    render: function() {
      return (
        <div className="inspector-plan">
          {this.props.currentPlan ?
            this._generatePlanDetails() : this._generateNoPlans()}
        </div>
      );
    }

  });

}, '0.1.0', { requires: [
  'button-row'
]});

@@ -800,66 +800,14 @@
 ';%0A%0A
-YUI.add('inspector-plan', function() %7B%0A%0A  juju.components.
+const 
 Insp
@@ -839,18 +839,16 @@
 lass(%7B%0A%0A
-  
   propTy
@@ -858,18 +858,16 @@
 : %7B%0A    
-  
 acl: Rea
@@ -898,18 +898,16 @@
 quired,%0A
-  
     curr
@@ -938,26 +938,24 @@
 .object%0A
-  
   %7D,%0A%0A  
   /**%0A  
@@ -942,32 +942,28 @@
 ect%0A  %7D,%0A%0A  
- 
- 
 /**%0A
-  
     Generate
@@ -1013,34 +1013,32 @@
  selected.%0A%0A    
-  
 @method _generat
@@ -1050,18 +1050,16 @@
 Details%0A
-  
     @ret
@@ -1100,33 +1100,29 @@
 for the UI.%0A
-  
   */%0A
-  
   _generateP
@@ -1150,18 +1150,16 @@
 ) %7B%0A    
-  
 var curr
@@ -1192,26 +1192,24 @@
 ntPlan;%0A    
- 
- 
 return (%0A   
@@ -1197,34 +1197,32 @@
 n;%0A    return (%0A
-  
       %3Cdiv class
@@ -1253,18 +1253,16 @@
 tails%22%3E%0A
-  
         
@@ -1316,34 +1316,32 @@
 Plan.url%7D%3C/div%3E%0A
-  
         %3Cdiv cla
@@ -1401,26 +1401,24 @@
 iv%3E%0A        
-  
 %3Cdiv classNa
@@ -1461,18 +1461,16 @@
         
-  
 %7Bcurrent
@@ -1491,26 +1491,24 @@
 on%7D%0A        
-  
 %3C/div%3E%0A     
@@ -1504,26 +1504,24 @@
 /div%3E%0A      
- 
- 
 %3C/div%3E);%0A   
@@ -1517,26 +1517,24 @@
 /div%3E);%0A
-  
   %7D,%0A%0A  
   /**%0A  
@@ -1525,24 +1525,20 @@
   %7D,%0A%0A  
- 
- 
 /**%0A
-  
     Gene
@@ -1611,18 +1611,16 @@
 d.%0A%0A    
-  
 @method 
@@ -1636,18 +1636,16 @@
 NoPlans%0A
-  
     @ret
@@ -1694,19 +1694,15 @@
 UI.%0A
-  
   */%0A  
- 
- 
 _gen
@@ -1720,34 +1720,32 @@
 s: function() %7B%0A
-  
     return (%0A   
@@ -1739,34 +1739,32 @@
  return (%0A      
-  
 %3Cdiv className=%22
@@ -1797,18 +1797,16 @@
         
- 
- 
 You have
@@ -1823,26 +1823,24 @@
  plan%0A      
-  
 %3C/div%3E);%0A   
@@ -1840,18 +1840,14 @@
 %3E);%0A
-  
   %7D,%0A%0A
-  
   re
@@ -1869,18 +1869,16 @@
 ) %7B%0A    
-  
 return (
@@ -1874,26 +1874,24 @@
    return (%0A
-  
       %3Cdiv c
@@ -1925,18 +1925,16 @@
         
-  
 %7Bthis.pr
@@ -1961,18 +1961,16 @@
         
- 
- 
 this._ge
@@ -2014,34 +2014,32 @@
 oPlans()%7D%0A      
-  
 %3C/div%3E%0A      );%0A
@@ -2037,26 +2037,108 @@
     
-  );%0A    %7D%0A%0A  %7D);%0A
+);%0A  %7D%0A%0A%7D);%0A%0AYUI.add('inspector-plan', function() %7B%0A  juju.components.InspectorPlan = InspectorPlan;
 %0A%7D, 

Update InspectorPlan component.