hunk.code_window:           $state.go('auth', {error: 'Your session has expired'});
           });
         }
       }, function error(err) {
         Messages.error("Failure", err, 'Unable to retrieve application settings');
       });
  
hunk.labels: keep keep add keep keep keep keep
hunk.after_edit:       if (state.application.analytics) {
           Analytics.offline(false);
           Analytics.registerScriptTags();
           Analytics.registerTrackers();
           $rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
             Analytics.trackPage(toState.url);
             Analytics.pageView();
           });
         }
  
hunk.file_path: app/app.js
hunk.type: add
file: angular.module('portainer.services')
  .factory('NetworkService', ['$q', 'Network', function NetworkServiceFactory($q, Network) {
    'use strict';
    var service = {};
  
    service.getNetworks = function() {
      return Network.query({}).$promise;
    };
  
    service.filterGlobalNetworks = function(networks) {
      return networks.filter(function (network) {
        if (network.Scope === 'global') {
          return network;
        }
      });
    };
  
    service.addPredefinedLocalNetworks = function(networks) {
      networks.push({Scope: "local", Name: "bridge"});
      networks.push({Scope: "local", Name: "host"});
      networks.push({Scope: "local", Name: "none"});
    };
  
    return service;
  }]);
  