{% extends "base.html" %}


{% block main_body_right %}
    <!-- Content Header (Page header) -->
    <section class="content-header">


<div class="row search">
  <div class="col-sm-12 col-sm-offset-0">
    <form action="/global_search" role="form" method="post" >
            <div class="input-group">
              <input id="q_search"  type="text" name="q" class="form-control" placeholder="Search Entities, Files and Attributes..." value="">
              <span class="input-group-btn">
                <button class="btn btn-default" type="submit"><span class="fa fa-search"></span></button>
              </span>
            </div>
    </form>
  </div>
</div>

<script>
            $(function() {
                function displayResult(item) {
                    $('.alert').show().html('You selected <strong>' + item.value + '</strong>: <strong>' + item.text + '</strong>');
                }
                $('#q_search').typeahead({
                    ajax: {
                        url: '/search_suggestion_json',
                        method: 'get',
                        triggerLength: 1
                    },
                    onSelect: displayResult
                });

            });
</script>
    </section>

    <!-- Main content -->
    <section class="content">


      <div class="row">
        <div class="col-md-12">


        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

      <!-- Main row -->
      <div class="row">
        <!-- Left col -->
        <div class="col-md-12">
          <!-- MAP & BOX PANE -->

          <!-- TABLE: LATEST ORDERS -->
          <div class="box box-info">
            <div class="box-header with-border">
              <center></center><h3 class="box-title">List of Data Source Plugins</h3> </center>
              <div class="box-tools pull-right">

    <form action="/reload_plugins" role="form" method="get" >
                <button type="submit" class="btn  btn-danger"  data-toggle="tooltip" title="Reload Plugins from disk!" >Re-Scan Plugins </button>
    </form>


              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <div class="table-responsive">
                <table class="table no-margin">
                  <thead>
                  <tr>
                    <th>Data Source Type Name</th>
                    <th>Plugin Path</th>
                    <th>Description</th>
                    <th>Operations</th>
                  </tr>
                  </thead>
                  <tbody>


              {% for p in base_navigation_dict['plugin_list']   %}
                  <tr>
                    <td>{{p.plugin_name}} </td>
                    <td    data-toggle="tooltip" title="{{p.plugin_spec_path}}">{{p.module_name}} </td>
                    <td>{{p.plugin_desc}}</td>
                    <td><a href="/add_data_source?ds_type={{p.plugin_name}}" class="btn btn-info  btn-sm" role="button">Create Data Source</a></td>
                  </tr>
              {% end %}


                  </tbody>
                </table>
              </div>
              <!-- /.table-responsive -->
            </div>
            <!-- /.box-body -->
            <!-- /.box-footer -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
 <!-- Left col -->
        <div class="col-md-12">
          <!-- MAP & BOX PANE -->

          <!-- TABLE: LATEST ORDERS -->
          <div class="box box-info">
            <div class="box-header with-border">
              <center></center><h3 class="box-title">List of Data Sources</h3> </center>

              <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <div class="table-responsive">
                <table class="table no-margin">
                  <thead>
                  <tr>
                    <th>Data Source Name</th>
                    <th>Parameters</th>
                    <th>Create Date</th>
                    <th>Last Reflect Date</th>
                  </tr>

                  </thead>
                  <tbody>

              {% for ds in base_navigation_dict['dbrs']   %}
                  <tr>
                    <td><a  href="/database_summary?ds_name={{ '.'.join([row.ds_name])  }}">
                      　　{{ds.ds_name}}</a></td>
                    <td>{{ds.ds_param}}</td>
                    <td>{{ds.created_date.strftime("%Y-%m-%d %H:%M:%S")}}</td>
                    <td>{{ds.last_reflect_date.strftime("%Y-%m-%d %H:%M:%S") if ds.last_reflect_date is not None else '' }}</td>
                  </tr>
              {% end %}

　                  </tbody>
                </table>
              </div>
              <!-- /.table-responsive -->
            </div>
            <!-- /.box-body>
            <div class="box-footer clearfix">
              <a href="javascript:void(0)" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a>
              <a href="javascript:void(0)" class="btn btn-sm btn-default btn-flat pull-right">View All Orders</a>
            </div -->
            <!-- /.box-footer -->
          </div>
          <!-- /.box -->
        </div>

        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->

{% end %}

{% block main_body_right_nouse %}

          <!-- PRODUCT LIST -->
          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">Recently Added Tags</h3>

              <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <ul class="products-list product-list-in-box">
                <li class="item">
                  <div class="product-img">
                    <img src="{{ static_url("adminlte/img/default-50x50.gif") }}" alt="Product Image">
                  </div>
                  <div class="product-info">
                    <a href="javascript:void(0)" class="product-title">Samsung TV
                      <span class="label label-warning pull-right">$1800</span></a>
                        <span class="product-description">
                          Samsung 32" 1080p 60Hz LED Smart HDTV.
                        </span>
                  </div>
                </li>
                <!-- /.item -->
                <li class="item">
                  <div class="product-img">
                    <img src="{{ static_url("adminlte/img/default-50x50.gif") }}" alt="Product Image">
                  </div>
                  <div class="product-info">
                    <a href="javascript:void(0)" class="product-title">Bicycle
                      <span class="label label-info pull-right">$700</span></a>
                        <span class="product-description">
                          26" Mongoose Dolomite Men's 7-speed, Navy Blue.
                        </span>
                  </div>
                </li>
                <!-- /.item -->
                <li class="item">
                  <div class="product-img">
                    <img src="{{ static_url("adminlte/img/default-50x50.gif") }}" alt="Product Image">
                  </div>
                  <div class="product-info">
                    <a href="javascript:void(0)" class="product-title">Xbox One <span class="label label-danger pull-right">$350</span></a>
                        <span class="product-description">
                          Xbox One Console Bundle with Halo Master Chief Collection.
                        </span>
                  </div>
                </li>
                <!-- /.item -->
                <li class="item">
                  <div class="product-img">
                    <img src="{{ static_url("adminlte/img/default-50x50.gif") }}" alt="Product Image">
                  </div>
                  <div class="product-info">
                    <a href="javascript:void(0)" class="product-title">PlayStation 4
                      <span class="label label-success pull-right">$399</span></a>
                        <span class="product-description">
                          PlayStation 4 500GB Console (PS4)
                        </span>
                  </div>
                </li>
                <!-- /.item -->
              </ul>
            </div>
            <!-- /.box-body -->
            <div class="box-footer text-center">
              <a href="javascript:void(0)" class="uppercase">View All Products</a>
            </div>
            <!-- /.box-footer -->
          </div>
          <!-- /.box -->

{% end %}
