You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ni...@apache.org on 2020/03/13 08:58:11 UTC
[atlas] branch branch-2.0 updated (6202f48 -> 453094c)
This is an automated email from the ASF dual-hosted git repository.
nixon pushed a change to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git.
from 6202f48 ATLAS-1866 :- Documentation for PAM type authentication and better logging for PAM auth
new fcb5eda ATLAS-3662 : UI: Business Metadata validation improvements
new 4761632 ATLAS-3657 : UI: changes for entity purge audits
new 453094c ATLAS-3598 : Beta UI: Issues with single click functionality in left hand panel.
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../js/views/search/SearchResultLayoutView.js | 5 +-
dashboardv3/public/css/scss/business-metadata.scss | 14 +-
dashboardv3/public/css/scss/common.scss | 9 +
dashboardv3/public/css/scss/override.scss | 2 +-
dashboardv3/public/js/collection/VEntityList.js | 8 +
dashboardv3/public/js/router/Router.js | 2 +-
.../AdministratorLayoutView_tmpl.html | 7 +-
.../PurgeAuditTableLayoutView_tmpl.html | 120 -----
.../audit/AdminAuditTableLayoutView_tmpl.html | 78 ++++
.../audit/CreateAuditTableLayoutView_tmpl.html | 2 +-
.../BusinessMetadataAttributeItemView_tmpl.html | 6 +-
.../CreateBusinessMetadataLayoutView_tmpl.html | 2 +-
dashboardv3/public/js/utils/Enums.js | 2 +-
dashboardv3/public/js/utils/UrlLinks.js | 4 +-
dashboardv3/public/js/utils/Utils.js | 6 +
.../views/administrator/AdministratorLayoutView.js | 15 +-
.../administrator/PurgeAuditTableLayoutView.js | 517 ---------------------
.../js/views/audit/AdminAuditTableLayoutView.js | 369 +++++++++++++++
.../js/views/audit/CreateAuditTableLayoutView.js | 5 +-
.../BusinessMetadataAttrTableLayoutView.js | 1 -
.../BusinessMetadataAttributeItemView.js | 67 +--
.../BusinessMetadataContainerLayoutView.js | 28 +-
.../BusinessMetadataDetailLayoutView.js | 12 +-
.../BusinessMetadataTableLayoutView.js | 38 +-
.../CreateBusinessMetadataLayoutView.js | 363 +++++----------
.../business_metadata/EnumCreateUpdateItemView.js | 14 +-
.../public/js/views/search/QueryBuilderView.js | 125 ++---
.../js/views/search/SearchDefaultLayoutView.js | 6 +-
.../js/views/search/SearchResultLayoutView.js | 11 +-
.../search/tree/ClassificationTreeLayoutView.js | 46 +-
.../js/views/search/tree/EntityTreeLayoutView.js | 38 +-
31 files changed, 798 insertions(+), 1124 deletions(-)
delete mode 100644 dashboardv3/public/js/templates/administrator/PurgeAuditTableLayoutView_tmpl.html
create mode 100644 dashboardv3/public/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
delete mode 100644 dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js
create mode 100644 dashboardv3/public/js/views/audit/AdminAuditTableLayoutView.js
[atlas] 02/03: ATLAS-3657 : UI: changes for entity purge audits
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 4761632f03c6411f48c57821e79870c6c8afac51
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Thu Mar 12 18:17:24 2020 +0530
ATLAS-3657 : UI: changes for entity purge audits
Signed-off-by: nixonrodrigues <ni...@apache.org>
(cherry picked from commit ffd2e2b5df934f5266e362e6b8ad1a6d4dfa6501)
---
dashboardv3/public/css/scss/business-metadata.scss | 14 +-
dashboardv3/public/css/scss/override.scss | 2 +-
dashboardv3/public/js/collection/VEntityList.js | 8 +
dashboardv3/public/js/router/Router.js | 2 +-
.../AdministratorLayoutView_tmpl.html | 7 +-
.../PurgeAuditTableLayoutView_tmpl.html | 120 -----
.../audit/AdminAuditTableLayoutView_tmpl.html | 78 ++++
.../audit/CreateAuditTableLayoutView_tmpl.html | 2 +-
dashboardv3/public/js/utils/Enums.js | 2 +-
dashboardv3/public/js/utils/UrlLinks.js | 4 +-
dashboardv3/public/js/utils/Utils.js | 6 +
.../views/administrator/AdministratorLayoutView.js | 15 +-
.../administrator/PurgeAuditTableLayoutView.js | 517 ---------------------
.../js/views/audit/AdminAuditTableLayoutView.js | 369 +++++++++++++++
.../js/views/audit/CreateAuditTableLayoutView.js | 5 +-
.../public/js/views/search/QueryBuilderView.js | 125 ++---
16 files changed, 569 insertions(+), 707 deletions(-)
diff --git a/dashboardv3/public/css/scss/business-metadata.scss b/dashboardv3/public/css/scss/business-metadata.scss
index a521a4b..ecfddf7 100644
--- a/dashboardv3/public/css/scss/business-metadata.scss
+++ b/dashboardv3/public/css/scss/business-metadata.scss
@@ -67,14 +67,24 @@
}
}
-.business-metadata-details {
-
+.business-metadata-details,
+.admin-details {
.expandable .attr-details {
max-height: 300px;
overflow: auto;
margin-left: 30px;
width: calc(100% - 30px);
}
+
+ .admin-type-dropdown {
+ width: 100px;
+ }
+
+ .expandable .admin-attr-details {
+ max-height: 100px;
+ margin-left: 20px;
+ width: calc(100% - 27px);
+ }
}
.tab-pane {
diff --git a/dashboardv3/public/css/scss/override.scss b/dashboardv3/public/css/scss/override.scss
index eb7e8a9..c375cd8 100644
--- a/dashboardv3/public/css/scss/override.scss
+++ b/dashboardv3/public/css/scss/override.scss
@@ -249,7 +249,7 @@
overflow-x: hidden;
}
-.purge-details {
+.admin-details {
.tab-pane.active {
min-height: 400px;
}
diff --git a/dashboardv3/public/js/collection/VEntityList.js b/dashboardv3/public/js/collection/VEntityList.js
index e4e2ba3..645bc0c 100644
--- a/dashboardv3/public/js/collection/VEntityList.js
+++ b/dashboardv3/public/js/collection/VEntityList.js
@@ -54,6 +54,14 @@ define(['require',
} catch (e) {
console.log(e);
}
+ },
+ getAdminData: function(options) {
+ var url = UrlLinks.adminApiUrl();
+ options = _.extend({
+ contentType: 'application/json',
+ dataType: 'json'
+ }, options);
+ return this.constructor.nonCrudOperation.call(this, url, 'POST', options);
}
},
//Static Class Members
diff --git a/dashboardv3/public/js/router/Router.js b/dashboardv3/public/js/router/Router.js
index 7127c40..f2c1f1d 100644
--- a/dashboardv3/public/js/router/Router.js
+++ b/dashboardv3/public/js/router/Router.js
@@ -486,7 +486,7 @@ define([
var that = this;
require(["views/site/Header", "views/site/SideNavLayoutView", 'views/administrator/AdministratorLayoutView'], function(Header, SideNavLayoutView, AdministratorLayoutView) {
var value = Utils.getUrlState.getQueryParams(),
- paramObj = _.extend({ value: value, guid: null }, that.preFetchedCollectionLists);
+ paramObj = _.extend({ value: value, guid: null }, that.preFetchedCollectionLists, that.sharedObj);
that.renderViewIfNotExists(that.getHeaderOptions(Header));
that.renderViewIfNotExists({
view: App.rSideNav,
diff --git a/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html b/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html
index cc6279a..f734c94 100644
--- a/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html
@@ -22,11 +22,12 @@
<ul class="nav nav-tabs" data-id="tab-list">
<li role="businessMetadata" class="tab active"><a href="#tab-businessMetadata" aria-controls="tab-businessMetadata" role="tab" data-toggle="tab">Business Metadata</a></li>
<li role="enum"><a href="#tab-enum" aria-controls="tab-enum" role="tab" data-toggle="tab">Enumerations</a></li>
+ <li role="admin"><a href="#tab-admin" aria-controls="tab-admin" role="tab" data-toggle="tab">Audits</a></li>
</ul>
</div>
</div>
<div>
- <div class="tab-content purge-details">
+ <div class="tab-content admin-details">
<div id="tab-businessMetadata" role="businessMetadata" class="tab-pane active animated fadeIn">
<div id="r_businessMetadataTableLayoutView">
</div>
@@ -35,6 +36,10 @@
<div id="r_enumTableLayoutView">
</div>
</div>
+ <div id="tab-admin" role="admin" class="tab-pane animated fadeIn">
+ <div id="r_adminTableLayoutView">
+ </div>
+ </div>
</div>
</div>
</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/administrator/PurgeAuditTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/administrator/PurgeAuditTableLayoutView_tmpl.html
deleted file mode 100644
index ee394a9..0000000
--- a/dashboardv3/public/js/templates/administrator/PurgeAuditTableLayoutView_tmpl.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<!--
- * 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="page-title clearfix">
- <!-- <div class="fontLoader">
- <i class="fa fa-refresh fa-spin-custom"></i>
- </div> -->
- <div class="row">
- <div class="col-sm-12 default-tab">
- <ul class="nav nav-tabs" data-id="tab-list">
- <li role="purgeaudit" class="tab active"><a href="#tab-audit" aria-controls="tab-audit" role="tab" data-toggle="tab">Audits</a></li>
- <li role="namespace"><a href="#tab-namespace" aria-controls="tab-namespace" role="tab" data-toggle="tab">Namespace</a></li>
- </ul>
- </div>
- </div>
-</div>
-<div>
- <div class="tab-content purge-details">
- <div id="tab-audit" role="purgeaudit" class="tab-pane active animated fadeIn">
- <div id="r_auditTableLayoutView">
- <div class="fontLoader-relative">
- <i class="fa fa-refresh fa-spin-custom"></i>
- </div>
- <div class="position-relative">
- <div class="tableOverlay"></div>
- <!-- Not for table Loader its only for initial loading -->
- <div class="fontLoader">
- <i class="fa fa-refresh fa-spin-custom"></i>
- </div>
- <div class="attributeResultContainer form-group ">
- <button class="btn-action btn-sm attribute-filter-text" data-id='purgeAttrFilter'> <i class="fa fa-angle-right"></i> Filters</button>
- <div class="attribute-filter-container hide">
- <div class="panel panel-default expand_collapse_panel-icon" data-id="purgeRegion">
- <div class="panel-heading" data-toggle="collapse" href="#collapsePurge" aria-expanded="true">
- <h4 class="panel-title">
- <a>Purge</a>
- </h4>
- <div class="btn-group pull-right">
- <button type="button" title="Collapse"><i class="ec-icon fa"></i></button>
- </div>
- </div>
- <div id="collapsePurge" class="panel-collapse collapse in">
- <div class="panel-body">
- <div id='r_attributeQueryBuilderPurge' class='attribute-querybuilder'>
- <div class='fontLoader'><i class='fa fa-refresh fa-spin-custom'></i></div>
- </div>
- </div>
- </div>
- </div>
- <div class='attribute-result-footer'>
- <div type="ok" class="btn btn-atlas ok search" data-id='attrApply'>Apply</div>
- <div type="ok" class="btn btn-atlas ok" data-id='attrClose'>Close</div>
- </div>
- </div>
- <div class="pull-right">
- <select class="pull-right form-controlrow-margin-bottom" data-id="purgeType"></select>
- </div>
- </div>
- <div class='attr-filter-overlay hide'></div>
- <div class="auditTable" style="display: none">
- <div id="r_purgeAuditTableLayoutView"></div>
- <div>
- <span class="labelShowRecord pull-left" data-id="pageRecordText"></span>
- </div>
- <div class="pagination-box">
- <div class="backgrid-paginator pull-right">
- <ul>
- <li>
- <button type="button" data-id="previousAuditData" title="Previous" disabled=true>
- <i class="fa fa-angle-left" aria-hidden="true"></i>
- </button>
- </li>
- <li class="active">
- <a href="javascript:void(0)" data-id="activePage"></a>
- </li>
- <li>
- <button type="button" data-id="nextAuditData" title="Next">
- <i class="fa fa-angle-right" aria-hidden="true"></i>
- </button>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="no-data" data-id="showDefault">
- <div class="position-relative thick-border">
- <div style="padding-top: 20px; " class="table-responsive tableBorder">
- <table class="table table-hover backgrid table-quickMenu">
- <tbody>
- <tr class="empty">
- <td colspan="16"><span>No Records found!</span></td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <div id="tab-namespace" role="namespace" class="tab-pane animated fadeIn">
- <div id="r_namespaceTableLayoutView">
- </div>
- </div>
- </div>
-</div>
-</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/audit/AdminAuditTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
new file mode 100644
index 0000000..5e5f897
--- /dev/null
+++ b/dashboardv3/public/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
@@ -0,0 +1,78 @@
+<!--
+ * 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="tab-content admin-details">
+ <div id="tab-audit" role="adminaudit">
+ <div id="r_auditTableLayoutView">
+ <div class="fontLoader-relative">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+ </div>
+ <div class="position-relative">
+ <div class="tableOverlay"></div>
+ <!-- Not for table Loader its only for initial loading -->
+ <div class="fontLoader">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+ </div>
+ <div class="attributeResultContainer form-group ">
+ <button class="btn-action btn-sm attribute-filter-text" data-id='adminAttrFilter'> <i class="fa fa-angle-right"></i> Filters</button>
+ <div class="attribute-filter-container hide">
+ <div class="panel panel-default expand_collapse_panel-icon" data-id="adminRegion">
+ <div class="panel-heading" data-toggle="collapse" href="#collapseAdmin" aria-expanded="true">
+ <h4 class="panel-title">
+ <a>Admin</a>
+ </h4>
+ <div class="btn-group pull-right">
+ <button type="button" title="Collapse"><i class="ec-icon fa"></i></button>
+ </div>
+ </div>
+ <div id="collapseAdmin" class="panel-collapse collapse in">
+ <div class="panel-body">
+ <div id='r_attributeQueryBuilderAdmin' class='attribute-querybuilder'>
+ <div class='fontLoader'><i class='fa fa-refresh fa-spin-custom'></i></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class='attribute-result-footer'>
+ <div type="ok" class="btn btn-atlas ok search" data-id='attrApply'>Apply</div>
+ <div type="ok" class="btn btn-atlas ok" data-id='attrClose'>Close</div>
+ </div>
+ </div>
+ <div class="pull-right admin-type-dropdown">
+ <select class="pull-right form-controlrow-margin-bottom" data-id="adminType"></select>
+ </div>
+ </div>
+ <div class="auditTable" style="display: none">
+ <div class='attr-filter-overlay hide'></div>
+ <div id="r_adminAuditTableLayoutView"></div>
+ </div>
+ </div>
+ </div>
+ <div class="no-data" data-id="showDefault">
+ <div class="position-relative thick-border">
+ <div style="padding-top: 20px; " class="table-responsive tableBorder">
+ <table class="table table-hover backgrid table-quickMenu">
+ <tbody>
+ <tr class="empty">
+ <td colspan="16"><span>No Records found!</span></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
index 1ff67d3..10cc697 100644
--- a/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-<h4 class="entity-name" style="word-break: break-word;">Name: <span data-id="name"></span></h4>
+<h4 class="entity-name" style="word-break: break-word;" data-id="nameContainer">Name: <span data-id="name"></span></h4>
<div class="panel-group server-stats-container auditStatusContainer clearfix" id="accordion">
<div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="detailsAttribute">
<div class="panel-heading" data-toggle="collapse" href="#detailAttributeTableCollapse" aria-expanded="true">
diff --git a/dashboardv3/public/js/utils/Enums.js b/dashboardv3/public/js/utils/Enums.js
index e5cba08..ef93b77 100644
--- a/dashboardv3/public/js/utils/Enums.js
+++ b/dashboardv3/public/js/utils/Enums.js
@@ -212,4 +212,4 @@ define(['require'], function(require) {
1: "true"
};
return Enums;
-});
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/utils/UrlLinks.js b/dashboardv3/public/js/utils/UrlLinks.js
index 95ca065..17d2bdf 100644
--- a/dashboardv3/public/js/utils/UrlLinks.js
+++ b/dashboardv3/public/js/utils/UrlLinks.js
@@ -227,8 +227,8 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
sessionApiUrl: function() {
return this.baseUrl + '/admin/session';
},
- purgeApiUrl: function() {
- return this.baseUrl + '/admin/audit';
+ adminApiUrl: function() {
+ return this.baseUrl + '/admin/audits';
}
});
diff --git a/dashboardv3/public/js/utils/Utils.js b/dashboardv3/public/js/utils/Utils.js
index bb33102..2d7d433 100644
--- a/dashboardv3/public/js/utils/Utils.js
+++ b/dashboardv3/public/js/utils/Utils.js
@@ -411,6 +411,12 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
matchString: "detailPage"
});
},
+ isPurgePage: function(url) {
+ return this.checkTabUrl({
+ url: url,
+ matchString: "purge"
+ });
+ },
getLastValue: function() {
return this.getQueryUrl().lastValue;
},
diff --git a/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js b/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
index 78d7cd1..49f4635 100644
--- a/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
+++ b/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
@@ -38,7 +38,8 @@ define(['require',
/** Layout sub regions */
regions: {
RBusinessMetadataTableLayoutView: "#r_businessMetadataTableLayoutView",
- REnumTableLayoutView: '#r_enumTableLayoutView'
+ REnumTableLayoutView: '#r_enumTableLayoutView',
+ RAdminTableLayoutView: '#r_adminTableLayoutView'
},
/** ui selector cache */
@@ -67,7 +68,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'value', 'guid', 'entityDefCollection', 'businessMetadataDefCollection', 'enumDefCollection'));
+ _.extend(this, _.pick(options, 'value', 'entityDefCollection', 'businessMetadataDefCollection', 'enumDefCollection', 'searchTableFilters'));
},
onShow: function() {
@@ -79,6 +80,7 @@ define(['require',
},
bindEvents: function() {
this.renderEnumLayoutView();
+ this.renderAdminLayoutView();
},
onRender: function() {
this.renderBusinessMetadataLayoutView();
@@ -99,6 +101,15 @@ define(['require',
});
that.REnumTableLayoutView.show(view);
});
+ },
+ renderAdminLayoutView: function(obj) {
+ var that = this;
+ require(["views/audit/AdminAuditTableLayoutView"], function(AdminAuditTableLayoutView) {
+ var view = new AdminAuditTableLayoutView({
+ searchTableFilters: that.searchTableFilters
+ });
+ that.RAdminTableLayoutView.show(view);
+ });
}
});
return AdministratorLayoutView;
diff --git a/dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js b/dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js
deleted file mode 100644
index ada59d2..0000000
--- a/dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js
+++ /dev/null
@@ -1,517 +0,0 @@
-/**
- * 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/audit/PurgeAuditTableLayoutView_tmpl',
- 'collection/VEntityList',
- 'models/VSearch',
- 'utils/Utils',
- 'utils/Enums',
- 'utils/UrlLinks',
- 'utils/CommonViewFunction'
-], function(require, Backbone, PurgeAuditTableLayoutView_tmpl, VEntityList, VSearch, Utils, Enums, UrlLinks, CommonViewFunction) {
- 'use strict';
-
- var PurgeAuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
- /** @lends AuditTableLayoutView */
- {
- _viewName: 'PurgeAuditTableLayoutView',
-
- template: PurgeAuditTableLayoutView_tmpl,
-
- /** Layout sub regions */
- regions: {
- RAuditTableLayoutView: "#r_purgeAuditTableLayoutView",
- RQueryBuilderPurge: "#r_attributeQueryBuilderPurge",
- RNamespaceTableLayoutView: "#r_namespaceTableLayoutView"
- },
-
- /** ui selector cache */
- ui: {
- auditCreate: "[data-id='auditCreate']",
- previousAuditData: "[data-id='previousAuditData']",
- nextAuditData: "[data-id='nextAuditData']",
- pageRecordText: "[data-id='pageRecordText']",
- activePage: "[data-id='activePage']",
- purgeEntityClick: "[data-id='purgeEntity']",
- purgeType: "[data-id='purgeType']",
- attrFilter: "[data-id='purgeAttrFilter']",
- purgeRegion: "[data-id='purgeRegion']",
- attrApply: "[data-id='attrApply']",
- showDefault: "[data-id='showDefault']",
- attrClose: "[data-id='attrClose']",
- tablist: '[data-id="tab-list"] li'
- },
- /** ui events hash */
- events: function() {
- var events = {},
- that = this;
- events["click " + this.ui.purgeEntityClick] = "onClickPurgeEntity";
- events["change " + this.ui.purgeType] = "onClickPurgeType";
- events["click " + this.ui.nextAuditData] = "onClickNextAuditData";
- events["click " + this.ui.previousAuditData] = "onClickPreviousAuditData";
- events["click " + this.ui.attrFilter] = function(e) {
- // this.$('.fa-chevron-right').toggleClass('fa-chevron-down');
- this.$('.fa-angle-right').toggleClass('fa-angle-down');
- this.$('.attributeResultContainer').addClass("overlay");
- this.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
- // this.$('.attribute-filter-container').toggleClass('attribute-filter-container')
- this.onClickAttrFilter();
- };
- events["click " + this.ui.attrClose] = function(e) {
- that.closeAttributeModel();
- };
- events["click " + this.ui.attrApply] = function(e) {
- that.okAttrFilterButton(e);
- };
- events["click " + this.ui.tablist] = function(e) {
- var tabValue = $(e.currentTarget).attr('role');
- Utils.setUrl({
- url: Utils.getUrlState.getQueryUrl().queyParams[0],
- urlParams: { tabActive: tabValue || 'properties' },
- mergeBrowserUrl: false,
- trigger: false,
- updateTabState: true
- });
-
- };
- return events;
- },
- /**
- * intialize a new AuditTableLayoutView Layout
- * @constructs
- */
- initialize: function(options) {
- _.extend(this, _.pick(options, 'value', 'guid', 'entity', 'entityName', 'attributeDefs', 'nameSpaceCollection'));
- this.entityCollection = new VEntityList();
- this.limit = 26;
- this.entityCollection.url = UrlLinks.purgeApiUrl();
- this.entityCollection.modelAttrName = "events";
- this.entityModel = new this.entityCollection.model();
- this.pervOld = [];
- this.onlyPurge = true;
- this.commonTableOptions = {
- collection: this.entityCollection,
- includeFilter: false,
- includePagination: false,
- includePageSize: false,
- includeAtlasTableSorting: true,
- includeFooterRecords: false,
- gridOpts: {
- className: "table table-hover backgrid table-quickMenu",
- emptyText: 'No records found!'
- },
- filterOpts: {},
- paginatorOpts: {}
- };
- this.currPage = 1;
- this.isFilters = null;
- this.purgeAttrFilters = [{
- "id": "startTime",
- "label": "startTime (date)",
- "operators": [
- "=",
- "!=",
- ">",
- "<",
- ">=",
- "<="
- ],
- "optgroup": "Select Purge Attribute",
- "plugin": "daterangepicker",
- "plugin_config": {
- "locale": {
- "format": "MM/DD/YYYY h:mm A"
- },
- "showDropdowns": true,
- "singleDatePicker": true,
- "timePicker": true
- },
- "type": "date"
- }, {
- "id": "endTime",
- "label": "endTime (date)",
- "operators": [
- "=",
- "!=",
- ">",
- "<",
- ">=",
- "<="
- ],
- "optgroup": "Select Purge Attribute",
- "plugin": "daterangepicker",
- "plugin_config": {
- "locale": {
- "format": "MM/DD/YYYY h:mm A"
- },
- "showDropdowns": true,
- "singleDatePicker": true,
- "timePicker": true
- },
- "type": "date"
- }]
- },
- onRender: function() {
- var str = '<option>All</option><option>Purge</option>';
- this.ui.purgeType.html(str);
- this.ui.purgeType.select2({});
- this.bindEvents();
- this.ui.purgeRegion.hide();
- this.getPurgeParam();
- this.entityCollection.comparator = function(model) {
- return -model.get('timestamp');
- }
- },
- onShow: function() {
- if (this.value && this.value.tabActive) {
- this.$('.nav.nav-tabs').find('[role="' + this.value.tabActive + '"]').addClass('active').siblings().removeClass('active');
- this.$('.tab-content').find('[role="' + this.value.tabActive + '"]').addClass('active').siblings().removeClass('active');
- $("html, body").animate({ scrollTop: (this.$('.tab-content').offset().top + 1200) }, 1000);
- }
- },
- bindEvents: function() {
- this.renderNameSpaceLayoutView();
- },
-
- renderNameSpaceLayoutView: function(obj) {
- var that = this;
- require(['views/name_space/AllNameSpaceTableLayoutView'], function(AllNameSpaceTableLayoutView) {
- that.RNamespaceTableLayoutView.show(new AllNameSpaceTableLayoutView({ nameSpaceCollection: that.nameSpaceCollection }));
- });
- },
- getToOffset: function() {
- return ((this.limit - 1) * this.currPage);
- },
- getFromOffset: function(toOffset) {
- // +2 because of toOffset is alrady in minus and limit is +1;
- return ((toOffset - this.limit) + 2);
- },
- renderOffset: function(options) {
- var entityLength;
- if (options.nextClick) {
- options.previous.removeAttr("disabled");
- if (this.entityCollection.length != 0) {
- this.currPage++;
-
- }
- } else if (options.previousClick) {
- options.next.removeAttr("disabled");
- if (this.currPage > 1 && this.entityCollection.models.length) {
- this.currPage--;
- }
- }
- if (this.entityCollection.models.length === this.limit) {
- // Because we have 1 extra record.
- entityLength = this.entityCollection.models.length - 1;
- } else {
- entityLength = this.entityCollection.models.length
- }
- this.ui.activePage.attr('title', "Page " + this.currPage);
- this.ui.activePage.text(this.currPage);
- var toOffset = this.getToOffset();
- this.ui.pageRecordText.html("Showing <u>" + entityLength + " records</u> From " + this.getFromOffset(toOffset) + " - " + toOffset);
- },
- getPurgeParam: function() {
- var that = this;
- that.fetchCollection({
- next: that.ui.nextAuditData,
- nextClick: false,
- previous: that.ui.previousAuditData,
- isPurge: that.onlyPurge
- });
- },
- closeAttributeModel: function() {
- var that = this;
- that.$('.attributeResultContainer').removeClass("overlay");
- that.$('.fa-angle-right').toggleClass('fa-angle-down');
- that.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
- },
- getAttributes: function() {
- var purgeAttributes = [{
- "attributeName": "operation",
- "operator": "like",
- "attributeValue": "PURGE"
- }];
- if (!this.onlyPurge) {
- purgeAttributes.push({
- "attributeName": "userName",
- "operator": "like",
- "attributeValue": "admin"
- })
- }
- if (this.isFilters) {
- _.each(this.isFilters, function(purgeFilter) {
- purgeAttributes.push({
- "attributeName": purgeFilter.id,
- "operator": purgeFilter.operator,
- "attributeValue": Date.parse(purgeFilter.value).toString(),
- })
- })
- this.isFilters = null;
- }
- return purgeAttributes;
- },
-
- renderQueryBuilder: function(obj, rQueryBuilder) {
- var that = this;
- require(['views/search/QueryBuilderView'], function(QueryBuilderView) {
- rQueryBuilder.show(new QueryBuilderView(obj));
- });
- },
- onClickAttrFilter: function() {
- var that = this;
- this.ui.purgeRegion.show();
- require(['views/search/QueryBuilderView'], function(QueryBuilderView) {
- that.RQueryBuilderPurge.show(new QueryBuilderView({ purgeAttrFilters: that.purgeAttrFilters }));
- });
-
- },
- okAttrFilterButton: function(options) {
- var that = this,
- isFilterValidate = true,
- queryBuilderRef = that.RQueryBuilderPurge.currentView.ui.builder;
- if (queryBuilderRef.data("queryBuilder")) {
- var queryBuilder = queryBuilderRef.queryBuilder("getRules");
- queryBuilder ? that.isFilters = queryBuilder.rules : isFilterValidate = false;
- }
- if (isFilterValidate) {
- that.closeAttributeModel();
- that.getPurgeParam();
- }
- },
- fetchCollection: function(options) {
- var that = this,
- purgeParam = {
- condition: "AND",
- criterion: that.getAttributes()
- };
- this.$('.fontLoader').show();
- this.$('.tableOverlay').show();
- if (that.entityCollection.models.length > 1) {
- if (options.nextClick) {
- this.pervOld.push(that.entityCollection.first().get('eventKey'));
- }
- }
- var apiObj = {
- sort: false,
- success: function(dataOrCollection, response) {
- if (!(that.ui.pageRecordText instanceof jQuery)) {
- return;
- }
- that.entityCollection.fullCollection.reset(dataOrCollection);
- if (that.entityCollection.models.length < that.limit) {
- options.previous.attr('disabled', true);
- options.next.attr('disabled', true);
- }
- that.renderOffset(options);
- that.entityCollection.sort();
- if (that.entityCollection.models.length) {
- if (that.entityCollection && (that.entityCollection.models.length < that.limit && that.currPage == 1) && that.next == that.entityCollection.last().get('eventKey')) {
- options.next.attr('disabled', true);
- options.previous.removeAttr("disabled");
- } else {
- that.next = that.entityCollection.last().get('eventKey');
- if (that.pervOld.length === 0) {
- options.previous.attr('disabled', true);
- }
- }
- }
- that.renderTableLayoutView();
- that.$('.fontLoader').hide();
- that.$('.tableOverlay').hide();
- that.$('.auditTable').show(); // Only for first time table show because we never hide after first render.
- },
- silent: true,
- reset: true
- }
- $.extend(that.entityCollection.queryParams, { limit: 25, offset: 0, auditFilters: purgeParam });
- $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.entityCollection.queryParams) })
- this.entityCollection.constructor.nonCrudOperation.call(this, UrlLinks.purgeApiUrl(), "POST", apiObj);
- },
- renderTableLayoutView: function() {
- var that = this;
-
- this.ui.showDefault.hide();
- require(['utils/TableLayout'], function(TableLayout) {
- var cols = new Backgrid.Columns(that.getAuditTableColumns());
- that.RAuditTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
- columns: cols
- })));
- if (!(that.entityCollection.models.length < that.limit)) {
- that.RAuditTableLayoutView.$el.find('table tr').last().hide();
- }
- });
- },
- getAuditTableColumns: function() {
- var that = this;
- return this.entityCollection.constructor.getTableCols({
- result: {
- label: "",
- cell: "html",
- editable: false,
- sortable: false,
- cell: Backgrid.ExpandableCell,
- fixWidth: "20",
- accordion: false,
- expand: function(el, model) {
- var purgeValues = '';
- if (model.attributes.params) {
- var guids = model.attributes.result.replace('[', '').replace(']', '').split(',');
- _.each(guids, function(purgeGuid) {
- // purgeGuid.trim();
- purgeValues += '<a class="blue-link" data-id="purgeEntity" >' + purgeGuid.trim() + '</a></br>';
- })
- } else {
- purgeValues = '';
- }
- var purgeText = '<div class="row"><div class="col-sm-2">Purge Entities: </div><div class="col-sm-10">' + purgeValues + '</div></div>';
- /* set expanded row's content */
- $(el).append($('<div>').html(purgeText));
-
- }
- },
- userName: {
- label: "Users",
- cell: "html",
- editable: false,
- sortable: function(e, attr, order) {
- return function(left, right) {
-
- // no-op
- if (order == null) return 0;
-
- var l = left.get(attr),
- r = right.get(attr),
- t;
-
- // if descending order, swap left and right
- if (order === 1) t = l, l = r, r = t;
-
- // compare as usual
- if (l === r) return 0;
- else if (l < r) return -1;
- return 1;
- }
- }
- },
- operation: {
- label: "Operation",
- cell: "String",
- editable: false,
- formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
- fromRaw: function(rawValue, model) {
- if (rawValue === "PURGE" && model.attributes.params) {
- var purgeLength = model.attributes.result.replace('[', '').replace(']', '').split(',').length;
- return purgeLength === 1 ? purgeLength + " entity purged." : purgeLength + " entities purged.";
- } else {
- return "No entity purged.";
- }
-
- }
- })
- },
- clientId: {
- label: "Client ID",
- cell: "String",
- editable: false
- },
- startTime: {
- label: "Start Time",
- cell: "html",
- editable: false,
- formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
- fromRaw: function(rawValue, model) {
- return new Date(rawValue);
- }
- })
- },
- endTime: {
- label: "End Time",
- cell: "html",
- editable: false,
- formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
- fromRaw: function(rawValue, model) {
- return new Date(rawValue);
- }
- })
- }
- }, this.entityCollection);
-
- },
- onClickPurgeType: function(e, value) {
- this.onlyPurge = e.currentTarget.value === "Purge" ? true : false;
- this.getPurgeParam();
- },
- onClickPurgeEntity: function(e) {
- var that = this;
- require([
- 'modules/Modal', 'views/audit/AuditTableLayoutView', 'views/audit/CreateAuditTableLayoutView',
- ], function(Modal, AuditTableLayoutView, CreateAuditTableLayoutView) {
- var obj = {
- guid: $(e.target).text(),
- },
- modal = new Modal({
- title: "Purged Entity Details : " + obj.guid,
- content: new AuditTableLayoutView(obj),
- mainClass: "modal-full-screen",
- okCloses: true,
- showFooter: false,
- }).open();
-
- modal.on('closeModal', function() {
- $('.modal').css({ 'padding-right': '0px !important' });
- modal.trigger('cancel');
- });
- modal.$el.on('click', 'td a', function() {
- modal.trigger('cancel');
- });
- });
- },
- onClickNextAuditData: function() {
- var that = this;
- this.ui.previousAuditData.removeAttr("disabled");
- $.extend(this.entityCollection.queryParams, {
- startKey: function() {
- return that.next;
- }
- });
- this.fetchCollection({
- next: this.ui.nextAuditData,
- nextClick: true,
- previous: this.ui.previousAuditData
- });
- },
- onClickPreviousAuditData: function() {
- var that = this;
- this.ui.nextAuditData.removeAttr("disabled");
- $.extend(this.entityCollection.queryParams, {
- startKey: function() {
- return that.pervOld.pop();
- }
- });
- this.fetchCollection({
- next: this.ui.nextAuditData,
- previousClick: true,
- previous: this.ui.previousAuditData
- });
- },
- });
- return PurgeAuditTableLayoutView;
-});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/audit/AdminAuditTableLayoutView.js b/dashboardv3/public/js/views/audit/AdminAuditTableLayoutView.js
new file mode 100644
index 0000000..6b4cfb7
--- /dev/null
+++ b/dashboardv3/public/js/views/audit/AdminAuditTableLayoutView.js
@@ -0,0 +1,369 @@
+/**
+ * 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/audit/AdminAuditTableLayoutView_tmpl',
+ 'collection/VEntityList',
+ 'utils/Utils',
+ 'utils/UrlLinks',
+ 'utils/CommonViewFunction'
+], function(require, Backbone, AdminAuditTableLayoutView_tmpl, VEntityList, Utils, UrlLinks, CommonViewFunction) {
+ 'use strict';
+
+ var AdminAuditTableLayoutView = Backbone.Marionette.LayoutView.extend(
+ /** @lends AuditTableLayoutView */
+ {
+ _viewName: 'AdminAuditTableLayoutView',
+
+ template: AdminAuditTableLayoutView_tmpl,
+
+ /** Layout sub regions */
+ regions: {
+ RAuditTableLayoutView: "#r_adminAuditTableLayoutView",
+ RQueryBuilderAdmin: "#r_attributeQueryBuilderAdmin"
+ },
+
+ /** ui selector cache */
+ ui: {
+ adminEntityClick: "[data-id='adminEntity']",
+ adminType: "[data-id='adminType']",
+ attrFilter: "[data-id='adminAttrFilter']",
+ adminRegion: "[data-id='adminRegion']",
+ attrApply: "[data-id='attrApply']",
+ showDefault: "[data-id='showDefault']",
+ attrClose: "[data-id='attrClose']"
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {},
+ that = this;
+ events["click " + this.ui.adminEntityClick] = "onClickAdminEntity";
+ events["change " + this.ui.adminType] = "onClickAdminType";
+ events["click " + this.ui.attrFilter] = function(e) {
+ this.$('.fa-angle-right').toggleClass('fa-angle-down');
+ this.$('.attributeResultContainer').addClass("overlay");
+ this.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
+ this.onClickAttrFilter();
+ };
+ events["click " + this.ui.attrClose] = function(e) {
+ that.closeAttributeModel();
+ };
+ events["click " + this.ui.attrApply] = function(e) {
+ that.okAttrFilterButton(e);
+ };
+ return events;
+ },
+ /**
+ * intialize a new AdminTableLayoutView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ _.extend(this, _.pick(options, 'searchTableFilters'));
+ this.entityCollection = new VEntityList();
+ this.limit = 25;
+ this.entityCollection.url = UrlLinks.adminApiUrl();
+ this.entityCollection.modelAttrName = "events";
+ this.onlyAdmin = true;
+ this.commonTableOptions = {
+ collection: this.entityCollection,
+ includeFilter: false,
+ includePagination: true,
+ includeFooterRecords: true,
+ includePageSize: true,
+ includeAtlasTableSorting: true,
+ includeTableLoader: true,
+ includeColumnManager: false,
+ gridOpts: {
+ className: "table table-hover backgrid table-quickMenu",
+ emptyText: 'No records found!'
+ },
+ columnOpts: {
+ opts: {
+ initialColumnsVisible: null,
+ saveState: false
+ },
+ visibilityControlOpts: {
+ buttonTemplate: _.template("<button class='btn btn-action btn-sm pull-right'>Columns <i class='fa fa-caret-down'></i></button>")
+ },
+ el: this.ui.colManager
+ },
+ filterOpts: {},
+ paginatorOpts: {}
+ };
+ this.isFilters = null;
+ this.adminAttrFilters = [{
+ "id": "startTime",
+ "label": "startTime (date)",
+ "operators": [
+ "=",
+ "!=",
+ ">",
+ "<",
+ ">=",
+ "<="
+ ],
+ "plugin": "daterangepicker",
+ "plugin_config": {
+ "locale": {
+ "format": "MM/DD/YYYY h:mm A"
+ },
+ "showDropdowns": true,
+ "singleDatePicker": true,
+ "timePicker": true
+ },
+ "type": "date"
+ }, {
+ "id": "endTime",
+ "label": "endTime (date)",
+ "operators": [
+ "=",
+ "!=",
+ ">",
+ "<",
+ ">=",
+ "<="
+ ],
+ "plugin": "daterangepicker",
+ "plugin_config": {
+ "locale": {
+ "format": "MM/DD/YYYY h:mm A"
+ },
+ "showDropdowns": true,
+ "singleDatePicker": true,
+ "timePicker": true
+ },
+ "type": "date"
+ }]
+ },
+ onRender: function() {
+ var str = '<option>All</option><option>Admin</option>';
+ this.ui.adminType.html(str);
+ this.ui.adminType.select2({});
+ this.ui.adminRegion.hide();
+ this.getAdminCollection();
+ this.entityCollection.comparator = function(model) {
+ return -model.get('timestamp');
+ }
+ },
+ bindEvents: function() {},
+ closeAttributeModel: function() {
+ var that = this;
+ that.$('.attributeResultContainer').removeClass("overlay");
+ that.$('.fa-angle-right').toggleClass('fa-angle-down');
+ that.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
+ },
+ getAttributes: function() {
+ var adminAttributes = [{
+ "attributeName": "userName",
+ "operator": "like",
+ "attributeValue": "admin"
+ }];
+ if (!this.onlyAdmin) {
+ adminAttributes.push({
+ "attributeName": "operation",
+ "operator": "like",
+ "attributeValue": "PURGE"
+ })
+ }
+ if (this.isFilters) {
+ _.each(this.isFilters, function(adminFilter) {
+ adminAttributes.push({
+ "attributeName": adminFilter.id,
+ "operator": adminFilter.operator,
+ "attributeValue": Date.parse(adminFilter.value).toString(),
+ })
+ })
+ this.isFilters = null;
+ }
+ return adminAttributes;
+ },
+ onClickAttrFilter: function() {
+ var that = this;
+ this.ui.adminRegion.show();
+ require(['views/search/QueryBuilderView'], function(QueryBuilderView) {
+ that.RQueryBuilderAdmin.show(new QueryBuilderView({ adminAttrFilters: that.adminAttrFilters, searchTableFilters: that.searchTableFilters }));
+ });
+ },
+ okAttrFilterButton: function(options) {
+ var that = this,
+ isFilterValidate = true,
+ queryBuilderRef = that.RQueryBuilderAdmin.currentView.ui.builder;
+ if (queryBuilderRef.data("queryBuilder")) {
+ var queryBuilder = queryBuilderRef.queryBuilder("getRules");
+ if (queryBuilder) {
+ that.isFilters = queryBuilder.rules;
+ that.searchTableFilters["adminAttrFilters"] = CommonViewFunction.attributeFilter.generateUrl({ value: queryBuilder, formatedDateToLong: true });
+ } else {
+ isFilterValidate = false
+ }
+ }
+ if (isFilterValidate) {
+ that.closeAttributeModel();
+ that.getAdminCollection();
+ }
+ },
+ getAdminCollection: function() {
+ var that = this,
+ adminParam = {
+ condition: "AND",
+ criterion: that.getAttributes()
+ };
+ this.$('.fontLoader').show();
+ this.$('.tableOverlay').show();
+ $.extend(that.entityCollection.queryParams, { limit: this.limit, offset: 0, auditFilters: adminParam });
+ var apiObj = {
+ sort: false,
+ data: that.entityCollection.queryParams,
+ success: function(dataOrCollection, response) {
+ that.entityCollection.fullCollection.reset(dataOrCollection);
+ that.renderTableLayoutView();
+ that.$('.fontLoader').hide();
+ that.$('.tableOverlay').hide();
+ that.$('.auditTable').show();
+ },
+ silent: true,
+ reset: true
+ }
+ this.entityCollection.getAdminData(apiObj);
+ },
+ renderTableLayoutView: function() {
+ var that = this;
+ this.ui.showDefault.hide();
+ require(['utils/TableLayout'], function(TableLayout) {
+ var cols = new Backgrid.Columns(that.getAuditTableColumns());
+ that.RAuditTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
+ columns: cols
+ })));
+ });
+ },
+ getAuditTableColumns: function() {
+ var that = this;
+ return this.entityCollection.constructor.getTableCols({
+ result: {
+ label: "",
+ cell: "html",
+ editable: false,
+ sortable: false,
+ cell: Backgrid.ExpandableCell,
+ fixWidth: "20",
+ accordion: false,
+ alwaysVisible: true,
+ expand: function(el, model) {
+ var adminValues = '<div class="col-sm-6">',
+ newColumn = '';
+ el.attr('colspan', '6');
+ if (model.attributes.params) {
+ var guids = model.attributes.result.replace('[', '').replace(']', '').split(',');
+ _.each(guids, function(adminGuid, index) {
+ if (index % 5 == 0 && index != 0) {
+ adminValues += '</div><div class="col-sm-6">';
+ }
+ adminValues += '<a class="blue-link" data-id="adminEntity" >' + adminGuid.trim() + '</a></br>';
+ })
+ adminValues += '</div>';
+
+ } else {
+ adminValues = '';
+ }
+ var adminText = '<div class="row"><div class="col-sm-12 attr-details admin-attr-details"><div class="col-sm-2">Admin Entities: </div><div class="col-sm-10">' + adminValues + '</div></div></div>';
+ $(el).append($('<div>').html(adminText));
+
+ }
+ },
+ userName: {
+ label: "Users",
+ cell: "html",
+ editable: false
+ },
+ operation: {
+ label: "Operation",
+ cell: "String",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ if (rawValue === "PURGE" && model.attributes.params) {
+ var adminLength = model.attributes.result.replace('[', '').replace(']', '').split(',').length;
+ return adminLength === 1 ? adminLength + " entity purged." : adminLength + " entities purged.";
+ } else {
+ return "No entity purged.";
+ }
+
+ }
+ })
+ },
+ clientId: {
+ label: "Client ID",
+ cell: "String",
+ editable: false
+ },
+ startTime: {
+ label: "Start Time",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return new Date(rawValue);
+ }
+ })
+ },
+ endTime: {
+ label: "End Time",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return new Date(rawValue);
+ }
+ })
+ }
+ }, this.entityCollection);
+
+ },
+ onClickAdminType: function(e, value) {
+ this.onlyAdmin = e.currentTarget.value === "Admin" ? false : true;
+ this.getAdminCollection();
+ },
+ onClickAdminEntity: function(e) {
+ var that = this;
+ require([
+ 'modules/Modal', 'views/audit/AuditTableLayoutView', 'views/audit/CreateAuditTableLayoutView',
+ ], function(Modal, AuditTableLayoutView, CreateAuditTableLayoutView) {
+ var obj = {
+ guid: $(e.target).text(),
+ },
+ modal = new Modal({
+ title: "Admin Entity Details : " + obj.guid,
+ content: new AuditTableLayoutView(obj),
+ mainClass: "modal-full-screen",
+ okCloses: true,
+ showFooter: false,
+ }).open();
+
+ modal.on('closeModal', function() {
+ $('.modal').css({ 'padding-right': '0px !important' });
+ modal.trigger('cancel');
+ });
+ modal.$el.on('click', 'td a', function() {
+ modal.trigger('cancel');
+ });
+ });
+ }
+ });
+ return AdminAuditTableLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js b/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
index 89f5337..f7db536 100644
--- a/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
+++ b/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
@@ -39,6 +39,7 @@ define(['require',
ui: {
auditValue: "[data-id='auditValue']",
name: "[data-id='name']",
+ nameContainer: "[data-id='nameContainer']",
noData: "[data-id='noData']",
tableAudit: "[data-id='tableAudit']",
auditHeaderValue: "[data-id='auditHeaderValue']",
@@ -156,8 +157,8 @@ define(['require',
that.noDetailsShow();
}
- } else if (detailObj == "Deleted entity") {
- that.updateName(this.entityName ? this.entityName : "Entity");
+ } else if (detailObj == "Deleted entity" || detailObj == "Purged entity") {
+ this.entityName ? that.updateName(this.entityName) : this.ui.nameContainer.empty().append("<h4 class='text-center'><i>No Records Found!</i></h4>");
}
}
});
diff --git a/dashboardv3/public/js/views/search/QueryBuilderView.js b/dashboardv3/public/js/views/search/QueryBuilderView.js
index a96f39c..fc16d6c 100644
--- a/dashboardv3/public/js/views/search/QueryBuilderView.js
+++ b/dashboardv3/public/js/views/search/QueryBuilderView.js
@@ -54,9 +54,8 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'attrObj', 'value', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'tag', 'type', 'searchTableFilters', 'systemAttrArr'));
+ _.extend(this, _.pick(options, 'attrObj', 'value', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'businessMetadataDefCollection', 'tag', 'type', 'searchTableFilters', 'systemAttrArr', 'adminAttrFilters'));
this.attrObj = _.sortBy(this.attrObj, 'name');
- //this.systemAttrArr = _.sortBy(this.systemAttrArr, 'name');
this.filterType = this.tag ? 'tagFilters' : 'entityFilters';
},
bindEvents: function() {},
@@ -312,70 +311,82 @@ define(['require',
onRender: function() {
var that = this,
filters = [],
- isGroupView = false,
+ isGroupView = true,
placeHolder = '--Select Attribute--';
- if (this.attrObj.length > 0 && this.systemAttrArr.length > 0) {
- isGroupView = true;
- } else if (this.attrObj.length === 0 || this.systemAttrArr.length === 0) {
- isGroupView = false;
- }
- if (this.attrObj.length === 0) {
- placeHolder = '--Select System Attribute--';
- }
- if (this.value) {
- var rules_widgets = CommonViewFunction.attributeFilter.extractUrl({ "value": this.searchTableFilters[this.filterType][(this.tag ? this.value.tag : this.value.type)], "formatDate": true });
- }
- _.each(this.attrObj, function(obj) {
- var type = that.tag ? 'Classification' : 'Entity';
- var returnObj = that.getObjDef(obj, rules_widgets, isGroupView, 'Select ' + type + ' Attribute');
- if (returnObj) {
- filters.push(returnObj);
- }
- });
- var sortMap = {
- "__guid": 1,
- "__typeName": 2,
- "__timestamp": 3,
- "__modificationTimestamp": 4,
- "__createdBy": 5,
- "__modifiedBy": 6,
- "__isIncomplete": 7,
- "__state": 8,
- "__classificationNames": 9,
- "__propagatedClassificationNames": 10,
- "__labels": 11,
- "__customAttributes": 12,
- }
- this.systemAttrArr = _.sortBy(this.systemAttrArr, function(obj) {
- return sortMap[obj.name]
- })
- _.each(this.systemAttrArr, function(obj) {
- var returnObj = that.getObjDef(obj, rules_widgets, isGroupView, 'Select System Attribute', true);
- if (returnObj) {
- filters.push(returnObj);
+ var rules_widgets = null;
+ if (this.adminAttrFilters) {
+ filters = this.adminAttrFilters;
+ rules_widgets = CommonViewFunction.attributeFilter.extractUrl({ "value": this.searchTableFilters ? this.searchTableFilters["adminAttrFilters"] : null, "formatDate": true });;
+ } else {
+ if (this.value) {
+ var rules_widgets = CommonViewFunction.attributeFilter.extractUrl({ "value": this.searchTableFilters[this.filterType][(this.tag ? this.value.tag : this.value.type)], "formatDate": true });
}
- });
- if (this.type) {
- var entityDef = this.entityDefCollection.fullCollection.find({ name: that.options.applicableType }),
- businessMetadataAttributeDefs = null;
- if (entityDef) {
- BusinessMetadataAttributeDefs = entityDef.get("businessAttributeDefs");
+ _.each(this.attrObj, function(obj) {
+ var type = that.tag ? that.value.tag : that.value.type;
+ var returnObj = that.getObjDef(obj, rules_widgets, isGroupView, (type + ' Attribute'));
+ if (returnObj) {
+ filters.push(returnObj);
+ }
+ });
+ var sortMap = {
+ "__guid": 1,
+ "__typeName": 2,
+ "__timestamp": 3,
+ "__modificationTimestamp": 4,
+ "__createdBy": 5,
+ "__modifiedBy": 6,
+ "__isIncomplete": 7,
+ "__state": 8,
+ "__classificationNames": 9,
+ "__propagatedClassificationNames": 10,
+ "__labels": 11,
+ "__customAttributes": 12,
}
- if (BusinessMetadataAttributeDefs) {
- _.each(BusinessMetadataAttributeDefs, function(attributes, key) {
- var sortedAttributes = _.sortBy(attributes, function(obj) {
- return obj.name;
- });
+ this.systemAttrArr = _.sortBy(this.systemAttrArr, function(obj) {
+ return sortMap[obj.name]
+ })
+ _.each(this.systemAttrArr, function(obj) {
+ var returnObj = that.getObjDef(obj, rules_widgets, isGroupView, 'System Attribute', true);
+ if (returnObj) {
+ filters.push(returnObj);
+ }
+ });
+ if (this.type) {
+ var pushBusinessMetadataFilter = function(sortedAttributes, businessMetadataKey) {
_.each(sortedAttributes, function(attrDetails) {
- var returnObj = that.getObjDef(attrDetails, rules_widgets, isGroupView, 'Select Business Metadata Attribute', true);
+ var returnObj = that.getObjDef(attrDetails, rules_widgets, isGroupView, 'Business Metadata Attribute', true);
if (returnObj) {
- returnObj.id = key + "." + returnObj.id;
- returnObj.label = key + ": " + returnObj.label;
+ returnObj.id = businessMetadataKey + "." + returnObj.id;
+ returnObj.label = businessMetadataKey + ": " + returnObj.label;
returnObj.data = { 'entityType': "businessMetadata" };
filters.push(returnObj);
}
});
- });
+ };
+ if (this.value.type == "_ALL_ENTITY_TYPES") {
+ this.businessMetadataDefCollection.each(function(model) {
+ var sortedAttributes = model.get('attributeDefs');
+ sortedAttributes = _.sortBy(sortedAttributes, function(obj) {
+ return obj.name;
+ });
+ pushBusinessMetadataFilter(sortedAttributes, model.get('name'));
+ })
+
+ } else {
+ var entityDef = this.entityDefCollection.fullCollection.find({ name: this.value.type }),
+ businessMetadataAttributeDefs = null;
+ if (entityDef) {
+ businessMetadataAttributeDefs = entityDef.get("businessAttributeDefs");
+ }
+ if (businessMetadataAttributeDefs) {
+ _.each(businessMetadataAttributeDefs, function(attributes, key) {
+ var sortedAttributes = _.sortBy(attributes, function(obj) {
+ return obj.name;
+ });
+ pushBusinessMetadataFilter(sortedAttributes, key);
+ });
+ }
+ }
}
}
filters = _.uniq(filters, 'id');
[atlas] 01/03: ATLAS-3662 : UI: Business Metadata validation
improvements
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit fcb5eda7101acb931ce53259945bd6636938eb88
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Thu Mar 12 21:41:25 2020 +0530
ATLAS-3662 : UI: Business Metadata validation improvements
Signed-off-by: nixonrodrigues <ni...@apache.org>
(cherry picked from commit 506ffc97ca641f86da4e90b821061162f15c0fef)
---
.../js/views/search/SearchResultLayoutView.js | 5 +-
dashboardv3/public/css/scss/common.scss | 9 +
.../BusinessMetadataAttributeItemView_tmpl.html | 6 +-
.../CreateBusinessMetadataLayoutView_tmpl.html | 2 +-
.../BusinessMetadataAttrTableLayoutView.js | 1 -
.../BusinessMetadataAttributeItemView.js | 67 ++--
.../BusinessMetadataContainerLayoutView.js | 28 +-
.../BusinessMetadataDetailLayoutView.js | 12 +-
.../BusinessMetadataTableLayoutView.js | 38 +--
.../CreateBusinessMetadataLayoutView.js | 363 ++++++---------------
.../business_metadata/EnumCreateUpdateItemView.js | 14 +-
.../js/views/search/SearchResultLayoutView.js | 11 +-
12 files changed, 180 insertions(+), 376 deletions(-)
diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
index 1d8b4ed..62c7ecd 100644
--- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js
@@ -157,6 +157,7 @@ define(['require',
this.multiSelectEntity = [];
this.searchType = 'Basic Search';
this.columnOrder = null;
+ this.defaultColumns = ["selected", "name", "description", "typeName", "owner", "tag", "term"];
if (this.value) {
if (this.value.searchType && this.value.searchType == 'dsl') {
this.searchType = 'Advanced Search';
@@ -221,7 +222,7 @@ define(['require',
this.updateColumnList(state);
var excludeDefaultColumn = [];
if (this.value && this.value.type) {
- excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "term");
+ excludeDefaultColumn = _.difference(this.searchTableColumns[this.value.type], this.defaultColumns);
if (this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show();
} else {
@@ -371,7 +372,7 @@ define(['require',
}
if (isPostMethod && isSearchTab) {
- var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag") : null,
+ var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.difference(this.searchTableColumns[this.value.type], this.defaultColumns) : null,
filterObj = {
'entityFilters': entityFilters,
'tagFilters': tagFilters,
diff --git a/dashboardv3/public/css/scss/common.scss b/dashboardv3/public/css/scss/common.scss
index a30057c..14ee1ce 100644
--- a/dashboardv3/public/css/scss/common.scss
+++ b/dashboardv3/public/css/scss/common.scss
@@ -276,4 +276,13 @@ pre {
margin-bottom: 5px;
margin-left: 5px;
float: left;
+}
+
+.errorValidate {
+ border-color: red !important;
+}
+
+.errorValidate+span .select2-selection {
+ border-color: red !important;
+
}
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html b/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
index 2c3f57c..862a6b4 100644
--- a/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
+++ b/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
@@ -23,7 +23,7 @@
<div class="form-group">
<label class="control-label col-sm-3 required" for="name">Name</label>
<div class="col-sm-8">
- <input class="form-control attributeInput" data-id="attributeInput" placeholder="Attribute name">
+ <input class="form-control attributeInput require" data-id="attributeInput" placeholder="Attribute name">
</input>
</div>
</div>
@@ -54,7 +54,7 @@
<div class="">
<label class="control-label col-sm-3 required" for="enumType">Enum Name</label>
<div class="col-sm-5">
- <select class="form-control enumTypeSelector" data-id="enumTypeSelector" multiple="false">
+ <select class="form-control enumTypeSelector require" data-id="enumTypeSelector" multiple="false">
</select>
</div>
<div class="col-sm-3">
@@ -75,7 +75,7 @@
<div class="stringlength-container">
<label class="control-label col-sm-3 required" for="name">Max length</label>
<div class="col-sm-8">
- <input type="number" class="form-control stringLengthVal" data-id="stringLength" placeholder="Maximum length">
+ <input type="number" class="form-control stringLengthVal require" data-id="stringLength" placeholder="Maximum length">
</div>
</div>
</div>
diff --git a/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html b/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
index b84c1f1..a78614d 100644
--- a/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
@@ -23,7 +23,7 @@
<label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label>
{{#if create}}
<div class="col-sm-10">
- <input class="form-control businessMetadata-name" data-id="name" placeholder="Name(required)" autofocus />
+ <input class="form-control businessMetadata-name require" data-id="name" placeholder="Name(required)" autofocus />
</div>
{{else}}
<span class="ellipsis-with-margin control-label text-left col-sm-10" data-id="title"></span> {{/if}}
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttrTableLayoutView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttrTableLayoutView.js
index 173d76f..1cdcef5 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttrTableLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttrTableLayoutView.js
@@ -72,7 +72,6 @@ define(['require',
filterOpts: {},
paginatorOpts: {}
};
- this.isFilters = null;
this.showDetails = true;
},
onRender: function() {
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttributeItemView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttributeItemView.js
index 7bc1016..d55b9f9 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttributeItemView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataAttributeItemView.js
@@ -17,12 +17,8 @@
*/
define(['require',
'backbone',
- 'hbs!tmpl/business_metadata/BusinessMetadataAttributeItemView_tmpl',
- 'utils/Utils',
- 'utils/UrlLinks',
- 'utils/Messages'
-
-], function(require, Backbone, BusinessMetadataAttributeItemViewTmpl, Utils, UrlLinks, Messages) {
+ 'hbs!tmpl/business_metadata/BusinessMetadataAttributeItemView_tmpl'
+], function(require, Backbone, BusinessMetadataAttributeItemViewTmpl) {
'use strict';
return Backbone.Marionette.ItemView.extend(
@@ -63,27 +59,35 @@ define(['require',
};
events["change " + this.ui.dataTypeSelector] = function(e) {
var obj = { options: this.model.get('options') || {} };
- debugger;
delete obj.enumValues;
delete obj.options.maxStrLength;
if (e.target.value.trim() === 'enumeration' || e.target.value.trim() === 'Enumeration') {
this.ui.enumTypeSelectorContainer.show();
+ this.ui.enumTypeSelector.show();
this.emumTypeSelectDisplay();
this.ui.stringLengthContainer.hide();
+ this.ui.stringLengthValue.hide();
} else {
obj.typeName = e.target.value.trim();
if (e.target.value.trim() === 'string' || e.target.value.trim() === 'String') {
this.ui.stringLengthContainer.show();
+ this.ui.stringLengthValue.show();
this.ui.enumTypeSelectorContainer.hide();
+ this.ui.enumTypeSelector.hide();
this.ui.enumValueSelectorContainer.hide();
obj.options["maxStrLength"] = e.target.value.trim();
} else {
this.ui.enumTypeSelectorContainer.hide();
+ this.ui.enumTypeSelector.hide();
this.ui.enumValueSelectorContainer.hide();
this.ui.stringLengthContainer.hide();
+ this.ui.stringLengthValue.hide();
}
}
this.model.set(obj);
+ if (e.target.value.trim() != 'enumeration') {
+ this.ui.multiValueSelectStatus.trigger('change');
+ }
};
events["change " + this.ui.enumTypeSelector] = function(e) {
this.model.set({ "enumValues": e.target.value.trim() });
@@ -138,15 +142,14 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- this.parentView = options.parentView;
- this.viewId = options.model ? options.model.cid : this.parentView.cid;
+ _.extend(this, _.pick(options, "typeHeaders", "businessMetadataDefCollection", "enumDefCollection", "isAttrEdit", "attrDetails", "viewId", "collection"));
+ this.viewId = options.model ? options.model.cid : this.viewId;
},
onRender: function() {
var that = this,
entitytypes = '',
enumTypes = [];
- //this.model.set({ "modalID": this.viewId });
- this.parentView.typeHeaders.fullCollection.each(function(model) {
+ this.typeHeaders.fullCollection.each(function(model) {
if (model.toJSON().category == "ENTITY") {
that.ui.entityTypeSelector.append("<option>" + model.get('name') + "</option>");
entitytypes += '<option value="' + (model.get('name')) + '" data-name="' + (model.get('name')) + '">' + model.get('name') + '</option>';
@@ -167,24 +170,26 @@ define(['require',
this.ui.enumValueSelector.attr("disabled", "false"); // cannot edit the values
this.emumTypeSelectDisplay();
this.ui.enumTypeSelectorContainer.hide();
+ this.ui.enumTypeSelector.hide();
this.ui.enumValueSelectorContainer.hide();
- if (this.parentView.isAttrEdit) {
+ if (this.isAttrEdit) {
this.ui.close.hide();
this.ui.createNewEnum.hide(); // cannot add new businessMetadata on edit view
- this.ui.attributeInput.val(this.parentView.attrDetails.name);
+ this.ui.attributeInput.val(this.attrDetails.name);
this.ui.attributeInput.attr("disabled", "false");
this.ui.dataTypeSelector.attr("disabled", "false");
this.ui.dataTypeSelector.attr("disabled", "false");
this.ui.multiValueSelect.hide();
- this.ui.dataTypeSelector.val(this.parentView.attrDetails.attrTypeName);
- if (this.parentView.attrDetails.attrTypeName == "string") {
+ this.ui.dataTypeSelector.val(this.attrDetails.attrTypeName);
+ if (this.attrDetails.attrTypeName == "string") {
this.ui.stringLengthContainer.show();
- this.ui.stringLengthValue.val(this.parentView.attrDetails.maxStrLength);
+ this.ui.stringLengthValue.show();
+ this.ui.stringLengthValue.val(this.attrDetails.maxStrLength);
} else {
this.ui.stringLengthContainer.hide();
+ this.ui.stringLengthValue.hide();
}
-
- _.each(this.parentView.attrDetails.attrEntityType, function(valName) {
+ _.each(this.attrDetails.attrEntityType, function(valName) {
that.ui.entityTypeSelector.find('option').each(function(o) {
var $el = $(this)
if ($el.data("name") === valName) {
@@ -192,16 +197,16 @@ define(['require',
}
})
});
- this.ui.entityTypeSelector.val(this.parentView.attrDetails.attrEntityType).trigger('change');
- if (this.parentView.attrDetails && this.parentView.attrDetails.attrTypeName) {
- var typeName = this.parentView.attrDetails.attrTypeName;
+ this.ui.entityTypeSelector.val(this.attrDetails.attrEntityType).trigger('change');
+ if (this.attrDetails && this.attrDetails.attrTypeName) {
+ var typeName = this.attrDetails.attrTypeName;
if (typeName != "string" && typeName != "boolean" && typeName != "byte" && typeName != "short" && typeName != "int" && typeName != "float" && typeName != "double" && typeName != "long" && typeName != "date") {
this.ui.enumTypeSelector.attr("disabled", "false");
this.ui.dataTypeSelector.val("enumeration").trigger('change');
this.ui.enumTypeSelector.val(typeName).trigger('change');
}
}
- if (this.parentView.attrDetails && this.parentView.attrDetails.multiValued) {
+ if (this.attrDetails && this.attrDetails.multiValued) {
this.ui.multiValueSelect.show();
$(this.ui.multiValueSelectStatus).prop('checked', true).trigger('change');
this.ui.multiValueSelectStatus.attr("disabled", "false");
@@ -211,7 +216,7 @@ define(['require',
showEnumValues: function(enumName) {
var enumValues = '',
selectedValues = [],
- selectedEnum = this.parentView.enumDefCollection.fullCollection.findWhere({ name: enumName }),
+ selectedEnum = this.enumDefCollection.fullCollection.findWhere({ name: enumName }),
selectedEnumValues = selectedEnum ? selectedEnum.get('elementDefs') : null,
savedValues = [];
_.each(selectedEnumValues, function(enumVal, index) {
@@ -231,7 +236,7 @@ define(['require',
},
emumTypeSelectDisplay: function() {
var enumTypes = '';
- this.parentView.enumDefCollection.fullCollection.each(function(model, index) {
+ this.enumDefCollection.fullCollection.each(function(model, index) {
enumTypes += "<option>" + _.escape(model.get('name')) + "</option>";
});
this.ui.enumTypeSelector.empty();
@@ -255,14 +260,14 @@ define(['require',
},
closeModal: function() {
modal.trigger("cancel");
- that.parentView.enumDefCollection.fetch({
+ that.enumDefCollection.fetch({
success: function() {
that.ui.enumTypeSelector.val(that.model.get('typeName')).trigger('change');
}
});
},
- enumDefCollection: that.parentView.enumDefCollection,
- businessMetadataDefCollection: that.parentView.options.businessMetadataDefCollection
+ enumDefCollection: that.enumDefCollection,
+ businessMetadataDefCollection: that.businessMetadataDefCollection
}),
modal = new Modal({
title: "Create/ Update Enum",
@@ -279,12 +284,12 @@ define(['require',
});
},
onCloseButton: function() {
- var tagName = this.parentView.$el.find('[data-id="tagName"]').val();
- if (this.parentView.collection.models.length > 0) {
+ var tagName = this.$el.find('[data-id="tagName"]').val();
+ if (this.collection.models.length > 0) {
this.model.destroy();
}
- if (this.parentView.collection.models.length == 0 && tagName != "") {
- this.parentView.$el.parent().next().find('button.ok').removeAttr("disabled");
+ if (this.collection.models.length == 0 && tagName != "") {
+ this.$el.parent().next().find('button.ok').removeAttr("disabled");
}
}
});
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataContainerLayoutView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataContainerLayoutView.js
index a1c80da..6ae97f9 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataContainerLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataContainerLayoutView.js
@@ -47,33 +47,7 @@ define([
initialize: function(options) {
_.extend(this, options);
},
- bindEvents: function() {
- // this.listenTo(this.businessMetadataDefCollection, 'reset', function() {
- // if (!this.model) {
- // this.model = this.businessMetadataDefCollection.fullCollection.findWhere({ guid: this.guid });
- // if (this.model) {
- // this.renderTagDetail();
- // } else {
- // this.$('.fontLoader').hide();
- // Utils.notifyError({
- // content: 'Tag Not Found'
- // });
- // }
- // }
- // }, this);
- // this.listenTo(this.collection, 'error', function(error, response) {
- // if (response.responseJSON && response.responseJSON.error) {
- // Utils.notifyError({
- // content: response.responseJSON.error
- // });
- // } else {
- // Utils.notifyError({
- // content: 'Something went wrong'
- // });
- // }
- // this.$('.fontLoader').hide();
- // }, this);
- },
+ bindEvents: function() {},
onRender: function() {
this.updateView();
},
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
index 36e613f..90d9d6d 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
@@ -32,10 +32,7 @@ define(['require',
/** ui selector cache */
ui: {
title: '[data-id="title"]',
- editBox: '[data-id="editBox"]',
- saveButton: "[data-id='saveButton']",
description: '[data-id="description"]',
- publishButton: '[data-id="publishButton"]',
backButton: '[data-id="backButton"]'
},
/** ui events hash */
@@ -51,16 +48,15 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'guid', 'model', 'enumDefCollection', 'typeHeaders'));
+ _.extend(this, _.pick(options, 'model'));
},
onRender: function() {
this.renderDetail();
},
renderDetail: function() {
- var that = this;
- this.ui.title.html('<span>' + that.model.get('name') + '</span>');
- if (that.model.get('description')) {
- this.ui.description.text((that.model.get('description')));
+ this.ui.title.html('<span>' + this.model.get('name') + '</span>');
+ if (this.model.get('description')) {
+ this.ui.description.text((this.model.get('description')));
}
}
});
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
index 1afa205..0c76cb6 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
@@ -19,14 +19,9 @@
define(['require',
'backbone',
'hbs!tmpl/business_metadata/BusinessMetadataTableLayoutView_tmpl',
- 'collection/VEntityList',
- 'models/VSearch',
'utils/Utils',
- 'utils/Messages',
- 'utils/Enums',
- 'utils/UrlLinks',
- 'utils/CommonViewFunction'
-], function(require, Backbone, BusinessMetadataTableLayoutView_tmpl, VEntityList, VSearch, Utils, Messages, Enums, UrlLinks, CommonViewFunction) {
+ 'utils/Messages'
+], function(require, Backbone, BusinessMetadataTableLayoutView_tmpl, Utils, Messages) {
'use strict';
var BusinessMetadataTableLayoutView = Backbone.Marionette.LayoutView.extend(
@@ -47,18 +42,12 @@ define(['require',
businessMetadataAttrPage: "[data-id='businessMetadataAttrPage']",
businessMetadataAttrPageTitle: "[data-id='businessMetadataAttrPageTitle']",
businessMetadataDetailPage: "[data-id='businessMetadataDetailPage']",
- auditCreate: "[data-id='auditCreate']",
- pageRecordText: "[data-id='pageRecordText']",
- activePage: "[data-id='activePage']",
createBusinessMetadata: "[data-id='createBusinessMetadata']",
attributeEdit: "[data-id='attributeEdit']",
addAttribute: '[data-id="addAttribute"]',
businessMetadataAttrPageOk: '[data-id="businessMetadataAttrPageOk"]',
colManager: "[data-id='colManager']",
- deleteBusinessMetadata: '[data-id="deleteBusinessMetadata"]',
- businessMetadataAttrFontLoader: '.business-metadata-attr-fontLoader',
- businessMetadataAttrTableOverlay: '.businessMetadata-attr-tableOverlay'
-
+ deleteBusinessMetadata: '[data-id="deleteBusinessMetadata"]'
},
/** ui events hash */
events: function() {
@@ -80,9 +69,6 @@ define(['require',
initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'businessMetadataDefCollection', 'entityDefCollection', 'businessMetadataAttr', 'selectedBusinessMetadata'));
this.limit = 10;
- this.offset = 0;
- this.pervOld = [];
- this.onlyPurge = true;
this.newAttr = false;
this.commonTableOptions = {
collection: this.businessMetadataDefCollection,
@@ -111,8 +97,6 @@ define(['require',
filterOpts: {},
paginatorOpts: {}
};
- this.currPage = 1;
- this.isFilters = null;
this.guid = null;
this.showDetails = true; // toggle between sttribute page and detail page
},
@@ -225,11 +209,10 @@ define(['require',
that.toggleBusinessMetadataDetailsAttrView();
that.entityDefCollection.fetch({ silent: true });
},
- tagCollection: that.businessMetadataDefCollection,
+ businessMetadataDefCollection: that.businessMetadataDefCollection,
enumDefCollection: enumDefCollection,
typeHeaders: typeHeaders,
- isNewBusinessMetadata: isNewBusinessMetadata,
- businessMetadataDefCollection: businessMetadataDefCollection
+ isNewBusinessMetadata: isNewBusinessMetadata
});
that.RModal.show(that.view);
});
@@ -272,7 +255,6 @@ define(['require',
var applicableEntityTypes = '',
typeName = attrObj.typeName;
if (attrObj.options && attrObj.options.applicableEntityTypes) {
- // attrEntityTypes = JSON.parse(attrObj.options.applicableEntityTypes).join(', ');
var entityTypes = JSON.parse(attrObj.options.applicableEntityTypes);
_.each(entityTypes, function(values) {
applicableEntityTypes += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + values + '</label>';
@@ -283,11 +265,11 @@ define(['require',
}
attrRow += "<tr> <td style='display:table-cell'>" + _.escape(attrObj.name) + "</td><td style='display:table-cell'>" + typeName + "</td><td style='display:table-cell'>" + applicableEntityTypes + "</td><td style='display:table-cell'> <div class='btn btn-action btn-sm' style='margin-left:0px;' data-id='attributeEdit' data-guid='" + model.get('guid') + "' data-name ='" + _.escape(attrObj.name) + "' data-action='attributeEdit' >Edit</div> </td></tr> ";
});
- var purgeText = '<div class="row"><div class="col-sm-12 attr-details"><table style="padding: 50px;">' + attrTableHeading + attrRow + '</table></div></div>';
- $(el).append($('<div>').html(purgeText));
+ var adminText = '<div class="row"><div class="col-sm-12 attr-details"><table style="padding: 50px;">' + attrTableHeading + attrRow + '</table></div></div>';
+ $(el).append($('<div>').html(adminText));
} else {
- var purgeText = '<div class="row"><div class="col-sm-12 attr-details"><h5 class="text-center"> No attributes to show.</h5></div></div>';
- $(el).append($('<div>').html(purgeText));
+ var adminText = '<div class="row"><div class="col-sm-12 attr-details"><h5 class="text-center"> No attributes to show.</h5></div></div>';
+ $(el).append($('<div>').html(adminText));
}
}
@@ -364,7 +346,6 @@ define(['require',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
return "<button type='button' data-id='addAttribute' data-guid='" + model.get('guid') + "'' title='' class='btn btn-action btn-xs ' style='margin-bottom: 10px;' data-action='createAttr' data-original-title='Add Business Metadata attribute'><i class='fa fa-plus'></i> Attributes</button>";
- // "<button type='button' data-id='deleteBusinessMetadata' data-guid='" + model.get('guid') + "'' title='' class='btn btn-action btn-xs ' style='margin-bottom: 10px;' data-action='createAttr' data-original-title='Delete BusinessMetadata'><i class='fa fa-trash-o'></i> Delete</button>";
}
})
}
@@ -386,7 +367,6 @@ define(['require',
onNotifyDeleteOk: function(data) {
var that = this,
deleteBusinessMetadataData = that.businessMetadataDefCollection.fullCollection.findWhere({ guid: that.guid });
- // that.$('.position-relative .fontLoader').addClass('show');
that.$('.tableOverlay').show();
if (deleteBusinessMetadataData) {
var businessMetadataName = deleteBusinessMetadataData.get("name");
diff --git a/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js b/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
index 6d18425..76c9fdf 100644
--- a/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
@@ -22,11 +22,8 @@ define(['require',
'utils/Utils',
'utils/Messages',
'views/business_metadata/BusinessMetadataAttributeItemView',
- 'collection/VTagList',
- 'models/VEntity',
- 'utils/UrlLinks',
- 'platform'
-], function(require, Backbone, CreateBusinessMetadataLayoutViewTmpl, Utils, Messages, BusinessMetadataAttributeItemView, VTagList, VEntity, UrlLinks, platform) {
+ 'models/VEntity'
+], function(require, Backbone, CreateBusinessMetadataLayoutViewTmpl, Utils, Messages, BusinessMetadataAttributeItemView, VEntity) {
var CreateBusinessMetadataLayoutView = Backbone.Marionette.CompositeView.extend(
/** @lends CreateBusinessMetadataLayoutView */
@@ -53,8 +50,13 @@ define(['require',
childViewOptions: function() {
return {
- // saveButton: this.ui.saveButton,
- parentView: this
+ typeHeaders: this.typeHeaders,
+ businessMetadataDefCollection: this.businessMetadataDefCollection,
+ enumDefCollection: this.enumDefCollection,
+ isAttrEdit: this.isAttrEdit,
+ attrDetails: this.attrDetails,
+ viewId: this.cid,
+ collection: this.collection
};
},
/** ui selector cache */
@@ -76,18 +78,9 @@ define(['require',
var that = this,
modal = that.$el;
if (e.target.dataset.action == "attributeEdit" || e.target.dataset.action == "addAttribute") {
- // var selectedBusinessMetadata = that.businessMetadataDefCollection.fullCollection.findWhere({ guid: that.guid });
that.onUpdateAttr();
} else {
- if (that.$el.find('.form-control.businessMetadata-name')[0].value === "") {
- $(that.$el.find('.form-control.businessMetadata-name')[0]).css("borderColor", "red");
- Utils.notifyInfo({
- content: "Business Metadata name is empty."
- });
-
- } else {
- that.onCreateBusinessMetadata();
- }
+ that.onCreateBusinessMetadata();
}
};
@@ -101,7 +94,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
- _.extend(this, _.pick(options, 'businessMetadataDefCollection', 'enumDefCollection', 'model', 'descriptionData', 'isNewBusinessMetadata', 'isAttrEdit', 'entityDefCollection', 'typeHeaders', 'attrDetails'));
+ _.extend(this, _.pick(options, 'businessMetadataDefCollection', 'selectedBusinessMetadata', 'enumDefCollection', 'model', 'isNewBusinessMetadata', 'isAttrEdit', 'typeHeaders', 'attrDetails'));
this.fromTable = this.isNewBusinessMetadata ? true : false;
this.isEditAttr = this.isAttrEdit ? false : true;
this.businessMetadataModel = new VEntity();
@@ -183,128 +176,56 @@ define(['require',
parent.$('.business-metadata-attr-fontLoader').hide();
}
},
- validateValues: function() {
- var attrNameValidate = true,
- enumValue = true,
- stringValidate = true,
- enumType = true;
- if (this.$el.find(".attributeInput").length > 0) {
- this.$el.find(".attributeInput").each(function() {
- if ($(this).val() === "") {
- $(this).css("borderColor", "red");
- attrNameValidate = false;
- }
+ validateValues: function(attributeDefs) {
+ var isValidate = true,
+ isAttrDuplicate = true,
+ validationFileds = this.$el.find('.require'),
+ attrNames = [];
+ if (attributeDefs && !this.isAttrEdit) {
+ attrNames = _.map(attributeDefs, function(model) {
+ return model.name.toLowerCase();
});
}
- if (this.$el.find(".enumvalue-container").length > 0 && this.$el.find(".enumvalue-container")[0].style.display != 'none') {
- this.$el.find(".enumvalue-container").each(function(index) {
- if (this.style.display != 'none') {
- if ($(this).find(".enumValueSelector").length > 0) {
- $(this).find(".enumValueSelector").each(function(index) {
- if ($(this).val().length === 0) {
- $(this).css("borderColor", "red");
- enumValue = false;
- }
- });
- }
+ validationFileds.each(function(elements) {
+ $(this).removeClass('errorValidate');
+ if (validationFileds[elements].value == '' || validationFileds[elements].value == null) {
+ if (validationFileds[elements].style.display != 'none') {
+ $(validationFileds[elements]).addClass('errorValidate');
+ $(this).addClass('errorValidate');
+ if (isValidate) { isValidate = false; }
}
- })
- }
- if (this.$el.find(".enumtype-container").length > 0 && this.$el.find(".enumtype-container")[0].style.display != 'none') {
- this.$el.find(".enumtype-container").each(function(index) {
- if (this.style.display != 'none') {
- if ($(this).find(".enumTypeSelector").length > 0) {
- $(this).find(".enumTypeSelector").each(function(index) {
- if ($(this).val() == null || $(this).val() == '' || $(this).val().length === 0) {
- $(this).css("borderColor", "red");
- enumType = false;
- }
- });
+ }
+ });
+ if (isValidate) {
+ this.$el.find('.attributeInput').each(function(element) {
+ var attrValue = this.value.toLowerCase();
+ if (attrNames.indexOf(attrValue) > -1) {
+ Utils.notifyInfo({
+ content: "Attribute name already exist"
+ });
+ $(this).addClass('errorValidate');
+ if (isAttrDuplicate) { isAttrDuplicate = false; }
+ } else {
+ if (attrValue.length) {
+ attrNames.push(attrValue);
}
}
- })
- }
- if (this.$el.find(".stringlength-container").length > 0 && this.$el.find(".stringlength-container")[0].style.display != 'none') {
- this.$el.find(".stringlength-container").each(function(index) {
- if (this.style.display != 'none') {
- if ($(this).find(".stringLengthVal").length > 0) {
- $(this).find(".stringLengthVal").each(function(index) {
- if ($(this).val().length === 0) {
- $(this).css("borderColor", "red");
- stringValidate = false;
- }
- });
- }
- };
- })
- }
-
- this.$el.find(".attributeInput").keyup(function() {
- $(this).css("borderColor", "#e8e9ee");
- });
- if (!attrNameValidate) {
- Utils.notifyInfo({
- content: "Please fill the attributes details"
});
- return true;
}
- if (!enumType) {
- Utils.notifyInfo({
- content: "Please enter the Enumeration Name or select another type"
- });
- return true;
- }
- if (!enumValue) {
+
+ if (!isValidate) {
Utils.notifyInfo({
- content: "Please enter the Enum values or select another type"
+ content: "Please fill the details"
});
return true;
}
- if (!stringValidate) {
- Utils.notifyInfo({
- content: "Please enter the Max Length for string or select another type"
- });
+ if (!isAttrDuplicate) {
return true;
}
- },
- businessMetadataAttributes: function(modelEl, attrObj) {
- var obj = {
- options: {
- "applicableEntityTypes": JSON.stringify(modelEl.find(".entityTypeSelector").val()),
- "maxStrLength": modelEl.find(".stringLengthVal").val() ? modelEl.find(".stringLengthVal").val() : "0"
- }
- };
- // var types = ["string","boolean"];
- // if (attrObj.typeName != "string" && attrObj.typeName != "boolean" && attrObj.typeName != "byte" && attrObj.typeName != "short" && attrObj.typeName != "int" && attrObj.typeName != "float" && attrObj.typeName != "double" && attrObj.typeName != "long" && attrObj.typeName != "date") {
- // var enumName = enumDefCollection.fullCollection.findWhere({ name: attrObj.typeName });
- // if (enumName) {
- // return
- // }
- // }
- if (obj.multiValueSelect) {
- obj.multiValued = true;
- obj.typeName = "array<" + obj.typeName + ">";
- }
- return obj;
- },
- highlightAttrinuteName: function(modelEl, obj) {
- Utils.notifyInfo({
- content: "Attribute " + obj.name + " already exist"
- });
- modelEl.find(".attributeInput").css("borderColor", "red");
- this.loaderStatus(false);
- },
- createEnumObject: function(arrayObj, obj, enumVal) {
- return arrayObj.push({
- "name": obj.typeName,
- "elementDefs": enumVal
- });
+
},
onCreateBusinessMetadata: function() {
- var that = this,
- attrNames = [],
- isvalidName = true;
-
+ var that = this;
if (this.validateValues()) {
return;
};
@@ -315,163 +236,87 @@ define(['require',
if (this.collection.length === 1 && this.collection.first().get("name") === "") {
attributeObj = [];
}
- if (attributeObj.length) {
- // _.each(attributeObj, function(obj) {
- // var modelEl = this.$('#' + obj.modalID);
- // modelEl.find(".attributeInput").css("borderColor", "transparent");;
- // if (attrNames.indexOf(obj.name) > -1) {
- // that.highlightAttrinuteName(modelEl, obj);
- // isvalidName = false;
- // return true;
- // } else {
- // attrNames.push(obj.name);
- // }
- // obj = that.businessMetadataAttributes(modelEl, obj);
- // // if (that.isPostCallEnum) {
- // // that.createEnumObject(enumDefs, obj, elementValues);
- // // }
- // // if (that.isPutCall) {
- // // that.createEnumObject(putEnumDef, obj, elementValues);
- // // }
- // });
- var notifyObj = {
- modal: true,
- confirm: {
- confirm: true,
- buttons: [{
- text: "Ok",
- addClass: "btn-atlas btn-md",
- click: function(notice) {
- notice.remove();
- }
- },
- null
- ]
+ this.json = {
+ "enumDefs": [],
+ "structDefs": [],
+ "classificationDefs": [],
+ "entityDefs": [],
+ "businessMetadataDefs": [{
+ "category": "BUSINESS_METADATA",
+ "createdBy": "admin",
+ "updatedBy": "admin",
+ "version": 1,
+ "typeVersion": "1.1",
+ "name": name.trim(),
+ "description": description.trim(),
+ "attributeDefs": attributeObj
+ }]
+ };
+ var apiObj = {
+ sort: false,
+ data: this.json,
+ success: function(model, response) {
+ var nameSpaveDef = model.businessMetadataDefs;
+ if (nameSpaveDef) {
+ that.businessMetadataDefCollection.fullCollection.add(nameSpaveDef);
+ Utils.notifySuccess({
+ content: "Business Metadata " + name + Messages.getAbbreviationMsg(false, 'addSuccessMessage')
+ });
}
- };
+ that.options.onUpdateBusinessMetadata();
+ },
+ silent: true,
+ reset: true,
+ complete: function(model, status) {
+ that.loaderStatus(false);
+ }
}
- if (isvalidName) {
+ apiObj.type = "POST";
+ that.businessMetadataModel.saveBusinessMetadata(apiObj);
+ },
+ onUpdateAttr: function() {
+ var that = this,
+ selectedBusinessMetadataClone = $.extend(true, {}, that.selectedBusinessMetadata.toJSON()),
+ attributeDefs = selectedBusinessMetadataClone['attributeDefs'],
+ isvalidName = true;
+ if (this.validateValues(attributeDefs)) {
+ return;
+ };
+ if (this.collection.length > 0) {
+ this.loaderStatus(true);
+ if (selectedBusinessMetadataClone.attributeDefs === undefined) {
+ selectedBusinessMetadataClone.attributeDefs = [];
+ }
+ selectedBusinessMetadataClone.attributeDefs = selectedBusinessMetadataClone.attributeDefs.concat(this.collection.toJSON());
this.json = {
"enumDefs": [],
"structDefs": [],
"classificationDefs": [],
"entityDefs": [],
- "businessMetadataDefs": [{
- "category": "BUSINESS_METADATA",
- "createdBy": "admin",
- "updatedBy": "admin",
- "version": 1,
- "typeVersion": "1.1",
- "name": name.trim(),
- "description": description.trim(),
- "attributeDefs": attributeObj
- }]
+ "businessMetadataDefs": [selectedBusinessMetadataClone]
};
var apiObj = {
sort: false,
data: this.json,
success: function(model, response) {
- var nameSpaveDef = model.businessMetadataDefs;
- if (nameSpaveDef) {
- that.options.businessMetadataDefCollection.fullCollection.add(nameSpaveDef);
- Utils.notifySuccess({
- content: "Business Metadata " + name + Messages.getAbbreviationMsg(false, 'addSuccessMessage')
- });
+ Utils.notifySuccess({
+ content: "One or more Business Metadada attribute" + Messages.getAbbreviationMsg(false, 'editSuccessMessage')
+ });
+ if (model.businessMetadataDefs && model.businessMetadataDefs.length) {
+ that.selectedBusinessMetadata.set(model.businessMetadataDefs[0]);
}
+ that.options.onEditCallback();
that.options.onUpdateBusinessMetadata();
},
silent: true,
reset: true,
complete: function(model, status) {
- attrNames = [];
that.loaderStatus(false);
}
}
- apiObj.type = "POST";
+ apiObj.type = "PUT";
that.businessMetadataModel.saveBusinessMetadata(apiObj);
} else {
- attrNames = [];
- }
- },
- onUpdateAttr: function() {
- var that = this,
- selectedBusinessMetadata = $.extend(true, {}, that.options.selectedBusinessMetadata.toJSON()),
- attributeDefs = selectedBusinessMetadata['attributeDefs'],
- isvalidName = true;
- if (this.validateValues()) {
- return;
- };
- if (this.collection.length > 0) {
- this.loaderStatus(true);
- if (selectedBusinessMetadata.attributeDefs === undefined) {
- selectedBusinessMetadata.attributeDefs = [];
- }
- selectedBusinessMetadata.attributeDefs = selectedBusinessMetadata.attributeDefs.concat(this.collection.toJSON());
- // this.collection.each(function(model) {
- // var obj = model.toJSON(),
- // modelEl = this.$('#' + obj.modalID);
- // modelEl.find(".attributeInput").css("borderColor", "transparent");
- // // if (that.options.isNewAttr == true && _.find(attributeDefs, { name: obj.name })) {
- // // that.highlightAttrinuteName(modelEl, obj);
- // // isvalidName = false;
- // // return true;
- // // }
- // obj = that.businessMetadataAttributes(modelEl, obj);
- // // if (that.isPostCallEnum) {
- // // that.createEnumObject(postEnumDef, obj, elementValues);
- // // } else if (that.isPutCall) {
- // // that.createEnumObject(enumDefs, obj, elementValues);
- // // }
-
- // // if (that.options.isNewAttr == true) {
- // // selectedBusinessMetadata.attributeDefs.push(obj);
- // // } else {
- // // var attrDef = selectedBusinessMetadata.attributeDefs;
- // // _.each(attrDef, function(attrObj) {
- // // if (attrObj.name === that.$el.find(".attributeInput")[0].value) {
- // // attrObj.name = obj.name;
- // // attrObj.typeName = obj.typeName;
- // // attrObj.multiValued = obj.multiValueSelect || false;
- // // attrObj.options.applicableEntityTypes = obj.options.applicableEntityTypes;
- // // attrObj.enumValues = obj.enumValues;
- // // attrObj.options.maxStrLength = obj.options.maxStrLength;
- // // }
- // // });
- // // }
- // });
- if (isvalidName) {
- this.json = {
- "enumDefs": [],
- "structDefs": [],
- "classificationDefs": [],
- "entityDefs": [],
- "businessMetadataDefs": [selectedBusinessMetadata]
- };
- var apiObj = {
- sort: false,
- data: this.json,
- success: function(model, response) {
- var selectedBusinessMetadata = that.options.businessMetadataDefCollection.fullCollection.findWhere({ guid: that.options.guid });
- Utils.notifySuccess({
- content: "One or more Business Metadada attribute" + Messages.getAbbreviationMsg(false, 'editSuccessMessage')
- });
- if (model.businessMetadataDefs && model.businessMetadataDefs.length) {
- that.options.selectedBusinessMetadata.set(model.businessMetadataDefs[0]);
- }
- that.options.onEditCallback();
- that.options.onUpdateBusinessMetadata();
- },
- silent: true,
- reset: true,
- complete: function(model, status) {
- that.loaderStatus(false);
- }
- }
- apiObj.type = "PUT";
- that.businessMetadataModel.saveBusinessMetadata(apiObj);
- }
-
- } else {
Utils.notifySuccess({
content: "No attribute updated"
});
diff --git a/dashboardv3/public/js/views/business_metadata/EnumCreateUpdateItemView.js b/dashboardv3/public/js/views/business_metadata/EnumCreateUpdateItemView.js
index e0f647f..867a56d 100644
--- a/dashboardv3/public/js/views/business_metadata/EnumCreateUpdateItemView.js
+++ b/dashboardv3/public/js/views/business_metadata/EnumCreateUpdateItemView.js
@@ -15,13 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemView_tmpl", "utils/Utils", "utils/UrlLinks", "utils/Messages"], function(
+define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemView_tmpl", "utils/Utils", "utils/UrlLinks"], function(
require,
Backbone,
EnumCreateUpdateItemViewTmpl,
Utils,
- UrlLinks,
- Messages
+ UrlLinks
) {
"use strict";
@@ -81,13 +80,9 @@ define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemV
* @constructs
*/
initialize: function(options) {
- this.enumDefCollection = options.enumDefCollection;
- this.businessMetadataDefCollection = options.businessMetadataDefCollection;
+ _.extend(this, _.pick(options, "businessMetadataDefCollection", "enumDefCollection"));
},
onRender: function() {
- var that = this,
- entitytypes = "",
- enumTypes = [];
this.ui.enumValueSelectorContainer.hide();
this.bindEvents();
this.emumTypeSelectDisplay();
@@ -107,8 +102,7 @@ define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemV
var enumValues = "",
selectedValues = [],
selectedEnum = this.enumDefCollection.fullCollection.findWhere({ name: enumName }),
- selectedEnumValues = selectedEnum ? selectedEnum.get("elementDefs") : null,
- savedValues = [];
+ selectedEnumValues = selectedEnum ? selectedEnum.get("elementDefs") : null;
_.each(selectedEnumValues, function(enumVal, index) {
selectedValues.push(_.unescape(enumVal.value));
enumValues += "<option>" + enumVal.value + "</option>";
diff --git a/dashboardv3/public/js/views/search/SearchResultLayoutView.js b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
index 3741bc0..afd3ab8 100644
--- a/dashboardv3/public/js/views/search/SearchResultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchResultLayoutView.js
@@ -163,6 +163,7 @@ define(['require',
this.multiSelectEntity = [];
this.searchType = 'Basic Search';
this.columnOrder = null;
+ this.defaultColumns = ["selected", "name", "description", "typeName", "owner", "tag", "term"];
if (this.value) {
if (this.value.searchType && this.value.searchType == 'dsl') {
this.searchType = 'Advanced Search';
@@ -227,7 +228,7 @@ define(['require',
this.updateColumnList(state);
var excludeDefaultColumn = [];
if (this.value && this.value.type) {
- excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "term");
+ excludeDefaultColumn = _.difference(this.searchTableColumns[this.value.type], this.defaultColumns);
if (this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show();
} else {
@@ -380,7 +381,7 @@ define(['require',
}
if (isPostMethod && isSearchTab) {
- var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag") : null,
+ var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.difference(this.searchTableColumns[this.value.type], this.defaultColumns) : null,
filterObj = {
'entityFilters': entityFilters,
'tagFilters': tagFilters,
@@ -793,14 +794,14 @@ define(['require',
}
})
};
- col['businessMetaData'] = {
- label: "Business MetaData",
+ col['businessMetadata'] = {
+ label: "Business Metadata",
cell: "Html",
editable: false,
resizeable: true,
orderable: true,
alwaysVisible: true, //Backgrid.ColumnManager.js -> render() to hide the name in dropdownlist
- renderable: _.contains(columnToShow, 'businessMetaData'),
+ renderable: _.contains(columnToShow, 'businessMetadata'),
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var obj = model.toJSON(),
[atlas] 03/03: ATLAS-3598 : Beta UI: Issues with single click
functionality in left hand panel.
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nixon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 453094cbd68a45ea45f332237486348927a20f9e
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Thu Mar 12 21:50:36 2020 +0530
ATLAS-3598 : Beta UI: Issues with single click functionality in left hand panel.
Signed-off-by: nixonrodrigues <ni...@apache.org>
(cherry picked from commit 1ccb7c715cb0ff0f60f27d21c77a810e6640e01c)
---
.../js/views/search/SearchDefaultLayoutView.js | 6 +--
.../search/tree/ClassificationTreeLayoutView.js | 46 ++++++++++++----------
.../js/views/search/tree/EntityTreeLayoutView.js | 38 ++++++++++--------
3 files changed, 49 insertions(+), 41 deletions(-)
diff --git a/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js b/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js
index 3c0d813..d0946c4 100644
--- a/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchDefaultLayoutView.js
@@ -214,7 +214,8 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
renderGlobalSearch: function() {
var that = this;
require(["views/search/GlobalSearchLayoutView"], function(GlobalSearchLayoutView) {
- that.RGlobalSearchLayoutView.show(new GlobalSearchLayoutView(_.extend({ closeOnSubmit: true }, that.options)));
+
+ that.RGlobalSearchLayoutView.show(new GlobalSearchLayoutView(_.extend({ closeOnSubmit: true }, _.omit(that.options, "value"))));
});
},
renderSearchResult: function() {
@@ -303,8 +304,7 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
this.renderQueryBuilder(_.extend({}, obj, {
tag: false,
type: true,
- attrObj: attrTypeObj,
- applicableType: that.options.value ? that.options.value.type : null
+ attrObj: attrTypeObj
}), this.RQueryBuilderEntity);
this.ui.entityName.html(that.options.value.type);
diff --git a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
index dd8161e..87f0b9a 100644
--- a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
@@ -258,28 +258,32 @@ define([
this.ui.classificationSearchTree.jstree(true).deselect_all();
this.tagId = null;
} else {
- if ((that.options.value.tag.indexOf('*') != -1)) {
- that.ui.classificationSearchTree.jstree(true).deselect_all();
- that.ui.wildCardValue.val(that.options.value.tag);
- }
- var dataFound = this.classificationDefCollection.fullCollection.find(function(obj) {
- return obj.get("name") === that.options.value.tag
- });
- if (dataFound) {
- if ((this.tagId && this.tagId !== dataFound.get("guid")) || this.tagId === null) {
- if (this.tagId) {
- this.ui.classificationSearchTree.jstree(true).deselect_node(this.tagId);
+ if (that.options.value.tag === "_ALL_CLASSIFICATION_TYPES" && this.tagId !== "_ALL_CLASSIFICATION_TYPES") {
+ this.fromManualRender = true;
+ if (this.tagId) {
+ this.ui.classificationSearchTree.jstree(true).deselect_node(this.tagId);
+ }
+ this.tagId = Globals[that.options.value.tag].guid;
+ this.ui.classificationSearchTree.jstree(true).select_node(this.tagId);
+ } else if (this.tagId !== "_ALL_CLASSIFICATION_TYPES" && that.options.value.tag !== this.tagId) {
+ if ((that.options.value.tag.indexOf('*') != -1)) {
+ that.ui.classificationSearchTree.jstree(true).deselect_all();
+ that.ui.wildCardValue.val(that.options.value.tag);
+ }
+ var dataFound = this.classificationDefCollection.fullCollection.find(function(obj) {
+ return obj.get("name") === that.options.value.tag
+ });
+ if (dataFound) {
+ if ((this.tagId && this.tagId !== dataFound.get("guid")) || this.tagId === null) {
+ if (this.tagId) {
+ this.ui.classificationSearchTree.jstree(true).deselect_node(this.tagId);
+ }
+ this.fromManualRender = true;
+ this.tagId = dataFound.get("guid");
+ this.ui.classificationSearchTree.jstree(true).select_node(dataFound.get("guid"));
}
- this.fromManualRender = true;
- this.tagId = dataFound.get("guid");
- this.ui.classificationSearchTree.jstree(true).select_node(dataFound.get("guid"));
}
}
- if (!dataFound && Globals[that.options.value.tag]) {
- this.fromManualRender = true;
- this.typeId = Globals[that.options.value.tag].guid;
- this.ui.classificationSearchTree.jstree(true).select_node(this.typeId);
- }
}
},
onNodeSelect: function(options) {
@@ -516,8 +520,8 @@ define([
name: rootClassification.name,
type: rootClassification.category,
gType: "Classification",
- guid: "root-classification",
- id: "root-classification",
+ guid: rootClassification.guid,
+ id: rootClassification.guid,
model: rootClassification,
children: [],
icon: "fa fa-tag",
diff --git a/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
index 6df64ad..5b96e8f 100644
--- a/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
@@ -171,23 +171,27 @@ define([
this.ui.entitySearchTree.jstree(true).deselect_all();
this.typeId = null;
} else {
- var dataFound = this.typeHeaders.fullCollection.find(function(obj) {
- return obj.get("name") === that.options.value.type
- });
- if (dataFound) {
- if ((this.typeId && this.typeId !== dataFound.get("guid")) || this.typeId === null) {
- if (this.typeId) {
- this.ui.entitySearchTree.jstree(true).deselect_node(this.typeId);
- }
- this.fromManualRender = true;
- this.typeId = dataFound.get("guid");
- this.ui.entitySearchTree.jstree(true).select_node(dataFound.get("guid"));
- }
- }
- if (!dataFound && Globals[that.options.value.type]) {
+ if (that.options.value.type === "_ALL_ENTITY_TYPES" && this.typeId !== "_ALL_ENTITY_TYPES") {
this.fromManualRender = true;
+ if (this.typeId) {
+ this.ui.entitySearchTree.jstree(true).deselect_node(this.typeId);
+ }
this.typeId = Globals[that.options.value.type].guid;
this.ui.entitySearchTree.jstree(true).select_node(this.typeId);
+ } else if (this.typeId !== "_ALL_ENTITY_TYPES" && that.options.value.type !== this.typeId) {
+ var dataFound = this.typeHeaders.fullCollection.find(function(obj) {
+ return obj.get("name") === that.options.value.type
+ });
+ if (dataFound) {
+ if ((this.typeId && this.typeId !== dataFound.get("guid")) || this.typeId === null) {
+ if (this.typeId) {
+ this.ui.entitySearchTree.jstree(true).deselect_node(this.typeId);
+ }
+ this.fromManualRender = true;
+ this.typeId = dataFound.get("guid");
+ this.ui.entitySearchTree.jstree(true).select_node(dataFound.get("guid"));
+ }
+ }
}
}
},
@@ -301,7 +305,7 @@ define([
text: _.escape(modelname),
name: model.get("name"),
type: model.get("category"),
- gType: "serviceType",
+ gType: "Entity",
guid: model.get("guid"),
id: model.get("guid"),
model: model,
@@ -336,7 +340,7 @@ define([
text: _.escape(rootEntity.name),
name: rootEntity.name,
type: rootEntity.category,
- gType: "serviceType",
+ gType: "Entity",
guid: rootEntity.guid,
id: rootEntity.guid,
model: rootEntity,
@@ -389,7 +393,7 @@ define([
parent = {
icon: "fa fa-folder-o",
type: type,
- gType: "serviceType",
+ gType: "ServiceType",
children: getParrent.children,
text: _.escape(textName),
name: data[parents[i]].name,