Skip to content

Commit b614494

Browse files
committed
data table for binary data, download data fixes
1 parent af7391a commit b614494

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed

src/kafka-topics/view/templates/data/tree/data-tree-view.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<md-list class="md-dense" flex style="padding:0px §0px">
1313
<md-list-item class="md-2-line"
14-
dir-paginate="t in rows | filter:search:strict | itemsPerPage: paginationItems"
14+
dir-paginate="t in rows | filter:search:strict | itemsPerPage: paginationItems track by $index"
1515
pagination-id="treeView"
1616
style="border-bottom:1px solid #f4f5f7; padding: 5px 0 0">
1717

@@ -20,12 +20,10 @@
2020
<div layout="row" style="padding:10px">
2121
<div layout="column" flex="100" layout-align="center left">
2222
<div>
23-
<json-tree object="t.key" root-name="'Key'" style="max-width: 100%;" ng-if="format != 'binary'"></json-tree>
24-
<json-tree object="decode(t.key)" root-name="'Key'" style="max-width: 100%;" ng-if="format == 'binary'"></json-tree>
23+
<json-tree object="t.key" root-name="'Key'" style="max-width: 100%;" ></json-tree>
2524
</div>
2625
<div>
27-
<json-tree object="t.value" root-name="'Value'" style=" max-width: 100%;" ng-if="format != 'binary'"></json-tree>
28-
<json-tree object="decode(t.value)" root-name="'Value'" style=" max-width: 100%;" ng-if="format == 'binary'"></json-tree>
26+
<json-tree object="t.value" root-name="'Value'" style=" max-width: 100%;" ></json-tree>
2927
</div>
3028
</div>
3129

src/kafka-topics/view/view.controller.js

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angularAPP.controller('ViewTopicCtrl', function ($scope, $routeParams, $rootScope, $filter, $log, $location,$cookies, $http, TopicFactory, env, $q, $timeout , consumerFactory, HttpFactory) {
1+
angularAPP.controller('ViewTopicCtrl', function ($scope, $routeParams, $rootScope, $filter, $log, $location,$cookies, $http, $base64, TopicFactory, env, $q, $timeout , consumerFactory, HttpFactory) {
22

33
$log.debug($routeParams.topicName, "Starting [ViewTopicCtrl]");
44

@@ -54,7 +54,7 @@ angularAPP.controller('ViewTopicCtrl', function ($scope, $routeParams, $rootScop
5454

5555
$scope.downloadData = function (topicName) {
5656
$log.info("Download requested for " + $scope.dataForDownload.length + " bytes ");
57-
var json = $scope.dataForDownload;
57+
var json = JSON.stringify($scope.dataForDownload);
5858
var blob = new Blob([json], {type: "application/json;charset=utf-8;"});
5959
var downloadLink = angular.element('<a></a>');
6060
downloadLink.attr('href', window.URL.createObjectURL(blob));
@@ -122,33 +122,6 @@ angularAPP.controller('ViewTopicCtrl', function ($scope, $routeParams, $rootScop
122122
return configArray;
123123
}
124124

125-
/*******************************
126-
* topic data / advanced / slider
127-
********************************/
128-
129-
//$scope.slider = {
130-
// minValue: 40,
131-
// maxValue: 60,
132-
// options: {
133-
// floor: 0,
134-
// ceil: 1000000,
135-
// step: 1,
136-
// minRange: 10,
137-
// maxRange: 30,
138-
// pushRange: true
139-
// }
140-
//};
141-
142-
//
143-
//$scope.slider = {
144-
// minValue: 10,
145-
// maxValue: 90,
146-
// options: {
147-
// floor: 0,
148-
// ceil: 100,
149-
// }
150-
//};
151-
//TODO delete me
152125
$scope.slider = {
153126
minValue: 0,
154127
maxValue: 10,
@@ -202,14 +175,16 @@ $scope.slider = {
202175
if(allData.length === 0) $scope.partitionIsEmpty = true;
203176
}
204177
$scope.rows = allData;
205-
$scope.dataForDownload = $scope.rows
206178
$scope.format=format;
207-
$scope.showSpinner = false;
208-
// TODO RETHINK THIS
209-
// if(format=='binary') {
210-
// $scope.hideTab = true;
211-
// }
179+
if(format == 'binary'){
180+
angular.forEach($scope.rows, function(row){
181+
row.key=$base64.decode(row.key)
182+
row.value=$base64.decode(row.value)
183+
})
184+
$scope.dataForDownload = $scope.rows
212185

186+
}
187+
$scope.showSpinner = false;
213188

214189
if(allData.length > 0) {
215190

@@ -365,7 +340,6 @@ $scope.slider = {
365340

366341
});
367342

368-
369343
angularAPP.factory('TopicFactory', function (HttpFactory) {
370344
var defaultContentType = 'application/vnd.kafka.avro.v2+json';
371345

0 commit comments

Comments
 (0)