From 37be53bbb7eec13f8ce57377c8653f482216553f Mon Sep 17 00:00:00 2001 From: kevalbhatt <kbhatt@apache.org> Date: Mon, 30 Oct 2017 18:41:55 +0530 Subject: [PATCH] ATLAS-2217 : Remove all taxonomy reference from UI --- dashboardv2/public/css/scss/breadcrumb.scss | 62 -------------------------------------------------------------- dashboardv2/public/css/scss/business-catlog.scss | 127 ------------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/css/scss/common.scss | 3 --- dashboardv2/public/css/scss/style.scss | 4 ---- dashboardv2/public/css/scss/theme.scss | 8 -------- dashboardv2/public/css/scss/tree.scss | 183 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/collection/VCatalogList.js | 64 ---------------------------------------------------------------- dashboardv2/public/js/main.js | 3 --- dashboardv2/public/js/models/VCatalog.js | 50 -------------------------------------------------- dashboardv2/public/js/modules/Modal.js | 2 +- dashboardv2/public/js/router/Router.js | 87 +++++++++++---------------------------------------------------------------------------- dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html | 17 ----------------- dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html | 38 -------------------------------------- dashboardv2/public/js/templates/business_catalog/BusinessCatalogDetailLayoutView_tmpl.html | 42 ------------------------------------------ dashboardv2/public/js/templates/business_catalog/BusinessCatalogHeader.html | 29 ----------------------------- dashboardv2/public/js/templates/business_catalog/BusinessCatalogLayoutView_tmpl.html | 17 ----------------- dashboardv2/public/js/templates/business_catalog/MoveTermLayoutView_tmpl.html | 19 ------------------- dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html | 39 --------------------------------------- dashboardv2/public/js/templates/business_catalog/TreeLayoutView_tmpl.html | 34 ---------------------------------- dashboardv2/public/js/templates/common/AboutAtlas_tmpl.html | 26 ++++++++++++++++++++++++++ dashboardv2/public/js/templates/common/Modal.html | 44 ++++++++++++++++++++++++++++++++++++++++++++ dashboardv2/public/js/templates/common/aboutAtlas_tmpl.html | 26 -------------------------- dashboardv2/public/js/templates/common/modal.html | 44 -------------------------------------------- dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html | 18 ------------------ dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html | 1 - dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html | 2 -- dashboardv2/public/js/templates/site/Header.html | 29 +++++++++++++++++++++++++++++ dashboardv2/public/js/templates/site/SideNavLayoutView_tmpl.html | 33 +++++++++++++++++++++++++++++++++ dashboardv2/public/js/templates/site/header.html | 29 ----------------------------- dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html | 37 +++++++++++++++++++++++++++++++++++++ dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html | 2 +- dashboardv2/public/js/templates/tag/addTagModalView_tmpl.html | 37 ------------------------------------- dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html | 54 ------------------------------------------------------ dashboardv2/public/js/utils/CommonViewFunction.js | 167 ++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/utils/Globals.js | 1 - dashboardv2/public/js/utils/Messages.js | 6 +----- dashboardv2/public/js/utils/UrlLinks.js | 6 ------ dashboardv2/public/js/utils/Utils.js | 62 -------------------------------------------------------------- dashboardv2/public/js/views/business_catalog/AddTermLayoutView.js | 64 ---------------------------------------------------------------- dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js | 124 ---------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js | 167 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js | 65 ----------------------------------------------------------------- dashboardv2/public/js/views/business_catalog/BusinessCatalogLayoutView.js | 65 ----------------------------------------------------------------- dashboardv2/public/js/views/business_catalog/MoveTermLayoutView.js | 54 ------------------------------------------------------ dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js | 150 ------------------------------------------------------------------------------------------------------------------------------------------------------ dashboardv2/public/js/views/business_catalog/TreeLayoutView.js | 629 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/views/common/AboutAtlas.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dashboardv2/public/js/views/common/aboutAtlas.js | 65 ----------------------------------------------------------------- dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js | 105 +++++++++++++++++++++++---------------------------------------------------------------------------------- dashboardv2/public/js/views/schema/SchemaLayoutView.js | 133 ++++++++++++++++++------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/views/search/SearchLayoutView.js | 5 +---- dashboardv2/public/js/views/search/SearchResultLayoutView.js | 166 +++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------- dashboardv2/public/js/views/site/Header.js | 2 +- dashboardv2/public/js/views/site/SideNavLayoutView.js | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dashboardv2/public/js/views/tag/AddTagModalView.js | 380 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dashboardv2/public/js/views/tag/CreateTagLayoutView.js | 19 +++++++------------ dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js | 77 ++++++++++++++++++++++++++--------------------------------------------------- dashboardv2/public/js/views/tag/TagLayoutView.js | 15 ++++++--------- dashboardv2/public/js/views/tag/addTagModalView.js | 383 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 60 files changed, 935 insertions(+), 3438 deletions(-) delete mode 100644 dashboardv2/public/css/scss/breadcrumb.scss delete mode 100644 dashboardv2/public/css/scss/business-catlog.scss delete mode 100644 dashboardv2/public/css/scss/tree.scss delete mode 100644 dashboardv2/public/js/collection/VCatalogList.js delete mode 100644 dashboardv2/public/js/models/VCatalog.js delete mode 100644 dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/BusinessCatalogDetailLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/BusinessCatalogHeader.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/BusinessCatalogLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/MoveTermLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/business_catalog/TreeLayoutView_tmpl.html create mode 100644 dashboardv2/public/js/templates/common/AboutAtlas_tmpl.html create mode 100644 dashboardv2/public/js/templates/common/Modal.html delete mode 100644 dashboardv2/public/js/templates/common/aboutAtlas_tmpl.html delete mode 100644 dashboardv2/public/js/templates/common/modal.html create mode 100644 dashboardv2/public/js/templates/site/Header.html create mode 100644 dashboardv2/public/js/templates/site/SideNavLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/site/header.html create mode 100644 dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html create mode 100644 dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/tag/addTagModalView_tmpl.html delete mode 100644 dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html delete mode 100644 dashboardv2/public/js/views/business_catalog/AddTermLayoutView.js delete mode 100644 dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js delete mode 100644 dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js delete mode 100644 dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js delete mode 100644 dashboardv2/public/js/views/business_catalog/BusinessCatalogLayoutView.js delete mode 100644 dashboardv2/public/js/views/business_catalog/MoveTermLayoutView.js delete mode 100644 dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js delete mode 100644 dashboardv2/public/js/views/business_catalog/TreeLayoutView.js create mode 100644 dashboardv2/public/js/views/common/AboutAtlas.js delete mode 100644 dashboardv2/public/js/views/common/aboutAtlas.js create mode 100644 dashboardv2/public/js/views/site/SideNavLayoutView.js create mode 100644 dashboardv2/public/js/views/tag/AddTagModalView.js delete mode 100644 dashboardv2/public/js/views/tag/addTagModalView.js diff --git a/dashboardv2/public/css/scss/breadcrumb.scss b/dashboardv2/public/css/scss/breadcrumb.scss deleted file mode 100644 index 4bb09db..0000000 --- a/dashboardv2/public/css/scss/breadcrumb.scss +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/* 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 diff --git a/dashboardv2/public/css/scss/business-catlog.scss b/dashboardv2/public/css/scss/business-catlog.scss deleted file mode 100644 index 7e43f64..0000000 --- a/dashboardv2/public/css/scss/business-catlog.scss +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/* 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 diff --git a/dashboardv2/public/css/scss/common.scss b/dashboardv2/public/css/scss/common.scss index fd6c0f0..3c2dff5 100644 --- a/dashboardv2/public/css/scss/common.scss +++ b/dashboardv2/public/css/scss/common.scss @@ -41,9 +41,6 @@ &[data-id="edit"] { display: none; } - &.btn[data-id="addTerm"] { - display: none; - } &.btn[data-id="tagClick"] { span { display: block; diff --git a/dashboardv2/public/css/scss/style.scss b/dashboardv2/public/css/scss/style.scss index 422680e..531a727 100644 --- a/dashboardv2/public/css/scss/style.scss +++ b/dashboardv2/public/css/scss/style.scss @@ -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"; diff --git a/dashboardv2/public/css/scss/theme.scss b/dashboardv2/public/css/scss/theme.scss index dae7827..4ce51b2 100644 --- a/dashboardv2/public/css/scss/theme.scss +++ b/dashboardv2/public/css/scss/theme.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; diff --git a/dashboardv2/public/css/scss/tree.scss b/dashboardv2/public/css/scss/tree.scss deleted file mode 100644 index 4339dba..0000000 --- a/dashboardv2/public/css/scss/tree.scss +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/* 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 diff --git a/dashboardv2/public/js/collection/VCatalogList.js b/dashboardv2/public/js/collection/VCatalogList.js deleted file mode 100644 index 7899b3e..0000000 --- a/dashboardv2/public/js/collection/VCatalogList.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - '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; -}); diff --git a/dashboardv2/public/js/main.js b/dashboardv2/public/js/main.js index aae231c..8e4dce5 100644 --- a/dashboardv2/public/js/main.js +++ b/dashboardv2/public/js/main.js @@ -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']; } diff --git a/dashboardv2/public/js/models/VCatalog.js b/dashboardv2/public/js/models/VCatalog.js deleted file mode 100644 index ea5ae2c..0000000 --- a/dashboardv2/public/js/models/VCatalog.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - '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; -}); diff --git a/dashboardv2/public/js/modules/Modal.js b/dashboardv2/public/js/modules/Modal.js index 48f385e..b49f657 100644 --- a/dashboardv2/public/js/modules/Modal.js +++ b/dashboardv2/public/js/modules/Modal.js @@ -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({ diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js index 7790aef..e9c9e5e 100644 --- a/dashboardv2/public/js/router/Router.js +++ b/dashboardv2/public/js/router/Router.js @@ -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, diff --git a/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html deleted file mode 100644 index 36cf43a..0000000 --- a/dashboardv2/public/js/templates/business_catalog/AddTermToEntityLayoutView_tmpl.html +++ /dev/null @@ -1,17 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div id="r_treeLayoutView"></div> diff --git a/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html deleted file mode 100644 index 0b62098..0000000 --- a/dashboardv2/public/js/templates/business_catalog/AddTermView_tmpl.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<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 diff --git a/dashboardv2/public/js/templates/business_catalog/BusinessCatalogDetailLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/BusinessCatalogDetailLayoutView_tmpl.html deleted file mode 100644 index d3c9fe1..0000000 --- a/dashboardv2/public/js/templates/business_catalog/BusinessCatalogDetailLayoutView_tmpl.html +++ /dev/null @@ -1,42 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div class="page-title clearfix"> - <div class="fontLoader"> - <i class="fa fa-refresh fa-spin-custom"></i> - </div> - <div class="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> diff --git a/dashboardv2/public/js/templates/business_catalog/BusinessCatalogHeader.html b/dashboardv2/public/js/templates/business_catalog/BusinessCatalogHeader.html deleted file mode 100644 index 3f8928e..0000000 --- a/dashboardv2/public/js/templates/business_catalog/BusinessCatalogHeader.html +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<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> diff --git a/dashboardv2/public/js/templates/business_catalog/BusinessCatalogLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/BusinessCatalogLayoutView_tmpl.html deleted file mode 100644 index 36cf43a..0000000 --- a/dashboardv2/public/js/templates/business_catalog/BusinessCatalogLayoutView_tmpl.html +++ /dev/null @@ -1,17 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div id="r_treeLayoutView"></div> diff --git a/dashboardv2/public/js/templates/business_catalog/MoveTermLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/MoveTermLayoutView_tmpl.html deleted file mode 100644 index 0f9a066..0000000 --- a/dashboardv2/public/js/templates/business_catalog/MoveTermLayoutView_tmpl.html +++ /dev/null @@ -1,19 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div class="form-control termMoveDiv"> - <div id="tree"></div> -</div> diff --git a/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html deleted file mode 100644 index 44b722f..0000000 --- a/dashboardv2/public/js/templates/business_catalog/SideNavLayoutView_tmpl.html +++ /dev/null @@ -1,39 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<ul class="sidebar-nav"> - <li class="sidebar-brand"> - <a href="{{apiBaseUrl}}/index.html"><i class="fa fa-globe"></i> Apache Atlas</a> - </li> - <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> -</div> diff --git a/dashboardv2/public/js/templates/business_catalog/TreeLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_catalog/TreeLayoutView_tmpl.html deleted file mode 100644 index ca2968e..0000000 --- a/dashboardv2/public/js/templates/business_catalog/TreeLayoutView_tmpl.html +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div class="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> diff --git a/dashboardv2/public/js/templates/common/AboutAtlas_tmpl.html b/dashboardv2/public/js/templates/common/AboutAtlas_tmpl.html new file mode 100644 index 0000000..a3cf90a --- /dev/null +++ b/dashboardv2/public/js/templates/common/AboutAtlas_tmpl.html @@ -0,0 +1,26 @@ +<!-- + * 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="row"> + <div class="col-md-4"> + <div class="col-md-8 subContent"> + <p data-id="atlasVersion"></p> + <br> + <p class="text-info">Get involved!</p> + <p class="text-info"><a href="http://apache.org/licenses/LICENSE-2.0" target="_blank">Licensed under the Apache License Version 2.0</a></p> + </div> + </div> +</div> diff --git a/dashboardv2/public/js/templates/common/Modal.html b/dashboardv2/public/js/templates/common/Modal.html new file mode 100644 index 0000000..e000fa8 --- /dev/null +++ b/dashboardv2/public/js/templates/common/Modal.html @@ -0,0 +1,44 @@ +<!-- + * 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="modal-dialog {{mainClass}} " style="width:{{width}}" role="document"> + <div class="modal-content"> + {{#if title}} + <div class="modal-header"> + <a class="close">×</a> + <h4 class="modal-title"> + {{#if titleHtml}} + {{{tt title}}} + {{else}} + {{tt title}} + {{/if}} + </h4> + </div> + {{/if}} {{#if contentWithFooter}} {{else}} + <div class="modal-body">{{content}}</div> + {{#if showFooter}} + <div class="modal-footer"> + {{#if buttons}} {{#each buttons}} + <button type="button" {{#if this.title}} title="{{this.title}}" {{/if}} class="btn {{this.btnClass}}">{{this.text}}</button> + {{/each}} {{else}} {{#if allowCancel}} {{#if cancelText}} + <button type="button" class="btn btn-action cancel">{{tt cancelText}}</button> + {{/if}} {{/if}} + <button type="button" class="btn btn-atlas ok">{{tt okText}}</button> + {{/if}} + </div> + {{/if}} {{/if}} + </div> +</div> \ No newline at end of file diff --git a/dashboardv2/public/js/templates/common/aboutAtlas_tmpl.html b/dashboardv2/public/js/templates/common/aboutAtlas_tmpl.html deleted file mode 100644 index a3cf90a..0000000 --- a/dashboardv2/public/js/templates/common/aboutAtlas_tmpl.html +++ /dev/null @@ -1,26 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div class="row"> - <div class="col-md-4"> - <div class="col-md-8 subContent"> - <p data-id="atlasVersion"></p> - <br> - <p class="text-info">Get involved!</p> - <p class="text-info"><a href="http://apache.org/licenses/LICENSE-2.0" target="_blank">Licensed under the Apache License Version 2.0</a></p> - </div> - </div> -</div> diff --git a/dashboardv2/public/js/templates/common/modal.html b/dashboardv2/public/js/templates/common/modal.html deleted file mode 100644 index e000fa8..0000000 --- a/dashboardv2/public/js/templates/common/modal.html +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div class="modal-dialog {{mainClass}} " style="width:{{width}}" role="document"> - <div class="modal-content"> - {{#if title}} - <div class="modal-header"> - <a class="close">×</a> - <h4 class="modal-title"> - {{#if titleHtml}} - {{{tt title}}} - {{else}} - {{tt title}} - {{/if}} - </h4> - </div> - {{/if}} {{#if contentWithFooter}} {{else}} - <div class="modal-body">{{content}}</div> - {{#if showFooter}} - <div class="modal-footer"> - {{#if buttons}} {{#each buttons}} - <button type="button" {{#if this.title}} title="{{this.title}}" {{/if}} class="btn {{this.btnClass}}">{{this.text}}</button> - {{/each}} {{else}} {{#if allowCancel}} {{#if cancelText}} - <button type="button" class="btn btn-action cancel">{{tt cancelText}}</button> - {{/if}} {{/if}} - <button type="button" class="btn btn-atlas ok">{{tt okText}}</button> - {{/if}} - </div> - {{/if}} {{/if}} - </div> -</div> \ No newline at end of file diff --git a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html index 8acd8e4..a08d9ab 100644 --- a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html @@ -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"> diff --git a/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html b/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html index 104c8de..31300b8 100644 --- a/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/schema/SchemaTableLayoutView_tmpl.html @@ -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> diff --git a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html index 80960d4..87a89b3 100644 --- a/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/search/SearchResultLayoutView_tmpl.html @@ -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> diff --git a/dashboardv2/public/js/templates/site/Header.html b/dashboardv2/public/js/templates/site/Header.html new file mode 100644 index 0000000..4673688 --- /dev/null +++ b/dashboardv2/public/js/templates/site/Header.html @@ -0,0 +1,29 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<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" class="user-dropdown"><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> diff --git a/dashboardv2/public/js/templates/site/SideNavLayoutView_tmpl.html b/dashboardv2/public/js/templates/site/SideNavLayoutView_tmpl.html new file mode 100644 index 0000000..b706609 --- /dev/null +++ b/dashboardv2/public/js/templates/site/SideNavLayoutView_tmpl.html @@ -0,0 +1,33 @@ +<!-- + * 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. +--> +<ul class="sidebar-nav"> + <li class="sidebar-brand"> + <a href="{{apiBaseUrl}}/index.html"><i class="fa fa-globe"></i> Apache Atlas</a> + </li> + <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> + </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-search"> + <div id="r_searchLayoutView"></div> + </div> +</div> diff --git a/dashboardv2/public/js/templates/site/header.html b/dashboardv2/public/js/templates/site/header.html deleted file mode 100644 index 4673688..0000000 --- a/dashboardv2/public/js/templates/site/header.html +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<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" class="user-dropdown"><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> diff --git a/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html b/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html new file mode 100644 index 0000000..a477532 --- /dev/null +++ b/dashboardv2/public/js/templates/tag/AddTagModalView_tmpl.html @@ -0,0 +1,37 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<div> + <div class="form-group hide"> + {{#if tagModel}} + <h4>{{tagModel.typeName}}</h4> {{else}} + <select class="form-control row-margin-bottom" data-id="addTagOptions" required> + </select> + {{/if}} + </div> + <div class="row modalHeight"> + <div class="col-sm-12"> + <div class="attrLoader" style="margin-left:45%;display:none"> + <i class="fa fa-refresh fa-spin-custom"></i> + </div> + </div> + <div class="col-sm-12" style="display:none"> + <p>Tag Attributes(optional)</p> + <p class="text-gray">Add attribute values for this tag</p> + <div data-id="tagAttribute"></div> + </div> + </div> +</div> diff --git a/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html new file mode 100644 index 0000000..d9c5907 --- /dev/null +++ b/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html @@ -0,0 +1,54 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +--> +<div class="fontLoader"> + <i class="fa fa-refresh fa-spin-custom"></i> +</div> +<form name="tagDefinitionform" class="hide form-horizontal" data-id="createTagForm"> + <div class="form-group"> + <label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label> + {{#if create}} + <div class="col-sm-10"> + <input class="form-control" data-id="tagName" placeholder="Name(required)" autofocus/> + </div> + {{else}} + <span class="ellipsis control-label text-left col-sm-10" data-id="title"></span> {{/if}} + </div> + <div class="form-group"> + <label class="control-label col-sm-2" for="description">Description</label> + <div class="col-sm-10"> + <input class="form-control" data-id="description" value="{{description}}" placeholder="Description" /> + </div> + </div> + {{#if create}} + <div class="form-group"> + <div class="col-md-12"> + <label>Select tags to inherit attributes(optional)</label> + <p class="text-gray">Attributes define additional properties for the tag</p> + <select class="form-control" data-id="parentTagList" multiple="multiple"></select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-12">Attributes(optional)</label> + <div class="col-sm-12"> + <button title="Add New Attribute" type="button" class="btn btn-action btn-sm" data-id="attributeData"><i class="fa fa-plus"></i> Add New Attributes</button> + </div> + </div> + {{/if}} + <div data-id="addAttributeDiv"> + </div> + </div> +</form> \ No newline at end of file diff --git a/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html index 291f230..76f225a 100644 --- a/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/tag/TagDetailTableLayoutView_tmpl.html @@ -16,5 +16,5 @@ --> <div> <div class="tableOverlay"></div> - <div id="r_tagTermTableLayoutView"></div> + <div id="r_tagTableLayoutView"></div> </div> diff --git a/dashboardv2/public/js/templates/tag/addTagModalView_tmpl.html b/dashboardv2/public/js/templates/tag/addTagModalView_tmpl.html deleted file mode 100644 index a477532..0000000 --- a/dashboardv2/public/js/templates/tag/addTagModalView_tmpl.html +++ /dev/null @@ -1,37 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div> - <div class="form-group hide"> - {{#if tagModel}} - <h4>{{tagModel.typeName}}</h4> {{else}} - <select class="form-control row-margin-bottom" data-id="addTagOptions" required> - </select> - {{/if}} - </div> - <div class="row modalHeight"> - <div class="col-sm-12"> - <div class="attrLoader" style="margin-left:45%;display:none"> - <i class="fa fa-refresh fa-spin-custom"></i> - </div> - </div> - <div class="col-sm-12" style="display:none"> - <p>Tag Attributes(optional)</p> - <p class="text-gray">Add attribute values for this tag</p> - <div data-id="tagAttribute"></div> - </div> - </div> -</div> diff --git a/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html deleted file mode 100644 index d9c5907..0000000 --- a/dashboardv2/public/js/templates/tag/createTagLayoutView_tmpl.html +++ /dev/null @@ -1,54 +0,0 @@ -<!-- - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. ---> -<div class="fontLoader"> - <i class="fa fa-refresh fa-spin-custom"></i> -</div> -<form name="tagDefinitionform" class="hide form-horizontal" data-id="createTagForm"> - <div class="form-group"> - <label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label> - {{#if create}} - <div class="col-sm-10"> - <input class="form-control" data-id="tagName" placeholder="Name(required)" autofocus/> - </div> - {{else}} - <span class="ellipsis control-label text-left col-sm-10" data-id="title"></span> {{/if}} - </div> - <div class="form-group"> - <label class="control-label col-sm-2" for="description">Description</label> - <div class="col-sm-10"> - <input class="form-control" data-id="description" value="{{description}}" placeholder="Description" /> - </div> - </div> - {{#if create}} - <div class="form-group"> - <div class="col-md-12"> - <label>Select tags to inherit attributes(optional)</label> - <p class="text-gray">Attributes define additional properties for the tag</p> - <select class="form-control" data-id="parentTagList" multiple="multiple"></select> - </div> - </div> - <div class="form-group"> - <label class="col-sm-12">Attributes(optional)</label> - <div class="col-sm-12"> - <button title="Add New Attribute" type="button" class="btn btn-action btn-sm" data-id="attributeData"><i class="fa fa-plus"></i> Add New Attributes</button> - </div> - </div> - {{/if}} - <div data-id="addAttributeDiv"> - </div> - </div> -</form> \ No newline at end of file diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index a3b6b91..d3153f5 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -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, diff --git a/dashboardv2/public/js/utils/Globals.js b/dashboardv2/public/js/utils/Globals.js index 1b055ed..6225715 100644 --- a/dashboardv2/public/js/utils/Globals.js +++ b/dashboardv2/public/js/utils/Globals.js @@ -27,7 +27,6 @@ define(['require'], function(require) { tabState: { stateChanged: false, tagUrl: "#!/tag", - taxonomyUrl: "#!/taxonomy", searchUrl: "#!/search" }, detailPageState: {} diff --git a/dashboardv2/public/js/utils/Messages.js b/dashboardv2/public/js/utils/Messages.js index 73d58a2..44604cf 100644 --- a/dashboardv2/public/js/utils/Messages.js +++ b/dashboardv2/public/js/utils/Messages.js @@ -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; diff --git a/dashboardv2/public/js/utils/UrlLinks.js b/dashboardv2/public/js/utils/UrlLinks.js index 1ab7061..b69e3a8 100644 --- a/dashboardv2/public/js/utils/UrlLinks.js +++ b/dashboardv2/public/js/utils/UrlLinks.js @@ -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) { diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js index 492eb39..47e9ac2 100644 --- a/dashboardv2/public/js/utils/Utils.js +++ b/dashboardv2/public/js/utils/Utils.js @@ -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; } diff --git a/dashboardv2/public/js/views/business_catalog/AddTermLayoutView.js b/dashboardv2/public/js/views/business_catalog/AddTermLayoutView.js deleted file mode 100644 index 15915d3..0000000 --- a/dashboardv2/public/js/views/business_catalog/AddTermLayoutView.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/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; - -}); diff --git a/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js b/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js deleted file mode 100644 index 307b244..0000000 --- a/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/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; -}); diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js deleted file mode 100644 index 6eb5b8b..0000000 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/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; - -}); diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js deleted file mode 100644 index 4994372..0000000 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - '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; -}); diff --git a/dashboardv2/public/js/views/business_catalog/BusinessCatalogLayoutView.js b/dashboardv2/public/js/views/business_catalog/BusinessCatalogLayoutView.js deleted file mode 100644 index e7c657f..0000000 --- a/dashboardv2/public/js/views/business_catalog/BusinessCatalogLayoutView.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/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; -}); diff --git a/dashboardv2/public/js/views/business_catalog/MoveTermLayoutView.js b/dashboardv2/public/js/views/business_catalog/MoveTermLayoutView.js deleted file mode 100644 index aa0d717..0000000 --- a/dashboardv2/public/js/views/business_catalog/MoveTermLayoutView.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/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; -}); diff --git a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js b/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js deleted file mode 100644 index 3dbaab4..0000000 --- a/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'hbs!tmpl/business_catalog/SideNavLayoutView_tmpl', - 'utils/Utils', - 'utils/Globals', - 'utils/UrlLinks' -], function(require, tmpl, Utils, Globals, UrlLinks) { - 'use strict'; - - var SideNavLayoutView = Marionette.LayoutView.extend({ - template: tmpl, - - regions: { - RBusinessCatalogLayoutView: "#r_businessCatalogLayoutView", - RTagLayoutView: "#r_tagLayoutView", - RSearchLayoutView: "#r_searchLayoutView", - }, - ui: { - tabs: '.tabs li a', - }, - templateHelpers: function() { - return { - taxonomy: Globals.taxonomy, - tabClass: this.tabClass, - apiBaseUrl: UrlLinks.apiBaseUrl - }; - }, - events: function() { - var events = {}, - that = this; - events["click " + this.ui.tabs] = function(e) { - var urlString = "", - elementName = $(e.currentTarget).data(), - tabStateUrls = Globals.saveApplicationState.tabState, - urlStateObj = Utils.getUrlState, - hashUrl = Utils.getUrlState.getQueryUrl().hash; - - if (urlStateObj.isTagTab()) { - if (hashUrl != tabStateUrls.tagUrl) { - Globals.saveApplicationState.tabState.tagUrl = hashUrl; - } - } else if (urlStateObj.isSearchTab()) { - 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'; - } - Utils.setUrl({ - url: urlString, - mergeBrowserUrl: false, - trigger: true, - updateTabState: true - }); - }; - return events; - }, - 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"; - } - }, - 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) { - that.RTagLayoutView.show(new TagLayoutView({ - collection: that.classificationDefCollection, - tag: that.tag, - value: that.value, - typeHeaders: that.typeHeaders - })); - }); - }, - renderSearchLayoutView: function() { - var that = this; - require(['views/search/SearchLayoutView'], function(SearchLayoutView) { - that.RSearchLayoutView.show(new SearchLayoutView({ - value: that.value, - searchVent: that.searchVent, - typeHeaders: that.typeHeaders, - entityDefCollection: that.entityDefCollection, - enumDefCollection: that.enumDefCollection, - classificationDefCollection: that.classificationDefCollection, - searchTableColumns: that.searchTableColumns, - searchTableFilters: that.searchTableFilters - })); - }); - }, - selectTab: function() { - 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'); - } - }, - }); - return SideNavLayoutView; -}); \ No newline at end of file diff --git a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js b/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js deleted file mode 100644 index 90b87be..0000000 --- a/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js +++ /dev/null @@ -1,629 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/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 diff --git a/dashboardv2/public/js/views/common/AboutAtlas.js b/dashboardv2/public/js/views/common/AboutAtlas.js new file mode 100644 index 0000000..8900950 --- /dev/null +++ b/dashboardv2/public/js/views/common/AboutAtlas.js @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +define(['require', + 'backbone', + 'hbs!tmpl/common/AboutAtlas_tmpl', + 'modules/Modal', + 'models/VCommon', + 'utils/UrlLinks', +], function(require, Backbone, AboutAtlasTmpl, Modal, VCommon, UrlLinks) { + 'use strict'; + + var AboutAtlasView = Backbone.Marionette.LayoutView.extend( + /** @lends AboutAtlasView */ + { + template: AboutAtlasTmpl, + /** Layout sub regions */ + regions: {}, + /** ui selector cache */ + ui: { + atlasVersion: "[data-id='atlasVersion']" + }, + /** ui events hash */ + events: function() {}, + /** + * intialize a new AboutAtlasView Layout + * @constructs + */ + initialize: function(options) { + _.extend(this, options); + 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(); + var VCommonModel = new VCommon(); + VCommonModel.aboutUs(url, { + success: function(data) { + var str = "<b>Version : </b>" + _.escape(data.Version); + that.ui.atlasVersion.html(str); + }, + complete: function() {} + }); + }, + + }); + return AboutAtlasView; +}); \ No newline at end of file diff --git a/dashboardv2/public/js/views/common/aboutAtlas.js b/dashboardv2/public/js/views/common/aboutAtlas.js deleted file mode 100644 index 5f9a77c..0000000 --- a/dashboardv2/public/js/views/common/aboutAtlas.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'backbone', - 'hbs!tmpl/common/aboutAtlas_tmpl', - 'models/VCommon', - 'utils/UrlLinks' -], function(require, Backbone, aboutAtlasTmpl, VCommon, UrlLinks) { - 'use strict'; - - var aboutAtlasView = Backbone.Marionette.LayoutView.extend( - /** @lends aboutAtlasView */ - { - template: aboutAtlasTmpl, - /** Layout sub regions */ - regions: {}, - /** ui selector cache */ - ui: { - atlasVersion: "[data-id='atlasVersion']" - }, - /** ui events hash */ - events: function() {}, - /** - * intialize a new aboutAtlasView Layout - * @constructs - */ - initialize: function(options) { - _.extend(this, options); - }, - bindEvents: function() { - - - }, - onRender: function() { - var that = this; - var url = UrlLinks.versionApiUrl(); - var VCommonModel = new VCommon(); - VCommonModel.aboutUs(url, { - success: function(data) { - var str = "<b>Version : </b>" + _.escape(data.Version); - that.ui.atlasVersion.html(str); - }, - complete: function() {} - }); - }, - - }); - return aboutAtlasView; -}); diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js index 4a1c601..76ad61d 100644 --- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js +++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js @@ -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) { diff --git a/dashboardv2/public/js/views/schema/SchemaLayoutView.js b/dashboardv2/public/js/views/schema/SchemaLayoutView.js index bd825f3..c199243 100644 --- a/dashboardv2/public/js/views/schema/SchemaLayoutView.js +++ b/dashboardv2/public/js/views/schema/SchemaLayoutView.js @@ -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) { diff --git a/dashboardv2/public/js/views/search/SearchLayoutView.js b/dashboardv2/public/js/views/search/SearchLayoutView.js index 5ece1c2..d11e985 100644 --- a/dashboardv2/public/js/views/search/SearchLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchLayoutView.js @@ -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); diff --git a/dashboardv2/public/js/views/search/SearchResultLayoutView.js b/dashboardv2/public/js/views/search/SearchResultLayoutView.js index ffca16c..2e8c165 100644 --- a/dashboardv2/public/js/views/search/SearchResultLayoutView.js +++ b/dashboardv2/public/js/views/search/SearchResultLayoutView.js @@ -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; diff --git a/dashboardv2/public/js/views/site/Header.js b/dashboardv2/public/js/views/site/Header.js index f53d3e8..7ce18af 100644 --- a/dashboardv2/public/js/views/site/Header.js +++ b/dashboardv2/public/js/views/site/Header.js @@ -17,7 +17,7 @@ */ define(['require', - 'hbs!tmpl/site/header', + 'hbs!tmpl/site/Header', 'utils/CommonViewFunction', 'utils/Globals' ], function(require, tmpl, CommonViewFunction, Globals) { diff --git a/dashboardv2/public/js/views/site/SideNavLayoutView.js b/dashboardv2/public/js/views/site/SideNavLayoutView.js new file mode 100644 index 0000000..04ab118 --- /dev/null +++ b/dashboardv2/public/js/views/site/SideNavLayoutView.js @@ -0,0 +1,125 @@ +/** + * 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/site/SideNavLayoutView_tmpl', + 'utils/Utils', + 'utils/Globals', + 'utils/UrlLinks' +], function(require, tmpl, Utils, Globals, UrlLinks) { + 'use strict'; + + var SideNavLayoutView = Marionette.LayoutView.extend({ + template: tmpl, + + regions: { + RBusinessCatalogLayoutView: "#r_businessCatalogLayoutView", + RTagLayoutView: "#r_tagLayoutView", + RSearchLayoutView: "#r_searchLayoutView", + }, + ui: { + tabs: '.tabs li a', + }, + templateHelpers: function() { + return { + tabClass: this.tabClass, + apiBaseUrl: UrlLinks.apiBaseUrl + }; + }, + events: function() { + var events = {}, + that = this; + events["click " + this.ui.tabs] = function(e) { + var urlString = "", + elementName = $(e.currentTarget).data(), + tabStateUrls = Globals.saveApplicationState.tabState, + urlStateObj = Utils.getUrlState, + hashUrl = Utils.getUrlState.getQueryUrl().hash; + + if (urlStateObj.isTagTab()) { + if (hashUrl != tabStateUrls.tagUrl) { + Globals.saveApplicationState.tabState.tagUrl = hashUrl; + } + } else if (urlStateObj.isSearchTab()) { + if (hashUrl != tabStateUrls.searchUrl) { + Globals.saveApplicationState.tabState.searchUrl = hashUrl; + } + } + + if (elementName.name == "tab-tag") { + urlString = tabStateUrls.tagUrl; //'#!/tag'; + } else if (elementName.name == "tab-search") { + urlString = tabStateUrls.searchUrl; // '#!/search'; + } + Utils.setUrl({ + url: urlString, + mergeBrowserUrl: false, + trigger: true, + updateTabState: true + }); + }; + return events; + }, + initialize: function(options) { + _.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'searchTableColumns', 'searchTableFilters')); + this.tabClass = "tab col-sm-6"; + }, + onRender: function() { + this.renderTagLayoutView(); + this.renderSearchLayoutView(); + this.selectTab(); + + }, + renderTagLayoutView: function() { + var that = this; + require(['views/tag/TagLayoutView'], function(TagLayoutView) { + that.RTagLayoutView.show(new TagLayoutView({ + collection: that.classificationDefCollection, + tag: that.tag, + value: that.value, + typeHeaders: that.typeHeaders + })); + }); + }, + renderSearchLayoutView: function() { + var that = this; + require(['views/search/SearchLayoutView'], function(SearchLayoutView) { + that.RSearchLayoutView.show(new SearchLayoutView({ + value: that.value, + searchVent: that.searchVent, + typeHeaders: that.typeHeaders, + entityDefCollection: that.entityDefCollection, + enumDefCollection: that.enumDefCollection, + classificationDefCollection: that.classificationDefCollection, + searchTableColumns: that.searchTableColumns, + searchTableFilters: that.searchTableFilters + })); + }); + }, + selectTab: function() { + 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.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'); + } + }, + }); + return SideNavLayoutView; +}); \ No newline at end of file diff --git a/dashboardv2/public/js/views/tag/AddTagModalView.js b/dashboardv2/public/js/views/tag/AddTagModalView.js new file mode 100644 index 0000000..52dd623 --- /dev/null +++ b/dashboardv2/public/js/views/tag/AddTagModalView.js @@ -0,0 +1,380 @@ +/** + * 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/tag/AddTagModalView_tmpl', + 'collection/VTagList', + 'collection/VCommonList', + 'modules/Modal', + 'models/VEntity', + 'utils/Utils', + 'utils/UrlLinks', + 'utils/Enums', + 'utils/Messages', + 'daterangepicker' +], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils, UrlLinks, Enums, Messages) { + 'use strict'; + + var AddTagModel = Marionette.LayoutView.extend({ + template: AddTagModalViewTmpl, + templateHelpers: function() { + return { + tagModel: this.tagModel + }; + }, + + regions: {}, + ui: { + addTagOptions: "[data-id='addTagOptions']", + tagAttribute: "[data-id='tagAttribute']" + }, + events: function() { + var events = {}; + events["change " + this.ui.addTagOptions] = 'onChangeTagDefination'; + return events; + }, + /** + * intialize a new AddTagModel Layout + * @constructs + */ + initialize: function(options) { + _.extend(this, _.pick(options, 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList', 'tagModel', 'enumDefCollection')); + this.collection = new VTagList(); + this.commonCollection = new VTagList(); + var that = this, + modalObj = { + title: 'Add Tag', + content: this, + okText: 'Add', + cancelText: "Cancel", + allowCancel: true, + }; + if (this.tagModel) { + modalObj.title = 'Edit Tag'; + modalObj.okText = 'Update'; + } + this.modal = new Modal(modalObj).open(); + this.modal.$el.find('button.ok').attr("disabled", true); + this.on('ok', function() { + var tagName = this.tagModel ? this.tagModel.typeName : this.ui.addTagOptions.val(), + tagAttributes = {}, + tagAttributeNames = this.$(".attrName"), + obj = { + tagName: tagName, + tagAttributes: tagAttributes, + guid: [], + skipEntity: [], + deletedEntity: [] + }; + tagAttributeNames.each(function(i, item) { + var selection = $(item).data("key"); + var datatypeSelection = $(item).data("type"); + if (datatypeSelection === "date") { + tagAttributes[selection] = Date.parse($(item).val()) || null; + } else { + tagAttributes[selection] = $(item).val() || null; + } + }); + + if (that.multiple) { + _.each(that.multiple, function(entity, i) { + var name = Utils.getName(entity.model); + if (Enums.entityStateReadOnly[entity.model.status]) { + obj.deletedEntity.push(name); + } else { + if (_.indexOf((entity.model.classificationNames || _.pluck(entity.model.classifications, 'typeName')), tagName) === -1) { + obj.guid.push(entity.model.guid) + } else { + obj.skipEntity.push(name); + } + } + }); + if (obj.deletedEntity.length) { + Utils.notifyError({ + html: true, + content: "<b>" + obj.deletedEntity.join(', ') + + "</b> " + (obj.deletedEntity.length === 1 ? "entity " : "entities ") + + Messages.assignDeletedEntity + }); + } + if (obj.skipEntity.length) { + var text = "<b>" + obj.skipEntity.length + " of " + that.multiple.length + + "</b> entities selected have already been associated with <b>" + tagName + + "</b> tag, Do you want to associate the tag with other entities ?", + removeCancelButton = false; + if ((obj.skipEntity.length + obj.deletedEntity.length) === that.multiple.length) { + text = (obj.skipEntity.length > 1 ? "All selected" : "Selected") + " entities have already been associated with <b>" + tagName + "</b> tag"; + removeCancelButton = true; + } + var notifyObj = { + text: text, + modal: true, + ok: function(argument) { + if (obj.guid.length) { + that.saveTagData(obj); + } else { + that.hideLoader(); + } + }, + cancel: function(argument) { + that.hideLoader(); + obj = { + tagName: tagName, + tagAttributes: tagAttributes, + guid: [], + skipEntity: [], + deletedEntity: [] + } + } + } + if (removeCancelButton) { + notifyObj['confirm'] = { + confirm: true, + buttons: [{ + text: 'Ok', + addClass: 'btn-atlas btn-md', + click: function(notice) { + notice.remove(); + obj = { + tagName: tagName, + tagAttributes: tagAttributes, + guid: [], + skipEntity: [], + deletedEntity: [] + } + } + }, + null + ] + } + } + Utils.notifyConfirm(notifyObj) + } else { + if (obj.guid.length) { + that.saveTagData(obj); + } else { + that.hideLoader(); + } + } + } else { + obj.guid.push(that.guid); + that.saveTagData(obj); + } + }); + this.on('closeModal', function() { + this.modal.trigger('cancel'); + }); + this.bindEvents(); + }, + + onRender: function() { + var that = this; + $.extend(this.collection.queryParams, { type: 'classification' }); + this.hideAttributeBox(); + this.collection.fetch({ + reset: true, + complete: function() { + if (that.tagModel) { + that.fetchTagSubData(that.tagModel.typeName); + } + that.showAttributeBox(); + }, + }); + }, + bindEvents: function() { + var that = this; + this.enumArr = []; + this.listenTo(this.collection, 'reset', function() { + this.tagsCollection(); + }, this); + this.listenTo(this.commonCollection, 'reset', function() { + this.subAttributeData(); + }, this); + }, + tagsCollection: function() { + var that = this; + this.collection.fullCollection.comparator = function(model) { + return Utils.getName(model.toJSON(), 'name').toLowerCase(); + } + + 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'); + // 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>'; + } + }); + this.ui.addTagOptions.html(str); + this.ui.addTagOptions.select2({ + placeholder: "Select Tag", + allowClear: false + }); + }, + onChangeTagDefination: function() { + this.ui.addTagOptions.select2("open").select2("close"); + this.ui.tagAttribute.empty(); + var saveBtn = this.modal.$el.find('button.ok'); + saveBtn.prop("disabled", false); + var tagname = this.ui.addTagOptions.val(); + this.hideAttributeBox(); + this.fetchTagSubData(tagname); + }, + fetchTagSubData: function(tagname) { + var attributeDefs = Utils.getNestedSuperTypeObj({ + data: this.collection.fullCollection.find({ name: tagname }).toJSON(), + collection: this.collection, + attrMerge: true + }); + this.subAttributeData(attributeDefs); + }, + showAttributeBox: function() { + var that = this; + this.$('.attrLoader').hide(); + this.$('.form-group.hide').removeClass('hide'); + if (this.ui.tagAttribute.children().length !== 0) { + this.ui.tagAttribute.parent().show(); + } + this.ui.tagAttribute.find('input,select').on("keyup change", function(e) { + if (e.keyCode != 32) { + that.modal.$el.find('button.ok').attr("disabled", false); + } + }); + }, + hideAttributeBox: function() { + this.ui.tagAttribute.children().empty(); + this.ui.tagAttribute.parent().hide(); + this.$('.attrLoader').show(); + }, + subAttributeData: function(attributeDefs) { + var that = this; + if (attributeDefs) { + _.each(attributeDefs, function(obj) { + var name = Utils.getName(obj, 'name'); + var typeName = Utils.getName(obj, 'typeName'); + var typeNameValue = that.enumDefCollection.fullCollection.findWhere({ 'name': typeName }); + if (typeNameValue) { + var str = '<option value=""' + (!that.tagModel ? 'selected' : '') + '>-- Select ' + typeName + " --</option>"; + var enumValue = typeNameValue.get('elementDefs'); + _.each(enumValue, function(key, value) { + str += '<option ' + ((that.tagModel && key.value === that.tagModel.attributes[name]) ? 'selected' : '') + '>' + key.value + '</option>'; + }) + that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + + '<select class="form-control attributeInputVal attrName" data-key="' + name + '">' + str + '</select></div>'); + } else { + var textElement = that.getElement(name, typeName); + that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + textElement + '</div>'); + } + }); + that.$('input[data-type="date"]').each(function() { + if (!$(this).data('daterangepicker')) { + var dateObj = { + "singleDatePicker": true, + "showDropdowns": true, + "timePicker": true, + locale: { + format: 'MM/DD/YYYY h:mm A' + } + }; + if (that.tagModel) { + var formatDate = Number(this.value); + dateObj["startDate"] = new Date(formatDate); + } + $(this).daterangepicker(dateObj); + } + }); + that.$('select[data-type="boolean"]').each(function() { + var labelName = $(this).data('key'); + if (that.tagModel) { + this.value = that.tagModel.attributes[labelName]; + } + }); + this.showAttributeBox(); + } + }, + getElement: function(labelName, typeName) { + var value = this.tagModel && this.tagModel.attributes ? (this.tagModel.attributes[labelName] || "") : "", + isTypeNumber = typeName === "int" || typeName === "byte" || typeName === "short" || typeName === "double" || typeName === "float", + inputClassName = "form-control attributeInputVal attrName"; + if (isTypeNumber) { + inputClassName += ((typeName === "int" || typeName === "byte" || typeName === "short") ? " number-input-negative" : " number-input-exponential"); + } + if (typeName === "boolean") { + return '<select class="form-control attributeInputVal attrName" data-key="' + labelName + '" data-type="' + typeName + '"> ' + + '<option value="">--Select true or false--</option>' + + '<option value="true">true</option>' + + '<option value="false">false</option></select>'; + } else { + return '<input type="text" value="' + value + '" class="' + inputClassName + '" data-key="' + labelName + '" data-type="' + typeName + '"/>'; + } + + }, + saveTagData: function(options) { + var that = this; + this.entityModel = new VEntity(); + var tagName = options.tagName, + tagAttributes = options.tagAttributes, + json = { + "classification": { + "typeName": tagName, + "attributes": tagAttributes + }, + "entityGuids": options.guid + }; + if (this.tagModel) { + json = [{ + "typeName": tagName, + "attributes": tagAttributes + }] + } + if (this.showLoader) { + this.showLoader(); + } + this.entityModel.saveTraitsEntity(this.tagModel ? options.guid : null, { + skipDefaultError: true, + data: JSON.stringify(json), + type: this.tagModel ? 'PUT' : 'POST', + success: function(data) { + var addupdatetext = that.tagModel ? 'updated successfully to ' : 'added to '; + Utils.notifySuccess({ + content: "Tag " + tagName + " has been " + addupdatetext + (that.multiple ? "entities" : "entity") + }); + if (options.modalCollection) { + options.modalCollection.fetch({ reset: true }); + } + if (that.callback) { + that.callback(); + } + }, + cust_error: function(model, response) { + var message = "Tag " + tagName + " could not be added"; + if (response && response.responseJSON) { + message = response.responseJSON.errorMessage; + } + Utils.notifyError({ + content: message + }); + if (that.hideLoader) { + that.hideLoader(); + } + } + }); + }, + }); + return AddTagModel; +}); \ No newline at end of file diff --git a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js index 802397a..617df59 100644 --- a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js +++ b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js @@ -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 diff --git a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js index e07dd94..2ea8734 100644 --- a/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js @@ -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, diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js index 37f9301..df896da 100644 --- a/dashboardv2/public/js/views/tag/TagLayoutView.js +++ b/dashboardv2/public/js/views/tag/TagLayoutView.js @@ -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); diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js deleted file mode 100644 index 7269ad9..0000000 --- a/dashboardv2/public/js/views/tag/addTagModalView.js +++ /dev/null @@ -1,383 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(['require', - 'hbs!tmpl/tag/addTagModalView_tmpl', - 'collection/VTagList', - 'collection/VCommonList', - 'modules/Modal', - 'models/VEntity', - 'utils/Utils', - 'utils/UrlLinks', - 'utils/Enums', - 'utils/Messages', - 'daterangepicker' -], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, VEntity, Utils, UrlLinks, Enums, Messages) { - 'use strict'; - - var AddTagModel = Marionette.LayoutView.extend({ - template: AddTagModalViewTmpl, - templateHelpers: function() { - return { - tagModel: this.tagModel - }; - }, - - regions: {}, - ui: { - addTagOptions: "[data-id='addTagOptions']", - tagAttribute: "[data-id='tagAttribute']" - }, - events: function() { - var events = {}; - events["change " + this.ui.addTagOptions] = 'onChangeTagDefination'; - return events; - }, - /** - * intialize a new AddTagModel Layout - * @constructs - */ - initialize: function(options) { - _.extend(this, _.pick(options, 'modalCollection', 'guid', 'callback', 'multiple', 'showLoader', 'hideLoader', 'tagList', 'tagModel', 'enumDefCollection')); - this.collection = new VTagList(); - this.commonCollection = new VTagList(); - var that = this, - modalObj = { - title: 'Add Tag', - content: this, - okText: 'Add', - cancelText: "Cancel", - allowCancel: true, - }; - if (this.tagModel) { - modalObj.title = 'Edit Tag'; - modalObj.okText = 'Update'; - } - this.modal = new Modal(modalObj).open(); - this.modal.$el.find('button.ok').attr("disabled", true); - this.on('ok', function() { - var tagName = this.tagModel ? this.tagModel.typeName : this.ui.addTagOptions.val(), - tagAttributes = {}, - tagAttributeNames = this.$(".attrName"), - obj = { - tagName: tagName, - tagAttributes: tagAttributes, - guid: [], - skipEntity: [], - deletedEntity: [] - }; - tagAttributeNames.each(function(i, item) { - var selection = $(item).data("key"); - var datatypeSelection = $(item).data("type"); - if (datatypeSelection === "date") { - tagAttributes[selection] = Date.parse($(item).val()) || null; - } else { - tagAttributes[selection] = $(item).val() || null; - } - }); - - if (that.multiple) { - _.each(that.multiple, function(entity, i) { - var name = Utils.getName(entity.model); - if (Enums.entityStateReadOnly[entity.model.status]) { - obj.deletedEntity.push(name); - } else { - if (_.indexOf((entity.model.classificationNames || _.pluck(entity.model.classifications, 'typeName')), tagName) === -1) { - obj.guid.push(entity.model.guid) - } else { - obj.skipEntity.push(name); - } - } - }); - if (obj.deletedEntity.length) { - Utils.notifyError({ - html: true, - content: "<b>" + obj.deletedEntity.join(', ') + - "</b> " + (obj.deletedEntity.length === 1 ? "entity " : "entities ") + - Messages.assignDeletedEntity - }); - } - if (obj.skipEntity.length) { - var text = "<b>" + obj.skipEntity.length + " of " + that.multiple.length + - "</b> entities selected have already been associated with <b>" + tagName + - "</b> tag, Do you want to associate the tag with other entities ?", - removeCancelButton = false; - if ((obj.skipEntity.length + obj.deletedEntity.length) === that.multiple.length) { - text = (obj.skipEntity.length > 1 ? "All selected" : "Selected") + " entities have already been associated with <b>" + tagName + "</b> tag"; - removeCancelButton = true; - } - var notifyObj = { - text: text, - modal: true, - ok: function(argument) { - if (obj.guid.length) { - that.saveTagData(obj); - } else { - that.hideLoader(); - } - }, - cancel: function(argument) { - that.hideLoader(); - obj = { - tagName: tagName, - tagAttributes: tagAttributes, - guid: [], - skipEntity: [], - deletedEntity: [] - } - } - } - if (removeCancelButton) { - notifyObj['confirm'] = { - confirm: true, - buttons: [{ - text: 'Ok', - addClass: 'btn-atlas btn-md', - click: function(notice) { - notice.remove(); - obj = { - tagName: tagName, - tagAttributes: tagAttributes, - guid: [], - skipEntity: [], - deletedEntity: [] - } - } - }, - null - ] - } - } - Utils.notifyConfirm(notifyObj) - } else { - if (obj.guid.length) { - that.saveTagData(obj); - } else { - that.hideLoader(); - } - } - } else { - obj.guid.push(that.guid); - that.saveTagData(obj); - } - }); - this.on('closeModal', function() { - this.modal.trigger('cancel'); - }); - this.bindEvents(); - }, - - onRender: function() { - var that = this; - $.extend(this.collection.queryParams, { type: 'classification' }); - this.hideAttributeBox(); - this.collection.fetch({ - reset: true, - complete: function() { - if (that.tagModel) { - that.fetchTagSubData(that.tagModel.typeName); - } - that.showAttributeBox(); - }, - }); - }, - bindEvents: function() { - var that = this; - this.enumArr = []; - this.listenTo(this.collection, 'reset', function() { - this.tagsCollection(); - }, this); - this.listenTo(this.commonCollection, 'reset', function() { - this.subAttributeData(); - }, this); - }, - tagsCollection: function() { - var that = this; - this.collection.fullCollection.comparator = function(model) { - return Utils.getName(model.toJSON(), 'name').toLowerCase(); - } - - 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>'; - } - }); - this.ui.addTagOptions.html(str); - this.ui.addTagOptions.select2({ - placeholder: "Select Tag", - allowClear: false - }); - }, - onChangeTagDefination: function() { - this.ui.addTagOptions.select2("open").select2("close"); - this.ui.tagAttribute.empty(); - var saveBtn = this.modal.$el.find('button.ok'); - saveBtn.prop("disabled", false); - var tagname = this.ui.addTagOptions.val(); - this.hideAttributeBox(); - this.fetchTagSubData(tagname); - }, - fetchTagSubData: function(tagname) { - var attributeDefs = Utils.getNestedSuperTypeObj({ - data: this.collection.fullCollection.find({ name: tagname }).toJSON(), - collection: this.collection, - attrMerge: true - }); - this.subAttributeData(attributeDefs); - }, - showAttributeBox: function() { - var that = this; - this.$('.attrLoader').hide(); - this.$('.form-group.hide').removeClass('hide'); - if (this.ui.tagAttribute.children().length !== 0) { - this.ui.tagAttribute.parent().show(); - } - this.ui.tagAttribute.find('input,select').on("keyup change", function(e) { - if (e.keyCode != 32) { - that.modal.$el.find('button.ok').attr("disabled", false); - } - }); - }, - hideAttributeBox: function() { - this.ui.tagAttribute.children().empty(); - this.ui.tagAttribute.parent().hide(); - this.$('.attrLoader').show(); - }, - subAttributeData: function(attributeDefs) { - var that = this; - if (attributeDefs) { - _.each(attributeDefs, function(obj) { - var name = Utils.getName(obj, 'name'); - var typeName = Utils.getName(obj, 'typeName'); - var typeNameValue = that.enumDefCollection.fullCollection.findWhere({ 'name': typeName }); - if (typeNameValue) { - var str = '<option value=""' + (!that.tagModel ? 'selected' : '') + '>-- Select ' + typeName + " --</option>"; - var enumValue = typeNameValue.get('elementDefs'); - _.each(enumValue, function(key, value) { - str += '<option ' + ((that.tagModel && key.value === that.tagModel.attributes[name]) ? 'selected' : '') + '>' + key.value + '</option>'; - }) - that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + - '<select class="form-control attributeInputVal attrName" data-key="' + name + '">' + str + '</select></div>'); - } else { - var textElement = that.getElement(name, typeName); - that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + textElement + '</div>'); - } - }); - that.$('input[data-type="date"]').each(function() { - if (!$(this).data('daterangepicker')) { - var dateObj = { - "singleDatePicker": true, - "showDropdowns": true, - "timePicker": true, - locale: { - format: 'MM/DD/YYYY h:mm A' - } - }; - if (that.tagModel) { - var formatDate = Number(this.value); - dateObj["startDate"] = new Date(formatDate); - } - $(this).daterangepicker(dateObj); - } - }); - that.$('select[data-type="boolean"]').each(function() { - var labelName = $(this).data('key'); - if (that.tagModel) { - this.value = that.tagModel.attributes[labelName]; - } - }); - this.showAttributeBox(); - } - }, - getElement: function(labelName, typeName) { - var value = this.tagModel && this.tagModel.attributes ? (this.tagModel.attributes[labelName] || "") : "", - isTypeNumber = typeName === "int" || typeName === "byte" || typeName === "short" || typeName === "double" || typeName === "float", - inputClassName = "form-control attributeInputVal attrName"; - if (isTypeNumber) { - inputClassName += ((typeName === "int" || typeName === "byte" || typeName === "short") ? " number-input-negative" : " number-input-exponential"); - } - if (typeName === "boolean") { - return '<select class="form-control attributeInputVal attrName" data-key="' + labelName + '" data-type="' + typeName + '"> ' + - '<option value="">--Select true or false--</option>' + - '<option value="true">true</option>' + - '<option value="false">false</option></select>'; - } else { - return '<input type="text" value="' + value + '" class="' + inputClassName + '" data-key="' + labelName + '" data-type="' + typeName + '"/>'; - } - - }, - saveTagData: function(options) { - var that = this; - this.entityModel = new VEntity(); - var tagName = options.tagName, - tagAttributes = options.tagAttributes, - json = { - "classification": { - "typeName": tagName, - "attributes": tagAttributes - }, - "entityGuids": options.guid - }; - if (this.tagModel) { - json = [{ - "typeName": tagName, - "attributes": tagAttributes - }] - } - if (this.showLoader) { - this.showLoader(); - } - this.entityModel.saveTraitsEntity(this.tagModel ? options.guid : null, { - skipDefaultError: true, - data: JSON.stringify(json), - type: this.tagModel ? 'PUT' : 'POST', - success: function(data) { - var addupdatetext = that.tagModel ? 'updated successfully to ' : 'added to '; - Utils.notifySuccess({ - content: "Tag " + tagName + " has been " + addupdatetext + (that.multiple ? "entities" : "entity") - }); - if (options.modalCollection) { - options.modalCollection.fetch({ reset: true }); - } - if (that.callback) { - that.callback(); - } - }, - cust_error: function(model, response) { - var message = "Tag " + tagName + " could not be added"; - if (response && response.responseJSON) { - message = response.responseJSON.errorMessage; - } - Utils.notifyError({ - content: message - }); - if (that.hideLoader) { - that.hideLoader(); - } - } - }); - }, - }); - return AddTagModel; -}); \ No newline at end of file -- libgit2 0.27.1