Repository: atlas Updated Branches: refs/heads/master 83fbe467b -> 22041f51c
ATLAS-3005 Modal for metrics statistic added Signed-off-by: kevalbhatt <kbh...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/22041f51 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/22041f51 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/22041f51 Branch: refs/heads/master Commit: 22041f51ce9a52f2c7b2634024e20765347a794a Parents: 83fbe46 Author: Abhishek Kadam <abhishek.kada...@gmail.com> Authored: Mon Dec 24 16:22:46 2018 +0530 Committer: kevalbhatt <kbh...@apache.org> Committed: Thu Jan 3 16:40:47 2019 +0530 ---------------------------------------------------------------------- dashboardv2/public/css/scss/common.scss | 6 ++ dashboardv2/public/css/scss/theme.scss | 27 ++++++- dashboardv2/public/js/router/Router.js | 7 ++ .../js/templates/common/Statistics_tmpl.html | 66 ++++++++++++++++ .../public/js/templates/site/Header.html | 1 + .../public/js/views/common/Statistics.js | 81 ++++++++++++++++++++ 6 files changed, 185 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/22041f51/dashboardv2/public/css/scss/common.scss ---------------------------------------------------------------------- diff --git a/dashboardv2/public/css/scss/common.scss b/dashboardv2/public/css/scss/common.scss index d137d39..65bafc3 100644 --- a/dashboardv2/public/css/scss/common.scss +++ b/dashboardv2/public/css/scss/common.scss @@ -155,4 +155,10 @@ pre { code { font-family: monospace; } +} + +#accordion { + .panel-default > .panel-heading{ + cursor: pointer; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/22041f51/dashboardv2/public/css/scss/theme.scss ---------------------------------------------------------------------- diff --git a/dashboardv2/public/css/scss/theme.scss b/dashboardv2/public/css/scss/theme.scss index 629c4c8..d603c4a 100644 --- a/dashboardv2/public/css/scss/theme.scss +++ b/dashboardv2/public/css/scss/theme.scss @@ -112,9 +112,7 @@ header { h1 { &.title { word-break: break-all; - } - - // margin-top: 50px; + } // margin-top: 50px; margin-bottom: 10px; font-weight: 600; @include ellipsis(); @@ -283,6 +281,29 @@ hr[size="10"] { z-index: 999; } +.panel.expand_collapse_panel-icon { + .panel-heading { + .panel-title { + display: inline-block; + } + i.ec-icon:before { + content: "\f078" + } + &.collapsed, + &[aria-expanded="false"] { + i.ec-icon:before { + content: "\f078" + } + } + &[aria-expanded="true"] { + i.ec-icon:before { + content: "\f077" + } + } + } +} + + .no-padding { padding: 0px !important; } http://git-wip-us.apache.org/repos/asf/atlas/blob/22041f51/dashboardv2/public/js/router/Router.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js index f323575..1bb98a1 100644 --- a/dashboardv2/public/js/router/Router.js +++ b/dashboardv2/public/js/router/Router.js @@ -73,6 +73,13 @@ define([ }, bindCommonEvents: function() { var that = this; + $('body').on('click', 'a.show-stat', function() { + require([ + 'views/common/Statistics', + ], function(AboutAtlas) { + new AboutAtlas(); + }); + }); $('body').on('click', 'li.aboutAtlas', function() { require([ 'views/common/AboutAtlas', http://git-wip-us.apache.org/repos/asf/atlas/blob/22041f51/dashboardv2/public/js/templates/common/Statistics_tmpl.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/common/Statistics_tmpl.html b/dashboardv2/public/js/templates/common/Statistics_tmpl.html new file mode 100644 index 0000000..cecdf20 --- /dev/null +++ b/dashboardv2/public/js/templates/common/Statistics_tmpl.html @@ -0,0 +1,66 @@ +<!-- + * 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. +--> +<div class="panel-group" id="accordion"> + <div class="panel panel-default expand_collapse_panel-icon"> + <div class="panel-heading" data-toggle="collapse" href="#collapse1" aria-expanded="true"> + <h4 class="panel-title"> + <a>Active Entities</a> + </h4> + <div class="btn-group pull-right"> + <button type="button" title="Collapse"><i class="ec-icon fa"></i></button> + </div> + </div> + <div id="collapse1" class="panel-collapse collapse in"> + <div class="panel-body"> + <table class="table table-quickMenu"> + <thead> + <tr> + <th>Entity</th> + <th>Count</th> + </tr> + </thead> + <tbody data-id="entityActive"> + </tbody> + </table> + </div> + </div> + </div> + <div class="panel panel-default expand_collapse_panel-icon"> + <div class="panel-heading" data-toggle="collapse" href="#collapse2"> + <h4 class="panel-title"> + <a>Deleted Entities</a> + </h4> + <div class="btn-group pull-right"> + <button type="button" title="Collapse"><i class="ec-icon fa"></i></button> + </div> + </div> + <div id="collapse2" class="panel-collapse collapse"> + <div class="panel-body"> + <table class="table table-quickMenu"> + <thead> + <tr> + <th>Entity</th> + <th>Count</th> + </tr> + </thead> + <tbody data-id="entityDelete"> + </tbody> + </table> + </div> + </div> + </div> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/22041f51/dashboardv2/public/js/templates/site/Header.html ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/templates/site/Header.html b/dashboardv2/public/js/templates/site/Header.html index 2042c99..fc612f5 100644 --- a/dashboardv2/public/js/templates/site/Header.html +++ b/dashboardv2/public/js/templates/site/Header.html @@ -22,6 +22,7 @@ <li class="details-backbutton"><a href="javascript:void(0);" data-id="backButton"><i class="fa fa-chevron-left"></i> Back To Results</a></li> </ul> <div class="btn-group pull-right header-menu "> + <a class="show-stat" href="javascript:void(0);"><i class="fa fa-bar-chart"></i></a> <a target="_blank" href="http://atlas.apache.org/"><i class="fa fa-question-circle"></i></a> <a href="javascript:void(0);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="user-dropdown"><i class="fa fa-user user-circle "></i><span class="userName"></span></a> <ul class="dropdown-menu"> http://git-wip-us.apache.org/repos/asf/atlas/blob/22041f51/dashboardv2/public/js/views/common/Statistics.js ---------------------------------------------------------------------- diff --git a/dashboardv2/public/js/views/common/Statistics.js b/dashboardv2/public/js/views/common/Statistics.js new file mode 100644 index 0000000..4ca1978 --- /dev/null +++ b/dashboardv2/public/js/views/common/Statistics.js @@ -0,0 +1,81 @@ +/** + * 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. + */ + +define(['require', + 'backbone', + 'hbs!tmpl/common/Statistics_tmpl', + 'modules/Modal', + 'models/VCommon', + 'utils/UrlLinks', + 'collection/VTagList', + 'utils/CommonViewFunction' +], function(require, Backbone, StatTmpl, Modal, VCommon, UrlLinks, VTagList, CommonViewFunction) { + 'use strict'; + + var StatisticsView = Backbone.Marionette.LayoutView.extend( + /** @lends AboutAtlasView */ + { + template: StatTmpl, + /** Layout sub regions */ + regions: {}, + /** ui selector cache */ + ui: { + entityActive: "[data-id='entityActive']", + entityDelete: "[data-id='entityDelete']" + }, + /** ui events hash */ + events: function() {}, + /** + * intialize a new AboutAtlasView Layout + * @constructs + */ + initialize: function(options) { + _.extend(this, options); + var modal = new Modal({ + title: 'Statistics', + content: this, + okCloses: true, + showFooter: true, + allowCancel: false, + }).open(); + + modal.on('closeModal', function() { + modal.trigger('cancel'); + }); + }, + bindEvents: function() {}, + onRender: function() { + var that = this; + var entityCountCollection = new VTagList(); + entityCountCollection.url = UrlLinks.entityCountApi(); + entityCountCollection.modelAttrName = "data"; + entityCountCollection.fetch({ + success: function(data) { + var data = _.first(data.toJSON()), + no_records = '<tr class="empty text-center"><td colspan="2"><span>No records found!</span></td></tr>', + activeEntityTable = _.isEmpty(data.entity.entityActive) ? no_records : CommonViewFunction.propertyTable({ scope: that, valueObject: data.entity.entityActive }), + deleteEntityTable = _.isEmpty(data.entity.entityDelete) ? no_records : CommonViewFunction.propertyTable({ scope: that, valueObject: data.entity.entityDelete }); + that.ui.entityActive.html(activeEntityTable); + that.ui.entityDelete.html(deleteEntityTable); + } + }); + }, + + }); + return StatisticsView; +}); \ No newline at end of file