text: /// <reference path="../libs/hawtio-forms/defs.d.ts"/>
  /// <reference path="../libs/hawtio-ui/defs.d.ts"/>
  /// <reference path="../libs/hawtio-utilities/defs.d.ts"/>
  /// <reference path="../libs/hawtio-wiki/defs.d.ts"/>
  
  // <reference path="../../includes.ts"/>
  var Forge;
  (function (Forge) {
      Forge.context = '/forge';
      Forge.hash = '#' + Forge.context;
      Forge.defaultRoute = Forge.hash + '/projects';
      Forge.pluginName = 'Forge';
      Forge.pluginPath = 'plugins/forge/';
      Forge.templatePath = Forge.pluginPath + 'html/';
      Forge.log = Logger.get(Forge.pluginName);
      Forge.defaultIconUrl = Core.url("/img/forge.svg");
      Forge.gogsServiceName = "gogs";
      Forge.orionServiceName = "orion";
      Forge.loggedInToGogs = false;
      function isForge(workspace) {
          return true;
      }
      Forge.isForge = isForge;
      function commandLink(name, resourcePath) {
          if (name) {
              if (resourcePath) {
                  return UrlHelpers.join("/forge/command", name, resourcePath);
              }
              else {
                  return UrlHelpers.join("/forge/command/", name);
              }
          }
          return null;
      }
      Forge.commandLink = commandLink;
      function commandsLink(resourcePath) {
          if (resourcePath) {
              return UrlHelpers.join("/forge/commands/user", resourcePath);
          }
          else {
              return "/forge/commands";
          }
      }
      Forge.commandsLink = commandsLink;
      function reposApiUrl(ForgeApiURL) {
          return UrlHelpers.join(ForgeApiURL, "/repos");
      }
      Forge.reposApiUrl = reposApiUrl;
      function repoApiUrl(ForgeApiURL, path) {
          return UrlHelpers.join(ForgeApiURL, "/repos/user", path);
      }
      Forge.repoApiUrl = repoApiUrl;
      function commandApiUrl(ForgeApiURL, commandId, resourcePath) {
          if (resourcePath === void 0) { resourcePath = null; }
          return UrlHelpers.join(ForgeApiURL, "command", commandId, resourcePath);
      }
      Forge.commandApiUrl = commandApiUrl;
      function executeCommandApiUrl(ForgeApiURL, commandId) {
          return UrlHelpers.join(ForgeApiURL, "command", "execute", commandId);
      }
      Forge.executeCommandApiUrl = executeCommandApiUrl;
      function validateCommandApiUrl(ForgeApiURL, commandId) {
          return UrlHelpers.join(ForgeApiURL, "command", "validate", commandId);
      }
      Forge.validateCommandApiUrl = validateCommandApiUrl;
      function commandInputApiUrl(ForgeApiURL, commandId, resourcePath) {
          return UrlHelpers.join(ForgeApiURL, "commandInput", commandId, resourcePath);
      }
      Forge.commandInputApiUrl = commandInputApiUrl;
      /**
       * Returns the project for the given resource path
       */
      function modelProject(ForgeModel, resourcePath) {
          if (resourcePath) {
              var project = ForgeModel.projects[resourcePath];
              if (!project) {
                  project = {};
                  ForgeModel.projects[resourcePath] = project;
              }
              return project;
          }
          else {
              return ForgeModel.rootProject;
          }
      }
      function setModelCommands(ForgeModel, resourcePath, commands) {
          var project = modelProject(ForgeModel, resourcePath);
          project.$commands = commands;
      }
      Forge.setModelCommands = setModelCommands;
      function getModelCommands(ForgeModel, resourcePath) {
          var project = modelProject(ForgeModel, resourcePath);
          return project.$commands || [];
      }
      Forge.getModelCommands = getModelCommands;
      function modelCommandInputMap(ForgeModel, resourcePath) {
          var project = modelProject(ForgeModel, resourcePath);
          var commandInputs = project.$commandInputs;
          if (!commandInputs) {
              commandInputs = {};
              project.$commandInputs = commandInputs;
          }
          return commandInputs;
      }
      function getModelCommandInputs(ForgeModel, resourcePath, id) {
          var commandInputs = modelCommandInputMap(ForgeModel, resourcePath);
          return commandInputs[id];
      }
      Forge.getModelCommandInputs = getModelCommandInputs;
      function setModelCommandInputs(ForgeModel, resourcePath, id, item) {
          var commandInputs = modelCommandInputMap(ForgeModel, resourcePath);
          return commandInputs[id] = item;
      }
      Forge.setModelCommandInputs = setModelCommandInputs;
      function enrichRepo(repo) {
          var owner = repo.owner || {};
          var user = owner.username || repo.user;
          var name = repo.name;
          var avatar_url = owner.avatar_url;
          if (avatar_url && avatar_url.startsWith("http//")) {
              avatar_url = "http://" + avatar_url.substring(6);
              owner.avatar_url = avatar_url;
          }
          if (user && name) {
              var resourcePath = user + "/" + name;
              repo.$commandsLink = commandsLink(resourcePath);
              repo.$buildsLink = "/kubernetes/builds?q=/" + resourcePath + ".git";
              var injector = HawtioCore.injector;
              if (injector) {
                  var ServiceRegistry = injector.get("ServiceRegistry");
                  if (ServiceRegistry) {
                      var orionLink = ServiceRegistry.serviceLink(Forge.orionServiceName);
                      var gogsService = ServiceRegistry.findService(Forge.gogsServiceName);
                      if (orionLink && gogsService) {
                          var portalIp = gogsService.portalIP;
                          if (portalIp) {
                              var port = gogsService.port;
                              var portText = (port && port !== 80 && port !== 443) ? ":" + port : "";
                              var protocol = (port && port === 443) ? "https://" : "http://";
                              var gitCloneUrl = UrlHelpers.join(protocol + portalIp + portText + "/", resourcePath + ".git");
                              repo.$openProjectLink = UrlHelpers.join(orionLink, "/git/git-repository.html#,createProject.name=" + name + ",cloneGit=" + gitCloneUrl);
                          }
                      }
                  }
              }
          }
      }
      Forge.enrichRepo = enrichRepo;
      function createHttpConfig() {
          var authHeader = localStorage["gogsAuthorization"];
          var email = localStorage["gogsEmail"];
          var config = {};
          return config;
      }
      Forge.createHttpConfig = createHttpConfig;
      function addQueryArgument(url, name, value) {
          if (url && name && value) {
              var sep = (url.indexOf("?") >= 0) ? "&" : "?";
              return url + sep + name + "=" + encodeURIComponent(value);
          }
          return url;
      }
      function createHttpUrl(url, authHeader, email) {
          if (authHeader === void 0) { authHeader = null; }
          if (email === void 0) { email = null; }
          authHeader = authHeader || localStorage["gogsAuthorization"];
          email = email || localStorage["gogsEmail"];
          url = addQueryArgument(url, "_gogsAuth", authHeader);
          url = addQueryArgument(url, "_gogsEmail", email);
          return url;
      }
      Forge.createHttpUrl = createHttpUrl;
      function commandMatchesText(command, filterText) {
          if (filterText) {
              return Core.matchFilterIgnoreCase(angular.toJson(command), filterText);
          }
          else {
              return true;
          }
      }
      Forge.commandMatchesText = commandMatchesText;
      function isLoggedIntoGogs() {
          var authHeader = localStorage["gogsAuthorization"];
          return authHeader ? Forge.loggedInToGogs : false;
          /*
              var config = createHttpConfig();
              return config.headers.Authorization ? true : false;
          */
      }
      Forge.isLoggedIntoGogs = isLoggedIntoGogs;
      function redirectToGogsLoginIfRequired($location, loginPage) {
          if (loginPage === void 0) { loginPage = "/forge/repos"; }
          if (!isLoggedIntoGogs()) {
              $location.path(loginPage);
          }
      }
      Forge.redirectToGogsLoginIfRequired = redirectToGogsLoginIfRequired;
  })(Forge || (Forge = {}));
  
  /// <reference path="../../includes.ts"/>
  /// <reference path="forgeHelpers.ts"/>
  var Forge;
  (function (Forge) {
      Forge._module = angular.module(Forge.pluginName, ['hawtio-core', 'hawtio-ui']);
      Forge.controller = PluginHelpers.createControllerFunction(Forge._module, Forge.pluginName);
      Forge.route = PluginHelpers.createRoutingFunction(Forge.templatePath);
      Forge._module.config(['$routeProvider', function ($routeProvider) {
          $routeProvider.when(UrlHelpers.join(Forge.context, '/repos/:path*'), Forge.route('repo.html', false)).when(UrlHelpers.join(Forge.context, '/repos'), Forge.route('repos.html', false)).when(UrlHelpers.join(Forge.context, '/createProject'), Forge.route('createProject.html', false)).when(UrlHelpers.join(Forge.context, '/commands'), Forge.route('commands.html', false)).when(UrlHelpers.join(Forge.context, '/commands/:path*'), Forge.route('commands.html', false)).when(UrlHelpers.join(Forge.context, '/command/:id'), Forge.route('command.html', false)).when(UrlHelpers.join(Forge.context, '/command/:id/:path*'), Forge.route('command.html', false)).when(Forge.context, { redirectTo: UrlHelpers.join(Forge.context, 'repos') });
      }]);
      // set up a promise that supplies the API URL for Forge, proxied if necessary
      Forge._module.factory('ForgeApiURL', ['jolokiaUrl', 'jolokia', '$q', '$rootScope', function (jolokiaUrl, jolokia, $q, $rootScope) {
          return "/api/forge";
      }]);
      Forge._module.factory('ServiceRegistry', [function () {
          return {
              hasService: function (serviceName) { return Forge.gogsServiceName === serviceName; },
              findService: function (serviceName) { return null; },
              serviceLink: function (serviceName) {
                  if (serviceName === Forge.gogsServiceName) {
                      return "http://gogs.vagrant.local";
                  }
                  else {
                      return null;
                  }
              }
          };
      }]);
      Forge._module.factory('ForgeModel', ['jolokiaUrl', 'jolokia', '$q', '$rootScope', function (jolokiaUrl, jolokia, $q, $rootScope) {
          return {
              rootProject: {},
              projects: []
          };
      }]);
      Forge._module.run(['viewRegistry', 'workspace', 'HawtioNav', function (viewRegistry, workspace, HawtioNav) {
          Forge.log.debug("Running");
          viewRegistry['forge'] = Forge.templatePath + 'layoutForge.html';
          var builder = HawtioNav.builder();
          var repos = builder.id('forge-repos').href(function () { return UrlHelpers.join(Forge.context, 'repos'); }).title(function () { return 'Repositories'; }).build();
          var mainTab = builder.id('forge').rank(110).href(function () { return Forge.context; }).title(function () { return 'Forge'; }).isValid(function () { return Forge.isForge(workspace); }).tabs(repos).build();
          HawtioNav.add(mainTab);
          // disable the images page for now...
          var navItems = HawtioNav.items || [];
          var dockerRegistry = navItems.find(function (item) { return item.id === "docker-registry"; });
          if (dockerRegistry) {
              dockerRegistry.isValid = function () { return false; };
          }
      }]);
      hawtioPluginLoader.addModule(Forge.pluginName);
  })(Forge || (Forge = {}));
  
  /// <reference path="../../includes.ts"/>
  /// <reference path="forgeHelpers.ts"/>
  /// <reference path="forgePlugin.ts"/>
  var Forge;
  (function (Forge) {
      Forge.CommandController = Forge.controller("CommandController", ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "ForgeApiURL", "ForgeModel", function ($scope, $templateCache, $location, $routeParams, $http, $timeout, ForgeApiURL, ForgeModel) {
          $scope.model = ForgeModel;
          $scope.resourcePath = $routeParams["path"] || $location.search()["path"] || "";
          $scope.id = $routeParams["id"];
          $scope.path = $routeParams["path"];
          $scope.avatar_url = localStorage["gogsAvatarUrl"];
          $scope.user = localStorage["gogsUser"];
          $scope.repoName = "";
          var pathSteps = $scope.resourcePath.split("/");
          if (pathSteps && pathSteps.length) {
              $scope.repoName = pathSteps[pathSteps.length - 1];
          }
          $scope.commandsLink = ($scope.path || $scope.id === 'project-new') ? "/forge/repos" : Forge.commandsLink($scope.resourcePath);
          console.log("command page created");
          Forge.redirectToGogsLoginIfRequired($location);
          $scope.entity = {};
          $scope.inputList = [$scope.entity];
          $scope.schema = Forge.getModelCommandInputs(ForgeModel, $scope.resourcePath, $scope.id);
          onSchemaLoad();
          function onRouteChanged() {
              console.log("route updated; lets clear the entity");
              $scope.entity = {};
              $scope.inputList = [$scope.entity];
              $scope.previousSchemaJson = "";
              $scope.schema = null;
              Core.$apply($scope);
              updateData();
          }
          $scope.$on('$routeChangeSuccess', onRouteChanged);
          $scope.execute = function () {
              // TODO check if valid...
              $scope.response = null;
              $scope.executing = true;
              $scope.invalid = false;
              $scope.validationError = null;
              var commandId = $scope.id;
              var resourcePath = $scope.resourcePath;
              var url = Forge.executeCommandApiUrl(ForgeApiURL, commandId);
              var request = {
                  resource: resourcePath,
                  inputList: $scope.inputList
              };
              url = Forge.createHttpUrl(url);
              Forge.log.info("About to post to " + url + " payload: " + angular.toJson(request));
              $http.post(url, request, Forge.createHttpConfig()).success(function (data, status, headers, config) {
                  $scope.executing = false;
                  $scope.invalid = false;
                  $scope.validationError = null;
                  if (data) {
                      data.message = data.message || data.output;
                      var wizardResults = data.wizardResults;
                      if (wizardResults) {
                          angular.forEach(wizardResults.stepValidations, function (validation) {
                              if (!$scope.invalid && !validation.valid) {
                                  var messages = validation.messages || [];
                                  if (messages.length) {
                                      var message = messages[0];
                                      if (message) {
                                          $scope.invalid = true;
                                          $scope.validationError = message.description;
                                          $scope.validationInput = message.inputName;
                                      }
                                  }
                              }
                          });
                          var stepInputs = wizardResults.stepInputs;
                          if (stepInputs) {
                              var schema = _.last(stepInputs);
                              if (schema) {
                                  $scope.entity = {};
                                  updateSchema(schema);
                                  $scope.inputList.push($scope.entity);
                                  if (data.canMoveToNextStep) {
                                      // lets clear the response we've another wizard page to do
                                      data = null;
                                  }
                                  else {
                                      // otherwise indicate that the wizard just completed and lets hide the input form
                                      $scope.wizardCompleted = true;
                                  }
                              }
                          }
                      }
                  }
                  if (!$scope.invalid) {
                      $scope.response = data;
                      var status = ((data || {}).status || "").toString().toLowerCase();
                      $scope.responseClass = toBackgroundStyle(status);
                      var fullName = ((data || {}).outputProperties || {}).fullName;
                      if ($scope.response && fullName && $scope.id === 'project-new') {
                          $scope.response = null;
                          // lets forward to the devops edit page
                          var editPath = UrlHelpers.join("/forge/command/devops-edit/user", fullName);
                          Forge.log.info("Moving to the devops edit path: " + editPath);
                          $location.path(editPath);
                      }
                  }
                  Core.$apply($scope);
              }).error(function (data, status, headers, config) {
                  $scope.executing = false;
                  Forge.log.warn("Failed to load " + url + " " + data + " " + status);
              });
          };
          $scope.$watchCollection("entity", function () {
              validate();
          });
          function updateSchema(schema) {
              if (schema) {
                  // lets remove the values so that we can properly check when the schema really does change
                  // otherwise the schema will change every time we type a character ;)
                  var schemaWithoutValues = angular.copy(schema);
                  angular.forEach(schemaWithoutValues.properties, function (property) {
                      delete property["value"];
                      delete property["enabled"];
                  });
                  var json = angular.toJson(schemaWithoutValues);
                  if (json !== $scope.previousSchemaJson) {
                      console.log("updated schema: " + json);
                      $scope.previousSchemaJson = json;
                      $scope.schema = schema;
                      if ($scope.id === "project-new") {
                          var entity = $scope.entity;
                          // lets hide the target location!
                          var properties = schema.properties || {};
                          var overwrite = properties.overwrite;
                          var catalog = properties.catalog;
                          var targetLocation = properties.targetLocation;
                          if (targetLocation) {
                              targetLocation.hidden = true;
                              if (overwrite) {
                                  overwrite.hidden = true;
                              }
                              console.log("hiding targetLocation!");
                              // lets default the type
                              if (!entity.type) {
                                  entity.type = "From Archetype Catalog";
                              }
                          }
                          if (catalog) {
                              if (!entity.catalog) {
                                  entity.catalog = "fabric8";
                              }
                          }
                      }
                  }
              }
          }
          function validate() {
              if ($scope.executing || $scope.validating) {
                  return;
              }
              var newJson = angular.toJson($scope.entity);
              if (newJson === $scope.validatedEntityJson) {
                  return;
              }
              else {
                  $scope.validatedEntityJson = newJson;
              }
              var commandId = $scope.id;
              var resourcePath = $scope.resourcePath;
              var url = Forge.validateCommandApiUrl(ForgeApiURL, commandId);
              // lets put the entity in the last item in the list
              var inputList = [].concat($scope.inputList);
              inputList[inputList.length - 1] = $scope.entity;
              var request = {
                  resource: resourcePath,
                  inputList: $scope.inputList
              };
              url = Forge.createHttpUrl(url);
              //log.info("About to post to " + url + " payload: " + angular.toJson(request));
              $scope.validating = true;
              $http.post(url, request, Forge.createHttpConfig()).success(function (data, status, headers, config) {
                  this.validation = data;
                  //console.log("got validation " + angular.toJson(data, true));
                  var wizardResults = data.wizardResults;
                  if (wizardResults) {
                      var stepInputs = wizardResults.stepInputs;
                      if (stepInputs) {
                          var schema = _.last(stepInputs);
                          updateSchema(schema);
                      }
                  }
                  Core.$apply($scope);
                  /*
                   * Lets throttle the validations so that we only fire another validation a little
                   * after we've got a reply and only if the model has changed since then
                   */
                  $timeout(function () {
                      $scope.validating = false;
                      validate();
                  }, 200);
              }).error(function (data, status, headers, config) {
                  $scope.executing = false;
                  Forge.log.warn("Failed to load " + url + " " + data + " " + status);
              });
          }
          updateData();
          function toBackgroundStyle(status) {
              if (!status) {
                  status = "";
              }
              if (status.startsWith("suc")) {
                  return "bg-success";
              }
              return "bg-warning";
          }
          function updateData() {
              $scope.item = null;
              var commandId = $scope.id;
              if (commandId) {
                  var resourcePath = $scope.resourcePath;
                  var url = Forge.commandInputApiUrl(ForgeApiURL, commandId, resourcePath);
                  url = Forge.createHttpUrl(url);
                  $http.get(url, Forge.createHttpConfig()).success(function (data, status, headers, config) {
                      if (data) {
                          $scope.fetched = true;
                          console.log("updateData loaded schema");
                          updateSchema(data);
                          Forge.setModelCommandInputs(ForgeModel, $scope.resourcePath, $scope.id, $scope.schema);
                          onSchemaLoad();
                      }
                      Core.$apply($scope);
                  }).error(function (data, status, headers, config) {
                      Forge.log.warn("Failed to load " + url + " " + data + " " + status);
                  });
              }
              else {
                  Core.$apply($scope);
              }
          }
          function onSchemaLoad() {
              // lets update the value if its blank with the default values from the properties
              var schema = $scope.schema;
              $scope.fetched = schema;
              var entity = $scope.entity;
              if (schema) {
                  angular.forEach(schema.properties, function (property, key) {
                      var value = property.value;
                      if (value && !entity[key]) {
                          entity[key] = value;
                      }
                  });
              }
          }
      }]);
  })(Forge || (Forge = {}));
  
  /// <reference path="../../includes.ts"/>
  /// <reference path="forgePlugin.ts"/>
  var Forge;
  (function (Forge) {
      Forge.CommandsController = Forge.controller("CommandsController", ["$scope", "$dialog", "$window", "$templateCache", "$routeParams", "$location", "localStorage", "$http", "$timeout", "ForgeApiURL", "ForgeModel", function ($scope, $dialog, $window, $templateCache, $routeParams, $location, localStorage, $http, $timeout, ForgeApiURL, ForgeModel) {
          $scope.model = ForgeModel;
          $scope.resourcePath = $routeParams["path"] || $location.search()["path"] || "";
          $scope.repoName = "";
          $scope.projectDescription = $scope.resourcePath || "";
          var pathSteps = $scope.projectDescription.split("/");
          if (pathSteps && pathSteps.length) {
              $scope.repoName = pathSteps[pathSteps.length - 1];
          }
          if (!$scope.projectDescription.startsWith("/") && $scope.projectDescription.length > 0) {
              $scope.projectDescription = "/" + $scope.projectDescription;
          }
          Forge.redirectToGogsLoginIfRequired($location);
          $scope.avatar_url = localStorage["gogsAvatarUrl"];
          $scope.user = localStorage["gogsUser"];
          $scope.commands = Forge.getModelCommands(ForgeModel, $scope.resourcePath);
          $scope.fetched = $scope.commands.length !== 0;
          $scope.tableConfig = {
              data: 'commands',
              showSelectionCheckbox: true,
              enableRowClickSelection: false,
              multiSelect: true,
              selectedItems: [],
              filterOptions: {
                  filterText: $location.search()["q"] || ''
              },
              columnDefs: [
                  {
                      field: 'name',
                      displayName: 'Name',
                      cellTemplate: $templateCache.get("idTemplate.html")
                  },
                  {
                      field: 'description',
                      displayName: 'Description'
                  },
                  {
                      field: 'category',
                      displayName: 'Category'
                  }
              ]
          };
          function commandMatches(command) {
              var filterText = $scope.tableConfig.filterOptions.filterText;
              return Forge.commandMatchesText(command, filterText);
          }
          $scope.commandSelector = {
              filterText: "",
              folders: [],
              selectedCommands: [],
              expandedFolders: {},
              isOpen: function (folder) {
                  var filterText = $scope.tableConfig.filterOptions.filterText;
                  if (filterText !== '' || $scope.commandSelector.expandedFolders[folder.id]) {
                      return "opened";
                  }
                  return "closed";
              },
              clearSelected: function () {
                  $scope.commandSelector.expandedFolders = {};
                  Core.$apply($scope);
              },
              updateSelected: function () {
                  // lets update the selected apps
                  var selectedCommands = [];
                  angular.forEach($scope.model.appFolders, function (folder) {
                      var apps = folder.apps.filter(function (app) { return app.selected; });
                      if (apps) {
                          selectedCommands = selectedCommands.concat(apps);
                      }
                  });
                  $scope.commandSelector.selectedCommands = selectedCommands.sortBy("name");
              },
              select: function (command, flag) {
                  var id = command.name;
                  /*
                            app.selected = flag;
                  */
                  $scope.commandSelector.updateSelected();
              },
              getSelectedClass: function (app) {
                  if (app.abstract) {
                      return "abstract";
                  }
                  if (app.selected) {
                      return "selected";
                  }
                  return "";
              },
              showCommand: function (command) {
                  return commandMatches(command);
              },
              showFolder: function (folder) {
                  var filterText = $scope.tableConfig.filterOptions.filterText;
                  return !filterText || folder.commands.some(function (app) { return commandMatches(app); });
              }
          };
          var url = UrlHelpers.join(ForgeApiURL, "commands", $scope.resourcePath);
          url = Forge.createHttpUrl(url);
          Forge.log.info("Fetching commands from: " + url);
          $http.get(url, Forge.createHttpConfig()).success(function (data, status, headers, config) {
              if (angular.isArray(data) && status === 200) {
                  var resourcePath = $scope.resourcePath;
                  var folderMap = {};
                  var folders = [];
                  $scope.commands = _.sortBy(data, "name");
                  angular.forEach($scope.commands, function (command) {
                      var id = command.id || command.name;
                      command.$link = Forge.commandLink(id, resourcePath);
                      var name = command.name || command.id;
                      var folderName = command.category;
                      var shortName = name;
                      var names = name.split(":", 2);
                      if (names != null && names.length > 1) {
                          folderName = names[0];
                          shortName = names[1].trim();
                      }
                      if (folderName === "Project/Build") {
                          folderName = "Project";
                      }
                      command.$shortName = shortName;
                      command.$folderName = folderName;
                      var folder = folderMap[folderName];
                      if (!folder) {
                          folder = {
                              name: folderName,
                              commands: []
                          };
                          folderMap[folderName] = folder;
                          folders.push(folder);
                      }
                      folder.commands.push(command);
                  });
                  folders = _.sortBy(folders, "name");
                  angular.forEach(folders, function (folder) {
                      folder.commands = _.sortBy(folder.commands, "$shortName");
                  });
                  $scope.commandSelector.folders = folders;
                  Forge.setModelCommands($scope.model, $scope.resourcePath, $scope.commands);
                  $scope.fetched = true;
              }
          }).error(function (data, status, headers, config) {
              Forge.log.warn("failed to load " + url + ". status: " + status + " data: " + data);
          });
      }]);
  })(Forge || (Forge = {}));
  
  /// <reference path="../../includes.ts"/>
  /// <reference path="forgeHelpers.ts"/>
  /// <reference path="forgePlugin.ts"/>
  var Forge;
  (function (Forge) {
      Forge.RepoController = Forge.controller("RepoController", ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "ForgeApiURL", function ($scope, $templateCache, $location, $routeParams, $http, $timeout, ForgeApiURL) {
          $scope.name = $routeParams["path"];
          Forge.redirectToGogsLoginIfRequired($location);
          $scope.$on('$routeUpdate', function ($event) {
              updateData();
          });
          updateData();
          function updateData() {
              if ($scope.name) {
                  var url = Forge.repoApiUrl(ForgeApiURL, $scope.name);
                  url = Forge.createHttpUrl(url);
                  var config = Forge.createHttpConfig();
                  $http.get(url, config).success(function (data, status, headers, config) {
                      if (data) {
                          Forge.enrichRepo(data);
                      }
                      $scope.entity = data;
                      $scope.fetched = true;
                  }).error(function (data, status, headers, config) {
                      Forge.log.warn("failed to load " + url + ". status: " + status + " data: " + data);
                  });
              }
              else {
                  $scope.fetched = true;
              }
          }
      }]);
  })(Forge || (Forge = {}));
  
  /// <reference path="../../includes.ts"/>
  /// <reference path="forgePlugin.ts"/>
  var Forge;
  (function (Forge) {
      Forge.ReposController = Forge.controller("ReposController", ["$scope", "$dialog", "$window", "$templateCache", "$routeParams", "$location", "localStorage", "$http", "$timeout", "ForgeApiURL", "ServiceRegistry", function ($scope, $dialog, $window, $templateCache, $routeParams, $location, localStorage, $http, $timeout, ForgeApiURL, ServiceRegistry) {
          $scope.resourcePath = $routeParams["path"];
          $scope.commandsLink = Forge.commandsLink;
          var gogsUrl = ServiceRegistry.serviceLink(Forge.gogsServiceName);
          if (gogsUrl) {
              $scope.signUpUrl = UrlHelpers.join(gogsUrl, "user/sign_up");
              $scope.forgotPasswordUrl = UrlHelpers.join(gogsUrl, "user/forget_password");
          }
          $scope.login = {
              authHeader: localStorage["gogsAuthorization"] || "",
              relogin: false,
              avatar_url: localStorage["gogsAvatarUrl"] || "",
              user: localStorage["gogsUser"] || "",
              password: "",
              email: localStorage["gogsEmail"] || ""
          };
          $scope.doLogin = function () {
              var login = $scope.login;
              var user = login.user;
              var password = login.password;
              if (user && password) {
                  var userPwd = user + ':' + password;
                  login.authHeader = 'Basic ' + (userPwd.encodeBase64());
                  updateData();
              }
          };
          $scope.logout = function () {
              delete localStorage["gogsAuthorization"];
              $scope.login.authHeader = null;
              $scope.login.loggedIn = false;
              $scope.login.failed = false;
              Forge.loggedInToGogs = false;
          };
          $scope.tableConfig = {
              data: 'projects',
              showSelectionCheckbox: true,
              enableRowClickSelection: false,
              multiSelect: true,
              selectedItems: [],
              filterOptions: {
                  filterText: $location.search()["q"] || ''
              },
              columnDefs: [
                  {
                      field: 'name',
                      displayName: 'Repository Name',
                      cellTemplate: $templateCache.get("repoTemplate.html")
                  },
                  {
                      field: 'actions',
                      displayName: 'Actions',
                      cellTemplate: $templateCache.get("repoActionsTemplate.html")
                  }
              ]
          };
          $scope.openCommands = function () {
              var resourcePath = null;
              var selected = $scope.tableConfig.selectedItems;
              if (_.isArray(selected) && selected.length) {
                  resourcePath = selected[0].path;
              }
              var link = Forge.commandsLink(resourcePath);
              Forge.log.info("moving to commands link: " + link);
              $location.path(link);
          };
          $scope.delete = function (projects) {
              UI.multiItemConfirmActionDialog({
                  collection: projects,
                  index: 'path',
                  onClose: function (result) {
                      if (result) {
                          doDelete(projects);
                      }
                  },
                  title: 'Delete projects?',
                  action: 'The following projects will be removed (though the files will remain on your file system):',
                  okText: 'Delete',
                  okClass: 'btn-danger',
                  custom: "This operation is permanent once completed!",
                  customClass: "alert alert-warning"
              }).open();
          };
          function doDelete(projects) {
              angular.forEach(projects, function (project) {
                  Forge.log.info("Deleting " + angular.toJson($scope.projects));
                  var path = project.path;
                  if (path) {
                      var url = Forge.repoApiUrl(ForgeApiURL, path);
                      $http.delete(url).success(function (data, status, headers, config) {
                          updateData();
                      }).error(function (data, status, headers, config) {
                          Forge.log.warn("failed to load " + url + ". status: " + status + " data: " + data);
                          var message = "Failed to POST to " + url + " got status: " + status;
                          Core.notification('error', message);
                      });
                  }
              });
          }
          function updateData() {
              var authHeader = $scope.login.authHeader;
              var email = $scope.login.email || "";
              if (authHeader) {
                  var url = Forge.reposApiUrl(ForgeApiURL);
                  url = Forge.createHttpUrl(url, authHeader, email);
                  var config = {};
                  $http.get(url, config).success(function (data, status, headers, config) {
                      $scope.login.failed = false;
                      $scope.login.loggedIn = true;
                      Forge.loggedInToGogs = true;
                      var avatar_url = null;
                      if (status === 200) {
                          if (!data || !angular.isArray(data)) {
                              data = [];
                          }
                          // lets store a successful login so that we hide the login page
                          localStorage["gogsAuthorization"] = authHeader;
                          localStorage["gogsEmail"] = email;
                          localStorage["gogsUser"] = $scope.login.user || "";
                          $scope.projects = _.sortBy(data, "name");
                          angular.forEach($scope.projects, function (repo) {
                              Forge.enrichRepo(repo);
                              if (!avatar_url) {
                                  avatar_url = Core.pathGet(repo, ["owner", "avatar_url"]);
                                  if (avatar_url) {
                                      $scope.login.avatar_url = avatar_url;
                                      localStorage["gogsAvatarUrl"] = avatar_url;
                                  }
                              }
                          });
                          $scope.fetched = true;
                      }
                  }).error(function (data, status, headers, config) {
                      $scope.logout();
                      $scope.login.failed = true;
                      if (status !== 403) {
                          Forge.log.warn("failed to load " + url + ". status: " + status + " data: " + data);
                      }
                  });
              }
          }
          updateData();
      }]);
  })(Forge || (Forge = {}));
  
  angular.module("hawtio-forge-templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("plugins/forge/html/command.html","<div ng-controller=\"Forge.CommandController\">\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <span class=\"pull-right\">&nbsp;</span>\n\n      <div class=\"user-icon-name pull-right\" ng-show=\"user\">\n        <a href=\"/forge/repos\" title=\"Browse the repositories for {{user}}\">\n          <img src=\"{{avatar_url}}\" class=\"avatar-small-img\" ng-show=\"avatar_url\">\n        </a>\n        &nbsp;\n        <a href=\"/forge/repos\" title=\"Browse the repositories for {{user}}\">\n          {{user}}\n        </a>\n        <span ng-show=\"repoName\">/\n          <a href=\"/forge/repos/{{repoName}}\" title=\"Browse the {{repoName}}repository\">\n            {{repoName}}\n          </a>\n        </span>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <h3>{{schema.info.description}}</h3>\n    </div>\n  </div>\n  <div class=\"row\" ng-show=\"executing\">\n    <div class=\"col-md-12\">\n      <p class=\"bg-info\">executing...\n        <i class=\"fa fa-spinner fa-spin\"></i>\n      </p>\n    </div>\n  </div>\n  <div class=\"row\" ng-show=\"response\">\n    <div class=\"col-md-12\">\n      <p ng-show=\"response.message\" ng-class=\"responseClass\"><span class=\"response-message\">{{response.message}}</span></p>\n      <p ng-show=\"response.output\" ng-class=\"responseClass\"><span class=\"response-output\">{{response.output}}</span></p>\n      <p ng-show=\"response.err\" ng-class=\"bg-warning\"><span class=\"response-err\">{{response.err}}</span></p>\n    </div>\n  </div>\n  <div class=\"row\" ng-show=\"response.outputProperties.htmlUrl && id == \'project-new\'\">\n    <div class=\"col-md-12\">\n      <p class=\"text-primary\">\n        Created project in a new\n        <a target=\"gitrepo\" href=\"{{response.outputProperties.htmlUrl}}\" title=\"view the newly created git repository for the project\">\n          repository <b>{{response.outputProperties.fullName}}</b>\n        </a>\n      </p>\n    </div>\n  </div>\n  <div class=\"row\" ng-show=\"response && !invalid\">\n    <div class=\"col-md-12\">\n      <a class=\"btn btn-primary\" href=\"{{commandsLink}}\">Done</a>\n      <a class=\"btn btn-default\" ng-click=\"response = null\" ng-hide=\"wizardCompleted\">Hide</a>\n    </div>\n  </div>\n  <div class=\"row\" ng-show=\"validationError\">\n    <div class=\"col-md-12\">\n      <p class=\"bg-danger\">{{validationError}}</p>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <div ng-hide=\"fetched\">\n        <div class=\"align-center\">\n          <i class=\"fa fa-spinner fa-spin\"></i>\n        </div>\n      </div>\n      <div ng-show=\"fetched && !wizardCompleted\">\n        <div hawtio-form-2=\"schema\" entity=\'entity\'></div>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\" ng-hide=\"wizardCompleted\">\n    <div class=\"col-md-2\">\n    </div>\n    <div class=\"col-md-2\">\n      <button class=\"btn btn-primary\"\n              title=\"Perform this command\"\n              ng-show=\"fetched\"\n              ng-disabled=\"executing\"\n              ng-click=\"execute()\">\n        Execute\n      </button>\n    </div>\n  </div>\n</div>\n");
  $templateCache.put("plugins/forge/html/commands.html","<div class=\"row\" ng-controller=\"Forge.CommandsController\">\n  <div class=\"row\">\n    <div class=\"col-md-12\" ng-show=\"commands.length\">\n      <span ng-show=\"!id\">\n        Command: <hawtio-filter ng-model=\"tableConfig.filterOptions.filterText\"\n                                css-class=\"input-xxlarge\"\n                                placeholder=\"Filter commands...\"\n                                save-as=\"fabric8-forge-command-filter\"></hawtio-filter>\n      </span>\n      <span class=\"pull-right\">&nbsp;</span>\n\n      <div class=\"user-icon-name pull-right\" ng-show=\"user\">\n        <a href=\"/forge/repos\" title=\"Browse the repositories for {{user}}\">\n          <img src=\"{{avatar_url}}\" class=\"avatar-small-img\" ng-show=\"avatar_url\">\n        </a>\n        &nbsp;\n        <a href=\"/forge/repos\" title=\"Browse the repositories for {{user}}\">\n          {{user}}\n        </a>\n        <span ng-show=\"repoName\">/\n          <a href=\"/forge/repos/{{repoName}}\" title=\"Browse the {{repoName}}repository\">\n            {{repoName}}\n          </a>\n        </span>\n      </div>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <div ng-hide=\"fetched\">\n        <div class=\"align-center\">\n          <i class=\"fa fa-spinner fa-spin\"></i>\n        </div>\n      </div>\n      <div ng-show=\"fetched\">\n        <div ng-hide=\"commands.length\" class=\"align-center\">\n          <p class=\"alert alert-info\">There are no commands available!</p>\n        </div>\n        <div ng-show=\"commands.length\">\n        </div>\n        <div ng-show=\"mode == \'table\'\">\n          <table class=\"table table-condensed table-striped\" hawtio-simple-table=\"tableConfig\"></table>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show=\"fetched && commands.length && mode != \'table\'\">\n    <div class=\"row\">\n      <ul>\n        <li class=\"no-list command-selector-folder\" ng-repeat=\"folder in commandSelector.folders\"\n            ng-show=\"commandSelector.showFolder(folder)\">\n          <div class=\"expandable\" ng-class=\"commandSelector.isOpen(folder)\">\n            <div title=\"{{folder.name}}\" class=\"title\">\n              <i class=\"expandable-indicator folder\"></i> <span class=\"folder-title\"\n                                                                ng-show=\"folder.name\">{{folder.name}}</span><span\n                    class=\"folder-title\" ng-hide=\"folder.name\">Uncategorized</span>\n            </div>\n            <div class=\"expandable-body\">\n              <ul>\n                <li class=\"no-list command\" ng-repeat=\"command in folder.commands\"\n                    ng-show=\"commandSelector.showCommand(command)\">\n                  <div class=\"inline-block command-selector-name\"\n                       ng-class=\"commandSelector.getSelectedClass(command)\">\n                    <span class=\"contained c-max\">\n                      <a href=\"{{command.$link}}\"\n                         title=\"{{command.description}}\">\n                        <span class=\"command-name\">{{command.$shortName}}</span>\n                      </a>\n                    </span>\n                  </div>\n                </li>\n              </ul>\n            </div>\n          </div>\n        </li>\n      </ul>\n    </div>\n  </div>\n</div>\n");
  $templateCache.put("plugins/forge/html/createProject.html","<div class=\"row\" ng-controller=\"Forge.ReposController\">\n  <style>\n    .createProjectPage {\n      padding-top: 40px;\n    }\n  </style>\n\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <span class=\"pull-right\">&nbsp;</span>\n      <a class=\"btn btn-default pull-right\" ng-click=\"logout()\" ng-show=\"login.loggedIn\"\n         title=\"Log out from the git repository\">\n        <i class=\"fa fa-sign-out\"></i> Log out</a>\n      </a>\n      <span class=\"pull-right\" ng-show=\"login.loggedIn\">&nbsp;</span>\n\n      <div class=\"user-icon-name pull-right\" ng-show=\"login.loggedIn\">\n        <img src=\"{{login.avatar_url}}\" class=\"avatar-small-img\" ng-show=\"login.avatar_url\">&nbsp;\n        {{login.user}}\n      </div>\n    </div>\n  </div>\n\n\n  <div ng-show=\"!login.authHeader || login.relogin\">\n    <div ng-show=\"login.failed\">\n      <div class=\"bg-danger\">\n        <div class=\"invalid-login align-center\">\n          <h3>Invalid login/password. Please try again!</h3>\n        </div>\n      </div>\n    </div>\n    <h2 ng-hide=\"login.failed\">Please login to the git repository so that you can create a project</h2>\n\n    <form>\n      <div class=\"form-group\">\n        <label for=\"gitUsername\">User name</label>\n        <input type=\"text\" class=\"form-control\" id=\"gitUsername\" placeholder=\"Enter user name\" required=\"true\"\n               ng-model=\"login.user\">\n      </div>\n      <div class=\"form-group\">\n        <label for=\"gitPassword\">Password</label>\n        <input type=\"password\" class=\"form-control\" id=\"gitPassword\" placeholder=\"Password\" required=\"true\"\n               ng-model=\"login.password\">\n      </div>\n      <div class=\"form-group\">\n        <label for=\"gitEmail\">Email address</label>\n        <input type=\"email\" class=\"form-control\" id=\"gitEmail\" placeholder=\"Enter email\" required=\"true\"\n               ng-model=\"login.email\">\n      </div>\n      <div class=\"form-group\">\n        <button type=\"submit\" class=\"btn btn-primary\" ng-click=\"doLogin()\"\n                ng-disabled=\"!login.user || !login.password || !login.email\">\n          <i class=\"fa fa-sign-in\"></i> Sign In\n        </button>\n      </div>\n\n      <div class=\"form-group\" ng-show=\"forgotPasswordUrl\">\n        <a href=\"{{forgotPasswordUrl}}\">Forgot password?</a>\n      </div>\n\n      <div class=\"form-group\" ng-show=\"signUpUrl\">\n        <a href=\"{{signUpUrl}}\">Need an account? Sign up now.</a>\n      </div>\n    </form>\n  </div>\n\n  <div ng-hide=\"fetched || !login.authHeader || login.relogin\">\n    <div class=\"row\">\n      <div class=\"col-md-12\">\n        <div class=\"align-center\">\n          <i class=\"fa fa-spinner fa-spin\"></i>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show=\"fetched && login.authHeader\">\n    <div class=\"createProjectPage\">\n      <div class=\"jumbotron\">\n        <p class=\"align-center\">\n          <a class=\"btn btn-primary btn-lg\" href=\"/forge/command/project-new\"\n             ng-show=\"login.loggedIn\"\n             title=\"Create a new project in this workspace using a wizard\">\n            <i class=\"fa fa-plus\"></i> Create Project using Wizard</a>\n          </a>\n        </p>\n\n        <p class=\"lead align-center\">\n          This wizard guides you though creating a new project, the git repository and the related builds and Continuous\n          Delivery Pipelines.\n        </p>\n      </div>\n    </div>\n  </div>\n</div>\n");
  $templateCache.put("plugins/forge/html/layoutForge.html","<script type=\"text/ng-template\" id=\"idTemplate.html\">\n  <div class=\"ngCellText\">\n    <a href=\"\"\n       title=\"Execute command {{row.entity.name}}\"\n       ng-href=\"{{row.entity.$link}}\">\n      {{row.entity.name}}</a>\n  </div>\n</script>\n<script type=\"text/ng-template\" id=\"repoTemplate.html\">\n  <div class=\"ngCellText\">\n    <a title=\"View repository {{row.entity.name}}\"\n       ng-href=\"/forge/repos/{{row.entity.name}}\">\n      {{row.entity.name}}\n    </a>\n  </div>\n</script>\n<script type=\"text/ng-template\" id=\"repoActionsTemplate.html\">\n  <div class=\"ngCellText\">\n    <a ng-show=\"row.entity.$openProjectLink\"\n       class=\"btn btn-primary\" target=\"editor\"\n       title=\"Open project {{row.entity.name}} in an editor\"\n       ng-href=\"{{row.entity.$openProjectLink}}\">\n      <i class=\"fa fa-pencil-square\"></i>\n      Open\n    </a>\n    <a ng-show=\"row.entity.html_url\"\n       class=\"btn btn-default\" target=\"browse\"\n       title=\"Browse project {{row.entity.name}}\"\n       ng-href=\"{{row.entity.html_url}}\">\n      <i class=\"fa fa-external-link\"></i>\n      Repository\n    </a>\n    <a ng-show=\"row.entity.$buildsLink\"\n       class=\"btn btn-default\" target=\"builds\"\n       title=\"View builds for this repository {{row.entity.owner.username}}/{{row.entity.name}}\"\n       ng-href=\"{{row.entity.$buildsLink}}\">\n      <i class=\"fa fa-cog\"></i>\n      Builds\n    </a>\n    <a ng-show=\"row.entity.$commandsLink\"\n       class=\"btn btn-default\"\n       title=\"Commands for project {{row.entity.name}}\"\n       ng-href=\"{{row.entity.$commandsLink}}\">\n      <i class=\"fa fa-play-circle\"></i>\n      Run...\n    </a>\n  </div>\n</script>\n<script type=\"text/ng-template\" id=\"categoryTemplate.html\">\n  <div class=\"ngCellText\">\n    <span class=\"pod-label badge\"\n          class=\"background-light-grey mouse-pointer\">{{row.entity.category}}</span>\n  </div>\n</script>\n\n<div class=\"row\">\n  <div class=\"wiki-icon-view\">\n    <div class=\"row forge-view\" ng-view></div>\n  </div>\n</div>\n");
  $templateCache.put("plugins/forge/html/repo.html","<div class=\"row\" ng-controller=\"Forge.RepoController\">\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <span class=\"pull-right\">&nbsp;</span>\n      <a class=\"btn btn-default pull-right\"\n              href=\"/forge/repos\"><i class=\"fa fa-list\"></i></a>\n      <span class=\"pull-right\">&nbsp;</span>\n      <a ng-show=\"entity.$commandsLink\"\n         class=\"btn btn-default pull-right\"\n         title=\"Commands for project {{entity.name}}\"\n         ng-href=\"{{entity.$commandsLink}}\">\n        <i class=\"fa fa-play-circle\"></i>\n        Run...\n      </a>\n      <span class=\"pull-right\" ng-show=\"entity.$buildsLink\">&nbsp;</span>\n      <a ng-show=\"entity.$buildsLink\"\n         class=\"btn btn-primary pull-right\" target=\"builds\"\n         title=\"View builds for this repository {{entity.owner.username}}/{{entity.name}}\"\n         ng-href=\"{{entity.$buildsLink}}\">\n        <i class=\"fa fa-cog\"></i>\n        Builds\n      </a>\n      <span class=\"pull-right\">&nbsp;</span>\n      <a ng-show=\"entity.html_url\"\n         class=\"btn btn-default pull-right\" target=\"browse\"\n         title=\"Browse project {{entity.name}}\"\n         ng-href=\"{{entity.html_url}}\">\n        <i class=\"fa fa-external-link\"></i>\n        Browse\n      </a>\n    </div>\n  </div>\n\n  <div ng-hide=\"fetched\">\n    <div class=\"row\">\n      <div class=\"col-md-12\">\n        <div class=\"align-center\">\n          <i class=\"fa fa-spinner fa-spin\"></i>\n        </div>\n      </div>\n    </div>\n  </div>\n  <div ng-show=\"fetched\">\n    <div class=\"row\">\n      <div class=\"col-md-12\">\n        <h3 title=\"repository for {{entity.owner.username}}\">\n          <span ng-show=\"entity.owner.username\">\n            <a href=\"/forge/repos\" title=\"Browse the repositories for {{entity.owner.username}}\">\n              <img src=\"{{entity.owner.avatar_url}}\" class=\"avatar-small-img\" ng-show=\"entity.owner.avatar_url\">\n            </a>\n            &nbsp;\n            <a href=\"/forge/repos\" title=\"Browse the repositories for {{entity.owner.username}}\">\n              {{entity.owner.username}}\n            </a>\n             &nbsp;/&nbsp;\n          </span>\n          {{entity.name}}\n        </h3>\n      </div>\n    </div>\n\n    <div class=\"git-clone-tabs\">\n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <div class=\"tabbable\">\n            <div value=\"ssh\" class=\"tab-pane\" title=\"SSH\" ng-show=\"entity.ssh_url\">\n              <div class=\"git-clone-panel\">\n                <p>to clone this git repository via <b>ssh</b> from the command line:</p>\n              </div>\n\n              <div class=\"highlight\">\n                <pre>\n                  <code>git clone {{entity.ssh_url}}</code>\n                </pre>\n              </div>\n            </div>\n\n            <div value=\"http\" class=\"tab-pane\" title=\"HTTP\" ng-show=\"entity.clone_url\">\n              <div class=\"git-clone-panel\">\n                <p>to clone this git repository via <b>http</b> from the command line:</p>\n              </div>\n\n              <div class=\"highlight\">\n                <pre>\n                  <code>git clone {{entity.clone_url}}</code>\n                </pre>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n");
  $templateCache.put("plugins/forge/html/repos.html","<div class=\"row\" ng-controller=\"Forge.ReposController\">\n  <div class=\"row\">\n    <div class=\"col-md-12\">\n      <hawtio-filter ng-model=\"tableConfig.filterOptions.filterText\"\n                     ng-show=\"projects.length\"\n                     css-class=\"input-xxlarge\"\n                     placeholder=\"Filter repositories...\"></hawtio-filter>\n      <!--\n            <span class=\"pull-right\">&nbsp;</span>\n            <button ng-show=\"fetched\"\n                    class=\"btn btn-danger pull-right\"\n                    ng-disabled=\"tableConfig.selectedItems.length == 0\"\n                    ng-click=\"delete(tableConfig.selectedItems)\">\n              <i class=\"fa fa-remove\"></i> Delete\n            </button>\n      -->\n      <span class=\"pull-right\">&nbsp;</span>\n      <a class=\"btn btn-primary pull-right\" href=\"/forge/command/project-new\"\n         ng-show=\"login.loggedIn\"\n         title=\"Create a new project and repository\">\n        <i class=\"fa fa-plus\"></i> Create Project</a>\n      </a>\n      <span class=\"pull-right\">&nbsp;</span>\n      <a class=\"btn btn-default pull-right\" ng-click=\"logout()\" ng-show=\"login.loggedIn\"\n         title=\"Log out from the git repository\">\n        <i class=\"fa fa-sign-out\"></i> Log out</a>\n      </a>\n      <span class=\"pull-right\" ng-show=\"login.loggedIn\">&nbsp;</span>\n      <div class=\"user-icon-name pull-right\" ng-show=\"login.loggedIn\">\n        <img src=\"{{login.avatar_url}}\" class=\"avatar-small-img\" ng-show=\"login.avatar_url\">&nbsp;\n        {{login.user}}\n      </div>\n    </div>\n  </div>\n\n\n  <div ng-show=\"!login.authHeader || login.relogin\">\n    <div ng-show=\"login.failed\">\n      <div class=\"bg-danger\">\n        <div class=\"invalid-login align-center\">\n          <h3>Invalid login/password. Please try again!</h3>\n        </div>\n      </div>\n    </div>\n    <h2 ng-hide=\"login.failed\">Please login to the git repository</h2>\n\n    <form>\n      <div class=\"form-group\">\n        <label for=\"gitUsername\">User name</label>\n        <input type=\"text\" class=\"form-control\" id=\"gitUsername\" placeholder=\"Enter user name\" required=\"true\"\n               ng-model=\"login.user\">\n      </div>\n      <div class=\"form-group\">\n        <label for=\"gitPassword\">Password</label>\n        <input type=\"password\" class=\"form-control\" id=\"gitPassword\" placeholder=\"Password\" required=\"true\"\n               ng-model=\"login.password\">\n      </div>\n      <div class=\"form-group\">\n        <label for=\"gitEmail\">Email address</label>\n        <input type=\"email\" class=\"form-control\" id=\"gitEmail\" placeholder=\"Enter email\" required=\"true\"\n               ng-model=\"login.email\">\n      </div>\n      <div class=\"form-group\">\n        <button type=\"submit\" class=\"btn btn-primary\" ng-click=\"doLogin()\"\n                ng-disabled=\"!login.user || !login.password || !login.email\">\n          <i class=\"fa fa-sign-in\"></i> Sign In\n        </button>\n      </div>\n\n      <div class=\"form-group\" ng-show=\"forgotPasswordUrl\">\n          <a href=\"{{forgotPasswordUrl}}\">Forgot password?</a>\n      </div>\n\n      <div class=\"form-group\" ng-show=\"signUpUrl\">\n        <a href=\"{{signUpUrl}}\">Need an account? Sign up now.</a>\n      </div>\n    </form>\n  </div>\n\n  <div ng-hide=\"fetched || !login.authHeader || login.relogin\">\n    <div class=\"row\">\n      <div class=\"col-md-12\">\n        <div class=\"align-center\">\n          <i class=\"fa fa-spinner fa-spin\"></i>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show=\"fetched && login.authHeader\">\n    <div ng-hide=\"projects.length\" class=\"align-center\">\n      <div class=\"padded-div\">\n        <div class=\"row\">\n          <div class=\"col-md-12\">\n            <p class=\"alert alert-info\">There are no git repositories yet. Please create one!</p>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-show=\"projects.length\">\n      <div class=\"row\">\n        <div class=\"col-md-12\">\n          <table class=\"table table-condensed table-striped\" hawtio-simple-table=\"tableConfig\"></table>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n");}]); hawtioPluginLoader.addModule("hawtio-forge-templates");