This is an automated email from the ASF dual-hosted git repository. madhan pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new a0ce7a6 ATLAS-3331: updated metrics UI to display notification consumption details per topic a0ce7a6 is described below commit a0ce7a63631d16c2a9dc414426124be8150e99f6 Author: Saqeeb Shaikh <saqeeb.sha...@freestoneinfotech.com> AuthorDate: Fri Jul 12 13:57:14 2019 +0530 ATLAS-3331: updated metrics UI to display notification consumption details per topic Signed-off-by: Madhan Neethiraj <mad...@apache.org> (cherry picked from commit 519fc2bf495c89fef7d2eb20403c436456e1cbc3) --- .../site/Statistics_Topic_Offset_table_tmpl.html | 36 ++++++++++++++++++++++ .../public/js/templates/site/Statistics_tmpl.html | 11 +++++++ dashboardv2/public/js/utils/Enums.js | 3 +- dashboardv2/public/js/views/site/Statistics.js | 29 +++++++++++++++-- 4 files changed, 76 insertions(+), 3 deletions(-) diff --git a/dashboardv2/public/js/templates/site/Statistics_Topic_Offset_table_tmpl.html b/dashboardv2/public/js/templates/site/Statistics_Topic_Offset_table_tmpl.html new file mode 100644 index 0000000..4693edf --- /dev/null +++ b/dashboardv2/public/js/templates/site/Statistics_Topic_Offset_table_tmpl.html @@ -0,0 +1,36 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<thead> + <tr> + <th>Kafka Topic</th> + <th>Current Offset</th> + <th>Start Offset</th> + + </tr> +</thead> +{{#if data}} +<tbody> + {{#each tableCol}} + <tr> + <td>{{{this.label}}}</td> + {{#each ../tableHeader}} + <td>{{callmyfunction ../../getTmplValue ../this this}}</td> + {{/each }} + </tr> + {{/each}} +</tbody> +{{/if}} \ No newline at end of file diff --git a/dashboardv2/public/js/templates/site/Statistics_tmpl.html b/dashboardv2/public/js/templates/site/Statistics_tmpl.html index 76e6f84..ecd84d6 100644 --- a/dashboardv2/public/js/templates/site/Statistics_tmpl.html +++ b/dashboardv2/public/js/templates/site/Statistics_tmpl.html @@ -81,9 +81,20 @@ </tr> </tbody> </table> + + <hr> + </hr> + <table data-id="offset-card" class="table stat-table notification-table table-striped "> + <tbody> + <tr class="empty text-center"> + <td colspan="2"><span>No records found!</span></td> + </tr> + </tbody> + </table> </div> </div> </div> + </div> </div> </div> diff --git a/dashboardv2/public/js/utils/Enums.js b/dashboardv2/public/js/utils/Enums.js index 7e1df04..e38af74 100644 --- a/dashboardv2/public/js/utils/Enums.js +++ b/dashboardv2/public/js/utils/Enums.js @@ -184,7 +184,8 @@ define(['require'], function(require) { "totalCreates": "number", "totalDeletes": "number", "totalFailed": "number", - "totalUpdates": "number" + "totalUpdates": "number", + "topicOffsets":"number" } }; return Enums; diff --git a/dashboardv2/public/js/views/site/Statistics.js b/dashboardv2/public/js/views/site/Statistics.js index 6b29b45..a8e351e 100644 --- a/dashboardv2/public/js/views/site/Statistics.js +++ b/dashboardv2/public/js/views/site/Statistics.js @@ -20,6 +20,7 @@ define(['require', 'backbone', 'hbs!tmpl/site/Statistics_tmpl', 'hbs!tmpl/site/Statistics_Notification_table_tmpl', + 'hbs!tmpl/site/Statistics_Topic_Offset_table_tmpl', 'hbs!tmpl/site/entity_tmpl', 'modules/Modal', 'models/VCommon', @@ -30,7 +31,7 @@ define(['require', 'moment', 'utils/Utils', 'moment-timezone' -], function(require, Backbone, StatTmpl, StatsNotiTable, EntityTable, Modal, VCommon, UrlLinks, VTagList, CommonViewFunction, Enums, moment, Utils) { +], function(require, Backbone, StatTmpl, StatsNotiTable, TopicOffsetTable, EntityTable, Modal, VCommon, UrlLinks, VTagList, CommonViewFunction, Enums, moment, Utils) { 'use strict'; var StatisticsView = Backbone.Marionette.LayoutView.extend( @@ -48,7 +49,8 @@ define(['require', notificationCard: "[data-id='notification-card']", statsNotificationTable: "[data-id='stats-notification-table']", notificationSmallCard: "[data-id='notification-small-card']", - entityCard: "[data-id='entity-card']" + entityCard: "[data-id='entity-card']", + offsetCard: "[data-id='offset-card']" }, /** ui events hash */ events: function() {}, @@ -241,6 +243,29 @@ define(['require', "data": _.pick(data.Notification, 'lastMessageProcessedTime', 'offsetCurrent', 'offsetStart') }) ); + + + var offsetTableColumn = function(obj) { + var returnObj = [] + _.each(obj, function(value, key) { + returnObj.push({ "label": key, "dataValue": value }); + }); + return returnObj + } + + that.ui.offsetCard.html( + TopicOffsetTable({ + "enums": Enums.stats.Notification, + "data": data.Notification.topicOffsets, + "tableHeader": ['offsetCurrent', 'offsetStart'], + "tableCol": offsetTableColumn(data.Notification.topicOffsets), + "getTmplValue": function(argument, args) { + console.log(argument, args) + var returnVal = data.Notification.topicOffsets[argument.label][args]; + return returnVal ? _.numberFormatWithComa(returnVal) : 0; + } + }) + ) } if (data.Server) {