<commit_before>
// bootstrap plugin loader
var jolokiaUrl = hawtioPluginLoader.parseQueryString()['url'] || "/jolokia";

hawtioPluginLoader.addUrl("jolokia:" + jolokiaUrl + ":hawtio:type=plugin,name=*");
hawtioPluginLoader.addUrl('/hawtio/test.json');

interface IMyAppScope extends ng.IRootScopeService, ng.IScope {
  lineCount: (value:any) => number;
  detectTextFormat: (value:any) => string;
  params: ng.IRouteParamsService;
  is: (type:any, value:any) => bool;
  empty: (value:any) => bool;
  log: (variable:string) => void;
  alert: (text:string) => void;
}

var myApp = angular.module('hawtioCore', ['bootstrap', 'ngResource']);

hawtioPluginLoader.addModule('hawtioCore');

myApp.config(($routeProvider) => {
  $routeProvider.
          when('/attributes', {templateUrl: 'app/core/html/attributes.html', controller: Core.AttributesController}).
          when('/operations', {templateUrl: 'app/core/html/operations.html', controller: Core.OperationsController}).
          when('/charts', {templateUrl: 'app/core/html/charts.html', controller: Core.Charts.ChartController}).
          when('/chartEdit', {templateUrl: 'app/core/html/chartEdit.html', controller: Core.Charts.ChartEditController}).
          when('/preferences', {templateUrl: 'app/core/html/preferences.html'}).
          when('/help', {
            redirectTo: '/help/overview'
          }).
          when('/help/:tabName', {templateUrl: 'app/core/html/help.html', controller: Core.NavBarController}).

          otherwise({redirectTo: '/help/overview'});
});

myApp.service('localStorage', function () {
      // TODO Create correct implementation of windowLocalStorage
      var storage:WindowLocalStorage = window.localStorage || <any> (function () {
        return {};
      })();
      return storage;
    });

myApp.factory('jolokia', ($location:ng.ILocationService, localStorage) => {
    var storedUrl = localStorage['url']
    var jolokiaUrl = $location.search()['url'] || storedUrl || url("/jolokia");
    console.log("Jolokia URL is " + jolokiaUrl);
    var jolokia = new Jolokia(jolokiaUrl);
    localStorage['url'] = jolokiaUrl;
    return jolokia;
  });

myApp.factory('workspace',($location:ng.ILocationService, $compile:ng.ICompileService, $templateCache:ng.ITemplateCacheService, localStorage:WindowLocalStorage, jolokia) => {
      return new Workspace(jolokia, $location, $compile, $templateCache, localStorage);
    });


myApp.filter('humanize', () => humanizeValue)


myApp.run(($rootScope, $routeParams, jolokia, workspace, localStorage) => {

        $.support.cors = true;

        /**<commit_msg>disabled local storage for URL for now; as if the URL is stored as a bad value it didn't seem possible to get the app working again; we maybe should just keep it in the URL? or have an alias or something?<commit_after>
// bootstrap plugin loader
var jolokiaUrl = hawtioPluginLoader.parseQueryString()['url'] || "/jolokia";

console.log("hawtioPluginLoader parsed jolokiaUrl: " + jolokiaUrl);
hawtioPluginLoader.addUrl("jolokia:" + jolokiaUrl + ":hawtio:type=plugin,name=*");
hawtioPluginLoader.addUrl('/hawtio/test.json');

interface IMyAppScope extends ng.IRootScopeService, ng.IScope {
  lineCount: (value:any) => number;
  detectTextFormat: (value:any) => string;
  params: ng.IRouteParamsService;
  is: (type:any, value:any) => bool;
  empty: (value:any) => bool;
  log: (variable:string) => void;
  alert: (text:string) => void;
}

var myApp = angular.module('hawtioCore', ['bootstrap', 'ngResource']);

hawtioPluginLoader.addModule('hawtioCore');

myApp.config(($routeProvider) => {
  $routeProvider.
          when('/attributes', {templateUrl: 'app/core/html/attributes.html', controller: Core.AttributesController}).
          when('/operations', {templateUrl: 'app/core/html/operations.html', controller: Core.OperationsController}).
          when('/charts', {templateUrl: 'app/core/html/charts.html', controller: Core.Charts.ChartController}).
          when('/chartEdit', {templateUrl: 'app/core/html/chartEdit.html', controller: Core.Charts.ChartEditController}).
          when('/preferences', {templateUrl: 'app/core/html/preferences.html'}).
          when('/help', {
            redirectTo: '/help/overview'
          }).
          when('/help/:tabName', {templateUrl: 'app/core/html/help.html', controller: Core.NavBarController}).

          otherwise({redirectTo: '/help/overview'});
});

myApp.service('localStorage', function () {
      // TODO Create correct implementation of windowLocalStorage
      var storage:WindowLocalStorage = window.localStorage || <any> (function () {
        return {};
      })();
      return storage;
    });

myApp.factory('jolokia', ($location:ng.ILocationService, localStorage) => {
    // TODO disabled local storage for now as things got borked when trying to get back to local URL
    // - having a named URL might be better which we expose in the route. e.g. /machine/foo/.... which then maps to using URI for foo or something
    //var storedUrl = localStorage['url']
    var storedUrl = null;
    var jolokiaUrl = $location.search()['url'] || storedUrl || url("/jolokia");
    console.log("Jolokia URL is " + jolokiaUrl);
    var jolokia = new Jolokia(jolokiaUrl);
    localStorage['url'] = jolokiaUrl;
    return jolokia;
  });

myApp.factory('workspace',($location:ng.ILocationService, $compile:ng.ICompileService, $templateCache:ng.ITemplateCacheService, localStorage:WindowLocalStorage, jolokia) => {
      return new Workspace(jolokia, $location, $compile, $templateCache, localStorage);
    });


myApp.filter('humanize', () => humanizeValue)


myApp.run(($rootScope, $routeParams, jolokia, workspace, localStorage) => {

        $.support.cors = true;

        /**
{'fraction_non_alphanumeric': 0.15559044130472702, 'fraction_numerical': 0.0, 'mean_word_length': 4.156474820143885, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6607822', 'n_tokens_mistral': 1773, 'n_tokens_neox': 1721, 'n_words': 369}