You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2017/11/01 14:13:48 UTC
[3/4] atlas git commit: ATLAS-2217 : Remove all taxonomy reference
from UI
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/utils/UrlLinks.js
----------------------------------------------------------------------
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) {
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/utils/Utils.js
----------------------------------------------------------------------
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;
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/AddTermLayoutView.js
----------------------------------------------------------------------
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;
-
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/AddTermToEntityLayoutView.js
----------------------------------------------------------------------
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;
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/BusinessCatalogDetailLayoutView.js
----------------------------------------------------------------------
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;
-
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/BusinessCatalogHeader.js
----------------------------------------------------------------------
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;
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/BusinessCatalogLayoutView.js
----------------------------------------------------------------------
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;
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/MoveTermLayoutView.js
----------------------------------------------------------------------
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;
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/SideNavLayoutView.js
----------------------------------------------------------------------
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
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/business_catalog/TreeLayoutView.js
----------------------------------------------------------------------
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
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/common/AboutAtlas.js
----------------------------------------------------------------------
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
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/common/aboutAtlas.js
----------------------------------------------------------------------
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;
-});
http://git-wip-us.apache.org/repos/asf/atlas/blob/37be53bb/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
----------------------------------------------------------------------
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) {