You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2020/02/21 06:25:27 UTC
[atlas] 01/03: ATLAS-3607 : UI: changes to create namespace type
definitions and define namespace attributes
This is an automated email from the ASF dual-hosted git repository.
kbhatt pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 72e7e73d2fbcbeddbb8228bb7a56c58366324679
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Mon Feb 3 21:13:52 2020 +0530
ATLAS-3607 : UI: changes to create namespace type definitions and define namespace attributes
(cherry picked from commit bcb9ea240614299280d8051b6b43a9927dcbb2de)
---
dashboardv3/public/css/scss/common.scss | 1 +
dashboardv3/public/css/scss/form.scss | 9 +
dashboardv3/public/css/scss/glossary.scss | 4 +
dashboardv3/public/css/scss/namespace.scss | 155 ++++++
dashboardv3/public/css/scss/override.scss | 42 ++
dashboardv3/public/css/scss/stats.scss | 7 +
dashboardv3/public/css/scss/style.scss | 1 +
dashboardv3/public/css/scss/table.scss | 55 +-
dashboardv3/public/css/scss/tag.scss | 4 +
dashboardv3/public/css/scss/theme.scss | 61 ++-
dashboardv3/public/js/main.js | 26 +-
dashboardv3/public/js/models/VEntity.js | 12 +
dashboardv3/public/js/router/Router.js | 187 +++----
.../AdministratorLayoutView_tmpl.html | 40 ++
.../PurgeAuditTableLayoutView_tmpl.html | 120 +++++
.../audit/CreateAuditTableLayoutView_tmpl.html | 14 +-
dashboardv3/public/js/templates/common/Modal.html | 2 +-
.../name_space/CreateNameSpaceLayoutView_tmpl.html | 53 ++
.../name_space/EnumCreateUpdateItemView_tmpl.html | 39 ++
.../NameSpaceAttrTableLayoutView_tmpl.html | 47 ++
.../NameSpaceAttributeItemView_tmpl.html | 89 ++++
.../NameSpaceContainerLayoutView_tmpl.html | 20 +
.../name_space/NameSpaceDetailLayoutView_tmpl.html | 29 +
.../name_space/NameSpaceTableLayoutView_tmpl.html | 47 ++
.../search/SearchFilterBrowseLayoutView_tmpl.html | 12 +-
.../search/tree/GlossaryTreeLayoutView_tmpl.html | 16 +-
.../search/tree/NameSpaceTreeLayoutView_tmpl.html | 45 ++
dashboardv3/public/js/templates/site/Header.html | 18 +-
dashboardv3/public/js/utils/Helper.js | 80 +++
dashboardv3/public/js/utils/Overrides.js | 90 ++++
dashboardv3/public/js/utils/UrlLinks.js | 22 +-
dashboardv3/public/js/utils/Utils.js | 6 +
.../views/administrator/AdministratorLayoutView.js | 105 ++++
.../administrator/PurgeAuditTableLayoutView.js | 518 ++++++++++++++++++
.../public/js/views/audit/AuditTableLayoutView.js | 40 +-
.../js/views/audit/CreateAuditTableLayoutView.js | 2 +-
.../views/name_space/CreateNameSpaceLayoutView.js | 591 +++++++++++++++++++++
.../views/name_space/EnumCreateUpdateItemView.js | 256 +++++++++
.../name_space/NameSpaceAttrTableLayoutView.js | 232 ++++++++
.../views/name_space/NameSpaceAttributeItemView.js | 266 ++++++++++
.../name_space/NameSpaceContainerLayoutView.js | 117 ++++
.../views/name_space/NameSpaceDetailLayoutView.js | 110 ++++
.../views/name_space/NameSpaceTableLayoutView.js | 419 +++++++++++++++
.../views/search/SearchFilterBrowseLayoutView.js | 19 +-
.../search/tree/CustomFilterTreeLayoutView.js | 14 +-
.../js/views/search/tree/EntityTreeLayoutView.js | 16 +-
.../js/views/search/tree/GlossaryTreeLayoutView.js | 15 +-
.../views/search/tree/NameSpaceTreeLayoutView.js | 384 +++++++++++++
48 files changed, 4238 insertions(+), 219 deletions(-)
diff --git a/dashboardv3/public/css/scss/common.scss b/dashboardv3/public/css/scss/common.scss
index 53eedcc..aa20b70 100644
--- a/dashboardv3/public/css/scss/common.scss
+++ b/dashboardv3/public/css/scss/common.scss
@@ -254,6 +254,7 @@ pre {
text-align: center;
width: 17%;
margin-left: 1%;
+ margin-bottom: 10px;
}
}
}
diff --git a/dashboardv3/public/css/scss/form.scss b/dashboardv3/public/css/scss/form.scss
index 729e5d7..38c9c45 100644
--- a/dashboardv3/public/css/scss/form.scss
+++ b/dashboardv3/public/css/scss/form.scss
@@ -30,6 +30,7 @@
@extend .control-label-sm;
padding-right: 10px;
}
+
}
.form-group {
@@ -245,6 +246,10 @@ button:focus {
padding: 2px 6px;
}
+ &.btn-xs {
+ padding: 0px 5px;
+ }
+
&.btn-md {
padding: 6px 10px;
}
@@ -305,6 +310,10 @@ button:focus {
padding: 2px 6px;
}
+ &.btn-xs {
+ padding: 0px 5px;
+ }
+
&.btn-md {
padding: 5px 10px;
}
diff --git a/dashboardv3/public/css/scss/glossary.scss b/dashboardv3/public/css/scss/glossary.scss
index bc1c596..9f044e9 100644
--- a/dashboardv3/public/css/scss/glossary.scss
+++ b/dashboardv3/public/css/scss/glossary.scss
@@ -36,6 +36,10 @@
background: $color_jungle_green_approx !important;
}
+ .jstree-custom-filter {
+ background: #beebff !important;
+ }
+
.jstree-hovered {
background: $color_star_dust_approx;
}
diff --git a/dashboardv3/public/css/scss/namespace.scss b/dashboardv3/public/css/scss/namespace.scss
new file mode 100644
index 0000000..c74c697
--- /dev/null
+++ b/dashboardv3/public/css/scss/namespace.scss
@@ -0,0 +1,155 @@
+// 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.
+
+
+/* namespace */
+.namespace-tree-parent {
+ padding: 0px;
+
+ >li:first-child {
+ font-weight: 600;
+ }
+
+ .namespace-tree-child {
+ padding-left: 20px;
+ margin-top: 10px;
+ }
+}
+
+.namespace-options.dropdown {
+ .dropdown-menu {
+ min-width: 100px;
+
+ .dropdown-item {
+ display: block;
+ width: 100%;
+ padding: .25rem 1.5rem;
+ clear: both;
+ font-weight: 400;
+ color: $color_jungle_green_approx;
+ text-align: inherit;
+ white-space: nowrap;
+ background-color: transparent;
+ border: 0;
+ }
+ }
+}
+
+.namespace-options.dropdown.open {
+ .btn-action {
+ background-color: $color_jungle_green_approx;
+ border: 1px solid $color_jungle_green_approx;
+ color: #fff !important;
+ }
+}
+
+.namespace-details {
+
+ .expandable .attr-details {
+ max-height: 300px;
+ overflow: auto;
+ margin-left: 100px;
+ width: calc(100% - 100px);
+ }
+}
+
+.tab-pane {
+ .namespace-attr-page {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ padding: 20px;
+ background-color: $white;
+ width: 100%;
+ height: inherit;
+ }
+}
+
+.namespace-attr-page {
+ .form-horizontal {
+ padding: 10px 22px;
+ // border: 1px solid #DEDEDE;
+
+ .control-label-sm {
+ padding-top: 3px;
+ }
+
+ .control-label-sm-pl {
+ @extend .control-label-sm;
+ padding-left: 10px;
+ }
+
+ .control-label-sm-pr {
+ @extend .control-label-sm;
+ padding-right: 10px;
+ }
+
+ .namespace-attr {
+ border: 1px solid #DEDEDE;
+ padding: 10px 20px
+ }
+ }
+}
+
+.namespace-attr-fontLoader {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ display: none;
+}
+
+.namespace-attr-tableOverlay {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ background: #808080;
+ z-index: 99;
+ display: none;
+ opacity: 0.2;
+}
+
+.name-space-details {
+ .backgrid {
+ td.expandable-content {
+ width: 100%;
+ max-width: none;
+ background: #f8f8f8;
+
+ div {
+
+ table {
+ width: 100%;
+ }
+ }
+ }
+
+ tbody>tr:last-child>td {
+ border-bottom: none;
+ }
+ }
+}
+
+.namespace-attr-page {
+ .modal-footer {
+ text-align: center;
+ }
+}
+
+.remove-from-list {
+ .select2-results__option[aria-selected=true] {
+ display: none;
+ }
+}
\ No newline at end of file
diff --git a/dashboardv3/public/css/scss/override.scss b/dashboardv3/public/css/scss/override.scss
index ab4d601..62c129f 100644
--- a/dashboardv3/public/css/scss/override.scss
+++ b/dashboardv3/public/css/scss/override.scss
@@ -76,6 +76,17 @@
}
}
+.modal-full-screen {
+ width: 80%;
+ height: 80vh;
+
+ .modal-content {
+ height: inherit;
+ width: 100%;
+ }
+
+}
+
.switch.pull-left {
margin-right: 8px;
}
@@ -238,6 +249,13 @@
overflow-x: hidden;
}
+.purge-details {
+ .tab-pane.active {
+ min-height: 400px;
+ }
+
+}
+
.advancedInfo {
margin-left: 5px;
cursor: pointer;
@@ -356,6 +374,10 @@ div.columnmanager-visibilitycontrol {
}
div.columnmanager-dropdown-container {
+ .columnmanager-dropdown-item {
+ padding: 2px 13px;
+ }
+
&.open {
overflow: auto;
width: auto;
@@ -452,4 +474,24 @@ div.columnmanager-dropdown-container {
.query-builder .error-container {
cursor: pointer;
+}
+
+.renderable {
+ .glyphicon {
+ color: $color_jungle_green_approx;
+ font-size: large;
+ font-weight: bold;
+ }
+}
+
+.backgrid-internal-table {
+
+ th,
+ td {
+ display: table-cell;
+ }
+}
+
+.table-hover>tbody>tr:hover {
+ background-color: #fafafa;
}
\ No newline at end of file
diff --git a/dashboardv3/public/css/scss/stats.scss b/dashboardv3/public/css/scss/stats.scss
index f089ede..896d5bb 100644
--- a/dashboardv3/public/css/scss/stats.scss
+++ b/dashboardv3/public/css/scss/stats.scss
@@ -62,6 +62,7 @@
.panel {
&.panel-default {
padding: 5px;
+ margin: 5px;
}
.panel-body {
@@ -81,6 +82,12 @@
.table {
&.stat-table {
+ width: 100%;
+
+ td {
+ display: table-cell;
+ }
+
&.notification-table {
&.table-striped>tbody>tr:nth-of-type(odd) {
background-color: $color_white_lilac_approx;
diff --git a/dashboardv3/public/css/scss/style.scss b/dashboardv3/public/css/scss/style.scss
index 48bafc9..fd84b25 100644
--- a/dashboardv3/public/css/scss/style.scss
+++ b/dashboardv3/public/css/scss/style.scss
@@ -34,6 +34,7 @@
@import "profile-table.scss";
@import "glossary.scss";
@import "wizard.scss";
+@import "namespace.scss";
@import "stats.scss";
@import "override.scss";
@import "leftsidebar.scss"
\ No newline at end of file
diff --git a/dashboardv3/public/css/scss/table.scss b/dashboardv3/public/css/scss/table.scss
index 73c998d..5f49be2 100644
--- a/dashboardv3/public/css/scss/table.scss
+++ b/dashboardv3/public/css/scss/table.scss
@@ -55,7 +55,7 @@ tr.empty {
.entity-detail-table-toggle {
position: absolute;
right: 0;
- top: 18px;
+ top: 7px;
}
table {
@@ -183,26 +183,36 @@ tr.empty {
}
}
- >thead>tr>th {
- border-width: thin;
- border-color: $color_jungle_green_approx;
- border-bottom-style: solid;
- box-shadow: none;
- padding: 12px 15px !important;
- background-color: transparent;
- text-align: left;
- font-weight: 800;
- border-top: 0;
- font-size: 14px;
- letter-spacing: 0.25px;
- color: rgba(52, 52, 52, 1);
+ >thead>tr {
+ background: #eeeeee;
+
+ &>th {
+ border-width: thin;
+ // border-color: $color_jungle_green_approx;
+ border-bottom-style: solid;
+ box-shadow: none;
+ padding: 6px 15px !important;
+ background-color: transparent;
+ text-align: left;
+ font-weight: 800;
+ border-top: 0;
+ font-size: 14px;
+ letter-spacing: 0.25px;
+ color: #6a6a6a;
+ }
+
+ >td {
+ border-color: $color_gallery_approx;
+ color: #333333;
+ font-weight: 100;
+ padding: 9px 15px;
+ }
}
>tbody>tr>td {
- border-color: $color_gallery_approx;
- color: #333333;
- font-weight: 100;
- padding: 9px 15px;
+ &.select-row-cell {
+ text-align: center;
+ }
}
}
@@ -240,4 +250,13 @@ td {
float: left;
}
}
+}
+
+.auditStatusContainer {
+ display: flex;
+ justify-content: center;
+}
+
+.auditStatusContainer>div {
+ flex-grow: 1;
}
\ No newline at end of file
diff --git a/dashboardv3/public/css/scss/tag.scss b/dashboardv3/public/css/scss/tag.scss
index 1d6fb00..5a023e6 100644
--- a/dashboardv3/public/css/scss/tag.scss
+++ b/dashboardv3/public/css/scss/tag.scss
@@ -205,4 +205,8 @@
.addtag-propagte-box {
border: 1px solid #ddd;
border-radius: 7px;
+}
+
+.entityTypeSelector {
+ margin: 10px 0px;
}
\ No newline at end of file
diff --git a/dashboardv3/public/css/scss/theme.scss b/dashboardv3/public/css/scss/theme.scss
index 7c10a0d..56e998c 100644
--- a/dashboardv3/public/css/scss/theme.scss
+++ b/dashboardv3/public/css/scss/theme.scss
@@ -158,6 +158,14 @@ header.atlas-header {
position: relative;
transition: width 0.3s !important;
+ .admin-icon {
+ background-color: $color_ironside_gray_approx;
+ width: 24px;
+ height: 20px;
+ -webkit-mask: url(../img/support.svg) no-repeat center;
+ mask: url(../img/support.svg) no-repeat center;
+ }
+
.search-box {
width: 50%;
margin: 0 auto;
@@ -172,7 +180,8 @@ header.atlas-header {
left: auto;
}
- &>li>a {
+ &>li>a,
+ {
color: $color_ironside_gray_approx;
&:hover {
@@ -188,19 +197,23 @@ header.atlas-header {
td {
>a {
display: inline-block;
- color: $color_ironside_gray_approx;
+ color: $color_ironside_gray_approx !important;
padding: 13px 14px;
border-bottom: 2px solid transparent;
}
>a,
>table {
- padding: 15px 14px;
+ padding: 14px 14px;
&:hover {
border-bottom: 2px solid $color_jungle_green_approx;
padding: 14px 14px;
- color: $color_jungle_green_approx;
+ color: $color_jungle_green_approx !important;
+
+ .admin-icon {
+ background-color: $color_jungle_green_approx;
+ }
a {
color: $color_jungle_green_approx;
@@ -776,4 +789,44 @@ td.searchTableName:hover {
z-index: 1;
left: calc(50% - 8px);
}
+}
+
+.dropdown-menu.multi-level {
+ .dropdown-submenu {
+ position: relative;
+
+ &>a:after {
+ display: none;
+ content: " ";
+ width: 0;
+ height: 0;
+ border-color: transparent;
+ border-style: solid;
+ border-width: 5px 5px 5px 0px;
+ border-right-color: #ccc;
+ position: absolute;
+ left: 8px;
+ top: calc(50% - 5px);
+ }
+
+ &>a:hover:after {
+ display: block;
+ }
+
+ &>.dropdown-menu {
+ top: 0;
+ left: -100%;
+ width: 100%;
+ margin-top: -6px;
+ margin-left: -1px;
+ -webkit-border-radius: 0 6px 6px 6px;
+ -moz-border-radius: 0 6px 6px;
+ border-radius: 0 6px 6px 6px;
+ }
+
+ &:hover>.dropdown-menu {
+ display: block;
+ }
+
+ }
}
\ No newline at end of file
diff --git a/dashboardv3/public/js/main.js b/dashboardv3/public/js/main.js
index 1001eb1..9bf190f 100644
--- a/dashboardv3/public/js/main.js
+++ b/dashboardv3/public/js/main.js
@@ -202,25 +202,35 @@ require(['App',
'select2'
], function(App, Router, Helper, CommonViewFunction, Globals, UrlLinks, VEntityList, VTagList, Enums) {
var that = this;
- this.asyncFetchCounter = 6 + (Enums.addOnEntities.length + 1);
+ this.asyncFetchCounter = 7 + (Enums.addOnEntities.length + 1);
+ // entity
this.entityDefCollection = new VEntityList();
this.entityDefCollection.url = UrlLinks.entitiesDefApiUrl();
+ // typeHeaders
this.typeHeaders = new VTagList();
this.typeHeaders.url = UrlLinks.typesApiUrl();
+ // enum
this.enumDefCollection = new VTagList();
this.enumDefCollection.url = UrlLinks.enumDefApiUrl();
this.enumDefCollection.modelAttrName = "enumDefs";
+ // classfication
this.classificationDefCollection = new VTagList();
+ // metric
this.metricCollection = new VTagList();
this.metricCollection.url = UrlLinks.metricsApiUrl();
this.metricCollection.modelAttrName = "data";
+ // nameSpace
+ this.nameSpaceCollection = new VEntityList();
+ this.nameSpaceCollection.url = UrlLinks.nameSpaceApiUrl();
+ this.nameSpaceCollection.modelAttrName = "namespaceDefs";
App.appRouter = new Router({
entityDefCollection: this.entityDefCollection,
typeHeaders: this.typeHeaders,
enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection,
- metricCollection: this.metricCollection
+ metricCollection: this.metricCollection,
+ nameSpaceCollection: this.nameSpaceCollection
});
var startApp = function() {
@@ -310,6 +320,18 @@ require(['App',
}
});
+ this.nameSpaceCollection.fetch({
+ skipDefaultError: true,
+ complete: function() {
+ that.nameSpaceCollection.fullCollection.comparator = function(model) {
+ return model.get('name').toLowerCase();
+ };
+ that.nameSpaceCollection.fullCollection.sort({ silent: true });
+ --that.asyncFetchCounter;
+ startApp();
+ }
+ });
+
Enums.addOnEntities.forEach(function(addOnEntity) {
CommonViewFunction.fetchRootEntityAttributes({
url: UrlLinks.rootEntityDefUrl(addOnEntity),
diff --git a/dashboardv3/public/js/models/VEntity.js b/dashboardv3/public/js/models/VEntity.js
index b798a6b..84a185f 100644
--- a/dashboardv3/public/js/models/VEntity.js
+++ b/dashboardv3/public/js/models/VEntity.js
@@ -95,6 +95,18 @@ define(['require',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, "POST", options);
+ },
+ saveNameSpaceAttribute: function(options) {
+ var url = UrlLinks.nameSpaceUpdateUrl();
+ options = _.extend({
+ contentType: 'application/json',
+ dataType: 'json'
+ }, options);
+ return this.constructor.nonCrudOperation.call(this, url, 'PUT', options);
+ },
+ deleteNameSpace: function(options) {
+ var url = UrlLinks.nameSpaceUpdateUrl(options.typeName);
+ return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
}
}, {});
return VEntity;
diff --git a/dashboardv3/public/js/router/Router.js b/dashboardv3/public/js/router/Router.js
index 0388ebd..02a8fb0 100644
--- a/dashboardv3/public/js/router/Router.js
+++ b/dashboardv3/public/js/router/Router.js
@@ -47,13 +47,16 @@ define([
"!/glossary/:id": "renderGlossaryLayoutView",
// Details
"!/detailPage/:id": "detailPage",
+ //Audit table
+ '!/administrator': 'administrator',
+ '!/administrator/namespace/:id': 'nameSpaceDetailPage',
// Default
"*actions": "defaultAction"
},
initialize: function(options) {
_.extend(
this,
- _.pick(options, "entityDefCollection", "typeHeaders", "enumDefCollection", "classificationDefCollection", "metricCollection")
+ _.pick(options, "entityDefCollection", "typeHeaders", "enumDefCollection", "classificationDefCollection", "metricCollection", "nameSpaceCollection")
);
this.showRegions();
this.bindFooterEvent();
@@ -72,7 +75,8 @@ define([
enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection,
glossaryCollection: this.glossaryCollection,
- metricCollection: this.metricCollection
+ metricCollection: this.metricCollection,
+ nameSpaceCollection: this.nameSpaceCollection
};
this.sharedObj = {
searchTableColumns: {},
@@ -277,6 +281,16 @@ define([
updateTabState: true
});
}
+ if (Utils.getUrlState.getQueryUrl().lastValue !== "search" && Utils.getUrlState.isAdministratorTab() === false) {
+ paramObj = _.omit(paramObj, ["tabActive", "ns", "nsa"]);
+ Utils.setUrl({
+ url: "#!/search/searchResult",
+ urlParams: paramObj,
+ mergeBrowserUrl: false,
+ trigger: false,
+ updateTabState: true
+ });
+ }
if (paramObj) {
if (!paramObj.type) {
if (paramObj.entityFilters) {
@@ -365,38 +379,6 @@ define([
});
});
},
- renderSearchResult: function() {
- var that = this;
- require(["views/site/Header", "views/search/SearchDetailLayoutView"], function(Header, SearchDetailLayoutView) {
- var paramObj = Utils.getUrlState.getQueryParams();
- var isinitialView = true,
- isTypeTagNotExists = false,
- tempParam = _.extend({}, paramObj);
- that.renderViewIfNotExists(that.getHeaderOptions(Header));
- if (paramObj) {
- isinitialView =
- (
- paramObj.type ||
- (paramObj.dslChecked == "true" ? "" : paramObj.tag || paramObj.term) ||
- (paramObj.query ? paramObj.query.trim() : "")
- ).length === 0;
- }
- App.rContent.show(
- new SearchDetailLayoutView(
- _.extend({
- value: paramObj,
- searchVent: that.searchVent,
- categoryEvent: that.categoryEvent,
- initialView: isinitialView,
- isTypeTagNotExists: paramObj.type != tempParam.type || tempParam.tag != paramObj.tag
- },
- that.preFetchedCollectionLists,
- that.sharedObj
- )
- )
- );
- });
- },
detailPage: function(id) {
var that = this;
if (id) {
@@ -416,7 +398,10 @@ define([
},
render: function() {
return new SideNavLayoutView(
- _.extend({ searchVent: that.searchVent, categoryEvent: that.categoryEvent }, that.preFetchedCollectionLists, that.sharedObj)
+ _.extend({
+ searchVent: that.searchVent,
+ categoryEvent: that.categoryEvent
+ }, that.preFetchedCollectionLists, that.sharedObj)
);
}
});
@@ -438,73 +423,6 @@ define([
});
}
},
- tagAttributePageLoad: function(tagName) {
- var that = this;
- require(["views/site/Header", "views/tag/TagDetailLayoutView", "views/site/SideNavLayoutView"], function(Header, TagDetailLayoutView, SideNavLayoutView) {
- var paramObj = Utils.getUrlState.getQueryParams(),
- url = Utils.getUrlState.getQueryUrl().queyParams[0];
- that.renderViewIfNotExists(that.getHeaderOptions(Header));
- // that.renderViewIfNotExists({
- // view: App.rSideNav,
- // manualRender: function() {
- // if (paramObj && paramObj.dlttag) {
- // Utils.setUrl({
- // url: url,
- // trigger: false,
- // updateTabState: true
- // });
- // }
- // this.view.currentView.RTagLayoutView.currentView.manualRender(_.extend({}, paramObj, { 'tagName': tagName }));
- // this.view.currentView.selectTab();
- // },
- // render: function() {
- // if (paramObj && paramObj.dlttag) {
- // Utils.setUrl({
- // url: url,
- // trigger: false,
- // updateTabState: true
- // });
- // }
- // return new SideNavLayoutView(
- // _.extend({
- // 'tag': tagName,
- // 'value': paramObj
- // }, that.preFetchedCollectionLists, that.sharedObj)
- // );
- // }
- // });
-
- that.renderViewIfNotExists({
- view: App.rSideNav,
- manualRender: function() {
- this.view.currentView.selectTab();
- },
- render: function() {
- return new SideNavLayoutView(
- _.extend({ searchVent: that.searchVent, categoryEvent: that.categoryEvent }, that.preFetchedCollectionLists, that.sharedObj)
- );
- }
- });
- if (tagName) {
- // updating paramObj to check for new queryparam.
- paramObj = Utils.getUrlState.getQueryParams();
- if (paramObj && paramObj.dlttag) {
- return false;
- }
- App.rContent.show(
- new TagDetailLayoutView(
- _.extend({
- tag: tagName,
- value: paramObj
- },
- that.preFetchedCollectionLists,
- that.sharedObj
- )
- )
- );
- }
- });
- },
glossaryDetailPage: function(id) {
var that = this;
if (id) {
@@ -542,25 +460,6 @@ define([
require(["views/site/Header", "views/search/SearchDetailLayoutView", "views/site/SideNavLayoutView"], function(Header, SearchDetailLayoutView, SideNavLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
that.renderViewIfNotExists(that.getHeaderOptions(Header));
- // that.renderViewIfNotExists({
- // view: App.rSideNav,
- // manualRender: function() {
- // this.view.currentView.selectTab();
- // if (Utils.getUrlState.isTagTab()) {
- // this.view.currentView.RTagLayoutView.currentView.manualRender();
- // } else if (Utils.getUrlState.isGlossaryTab()) {
- // this.view.currentView.RGlossaryLayoutView.currentView.manualRender(_.extend({ "isTrigger": true }, { "value": paramObj }));
- // }
- // },
- // render: function() {
- // return new SideNavLayoutView(
- // _.extend({
- // 'searchVent': that.searchVent
- // }, that.preFetchedCollectionLists, that.sharedObj)
- // )
- // }
- // });
-
that.renderViewIfNotExists({
view: App.rSideNav,
manualRender: function() {
@@ -593,6 +492,52 @@ define([
}
});
},
+ administrator: function() {
+ 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, namespaceID: null }, that.preFetchedCollectionLists);
+ that.renderViewIfNotExists(that.getHeaderOptions(Header));
+ that.renderViewIfNotExists({
+ view: App.rSideNav,
+ manualRender: function() {
+ this.view.currentView.manualRender(paramObj);
+ },
+ render: function() {
+ return new SideNavLayoutView(
+ _.extend({ searchVent: that.searchVent, categoryEvent: that.categoryEvent }, that.preFetchedCollectionLists, that.sharedObj)
+ );
+ }
+ });
+ App.rContent.show(new AdministratorLayoutView(paramObj));
+ });
+ },
+ nameSpaceDetailPage: function(namespaceGuid) {
+ var that = this;
+ require(["views/site/Header", "views/site/SideNavLayoutView", "views/name_space/NameSpaceContainerLayoutView", ], function(Header, SideNavLayoutView, NameSpaceContainerLayoutView) {
+ var paramObj = Utils.getUrlState.getQueryParams();
+ that.renderViewIfNotExists(that.getHeaderOptions(Header));
+ var options = _.extend({
+ namespaceID: namespaceGuid,
+ value: paramObj,
+ searchVent: that.searchVent,
+ categoryEvent: that.categoryEvent
+ },
+ that.preFetchedCollectionLists,
+ that.sharedObj
+ )
+ that.renderViewIfNotExists({
+ view: App.rSideNav,
+ manualRender: function() {
+ this.view.currentView.manualRender(options);
+ },
+ render: function() {
+ return new SideNavLayoutView(options);
+ }
+ });
+ App.rContent.show(new NameSpaceContainerLayoutView(options));
+ });
+ },
defaultAction: function(actions) {
// We have no matching route, lets just log what the URL was
Utils.setUrl({
diff --git a/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html b/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html
new file mode 100644
index 0000000..ddc55f3
--- /dev/null
+++ b/dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html
@@ -0,0 +1,40 @@
+<!--
+ * 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="clearfix">
+ <!-- <div class="fontLoader">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+ </div> -->
+ <div class="col-sm-12 default-tab">
+ <ul class="nav nav-tabs" data-id="tab-list">
+ <li role="namespace" class="tab active"><a href="#tab-namespace" aria-controls="tab-namespace" role="tab" data-toggle="tab">Namespaces</a></li>
+ <li role="enum"><a href="#tab-enum" aria-controls="tab-enum" role="tab" data-toggle="tab">Enumerations</a></li>
+ </ul>
+ </div>
+</div>
+<div>
+ <div class="tab-content purge-details">
+ <div id="tab-namespace" role="namespace" class="tab-pane active animated fadeIn">
+ <div id="r_namespaceTableLayoutView">
+ </div>
+ </div>
+ <div id="tab-enum" role="enum" class="tab-pane animated fadeIn">
+ <div id="r_enumTableLayoutView">
+ </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
new file mode 100644
index 0000000..ee394a9
--- /dev/null
+++ b/dashboardv3/public/js/templates/administrator/PurgeAuditTableLayoutView_tmpl.html
@@ -0,0 +1,120 @@
+<!--
+ * 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/CreateAuditTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
index 1934339..1ff67d3 100644
--- a/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-<h4 style="word-break: break-word;">Name: <span data-id="name"></span></h4>
-<div class="panel-group server-stats-container statsContainer " id="accordion">
- <div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="detailsAttribute">
+<h4 class="entity-name" style="word-break: break-word;">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">
<h4 class="panel-title">
<a>Properties </a>
@@ -37,7 +37,7 @@
</div>
</div>
</div>
- <div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="attributeDetails">
+ <div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="attributeDetails">
<div class="panel-heading" data-toggle="collapse" href="#attributeTableCollapse" aria-expanded="true">
<h4 class="panel-title">
<a data-id="panel-attr-heading">Technical properties </a>
@@ -58,7 +58,7 @@
</div>
</div>
</div>
- <div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="relationShipAttributeDetails">
+ <div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="relationShipAttributeDetails">
<div class="panel-heading" data-toggle="collapse" href="#relationShipAttributeTableCollapse" aria-expanded="true">
<h4 class="panel-title">
<a>Relationship properties </a>
@@ -79,7 +79,7 @@
</div>
</div>
</div>
- <div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="customAttributeDetails">
+ <div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="customAttributeDetails">
<div class="panel-heading" data-toggle="collapse" href="#customAttributeCollapse" aria-expanded="true">
<h4 class="panel-title">
<a>User-defined properties </a>
@@ -100,7 +100,7 @@
</div>
</div>
</div>
- <div class="panel panel-default custom-panel expand_collapse_panel-icon hide" data-id="labelsDetails">
+ <div class="panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5" data-id="labelsDetails">
<div class="panel-heading" data-toggle="collapse" href="#labelsTableCollapse" aria-expanded="true">
<h4 class="panel-title">
<a>Labels</a>
diff --git a/dashboardv3/public/js/templates/common/Modal.html b/dashboardv3/public/js/templates/common/Modal.html
index cf409ef..6be0d4d 100644
--- a/dashboardv3/public/js/templates/common/Modal.html
+++ b/dashboardv3/public/js/templates/common/Modal.html
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-<div class="modal-dialog {{mainClass}} " style="width:{{width}}" role="document">
+<div class="modal-dialog {{mainClass}}{{modal-full-screen}}" style="width:{{width}}" role="document">
<div class="modal-content">
{{#if title}}
<div class="modal-header">
diff --git a/dashboardv3/public/js/templates/name_space/CreateNameSpaceLayoutView_tmpl.html b/dashboardv3/public/js/templates/name_space/CreateNameSpaceLayoutView_tmpl.html
new file mode 100644
index 0000000..acf3b23
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/CreateNameSpaceLayoutView_tmpl.html
@@ -0,0 +1,53 @@
+<!--
+ * 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="fontLoader">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+</div>
+<form name="tagDefinitionform" class="hide form-horizontal" data-id="createTagForm" style="width: 70%;margin: 0 auto;">
+ {{#if fromTable}}
+ <div class="form-group">
+ <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 namespace-name" data-id="tagName" placeholder="Name(required)" autofocus />
+ </div>
+ {{else}}
+ <span class="ellipsis-with-margin control-label text-left col-sm-10" data-id="title"></span> {{/if}}
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-2" for="description">Description</label>
+ <div class="col-sm-10">
+ <input class="form-control" data-id="description" value="{{description}}" placeholder="Description" />
+ </div>
+ </div>
+ {{/if}}
+ <div class="form-group">
+ <!-- <h4 class="col-sm-6">Attributes</h4> -->
+ {{#if isEditAttr}}
+ <div class="col-sm-12 no-padding-left">
+ <button title="Add Namespace attribute" type="button" class="btn btn-action btn-sm pull-left" data-id="attributeData"><i class="fa fa-plus"></i> Add Namespace attribute</button>
+ </div>
+ {{/if}}
+ </div>
+ <div data-id="addAttributeDiv">
+ </div>
+ </div>
+</form>
+<div class="modal-footer " data-id="modalFooter">
+ <button type="button" class="btn btn-action cancel" data-id="namespaceAttrPageCancle">Cancel</button>
+ <button type="button" class="btn btn-atlas ok" data-id="namespaceAttrPageOk">Ok</button>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/name_space/EnumCreateUpdateItemView_tmpl.html b/dashboardv3/public/js/templates/name_space/EnumCreateUpdateItemView_tmpl.html
new file mode 100644
index 0000000..be0ab81
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/EnumCreateUpdateItemView_tmpl.html
@@ -0,0 +1,39 @@
+<!--
+ * 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="form-horizontal form-group clearfix enum-attr">
+ <div class="form-group" data-id="enumTypeSelectorContainer">
+ <label class="control-label col-sm-3 required" for="enumType">Enum Name</label>
+ <div class="col-sm-8">
+ <select class="form-control enumTypeSelector" data-id="enumSelector">
+ </select>
+ </div>
+ </div>
+ <div class="form-group " data-id="enumValueSelectorContainer">
+ <label class="control-label col-sm-3 required" for="enumVal">Enum Value</label>
+ <div class="col-sm-8">
+ <select class="form-control enumValueSelector" data-id="valueSelector" multiple="multiple">
+ </select>
+ </div>
+ </div>
+ <div class="form-group " data-id="enumFooter">
+ <label class="control-label col-sm-3" for="enumVal"></label>
+ <div class="col-sm-8">
+ <button type="button" data-id="enumCancleBtn" class="btn btn-action cancel">Cancel</button>
+ <button type="button" data-id="enumOkBtn" class="btn btn-atlas ok">Update</button>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/name_space/NameSpaceAttrTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/name_space/NameSpaceAttrTableLayoutView_tmpl.html
new file mode 100644
index 0000000..c36195c
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceAttrTableLayoutView_tmpl.html
@@ -0,0 +1,47 @@
+<!--
+ * 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="namespace-attr-page" data-id="namespaceAttrPage">
+ <div class="namespace-attr-tableOverlay"></div>
+ <div class=" modal-header" data-id="namespaceAttrPageHeader">
+ <h4 class="modal-title" data-id="namespaceAttrPageTitle"></h4>
+ </div>
+ <div id="r_modal">
+ </div>
+ <div class="namespace-attr-fontLoader">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+ </div>
+ <!-- <div class="modal-footer " data-id="modalFooter">
+ <button type="button" class="btn btn-action cancel" data-id="namespaceAttrPageCancle">Cancel</button>
+ <button type="button" class="btn btn-atlas ok" data-id="namespaceAttrPageOk">Ok</button>
+ </div> -->
+</div>
+<div class="namespace-details" data-id="namespaceDetailPage">
+ <div class="position-relative">
+ <div class="pull-right inline-content-fr no-padding-left">
+ <div class="inline" data-id="colManager"></div>
+ <div class="inline">
+ <button type="button" data-id="addAttribute" title="Create Namespace" class="btn btn-action btn-sm pull-right btn-loader" style="margin-bottom: 10px;" data-action="createNamespace">
+ <i class='fa fa-plus'></i> Attributes
+ </button></div>
+ </div>
+ <div class="tableOverlay"></div>
+ <div class='attr-filter-overlay hide'></div>
+ <div class="auditTable name-space-details">
+ <div id="r_nameSpaceAttrTableLayoutView"></div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html b/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
new file mode 100644
index 0000000..2afc3df
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceAttributeItemView_tmpl.html
@@ -0,0 +1,89 @@
+<!--
+ * 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="form-group clearfix namespace-attr">
+ <div class="form-group">
+ <div class="col-sm-12 attributePlusData " align="right">
+ <button type="button" class="btn btn-danger btn-sm closeInput" data-id="close"><i class="fa fa-times"></i></button>
+ </div>
+ </div>
+ <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>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label col-sm-3 required" for="type">Type</label>
+ <div class="col-sm-8">
+ <select class="form-control dataTypeSelector" data-id="dataTypeSelector">
+ <option selected="selected">string</option>
+ <option>boolean</option>
+ <option>byte</option>
+ <option>short</option>
+ <option>int</option>
+ <option>float</option>
+ <option>double</option>
+ <option>long</option>
+ <option>date</option>
+ <option>enumeration</option>
+ </select>
+ </div>
+ </div>
+ <!-- <div class="form-group" data-id="multiValueSelect">
+ <label class="control-label col-sm-3" for="multiValSelect">Enable Multivalues</label>
+ <div class="col-sm-8">
+ <input type="checkbox" class="form-check-input multi-value-select" data-id="multiValueSelectStatus">
+ </div>
+ </div> -->
+ <div class="form-group enumtype-container" data-id="enumTypeSelectorContainer">
+ <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>
+ </div>
+ <div class="col-sm-3">
+ <button type="button" class="btn btn-action btn-sm" data-id="createNewEnum" data-action="" title="Create/Update Enum"> <i class="fa fa-pencil"></i> Enum</button>
+ </div>
+ </div>
+ </div>
+ <div class="form-group enumvalue-container" data-id="enumValueSelectorContainer">
+ <div class="">
+ <label class="control-label col-sm-3 required" for="enumVal">Enum Value</label>
+ <div class="col-sm-8">
+ <select class="form-control enumValueSelector" data-id="enumValueSelector" multiple="true">
+ </select>
+ </div>
+ </div>
+ </div>
+ <div class="form-group" data-id="stringLengthContainer">
+ <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">
+ </div>
+ </div>
+ </div>
+ <div class="form-group entity-namespace-selector">
+ <label class="control-label col-sm-3" for="name">Applicable Types</label>
+ <div class="col-sm-8">
+ <select class="form-control entityTypeSelector" data-id="entityTypeSelector" multiple="multiple">
+ </select>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/name_space/NameSpaceContainerLayoutView_tmpl.html b/dashboardv3/public/js/templates/name_space/NameSpaceContainerLayoutView_tmpl.html
new file mode 100644
index 0000000..7aaed9a
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceContainerLayoutView_tmpl.html
@@ -0,0 +1,20 @@
+<!--
+ * 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>
+ <div id="r_nameSpaceDetailContainer" class="sidebar-fixed-filter"></div>
+ <div id="r_nameSpaceAttrContainer" class="col-sm-12"></div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/name_space/NameSpaceDetailLayoutView_tmpl.html b/dashboardv3/public/js/templates/name_space/NameSpaceDetailLayoutView_tmpl.html
new file mode 100644
index 0000000..84ab494
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceDetailLayoutView_tmpl.html
@@ -0,0 +1,29 @@
+<!--
+ * 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="back-button" title="Back to search page" style="top:15px">
+ <i class="fa fa-angle-left" data-id="backButton"></i>
+ </div>
+ <div class="tagDetail clearfix form-horizontal col-sm-12">
+ <h1 class="title"><span data-id="title"></span></h1>
+ <p class="form-group col-sm-12" data-id="description"></p>
+ </div>
+</div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/name_space/NameSpaceTableLayoutView_tmpl.html b/dashboardv3/public/js/templates/name_space/NameSpaceTableLayoutView_tmpl.html
new file mode 100644
index 0000000..c30d90d
--- /dev/null
+++ b/dashboardv3/public/js/templates/name_space/NameSpaceTableLayoutView_tmpl.html
@@ -0,0 +1,47 @@
+<!--
+ * 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="namespace-attr-page" data-id="namespaceAttrPage">
+ <div class="namespace-attr-tableOverlay"></div>
+ <div class=" modal-header" data-id="namespaceAttrPageHeader">
+ <h4 class="modal-title" data-id="namespaceAttrPageTitle"></h4>
+ </div>
+ <div id="r_modal">
+ </div>
+ <div class="namespace-attr-fontLoader">
+ <i class="fa fa-refresh fa-spin-custom"></i>
+ </div>
+<!-- <div class="modal-footer " data-id="modalFooter">
+ <button type="button" class="btn btn-action cancel" data-id="namespaceAttrPageCancle">Cancel</button>
+ <button type="button" class="btn btn-atlas ok" data-id="namespaceAttrPageOk">Ok</button>
+ </div> -->
+</div>
+<div class="namespace-details" data-id="namespaceDetailPage">
+ <div class="position-relative">
+ <div class="pull-right inline-content-fr no-padding-left">
+ <div class="inline" data-id="colManager"></div>
+ <div class="inline">
+ <button type="button" data-id="createNameSpace" title="Create Namespace" class="btn btn-action btn-sm pull-right btn-loader" style="margin-bottom: 10px;" data-action="createNamespace">
+ <i class='fa fa-plus'></i> Create Namespace
+ </button></div>
+ </div>
+ <div class="tableOverlay"></div>
+ <div class='attr-filter-overlay hide'></div>
+ <div class="auditTable name-space-details">
+ <div id="r_nameSpaceTableLayoutView"></div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/search/SearchFilterBrowseLayoutView_tmpl.html b/dashboardv3/public/js/templates/search/SearchFilterBrowseLayoutView_tmpl.html
index a9690bd..dc0f4c5 100644
--- a/dashboardv3/public/js/templates/search/SearchFilterBrowseLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/search/SearchFilterBrowseLayoutView_tmpl.html
@@ -39,19 +39,13 @@
<div data-id="r_classificationTreeRender"></div>
</div>
<div class="col-sm-12">
+ <div data-id="r_nameSpaceTreeRender"></div>
+ </div>
+ <div class="col-sm-12">
<div data-id="r_glossaryTreeRender"></div>
</div>
<div class="col-sm-12">
<div data-id="r_customFilterTreeRender"></div>
- <!-- <div class="panel panel-default expand_collapse_panel-icon right-icons">
- <div class="panel-heading dash-button-icon" data-toggle="collapse" aria-expanded="false" href="#c_saveSearch">
- <i class="ec-icon fa"></i>
- <h4 class="panel-title">Custom Filters</h4>
- </div>
- <div id="c_saveSearch" class="panel-collapse collapse">
- <div class="basicSaveSearch" data-id="r_saveSearchBasic"></div>
- </div>
- </div> -->
</div>
</div>
</div>
diff --git a/dashboardv3/public/js/templates/search/tree/GlossaryTreeLayoutView_tmpl.html b/dashboardv3/public/js/templates/search/tree/GlossaryTreeLayoutView_tmpl.html
index ebf6f2e..83da9c5 100644
--- a/dashboardv3/public/js/templates/search/tree/GlossaryTreeLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/search/tree/GlossaryTreeLayoutView_tmpl.html
@@ -20,29 +20,21 @@
<h4 class="panel-title">Glossaries</h4>
<div class="btn-group pull-right">
<button type="button" class="typeRefresh" data-id="refreshTree" data-type="term" title="Refresh"><i class="fa fa-refresh"></i></button>
- <!-- <ul class="dropdown-menu right-align tree-menu">
- <li data-id="createGlossary"><i class="fa fa-plus"></i> <a>Create Glossary</a></li>
- </ul> -->
<button type="button" class="typeRefresh" data-id="showGlossaryType" title="Show Category">
<i class="fa fa-toggle-on switch-button"></i>
</button>
- <!-- <button title="Create Glossary" type="button" data-id="createGlossary">
+ <button title="Create Glossary" type="button" data-id="createGlossary">
<i class="fa fa-plus"></i>
- </button> -->
- <!-- <button data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" data-id="termMenu"><i class="fa fa-ellipsis-v"></i></button> -->
- <button type="button" class="typeRefresh dropdown">
+ </button>
+ <!-- <button type="button" class="typeRefresh dropdown">
<div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i>
</div>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
- <!-- <li data-id="showGlossaryType" data-type="term"> <i class="fa fa-toggle-on switch-button"></i><span>Show Category</span>
- </li> -->
- <!-- <li data-id="refreshTree" data-type="term"><i class="fa fa-refresh"></i><span>Refresh</span>
- </li> -->
<li data-id="createGlossary" data-type="term"> <i class="fa fa-plus"></i><span>Create Glossary</span>
</li>
</ul>
- </button>
+ </button> -->
</div>
</div>
<div id="c_term" class="panel-collapse collapse jstree-with-action in">
diff --git a/dashboardv3/public/js/templates/search/tree/NameSpaceTreeLayoutView_tmpl.html b/dashboardv3/public/js/templates/search/tree/NameSpaceTreeLayoutView_tmpl.html
new file mode 100644
index 0000000..52eca04
--- /dev/null
+++ b/dashboardv3/public/js/templates/search/tree/NameSpaceTreeLayoutView_tmpl.html
@@ -0,0 +1,45 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<div class="panel panel-default expand_collapse_panel-icon right-icons">
+ <div class="panel-heading dash-button-icon clearfix" data-toggle="collapse" aria-expanded="true" href="#c_namespace">
+ <i class="ec-icon fa"></i>
+ <h4 class="panel-title">Namespaces</h4>
+ <div class="btn-group pull-right">
+ <button type="button" class="typeRefresh drop-down-menu-view" data-id="refreshTree" data-type="classification" title="Refresh">
+ <i class="fa fa-refresh"></i>
+ </button>
+ <button type="button" class="typeRefresh drop-down-menu-view" data-id="createNameSpace" data-type="classification" title="Open Namespaces">
+ <i class="fa fa-external-link"></i>
+ </button>
+ <!-- <button type="button" class="typeRefresh dropdown">
+ <div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ <i class="fa fa-ellipsis-v"></i>
+ </div>
+ <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
+ <li data-id="groupOrFlatTreeView" data-type="classification"> <i class="fa fa-list-ul"></i><span>Show flat tree</span>
+ </li>
+ <li data-id="createNameSpace" data-type="classification"> <i class="fa fa-plus"></i><span>Create Namespace</span>
+ </li>
+ </button> -->
+ </ul>
+ </button>
+ </div>
+ </div>
+ <div id="c_namespace" class="panel-collapse collapse jstree-with-action in">
+ <div data-id="nameSpaceSearchTree"></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/site/Header.html b/dashboardv3/public/js/templates/site/Header.html
index bb531da..8448964 100644
--- a/dashboardv3/public/js/templates/site/Header.html
+++ b/dashboardv3/public/js/templates/site/Header.html
@@ -29,8 +29,6 @@
<div class="btn-group pull-right header-menu">
<table class="header-menu">
<tr>
- <!-- <td><a class="show-classification" href="javascript:void(0);" title="Clasification"><i class="fa fa-tag"></i></a></td>
- <td><a class="show-glossary" href="javascript:void(0);" title="Glossary"><i class="fa fa-folder"></i></a></td> -->
<td><a class="show-stat" href="javascript:void(0);" title="Statistics"><i class="fa fa-bar-chart"></i></a></td>
<td class="user-dropdown">
<table data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@@ -43,13 +41,17 @@
</td>
</tr>
</table>
- <ul class="dropdown-menu right-align">
- <li class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
- <li class="aboutAtlas"><a target="_blank" href="http://atlas.apache.org/">Help</a></li>
- <li role="separator" class="divider"></li>
- <li>
- <a data-id="signOut" href="javascript:void(0)"><i class="fa fa-sign-out"></i>Logout</a>
+ <ul class="dropdown-menu pull-right multi-level" role="menu" aria-labelledby="dropdownMenu">
+ <li><a href="#!/administrator" data-id="purgeSearch">Administration</a></li>
+ <li class="dropdown-submenu">
+ <a tabindex="-1" href="javascript:void(0)"> Help </span></a>
+ <ul class="dropdown-menu">
+ <li><a target="_blank" href="http://atlas.apache.org/">Documentation</a></li>
+ <li class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
+ </ul>
</li>
+ <li class="divider"></li>
+ <li><a data-id="signOut" href="javascript:void(0)"><i class="fa fa-sign-out"></i>Logout</a></li>
</ul>
</td>
</tr>
diff --git a/dashboardv3/public/js/utils/Helper.js b/dashboardv3/public/js/utils/Helper.js
index f18cdc4..ccfde66 100644
--- a/dashboardv3/public/js/utils/Helper.js
+++ b/dashboardv3/public/js/utils/Helper.js
@@ -112,10 +112,90 @@ define(['require',
$("body").on('click', '.dropdown-menu.dropdown-changetitle li a', function() {
$(this).parents('li').find(".btn:first-child").html($(this).text() + ' <span class="caret"></span>');
});
+ $("body").on('click', '.dropdown-menu.multi-level .dropdown-submenu>a', function(e) {
+ e.stopPropagation();
+ e.preventDefault();
+ });
$("body").on('click', '.btn', function() {
$(this).blur();
});
+ $.fn.select2.amd.define("TagHideDeleteButtonAdapter", [
+ "select2/utils",
+ "select2/selection/multiple",
+ "select2/selection/placeholder",
+ "select2/selection/eventRelay",
+ "select2/selection/search",
+ ],
+ function(Utils, MultipleSelection, Placeholder, EventRelay, SelectionSearch) {
+
+ // Decorates MultipleSelection with Placeholder
+
+ var adapter = Utils.Decorate(MultipleSelection, Placeholder);
+ adapter = Utils.Decorate(adapter, SelectionSearch);
+ adapter = Utils.Decorate(adapter, EventRelay);
+
+ adapter.prototype.render = function() {
+ // Use selection-box from SingleSelection adapter
+ // This implementation overrides the default implementation
+ var $search = $(
+ '<li class="select2-search select2-search--inline">' +
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
+ ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
+ '</li>'
+ );
+
+ this.$searchContainer = $search;
+ this.$search = $search.find('input');
+ let $selection = MultipleSelection.prototype.render.call(this);
+ this._transferTabIndex();
+ return $selection;
+ };
+
+ adapter.prototype.update = function(data) {
+ // copy and modify SingleSelection adapter
+ var that = this;
+ this.clear();
+ if (data.length === 0) {
+ this.$selection.find('.select2-selection__rendered')
+ .append(this.$searchContainer);
+ this.$search.attr('placeholder', this.options.get("placeholder"));
+ return;
+ }
+ this.$search.attr('placeholder', '');
+ var $rendered = this.$selection.find('.select2-selection__rendered'),
+ $selectionContainer = [];
+ if (data.length > 0) {
+ _.each(data, function(obj) {
+ var $container = $('<li class="select2-selection__choice"></li>'),
+ formatted = that.display(obj, $rendered),
+ $remove = $('<span class="select2-selection__choice__remove" role="presentation">×</span>'),
+ allowRemoveAttr = $(obj.element).data("allowremove"),
+ allowRemove = obj.allowRemove === undefined ? allowRemoveAttr : obj.allowRemove;
+ if (allowRemove === undefined || allowRemove !== false) {
+ $container.append($remove);
+ }
+ $container.data("data", obj);
+ $container.append(formatted);
+ $selectionContainer.push($container);
+ });
+ Utils.appendMany($rendered, $selectionContainer);
+ }
+
+
+ var searchHadFocus = this.$search[0] == document.activeElement;
+ this.$search.attr('placeholder', '');
+ this.$selection.find('.select2-selection__rendered')
+ .append(this.$searchContainer);
+ this.resizeSearch();
+ if (searchHadFocus) {
+ this.$search.focus();
+ }
+ };
+ return adapter;
+ });
+
$.fn.select2.amd.define("ServiceTypeFilterDropdownAdapter", [
"select2/utils",
"select2/dropdown",
diff --git a/dashboardv3/public/js/utils/Overrides.js b/dashboardv3/public/js/utils/Overrides.js
index 7e493d6..42d047e 100644
--- a/dashboardv3/public/js/utils/Overrides.js
+++ b/dashboardv3/public/js/utils/Overrides.js
@@ -95,6 +95,7 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
});
}
if (modelValue.get('width')) that.$el.find('.' + modelValue.get('name')).css('min-width', modelValue.get('width') + 'px');
+ if (modelValue.get('fixWidth')) that.$el.find('.' + modelValue.get('name')).css('width', modelValue.get('fixWidth') + 'px');
if (modelValue.get('toolTip')) that.$el.find('.' + modelValue.get('name')).attr('title', modelValue.get('toolTip'));
});
return this;
@@ -161,6 +162,95 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
return this;
};
+ /*
+ backgrid-expandable-cell
+ https://github.com/cime/backgrid-expandable-cell
+
+ Copyright (c) 2014 Andrej Cimperšek
+ Licensed under the MIT @license.
+ */
+ Backgrid.ExpandableCell = Backgrid.Cell.extend({
+ accordion: true,
+ toggle: '<i style="cursor: pointer;" class="glyphicon toggle pull-left"></i>',
+ toggleClass: 'toggle',
+ toggleExpandedClass: 'fa fa-angle-down',
+ toggleCollapsedClass: 'fa fa-angle-right',
+ trClass: 'expandable',
+ tdClass: 'expandable-content',
+ events: {
+ 'click': 'setToggle'
+ },
+ initialize: function(options) {
+ if (options.accordion) {
+ this.accordion = options.accordion;
+ }
+
+ this.column = options.column;
+ if (!(this.column instanceof Backgrid.Column)) {
+ this.column = new Backgrid.Column(this.column);
+ }
+
+ var column = this.column,
+ model = this.model,
+ $el = this.$el;
+
+ if (Backgrid.callByNeed(column.renderable(), column, model)) $el.addClass("renderable");
+ },
+
+ render: function() {
+ /* follow along with the original render really... */
+ this.$el.empty();
+
+ this.$toggleEl = $(this.toggle).addClass(this.toggleClass).addClass(this.toggleCollapsedClass);
+
+ this.$el.append(this.$toggleEl);
+
+ this.delegateEvents();
+
+ return this;
+ },
+
+ setToggle: function() {
+ var detailsRow = this.$el.data('details');
+ var toggle = this.$toggleEl;
+
+ /* if there's details data already stored, then we'll remove it */
+ if (detailsRow) {
+ $(detailsRow).remove();
+ this.$el.data('details', null);
+ toggle.removeClass(this.toggleExpandedClass).addClass(this.toggleCollapsedClass);
+ } else {
+ if (this.accordion) {
+ var table = this.$el.closest('table');
+ $('.' + this.toggleClass, table).filter('.' + this.toggleExpandedClass).click();
+ }
+
+ var renderableColumns = this.$el.closest('table').find('th.renderable').length;
+ var isRenderable = false;
+ var cellClass = this.tdClass;
+
+ if (Backgrid.callByNeed(this.column.renderable(), this.column, this.model)) {
+ isRenderable = true;
+ cellClass += ' renderable';
+ }
+
+ /* build a jquery object for the new row... */
+ detailsRow = $('<tr class="' + this.trClass + '"></td><td class="' + cellClass + '" colspan="' + (renderableColumns - 1) + '"></td></tr>');
+
+ /* Inject new row */
+ this.$el.closest('tr').after(detailsRow);
+
+ /* Call expand function */
+ this.column.get('expand')(detailsRow.find('td.' + this.tdClass), this.model);
+
+ this.$el.data('details', detailsRow);
+
+ toggle.removeClass(this.toggleCollapsedClass).addClass(this.toggleExpandedClass);
+ }
+
+ return this;
+ }
+ });
// Backgrid patch
Backgrid.Header.prototype.initialize = BackgridHeaderInitializeMethod;
diff --git a/dashboardv3/public/js/utils/UrlLinks.js b/dashboardv3/public/js/utils/UrlLinks.js
index 6c67e8c..6a09d31 100644
--- a/dashboardv3/public/js/utils/UrlLinks.js
+++ b/dashboardv3/public/js/utils/UrlLinks.js
@@ -226,8 +226,28 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
},
sessionApiUrl: function() {
return this.baseUrl + '/admin/session';
+ },
+ purgeApiUrl: function() {
+ return this.baseUrl + '/admin/audit';
+ },
+ nameSpaceApiUrl: function() {
+ return this.typedefsUrl().defs + '?type=namespace';
+ },
+ nameSpaceGuidApiUrl: function(guid) {
+ var lineageUrl = this.baseUrlV2 + '/types/namespacedef/guid';
+ if (guid) {
+ return lineageUrl + '/' + guid;
+ } else {
+ return lineageUrl
+ }
+ },
+ nameSpaceUpdateUrl: function(name) {
+ if (name) {
+ return this.typedefsUrl().def + '/name/' + name;
+ } else {
+ return this.typedefsUrl().defs + '?type=namespace';
+ }
}
-
});
return UrlLinks;
diff --git a/dashboardv3/public/js/utils/Utils.js b/dashboardv3/public/js/utils/Utils.js
index e336e41..7aab725 100644
--- a/dashboardv3/public/js/utils/Utils.js
+++ b/dashboardv3/public/js/utils/Utils.js
@@ -382,6 +382,12 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
matchString: "search"
});
},
+ isAdministratorTab: function(url) {
+ return this.checkTabUrl({
+ url: url,
+ matchString: "administrator"
+ });
+ },
isCustomFilterTab: function(url) {
return this.checkTabUrl({
url: url,
diff --git a/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js b/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
new file mode 100644
index 0000000..722059f
--- /dev/null
+++ b/dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
@@ -0,0 +1,105 @@
+/**
+ * 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/administrator/AdministratorLayoutView_tmpl',
+ 'collection/VEntityList',
+ 'models/VSearch',
+ 'utils/Utils',
+ 'utils/Enums',
+ 'utils/UrlLinks',
+ 'utils/CommonViewFunction'
+], function(require, Backbone, AdministratorLayoutView_tmpl, VEntityList, VSearch, Utils, Enums, UrlLinks, CommonViewFunction) {
+ 'use strict';
+
+ var AdministratorLayoutView = Backbone.Marionette.LayoutView.extend(
+ /** @lends AuditTableLayoutView */
+ {
+ _viewName: 'AdministratorLayoutView',
+
+ template: AdministratorLayoutView_tmpl,
+
+ /** Layout sub regions */
+ regions: {
+ RNamespaceTableLayoutView: "#r_namespaceTableLayoutView",
+ REnumTableLayoutView: '#r_enumTableLayoutView'
+ },
+
+ /** ui selector cache */
+ ui: {
+ tablist: '[data-id="tab-list"] li'
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {};
+ 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', 'enumDefCollection'));
+
+ },
+ 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.renderEnumLayoutView();
+ },
+ onRender: function() {
+ this.renderNameSpaceLayoutView();
+ this.bindEvents();
+ },
+ renderNameSpaceLayoutView: function(obj) {
+ var that = this;
+ require(['views/name_space/NameSpaceTableLayoutView'], function(NameSpaceTableLayoutView) {
+ that.RNamespaceTableLayoutView.show(new NameSpaceTableLayoutView({ nameSpaceCollection: that.nameSpaceCollection }));
+ });
+ },
+ renderEnumLayoutView: function(obj) {
+ var that = this;
+ require(["views/name_space/EnumCreateUpdateItemView"], function(EnumCreateUpdateItemView) {
+ var view = new EnumCreateUpdateItemView({
+ enumDefCollection: that.enumDefCollection,
+ nameSpaceCollection: that.nameSpaceCollection
+ });
+ that.REnumTableLayoutView.show(view);
+ });
+ }
+ });
+ return AdministratorLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js b/dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js
new file mode 100644
index 0000000..6b5b4d3
--- /dev/null
+++ b/dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js
@@ -0,0 +1,518 @@
+/**
+ * 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 = {
+ skipDefaultError: true,
+ 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/AuditTableLayoutView.js b/dashboardv3/public/js/views/audit/AuditTableLayoutView.js
index ed570ea..ea52a45 100644
--- a/dashboardv3/public/js/views/audit/AuditTableLayoutView.js
+++ b/dashboardv3/public/js/views/audit/AuditTableLayoutView.js
@@ -179,6 +179,31 @@ define(['require',
getAuditTableColumns: function() {
var that = this;
return this.entityCollection.constructor.getTableCols({
+
+ tool: {
+ label: "",
+ cell: "html",
+ editable: false,
+ sortable: false,
+ cell: Backgrid.ExpandableCell,
+ accordion: false,
+ expand: function(el, model) {
+ el.attr('colspan', '4');
+ require([
+ 'views/audit/CreateAuditTableLayoutView',
+ ], function(CreateAuditTableLayoutView) {
+
+ that.action = model.get('action');
+ // $(el.target).attr('disabled', true);
+ var eventModel = that.entityCollection.fullCollection.findWhere({ 'eventKey': model.get('eventKey') }).toJSON(),
+ collectionModel = new that.entityCollection.model(eventModel),
+ view = new CreateAuditTableLayoutView({ guid: that.guid, entityModel: collectionModel, action: that.action, entity: that.entity, entityName: that.entityName, attributeDefs: that.attributeDefs });
+ view.render();
+ $(el).append($('<div>').html(view.$el));
+ });
+
+ }
+ },
user: {
label: "Users",
cell: "html",
@@ -207,20 +232,7 @@ define(['require',
}
}
})
- },
- tool: {
- label: "Tools",
- cell: "html",
- editable: false,
- sortable: false,
- width: 100,
- formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
- fromRaw: function(rawValue, model) {
- return '<div class="btn btn-action btn-sm" data-id="auditCreate" data-action="' + Enums.auditAction[model.get('action')] + '" data-modalId="' + model.get('eventKey') + '">Detail</div>';
- }
- })
- },
-
+ }
}, this.entityCollection);
},
diff --git a/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js b/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
index 43fb114..89f5337 100644
--- a/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
+++ b/dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
@@ -157,7 +157,7 @@ define(['require',
}
} else if (detailObj == "Deleted entity") {
- that.updateName(this.entityName);
+ that.updateName(this.entityName ? this.entityName : "Entity");
}
}
});
diff --git a/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js b/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
new file mode 100644
index 0000000..16d6a6d
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/CreateNameSpaceLayoutView.js
@@ -0,0 +1,591 @@
+/**
+ * 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/name_space/CreateNameSpaceLayoutView_tmpl',
+ 'utils/Utils',
+ 'utils/Messages',
+ 'views/name_space/NameSpaceAttributeItemView',
+ 'collection/VTagList',
+ 'utils/UrlLinks',
+ 'platform'
+], function(require, Backbone, CreateNameSpaceLayoutViewTmpl, Utils, Messages, NameSpaceAttributeItemView, VTagList, UrlLinks, platform) {
+
+ var CreateNameSpaceLayoutView = Backbone.Marionette.CompositeView.extend(
+ /** @lends CreateNameSpaceLayoutView */
+ {
+ _viewName: 'CreateNameSpaceLayoutView',
+
+ template: CreateNameSpaceLayoutViewTmpl,
+
+ templateHelpers: function() {
+ return {
+ create: this.create,
+ description: this.description,
+ fromTable: this.fromTable,
+ isEditAttr: this.isEditAttr
+ };
+ },
+
+ /** Layout sub regions */
+ regions: {},
+
+ childView: NameSpaceAttributeItemView,
+
+ childViewContainer: "[data-id='addAttributeDiv']",
+
+ childViewOptions: function() {
+ return {
+ // saveButton: this.ui.saveButton,
+ parentView: this
+ };
+ },
+ /** ui selector cache */
+ ui: {
+ tagName: "[data-id='tagName']",
+ description: "[data-id='description']",
+ title: "[data-id='title']",
+ attributeData: "[data-id='attributeData']",
+ addAttributeDiv: "[data-id='addAttributeDiv']",
+ createTagForm: '[data-id="createTagForm"]',
+ namespaceAttrPageCancle: '[data-id="namespaceAttrPageCancle"]',
+ namespaceAttrPageOk: '[data-id="namespaceAttrPageOk"]'
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {};
+ events["click " + this.ui.attributeData] = "onClickAddAttriBtn";
+ events["click " + this.ui.namespaceAttrPageOk] = function(e) {
+ var that = this,
+ modal = that.$el;
+ if (e.target.dataset.action == "attributeEdit" || e.target.dataset.action == "addAttribute") {
+ // var selectedNamespace = that.nameSpaceCollection.fullCollection.findWhere({ guid: that.guid });
+ that.onUpdateAttr();
+ } else {
+ if (that.$el.find('.form-control.namespace-name')[0].value === "") {
+ $(that.$el.find('.form-control.namespace-name')[0]).css("borderColor", "red");
+ Utils.notifyInfo({
+ content: "Namespace name is empty."
+ });
+
+ } else {
+ that.onCreateNameSpace();
+ }
+ }
+
+ };
+ events["click " + this.ui.namespaceAttrPageCancle] = function(e) {
+ this.options.onUpdateNamespace();
+ };
+ return events;
+ },
+ /**
+ * intialize a new CreateNameSpaceLayoutView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ _.extend(this, _.pick(options, 'tagCollection', 'enumDefCollection', 'model', 'tag', 'descriptionData', 'selectedTag', 'isNewNameSpace', 'isAttrEdit', 'entityDefCollection', 'typeHeaders', 'attrDetails'));
+ this.fromTable = this.isNewNameSpace ? true : false;
+ this.isEditAttr = this.isAttrEdit ? false : true;
+ if (this.model) {
+ this.description = this.model.get('description');
+ } else {
+ this.create = true;
+ }
+ if (!this.isNewNameSpace) {
+ this.collection = this.isAttrEdit ? new Backbone.Collection([{
+ "name": this.attrDetails.name,
+ "typeName": this.attrDetails.attrTypeName,
+ "isOptional": true,
+ "cardinality": "SINGLE",
+ "valuesMinCount": 0,
+ "valuesMaxCount": 1,
+ "isUnique": false,
+ "isIndexable": false
+ }]) : new Backbone.Collection([{
+ "name": "",
+ "typeName": "string",
+ "isOptional": true,
+ "cardinality": "SINGLE",
+ "valuesMinCount": 0,
+ "valuesMaxCount": 1,
+ "isUnique": false,
+ "isIndexable": false
+ }]);
+ } else {
+ this.collection = new Backbone.Collection();
+ }
+
+ },
+ bindEvents: function() {},
+ onRender: function() {
+ var that = this;
+ this.$('.fontLoader').show();
+ if (this.create) {
+ this.tagCollectionList();
+ } else {
+ this.ui.title.html('<span>' + _.escape(this.tag) + '</span>');
+ }
+ if (!('placeholder' in HTMLInputElement.prototype)) {
+ this.ui.createTagForm.find('input,textarea').placeholder();
+ }
+ if (this.isNewNameSpace == true) {
+ that.ui.namespaceAttrPageOk.text("Create");
+ that.ui.namespaceAttrPageOk.attr('data-action', 'newNamespace');
+ } else {
+ that.ui.namespaceAttrPageOk.text("Save");
+ that.ui.namespaceAttrPageOk.attr('data-action', 'attributeEdit');
+ }
+ this.hideLoader();
+ },
+ tagCollectionList: function() {
+ var that = this,
+ str = '';
+ this.tagCollection.fullCollection.each(function(val) {
+ var name = Utils.getName(val.toJSON());
+ str += '<option ' + (name == that.selectedTag ? 'selected' : '') + '>' + (name) + '</option>';
+ });
+ },
+ hideLoader: function() {
+ this.$('.fontLoader').hide();
+ this.$('.hide').removeClass('hide');
+ },
+ collectionAttribute: function() {
+ this.collection.add(new Backbone.Model({
+ "name": "",
+ "typeName": "string",
+ "isOptional": true,
+ "cardinality": "SINGLE",
+ "valuesMinCount": 0,
+ "valuesMaxCount": 1,
+ "isUnique": false,
+ "isIndexable": false
+ }));
+ },
+ onClickAddAttriBtn: function() {
+ this.collectionAttribute();
+ if (!('placeholder' in HTMLInputElement.prototype)) {
+ this.ui.addAttributeDiv.find('input,textarea').placeholder();
+ }
+
+ },
+ loaderStatus: function(isActive) {
+ var that = this;
+ if (isActive) {
+ parent.$('.namespace-attr-tableOverlay').show();
+ parent.$('.namespace-attr-fontLoader').show();
+ } else {
+ parent.$('.namespace-attr-tableOverlay').hide();
+ parent.$('.namespace-attr-fontLoader').hide();
+ }
+ },
+ validateValues: function() {
+ var attrNameValidate = true,
+ enumValue = true,
+ stringValidate = true,
+ enumType = true;
+
+ this.ui;
+ if (this.$el.find(".attributeInput").length > 0) {
+ this.$el.find(".attributeInput").each(function() {
+ if ($(this).val() === "") {
+ $(this).css("borderColor", "red");
+ attrNameValidate = false;
+ }
+ });
+ }
+ 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;
+ }
+ });
+ }
+ }
+ })
+ }
+ 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 (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) {
+ Utils.notifyInfo({
+ content: "Please enter the Enum values or select another type"
+ });
+ return true;
+ }
+ if (!stringValidate) {
+ Utils.notifyInfo({
+ content: "Please enter the Max Length for string or select another type"
+ });
+ return true;
+ }
+ },
+ onCreateNameSpace: function() {
+ var that = this,
+ validate = true,
+ attrNameValidate = true,
+ enumValue = true,
+ stringValidate = true,
+ isPutCall = false,
+ isPostCallEnum = false,
+ enumDefs = [],
+ putEnumDef = [];
+ this.checkLoader = 0;
+
+ if (this.validateValues()) {
+ return;
+ };
+ this.loaderStatus(true);
+ var name = this.ui.tagName.val(),
+ description = _.escape(this.ui.description.val());
+ var attributeObj = this.collection.toJSON();
+ if (this.collection.length === 1 && this.collection.first().get("name") === "") {
+ attributeObj = [];
+ }
+ if (attributeObj.length) {
+ _.each(attributeObj, function(obj) {
+ var isMultiCheck = obj.multiValueSelect;
+ obj.options = {
+ "applicableEntityTypes": JSON.stringify(that.$el.find(".entityTypeSelector").val()),
+ "maxStrLength": that.$el.find(".stringLengthVal").val() ? that.$el.find(".stringLengthVal").val() : "0"
+ };
+ if (obj.typeName != "string" && obj.typeName != "boolean" && obj.typeName != "byte" && obj.typeName != "short" && obj.typeName != "int" && obj.typeName != "float" && obj.typeName != "double" && obj.typeName != "long" && obj.typeName != "date") {
+ obj.typeName = obj.typeName;
+ var enumName = enumDefCollection.fullCollection.findWhere({ name: obj.typeName });
+ if (enumName) {
+ var enumDef = enumName.get('elementDefs');
+ if (enumDef.length === obj.enumValues.length) {
+ _.each(enumDef, function(enumVal, index) {
+ if (obj.enumValues.indexOf(enumVal.value) === -1) {
+ isPutCall = true;
+ };
+ })
+ } else {
+ isPutCall = true;
+ }
+ } else {
+ isPostCallEnum = true;
+ }
+ var elementValues = [];
+ _.each(obj.enumValues, function(inputEnumVal, index) {
+ elementValues.push({
+ "ordinal": index + 1,
+ "value": inputEnumVal
+ })
+ });
+ if (isPostCallEnum) {
+ enumDefs.push({
+ "name": obj.typeName,
+ "elementDefs": elementValues
+ })
+ }
+ if (isPutCall) {
+ putEnumDef.push({
+ "name": obj.typeName,
+ "elementDefs": elementValues
+ })
+ }
+ }
+ if (isMultiCheck) {
+ obj.multiValued = true;
+ if (obj.typeName == "string" || obj.typeName == "int" || obj.typeName == "float") {
+ obj.typeName = "array<" + obj.typeName + ">";
+ }
+ }
+ });
+ var notifyObj = {
+ modal: true,
+ confirm: {
+ confirm: true,
+ buttons: [{
+ text: "Ok",
+ addClass: "btn-atlas btn-md",
+ click: function(notice) {
+ notice.remove();
+ }
+ },
+ null
+ ]
+ }
+ };
+ }
+ this.json = {
+ "enumDefs": enumDefs,
+ "structDefs": [],
+ "classificationDefs": [],
+ "entityDefs": [],
+ "namespaceDefs": [{
+ "category": "NAMESPACE",
+ "createdBy": "admin",
+ "updatedBy": "admin",
+ "version": 1,
+ "typeVersion": "1.1",
+ "name": name.trim(),
+ "description": description.trim(),
+ "attributeDefs": attributeObj
+ }]
+ };
+
+ var apiObj = {
+ sort: false,
+ success: function(model, response) {
+ var nameSpaveDef = model.namespaceDefs;
+ if (nameSpaveDef) {
+ that.options.nameSpaceCollection.fullCollection.add(nameSpaveDef);
+ Utils.notifySuccess({
+ content: "Namespace " + name + Messages.getAbbreviationMsg(false, 'addSuccessMessage')
+ });
+ }
+ that.checkLoader--;
+ if (that.checkLoader == 0) {
+ that.options.onUpdateNamespace();
+ }
+ },
+ silent: true,
+ reset: true,
+ complete: function(model, status) {
+ that.loaderStatus(false);
+ }
+ }
+ that.checkLoader++;
+ $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.json) })
+ this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.nameSpaceApiUrl(), "POST", apiObj);
+ if (isPutCall) {
+ var putData = {
+ "enumDefs": putEnumDef
+ };
+ that.checkLoader++;
+ $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(putData) })
+ this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "PUT", apiObj);
+ }
+ },
+ onUpdateAttr: function() {
+ var that = this,
+ attrNameValidate = true,
+ enumValue = true,
+ stringValidate = true,
+ attributeDefs = that.options.selectedNamespace.get('attributeDefs'),
+ enumDefs = [],
+ postEnumDef = [],
+ isPutCall = false,
+ isPostCallEnum = false;
+ this.checkLoader = 0;
+ if (this.validateValues()) {
+ return;
+ };
+ if (this.$el.find(".namespace-attr").length > 0 && this.collection.length > 0) {
+
+ this.loaderStatus(true);
+ var attributeObj = this.collection.toJSON(),
+ name = this.collection.first().get("name"),
+ multipleName = '';
+ if (this.collection.length === 1 && this.collection.first().get("name") === "") {
+ attributeObj = [];
+ }
+ if (attributeObj.length > 0) {
+ _.each(attributeObj, function(obj) {
+ var isMultiCheck = obj.multiValueSelect;
+ multipleName += obj.name + ", ";
+ obj.options = {
+ "applicableEntityTypes": JSON.stringify(that.$el.find(".entityTypeSelector").val()),
+ "maxStrLength": that.$el.find(".stringLengthVal").val() ? that.$el.find(".stringLengthVal").val() : "0"
+ };
+ if (obj.typeName != "string" && obj.typeName != "boolean" && obj.typeName != "byte" && obj.typeName != "short" && obj.typeName != "int" && obj.typeName != "float" && obj.typeName != "double" && obj.typeName != "long" && obj.typeName != "date") {
+ var enumName = enumDefCollection.fullCollection.findWhere({ name: obj.typeName });
+ if (enumName) {
+ var enumDef = enumName.get('elementDefs');
+ if (enumDef.length === obj.enumValues.length) {
+ _.each(enumDef, function(enumVal, index) {
+ if (obj.enumValues.indexOf(enumVal.value) === -1) {
+ isPutCall = true;
+ };
+ })
+ } else {
+ isPutCall = true;
+ }
+ } else {
+ isPostCallEnum = true;
+ }
+ var elementValues = [];
+ _.each(obj.enumValues, function(inputEnumVal, index) {
+ elementValues.push({
+ "ordinal": index + 1,
+ "value": inputEnumVal
+ })
+ });
+ if (isPostCallEnum) {
+ postEnumDef.push({
+ "name": obj.typeName,
+ "elementDefs": elementValues
+ })
+
+ } else if (isPutCall) {
+ enumDefs.push({
+ "name": obj.typeName,
+ "elementDefs": elementValues
+ })
+ }
+ }
+ if (isMultiCheck) {
+ obj.multiValued = true;
+ if (obj.typeName == "string" || obj.typeName == "int" || obj.typeName == "float") {
+ obj.typeName = "array<" + obj.typeName + ">";
+ }
+ }
+
+ });
+ var notifyObj = {
+ modal: true,
+ confirm: {
+ confirm: true,
+ buttons: [{
+ text: "Ok",
+ addClass: "btn-atlas btn-md",
+ click: function(notice) {
+ notice.remove();
+ }
+ },
+ null
+ ]
+ }
+ };
+ if (that.options.isNewAttr == true) {
+ _.each(attributeObj, function(obj) {
+ attributeDefs.push(obj);
+ })
+ } else {
+ var selectedNamespaceUpdateCopy = that.options.selectedNamespace;
+ var attrDef = selectedNamespaceUpdateCopy.toJSON().attributeDefs;
+ _.each(attrDef, function(attrObj) {
+ if (attrObj.name === that.$el.find(".attributeInput")[0].value) {
+ attrObj.name = attributeObj[0].name;
+ attrObj.typeName = attributeObj[0].typeName;
+ attrObj.multiValued = attributeObj[0].multiValueSelect || false;
+ attrObj.options.applicableEntityTypes = attributeObj[0].options.applicableEntityTypes;
+ attrObj.enumValues = attributeObj[0].enumValues;
+ attrObj.options.maxStrLength = attributeObj[0].options.maxStrLength;
+ }
+ });
+ }
+ var putNameSpace = function() {
+ that.checkLoader++;
+ $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(that.json) })
+ that.options.nameSpaceCollection.constructor.nonCrudOperation.call(that, UrlLinks.nameSpaceUpdateUrl(), "PUT", apiObj);
+ }
+ this.json = {
+ "enumDefs": enumDefs,
+ "structDefs": [],
+ "classificationDefs": [],
+ "entityDefs": [],
+ "namespaceDefs": that.options.isNewAttr ? [that.options.selectedNamespace.toJSON()] : [selectedNamespaceUpdateCopy.toJSON()]
+ };
+ var apiObj = {
+ sort: false,
+ success: function(model, response) {
+ if (model.namespaceDefs.length === 0 && model.enumDefs.length) {
+ putNameSpace();
+ } else {
+ var selectedNameSpace = that.options.nameSpaceCollection.fullCollection.findWhere({ guid: that.options.guid });
+ Utils.notifySuccess({
+ content: "One or more Namespace attribute" + Messages.getAbbreviationMsg(false, 'editSuccessMessage')
+ });
+ if (model.namespaceDefs && model.namespaceDefs.length) {
+ that.options.selectedNamespace.set(model.namespaceDefs[0]);
+ }
+ that.options.onEditCallback();
+ }
+ that.checkLoader--;
+ if (that.checkLoader == 0) {
+ that.options.onUpdateNamespace();
+ }
+
+ },
+ silent: true,
+ reset: true,
+ complete: function(model, status) {
+ that.loaderStatus(false);
+ }
+ }
+ if (isPostCallEnum) {
+ var postData = {
+ "enumDefs": postEnumDef
+ };
+ this.checkLoader++;
+ $.extend(apiObj, { contentType: 'application/json', dataType: 'json', data: JSON.stringify(postData) })
+ this.options.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "POST", apiObj);
+ } else {
+ putNameSpace();
+ }
+ }
+ } else {
+ Utils.notifySuccess({
+ content: "No attribute updated"
+ });
+ this.loaderStatus(false);
+ that.options.onUpdateNamespace();
+ }
+ }
+ });
+ return CreateNameSpaceLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js b/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
new file mode 100644
index 0000000..bf8dd2e
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/EnumCreateUpdateItemView.js
@@ -0,0 +1,256 @@
+/*
+ * 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/name_space/EnumCreateUpdateItemView_tmpl", "utils/Utils", "utils/UrlLinks", "utils/Messages"], function(
+ require,
+ Backbone,
+ EnumCreateUpdateItemViewTmpl,
+ Utils,
+ UrlLinks,
+ Messages
+) {
+ "use strict";
+
+ return Backbone.Marionette.ItemView.extend(
+ /** @lends GlobalExclusionListView */
+ {
+ template: EnumCreateUpdateItemViewTmpl,
+
+ /** Layout sub regions */
+ regions: {},
+
+ /** ui selector cache */
+ ui: {
+ enumTypeSelectorContainer: "[data-id='enumTypeSelectorContainer']",
+ enumSelector: "[data-id='enumSelector']",
+ enumValueSelectorContainer: "[data-id='enumValueSelectorContainer']",
+ valueSelector: "[data-id='valueSelector']",
+ enumCancleBtn: "[data-id='enumCancleBtn']",
+ enumOkBtn: "[data-id='enumOkBtn']"
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {};
+ events["change " + this.ui.enumSelector] = function(e) {
+ this.model.set({ enumValues: e.target.value.trim() });
+ };
+ events["change " + this.ui.enumSelector] = function(e) {
+ var emumValue = this.ui.enumSelector.select2("data")[0] ?
+ this.ui.enumSelector.select2("data")[0].text :
+ this.ui.enumSelector.val();
+ if (emumValue == "" || emumValue == null) {
+ this.ui.enumValueSelectorContainer.hide();
+ } else {
+ this.ui.enumValueSelectorContainer.show();
+ this.showEnumValues(emumValue);
+ }
+ };
+ events["change " + this.ui.valueSelector] = function(e) {};
+ events["click " + this.ui.enumCancleBtn] = function(e) {
+ if (this.options.closeModal) {
+ this.options.closeModal();
+ return;
+ }
+ this.ui.enumValueSelectorContainer.hide();
+ this.ui.enumSelector.val("").trigger("change");
+ this.ui.enumCancleBtn.attr("disabled", "true");
+ };
+ events["click " + this.ui.enumOkBtn] = function(e) {
+ this.onUpdateEnum();
+ };
+ return events;
+ },
+
+ /**
+ * intialize a new GlobalExclusionComponentView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ this.enumDefCollection = options.enumDefCollection;
+ this.nameSpaceCollection = options.nameSpaceCollection;
+ },
+ onRender: function() {
+ var that = this,
+ entitytypes = "",
+ enumTypes = [];
+ this.ui.enumValueSelectorContainer.hide();
+ this.emumTypeSelectDisplay();
+ if (!this.options.closeModal) {
+ this.ui.enumCancleBtn.attr("disabled", "true");
+ this.ui.enumCancleBtn.text("Clear");
+ }
+ },
+ showEnumValues: function(enumName) {
+ var enumValues = "",
+ selectedValues = [],
+ selectedEnum = this.enumDefCollection.fullCollection.findWhere({ name: enumName }),
+ selectedEnumValues = selectedEnum ? selectedEnum.get("elementDefs") : null,
+ savedValues = [];
+ _.each(selectedEnumValues, function(enumVal, index) {
+ selectedValues.push(_.unescape(enumVal.value));
+ enumValues += "<option>" + enumVal.value + "</option>";
+ });
+
+ this.ui.enumCancleBtn.removeAttr("disabled");
+ this.ui.valueSelector.empty();
+ this.ui.valueSelector.append(enumValues);
+ this.ui.valueSelector.val(selectedValues);
+ this.ui.valueSelector.select2({
+ placeholder: "Select Enum value",
+ allowClear: false,
+ tags: true,
+ multiple: true
+ });
+ },
+ emumTypeSelectDisplay: function() {
+ var enumTypes = "";
+ this.enumDefCollection.fullCollection.each(function(model, index) {
+ enumTypes += "<option>" + _.escape(model.get("name")) + "</option>";
+ });
+ this.ui.enumSelector.empty();
+ this.ui.enumSelector.append(enumTypes);
+ this.ui.enumSelector.val("");
+ this.ui.enumSelector.select2({
+ placeholder: "Select Enum name",
+ tags: true,
+ allowClear: true,
+ multiple: false,
+ templateResult: this.formatSearchResult
+ });
+ },
+ formatSearchResult: function(state) {
+ if (!state.id) {
+ return state.text;
+ }
+ if (!state.element) {
+ return $("<span>Create new enum : <strong> " + _.escape(state.text) + "</strong></span>");
+ } else {
+ return $("<span>" + _.escape(state.text) + "</span>");
+ }
+ },
+ validationEnum: function() {
+ var selectedEnumName = this.ui.enumSelector.val(),
+ selectedEnumValues = this.ui.valueSelector.val();
+
+ if (selectedEnumName == "" || selectedEnumName == null) {
+ this.ui.enumOkBtn.removeAttr("disabled");
+ Utils.notifyInfo({
+ content: "Please enter the Enumeration Name"
+ });
+ return true;
+ }
+ if (selectedEnumValues == "" || selectedEnumValues == null) {
+ this.ui.enumOkBtn.removeAttr("disabled");
+ Utils.notifyInfo({
+ content: "Please enter the Enum values"
+ });
+ return true;
+ }
+ },
+ onUpdateEnum: function(view, modal) {
+ var that = this,
+ selectedEnumName = this.ui.enumSelector.val(),
+ selectedEnumValues = this.ui.valueSelector.val(),
+ enumName = this.enumDefCollection.fullCollection.findWhere({ name: selectedEnumName }),
+ isPutCall = false,
+ isPostCallEnum = false,
+ enumDefs = [];
+ if (this.validationEnum()) {
+ return;
+ }
+ this.ui.enumOkBtn.attr("disabled", "true");
+ if (enumName) {
+ var enumDef = enumName.get("elementDefs");
+ if (enumDef.length === selectedEnumValues.length) {
+ _.each(enumDef, function(enumVal, index) {
+ if (selectedEnumValues.indexOf(enumVal.value) === -1) {
+ isPutCall = true;
+ }
+ });
+ } else {
+ isPutCall = true;
+ }
+ } else {
+ isPostCallEnum = true;
+ }
+ var elementValues = [];
+ _.each(selectedEnumValues, function(inputEnumVal, index) {
+ elementValues.push({
+ ordinal: index + 1,
+ value: _.escape(inputEnumVal)
+ });
+ });
+
+ enumDefs.push({
+ name: selectedEnumName,
+ elementDefs: elementValues
+ });
+
+ this.json = {
+ enumDefs: enumDefs
+ };
+ var apiObj = {
+ sort: false,
+ success: function(model, response) {
+ that.ui.enumValueSelectorContainer.hide();
+ if (isPostCallEnum) {
+ that.enumDefCollection.add(model.enumDefs[0]);
+ Utils.notifySuccess({
+ content: "Enumeration " + selectedEnumName + " added successfully"
+ });
+ } else {
+ var foundEnum = that.enumDefCollection.fullCollection.find({ guid: model.enumDefs[0].guid })
+ if (foundEnum) {
+ foundEnum.set(model.enumDefs[0]);
+ }
+ Utils.notifySuccess({
+ content: "Enumeration " + selectedEnumName + " updated successfully"
+ });
+ }
+ if (that.options.onUpdateEnum) {
+ that.options.onUpdateEnum();
+ }
+ that.ui.enumCancleBtn.attr("disabled", "true");
+ },
+ silent: true,
+ reset: true,
+ complete: function(model, status) {
+ that.emumTypeSelectDisplay();
+ that.ui.enumOkBtn.removeAttr("disabled");
+ if (that.options.closeModal) {
+ that.options.closeModal();
+ }
+ }
+ };
+ $.extend(apiObj, { contentType: "application/json", dataType: "json", data: JSON.stringify(this.json) });
+ if (isPostCallEnum) {
+ this.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "POST", apiObj);
+ } else if (isPutCall) {
+ this.nameSpaceCollection.constructor.nonCrudOperation.call(this, UrlLinks.typedefsUrl().defs, "PUT", apiObj);
+ } else {
+ Utils.notifySuccess({
+ content: "No updated values"
+ });
+ that.ui.enumOkBtn.removeAttr("disabled");
+ if (that.options.closeModal) {
+ that.options.closeModal();
+ }
+ }
+ }
+ }
+ );
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js
new file mode 100644
index 0000000..218f9c5
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/NameSpaceAttrTableLayoutView.js
@@ -0,0 +1,232 @@
+/**
+ * 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/name_space/NameSpaceAttrTableLayoutView_tmpl',
+ 'collection/VEntityList',
+ 'collection/VTagList',
+ 'models/VSearch',
+ 'utils/Utils',
+ 'utils/Messages',
+ 'utils/Enums',
+ 'utils/UrlLinks',
+ 'utils/CommonViewFunction'
+], function(require, Backbone, NameSpaceAttrTableLayoutView_tmpl, VEntityList, VTagList, VSearch, Utils, Messages, Enums, UrlLinks, CommonViewFunction) {
+ 'use strict';
+
+ var NameSpaceAttrTableLayoutView = Backbone.Marionette.LayoutView.extend(
+ /** @lends NameSpaceAttrTableLayoutView */
+ {
+ _viewName: 'NameSpaceAttrTableLayoutView',
+
+ template: NameSpaceAttrTableLayoutView_tmpl,
+
+ /** Layout sub regions */
+ regions: {
+ RNameSpaceAttrTableLayoutView: "#r_nameSpaceAttrTableLayoutView",
+ RModal: "#r_modal"
+ },
+
+ /** ui selector cache */
+ ui: {
+ attributeEdit: "[data-id='attributeEdit']",
+ addAttribute: '[data-id="addAttribute"]',
+ namespaceAttrPage: "[data-id='namespaceAttrPage']",
+ namespaceAttrPageTitle: "[data-id='namespaceAttrPageTitle']",
+ namespaceDetailPage: "[data-id='namespaceDetailPage']",
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {};
+ events["click " + this.ui.attributeEdit] = "onEditAttr";
+ events["click " + this.ui.addAttribute] = "onEditAttr";
+ return events;
+ },
+ /**
+ * intialize a new NameSpaceAttrTableLayoutView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr'));
+ this.commonTableOptions = {
+ collection: this.nameSpaceAttr,
+ 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.isFilters = null;
+ this.showDetails = true;
+ },
+ onRender: function() {
+ this.toggleNamespaceDetailsAttrView();
+ if (this.nameSpaceCollection.models.length && !this.model) {
+ this.model = this.nameSpaceCollection.fullCollection.findWhere({ guid: this.guid });
+ Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.tagDetail'));
+ this.renderTableLayoutView();
+ }
+ },
+ bindEvents: function() {},
+ toggleNamespaceDetailsAttrView: function() {
+ var that = this;
+ if (that.showDetails) {
+ that.ui.namespaceAttrPage.hide();
+ that.ui.namespaceDetailPage.show();
+ } else {
+ that.ui.namespaceAttrPage.show();
+ that.ui.namespaceDetailPage.hide();
+ }
+ },
+ onEditAttr: function(e) {
+ var that = this,
+ isAttrEdit = false,
+ selectedNamespace = that.nameSpaceCollection.fullCollection.findWhere({ guid: that.guid }),
+ attrributes = selectedNamespace ? selectedNamespace.get('attributeDefs') : null,
+ attrName = e.target.dataset.name ? e.target.dataset.name : null,
+ attrDetails = { name: attrName };
+ if (e.target.dataset.action == 'attributeEdit') {
+ isAttrEdit = true
+ }
+ if (selectedNamespace) {
+ that.newAttr = isAttrEdit ? false : true;
+ _.each(attrributes, function(attrObj) {
+ if (attrObj.name === attrName) {
+ attrDetails.attrTypeName = attrObj.typeName;
+ if (attrObj.typeName.includes('array')) {
+ attrDetails.attrTypeName = attrObj.typeName.replace("array<", "").replace(">", "");
+ attrDetails.multiValued = true;
+ }
+ attrDetails.attrEntityType = attrObj.options && attrObj.options.applicableEntityTypes ? JSON.parse(attrObj.options.applicableEntityTypes) : null;
+ attrDetails.maxStrLength = attrObj.options && attrObj.options.maxStrLength ? attrObj.options.maxStrLength : null;
+ attrDetails.enumValues = attrObj.enumValues ? attrObj.enumValues : null;
+ }
+ });
+ this.showDetails = false;
+ that.toggleNamespaceDetailsAttrView();
+ require(["views/name_space/CreateNameSpaceLayoutView"], function(CreateNameSpaceLayoutView) {
+ that.view = new CreateNameSpaceLayoutView({
+ onEditCallback: function() {
+ enumDefCollection.fetch({ reset: true });
+ that.nameSpaceAttr.fullCollection.reset();
+ that.options.selectedNameSpace.fetch({
+ skipDefaultError: true,
+ complete: function(model, status) {
+ that.nameSpaceAttr.fullCollection.add(model.responseJSON.attributeDefs);
+ }
+ });
+ },
+ onUpdateNamespace: function() {
+ that.renderTableLayoutView();
+ that.showDetails = true;
+ that.toggleNamespaceDetailsAttrView();
+ },
+ parent: that.$el,
+ tagCollection: that.nameSpaceCollection,
+ enumDefCollection: enumDefCollection,
+ isAttrEdit: isAttrEdit,
+ attrDetails: attrDetails,
+ typeHeaders: typeHeaders,
+ selectedNamespace: selectedNamespace,
+ nameSpaceCollection: nameSpaceCollection,
+ guid: that.guid,
+ isNewAttr: that.newAttr
+ });
+ if (isAttrEdit) {
+ that.ui.namespaceAttrPageTitle.text("Update Attribute of: " + selectedNamespace.get('name'));
+ } else {
+ that.ui.namespaceAttrPageTitle.text("Add Namespace Attribute for: " + selectedNamespace.get('name'));
+ }
+ that.RModal.show(that.view);
+ });
+ }
+
+ },
+ renderTableLayoutView: function() {
+ var that = this;
+ require(['utils/TableLayout'], function(TableLayout) {
+ var cols = new Backgrid.Columns(that.getNamespaceTableColumns());
+ that.RNameSpaceAttrTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
+ columns: cols
+ })));
+ if (!(that.nameSpaceAttr.models.length < that.limit)) {
+ // that.RNameSpaceAttrTableLayoutView.$el.find('table tr').last().hide();
+ }
+ });
+ },
+ getNamespaceTableColumns: function() {
+ var that = this;
+ return this.nameSpaceAttr.constructor.getTableCols({
+ name: {
+ label: "Attribute Name",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return model.get('name');
+ }
+ })
+ },
+ typeName: {
+ label: "typeName",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return model.get('typeName');
+ }
+ })
+ },
+ options: {
+ label: "Entity Type(s)",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ var applicableEntityTypes = '',
+ attrEntityTypes = JSON.parse(model.get('options').applicableEntityTypes);
+ _.each(attrEntityTypes, function(values) {
+ applicableEntityTypes += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + values + '</label>';
+ });
+ return applicableEntityTypes;
+ }
+ })
+ },
+ tool: {
+ label: "Action",
+ cell: "html",
+ editable: false,
+ sortable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return '<div class="btn btn-action btn-sm" data-id="attributeEdit" data-action="attributeEdit" data-name="' + model.get('name') + '">Edit</div>';
+ }
+ })
+ }
+ }, this.nameSpaceAttr);
+ }
+ });
+return NameSpaceAttrTableLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js b/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
new file mode 100644
index 0000000..ce99726
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/NameSpaceAttributeItemView.js
@@ -0,0 +1,266 @@
+/*
+ * 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/name_space/NameSpaceAttributeItemView_tmpl',
+ 'utils/Utils',
+ 'utils/UrlLinks',
+ 'utils/Messages'
+
+], function(require, Backbone, NameSpaceAttributeItemViewTmpl, Utils, UrlLinks, Messages) {
+ 'use strict';
+
+ return Backbone.Marionette.ItemView.extend(
+ /** @lends GlobalExclusionListView */
+ {
+
+ template: NameSpaceAttributeItemViewTmpl,
+
+ /** Layout sub regions */
+ regions: {},
+
+ /** ui selector cache */
+ ui: {
+ attributeInput: "[data-id='attributeInput']",
+ close: "[data-id='close']",
+ dataTypeSelector: "[data-id='dataTypeSelector']",
+ entityTypeSelector: "[data-id='entityTypeSelector']",
+ enumTypeSelectorContainer: "[data-id='enumTypeSelectorContainer']",
+ enumTypeSelector: "[data-id='enumTypeSelector']",
+ enumValueSelectorContainer: "[data-id='enumValueSelectorContainer']",
+ enumValueSelector: "[data-id='enumValueSelector']",
+ multiValueSelect: "[data-id='multiValueSelect']",
+ multiValueSelectStatus: "[data-id='multiValueSelectStatus']",
+ stringLengthContainer: "[data-id='stringLengthContainer']",
+ stringLengthValue: "[data-id='stringLength']",
+ createNewEnum: "[data-id='createNewEnum']"
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {};
+ events["keyup " + this.ui.attributeInput] = function(e) {
+ this.model.set({ "name": e.target.value.trim() });
+ };
+ events["change " + this.ui.dataTypeSelector] = function(e) {
+ //this.ui.multiValueSelect.hide();
+ if (e.target.value.trim() === 'enumeration' || e.target.value.trim() === 'Enumeration') {
+ // this.model.set({ "typeName": "enum" });
+ this.ui.enumTypeSelectorContainer.show();
+ this.emumTypeSelectDisplay();
+ this.ui.stringLengthContainer.hide();
+ } else if (e.target.value.trim() === 'string' || e.target.value.trim() === 'String') {
+ this.model.set({ "typeName": e.target.value.trim() });
+ this.model.set({ "enumValues": null });
+ this.ui.stringLengthContainer.show();
+ //this.ui.multiValueSelect.show();
+ this.ui.enumTypeSelectorContainer.hide();
+ this.ui.enumValueSelectorContainer.hide();
+ } else {
+ // if (e.target.value.trim() === 'int' || e.target.value.trim() === 'float') {
+ // this.ui.multiValueSelect.show();
+ // }
+ this.model.set({ "typeName": e.target.value.trim() });
+ this.model.set({ "enumValues": null });
+ this.ui.enumTypeSelectorContainer.hide();
+ this.ui.enumValueSelectorContainer.hide();
+ this.ui.stringLengthContainer.hide();
+ }
+ };
+ events["change " + this.ui.enumTypeSelector] = function(e) {
+ this.model.set({ "enumValues": e.target.value.trim() });
+ };
+ events["change " + this.ui.stringLengthContainer] = function(e) {
+ this.model.set({ "maxStrLength": e.target.value.trim() });
+ };
+ events["change " + this.ui.enumTypeSelector] = function(e) {
+ var emumValue = this.ui.enumTypeSelector.select2('data')[0] ? this.ui.enumTypeSelector.select2('data')[0].text : this.ui.enumTypeSelector.val();
+
+ this.model.set({ "typeName": emumValue });
+ if (emumValue == '' || emumValue == null) {
+ this.ui.enumValueSelectorContainer.hide();
+ } else {
+ this.ui.enumValueSelectorContainer.show();
+ this.showEnumValues(_.escape(emumValue));
+ }
+ };
+ events["change " + this.ui.enumValueSelector] = function(e) {
+ this.model.set({ "enumValues": this.ui.enumValueSelector.val() });
+ };
+ // events["change " + this.ui.multiValueSelectStatus] = function(e) {
+ // this.model.set({ "multiValueSelect": e.target.checked });
+ // };
+ events["click " + this.ui.close] = 'onCloseButton';
+ events["click " + this.ui.createNewEnum] = 'onCreateUpdateEnum';
+ return events;
+ },
+
+ /**
+ * intialize a new GlobalExclusionComponentView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ this.parentView = options.parentView;
+
+ },
+ onRender: function() {
+ var that = this,
+ entitytypes = '',
+ enumTypes = [];
+ this.parentView.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>';
+ }
+ });
+ this.ui.entityTypeSelector.select2({
+ placeholder: "Select Entity type",
+ allowClear: true,
+ multiple: true,
+ selectionAdapter: $.fn.select2.amd.require("TagHideDeleteButtonAdapter")
+ });
+ this.ui.entityTypeSelector.html(entitytypes);
+
+ this.ui.entityTypeSelector.on('select2:open', function(e) { // to make selected option disable in dropdown added remove-from-list class
+ $('.select2-dropdown--below').addClass('remove-from-list');
+ });
+ this.ui.stringLengthValue.val('50'); //default length for string is 50
+ this.ui.enumValueSelector.attr("disabled", "false"); // cannot edit the values
+ this.emumTypeSelectDisplay();
+ this.ui.enumTypeSelectorContainer.hide();
+ this.ui.enumValueSelectorContainer.hide();
+ if (this.parentView.isAttrEdit) {
+ this.ui.close.hide();
+ this.ui.createNewEnum.hide(); // cannot add new namespace on edit view
+ this.ui.attributeInput.val(this.parentView.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.stringLengthContainer.show();
+ this.ui.stringLengthValue.val(this.parentView.attrDetails.maxStrLength);
+ } else {
+ this.ui.stringLengthContainer.hide();
+ }
+
+ _.each(this.parentView.attrDetails.attrEntityType, function(valName) {
+ that.ui.entityTypeSelector.find('option').each(function(o) {
+ var $el = $(this)
+ if ($el.data("name") === valName) {
+ $el.attr("data-allowremove", "false");
+ }
+ })
+ });
+ this.ui.entityTypeSelector.val(this.parentView.attrDetails.attrEntityType).trigger('change');
+ if (this.parentView.attrDetails && this.parentView.attrDetails.attrTypeName) {
+ var typeName = this.parentView.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.multiValued) {
+ // this.ui.multiValueSelect.show();
+ // $(this.ui.multiValueSelectStatus).prop('checked', true).trigger('change');
+ // this.ui.multiValueSelectStatus.attr("disabled", "false");
+ // }
+ }
+ },
+ showEnumValues: function(enumName) {
+ var enumValues = '',
+ selectedValues = [],
+ selectedEnum = this.parentView.enumDefCollection.fullCollection.findWhere({ name: enumName }),
+ selectedEnumValues = selectedEnum ? selectedEnum.get('elementDefs') : null,
+ savedValues = [];
+ _.each(selectedEnumValues, function(enumVal, index) {
+ selectedValues.push(_.unescape(enumVal.value));
+ enumValues += "<option>" + enumVal.value + "</option>";
+ });
+ this.ui.enumValueSelector.empty();
+ this.ui.enumValueSelector.append(enumValues);
+ this.ui.enumValueSelector.val(selectedValues);
+ this.ui.enumValueSelector.select2({
+ placeholder: "Select Enum value",
+ allowClear: false,
+ tags: false,
+ multiple: true
+ });
+ this.model.set({ "enumValues": this.ui.enumValueSelector.val() });
+ },
+ emumTypeSelectDisplay: function() {
+ var enumTypes = '';
+ this.parentView.enumDefCollection.fullCollection.each(function(model, index) {
+ enumTypes += "<option>" + _.escape(model.get('name')) + "</option>";
+ });
+ this.ui.enumTypeSelector.empty();
+ this.ui.enumTypeSelector.append(enumTypes);
+ this.ui.enumTypeSelector.val('');
+ this.ui.enumTypeSelector.select2({
+ placeholder: "Select Enum name",
+ tags: false,
+ allowClear: true,
+ multiple: false
+ });
+ },
+ onCreateUpdateEnum: function(e) {
+ var that = this;
+ require(["views/name_space/EnumCreateUpdateItemView", "modules/Modal"], function(EnumCreateUpdateItemView, Modal) {
+ var view = new EnumCreateUpdateItemView({
+ onUpdateEnum: function() {
+ that.ui.enumValueSelectorContainer.hide();
+ that.emumTypeSelectDisplay();
+ that.ui.enumValueSelector.empty();
+ },
+ closeModal: function() {
+ modal.trigger("cancel");
+ that.parentView.enumDefCollection.fetch({
+ success: function() {
+ that.ui.enumTypeSelector.val(that.model.get('typeName')).trigger('change');
+ }
+ });
+ },
+ enumDefCollection: that.parentView.enumDefCollection,
+ nameSpaceCollection: that.parentView.options.nameSpaceCollection
+ }),
+ modal = new Modal({
+ title: "Create/ Update Enum",
+ content: view,
+ cancelText: "Cancel",
+ okCloses: false,
+ okText: "Update",
+ allowCancel: true,
+ showFooter: false
+ }).open();
+ modal.on('closeModal', function() {
+ modal.trigger('cancel');
+ });
+ });
+ },
+ onCloseButton: function() {
+ var tagName = this.parentView.$el.find('[data-id="tagName"]').val();
+ if (this.parentView.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");
+ }
+ }
+ });
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js
new file mode 100644
index 0000000..3874a8d
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/NameSpaceContainerLayoutView.js
@@ -0,0 +1,117 @@
+/**
+ * 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/name_space/NameSpaceContainerLayoutView_tmpl",
+ 'collection/VEntityList',
+ "utils/Utils",
+ "utils/Messages",
+ "utils/Globals",
+ "utils/UrlLinks",
+ "models/VTag"
+], function(require, Backbone, NameSpaceContainerLayoutViewTmpl, VEntityList, Utils, Messages, Globals, UrlLinks, VTag) {
+ "use strict";
+
+ var NameSpaceContainerLayoutView = Backbone.Marionette.LayoutView.extend(
+ /** @lends NameSpaceContainerLayoutView */
+ {
+ _viewName: "NameSpaceContainerLayoutView",
+
+ template: NameSpaceContainerLayoutViewTmpl,
+
+ /** Layout sub regions */
+ regions: {
+ RNameSpaceDetailContainer: "#r_nameSpaceDetailContainer",
+ RNameSpaceAttrContainer: "#r_nameSpaceAttrContainer"
+ },
+
+ /** ui selector cache */
+ ui: {},
+ /** ui events hash */
+ events: function() {},
+ /**
+ * intialize a new TagLayoutView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ _.extend(this.options, options);
+ this.selectedNameSpace = new VEntityList();
+ this.selectedNameSpace.url = UrlLinks.nameSpaceGuidApiUrl(this.options.namespaceID);
+ this.nameSpaceAttr = new VEntityList();
+ },
+ bindEvents: function() {},
+ onRender: function() {
+ this.fetchNameSpaceGuid();
+ this.options.nameSpaceCollection.fullCollection.sort({ silent: true });
+ this.options.nameSpaceCollection.comparator = function(model) {
+ return -model.get('timestamp');
+ }
+ this.renderNameSpaceDetailLayoutView(this.options);
+ this.renderNameSpaceAttrLayoutView(this.options);
+ },
+ fetchNameSpaceGuid: function() {
+ var that = this;
+ this.selectedNameSpace.fetch({
+ skipDefaultError: true,
+ complete: function(model, status) {
+ that.nameSpaceAttr.fullCollection.add(model.responseJSON.attributeDefs);
+ }
+ });
+ },
+ renderNameSpaceDetailLayoutView: function(options) {
+ var that = this;
+ require(["views/name_space/NameSpaceDetailLayoutView"], function(NameSpaceDetailLayoutView) {
+ if (that.isDestroyed) {
+ return;
+ }
+ that.RNameSpaceDetailContainer.show(
+ new NameSpaceDetailLayoutView({
+ nameSpaceVent: that.options.nameSpaceVent,
+ nameSpaceCollection: that.options.nameSpaceCollection,
+ nameSpaceAttr: that.nameSpaceAttr,
+ guid: that.options.namespaceID,
+ enumDefCollection: that.enumDefCollection,
+ typeHeaders: that.typeHeaders
+ })
+ );
+ });
+ },
+ renderNameSpaceAttrLayoutView: function(options) {
+ var that = this;
+ require(['views/name_space/NameSpaceAttrTableLayoutView'], function(NameSpaceAttrTableLayoutView) {
+ if (that.isDestroyed) {
+ return;
+ }
+ that.RNameSpaceAttrContainer.show(
+ new NameSpaceAttrTableLayoutView({
+ nameSpaceVent: that.options.nameSpaceVent,
+ nameSpaceCollection: that.options.nameSpaceCollection,
+ nameSpaceAttr: that.nameSpaceAttr,
+ guid: that.options.namespaceID,
+ typeHeaders: that.typeHeaders,
+ enumDefCollection: that.enumDefCollection,
+ selectedNameSpace:that.selectedNameSpace
+ }));
+ });
+ }
+ }
+ );
+ return NameSpaceContainerLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceDetailLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceDetailLayoutView.js
new file mode 100644
index 0000000..59f3b94
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/NameSpaceDetailLayoutView.js
@@ -0,0 +1,110 @@
+/**
+ * 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/name_space/NameSpaceDetailLayoutView_tmpl',
+ 'utils/Utils',
+ 'views/tag/AddTagAttributeView',
+ 'collection/VTagList',
+ 'models/VTag',
+ 'utils/Messages',
+ 'utils/UrlLinks',
+ "utils/Globals",
+], function(require, Backbone, NameSpaceDetailLayoutViewTmpl, Utils, AddTagAttributeView, VTagList, VTag, Messages, UrlLinks, Globals) {
+ 'use strict';
+
+ var NameSpaceDetailLayoutView = Backbone.Marionette.LayoutView.extend(
+ /** @lends NameSpaceDetailLayoutView */
+ {
+ template: NameSpaceDetailLayoutViewTmpl,
+ /** Layout sub regions */
+ regions: {},
+ /** 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 */
+ events: function() {
+ var events = {};
+ events["click " + this.ui.backButton] = function() {
+ Utils.backButtonClick();
+ };
+ return events;
+ },
+ /**
+ * intialize a new NameSpaceDetailLayoutView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'enumDefCollection', 'typeHeaders', 'nameSpaceCollection', 'selectedNameSpace', 'nameSpaceAttr'));
+
+ },
+ bindEvents: function() {
+ this.listenTo(this.nameSpaceCollection, 'reset', function() {
+ if (!this.model) {
+ this.model = this.nameSpaceCollection.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);
+ },
+ onRender: function() {
+ if (this.nameSpaceCollection.models.length && !this.model) {
+ this.model = this.nameSpaceCollection.fullCollection.findWhere({ guid: this.guid });
+ Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.tagDetail'));
+ this.renderTagDetail();
+ }
+ this.bindEvents();
+ },
+ renderTagDetail: function() {
+ var that = this,
+ attributeData = "";
+ this.attributeDefs = this.model.get('attributeDefs');
+ this.ui.title.html('<span>' + that.model.get('name') + '</span>');
+ if (that.model.get('description')) {
+ this.ui.description.text((that.model.get('description')));
+ }
+ Utils.hideTitleLoader(this.$('.fontLoader'), this.$('.tagDetail'));
+ }
+ });
+ return NameSpaceDetailLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js b/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
new file mode 100644
index 0000000..c852cf8
--- /dev/null
+++ b/dashboardv3/public/js/views/name_space/NameSpaceTableLayoutView.js
@@ -0,0 +1,419 @@
+/**
+ * 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/name_space/NameSpaceTableLayoutView_tmpl',
+ 'collection/VEntityList',
+ 'collection/VTagList',
+ 'models/VSearch',
+ 'utils/Utils',
+ 'utils/Messages',
+ 'utils/Enums',
+ 'utils/UrlLinks',
+ 'utils/CommonViewFunction'
+], function(require, Backbone, NameSpaceTableLayoutView_tmpl, VEntityList, VTagList, VSearch, Utils, Messages, Enums, UrlLinks, CommonViewFunction) {
+ 'use strict';
+
+ var NameSpaceTableLayoutView = Backbone.Marionette.LayoutView.extend(
+ /** @lends NameSpaceTableLayoutView */
+ {
+ _viewName: 'NameSpaceTableLayoutView',
+
+ template: NameSpaceTableLayoutView_tmpl,
+
+ /** Layout sub regions */
+ regions: {
+ RNameSpaceTableLayoutView: "#r_nameSpaceTableLayoutView",
+ RModal: "#r_modal"
+ },
+
+ /** ui selector cache */
+ ui: {
+ namespaceAttrPage: "[data-id='namespaceAttrPage']",
+ namespaceAttrPageTitle: "[data-id='namespaceAttrPageTitle']",
+ namespaceDetailPage: "[data-id='namespaceDetailPage']",
+ auditCreate: "[data-id='auditCreate']",
+ pageRecordText: "[data-id='pageRecordText']",
+ activePage: "[data-id='activePage']",
+ createNameSpace: "[data-id='createNameSpace']",
+ attributeEdit: "[data-id='attributeEdit']",
+ addAttribute: '[data-id="addAttribute"]',
+ namespaceAttrPageOk: '[data-id="namespaceAttrPageOk"]',
+ colManager: "[data-id='colManager']",
+ deleteNamespace: '[data-id="deleteNamespace"]',
+ namespaceAttrFontLoader: '.namespace-attr-fontLoader',
+ namespaceAttrTableOverlay: '.namespace-attr-tableOverlay'
+
+ },
+ /** ui events hash */
+ events: function() {
+ var events = {},
+ that = this;
+ events["click " + this.ui.createNameSpace] = "onClickCreateNamespace";
+ events["click " + this.ui.addAttribute] = "onEditAttr";
+ events["click " + this.ui.attributeEdit] = "onEditAttr";
+ events["click " + this.ui.deleteNamespace] = function(e) {
+ that.guid = e.target.dataset.guid;
+ that.deleteNamespaceElement();
+ };
+ return events;
+ },
+ /**
+ * intialize a new NameSpaceTableLayoutView Layout
+ * @constructs
+ */
+ initialize: function(options) {
+ _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr', 'selectedNameSpace'));
+ this.limit = 10;
+ this.offset = 0;
+ this.pervOld = [];
+ this.onlyPurge = true;
+ this.newAttr = false;
+ this.commonTableOptions = {
+ collection: this.nameSpaceCollection,
+ includeFilter: false,
+ includePagination: true,
+ includeFooterRecords: true,
+ includePageSize: true,
+ includeGotoPage: true,
+ includeAtlasTableSorting: true,
+ includeTableLoader: true,
+ includeColumnManager: true,
+ 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.currPage = 1;
+ this.isFilters = null;
+ this.guid = null;
+ this.showDetails = true; // toggle between sttribute page and detail page
+ },
+ onRender: function() {
+ this.toggleNamespaceDetailsAttrView();
+ $.extend(this.nameSpaceCollection.queryParams, { count: this.limit });
+ this.nameSpaceCollection.fullCollection.sort({ silent: true });
+ this.renderTableLayoutView();
+ this.$('.tableOverlay').hide();
+ this.$('.auditTable').show(); // Only for first time table show because we never hide after first render.
+ this.nameSpaceCollection.comparator = function(model) {
+ return -model.get('timestamp');
+ }
+ },
+ toggleNamespaceDetailsAttrView: function() {
+ var that = this;
+ if (that.showDetails) {
+ that.ui.namespaceAttrPage.hide();
+ that.ui.namespaceDetailPage.show();
+ } else {
+ that.ui.namespaceAttrPage.show();
+ that.ui.namespaceDetailPage.hide();
+ }
+ },
+ bindEvents: function() {},
+ loaderStatus: function(isActive) {
+ var that = this;
+ if (isActive) {
+ that.$('.namespace-attr-tableOverlay').show();
+ that.$('.namespace-attr-fontLoader').show();
+ } else {
+ that.$('.namespace-attr-tableOverlay').hide();
+ that.$('.namespace-attr-fontLoader').hide();
+ }
+ },
+ onEditAttr: function(e) {
+ var that = this,
+ isAttrEdit = e.target.dataset && e.target.dataset.id === 'attributeEdit' ? true : false,
+ guid = e.target.dataset && e.target.dataset.guid ? e.target.dataset.guid : null,
+ selectedNamespace = that.nameSpaceCollection.fullCollection.findWhere({ guid: guid }),
+ attrributes = selectedNamespace ? selectedNamespace.get('attributeDefs') : null,
+ attrName = e.target.dataset.name ? e.target.dataset.name : null,
+ attrDetails = { name: attrName };
+ if (selectedNamespace) {
+ that.ui.namespaceAttrPageOk.text("Save");
+ that.newAttr = e.target && e.target.dataset.action === "createAttr" ? true : false;
+ that.guid = guid;
+ _.each(attrributes, function(attrObj) {
+ if (attrObj.name === attrName) {
+ attrDetails.attrTypeName = attrObj.typeName;
+ if (attrObj.typeName.includes('array')) {
+ attrDetails.attrTypeName = attrObj.typeName.replace("array<", "").replace(">", "");
+ attrDetails.multiValued = true;
+ }
+ attrDetails.attrEntityType = attrObj.options && attrObj.options.applicableEntityTypes ? JSON.parse(attrObj.options.applicableEntityTypes) : null;
+ attrDetails.maxStrLength = attrObj.options && attrObj.options.maxStrLength ? attrObj.options.maxStrLength : null;
+ attrDetails.enumValues = attrObj.enumValues ? attrObj.enumValues : null;
+ }
+ });
+
+ that.showDetails = false;
+ that.toggleNamespaceDetailsAttrView();
+ that.ui.namespaceAttrPageOk.attr('data-action', e.target.dataset.id);
+ require(["views/name_space/CreateNameSpaceLayoutView"], function(CreateNameSpaceLayoutView) {
+ that.view = new CreateNameSpaceLayoutView({
+ onEditCallback: function() {
+ that.nameSpaceCollection.fullCollection.sort({ silent: true });
+ that.renderTableLayoutView();
+
+ },
+ onUpdateNamespace: function() {
+ enumDefCollection.fetch({ reset: true });
+ that.showDetails = true;
+ that.toggleNamespaceDetailsAttrView();
+ },
+ parent: that.$el,
+ tagCollection: that.nameSpaceCollection,
+ enumDefCollection: enumDefCollection,
+ isAttrEdit: isAttrEdit,
+ typeHeaders: typeHeaders,
+ attrDetails: attrDetails,
+ selectedNamespace: selectedNamespace,
+ nameSpaceCollection: nameSpaceCollection,
+ guid: that.guid,
+ isNewAttr: that.newAttr
+ });
+ if (isAttrEdit) {
+ that.ui.namespaceAttrPageTitle.text("Update Attribute of: " + selectedNamespace.get('name'));
+ } else {
+ that.ui.namespaceAttrPageTitle.text("Add Namespace Attribute for: " + selectedNamespace.get('name'));
+ }
+
+ that.RModal.show(that.view);
+ });
+ }
+ },
+ onClickCreateNamespace: function(e) {
+ var that = this,
+ isNewNameSpace = true;
+ that.showDetails = false;
+ that.ui.namespaceAttrPageOk.text("Create");
+ that.ui.namespaceAttrPageOk.attr('data-action', 'createNamespace');
+ that.ui.namespaceAttrPageTitle.text("Create Namespace");
+ that.toggleNamespaceDetailsAttrView();
+ require(["views/name_space/CreateNameSpaceLayoutView"], function(CreateNameSpaceLayoutView) {
+ that.view = new CreateNameSpaceLayoutView({
+ onUpdateNamespace: function() {
+ enumDefCollection.fetch({ reset: true });
+ that.showDetails = true;
+ that.toggleNamespaceDetailsAttrView();
+ },
+ tagCollection: that.nameSpaceCollection,
+ enumDefCollection: enumDefCollection,
+ typeHeaders: typeHeaders,
+ isNewNameSpace: isNewNameSpace,
+ nameSpaceCollection: nameSpaceCollection
+ });
+ that.RModal.show(that.view);
+ });
+ },
+ renderTableLayoutView: function() {
+ var that = this;
+ require(['utils/TableLayout'], function(TableLayout) {
+ var cols = new Backgrid.Columns(that.getNamespaceTableColumns());
+ that.RNameSpaceTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
+ columns: cols
+ })));
+ if (!(that.nameSpaceCollection.models.length < that.limit)) {
+ that.RNameSpaceTableLayoutView.$el.find('table tr').last().hide();
+ }
+
+ });
+ },
+ getNamespaceTableColumns: function() {
+ var that = this;
+ return this.nameSpaceCollection.constructor.getTableCols({
+ attributeDefs: {
+ label: "",
+ cell: "html",
+ editable: false,
+ sortable: false,
+ cell: Backgrid.ExpandableCell,
+ fixWidth: "50",
+ accordion: false,
+ alwaysVisible: true,
+ expand: function(el, model) {
+ el.attr('colspan', '8');
+ var attrValues = '',
+ attrTable = $('table'),
+ attrTableBody = $('tbody'),
+ attrTableHeading = "<thead><td style='display:table-cell'><b>Attribute</b></td><td style='display:table-cell'><b>Type</b></td><td style='display:table-cell'><b>Applicable Type(s)</b></td><td style='display:table-cell'><b>Action</b></td></thead>",
+ attrRow = '',
+ attrTableDetails = '';
+ if (model.attributes && model.attributes.attributeDefs.length) {
+ _.each(model.attributes.attributeDefs, function(attrObj) {
+ var applicableEntityTypes = '',
+ typeName = attrObj.typeName;
+ if (attrObj.options) {
+ // 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>';
+ })
+ }
+ if (typeName.includes('array')) {
+ typeName = _.escape(typeName);
+ }
+ 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));
+ } 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));
+ }
+
+ }
+ },
+ name: {
+ label: "Name",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return '<a title= "' + model.get('name') + '" href ="#!/administrator/namespace/' + model.get('guid') + '">' + model.get('name') + '</a>';
+ }
+ })
+ },
+ description: {
+ label: "Description",
+ cell: "html",
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return model.get('description');
+ }
+ })
+ },
+ createdBy: {
+ label: "Created by",
+ cell: "html",
+ renderable: false,
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return model.get('updatedBy');
+ }
+ })
+ },
+ createTime: {
+ label: "Created on",
+ cell: "html",
+ renderable: false,
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return new Date(model.get('createTime'));
+ }
+ })
+ },
+ updatedBy: {
+ label: "Updated by",
+ cell: "html",
+ renderable: false,
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return model.get('updatedBy');
+ }
+ })
+ },
+ updateTime: {
+ label: "Updated on",
+ cell: "html",
+ renderable: false,
+ editable: false,
+ formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+ fromRaw: function(rawValue, model) {
+ return new Date(model.get('updateTime'));
+ }
+ })
+ },
+ tools: {
+ label: "Action",
+ cell: "html",
+ sortable: false,
+ editable: false,
+ 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 Namespace attribute'><i class='fa fa-plus'></i> Attributes</button>";
+ // "<button type='button' data-id='deleteNamespace' data-guid='" + model.get('guid') + "'' title='' class='btn btn-action btn-xs ' style='margin-bottom: 10px;' data-action='createAttr' data-original-title='Delete Namespace'><i class='fa fa-trash-o'></i> Delete</button>";
+ }
+ })
+ }
+ }, this.nameSpaceCollection);
+ },
+ deleteNamespaceElement: function(nameSpaceName) {
+ var that = this,
+ notifyObj = {
+ modal: true,
+ ok: function(argument) {
+ that.onNotifyDeleteOk();
+ },
+ cancel: function(argument) {}
+ };
+ var text = "Are you sure you want to delete the namespace";
+ notifyObj["text"] = text;
+ Utils.notifyConfirm(notifyObj);
+ },
+ onNotifyDeleteOk: function(data) {
+ var that = this,
+ deleteNamespaceData = that.nameSpaceCollection.fullCollection.findWhere({ guid: that.guid });
+ // that.$('.position-relative .fontLoader').addClass('show');
+ that.$('.tableOverlay').show();
+ if (deleteNamespaceData) {
+ var nameSpaceName = deleteNamespaceData.get("name");
+ deleteNamespaceData.deleteNameSpace({
+ typeName: nameSpaceName,
+ success: function() {
+ Utils.notifySuccess({
+ content: "Namespace " + nameSpaceName + Messages.getAbbreviationMsg(false, 'deleteSuccessMessage')
+ });
+ that.nameSpaceCollection.fullCollection.remove(deleteNamespaceData);
+ that.nameSpaceCollection.fullCollection.sort({ silent: true });
+ that.renderTableLayoutView();
+ that.showDetails = true;
+ that.toggleNamespaceDetailsAttrView();
+ that.loaderStatus(false);
+ },
+ complete: function() {
+ that.$('.tableOverlay').hide();
+ that.$('.position-relative .fontLoader').removeClass('show');
+ }
+ });
+ } else {
+ Utils.notifyError({
+ content: Messages.defaultErrorMessage
+ });
+ }
+ }
+ });
+ return NameSpaceTableLayoutView;
+});
\ No newline at end of file
diff --git a/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js b/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js
index 244c234..4d5c5ce 100644
--- a/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js
+++ b/dashboardv3/public/js/views/search/SearchFilterBrowseLayoutView.js
@@ -36,7 +36,8 @@ define([
RGlossaryTreeRender: '[data-id="r_glossaryTreeRender"]',
RClassificationTreeRender: '[data-id="r_classificationTreeRender"]',
REntityTreeRender: '[data-id="r_entityTreeRender"]',
- RCustomFilterTreeRender: '[data-id="r_customFilterTreeRender"]'
+ RCustomFilterTreeRender: '[data-id="r_customFilterTreeRender"]',
+ RNameSpaceTreeRender: '[data-id="r_nameSpaceTreeRender"]'
},
ui: {
//search
@@ -81,6 +82,7 @@ define([
this.classificationSearchTree = this.$('[data-id="classificationSearchTree"]');
this.termSearchTree = this.$('[data-id="termSearchTree"]');
this.customFilterSearchTree = this.$('[data-id="customFilterSearchTree"]');
+ this.nameSpaceSearchTree = this.$('[data-id="nameSpaceSearchTree"]');
this.entitySearchTree.jstree(true).show_all();
this.entitySearchTree.jstree("search", searchString);
this.classificationSearchTree.jstree(true).show_all();
@@ -89,6 +91,9 @@ define([
this.termSearchTree.jstree("search", searchString);
this.customFilterSearchTree.jstree(true).show_all();
this.customFilterSearchTree.jstree("search", searchString);
+ this.nameSpaceSearchTree.jstree(true).show_all();
+ this.nameSpaceSearchTree.jstree("search", searchString);
+
};
events["click " + this.ui.menuItems] = function(e) {
@@ -118,11 +123,12 @@ define([
this.bindEvents();
},
onRender: function() {
- var opt = opt = Utils.getUrlState.getQueryParams();
+ var opt = Utils.getUrlState.getQueryParams();
this.renderEntityTree(opt);
this.renderClassificationTree(opt);
this.renderGlossaryTree(opt);
this.renderCustomFilterTree();
+ this.renderNameSpaceTree();
this.showHideGlobalFilter();
this.showDefaultPage();
},
@@ -195,6 +201,9 @@ define([
if (options) {
_.extend(this.options, options);
this.showHideGlobalFilter();
+ if (this.RNameSpaceTreeRender.currentView) {
+ this.RNameSpaceTreeRender.currentView.manualRender(this.options);
+ }
if (this.RCustomFilterTreeRender.currentView) {
this.RCustomFilterTreeRender.currentView.manualRender(this.options);
}
@@ -232,6 +241,12 @@ define([
require(["views/search/tree/CustomFilterTreeLayoutView"], function(CustomFilterTreeLayoutView) {
that.RCustomFilterTreeRender.show(new CustomFilterTreeLayoutView(_.extend({ query: that.query }, that.options)));
});
+ },
+ renderNameSpaceTree: function() {
+ var that = this;
+ require(["views/search/tree/NameSpaceTreeLayoutView"], function(NameSpaceTreeLayoutView) {
+ that.RNameSpaceTreeRender.show(new NameSpaceTreeLayoutView(_.extend({ query: that.query }, that.options)));
+ });
}
});
return SearchFilterBrowseLayoutViewNew;
diff --git a/dashboardv3/public/js/views/search/tree/CustomFilterTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/CustomFilterTreeLayoutView.js
index 1c44669..9766b32 100644
--- a/dashboardv3/public/js/views/search/tree/CustomFilterTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/CustomFilterTreeLayoutView.js
@@ -245,12 +245,14 @@ define([
var aFilter = that.$("#" + str.node.a_attr.id),
filterOffset = aFilter.find(">.jstree-icon").offset();
that.$(".tree-tooltip").removeClass("show");
- if (filterOffset.top && filterOffset.left) {
- aFilter.find(">span.tree-tooltip").css({
- top: "calc(" + filterOffset.top + "px - 45px)",
- left: "24px"
- }).addClass("show");
- }
+ setTimeout(function() {
+ if (aFilter.hasClass("jstree-hovered") && filterOffset.top && filterOffset.left) {
+ aFilter.find(">span.tree-tooltip").css({
+ top: "calc(" + filterOffset.top + "px - 45px)",
+ left: "24px"
+ }).addClass("show");
+ }
+ }, 1200);
}).on("dehover_node.jstree", function(nodes, str, res) {
that.$(".tree-tooltip").removeClass("show");
});
diff --git a/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
index 3056525..421fb2d 100644
--- a/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/EntityTreeLayoutView.js
@@ -309,7 +309,7 @@ define([
parent: "#",
icon: "fa fa-file-o",
state: {
- disabled: entityCount == 0 ? true : false,
+ disabled: false,
selected: isSelected
},
};
@@ -489,12 +489,14 @@ define([
var aType = that.$("#" + str.node.a_attr.id),
typeOffset = aType.find(">.jstree-icon").offset();
that.$(".tree-tooltip").removeClass("show");
- if (typeOffset.top && typeOffset.left) {
- aType.find(">span.tree-tooltip").css({
- top: "calc(" + typeOffset.top + "px - 45px)",
- left: "24px"
- }).addClass("show");
- }
+ setTimeout(function() {
+ if (aType.hasClass("jstree-hovered") && typeOffset.top && typeOffset.left) {
+ aType.find(">span.tree-tooltip").css({
+ top: "calc(" + typeOffset.top + "px - 45px)",
+ left: "24px"
+ }).addClass("show");
+ }
+ }, 1200);
}).on("dehover_node.jstree", function(nodes, str, res) {
that.$(".tree-tooltip").removeClass("show");
});
diff --git a/dashboardv3/public/js/views/search/tree/GlossaryTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/GlossaryTreeLayoutView.js
index 64be2db..28c6a9e 100644
--- a/dashboardv3/public/js/views/search/tree/GlossaryTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/GlossaryTreeLayoutView.js
@@ -56,6 +56,7 @@ define([
events["click " + this.ui.createGlossary] = function(e) {
var that = this;
+ e.stopPropagation();
CommonViewFunction.createEditGlossaryCategoryTerm({
isGlossaryView: true,
collection: that.glossaryCollection,
@@ -664,12 +665,14 @@ define([
var aTerm = that.$("#" + str.node.a_attr.id),
termOffset = aTerm.find(">.jstree-icon").offset();
that.$(".tree-tooltip").removeClass("show");
- if (termOffset.top && termOffset.left) {
- aTerm.find(">span.tree-tooltip").css({
- top: "calc(" + termOffset.top + "px - 45px)",
- left: "24px"
- }).addClass("show");
- }
+ setTimeout(function() {
+ if (aTerm.hasClass("jstree-hovered") && termOffset.top && termOffset.left) {
+ aTerm.find(">span.tree-tooltip").css({
+ top: "calc(" + termOffset.top + "px - 45px)",
+ left: "24px"
+ }).addClass("show");
+ }
+ }, 1200);
}).on("dehover_node.jstree", function(nodes, str, res) {
that.$(".tree-tooltip").removeClass("show");
});
diff --git a/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js
new file mode 100644
index 0000000..2ece151
--- /dev/null
+++ b/dashboardv3/public/js/views/search/tree/NameSpaceTreeLayoutView.js
@@ -0,0 +1,384 @@
+/**
+ * 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",
+ "hbs!tmpl/search/tree/NameSpaceTreeLayoutView_tmpl",
+ "utils/Utils",
+ "utils/Messages",
+ "utils/Globals",
+ "utils/UrlLinks",
+ "utils/CommonViewFunction",
+ "collection/VSearchList",
+ "collection/VGlossaryList",
+ "utils/Enums",
+ "jstree"
+], function(require, NameSpaceTreeLayoutViewTmpl, Utils, Messages, Globals, UrlLinks, CommonViewFunction, VSearchList, VGlossaryList, Enums) {
+ "use strict";
+
+ var NameSpaceTreeLayoutView = Marionette.LayoutView.extend({
+ template: NameSpaceTreeLayoutViewTmpl,
+
+ regions: {},
+ ui: {
+ //refresh
+ refreshTree: '[data-id="refreshTree"]',
+
+ // tree el
+ nameSpaceSearchTree: '[data-id="nameSpaceSearchTree"]',
+
+ // Create
+ createNameSpace: '[data-id="createNameSpace"]'
+ },
+ templateHelpers: function() {
+ return {
+ apiBaseUrl: UrlLinks.apiBaseUrl
+ };
+ },
+ events: function() {
+ var events = {},
+ that = this;
+ // refresh individual tree
+ events["click " + this.ui.refreshTree] = function(e) {
+ var type = $(e.currentTarget).data("type");
+ e.stopPropagation();
+ that.refresh({ type: type });
+ };
+
+ events["click " + this.ui.createNameSpace] = function(e) {
+ e.stopPropagation();
+ that.triggerUrl("#!/administrator?tabActive=namespace");
+ };
+
+ return events;
+ },
+ initialize: function(options) {
+ this.options = options;
+ _.extend(
+ this,
+ _.pick(
+ options,
+ "typeHeaders",
+ "namespaceID",
+ "searchVent",
+ "entityDefCollection",
+ "enumDefCollection",
+ "nameSpaceCollection",
+ "searchTableColumns",
+ "searchTableFilters",
+ "metricCollection",
+ "nameSpaceCollection"
+ )
+ );
+ this.bindEvents();
+ },
+ onRender: function() {
+ this.renderNameSpaceTree();
+ //this.createNameSpaceAction();
+ },
+ bindEvents: function() {
+ var that = this;
+ this.listenTo(
+ this.nameSpaceCollection.fullCollection,
+ "reset add remove",
+ function() {
+ if (this.ui.nameSpaceSearchTree.jstree(true)) {
+ that.ui.nameSpaceSearchTree.jstree(true).refresh();
+ } else {
+ this.renderNameSpaceTree();
+ }
+ },
+ this
+ );
+ // this.options.nameSpaceVent.on("Save:NamespaceAttribute", function(data) {
+ // that.ui.nameSpaceSearchTree.jstree(true).refresh();
+ // });
+ $("body").on("click", ".namespacePopoverOptions li", function(e) {
+ that.$(".nameSpacePopover").popover("hide");
+ that[$(this).find("a").data("fn") + "NameSpace"](e);
+ });
+ },
+ createNameSpaceAction: function() {
+ var that = this;
+ Utils.generatePopover({
+ el: this.$el,
+ contentClass: "namespacePopoverOptions",
+ popoverOptions: {
+ selector: ".nameSpacePopover",
+ content: function() {
+ var type = $(this).data("detail"),
+ liString =
+ "<li><i class='fa fa-list-alt'></i><a href='javascript:void(0)' data-fn='onViewEdit'>View/Edit</a></li><li><i class='fa fa-search'></i><a href='javascript:void(0)' data-fn='onSelectedSearch'>Search</a></li>";
+ return "<ul>" + liString + "</ul>";
+ }
+ }
+ });
+ },
+ renderNameSpaceTree: function() {
+ this.generateSearchTree({
+ $el: this.ui.nameSpaceSearchTree
+ });
+ },
+ manualRender: function(options) {
+ var that = this;
+ _.extend(this, options);
+ if (Utils.getUrlState.isAdministratorTab() && this.namespaceID) {
+ this.ui.nameSpaceSearchTree.jstree(true).select_node(this.namespaceID);
+ } else {
+ this.ui.nameSpaceSearchTree.jstree(true).deselect_all();
+ this.namespaceID = null;
+ }
+ // if (this.options.value === undefined) {
+ // this.options.value = {};
+ // }
+ // if (!this.options.value.tag) {
+ // this.ui.nameSpaceSearchTree.jstree(true).deselect_all();
+ // this.nameSpaceId = null;
+ // } else {
+ // if (that.options.value.tag.indexOf("*") != -1) {
+ // that.ui.nameSpaceSearchTree.jstree(true).deselect_all();
+ // }
+ // var dataFound = this.nameSpaceCollection.fullCollection.find(function(obj) {
+ // return obj.get("name") === that.options.value.tag;
+ // });
+ // if (dataFound) {
+ // if ((this.nameSpaceId && this.nameSpaceId !== dataFound.get("guid")) || this.nameSpaceId === null) {
+ // if (this.nameSpaceId) {
+ // this.ui.nameSpaceSearchTree.jstree(true).deselect_node(this.nameSpaceId);
+ // }
+ // this.fromManualRender = true;
+ // this.nameSpaceId = dataFound.get("guid");
+ // this.ui.nameSpaceSearchTree.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.nameSpaceSearchTree.jstree(true).select_node(this.typeId);
+ // }
+ // }
+ },
+ onNodeSelect: function(nodeData) {
+ var that = this,
+ options = nodeData.node.original,
+ url = "#!/administrator/namespace";
+ if (options.parent === undefined) {
+ url += "/" + options.id;
+ this.triggerUrl(url);
+ } else {
+ //this.triggerSearch();
+ }
+ },
+ onViewEditNameSpace: function() {
+ var selectedNode = this.ui.nameSpaceSearchTree.jstree("get_selected", true);
+ if (selectedNode && selectedNode[0]) {
+ selectedNode = selectedNode[0];
+ var url = "#!/administrator?tabActive=namespace";
+ if (selectedNode.parent && selectedNode.original && selectedNode.original.name) {
+ url += "&ns=" + selectedNode.parent + "&nsa=" + selectedNode.original.name;
+ this.triggerUrl(url);
+ }
+ }
+ },
+ // triggerSearch: function(params, url) {
+ // var serachUrl = url ? url : "#!/search/searchResult";
+ // Utils.setUrl({
+ // url: serachUrl,
+ // urlParams: params,
+ // mergeBrowserUrl: false,
+ // trigger: true,
+ // updateTabState: true
+ // });
+ // },
+ triggerUrl: function(url) {
+ Utils.setUrl({
+ url: url,
+ mergeBrowserUrl: false,
+ trigger: true,
+ updateTabState: true
+ });
+ },
+ refresh: function(options) {
+ var that = this;
+ this.nameSpaceCollection.fetch({
+ skipDefaultError: true,
+ silent: true,
+ complete: function() {
+ that.nameSpaceCollection.fullCollection.comparator = function(model) {
+ return model.get("name").toLowerCase();
+ };
+ that.nameSpaceCollection.fullCollection.sort({ silent: true });
+ that.ui.nameSpaceSearchTree.jstree(true).refresh();
+ }
+ });
+ },
+ getNameSpaceTree: function(options) {
+ var that = this,
+ nameSpaceList = [],
+ allCustomFilter = [],
+ namsSpaceTreeData = that.nameSpaceCollection.fullCollection.models,
+ openClassificationNodesState = function(treeDate) {
+ if (treeDate.length == 1) {
+ _.each(treeDate, function(model) {
+ model.state["opeaned"] = true;
+ });
+ }
+ },
+ generateNode = function(nodeOptions, attrNode) {
+ var attributesNode = attrNode ? null : nodeOptions.get("attributeDefs"),
+ nodeStructure = {
+ text: attrNode ? _.escape(nodeOptions.name) : _.escape(nodeOptions.get("name")),
+ name: attrNode ? _.escape(nodeOptions.name) : _.escape(nodeOptions.get("name")),
+ type: "nameSpace",
+ id: attrNode ? _.escape(nodeOptions.name) : nodeOptions.get("guid"),
+ icon: attrNode ? "fa fa-file-o" : "fa fa-folder-o",
+ children: [],
+ state: { selected: nodeOptions.get("guid") === that.namespaceID },
+ gType: "NameSpace",
+ model: nodeOptions
+ };
+ return nodeStructure;
+ };
+ // getChildren = function(options) {
+ // var children = options.children,
+ // data = [],
+ // dataWithoutEmptyTag = [],
+ // isAttrNode = true;
+ // if (children && children.length) {
+ // _.each(children, function(attrDetail) {
+ // var nodeDetails = {
+ // name: _.escape(attrDetail.name),
+ // model: attrDetail
+ // },
+ // nodeProperties = {
+ // parent: options.parent,
+ // text: _.escape(attrDetail.name),
+ // model: attrDetail,
+ // id: options.parent + "_" + _.escape(attrDetail.name)
+ // },
+ // getNodeDetails = generateNode(nodeDetails, isAttrNode),
+ // classificationNode = _.extend(getNodeDetails, nodeProperties);
+ // data.push(classificationNode);
+ // });
+ // } else {
+ // return null;
+ // }
+ // return data;
+ // };
+ _.each(namsSpaceTreeData, function(filterNode) {
+ nameSpaceList.push(generateNode(filterNode));
+ });
+
+ var treeView = [{
+ icon: "fa fa-folder-o",
+ gType: "nameSpace",
+ type: "nameSpaceFolder",
+ children: nameSpaceList,
+ text: "Namespace",
+ name: "Namespace",
+ state: { opened: true }
+ }];
+ var customFilterList = treeView;
+ return nameSpaceList;
+ },
+ generateSearchTree: function(options) {
+ var $el = options && options.$el,
+ type = options && options.type,
+ that = this,
+ getEntityTreeConfig = function(opt) {
+ return {
+ plugins: ["search", "core", "sort", "conditionalselect", "changed", "wholerow", "node_customize"],
+ conditionalselect: function(node) {
+ var type = node.original.type;
+ if (type == "nameSpaceFolder") {
+ if (node.children.length) {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return true;
+ }
+ },
+ state: { opened: true },
+ search: {
+ show_only_matches: true,
+ case_sensitive: false
+ },
+ node_customize: {
+ default: function(el, node) {
+ var aTag = $(el).find(">a.jstree-anchor");
+ aTag.append("<span class='tree-tooltip'>" + aTag.text() + "</span>");
+ if (node.parent === "#") {
+ $(el).append('<div class="tools"><i class="fa"></i></div>');
+ } else {
+ $(el).append('<div class="tools"><i class="fa fa-ellipsis-h nameSpacePopover" rel="popover"></i></div>');
+ }
+ }
+ },
+ core: {
+ multiple: false,
+ data: function(node, cb) {
+ if (node.id === "#") {
+ cb(that.getNameSpaceTree());
+ }
+ }
+ }
+ };
+ };
+ $el.jstree(
+ getEntityTreeConfig({
+ type: ""
+ })
+ )
+ .on("open_node.jstree", function(e, data) {
+ that.isTreeOpen = true;
+ })
+ .on("select_node.jstree", function(e, data) {
+ that.onNodeSelect(data);
+ })
+ .on("search.jstree", function(nodes, str, res) {
+ if (str.nodes.length === 0) {
+ $el.jstree(true).hide_all();
+ $el.parents(".panel").addClass("hide");
+ } else {
+ $el.parents(".panel").removeClass("hide");
+ }
+ })
+ .on("hover_node.jstree", function(nodes, str, res) {
+ var aFilter = that.$("#" + str.node.a_attr.id),
+ filterOffset = aFilter.find(">.jstree-icon").offset();
+ that.$(".tree-tooltip").removeClass("show");
+ setTimeout(function() {
+ if (aFilter.hasClass("jstree-hovered") && ($(":hover").last().hasClass("jstree-hovered") || $(":hover").last().parent().hasClass("jstree-hovered")) && filterOffset.top && filterOffset.left) {
+ aFilter
+ .find(">span.tree-tooltip")
+ .css({
+ top: "calc(" + filterOffset.top + "px - 45px)",
+ left: "24px"
+ })
+ .addClass("show");
+ }
+ }, 1200);
+ })
+ .on("dehover_node.jstree", function(nodes, str, res) {
+ that.$(".tree-tooltip").removeClass("show");
+ });
+ }
+ });
+ return NameSpaceTreeLayoutView;
+});
\ No newline at end of file