-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Details, Environment, Metrics, Events - Edit YAML - Delete - Pods list - Annotations - Template & volume claim template - No support currently for scale/autoscale - hopefully API support in near future
- Loading branch information
1 parent
dda5f7a
commit 075d122
Showing
14 changed files
with
813 additions
and
0 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,101 @@ | ||
'use strict'; | ||
|
||
angular | ||
.module('openshiftConsole') | ||
.controller('StatefulSetController', function( | ||
$filter, | ||
$scope, | ||
$routeParams, | ||
AlertMessageService, | ||
BreadcrumbsService, | ||
DataService, | ||
ProjectsService) { | ||
|
||
$scope.projectName = $routeParams.project; | ||
$scope.statefulSetName = $routeParams.statefulset; | ||
$scope.forms = {}; | ||
$scope.alerts = {}; | ||
$scope.breadcrumbs = BreadcrumbsService.getBreadcrumbs({ | ||
name: $scope.statefulSetName, | ||
kind: 'statefulSet', | ||
namespace: $routeParams.project | ||
}); | ||
$scope.emptyMessage = "Loading..."; | ||
|
||
var altTextForValueFrom = $filter('altTextForValueFrom'); | ||
var updateEnvVars = function(statefulSet) { | ||
_.each(statefulSet.spec.template.spec.containers, function(container) { | ||
_.each(container.env, altTextForValueFrom); | ||
}); | ||
return statefulSet; | ||
}; | ||
|
||
AlertMessageService.getAlerts().forEach(function(alert) { | ||
$scope.alerts[alert.name] = alert.data; | ||
}); | ||
AlertMessageService.clearAlerts(); | ||
|
||
var watches = []; | ||
var projectContext; | ||
|
||
var updatePods = function(pods, selector) { | ||
if (!pods || !selector) { | ||
return; | ||
} | ||
return selector.select(pods); | ||
}; | ||
|
||
var resourceGroupVersion = { | ||
resource: 'statefulsets', | ||
group: 'apps', | ||
version: 'v1beta1' | ||
}; | ||
|
||
ProjectsService | ||
.get($routeParams.project) | ||
.then(_.spread(function(project, context) { | ||
projectContext = context; | ||
|
||
DataService | ||
.get(resourceGroupVersion, $scope.statefulSetName, context) | ||
.then(function(statefulSet) { | ||
|
||
angular.extend($scope, { | ||
statefulSet: updateEnvVars(statefulSet), | ||
project: project, | ||
projectContext: context, | ||
loaded: true, | ||
// TODO: support scaling(?). currently no scale subresource. | ||
isScalable: function() { | ||
return false; | ||
}, | ||
scale: function() {} | ||
}); | ||
|
||
watches.push(DataService.watchObject(resourceGroupVersion, $scope.statefulSetName, context, function(statefulSet) { | ||
angular.extend($scope, { | ||
resourceGroupVersion: resourceGroupVersion, | ||
statefulSet: updateEnvVars(statefulSet) | ||
}); | ||
})); | ||
|
||
var pods; | ||
var selector; | ||
$scope.$watch('statefulSet.spec.selector', function() { | ||
selector = new LabelSelector($scope.statefulSet.spec.selector); | ||
$scope.podsForStatefulSet = updatePods(pods, selector); | ||
}, true); | ||
|
||
watches.push(DataService.watch('pods', context, function(podData) { | ||
pods = podData.by('metadata.name'); | ||
$scope.podsForStatefulSet = updatePods(pods, selector); | ||
})); | ||
|
||
}); | ||
})); | ||
|
||
$scope.$on('$destroy', function(){ | ||
DataService.unwatchAll(watches); | ||
}); | ||
|
||
}); |
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,37 @@ | ||
'use strict'; | ||
|
||
angular.module('openshiftConsole') | ||
.controller('StatefulSetsController', function($scope, $routeParams, AlertMessageService, DataService, ProjectsService) { | ||
$scope.projectName = $routeParams.project; | ||
$scope.alerts = $scope.alerts || {}; | ||
$scope.emptyMessage = "Loading..."; | ||
|
||
// get and clear any alerts | ||
AlertMessageService.getAlerts().forEach(function(alert) { | ||
$scope.alerts[alert.name] = alert.data; | ||
}); | ||
AlertMessageService.clearAlerts(); | ||
|
||
var watches = []; | ||
ProjectsService | ||
.get($routeParams.project) | ||
.then(_.spread(function(project, context) { | ||
$scope.project = project; | ||
|
||
watches.push(DataService.watch({ | ||
resource: 'statefulsets', | ||
group: 'apps', | ||
version: 'v1beta1' | ||
}, context, function(statefulSets) { | ||
angular.extend($scope, { | ||
loaded: true, | ||
statefulSets: statefulSets.by('metadata.name') | ||
}); | ||
})); | ||
|
||
$scope.$on('$destroy', function(){ | ||
DataService.unwatchAll(watches); | ||
}); | ||
|
||
})); | ||
}); |
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
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,46 @@ | ||
<div class="pod-template-block"> | ||
<div | ||
ng-repeat="template in templates" | ||
class="pod-template"> | ||
<div class="component-label">Storage claim: {{template.metadata.name}}</div> | ||
|
||
<div row class="pod-template-image icon-row"> | ||
<div> | ||
<span class="fa fa-lock" aria-hidden="true"></span> | ||
</div> | ||
<div flex class="word-break"> | ||
<span class="pod-template-key">Access Modes:</span> | ||
<span ng-repeat="mode in template.spec.accessModes"> | ||
{{mode | sentenceCase }}<span ng-if="!$last">, </span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div row class="pod-template-image icon-row"> | ||
<div> | ||
<span class="fa fa-database" aria-hidden="true"></span> | ||
</div> | ||
<div flex class="word-break"> | ||
<span class="pod-template-key">Capacity:</span> | ||
<span> | ||
{{template.spec.resources.requests.storage}} | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div | ||
row class="pod-template-image icon-row" | ||
ng-if="template.spec.selector.matchLabels"> | ||
<div> | ||
<span class="fa fa-tag" aria-hidden="true"></span> | ||
</div> | ||
<div flex class="word-break"> | ||
<span class="pod-template-key">Selector:</span> | ||
<span ng-repeat="(key, value) in template.spec.selector.matchLabels"> | ||
{{key}}={{value}}<span ng-if="!$last">, </span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> |
Oops, something went wrong.