Skip to content

Commit

Permalink
Merge pull request #3 from jwforres/abstract_pod_template_describe
Browse files Browse the repository at this point in the history
Move pod template describing into its own directive
  • Loading branch information
jwforres committed Apr 15, 2015
2 parents ff0139a + 43c2bd1 commit 76cd58f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kubernetes-object-describer",
"version": "0.0.3",
"version": "0.0.4",
"description": "Provides an extendable describer for kubernetes resources. Includes an angular directive for rendering an instance of a describer.",
"moduleType": [
"globals"
Expand Down
36 changes: 25 additions & 11 deletions dist/object-describer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ angular.module('kubernetesUI')
templateUrl: 'views/footer.html'
}
})
.directive("kubernetesObjectDescribePodTemplate", function() {
return {
restrict: 'E',
scope: {
template: '='
},
templateUrl: 'views/pod-template.html'
}
})
.directive("kubernetesObjectDescribeVolumes", function() {
return {
restrict: 'E',
Expand Down Expand Up @@ -192,6 +201,21 @@ angular.module('kubernetesUI').run(['$templateCache', function($templateCache) {
);


$templateCache.put('views/pod-template.html',
"<h3>Pod Template</h3>\n" +
"<dl class=\"dl-horizontal\">\n" +
" <dt>Restart policy</dt>\n" +
" <dd>{{template.restartPolicy}}</dd>\n" +
" <dt>DNS policy</dt>\n" +
" <dd>{{template.dnsPolicy}}</dd>\n" +
"</dl> \n" +
"<h4>Containers</h4>\n" +
"<kubernetes-object-describe-containers containers=\"template.containers\"></kubernetes-object-describe-containers>\n" +
"<h4>Volumes</h4>\n" +
"<kubernetes-object-describe-volumes volumes=\"template.volumes\"></kubernetes-object-describe-volumes> "
);


$templateCache.put('views/pod.html',
"<div>\n" +
" <kubernetes-object-describe-header resource=\"resource\"></kubernetes-object-describe-header>\n" +
Expand Down Expand Up @@ -243,17 +267,7 @@ angular.module('kubernetesUI').run(['$templateCache', function($templateCache) {
" <dt ng-repeat-start=\"(selectorKey, selectorValue) in resource.spec.selector\">{{selectorKey}}</dt>\n" +
" <dd ng-repeat-end>{{selectorValue}}</dd>\n" +
" </dl>\n" +
" <h3>Pod Template</h3>\n" +
" <dl class=\"dl-horizontal\">\n" +
" <dt>Restart policy</dt>\n" +
" <dd>{{resource.spec.template.spec.restartPolicy}}</dd>\n" +
" <dt>DNS policy</dt>\n" +
" <dd>{{resource.spec.template.spec.dnsPolicy}}</dd>\n" +
" </dl> \n" +
" <h4>Containers</h4>\n" +
" <kubernetes-object-describe-containers containers=\"resource.spec.template.spec.containers\"></kubernetes-object-describe-containers>\n" +
" <h4>Volumes</h4>\n" +
" <kubernetes-object-describe-volumes volumes=\"resource.spec.template.spec.volumes\"></kubernetes-object-describe-volumes>\n" +
" <kubernetes-object-describe-pod-template template=\"resource.spec.template.spec\"></kubernetes-object-describe-pod-template>\n" +
" <kubernetes-object-describe-labels resource=\"resource\"></kubernetes-object-describe-labels>\n" +
" <kubernetes-object-describe-annotations resource=\"resource\"></kubernetes-object-describe-annotations>\n" +
" <kubernetes-object-describe-footer resource=\"resource\"></kubernetes-object-describe-footer>\n" +
Expand Down
9 changes: 9 additions & 0 deletions object-describer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ angular.module('kubernetesUI')
templateUrl: 'views/footer.html'
}
})
.directive("kubernetesObjectDescribePodTemplate", function() {
return {
restrict: 'E',
scope: {
template: '='
},
templateUrl: 'views/pod-template.html'
}
})
.directive("kubernetesObjectDescribeVolumes", function() {
return {
restrict: 'E',
Expand Down
11 changes: 11 additions & 0 deletions views/pod-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h3>Pod Template</h3>
<dl class="dl-horizontal">
<dt>Restart policy</dt>
<dd>{{template.restartPolicy}}</dd>
<dt>DNS policy</dt>
<dd>{{template.dnsPolicy}}</dd>
</dl>
<h4>Containers</h4>
<kubernetes-object-describe-containers containers="template.containers"></kubernetes-object-describe-containers>
<h4>Volumes</h4>
<kubernetes-object-describe-volumes volumes="template.volumes"></kubernetes-object-describe-volumes>
12 changes: 1 addition & 11 deletions views/replication-controller.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,7 @@ <h3>Selector</h3>
<dt ng-repeat-start="(selectorKey, selectorValue) in resource.spec.selector">{{selectorKey}}</dt>
<dd ng-repeat-end>{{selectorValue}}</dd>
</dl>
<h3>Pod Template</h3>
<dl class="dl-horizontal">
<dt>Restart policy</dt>
<dd>{{resource.spec.template.spec.restartPolicy}}</dd>
<dt>DNS policy</dt>
<dd>{{resource.spec.template.spec.dnsPolicy}}</dd>
</dl>
<h4>Containers</h4>
<kubernetes-object-describe-containers containers="resource.spec.template.spec.containers"></kubernetes-object-describe-containers>
<h4>Volumes</h4>
<kubernetes-object-describe-volumes volumes="resource.spec.template.spec.volumes"></kubernetes-object-describe-volumes>
<kubernetes-object-describe-pod-template template="resource.spec.template.spec"></kubernetes-object-describe-pod-template>
<kubernetes-object-describe-labels resource="resource"></kubernetes-object-describe-labels>
<kubernetes-object-describe-annotations resource="resource"></kubernetes-object-describe-annotations>
<kubernetes-object-describe-footer resource="resource"></kubernetes-object-describe-footer>
Expand Down

0 comments on commit 76cd58f

Please sign in to comment.