Skip to content

Commit

Permalink
Add a simple hierarchical treatment for box/list view.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeromy Carriere committed Oct 10, 2014
1 parent 707ff3c commit 181ba83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 8 additions & 7 deletions www/box.ng
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ limitations under the License.
<div style="margin-top: 10px">
<div class="k8s-title-font k8s-box">
{{ groupName }}
{{ settings.display }}

<div ng-if="group.kind != 'grouping'">
<div ng-if="!display || display=='box'">
<div ng-if="!settings.display || settings.display=='box'">
<div class="content k8s-item k8s-inline" ng-repeat="item in group">
<div class="k8s-title-font k8s-font-regular">
<div ng-switch on='item.labels["type"]'>
Expand All @@ -30,7 +31,7 @@ limitations under the License.
</div>
</div>
</div>
<div ng-if="display=='list'">
<div ng-if="settings.display=='list'">
<table style="width: 90%; padding: 10px">
<tr ng-repeat="item in group" ng-class-odd="'k8s-odd'" ng-class-even="'k8s-even'" valign="top">
<td class="k8s-cell">
Expand All @@ -49,14 +50,14 @@ limitations under the License.
</tr>
</table>
</div>
<div>
<a ng-click="display='box'">box</a>
<a ng-click="display='list'">list</a>
</div>
</div>
<div ng-if="group.kind == 'grouping'">
<div ng-repeat="(groupName,group) in group.items" ng-include="'box.ng'">
</div>
</div>
<div>
<a ng-click="settings={display:'box'}">box</a>
<a ng-click="settings={display:'list'}">list</a>
<a ng-click="controller.resetGroupLayout(this);">reset</a>
</div>
</div>
</div>
4 changes: 4 additions & 0 deletions www/podcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ k8sApp.controller('PodCtrl', function ($scope, $http, $routeParams) {

function GroupController() {}

GroupController.prototype.resetGroupLayout = function(group) {
delete group.settings;
};

GroupController.prototype.handlePath = function(path) {
var parts = path.split("/")
// split leaves an empty string at the beginning.
Expand Down

0 comments on commit 181ba83

Please sign in to comment.