forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEVEXP-457] Create application from source. Includes changes from jw…
…forres, cewong, sgoodwin
- Loading branch information
Showing
57 changed files
with
3,975 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name openshiftConsole.controller:PodsController | ||
* @description | ||
* # ProjectController | ||
* Controller of the openshiftConsole | ||
*/ | ||
angular.module('openshiftConsole') | ||
.controller('CatalogImagesController', function ($scope, DataService, $filter, LabelFilter, imageEnvFilter, $routeParams, Logger) { | ||
$scope.projectImageRepos = {}; | ||
$scope.openshiftImageRepos = {}; | ||
$scope.builders = []; | ||
$scope.images = []; | ||
$scope.sourceURL = $routeParams.builderfor; | ||
|
||
var imagesForRepos = function(imageRepos, scope) { | ||
angular.forEach(imageRepos, function(imageRepo) { | ||
if (imageRepo.status) { | ||
angular.forEach(imageRepo.status.tags, function(tag) { | ||
var imageRepoTag = tag.tag; | ||
var image = { | ||
imageRepo: imageRepo, | ||
imageRepoTag: imageRepoTag, | ||
name: imageRepo.metadata.name + ":" + imageRepoTag | ||
}; | ||
$scope.images.push(image); | ||
|
||
var categoryTags = []; | ||
if(imageRepo.spec.tags){ | ||
angular.forEach(imageRepo.spec.tags, function(imageTags){ | ||
if(imageTags.annotations && imageTags.annotations.tags){ | ||
categoryTags = imageTags.annotations.tags.split(/\s*,\s*/); | ||
} | ||
if (categoryTags.indexOf("builder") >= 0) { | ||
$scope.builders.push(image); | ||
} | ||
}); | ||
} | ||
}); | ||
Logger.info("builders", $scope.builders); | ||
} | ||
}); | ||
}; | ||
|
||
DataService.list("imageStreams", $scope, function(imageRepos) { | ||
$scope.projectImageRepos = imageRepos.by("metadata.name"); | ||
imagesForRepos($scope.projectImageRepos, $scope); | ||
|
||
Logger.info("project image repos", $scope.projectImageRepos); | ||
}); | ||
|
||
DataService.list("imageStreams", {namespace: "openshift"}, function(imageRepos) { | ||
$scope.openshiftImageRepos = imageRepos.by("metadata.name"); | ||
imagesForRepos($scope.openshiftImageRepos, {namespace: "openshift"}); | ||
|
||
Logger.info("openshift image repos", $scope.openshiftImageRepos); | ||
}); | ||
|
||
|
||
var templatesByTag = function() { | ||
$scope.templatesByTag = {}; | ||
angular.forEach($scope.templates, function(template) { | ||
if (template.metadata.annotations && template.metadata.annotations.tags) { | ||
var tags = template.metadata.annotations.tags.split(","); | ||
angular.forEach(tags, function(tag){ | ||
tag = $.trim(tag); | ||
// not doing this as a map since we are dealing with things across namespaces that could have collisions on name | ||
$scope.templatesByTag[tag] = $scope.templatesByTag[tag] || []; | ||
$scope.templatesByTag[tag].push(template); | ||
}); | ||
} | ||
}); | ||
|
||
Logger.info("templatesByTag", $scope.templatesByTag); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc function | ||
* @name openshiftConsole.controller:PodsController | ||
* @description | ||
* # ProjectController | ||
* Controller of the openshiftConsole | ||
*/ | ||
angular.module('openshiftConsole') | ||
.controller('CreateController', function ($scope, DataService, $filter, LabelFilter, $location, Logger) { | ||
$scope.projectTemplates = {}; | ||
$scope.openshiftTemplates = {}; | ||
|
||
$scope.templatesByTag = {}; | ||
|
||
$scope.sourceURLPattern = /^(ftp|http|https|git):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; | ||
|
||
DataService.list("templates", $scope, function(templates) { | ||
$scope.projectTemplates = templates.by("metadata.name"); | ||
templatesByTag(); | ||
Logger.info("project templates", $scope.projectTemplates); | ||
}); | ||
|
||
DataService.list("templates", {namespace: "openshift"}, function(templates) { | ||
$scope.openshiftTemplates = templates.by("metadata.name"); | ||
templatesByTag(); | ||
Logger.info("openshift templates", $scope.openshiftTemplates); | ||
}); | ||
|
||
var templatesByTag = function() { | ||
$scope.templatesByTag = {}; | ||
var fn = function(template) { | ||
if (template.metadata.annotations && template.metadata.annotations.tags) { | ||
var tags = template.metadata.annotations.tags.split(","); | ||
angular.forEach(tags, function(tag){ | ||
tag = $.trim(tag); | ||
// not doing this as a map since we are dealing with things across namespaces that could have collisions on name | ||
$scope.templatesByTag[tag] = $scope.templatesByTag[tag] || []; | ||
$scope.templatesByTag[tag].push(template); | ||
}); | ||
} | ||
}; | ||
|
||
angular.forEach($scope.projectTemplates, fn); | ||
angular.forEach($scope.openshiftTemplates, fn); | ||
|
||
Logger.info("templatesByTag", $scope.templatesByTag); | ||
}; | ||
|
||
$scope.createFromSource = function() { | ||
if($scope.from_source_form.$valid) { | ||
var createURI = URI.expand("/project/{project}/catalog/images{?q*}", { | ||
project: $scope.projectName, | ||
q: { | ||
builderfor: $scope.from_source_url | ||
} | ||
}); | ||
$location.url(createURI.toString()); | ||
} | ||
}; | ||
}); |
Oops, something went wrong.