<commit_before>{% extends "common/base.html" %}

{% block title %}
    <title>Data Catalog</title>
{% endblock %}

{% block head %}

  <link href="/css/compiled/index.css" rel="stylesheet" type="text/css" />
  <!-- partials -->
  <script src="/js/partials/compiled/index.js" type="text/javascript"></script>
  <script src="/js/partials/compiled/svgplot.js" type="text/javascript"></script>
  <!-- lunr needs to be imported by a script tag -->
  <script src="/lib/lunr.js/lunr.js" type="text/javascript"></script>
  <script src="/js/compiled/index.js" type="text/javascript"></script>

  <script src="/js/compiled/svgplot.js" type="text/javascript"></script>
{% endblock %}

{%block body %}
<div class="container-fluid">
  <div id="navbar" class="row"></div>
</div>

<div id="wrapper">
  {# <div id="sidebar-wrapper" class="hidden navbar-default"> #}
  {# </div>  #}
  <!-- #sidebar-wrapper -->
  <div id="page-content-wrapper">
      <div class="content-fluid">
          <div class="row">
              <div class="panel-search">
                </br>
                  <div class="panel">
                      <div class="panel-heading">
                          <div class="row">
                          <div class="col-md-4">
                              <button id="assetCreatorBtn" type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#assetCreatorModal">Create Asset</button>
                          </div>
                          <div class="col-md-5">
                              <div class="pagination pagination-sm pagination-right pagination-boxes"></div>
                          </div>
                          <div class="col-md-3 panel-search text-right">
                              <input id='search' type="text" placeholder="&#xf002; Search">
                              <span id="search-clear" class="glyphicon glyphicon-remove-circle"></span>
                          </div>
                      </div>
                      </div>

                      <div class="panel-body">
                          <div id="stream-table-view">
                              <table  class="table table-bordered table-striped table-selectable">
                                  <i  class="fa fa-spinner fa-spin" style="margin-left:50%;font-size:90px;"> </i>
                                  <thead>
                                  </thead>
                              </table>
                          </div> <!-- #view -->
                          <div class="paginator row text-center">
                              <div class="pagination-info"> </div>
                          </div>
                      </div> <!-- .panel-body -->
                  </div> <!-- .panel -->
              </div> <!-- .panel-search -->
          </div> <!-- .row -->
    </div> <!-- .content-fluid -->
  </div> <!-- #page-content-wrapper -->
    <div id="stream-download-modal"></div>
    <div id='download-ok-modal'></div>
    <div id='download-fail-modal'></div>
</div> <!-- #wrapper -->


<script type="text/javascript">
var bannerTitle = "Data Catalog";

var userId = parseInt(window.location.href.split('/').pop());

_.extend(OOI.prototype, Backbone.Events, {
  login: new LoginModel(),
  collections: {
    streams: new StreamCollection()
  },
  views: {
  },
  models: {
    userModel: new UserModel()
  },
  start: function() {
    var self = this;
    this.login.fetch({async: false});

    this.views.banner = new BannerView({bannerTitle : bannerTitle});
    $('body').prepend(this.views.banner.el);

    this.views.navbar = new NavbarView({
        el: $('#navbar')
    });

    if(this.login.loggedIn()) {
      this.models.userModel.fetch({url: '/api/current_user'});
    }

    this.views.navbar = new NavbarView();
    $('body').prepend(this.views.navbar.el);
    this.views.navbar.sidebarToggle();

    this.views.streamTableView = new StreamTableView({
      collection: this.collections.streams,
      el: $('#stream-table-view')
    });

    this.views.streamDownloadFormView = new StreamDownloadFormView({
      el: $('#stream-download-modal')
    });
    this.views.modalDownloadView = new ModalDownloadView({
      el: $('#download-ok-modal')
      });
    this.views.modalDownloadFailView = new ModalDownloadFailView({
      el: $('#download-fail-modal')
      });


    // Get the list of streams from the API
    updateCollection( showStreams );

    // When the custom event fires, update the pagination
    this.listenTo(collection, "collection:updated", function(details){
            updatePagination(details, showStreams);
    });

    //this.collections.streams.fetch({reset:true});

    /* Dispatcher Section */
    this.listenTo(this, "login:success", function() { location.reload(); });
    this.listenTo(this, "login:logout", function() { location.reload(); });
    this.listenTo(this, 'StreamTableItemView:onRowClick', function(row) {

        row.focus();

      //get the model
      var ref_des = row.model.get('reference_designator')
      var ref_des_split = ref_des.split("-")
      //get the current location
      if (!location.origin)
        location.origin = location.protocol + "//" + location.host;

      //get the parts
      var array = ref_des.substring(0, 2);
      var mooring = ref_des_split[0]
      var platform = ref_des_split[1]
      var instrument = ref_des
      var instrument_url = [array, mooring, platform , instrument].join("/");

      var win = window.open(location.origin+"/plotting/"+instrument_url, '_blank');
      win.focus();


    });

    this.listenTo(this, 'StreamTableItemView:onClick', function(options) {
      var base_url = window.location.protocol+"//"+window.location.host+"/"
      var download_link = options.model.get('download');
      var download_link_url = download_link[options['selection']]

      base_url+=download_link_url+"/"+options.model.get('start')+"/"+ options.model.get('end')

      self.views.streamDownloadFormView.show(options);
      console.log(options)
      //window.open(base_url, '_blank');

    });
    this.listenTo(this, 'DownloadModal:onHide',function(){<commit_msg>remove console logs<commit_after>{% extends "common/base.html" %}

{% block title %}
    <title>Data Catalog</title>
{% endblock %}

{% block head %}

  <link href="/css/compiled/index.css" rel="stylesheet" type="text/css" />
  <!-- partials -->
  <script src="/js/partials/compiled/index.js" type="text/javascript"></script>
  <script src="/js/partials/compiled/svgplot.js" type="text/javascript"></script>
  <!-- lunr needs to be imported by a script tag -->
  <script src="/lib/lunr.js/lunr.js" type="text/javascript"></script>
  <script src="/js/compiled/index.js" type="text/javascript"></script>

  <script src="/js/compiled/svgplot.js" type="text/javascript"></script>
{% endblock %}

{%block body %}
<div class="container-fluid">
  <div id="navbar" class="row"></div>
</div>

<div id="wrapper">
  {# <div id="sidebar-wrapper" class="hidden navbar-default"> #}
  {# </div>  #}
  <!-- #sidebar-wrapper -->
  <div id="page-content-wrapper">
      <div class="content-fluid">
          <div class="row">
              <div class="panel-search">
                </br>
                  <div class="panel">
                      <div class="panel-heading">
                          <div class="row">
                          <div class="col-md-4">
                              <button id="assetCreatorBtn" type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#assetCreatorModal">Create Asset</button>
                          </div>
                          <div class="col-md-5">
                              <div class="pagination pagination-sm pagination-right pagination-boxes"></div>
                          </div>
                          <div class="col-md-3 panel-search text-right">
                              <input id='search' type="text" placeholder="&#xf002; Search">
                              <span id="search-clear" class="glyphicon glyphicon-remove-circle"></span>
                          </div>
                      </div>
                      </div>

                      <div class="panel-body">
                          <div id="stream-table-view">
                              <table  class="table table-bordered table-striped table-selectable">
                                  <i  class="fa fa-spinner fa-spin" style="margin-left:50%;font-size:90px;"> </i>
                                  <thead>
                                  </thead>
                              </table>
                          </div> <!-- #view -->
                          <div class="paginator row text-center">
                              <div class="pagination-info"> </div>
                          </div>
                      </div> <!-- .panel-body -->
                  </div> <!-- .panel -->
              </div> <!-- .panel-search -->
          </div> <!-- .row -->
    </div> <!-- .content-fluid -->
  </div> <!-- #page-content-wrapper -->
    <div id="stream-download-modal"></div>
    <div id='download-ok-modal'></div>
    <div id='download-fail-modal'></div>
</div> <!-- #wrapper -->


<script type="text/javascript">
var bannerTitle = "Data Catalog";

var userId = parseInt(window.location.href.split('/').pop());

_.extend(OOI.prototype, Backbone.Events, {
  login: new LoginModel(),
  collections: {
    streams: new StreamCollection()
  },
  views: {
  },
  models: {
    userModel: new UserModel()
  },
  start: function() {
    var self = this;
    this.login.fetch({async: false});

    this.views.banner = new BannerView({bannerTitle : bannerTitle});
    $('body').prepend(this.views.banner.el);

    this.views.navbar = new NavbarView({
        el: $('#navbar')
    });

    if(this.login.loggedIn()) {
      this.models.userModel.fetch({url: '/api/current_user'});
    }

    this.views.navbar = new NavbarView();
    $('body').prepend(this.views.navbar.el);
    this.views.navbar.sidebarToggle();

    this.views.streamTableView = new StreamTableView({
      collection: this.collections.streams,
      el: $('#stream-table-view')
    });

    this.views.streamDownloadFormView = new StreamDownloadFormView({
      el: $('#stream-download-modal')
    });
    this.views.modalDownloadView = new ModalDownloadView({
      el: $('#download-ok-modal')
      });
    this.views.modalDownloadFailView = new ModalDownloadFailView({
      el: $('#download-fail-modal')
      });


    // Get the list of streams from the API
    updateCollection( showStreams );

    // When the custom event fires, update the pagination
    this.listenTo(collection, "collection:updated", function(details){
            updatePagination(details, showStreams);
    });

    //this.collections.streams.fetch({reset:true});

    /* Dispatcher Section */
    this.listenTo(this, "login:success", function() { location.reload(); });
    this.listenTo(this, "login:logout", function() { location.reload(); });
    this.listenTo(this, 'StreamTableItemView:onRowClick', function(row) {

        row.focus();

      //get the model
      var ref_des = row.model.get('reference_designator')
      var ref_des_split = ref_des.split("-")
      //get the current location
      if (!location.origin)
        location.origin = location.protocol + "//" + location.host;

      //get the parts
      var array = ref_des.substring(0, 2);
      var mooring = ref_des_split[0]
      var platform = ref_des_split[1]
      var instrument = ref_des
      var instrument_url = [array, mooring, platform , instrument].join("/");

      var win = window.open(location.origin+"/plotting/"+instrument_url, '_blank');
      win.focus();


    });

    this.listenTo(this, 'StreamTableItemView:onClick', function(options) {
      var base_url = window.location.protocol+"//"+window.location.host+"/"
      var download_link = options.model.get('download');
      var download_link_url = download_link[options['selection']]

      base_url+=download_link_url+"/"+options.model.get('start')+"/"+ options.model.get('end')

      self.views.streamDownloadFormView.show(options);
      //window.open(base_url, '_blank');

    });
    this.listenTo(this, 'DownloadModal:onHide',function(){
{'fraction_non_alphanumeric': 0.16741490490572197, 'fraction_numerical': 0.002285527712023508, 'mean_word_length': 2.1343054489639295, 'pattern_counts': {'":': 0, '<': 165, '<?xml version=': 0, '>': 165, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5378626', 'n_tokens_mistral': 3627, 'n_tokens_neox': 3488, 'n_words': 656}