<div  id="threadForm" ng-controller="Jmx.OperationsController">

  <div class="row-fluid" ng-show="isOperationsEmpty()">
    The selected MBean has no JMX operations.
  </div>

  <div class="row-fluid" ng-hide="isOperationsEmpty() || showInvoke">
    <div class="pull-right">
      <hawtio-filter ng-model="methodFilter" placeholder="Filter..." save-as="{{objectName}}-text-filter"></hawtio-filter>
    </div>
  </div>


  <script type="text/ng-template" id="operationTemplate">
    <div>
      <div ng-controller="Jmx.OperationController">

        <div ng-show="operationResult!=''">
          <div class="row-fluid">
            <div class="control-group pull-right">
              <div class="controls">
                <button class="btn"
                        zero-clipboard
                        data-clipboard-text="{{operationResult}}"
                        title="Copy value to clipboard">
                  <i class="icon-copy"></i>
                </button>
                <button class="btn cancel"
                        ng-click="close()">
                  <i class="icon-remove"></i> Close
                </button>
                <button class="btn"
                        ng-disabled="isExecuting"
                        ng-click="ok()">
                  <i class="icon-ok"></i> Back
                </button>
              </div>
            </div>
          </div>
          <div class="row-fluid">
            <div hawtio-editor="operationResult" mode="html" read-only="nocursor"></div>
          </div>
        </div>

        <div ng-show="operationResult==''">
          <div class="row-fluid">
            <div class="control-group pull-right">
              <div class="controls">
                <button class="btn"
                        ng-click="reset()"
                        ng-show="args">
                  <i class="icon-undo"></i> Reset
                </button>
                <button class="btn cancel"
                        ng-click="close()">
                  <i class="icon-remove"></i> Close
                </button>
                <button class="btn btn-success execute"
                        ng-disabled="isExecuting"
                        hawtio-submit="entryForm">
                  <i class="{{executeIcon}}"></i> Execute
                </button>
              </div>
            </div>
            <div simple-form data="formConfig"
                 entity="entity"
                 name="entryForm"></div>
          </div>
        </div>

      </div>
    </div>
  </script>

  <div ng-show="showInvoke">
    <div compile="template"></div>
  </div>

  <ul ng-hide="showInvoke" class="zebra-list" ng-hide="isOperationsEmpty()">
    <li class="operation-row"
        ng-repeat="operation in operations"
        ng-show="doFilter(operation)"
        ng-click="invokeOp(operation)"
        ng-class="getClass(operation)"
        title="Click to invoke {{operation.name}}"
        data-placement="bottom">
      <i class="icon-cog"
         ng-class="getClass(operation)"></i>
      <span>{{operation.name}}</span>
      <span class="operation-actions">
        <button class="btn"
                zero-clipboard
                data-clipboard-text="{{operation.name}}"
                title="Copy method name to clipboard">
          <i class="icon-copy"></i>
        </button>
      </span>
    </li>
  </ul>

</div>
