Skip to content

Commit be2935d

Browse files
committed
removing code duplication, cleanup some code
1 parent 79a44ce commit be2935d

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
angularAPP.controller('KafkaTopicsListCtrl', function ($scope, $rootScope, $location, $routeParams, $mdToast, $log, KafkaRestProxyFactory, toastFactory, env) {
2-
$rootScope.timesCalled = 1;
32
$log.info("Starting kafka-topics controller : list (getting topic info)");
43
toastFactory.hideToast();
54

@@ -75,7 +74,7 @@ angularAPP.controller('KafkaTopicsListCtrl', function ($scope, $rootScope, $loca
7574
}
7675
});
7776

78-
return doLalbels(counts.replications, 'Replication') + ' \u2A2F ' + doLalbels(counts.partitions, 'Partition');
77+
return doLabels(counts.replications, 'Replication') + ' \u2A2F ' + doLabels(counts.partitions, 'Partition');
7978
}
8079

8180

@@ -124,7 +123,7 @@ function getLeftListTopics() {
124123
});
125124
}
126125

127-
function doLalbels(count, name) {
126+
function doLabels(count, name) {
128127
if (count == 0) return 'None ' + name;
129128
else if (count == 1) return '1 ' + name;
130129
else return count + ' ' + name +'s';

src/kafka-topics/view/templates/withConfiguration.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Custom rendering for Config overrides -->
22
<md-tab-body>
33
<md-content class="md-padding">
4-
<table class="flat-table" >
4+
<table class="flat-table" ng-if ="getExtraConfig(topicName) !== ''" >
55
<thead>
66
<tr>
77
<th class="td-center">Comfiguration</th>
@@ -34,7 +34,7 @@
3434
</tr>
3535
</tbody>
3636
</table>
37-
<div class="container-fluid-centered ng-scope" ng-if ="hasExtraConfig(topicName) == ''" style="height: 352px;">
37+
<div class="container-fluid-centered ng-scope" ng-if ="getExtraConfig(topicName) == ''" style="height: 352px;">
3838
<div class="row-fluid">
3939
<div class="centering text-center">
4040
This topic retains the default configuration

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,12 @@ angularAPP.controller('ViewTopicCtrl', function ($scope, $rootScope, $filter, $r
109109
originatorEv = null;
110110
};
111111

112-
$scope.hasExtraConfig = function (topicName) {
113-
var topicDetails = KafkaRestProxyFactory.isNormalTopic(topicName) ? $rootScope.topicDetails : $rootScope.controlTopicDetails;
114-
var extra = KafkaRestProxyFactory.hasExtraConfig(topicName, topicDetails);
115-
if (extra != '') {
116-
// $log.debug("Topic details " + topicName + " HAS EXTRA CONFIG " + extra);
117-
}
118-
return extra;
119-
};
120-
121112
$scope.getExtraConfig = function (topicName) {
122113
var topicDetails = KafkaRestProxyFactory.isNormalTopic(topicName) ? $rootScope.topicDetails : $rootScope.controlTopicDetails;
123114
var extra = KafkaRestProxyFactory.hasExtraConfig(topicName, topicDetails);
115+
if (extra)
124116
return JSON.parse(extra);
117+
else return ''
125118
};
126119

127120
$scope.getDefautConfigValue = function (configKey) {

0 commit comments

Comments
 (0)