Commit 37be53bb by kevalbhatt

ATLAS-2217 : Remove all taxonomy reference from UI

parent e9b95131
/*
* 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.
*/
/* breadcrumb.scss */
.breadcrumb {
padding: 8px 25px;
background-color: transparent;
margin-bottom: 0;
font-weight: 600;
line-height: 44px;
>li {
display: inline-block;
+li:before {
padding: 0 10px;
font-family: $font_2;
color: $color_ironside_gray_approx;
content: "\f105";
}
}
}
.breadcrumb-menu,
.breadcrumb-dropdown+li:before,
.breadcrumb-ellipsis+li:before {
display: none;
}
.dropdown .fa-ellipsis-h {
position: relative;
top: 4px;
}
.breadcrumb-ellipsis {
color: #359f89;
cursor: pointer;
display: none !important;
}
#new-header .breadcrumb-dropdown .popover.bottom {
margin-top: 45px !important;
}
.breadcrumb>li:last-child a {
color: #b4b7bc;
}
\ No newline at end of file
/*
* 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.
*/
/* business-catlog.scss */
.main-search {
.form-control {
border: none;
border-left: 1px $color_mystic_approx solid; //Instead of the line below you could use @include border-radius($radius, $vertical-radius)
border-radius: 0; //Instead of the line below you could use @include box-shadow($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10)
box-shadow: none;
height: 60px;
font-size: 18px;
font-style: italic;
}
.input-group-addon {
font-size: 20px;
color: $color_bombay_approx;
background: none;
border: none;
}
}
.arrowPosition {
left: -75px;
}
.sidebar-item.active i {
display: block !important;
}
.dropdown-menu>li>a {
color: $color_jungle_green_approx;
padding: 6px 20px;
max-width: 276px;
@include ellipsis();
}
.branchListParent {
.parentActive {
background: none;
}
.fa {
line-height: 40px;
}
}
ul[data-id=branchList] {
.fa {
line-height: 40px;
}
li {
padding-left: 50px;
}
}
.branchChildDiv {
padding-left: 15px;
}
.branchListParentInput {
padding-bottom: 18px;
display: list-item;
.form-control {
border-right: none; //Instead of the line below you could use @include box-shadow($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10)
box-shadow: none; //Instead of the line below you could use @include border-radius($radius, $vertical-radius)
border-radius: 4px;
}
.input-group-addon {
background-color: $white;
}
}
.listTerm {
padding-bottom: 5px;
}
.termNote {
padding-top: 10px;
}
.termTableBreadcrumb {
>div {
@include clearfix();
display: block;
width: 100%;
}
.hide {
opacity: 0;
overflow: hidden;
height: 0px;
display: block !important;
}
.show {
opacity: 1;
overflow: visible;
height: auto;
}
.liContent {
float: left;
line-height: 21px !important;
padding: 0px 10px 0px 0px !important;
}
>div a {
.fa-trash,
.fa-ellipsis-h {
color: $tag_color;
cursor: pointer;
}
}
}
\ No newline at end of file
......@@ -41,9 +41,6 @@
&[data-id="edit"] {
display: none;
}
&.btn[data-id="addTerm"] {
display: none;
}
&.btn[data-id="tagClick"] {
span {
display: block;
......
......@@ -25,12 +25,8 @@
@import "panel.scss";
@import "loader.scss";
@import "graph.scss";
@import "breadcrumb.scss";
//@import "login.scss";
@import "business-catlog.scss";
@import "old-style.scss";
@import "theme.scss";
@import "tree.scss";
@import "tag.scss";
@import "search.scss";
@import "profile-table.scss";
......
......@@ -184,14 +184,6 @@ hr[size="10"] {
}
}
.table-quickMenu>tbody>tr>td {
&.searchTerm {
overflow: visible;
}
&.searchTag {}
}
.card {
background: $white none repeat scroll 0 0; //Instead of the line below you could use @include box-shadow($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10)
box-shadow: 0 1px 3px $black_30;
......
/*
* 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.
*/
/* tree.scss */
.jstree-container-ul {
padding-left: 0px;
position: relative;
list-style: none;
.jstree-node {
white-space: nowrap;
position: relative;
cursor: pointer;
padding: 4px 0;
margin: 0;
margin-top: 5px;
margin-bottom: 5px;
}
ul {
list-style: none;
padding: 0;
text-indent: 30px;
}
li a {
// color: $white;
display: block;
}
}
.taxonomyTree {
padding: 0;
position: relative;
li {
position: relative;
border-radius: 4px;
margin-top: 5px;
&.parent {
width: 100%;
a {
max-width: 93%;
}
}
&.parentChild {
>ul {
padding-left: 9%;
}
li {
&.children {
width: 91%;
}
a {
max-width: 90%;
}
}
}
&.children {
&:hover {
background-color: $color_star_dust_approx;
}
}
&.listTerm {
a {
display: inline;
}
}
&.active {
background-color: $color_jungle_green_approx !important;
border: none;
.tools {
display: block;
.fa {
cursor: pointer;
padding: 0px 3px;
}
}
}
a {
display: block;
color: $concrete;
white-space: nowrap;
padding: 5px 25px;
@include ellipsis();
cursor: pointer;
}
.tools {
background: $color_jungle_green_approx;
display: none;
position: absolute;
right: 2px;
padding: 5px;
}
}
}
.termMoveDiv {
width: 550px;
height: 200px;
margin: 10px;
}
.toggleArrow {
position: absolute;
left: 0px;
padding: 8px;
cursor: pointer;
}
.addTermDisable {
border-color: $red !important;
}
.alertTerm {
color: $red !important;
}
/**Css changes**/
.modal-body {
.add-seperator {
border: none;
}
.taxonomyTree li {
.children {
text-indent: 20px;
}
&.parentChild {
ul {
padding-left: 0px;
}
li {
&.children {
width: 100%;
}
a {
max-width: 100%;
}
}
}
&.active {
color: $concrete;
a {
color: $concrete;
}
}
a {
color: #6C6C6C;
}
&.children:hover {
a {
color: $concrete;
}
background-color: #ABABAB;
color: $white;
}
.tools {
text-indent: 0px;
background: none;
}
}
}
.popoverTerm {
text-align: center;
margin-top: 25px !important;
}
\ No newline at end of file
/**
* 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',
'utils/Globals',
'collection/BaseCollection',
'models/VCatalog',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VCatalog, UrlLinks) {
'use strict';
var VCatalogList = BaseCollection.extend(
//Prototypal attributes
{
url: UrlLinks.taxonomiesApiUrl(),
model: VCatalog,
initialize: function() {
this.modelName = 'VCatalog';
this.modelAttrName = '';
},
fetch: function(options) {
//Call Backbone's fetch
return Backbone.Collection.prototype.fetch.call(this, options);
},
parseRecords: function(resp, options) {
try {
/* var arr = [];
arr.push({
taxonomies: resp
});*/
return resp;
} catch (e) {
console.log(e);
}
},
},
//Static Class Members
{
/**
* Table Cols to be passed to Backgrid
* UI has to use this as base and extend this.
*
*/
tableCols: {}
}
);
return VCatalogList;
});
......@@ -213,9 +213,6 @@ require(['App',
Globals.userLogedIn.status = true;
Globals.userLogedIn.response = response;
}
if (response && response['atlas.feature.taxonomy.enable'] !== undefined) {
Globals.taxonomy = response['atlas.feature.taxonomy.enable']
}
if (response && response['atlas.entity.create.allowed'] !== undefined) {
Globals.entityCreate = response['atlas.entity.create.allowed'];
}
......
/**
* 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',
'utils/Globals',
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VCatalog = VBaseModel.extend({
urlRoot: UrlLinks.taxonomiesApiUrl(),
defaults: {},
serverSchema: {},
idAttribute: 'id',
initialize: function() {
this.modelName = 'VCatalog';
},
toString: function() {
return this.get('name');
},
deleteTerm: function(termURL, options) {
var url = termURL;
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
}
}, {});
return VCatalog;
});
......@@ -16,7 +16,7 @@
* limitations under the License.
*/
define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backbone, template) {
define(['require', 'backbone', 'hbs!tmpl/common/Modal'], function(require, Backbone, template) {
var Modal = Backbone.View.extend({
......
......@@ -32,11 +32,9 @@ define([
'': 'defaultAction',
'!/': 'tagAttributePageLoad',
'!/tag/tagAttribute/(*name)': 'tagAttributePageLoad',
'!/taxonomy/detailCatalog/(*url)': 'detailCatalog',
'!/search/searchResult': 'searchResult',
'!/detailPage/:id': 'detailPage',
'!/tag': 'commonAction',
'!/taxonomy': 'commonAction',
'!/search': 'commonAction',
// Default
'*actions': 'defaultAction'
......@@ -64,29 +62,11 @@ define([
bindCommonEvents: function() {
var that = this;
$('body').on('click', 'li.aboutAtlas', function() {
that.aboutAtlas();
});
},
aboutAtlas: function() {
var that = this;
require([
'hbs!tmpl/common/aboutAtlas_tmpl',
'modules/Modal',
'views/common/aboutAtlas',
], function(aboutAtlasTmpl, Modal, aboutAtlasView) {
var view = new aboutAtlasView();
var modal = new Modal({
title: 'Apache Atlas',
content: view,
okCloses: true,
showFooter: true,
allowCancel: false,
}).open();
view.on('closeModal', function() {
modal.trigger('cancel');
require([
'views/common/AboutAtlas',
], function(AboutAtlas) {
new AboutAtlas();
});
});
},
showRegions: function() {},
......@@ -110,53 +90,13 @@ define([
// console.log("Post-Route Change Operations can be performed here !!");
// console.log("Route changed: ", name);
},
detailCatalog: function(url) {
var that = this;
require([
'views/business_catalog/BusinessCatalogHeader',
'views/business_catalog/BusinessCatalogDetailLayoutView',
'views/business_catalog/SideNavLayoutView',
'collection/VCatalogList'
], function(BusinessCatalogHeader, BusinessCatalogDetailLayoutView, SideNavLayoutView, VCatalogList) {
if (Globals.taxonomy) {
var paramObj = Utils.getUrlState.getQueryParams();
this.collection = new VCatalogList();
this.collection.url = url;
App.rNHeader.show(new BusinessCatalogHeader(
_.extend({
'url': url,
'collection': this.collection
}, that.preFetchedCollectionLists)
));
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView(
_.extend({
'url': url
}, that.preFetchedCollectionLists, that.sharedObj)
));
} else {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender("/" + url);
App.rSideNav.currentView.selectTab();
}
App.rNContent.show(new BusinessCatalogDetailLayoutView(
_.extend({
'url': url,
'collection': this.collection
}, that.preFetchedCollectionLists)
));
this.collection.fetch({ reset: true });
} else {
that.defaultAction()
}
});
},
detailPage: function(id) {
var that = this;
if (id) {
require([
'views/site/Header',
'views/detail_page/DetailPageLayoutView',
'views/business_catalog/SideNavLayoutView',
'views/site/SideNavLayoutView',
'collection/VEntityList'
], function(Header, DetailPageLayoutView, SideNavLayoutView, VEntityList) {
this.entityCollection = new VEntityList([], {});
......@@ -183,10 +123,9 @@ define([
var that = this;
require([
'views/site/Header',
'views/business_catalog/BusinessCatalogLayoutView',
'views/business_catalog/SideNavLayoutView',
'views/site/SideNavLayoutView',
'views/tag/TagDetailLayoutView',
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, TagDetailLayoutView) {
], function(Header, SideNavLayoutView, TagDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams(),
url = Utils.getUrlState.getQueryUrl().queyParams[0];
App.rNHeader.show(new Header());
......@@ -233,10 +172,9 @@ define([
var that = this;
require([
'views/site/Header',
'views/business_catalog/BusinessCatalogLayoutView',
'views/business_catalog/SideNavLayoutView',
'views/site/SideNavLayoutView',
'views/search/SearchDetailLayoutView',
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) {
], function(Header, SideNavLayoutView, SearchDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) {
......@@ -249,8 +187,6 @@ define([
App.rSideNav.currentView.selectTab();
if (Utils.getUrlState.isTagTab()) {
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender();
} else if (Utils.getUrlState.isTaxonomyTab()) {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(undefined, true);
}
}
if (Globals.entityCreate && Utils.getUrlState.isSearchTab()) {
......@@ -271,10 +207,9 @@ define([
var that = this;
require([
'views/site/Header',
'views/business_catalog/BusinessCatalogLayoutView',
'views/business_catalog/SideNavLayoutView',
'views/site/SideNavLayoutView',
'views/search/SearchDetailLayoutView'
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) {
], function(Header, SideNavLayoutView, SearchDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
var isinitialView = true,
isTypeTagNotExists = false,
......
<!--
* 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 id="r_treeLayoutView"></div>
<!--
* 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.
-->
<form name="tagDefinitionform" class="form-horizontal" onsubmit="return false;">
<div class="form-group">
<label class="control-label col-sm-2 required" for="name">Name</label>
{{#if defaultTerm}}
<div class="col-sm-10">
<input class="form-control" data-id="termName" placeholder="Enter Taxonomy Name" autofocus>
<p class='alertTerm' style='display:none'>Taxonomy name should not have spaces</p>
</div>
{{else}}
<div class="col-sm-10">
<input class="form-control" data-id="termName" placeholder="Name(Required)" autofocus>
<p class='alertTerm' style='display:none'>Term name should not have spaces</p>
</div>
{{/if}}
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="description">Description</label>
<div class="col-sm-10">
<textarea class="form-control" data-id="termDetail" placeholder="Description"></textarea>
</div>
</div>
</form>
\ No newline at end of file
<!--
* 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="catlogDetail">
<h1 class="form-group"><span data-id="title"></span></h1>
<button type="button" data-id="editButton" class="btn btn-sm btn-action pull-right"><i class="fa fa-pencil"></i></button>
<p class="form-group" data-id="description">Description</p>
</div>
</div>
<div class="container-fluid gray-bg">
<div class="row">
<div class="col-sm-custom">
<div class="atlast-tabbable">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="tab active"><a href="#tab-details" aria-controls="tab-details" role="tab" data-toggle="tab">Properties</a></li>
</ul>
<div class="tab-content">
<div id="tab-details" role="tabpanel" class="tab-pane active">
<p data-id="createDate"></p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--
* 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.
-->
<ol class="breadcrumb col-md-6">
</ol>
<header class="clearfix">
<div class="btn-group pull-right header-menu">
<a target="_blank" href="http://atlas.apache.org/"><i class="fa fa-question-circle"></i></a>
<a href="javascript:void(0);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user user-circle"></i><span class="userName"></span></a>
<ul class="dropdown-menu">
<li class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.html"><i class="fa fa-sign-out"></i>Logout</a></li>
</ul>
</div>
</header>
<!--
* 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 id="r_treeLayoutView"></div>
<!--
* 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-control termMoveDiv">
<div id="tree"></div>
</div>
<!--
* 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 add-seperator">
<p data-id="descriptionAssign" style="display:none">Assign a term to this asset</p>
<button type="button" class="btn btn-action btn-md pull-left" data-id="backTaxanomy"><i class="fa fa-chevron-left"></i> Back</button>
<button type="button" class="btn btn-action btn-md pull-right" onclick="this.blur();" title="Refresh" data-id="refreshTaxanomy"><i class="fa fa-refresh"></i></button>
</div>
<div>
<select type="text" class="form-control" data-id="searchTermInput"></select>
</div>
<div class="">
<ul class="taxonomyTree">
<div class="contentLoading"></div>
<li class="children parent" data-id="Parent"></li>
<li class="childs parentChild">
<ul data-id="childList">
</ul>
</li>
</ul>
</div>
......@@ -33,14 +33,6 @@
</button>
</div>
</div>
{{#if taxonomy}}
<div class="form-group">
<span class="control-label-sm-pr pull-left">Terms:</span>
<div class="pull-left" data-id="termList">
<button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm"><i class="fa fa-plus"></i></button>
</div>
</div>
{{/if}}
</div>
</div>
<div class="container-fluid gray-bg">
......@@ -84,9 +76,6 @@
<ul class="nav nav-tabs ">
<li role="properties" class="tab active"><a href="#tab-details" aria-controls="tab-details" role="tab" data-toggle="tab">Properties</a></li>
<li role="tags"><a href="#tab-tagTable" aria-controls="tab-tagTable" role="tab" data-toggle="tab">Tags</a></li>
{{#if taxonomy}}
<li role="terms"><a href="#tab-termTable" aria-controls="tab-termTable" role="tab" data-toggle="tab">Terms</a></li>
{{/if}}
<li role="audits" class="tab"><a href="#tab-audit" aria-controls="tab-audit" role="tab" data-toggle="tab">Audits</a></li>
<li role="schema" class="tab schemaTable" style="display:none"><a href="#tab-schema" aria-controls="tab-schema" role="tab" data-toggle="tab">Schema</a></li>
<li role="profile" class="tab profileTab" style="display:none"><a href="#tab-profile" aria-controls="tab-profile" role="tab" data-toggle="tab">Profile</a></li>
......@@ -108,13 +97,6 @@
</div>
</div>
</div>
<div id="tab-termTable" role="terms" class="tab-pane">
<div id="r_termTableLayoutView">
<div class="fontLoader-relative">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
</div>
</div>
<div id="tab-audit" role="audits" class="tab-pane">
<div id="r_auditTableLayoutView">
<div class="fontLoader-relative">
......
......@@ -22,7 +22,6 @@
<input type="checkbox" class="input" name="queryType" value="text" name="check" value="1" />Show historical entities</label>
</div>
<div class="clearfix inline">
<a href="javascript:void(0)" class="inputAssignTag multiSelectTerm btn btn-action btn-sm" style="display:none" data-id="addTerm"><i class="fa fa-plus"></i> Assign Term</a>
<a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag btn btn-action btn-sm" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a>
</div>
</div>
......
......@@ -36,8 +36,6 @@
<b>Show historical entities</b></label>
</div>
<div class="inline">
{{#if taxonomy}}
<a href="javascript:void(0)" class=" multiSelectTerm btn btn-action btn-sm inline" style="display:none" data-id="addTerm"><i class="fa fa-plus"></i> Assign Term</a> {{/if}}
<a href="javascript:void(0)" class=" multiSelectTag assignTag btn btn-action btn-sm" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a>
</div>
</div>
......
......@@ -21,18 +21,12 @@
<ul class="tabs" style="width: 100%;" role="tablist">
<li role="presentation" class="{{tabClass}}"><a href="#tab-search" aria-controls="tab-search" data-name="tab-search" role="tab" data-toggle="tab" class=""><i class="fa fa-search"></i> Search</a></li>
<li role="presentation" class="{{tabClass}}"><a href="#tab-tag" aria-controls="tab-tag" data-name="tab-tag" role="tab" data-toggle="tab"><i class="fa fa-tags"></i> Tags</a></li>
{{#if taxonomy}}
<li role="presentation" class="tab col-sm-4"><a href="#tab-taxonomy" aria-controls="tab-taxonomy" data-name="tab-taxonomy" role="tab" data-toggle="tab" class=""><i class="fa fa-sitemap"></i> Taxonomy</a></li>
{{/if}}
</ul>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane" id="tab-tag">
<div id="r_tagLayoutView"></div>
</div>
<div role="tabpanel" class="tab-pane" id="tab-taxonomy">
<div id="r_businessCatalogLayoutView"></div>
</div>
<div role="tabpanel" class="tab-pane" id="tab-search">
<div id="r_searchLayoutView"></div>
</div>
......
......@@ -16,5 +16,5 @@
-->
<div>
<div class="tableOverlay"></div>
<div id="r_tagTermTableLayoutView"></div>
<div id="r_tagTableLayoutView"></div>
</div>
......@@ -42,14 +42,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
tagModel.deleteAssociation(options.guid, options.tagName, {
skipDefaultError: true,
success: function(data) {
var msg = "Tag " + name.name + Messages.removeSuccessMessage;
if (options.tagOrTerm === "term") {
msg = "Term " + options.tagName + Messages.removeSuccessMessage;
} else if (options.tagOrTerm === "tag") {
msg = "Tag " + options.tagName + Messages.removeSuccessMessage;
}
Utils.notifySuccess({
content: msg
content: "Tag " + options.tagName + Messages.removeSuccessMessage
});
if (options.callback) {
options.callback();
......@@ -233,122 +227,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
});
return table;
}
CommonViewFunction.breadcrumbUrlMaker = function(url) {
if (url) {
var urlList = [];
var splitURL = url.split("api/atlas/v1/taxonomies/");
if (splitURL.length > 1) {
var splitUrlWithoutTerm = splitURL[1].split("/terms/");
if (splitUrlWithoutTerm.length == 1) {
splitUrlWithoutTerm = splitUrlWithoutTerm[0].split("/");
}
} else {
var splitUrlWithoutTerm = splitURL[0].split("/terms/");
if (splitUrlWithoutTerm.length == 1) {
splitUrlWithoutTerm = splitUrlWithoutTerm[0].split("/");
}
}
var href = "";
for (var i in splitUrlWithoutTerm) {
if (i == 0) {
href = splitUrlWithoutTerm[i];
urlList.push({
value: _.escape(splitUrlWithoutTerm[i]),
href: href
});
} else {
href += "/terms/" + splitUrlWithoutTerm[i];
urlList.push({
value: _.escape(splitUrlWithoutTerm[i]),
href: href
});
};
}
return urlList;
}
}
CommonViewFunction.breadcrumbMaker = function(options) {
var li = "";
if (options.urlList) {
_.each(options.urlList, function(object) {
li += '<li><a class="link" href="#!/taxonomy/detailCatalog/api/atlas/v1/taxonomies/' + object.href + '?load=true">' + _.escape(object.value) + '</a></li>';
});
}
if (options.scope) {
options.scope.html(li);
options.scope.asBreadcrumbs("destroy");
options.scope.asBreadcrumbs({
namespace: 'breadcrumb',
overflow: "left",
responsive: false,
toggleIconClass: 'fa fa-ellipsis-h',
dropdown: function(classes) {
var dropdownClass = 'dropdown';
var dropdownMenuClass = 'dropdown-menu popover popoverTerm bottom arrowPosition';
if (this.options.overflow === 'right') {
dropdownMenuClass += ' dropdown-menu-right';
}
return '<li class="' + dropdownClass + ' ' + classes.dropdownClass + '">' +
'<a href="javascript:void(0);" class="' + classes.toggleClass + '" data-toggle="dropdown">' +
'<i class="' + classes.toggleIconClass + '"></i>' +
'</a>' +
'<ul class="' + dropdownMenuClass + ' ' + classes.dropdownMenuClass + '">' +
'<div class="arrow"></div>' +
'</ul>' +
'</li>';
}
});
}
}
CommonViewFunction.termTableBreadcrumbMaker = function(obj) {
if (!obj) {
return "";
}
var traits = obj.classificationNames || _.pluck(obj.classifications, 'typeName'),
url = "",
deleteHtml = "",
html = "",
id = obj.guid,
terms = [],
entityName = Utils.getName(obj);
if (traits) {
traits.map(function(term) {
var checkTagOrTerm = Utils.checkTagOrTerm(term);
if (checkTagOrTerm.term) {
terms.push({
deleteHtml: '<a href="javascript:void(0)" class="pull-left" title="Remove Term"><i class="fa fa-trash" data-id="tagClick" data-type="term" data-assetname="' + entityName + '" data-name="' + term + '" data-guid="' + obj.guid + '" ></i></a>',
url: _.unescape(term).split(".").join("/"),
name: term
});
}
});
}
_.each(terms, function(obj, i) {
var className = "";
if (i >= 1) {
className += "showHideDiv hide";
}
obj['valueUrl'] = CommonViewFunction.breadcrumbUrlMaker(obj.url);
html += '<div class="' + className + '" dataterm-name="' + obj.name + '"><div class="liContent"></div>' + obj.deleteHtml + '</div>';
})
if (terms.length > 1) {
html += '<div><a href="javascript:void(0)" data-id="showMoreLessTerm" class="btn btn-action btn-sm btn-icon-pd"><span>Show More </span><i class="fa fa-angle-right"></i></a></div>'
}
if (!Enums.entityStateReadOnly[obj.status]) {
if (obj.guid) {
html += '<div><a href="javascript:void(0)" class="btn btn-action btn-sm" data-id="addTerm" data-guid="' + (obj.guid) + '"><i class="fa fa-plus"></i></a></div>'
} else {
html += '<div><a href="javascript:void(0)" class="btn btn-action btn-sm" data-id="addTerm"><i class="fa fa-plus"></i></a></div>'
}
}
return {
html: '<div class="termTableBreadcrumb btn-inline" dataterm-id="' + id + '">' + html + '</div>',
object: { scopeId: id, value: terms }
}
}
CommonViewFunction.tagForTable = function(obj) {
var traits = obj.classificationNames || _.pluck(obj.classifications, 'typeName'),
atags = "",
......@@ -358,17 +236,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
entityName = Utils.getName(obj);
if (traits) {
traits.map(function(tag) {
var checkTagOrTerm = Utils.checkTagOrTerm(tag);
if (checkTagOrTerm.tag) {
var className = "btn btn-action btn-sm btn-blue btn-icon",
tagString = '<a class="' + className + '" data-id="tagClick"><span title="' + tag + '">' + tag + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + entityName + '"data-name="' + tag + '" data-type="tag" data-guid="' + obj.guid + '" ></i></a>';
if (count >= 1) {
popTag += tagString;
} else {
atags += tagString;
}
++count;
var className = "btn btn-action btn-sm btn-blue btn-icon",
tagString = '<a class="' + className + '" data-id="tagClick"><span title="' + tag + '">' + tag + '</span><i class="fa fa-times" data-id="delete" data-assetname="' + entityName + '"data-name="' + tag + '" data-type="tag" data-guid="' + obj.guid + '" ></i></a>';
if (count >= 1) {
popTag += tagString;
} else {
atags += tagString;
}
++count;
});
}
if (!Enums.entityStateReadOnly[obj.status]) {
......@@ -418,32 +293,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
}
CommonViewFunction.saveTermToAsset = function(options, that) {
require(['models/VCatalog'], function(Vcatalog) {
var VCatalog = new Vcatalog();
var name = options.termName;
++that.asyncFetchCounter;
VCatalog.url = function() {
return "api/atlas/v1/entities/" + options.guid + "/tags/" + name;
};
VCatalog.save(null, {
success: function(data) {
Utils.notifySuccess({
content: "Term " + name + Messages.addTermToEntitySuccessMessage
});
if (options.collection) {
options.collection.fetch({ reset: true });
}
},
complete: function() {
--that.asyncFetchCounter
if (that.callback && that.asyncFetchCounter === 0) {
that.callback(); // It will call to parent of parent Callback i.e callback of searchLayoutView
}
}
});
})
}
CommonViewFunction.generateObjectForSaveSearchApi = function(options) {
var obj = {
name: options.name,
......
......@@ -27,7 +27,6 @@ define(['require'], function(require) {
tabState: {
stateChanged: false,
tagUrl: "#!/tag",
taxonomyUrl: "#!/taxonomy",
searchUrl: "#!/search"
},
detailPageState: {}
......
......@@ -23,10 +23,7 @@ define(['require'], function(require) {
defaultErrorMessage: "Something went wrong",
addSuccessMessage: " has been created successfully",
addErrorMessage: " could not be Created",
addTermToEntitySuccessMessage: " has been added to entity",
deleteTerm: "Delete Term",
removeTag: "Remove Tag Assignment",
removeTerm: "Remove Term Assignment",
deleteSuccessMessage: " has been deleted successfully",
deleteErrorMessage: " could not be deleted",
removeSuccessMessage: " has been removed successfully",
......@@ -48,8 +45,7 @@ define(['require'], function(require) {
},
tag: {
addAttributeSuccessMessage: "Tag attribute is added successfully",
updateTagDescriptionMessage: "Tag description is updated successfully",
updateTermDescriptionMessage: "Term description is updated successfully"
updateTagDescriptionMessage: "Tag description is updated successfully"
}
};
return Messages;
......
......@@ -48,12 +48,6 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
return defApiUrl.defs + '?type=' + type;
}
},
taxonomiesApiUrl: function() {
return this.baseUrl + '/v1/taxonomies';
},
taxonomiesTermsApiUrl: function(name) {
return this.baseUrl + '/v1/taxonomies' + '/' + name + '/terms';
},
entitiesApiUrl: function(guid, name) {
var entitiesUrl = this.baseUrlV2 + '/entity';
if (guid && name) {
......
......@@ -281,8 +281,6 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
};
if (Utils.getUrlState.isTagTab(options.url)) {
urlUpdate['tagUrl'] = options.url;
} else if (Utils.getUrlState.isTaxonomyTab(options.url)) {
urlUpdate['taxonomyUrl'] = options.url;
} else if (Utils.getUrlState.isSearchTab(options.url)) {
urlUpdate['searchUrl'] = options.url;
}
......@@ -311,9 +309,6 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
isTagTab: function(url) {
return this.getQueryUrl(url).firstValue == "tag" ? true : false;
},
isTaxonomyTab: function(url) {
return this.getQueryUrl(url).firstValue == "taxonomy" ? true : false;
},
isSearchTab: function(url) {
return this.getQueryUrl(url).firstValue == "search" ? true : false;
},
......@@ -354,63 +349,6 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
}
}
}
Utils.checkTagOrTerm = function(value, isTermView) {
if (value && _.isString(value) && isTermView) {
// For string break
if (value == "TaxonomyTerm") {
return {}
}
var name = _.escape(value).split('.');
return {
term: true,
tag: false,
name: name[name.length - 1],
fullName: value
}
}
if (value && _.isString(value)) {
value = {
typeName: value
}
}
if (_.isObject(value)) {
var name = "";
if (value && value.$typeName$) {
name = value.$typeName$;
} else if (value && value.typeName) {
name = value.typeName;
}
if (name === "TaxonomyTerm") {
return {}
}
name = _.escape(name).split('.');
var trem = false;
if (value['taxonomy.namespace']) {
trem = true;
} else if (value.values && value.values['taxonomy.namespace']) {
trem = true;
} else if (Globals.taxonomy && name.length > 1) {
trem = true; // Temp fix
}
if (trem) {
return {
term: true,
tag: false,
name: name[name.length - 1],
fullName: name.join('.')
}
} else {
return {
term: false,
tag: true,
name: name[name.length - 1],
fullName: name.join('.')
}
}
}
}
Utils.getName = function() {
return Utils.extractKeyValueFromEntity.apply(this, arguments).name;
}
......
/**
* 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/business_catalog/AddTermView_tmpl',
'utils/Utils',
'collection/VCatalogList'
], function(require, Backbone, AddTermViewTmpl, Utils, VCatalogList) {
'use strict';
var AddTermLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends AddTermView */
{
_viewName: 'AddTermLayoutView',
template: AddTermViewTmpl,
templateHelpers: function() {
return {
defaultTerm: this.defaultTerm
};
},
/** Layout sub regions */
regions: {},
/** ui selector cache */
ui: {
termName: '[data-id="termName"]',
termDetail: '[data-id="termDetail"]'
},
/** ui events hash */
events: function() {
var events = {};
return events;
},
/**
* intialize a new BusinessCatalogLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'model','defaultTerm'));
},
bindEvents: function() {},
onRender: function() {}
});
return AddTermLayoutView;
});
/**
* 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/business_catalog/AddTermToEntityLayoutView_tmpl',
'utils/Utils',
'modules/Modal',
'collection/VCatalogList',
'utils/CommonViewFunction',
'utils/Messages',
'utils/Enums'
], function(require, Backbone, AddTermToEntityLayoutViewTmpl, Utils, Modal, VCatalogList, CommonViewFunction, Messages, Enums) {
'use strict';
var AddTermToEntityLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends AddTermToEntityLayoutView */
{
_viewName: 'AddTermToEntityLayoutView',
template: AddTermToEntityLayoutViewTmpl,
/** Layout sub regions */
regions: {
RTreeLayoutView: "#r_treeLayoutView"
},
/** ui selector cache */
ui: {},
/** ui events hash */
events: function() {
var events = {};
return events;
},
/**
* intialize a new AddTermToEntityLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'modalCollection', 'callback', 'multiple', 'showLoader', 'hideLoader'));
this.vCatalogList = new VCatalogList();
var that = this;
this.modal = new Modal({
title: 'Assign Term',
content: this,
okText: 'Assign',
cancelText: "Cancel",
allowCancel: true,
}).open();
this.on('ok', function() {
that.asyncFetchCounter = 0;
var termName = this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join("");
if (termName.trim) {
termName = termName.trim();
}
if (that.multiple) {
for (var i = 0; i < that.multiple.length; i++) {
if (i == 0) {
if (that.showLoader) {
that.showLoader();
}
}
var obj = {
termName: termName,
guid: that.multiple[i].id,
deletedEntity: Enums.entityStateReadOnly[that.multiple[i].model.status],
entityName: Utils.getName(that.multiple[i].model)
};
if (obj.deletedEntity) {
Utils.notifyError({
content: obj.entityName + Messages.assignDeletedEntity
});
if (that.multiple.length === 1 || (that.multiple.length == (i + 1) && that.asyncFetchCounter == 0)) {
that.hideLoader();
}
} else {
CommonViewFunction.saveTermToAsset(obj, that);
}
}
} else {
that.asyncFetchCounter = 0;
if (that.showLoader) {
that.showLoader();
}
CommonViewFunction.saveTermToAsset({
termName: termName,
guid: this.guid
}, that);
}
});
this.on('closeModal', function() {
this.modal.trigger('cancel');
});
},
onRender: function() {
this.renderTreeLayoutView();
},
renderTreeLayoutView: function() {
var that = this;
require(['views/business_catalog/TreeLayoutView'], function(TreeLayoutView) {
that.RTreeLayoutView.show(new TreeLayoutView({
url: that.url,
viewBased: false
}));
});
}
});
return AddTermToEntityLayoutView;
});
/**
* 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/business_catalog/BusinessCatalogDetailLayoutView_tmpl',
'utils/Utils',
'models/VEntity',
'models/VCatalog',
'utils/Messages'
], function(require, Backbone, BusinessCatalogDetailLayoutViewTmpl, Utils, VEntity, VCatalog, Messages) {
'use strict';
var BusinessCatalogDetailLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends BusinessCatalogDetailLayoutView */
{
_viewName: 'BusinessCatalogDetailLayoutView',
template: BusinessCatalogDetailLayoutViewTmpl,
/** Layout sub regions */
regions: {},
/** ui selector cache */
ui: {
title: '[data-id="title"]',
editButton: '[data-id="editButton"]',
description: '[data-id="description"]',
editBox: '[data-id="editBox"]',
createDate: '[data-id="createDate"]'
},
/** ui events hash */
events: function() {
var events = {};
events["click " + this.ui.editButton] = 'onEditButton';
events["click " + this.ui.cancelButton] = 'onCancelButtonClick';
return events;
},
/**
* intialize a new BusinessCatalogDetailLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'collection'));
this.bindEvents();
},
bindEvents: function() {
var that = this;
this.listenTo(this.collection, 'error', function(model, response) {
this.$('.fontLoader').hide();
if (response && response.responseJSON && response.responseJSON.message) {
Utils.notifyError({
content: response.responseJSON.message
});
}
}, this);
this.listenTo(this.collection, 'reset', function() {
this.$('.fontLoader').hide();
this.$('.hide').removeClass('hide');
this.model = this.collection.first();
var name = this.model.get('name'),
description = this.model.get('description'),
createdDate = this.model.get('creation_time');
if (name) {
this.ui.title.show();
this.termName = Utils.checkTagOrTerm(name, true);
this.ui.title.html('<span>' + this.termName.name + '</span>');
} else {
this.ui.title.hide();
}
if (description) {
this.ui.description.show();
this.ui.description.html('<span>' + _.escape(description) + '</span>');
} else {
this.ui.description.hide();
}
if (createdDate) {
var splitDate = createdDate.split(":");
this.ui.createDate.html('<strong> Date Created: </strong> ' + splitDate[0] + " " + splitDate[1] + ":" + splitDate[2] + ":" + splitDate[3] + " (GMT)");
}
Utils.hideTitleLoader(this.$('.fontLoader'), this.$('.catlogDetail'));
}, this);
},
onRender: function() {
var that = this;
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.catlogDetail'));
},
fetchCollection: function() {
this.collection.fetch({ reset: true });
},
onEditButton: function(e) {
var that = this;
$(e.currentTarget).blur();
require([
'views/tag/CreateTagLayoutView',
'modules/Modal'
], function(CreateTagLayoutView, Modal) {
var view = new CreateTagLayoutView({ 'termCollection': that.collection, 'descriptionData': that.model.get('description'), 'tag': _.unescape(that.termName.name) });
var modal = new Modal({
title: 'Edit Term',
content: view,
cancelText: "Cancel",
okText: 'Save',
allowCancel: true,
}).open();
view.ui.description.on('keyup', function(e) {
that.textAreaChangeEvent(view, modal);
});
modal.$el.find('button.ok').prop('disabled', true);
modal.on('ok', function() {
that.onSaveDescriptionClick(view);
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
});
},
textAreaChangeEvent: function(view, modal) {
if (view.description == view.ui.description.val()) {
modal.$el.find('button.ok').prop('disabled', true);
} else {
modal.$el.find('button.ok').prop('disabled', false);
}
},
onSaveDescriptionClick: function(view) {
view.description = view.ui.description.val();
this.onSaveButton(this.collection.first().toJSON(), Messages.tag.updateTermDescriptionMessage, view);
this.ui.description.show();
},
onSaveButton: function(saveObject, message, view) {
var that = this,
termModel = new VCatalog();
termModel.url = function() {
return that.collection.url;
};
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.catlogDetail'));
termModel.set({
"description": view.ui.description.val()
}).save(null, {
type: "PUT",
success: function(model, response) {
that.collection.fetch({ reset: true });
Utils.notifySuccess({
content: message
});
}
});
}
});
return BusinessCatalogDetailLayoutView;
});
/**
* 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/business_catalog/BusinessCatalogHeader',
'utils/CommonViewFunction',
'utils/Globals'
], function(require, tmpl, CommonViewFunction, Globals) {
'use strict';
var BusinessCatalogHeader = Marionette.LayoutView.extend({
template: tmpl,
templateHelpers: function() {},
regions: {},
events: {},
initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'collection'));
this.value = [];
},
/**
* After Page Render createBrudCrum called.
* @return {[type]} [description]
*/
render: function() {
var that = this;
$(this.el).html(this.template());
if (Globals.userLogedIn.status) {
that.$('.userName').text(Globals.userLogedIn.response.userName);
}
var that = this;
if (this.url) {
this.value = CommonViewFunction.breadcrumbUrlMaker(this.url);
}
this.listenTo(this.collection, 'reset', function() {
setTimeout(function() {
that.createBrudCrum();
}, 0);
}, this);
return this;
},
createBrudCrum: function() {
var li = "",
value = this.value,
that = this;
CommonViewFunction.breadcrumbMaker({ urlList: this.value, scope: this.$('.breadcrumb') });
}
});
return BusinessCatalogHeader;
});
/**
* 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/business_catalog/BusinessCatalogLayoutView_tmpl'
], function(require, Backbone, BusinessCatalogLayoutViewTmpl) {
'use strict';
var BusinessCatalogLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends BusinessCatalogLayoutView */
{
_viewName: 'BusinessCatalogLayoutView',
template: BusinessCatalogLayoutViewTmpl,
/** Layout sub regions */
regions: {
RTreeLayoutView: "#r_treeLayoutView"
},
/** ui selector cache */
ui: {},
/** ui events hash */
events: function() {},
/**
* intialize a new BusinessCatalogLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'url'));
},
bindEvents: function() {},
onRender: function() {
this.renderTreeLayoutView();
},
renderTreeLayoutView: function() {
var that = this;
require(['views/business_catalog/TreeLayoutView'], function(TreeLayoutView) {
that.RTreeLayoutView.show(new TreeLayoutView({
url: that.url,
viewBased: true
}));
});
},
manualRender: function(url, isParent, back) {
this.RTreeLayoutView.currentView.manualRender(url, isParent, back);
}
});
return BusinessCatalogLayoutView;
});
/**
* 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/business_catalog/MoveTermLayoutView_tmpl',
'utils/Utils'
], function(require, Backbone, MoveTermLayoutViewTmpl, Utils) {
'use strict';
var MoveTermLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends MoveTermLayoutView */
{
_viewName: 'MoveTermLayoutView',
template: MoveTermLayoutViewTmpl,
/** Layout sub regions */
regions: {},
/** ui selector cache */
ui: {
moveTree: '[data-id="moveTree"]'
},
/** ui events hash */
events: function() {
var events = {};
return events;
},
/**
* intialize a new MoveTermLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'taxanomyCollection'));
},
bindEvents: function() {},
onRender: function() {}
});
return MoveTermLayoutView;
});
/**
* 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/business_catalog/TreeLayoutView_tmpl',
'utils/Utils',
'collection/VCatalogList',
'utils/CommonViewFunction',
'utils/Messages',
'utils/UrlLinks'
], function(require, Backbone, TreeLayoutView_tmpl, Utils, VCatalogList, CommonViewFunction, Messages, UrlLinks) {
'use strict';
var TreeLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends TreeLayoutView */
{
_viewName: 'TreeLayoutView',
template: TreeLayoutView_tmpl,
/** Layout sub regions */
regions: {},
/** ui selector cache */
ui: {
Parent: '[data-id="Parent"]',
childList: '[data-id="childList"]',
liClick: 'li a[data-href]',
backTaxanomy: '[data-id="backTaxanomy"]',
expandArrow: '[data-id="expandArrow"]',
searchTermInput: '[data-id="searchTermInput"]',
refreshTaxanomy: '[data-id="refreshTaxanomy"]',
descriptionAssign: '[data-id="descriptionAssign"]',
},
/** ui events hash */
events: function() {
var events = {};
events['dblclick ' + this.ui.liClick] = function(e) {
this.changeArrowState(e);
};
events['click ' + this.ui.liClick] = function(e) {
var that = this;
that.addActiveClass(e);
that.url = $(e.currentTarget).data('href');
if (this.viewBased) {
Utils.setUrl({
url: '#!/taxonomy/detailCatalog' + that.url,
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
}
};
events['click ' + this.ui.backTaxanomy] = 'backButtonTaxanomy';
events['click ' + this.ui.refreshTaxanomy] = 'refreshButtonTaxanomy';
events['click ' + this.ui.expandArrow] = 'changeArrowState';
events["change " + this.ui.searchTermInput] = function() {
var termUrl = this.termCollection.url.split("/", 5).join("/") + "/" + this.ui.searchTermInput.val().split(".").join("/terms/");
this.fetchCollection(termUrl, true);
if (this.viewBased) {
Utils.setUrl({
url: "#!/taxonomy/detailCatalog" + termUrl,
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
}
};
return events;
},
/**
* intialize a new TreeLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'viewBased'));
this.parentCollection = new VCatalogList();
this.childCollection = new VCatalogList();
this.taxanomy = new VCatalogList();
this.termCollection = new VCatalogList();
},
bindEvents: function() {
var that = this;
this.listenTo(this.parentCollection, 'reset', function() {
if (this.parentCollection.fullCollection.models.length) {
this.generateTree(true);
} else {
if (Utils.getUrlState.isTaxonomyTab() || Utils.getUrlState.isInitial()) {
this.createDefaultTaxonomy();
}
}
}, this);
this.listenTo(this.childCollection, 'reset', function() {
this.generateTree();
}, this);
this.listenTo(this.taxanomy, 'reset', function() {
this.searchResult();
}, this);
this.listenTo(this.termCollection, 'reset', function() {
this.termSearchData();
}, this);
this.listenTo(this.childCollection, 'error', function(model, response) {
this.hideLoader();
}, this);
this.listenTo(this.parentCollection, 'error', function(model, response) {
this.hideLoader();
}, this);
},
onRender: function() {
var that = this;
this.bindEvents();
that.ui.backTaxanomy.hide();
this.fetchCollection(this.url, true);
this.fetchTaxanomyCollections();
if (!this.viewBased) {
this.ui.descriptionAssign.show();
} else {
this.ui.descriptionAssign.hide();
}
},
backButtonTaxanomy: function(e) {
var that = this;
this.backButton = true;
var dataURL = this.$('.taxonomyTree').find('li[data-id="Parent"]').find("a").data('href').split("/terms");
var backUrl = dataURL.pop();
if (dataURL.join("/terms").length) {
this.ui.backTaxanomy.show();
var currentURL = "#!/taxonomy/detailCatalog" + dataURL.join("/terms");
this.fetchCollection(dataURL.join("/terms"), true);
this.url = dataURL.join("/terms");
if (this.viewBased) {
Utils.setUrl({
url: currentURL,
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
}
}
},
manualRender: function(url) {
var splitUrl = this.url.split('/terms');
if (url && this.url != url) {
if (splitUrl.length > 1 && splitUrl[splitUrl.length - 1] == "") {
var checkUrl = splitUrl;
checkUrl.pop();
if (url != checkUrl) {
this.fetchCollection(url, true);
}
} else if (Utils.getUrlState.getQueryParams() && Utils.getUrlState.getQueryParams().load == "true") {
if (this.viewBased) {
Utils.setUrl({
url: "#!/taxonomy/detailCatalog" + url,
mergeBrowserUrl: false,
trigger: false,
updateTabState: true
});
}
this.fetchCollection(url, true);
} else {
this.fetchCollection(url, true);
}
}
if (!url && Utils.getUrlState.isTaxonomyTab()) {
this.selectFirstElement();
}
},
changeArrowState: function(e) {
var scope = this.$('[data-id="expandArrow"]');
if (e) {
scope = $(e.currentTarget);
}
if (scope.is('a')) {
var url = scope.data('href');
scope = scope.parent().find("i.toggleArrow");
} else if (scope.is('i')) {
var url = scope.parent().find("a").data('href');
}
if (scope.hasClass('fa-angle-down')) {
scope.toggleClass('fa-angle-right fa-angle-down');
this.ui.childList.hide();
} else {
if (e && $(e.currentTarget).parents('li.parentChild').length) {
scope.parent('li').find('.tools .taxanomyloader').show();
this.url = url;
this.fetchCollection(url, true);
if (this.viewBased) {
Utils.setUrl({
url: "#!/taxonomy/detailCatalog" + url,
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
}
} else {
scope.toggleClass('fa-angle-right fa-angle-down');
this.ui.childList.show();
}
}
},
fetchCollection: function(url, isParent) {
if (url) {
this.url = url;
} else {
var parentURL = this.ui.Parent.find('a').data('href');
if (parentURL) {
this.url = parentURL;
} else {
this.url = UrlLinks.taxonomiesApiUrl();
}
}
this.showLoader();
if (isParent) {
this.parentCollection.url = this.url;
this.parentCollection.fullCollection.reset(undefined, { silent: true });
this.parentCollection.fetch({ reset: true, cache: true });
} else {
this.childCollection.url = this.url + "?hierarchy/path:.";
this.childCollection.fullCollection.reset(undefined, { silent: true });
this.childCollection.fetch({ reset: true, cache: true });
}
},
showLoader: function() {
this.$('.taxonomyTree').find('li.active .tools .taxanomyloader').show();
this.$('.contentLoading').show();
},
hideLoader: function() {
this.$('.taxanomyloader').hide();
this.$('.contentLoading').hide();
},
addActiveClass: function(e) {
this.$('ul.taxonomyTree').find('li').removeClass('active');
if (e.jquery) {
e.parent('li').addClass('active');
} else {
if (e.currentTarget) {
$(e.currentTarget).parent('li').addClass('active');
} else {
if ($(e).parent.length) {
$(e).parent('li').addClass('active');
} else {
$(e).parents('li').addClass('active');
}
}
}
},
fetchTaxanomyCollections: function() {
this.taxanomy.fetch({ reset: true });
},
refreshButtonTaxanomy: function() {
this.fetchTaxanomyCollections();
var url = "";
if (this.$('.taxonomyTree').find('.active').parents('.parentChild').length) {
url = this.$('.taxonomyTree').find('.active a').data('href').split("/").slice(0, -2).join("/");
this.refresh = this.$('.taxonomyTree').find('.active a').data('href');
} else {
url = this.$('.taxonomyTree').find('.active a').data('href');
this.refresh = this.$('.taxonomyTree').find('.active a').data('href');
}
this.fetchCollection(url, true);
},
searchResult: function() {
var that = this;
_.each(this.taxanomy.models, function(model, key) {
var name = model.get('name');
that.termCollection.url = UrlLinks.taxonomiesTermsApiUrl(name)
});
this.termCollection.fetch({ reset: true });
},
termSearchData: function() {
var that = this;
var str = '<option></option>';
this.termCollection.fullCollection.comparator = function(model) {
return model.get('name');
};
this.termCollection.fullCollection.sort().each(function(model) {
str += '<option>' + model.get('name') + '</option>';
});
this.ui.searchTermInput.html(str);
// this.ui.searchTermInput.setAttribute('data-href' : that.termCollection.url);
this.ui.searchTermInput.select2({
placeholder: "Search Term",
allowClear: true
});
},
onSearchTerm: function() {
Utils.setUrl({
url: '#!/search/searchResult',
urlParams: {
query: this.$('.taxonomyTree').find('li.active').find("a").data('name'),
searchType: "dsl",
dslChecked: true
},
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
},
selectFirstElement: function() {
var dataURL = this.$('.taxonomyTree').find('li[data-id="Parent"]').find("a").data('href');
if (dataURL) {
this.url = dataURL;
if (this.viewBased && Utils.getUrlState.isTaxonomyTab()) {
Utils.setUrl({
url: "#!/taxonomy/detailCatalog" + dataURL,
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
}
}
},
generateTree: function(isParent) {
var parentLi = "",
childLi = "",
that = this;
function createTaxonomy(url) {
var href = false;
_.each(that.parentCollection.fullCollection.models, function(model, key) {
if (model.get('terms')) {
href = model.get('terms').href;
} else if (model.get('href')) {
href = model.get('href') + "/terms";
}
var hrefUrl = "/api" + model.get('href').split("/api")[1];
if (hrefUrl) {
var backUrlCheck = hrefUrl.split("taxonomies/");
if (backUrlCheck.length > 1) {
if (backUrlCheck[1].split("/terms").length <= 1) {
that.ui.backTaxanomy.hide();
} else {
that.ui.backTaxanomy.show();
}
}
}
var name = Utils.checkTagOrTerm(model.get('name'), true);
if (name.name) {
if (that.viewBased) {
parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a>';
} else {
parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a>';
}
}
});
if (href) {
var hrefUrl = "/api" + href.split("/api")[1];
that.fetchCollection(hrefUrl);
}
that.ui.childList.html('');
that.ui.Parent.addClass('active');
that.ui.Parent.html(parentLi);
}
function createTerm() {
that.childCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
};
that.childCollection.fullCollection.sort().each(function(model, key) {
var name = Utils.checkTagOrTerm(model.get('name'), true);
var hrefUrl = "/api" + model.get('href').split("/api")[1];
if (name.name) {
if (that.viewBased) {
childLi += '<li class="children"><div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover" ></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a></li>';
} else {
childLi += '<li class="children"><div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i></div><i class="fa fa-angle-right toggleArrow" data-id="expandArrow" data-href="' + hrefUrl + '"></i><a href="javascript:void(0)" data-href="' + hrefUrl + '" data-name="`' + model.get('name') + '`">' + name.name + '</a></li>';
}
}
});
that.ui.childList.html(childLi);
}
if (isParent) {
createTaxonomy();
} else {
this.changeArrowState();
createTerm();
if (Utils.getUrlState.isInitial() || Utils.getUrlState.getQueryUrl().lastValue == "taxonomy") {
this.selectFirstElement();
}
if (this.refresh) {
this.addActiveClass(this.$('.taxonomyTree').find('a[data-href="' + this.refresh + '"]'));
this.refresh = undefined;
}
}
this.hideLoader();
if (this.viewBased) {
Utils.generatePopover({
el: this.$('.termPopover'),
container: this.$el,
popoverOptions: {
content: function() {
var lis = "<li class='listTerm'><i class='fa fa-plus'></i> <a href='javascript:void(0)' data-fn='onAddTerm'>Create Subterm</a></li>";
var termDataURL = Utils.getUrlState.getQueryUrl().hash.split("terms");
if (termDataURL.length > 1) {
lis = "<li class='listTerm' ><i class='fa fa-search'></i> <a href='javascript:void(0)' data-fn='onSearchTerm'>Search Assets</a></li>" + lis;
lis += "<li class='listTerm'><i class='fa fa-trash'></i> <a href='javascript:void(0)' data-fn='deleteTerm'>Delete Term</a></li>";
}
return "<ul>" + lis + "</ul>";
}
}
}).parent('.tools').off('click').on('click', 'li', function(e) {
e.stopPropagation();
that.$('.termPopover').popover('hide');
that[$(this).find('a').data('fn')](e);
});
}
},
onAddTerm: function(e) {
var that = this;
require([
'views/business_catalog/AddTermLayoutView',
'modules/Modal'
], function(AddTermLayoutView, Modal) {
var view = new AddTermLayoutView({
url: that.$('.taxonomyTree').find('li.active').find(">a[data-name]").data("href"),
model: new that.parentCollection.model()
});
var modal = new Modal({
title: 'Create Sub-term',
content: view,
okCloses: true,
showFooter: true,
allowCancel: true,
okText: 'Create',
}).open();
modal.$el.find('button.ok').attr('disabled', true);
modal.on('ok', function() {
that.saveAddTerm(view);
});
view.ui.termName.on('keyup', function() {
if (this.value.indexOf(' ') >= 0) {
modal.$el.find('button.ok').prop('disabled', true);
view.ui.termName.addClass("addTermDisable");
view.$('.alertTerm').show();
} else {
modal.$el.find('button.ok').prop('disabled', false);
view.ui.termName.removeClass("addTermDisable");
view.$('.alertTerm').hide();
}
});
view.on('closeModal', function() {
modal.trigger('cancel');
});
});
},
saveAddTerm: function(view) {
var that = this;
var url = view.url;
view.model.url = url + "/terms/" + view.ui.termName.val();
this.showLoader();
view.model.set({ description: view.ui.termDetail.val() }).save(null, {
success: function(model, response) {
that.create = true;
that.fetchTaxanomyCollections();
that.fetchCollection(url, true);
Utils.notifySuccess({
content: "Term " + view.ui.termName.val() + Messages.addSuccessMessage
});
},
complete: function() {
that.hideLoader();
}
});
},
deleteTerm: function(e) {
var termName = this.$('.taxonomyTree').find('li.active a').data("name"),
assetName = $(e.target).data("assetname"),
that = this,
modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Delete: " + "<b>" + _.escape(termName) + "?</b></div>" +
"<p class='termNote'>Assets mapped to this term will be unclassified.</p>",
titleMessage: Messages.deleteTerm,
buttonText: "Delete"
});
modal.on('ok', function() {
that.deleteTermData(e);
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
},
deleteTermData: function(e) {
var that = this;
this.showLoader();
require(['models/VCatalog'], function(VCatalog) {
var termModel = new VCatalog(),
url = that.$('.taxonomyTree').find('li.active a').data('href');
var termName = that.$('.taxonomyTree').find('li.active a').text();
termModel.deleteTerm(url, {
skipDefaultError: true,
success: function(data) {
Utils.notifySuccess({
content: "Term " + termName + Messages.deleteSuccessMessage
});
var termURL = url.split("/").slice(0, -2).join("/");
if (that.viewBased) {
Utils.setUrl({
url: "#!/taxonomy/detailCatalog" + termURL,
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
}
that.fetchCollection(termURL, true);
},
cust_error: function(model, response) {
var message = "Term " + termName + Messages.deleteErrorMessage;
if (response && response.responseJSON) {
message = response.responseJSON.errorMessage;
}
Utils.notifyError({
content: message
});
},
complete: function() {
that.hideLoader();
}
});
});
},
moveTerm: function() {
var that = this;
require([
'views/business_catalog/MoveTermLayoutView',
'modules/Modal'
], function(MoveTermLayoutView, Modal) {
var view = new MoveTermLayoutView({
taxanomyCollection: that.collection
});
var modal = new Modal({
title: 'Move Term',
content: view,
okCloses: true,
showFooter: true,
allowCancel: true,
okText: 'Move',
}).open();
// modal.on('ok', function() {
// that.saveAddTerm(view);
// });
view.on('closeModal', function() {
modal.trigger('cancel');
});
});
},
createDefaultTaxonomy: function() {
var that = this;
require([
'views/business_catalog/AddTermLayoutView',
'modules/Modal'
], function(AddTermLayoutView, Modal) {
var view = new AddTermLayoutView({
url: UrlLinks.taxonomiesApiUrl(),
model: new that.parentCollection.model(),
defaultTerm: true
});
var modal = new Modal({
title: 'Taxonomy',
content: view,
okCloses: true,
showFooter: true,
allowCancel: true,
okText: 'Create',
}).open();
modal.$el.find('button.ok').attr('disabled', true);
modal.on('ok', function() {
that.saveDefaultTaxonomy(view);
});
view.ui.termName.on('keyup', function() {
if (this.value.indexOf(' ') >= 0) {
modal.$el.find('button.ok').prop('disabled', true);
view.ui.termName.addClass("addTermDisable");
view.$('.alertTerm').show();
} else {
modal.$el.find('button.ok').prop('disabled', false);
view.ui.termName.removeClass("addTermDisable");
view.$('.alertTerm').hide();
}
});
view.on('closeModal', function() {
modal.trigger('cancel');
});
});
},
saveDefaultTaxonomy: function(view) {
var that = this;
var url = view.url;
view.model.url = url + "/" + view.ui.termName.val();
this.showLoader();
view.model.set({ description: view.ui.termDetail.val() }).save(null, {
skipDefaultError: true,
success: function(model, response) {
that.fetchCollection(view.model.url, true);
Utils.notifySuccess({
content: "Default taxonomy " + view.ui.termName.val() + Messages.addSuccessMessage
});
},
cust_error: function(model, response) {
Utils.notifyError({
content: "Default taxonomy " + view.ui.termName.val() + Messages.addErrorMessage
});
},
complete: function() {
that.hideLoader();
}
});
}
});
return TreeLayoutView;
});
\ No newline at end of file
......@@ -18,16 +18,17 @@
define(['require',
'backbone',
'hbs!tmpl/common/aboutAtlas_tmpl',
'hbs!tmpl/common/AboutAtlas_tmpl',
'modules/Modal',
'models/VCommon',
'utils/UrlLinks'
], function(require, Backbone, aboutAtlasTmpl, VCommon, UrlLinks) {
'utils/UrlLinks',
], function(require, Backbone, AboutAtlasTmpl, Modal, VCommon, UrlLinks) {
'use strict';
var aboutAtlasView = Backbone.Marionette.LayoutView.extend(
/** @lends aboutAtlasView */
var AboutAtlasView = Backbone.Marionette.LayoutView.extend(
/** @lends AboutAtlasView */
{
template: aboutAtlasTmpl,
template: AboutAtlasTmpl,
/** Layout sub regions */
regions: {},
/** ui selector cache */
......@@ -37,16 +38,24 @@ define(['require',
/** ui events hash */
events: function() {},
/**
* intialize a new aboutAtlasView Layout
* intialize a new AboutAtlasView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, options);
},
bindEvents: function() {
var modal = new Modal({
title: 'Apache Atlas',
content: this,
okCloses: true,
showFooter: true,
allowCancel: false,
}).open();
modal.on('closeModal', function() {
modal.trigger('cancel');
});
},
bindEvents: function() {},
onRender: function() {
var that = this;
var url = UrlLinks.versionApiUrl();
......@@ -61,5 +70,5 @@ define(['require',
},
});
return aboutAtlasView;
});
return AboutAtlasView;
});
\ No newline at end of file
......@@ -44,7 +44,6 @@ define(['require',
RTagTableLayoutView: "#r_tagTableLayoutView",
RLineageLayoutView: "#r_lineageLayoutView",
RAuditTableLayoutView: "#r_auditTableLayoutView",
RTermTableLayoutView: "#r_termTableLayoutView",
RProfileLayoutView: "#r_profileLayoutView"
},
......@@ -59,14 +58,11 @@ define(['require',
deleteTag: '[data-id="deleteTag"]',
backButton: "[data-id='backButton']",
addTag: '[data-id="addTag"]',
addTerm: '[data-id="addTerm"]',
tagList: '[data-id="tagList"]',
termList: '[data-id="termList"]',
fullscreenPanel: "#fullscreen_panel"
},
templateHelpers: function() {
return {
taxonomy: Globals.taxonomy,
entityUpdate: Globals.entityUpdate
};
},
......@@ -76,26 +72,15 @@ define(['require',
events["click " + this.ui.editButton] = 'onClickEditEntity';
events["click " + this.ui.tagClick] = function(e) {
if (e.target.nodeName.toLocaleLowerCase() != "i") {
var scope = $(e.currentTarget);
if (scope.hasClass('term')) {
var url = scope.data('href').split(".").join("/terms/");
Utils.setUrl({
url: '#!/taxonomy/detailCatalog' + UrlLinks.taxonomiesApiUrl() + '/' + url,
mergeBrowserUrl: false,
trigger: true
});
} else {
Utils.setUrl({
url: '#!/tag/tagAttribute/' + e.currentTarget.textContent,
mergeBrowserUrl: false,
trigger: true
});
}
Utils.setUrl({
url: '#!/tag/tagAttribute/' + e.currentTarget.textContent,
mergeBrowserUrl: false,
trigger: true
});
}
};
events["click " + this.ui.deleteTag] = 'onClickTagCross';
events["click " + this.ui.addTag] = 'onClickAddTagBtn';
events["click " + this.ui.addTerm] = 'onClickAddTermBtn';
events['click ' + this.ui.backButton] = function() {
Backbone.history.history.back();
};
......@@ -156,9 +141,9 @@ define(['require',
}
}
if (collectionJSON.classifications) {
this.addTagToTerms(collectionJSON.classifications);
this.generateTag(collectionJSON.classifications);
} else {
this.addTagToTerms([]);
this.generateTag([]);
}
if (Globals.entityTypeConfList && _.isEmptyArray(Globals.entityTypeConfList)) {
this.ui.editButtonContainer.html(ButtonsTmpl({ btn_edit: true }));
......@@ -191,7 +176,6 @@ define(['require',
this.renderEntityDetailTableLayoutView(obj);
this.renderAuditTableLayoutView(obj);
this.renderTagTableLayoutView(obj);
this.renderTermTableLayoutView(_.extend({}, obj, { term: true }));
if (collectionJSON && (!_.isUndefined(collectionJSON.attributes['profileData']) || collectionJSON.typeName === "hive_db")) {
if (collectionJSON.typeName === "hive_db") {
this.$('.profileTab a').text("Tables")
......@@ -287,60 +271,42 @@ define(['require',
},
onClickTagCross: function(e) {
var tagName = $(e.currentTarget).parent().text(),
tagOrTerm = $(e.target).data("type"),
that = this;
if (tagOrTerm === "term") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove"
});
} else if (tagOrTerm === "tag") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
}
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
if (modal) {
modal.on('ok', function() {
that.deleteTagData(e, tagOrTerm);
that.deleteTagData({
'tagName': tagName,
'guid': that.id
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
}
},
deleteTagData: function(e, tagOrTerm) {
deleteTagData: function(options) {
var that = this,
tagName = $(e.currentTarget).text();
Utils.showTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail'));
CommonViewFunction.deleteTag({
'tagName': tagName,
'guid': that.id,
'tagOrTerm': tagOrTerm,
CommonViewFunction.deleteTag(_.extend({}, options, {
callback: function() {
that.fetchCollection();
}
});
}));
},
addTagToTerms: function(tagObject) {
generateTag: function(tagObject) {
var that = this,
tagData = "",
termData = "";
tagData = "";
_.each(tagObject, function(val) {
var checkTagOrTerm = Utils.checkTagOrTerm(val);
if (checkTagOrTerm.term) {
termData += '<span class="btn btn-action btn-sm btn-blue btn-icon term" data-id="tagClick" data-href="' + val.typeName + '"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="deleteTag" data-type="term"></i></span>';
} else {
tagData += '<span class="btn btn-action btn-sm btn-icon btn-blue" data-id="tagClick"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="deleteTag" data-type="tag"></i></span>';
}
tagData += '<span class="btn btn-action btn-sm btn-icon btn-blue" data-id="tagClick"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="deleteTag" data-type="tag"></i></span>';
});
this.ui.tagList.find("span.btn").remove();
this.ui.termList.find("span.btn").remove();
this.ui.tagList.prepend(tagData);
this.ui.termList.prepend(termData);
},
hideLoader: function() {
Utils.hideTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail'));
......@@ -350,7 +316,7 @@ define(['require',
},
onClickAddTagBtn: function(e) {
var that = this;
require(['views/tag/addTagModalView'], function(AddTagModalView) {
require(['views/tag/AddTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({
guid: that.id,
tagList: _.map(that.entityObject.entity.classifications, function(obj) {
......@@ -368,25 +334,6 @@ define(['require',
});
});
},
onClickAddTermBtn: function(e) {
var that = this;
require([
'views/business_catalog/AddTermToEntityLayoutView',
], function(AddTermToEntityLayoutView) {
var view = new AddTermToEntityLayoutView({
guid: that.id,
callback: function() {
that.fetchCollection();
},
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that)
});
view.modal.on('ok', function() {
Utils.showTitleLoader(that.$('.page-title .fontLoader'), that.$('.entityDetail'));
});
});
},
renderEntityDetailTableLayoutView: function(obj) {
var that = this;
require(['views/entity/EntityDetailTableLayoutView'], function(EntityDetailTableLayoutView) {
......@@ -399,12 +346,6 @@ define(['require',
that.RTagTableLayoutView.show(new TagDetailTableLayoutView(obj));
});
},
renderTermTableLayoutView: function(obj) {
var that = this;
require(['views/tag/TagDetailTableLayoutView'], function(TagDetailTableLayoutView) {
that.RTermTableLayoutView.show(new TagDetailTableLayoutView(obj));
});
},
renderLineageLayoutView: function(obj) {
var that = this;
require(['views/graph/LineageLayoutView'], function(LineageLayoutView) {
......
......@@ -44,9 +44,6 @@ define(['require',
ui: {
tagClick: '[data-id="tagClick"]',
addTag: "[data-id='addTag']",
addTerm: '[data-id="addTerm"]',
showMoreLess: '[data-id="showMoreLess"]',
showMoreLessTerm: '[data-id="showMoreLessTerm"]',
addAssignTag: "[data-id='addAssignTag']",
checkDeletedEntity: "[data-id='checkDeletedEntity']"
},
......@@ -54,7 +51,6 @@ define(['require',
events: function() {
var events = {};
events["click " + this.ui.addTag] = 'checkedValue';
events["click " + this.ui.addTerm] = 'checkedValue';
events["click " + this.ui.addAssignTag] = 'checkedValue';
events["click " + this.ui.tagClick] = function(e) {
if (e.target.nodeName.toLocaleLowerCase() == "i") {
......@@ -68,15 +64,6 @@ define(['require',
});
}
};
events["click " + this.ui.showMoreLessTerm] = function(e) {
$(e.currentTarget).find('i').toggleClass('fa fa-angle-right fa fa-angle-up');
$(e.currentTarget).parents('.searchTerm').find('div.termTableBreadcrumb>div.showHideDiv').toggleClass('hide');
if ($(e.currentTarget).find('i').hasClass('fa-angle-right')) {
$(e.currentTarget).find('span').text('Show More');
} else {
$(e.currentTarget).find('span').text('Show less');
}
};
events["click " + this.ui.checkDeletedEntity] = 'onCheckDeletedEntity';
return events;
......@@ -124,14 +111,8 @@ define(['require',
}
});
if (this.arr.length > 0) {
if (Globals.taxonomy) {
this.$('.multiSelectTerm').show();
}
this.$('.multiSelectTag').show();
} else {
if (Globals.taxonomy) {
this.$('.multiSelectTerm').hide();
}
this.$('.multiSelectTag').hide();
}
});
......@@ -190,9 +171,7 @@ define(['require',
that.RSchemaTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
columns: columns
})));
that.$('.multiSelectTerm').hide();
that.$('.multiSelectTag').hide();
that.renderBreadcrumb();
Utils.generatePopover({
el: that.$('[data-id="showMoreLess"]'),
contentClass: 'popover-tag',
......@@ -206,15 +185,6 @@ define(['require',
});
});
},
renderBreadcrumb: function() {
var that = this;
_.each(this.bradCrumbList, function(object) {
_.each(object.value, function(subObj) {
var scopeObject = that.$('[dataterm-id="' + object.scopeId + '"]').find('[dataterm-name="' + subObj.name + '"] .liContent');
CommonViewFunction.breadcrumbMaker({ urlList: subObj.valueUrl, scope: scopeObject });
});
});
},
getSchemaTableColumns: function() {
var that = this,
col = {
......@@ -270,31 +240,6 @@ define(['require',
}
})
};
if (Globals.taxonomy) {
col['terms'] = {
label: "Terms",
cell: "Html",
editable: false,
sortable: false,
orderable: true,
className: 'searchTerm',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var obj = model.toJSON();
var returnObject = CommonViewFunction.termTableBreadcrumbMaker(obj);
if (returnObject.object) {
that.bradCrumbList.push(returnObject.object);
}
if (obj.status && Enums.entityStateReadOnly[obj.status]) {
return '<div class="readOnly">' + returnObject.html + '</div>';
} else {
return returnObject.html;
}
}
})
};
}
return this.schemaCollection.constructor.getTableCols(col, this.schemaCollection);
}
......@@ -305,29 +250,18 @@ define(['require',
}
var guid = "",
that = this,
isTagMultiSelect = $(e.currentTarget).hasClass('multiSelectTag'),
isTermMultiSelect = $(e.currentTarget).hasClass('multiSelectTerm'),
isTagButton = $(e.currentTarget).hasClass('assignTag');
if (isTagButton) {
if (isTagMultiSelect && this.arr && this.arr.length) {
that.addTagModalView(guid, this.arr);
} else {
guid = that.$(e.currentTarget).data("guid");
that.addTagModalView(guid);
}
isTagMultiSelect = $(e.currentTarget).hasClass('multiSelectTag');
if (isTagMultiSelect && this.arr && this.arr.length) {
that.addTagModalView(guid, this.arr);
} else {
if (isTermMultiSelect && this.arr && this.arr.length) {
that.addTermModalView(guid, this.arr);
} else {
guid = that.$(e.currentTarget).data("guid");
that.addTermModalView(guid);
}
guid = that.$(e.currentTarget).data("guid");
that.addTagModalView(guid);
}
},
addTagModalView: function(guid, multiple) {
var that = this;
var tagList = that.schemaCollection.find({ 'guid': guid });
require(['views/tag/addTagModalView'], function(AddTagModalView) {
require(['views/tag/AddTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({
guid: guid,
multiple: multiple,
......@@ -342,71 +276,40 @@ define(['require',
showLoader: that.showLoader.bind(that),
enumDefCollection: that.enumDefCollection
});
// view.saveTagData = function() {
//override saveTagData function
// }
});
},
addTermModalView: function(guid, multiple) {
var that = this;
require([
'views/business_catalog/AddTermToEntityLayoutView',
], function(AddTermToEntityLayoutView) {
var view = new AddTermToEntityLayoutView({
guid: guid,
multiple: multiple,
callback: function(termName) {
that.fetchCollection();
that.arr = [];
},
hideLoader: that.hideLoader.bind(that),
showLoader: that.showLoader.bind(that)
});
});
},
onClickTagCross: function(e) {
var tagName = $(e.target).data("name"),
var that = this,
tagName = $(e.target).data("name"),
guid = $(e.target).data("guid"),
assetName = $(e.target).data("assetname"),
tagOrTerm = $(e.target).data("type"),
that = this;
if (tagOrTerm === "term") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove"
});
} else if (tagOrTerm === "tag") {
var modal = CommonViewFunction.deleteTagModel({
modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
}
if (modal) {
modal.on('ok', function() {
that.deleteTagData(e, tagOrTerm);
that.deleteTagData({
'tagName': tagName,
'guid': guid
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
}
},
deleteTagData: function(e, tagOrTerm) {
var that = this,
tagName = $(e.target).data("name"),
guid = $(e.target).data("guid");
CommonViewFunction.deleteTag({
'tagName': tagName,
'guid': guid,
'tagOrTerm': tagOrTerm,
deleteTagData: function(options) {
var that = this;
CommonViewFunction.deleteTag(_.extend({}, options, {
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
callback: function() {
that.fetchCollection();
}
});
}));
},
onCheckDeletedEntity: function(e) {
if (e.target.checked) {
......
......@@ -429,10 +429,7 @@ define(['require',
typeStr += '<option>' + (name) + '</option>';
}
if (model.get('category') == 'CLASSIFICATION') {
var checkTagOrTerm = Utils.checkTagOrTerm(name);
if (checkTagOrTerm.tag) {
tagStr += '<option>' + (name) + '</option>';
}
tagStr += '<option>' + (name) + '</option>';
}
});
that.ui.typeLov.html(typeStr);
......
......@@ -51,9 +51,6 @@ define(['require',
ui: {
tagClick: '[data-id="tagClick"]',
addTag: '[data-id="addTag"]',
addTerm: '[data-id="addTerm"]',
showMoreLess: '[data-id="showMoreLess"]',
showMoreLessTerm: '[data-id="showMoreLessTerm"]',
paginationDiv: '[data-id="paginationDiv"]',
previousData: "[data-id='previousData']",
nextData: "[data-id='nextData']",
......@@ -72,8 +69,7 @@ define(['require',
templateHelpers: function() {
return {
entityCreate: Globals.entityCreate,
searchType: this.searchType,
taxonomy: Globals.taxonomy
searchType: this.searchType
};
},
/** ui events hash */
......@@ -85,24 +81,13 @@ define(['require',
if (e.target.nodeName.toLocaleLowerCase() == "i") {
this.onClickTagCross(e);
} else {
if (scope.hasClass('term')) {
var url = scope.data('href').split(".").join("/terms/");
this.triggerUrl({
url: '#!/taxonomy/detailCatalog' + UrlLinks.taxonomiesApiUrl() + '/' + url,
urlParams: null,
mergeBrowserUrl: false,
trigger: true,
updateTabState: null
});
} else {
this.triggerUrl({
url: '#!/tag/tagAttribute/' + scope.text(),
urlParams: null,
mergeBrowserUrl: false,
trigger: true,
updateTabState: null
});
}
this.triggerUrl({
url: '#!/tag/tagAttribute/' + scope.text(),
urlParams: null,
mergeBrowserUrl: false,
trigger: true,
updateTabState: null
});
}
};
events["keyup " + this.ui.gotoPage] = function(e) {
......@@ -122,18 +107,7 @@ define(['require',
events["change " + this.ui.showPage] = 'changePageLimit';
events["click " + this.ui.gotoPagebtn] = 'gotoPagebtn';
events["click " + this.ui.addTag] = 'checkedValue';
events["click " + this.ui.addTerm] = 'checkedValue';
events["click " + this.ui.addAssignTag] = 'checkedValue';
events["click " + this.ui.showMoreLessTerm] = function(e) {
e.stopPropagation();
$(e.currentTarget).find('i').toggleClass('fa fa-angle-right fa fa-angle-up');
$(e.currentTarget).parents('.searchTerm').find('div.termTableBreadcrumb>div.showHideDiv').toggleClass('hide');
if ($(e.currentTarget).find('i').hasClass('fa-angle-right')) {
$(e.currentTarget).find('span').text('Show More');
} else {
$(e.currentTarget).find('span').text('Show less');
}
};
events["click " + this.ui.nextData] = "onClicknextData";
events["click " + this.ui.previousData] = "onClickpreviousData";
events["click " + this.ui.createEntity] = 'onClickCreateEntity';
......@@ -190,7 +164,6 @@ define(['require',
}
this.searchCollection.find(function(item) {
if (item.get('isEnable')) {
var term = [];
var obj = item.toJSON();
that.arr.push({
id: obj.guid,
......@@ -200,14 +173,8 @@ define(['require',
});
if (this.arr.length > 0) {
if (Globals.taxonomy) {
this.$('.multiSelectTerm').show();
}
this.$('.multiSelectTag').show();
} else {
if (Globals.taxonomy) {
this.$('.multiSelectTerm').hide();
}
this.$('.multiSelectTag').hide();
}
});
......@@ -232,7 +199,7 @@ define(['require',
this.updateColumnList(state);
var excludeDefaultColumn = [];
if (this.value && this.value.type) {
excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "terms");
excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag");
if (this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show();
} else {
......@@ -357,7 +324,7 @@ define(['require',
}
if (isPostMethod && isSearchTab) {
var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "terms") : null,
var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag") : null,
filterObj = {
'entityFilters': entityFilters,
'tagFilters': tagFilters,
......@@ -544,19 +511,9 @@ define(['require',
that.ui.containerCheckBox.hide();
}
that.$(".ellipsis .inputAssignTag").hide();
that.renderBreadcrumb();
that.checkTableFetch();
});
},
renderBreadcrumb: function() {
var that = this;
_.each(this.bradCrumbList, function(object) {
_.each(object.value, function(subObj) {
var scopeObject = that.$('[dataterm-id="' + object.scopeId + '"]').find('[dataterm-name="' + subObj.name + '"] .liContent');
CommonViewFunction.breadcrumbMaker({ urlList: subObj.valueUrl, scope: scopeObject });
});
});
},
checkTableFetch: function() {
if (this.asyncFetchCounter <= 0) {
this.hideLoader();
......@@ -688,7 +645,7 @@ define(['require',
}
})
};
this.getTagTermCol({ 'col': col, 'columnToShow': columnToShow });
this.getTagCol({ 'col': col, 'columnToShow': columnToShow });
if (this.value && this.value.searchType === "basic") {
var def = this.entityDefCollection.fullCollection.find({ name: this.value.type });
......@@ -781,7 +738,7 @@ define(['require',
}
return this.searchCollection.constructor.getTableCols(col, this.searchCollection);
},
getTagTermCol: function(options) {
getTagCol: function(options) {
var that = this,
columnToShow = options.columnToShow,
col = options.col;
......@@ -807,37 +764,11 @@ define(['require',
}
})
};
if (Globals.taxonomy) {
col['terms'] = {
label: "Terms",
cell: "Html",
editable: false,
sortable: false,
resizeable: true,
orderable: true,
renderable: (columnToShow ? _.contains(columnToShow, 'terms') : true),
className: 'searchTerm',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) {
var obj = model.toJSON();
var returnObject = CommonViewFunction.termTableBreadcrumbMaker(obj);
if (returnObject.object) {
that.bradCrumbList.push(returnObject.object);
}
if (obj.status && Enums.entityStateReadOnly[obj.status]) {
return '<div class="readOnly">' + returnObject.html + '</div>';
} else {
return returnObject.html;
}
}
})
};
}
}
},
addTagModalView: function(guid, multiple) {
var that = this;
require(['views/tag/addTagModalView'], function(AddTagModalView) {
require(['views/tag/AddTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({
guid: guid,
multiple: multiple,
......@@ -883,84 +814,45 @@ define(['require',
checkedValue: function(e) {
var guid = "",
that = this,
isTagMultiSelect = $(e.currentTarget).hasClass('multiSelectTag'),
isTermMultiSelect = $(e.currentTarget).hasClass('multiSelectTerm'),
isTagButton = $(e.currentTarget).hasClass('assignTag');
if (isTagButton) {
if (isTagMultiSelect && this.arr && this.arr.length) {
that.addTagModalView(guid, this.arr);
} else {
guid = that.$(e.currentTarget).data("guid");
that.addTagModalView(guid);
}
isTagMultiSelect = $(e.currentTarget).hasClass('multiSelectTag');
if (isTagMultiSelect && this.arr && this.arr.length) {
that.addTagModalView(guid, this.arr);
} else {
if (isTermMultiSelect && this.arr && this.arr.length) {
that.addTermModalView(guid, this.arr);
} else {
guid = that.$(e.currentTarget).data("guid");
that.addTermModalView(guid);
}
guid = that.$(e.currentTarget).data("guid");
that.addTagModalView(guid);
}
},
addTermModalView: function(guid, multiple) {
var that = this;
require([
'views/business_catalog/AddTermToEntityLayoutView',
], function(AddTermToEntityLayoutView) {
var view = new AddTermToEntityLayoutView({
guid: guid,
multiple: multiple,
callback: function() {
that.fetchCollection();
that.arr = [];
},
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that)
});
});
},
onClickTagCross: function(e) {
var tagName = $(e.target).data("name"),
var that = this,
tagName = $(e.target).data("name"),
guid = $(e.target).data("guid"),
assetName = $(e.target).data("assetname"),
tagOrTerm = $(e.target).data("type"),
that = this;
if (tagOrTerm === "term") {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove"
});
} else if (tagOrTerm === "tag") {
var modal = CommonViewFunction.deleteTagModel({
modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + assetName + " ?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove"
});
}
if (modal) {
modal.on('ok', function() {
that.deleteTagData(e, tagOrTerm);
that.deleteTagData({
'tagName': tagName,
'guid': guid
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
}
},
deleteTagData: function(e, tagOrTerm) {
var that = this,
tagName = $(e.target).data("name"),
guid = $(e.target).data("guid");
CommonViewFunction.deleteTag({
'tagName': tagName,
'guid': guid,
'tagOrTerm': tagOrTerm,
deleteTagData: function(options) {
var that = this;
CommonViewFunction.deleteTag(_.extend({}, options, {
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
callback: function() {
that.fetchCollection();
}
});
}));
},
onClicknextData: function() {
this.offset = this.offset + this.limit;
......
......@@ -17,7 +17,7 @@
*/
define(['require',
'hbs!tmpl/site/header',
'hbs!tmpl/site/Header',
'utils/CommonViewFunction',
'utils/Globals'
], function(require, tmpl, CommonViewFunction, Globals) {
......
......@@ -17,7 +17,7 @@
*/
define(['require',
'hbs!tmpl/business_catalog/SideNavLayoutView_tmpl',
'hbs!tmpl/site/SideNavLayoutView_tmpl',
'utils/Utils',
'utils/Globals',
'utils/UrlLinks'
......@@ -37,7 +37,6 @@ define(['require',
},
templateHelpers: function() {
return {
taxonomy: Globals.taxonomy,
tabClass: this.tabClass,
apiBaseUrl: UrlLinks.apiBaseUrl
};
......@@ -60,16 +59,10 @@ define(['require',
if (hashUrl != tabStateUrls.searchUrl) {
Globals.saveApplicationState.tabState.searchUrl = hashUrl;
}
} else if (urlStateObj.isTaxonomyTab()) {
if (hashUrl != tabStateUrls.taxonomyUrl) {
Globals.saveApplicationState.tabState.isTaxonomyTab = hashUrl;
}
}
if (elementName.name == "tab-tag") {
urlString = tabStateUrls.tagUrl; //'#!/tag';
} else if (elementName.name == "tab-taxonomy") {
urlString = tabStateUrls.taxonomyUrl; // '#!/taxonomy';
} else if (elementName.name == "tab-search") {
urlString = tabStateUrls.searchUrl; // '#!/search';
}
......@@ -84,29 +77,14 @@ define(['require',
},
initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'searchTableColumns', 'searchTableFilters'));
if (Globals.taxonomy) {
this.tabClass = "tab col-sm-4";
} else {
this.tabClass = "tab col-sm-6";
}
this.tabClass = "tab col-sm-6";
},
onRender: function() {
this.renderTagLayoutView();
this.renderSearchLayoutView();
if (Globals.taxonomy) {
this.rendeBusinessCatalogLayoutView();
}
this.selectTab();
},
rendeBusinessCatalogLayoutView: function() {
var that = this;
require(['views/business_catalog/BusinessCatalogLayoutView'], function(BusinessCatalogLayoutView) {
that.RBusinessCatalogLayoutView.show(new BusinessCatalogLayoutView({
url: that.url
}));
});
},
renderTagLayoutView: function() {
var that = this;
require(['views/tag/TagLayoutView'], function(TagLayoutView) {
......@@ -137,9 +115,6 @@ define(['require',
if (Utils.getUrlState.isTagTab()) {
this.$('.tabs').find('li a[aria-controls="tab-tag"]').parents('li').addClass('active').siblings().removeClass('active');
this.$('.tab-content').find('div#tab-tag').addClass('active').siblings().removeClass('active');
} else if (Utils.getUrlState.isTaxonomyTab()) {
this.$('.tabs').find('li a[aria-controls="tab-taxonomy"]').parents('li').addClass('active').siblings().removeClass('active');
this.$('.tab-content').find('div#tab-taxonomy').addClass('active').siblings().removeClass('active');
} else if (Utils.getUrlState.isSearchTab() || (Utils.getUrlState.isDetailPage()) || Utils.getUrlState.isInitial()) {
this.$('.tabs').find('li a[aria-controls="tab-search"]').parents('li').addClass('active').siblings().removeClass('active');
this.$('.tab-content').find('div#tab-search').addClass('active').siblings().removeClass('active');
......
......@@ -17,7 +17,7 @@
*/
define(['require',
'hbs!tmpl/tag/addTagModalView_tmpl',
'hbs!tmpl/tag/AddTagModalView_tmpl',
'collection/VTagList',
'collection/VCommonList',
'modules/Modal',
......@@ -215,9 +215,6 @@ define(['require',
var str = '<option selected="selected" disabled="disabled">-- Select a tag from the dropdown list --</option>';
this.collection.fullCollection.sort().each(function(obj, key) {
var name = Utils.getName(obj.toJSON(), 'name');
if (name === "TaxonomyTerm") {
return;
}
// using obj.get('name') insted of name variable because if html is presen in name then escaped name will not found in tagList.
if (_.indexOf(that.tagList, obj.get('name')) === -1) {
str += '<option ' + (that.tagModel && that.tagModel.typeName === name ? 'selected' : '') + '>' + name + '</option>';
......
......@@ -18,7 +18,7 @@
define(['require',
'backbone',
'hbs!tmpl/tag/createTagLayoutView_tmpl',
'hbs!tmpl/tag/CreateTagLayoutView_tmpl',
'utils/Utils',
'views/tag/TagAttributeItemView',
'collection/VTagList',
......@@ -74,11 +74,9 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'tagCollection', 'model', 'tag', 'termCollection', 'descriptionData'));
_.extend(this, _.pick(options, 'tagCollection', 'model', 'tag', 'descriptionData'));
if (this.model) {
this.description = this.model.get('description');
} else if (this.termCollection) {
this.description = this.descriptionData;
} else {
this.create = true;
}
......@@ -107,15 +105,12 @@ define(['require',
});
},
tagCollectionList: function() {
var str = '',
that = this;
var that = this,
str = '';
this.ui.parentTag.empty();
this.tagCollection.fullCollection.each(function(val) {
var name = Utils.getName(val.toJSON()),
checkTagOrTerm = Utils.checkTagOrTerm(name);
if (checkTagOrTerm.tag) {
str += '<option>' + (name) + '</option>';
}
var name = Utils.getName(val.toJSON());
str += '<option>' + (name) + '</option>';
});
that.ui.parentTag.html(str);
// IE9 support
......@@ -152,4 +147,4 @@ define(['require',
}
});
return CreateTagLayoutView;
});
});
\ No newline at end of file
......@@ -35,7 +35,7 @@ define(['require',
/** Layout sub regions */
regions: {
RTagTermTableLayoutView: "#r_tagTermTableLayoutView"
RTagTableLayoutView: "#r_tagTableLayoutView"
},
/** ui selector cache */
......@@ -64,27 +64,14 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'guid', 'term', 'entityName', 'fetchCollection', 'enumDefCollection', 'classificationDefCollection'));
_.extend(this, _.pick(options, 'entity', 'guid', 'entityName', 'fetchCollection', 'enumDefCollection', 'classificationDefCollection'));
this.collectionObject = this.entity;
this.tagTermCollection = new VTagList();
var tagorterm = _.toArray(this.collectionObject.classifications),
tagTermList = [],
that = this;
_.each(tagorterm, function(object) {
var checkTagOrTerm = Utils.checkTagOrTerm(object);
if (that.term) {
if (checkTagOrTerm.term) {
tagTermList.push(object);
}
} else {
if (checkTagOrTerm.tag) {
tagTermList.push(object);
}
}
});
this.tagTermCollection.set(tagTermList);
this.tagCollection = new VTagList();
var that = this,
tags = _.toArray(this.collectionObject.classifications);
this.tagCollection.set(tags);
this.commonTableOptions = {
collection: this.tagTermCollection,
collection: this.tagCollection,
includeFilter: false,
includePagination: true,
includePageSize: false,
......@@ -105,7 +92,7 @@ define(['require',
var that = this;
require(['utils/TableLayout'], function(TableLayout) {
var cols = new Backgrid.Columns(that.getSchemaTableColumns());
that.RTagTermTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
that.RTagTableLayoutView.show(new TableLayout(_.extend({}, that.commonTableOptions, {
columns: cols
})));
});
......@@ -114,9 +101,9 @@ define(['require',
var that = this;
var col = {};
return this.tagTermCollection.constructor.getTableCols({
TagorTerm: {
label: (this.term) ? "Terms" : "Tags",
return this.tagCollection.constructor.getTableCols({
tag: {
label: "Tags",
cell: "String",
editable: false,
sortable: false,
......@@ -126,7 +113,7 @@ define(['require',
}
})
},
Attributes: {
attributes: {
label: "Attributes",
cell: "html",
editable: false,
......@@ -177,52 +164,40 @@ define(['require',
})
},
},
this.tagTermCollection);
this.tagCollection);
},
addModalView: function(e) {
var that = this;
require(['views/tag/addTagModalView'], function(AddTagModalView) {
require(['views/tag/AddTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({
guid: that.guid,
modalCollection: that.collection,
enumDefCollection: that.enumDefCollection
});
// view.saveTagData = function() {
//override saveTagData function
// }
});
},
deleteTagDataModal: function(e) {
var tagName = $(e.currentTarget).data("name"),
that = this;
if (that.term) {
var modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>",
titleMessage: Messages.removeTerm,
buttonText: "Remove",
});
} else {
var modal = CommonViewFunction.deleteTagModel({
var that = this,
tagName = $(e.currentTarget).data("name"),
modal = CommonViewFunction.deleteTagModel({
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(tagName) + "</b> assignment from" + " " + "<b>" + this.entityName + "?</b></div>",
titleMessage: Messages.removeTag,
buttonText: "Remove",
});
}
modal.on('ok', function() {
that.deleteTagData(e);
that.deleteTagData({
'tagName': tagName,
'guid': that.guid
});
});
modal.on('closeModal', function() {
modal.trigger('cancel');
});
},
deleteTagData: function(e) {
var that = this,
tagName = $(e.currentTarget).data("name");
CommonViewFunction.deleteTag({
'tagName': tagName,
'guid': that.guid,
'tagOrTerm': (that.term ? "term" : "tag"),
deleteTagData: function(options) {
var that = this;
CommonViewFunction.deleteTag(_.extend({}, options, {
showLoader: function() {
that.$('.fontLoader').show();
that.$('.tableOverlay').show();
......@@ -238,14 +213,14 @@ define(['require',
}
}
});
}));
},
editTagDataModal: function(e) {
var that = this,
tagName = $(e.currentTarget).data('name'),
tagModel = _.findWhere(that.collectionObject.classifications, { typeName: tagName });
require([
'views/tag/addTagModalView'
'views/tag/AddTagModalView'
], function(AddTagModalView) {
var view = new AddTagModalView({
'tagModel': tagModel,
......
......@@ -144,17 +144,14 @@ define(['require',
};
this.collection.fullCollection.sort().each(function(model) {
var name = Utils.getName(model.toJSON(), 'name');
var checkTagOrTerm = Utils.checkTagOrTerm(name);
if (checkTagOrTerm.tag) {
if (searchString) {
if (name.search(new RegExp(searchString, "i")) != -1) {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '" >' + name + '</a></li>';
} else {
return;
}
if (searchString) {
if (name.search(new RegExp(searchString, "i")) != -1) {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '" >' + name + '</a></li>';
} else {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '">' + name + '</a></li>';
return;
}
} else {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '">' + name + '</a></li>';
}
});
this.ui.tagsParent.empty().html(str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment