Commit 8baade24 by kevalbhatt

ATLAS-3685 :- UI Bulk import Business Metadata attribute assignment to entities

parent c5464da3
...@@ -427,7 +427,7 @@ span.tree-tooltip { ...@@ -427,7 +427,7 @@ span.tree-tooltip {
} }
} }
.glossary-dropdown { .tree-droupdown {
left: -190px !important; left: -190px !important;
span a { span a {
......
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
--> -->
<form action={{importUrl}} id="importGlossary" class="dropzone single-file-center"></form> <form id="importGlossary" class="dropzone single-file-center"></form>
\ No newline at end of file \ No newline at end of file
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
<button type="button" class="typeRefresh drop-down-menu-view" data-id="createBusinessMetadata" title="Open Business Metadata"> <button type="button" class="typeRefresh drop-down-menu-view" data-id="createBusinessMetadata" title="Open Business Metadata">
<i class="fa fa-external-link"></i> <i class="fa fa-external-link"></i>
</button> </button>
</ul>
</button>
</div> </div>
</div> </div>
<div id="businessMetadataTree" class="panel-collapse collapse jstree-with-action in"> <div id="businessMetadataTree" class="panel-collapse collapse jstree-with-action in">
......
...@@ -29,11 +29,16 @@ ...@@ -29,11 +29,16 @@
<div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i> <i class="fa fa-ellipsis-v"></i>
</div> </div>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <ul class="dropdown-menu tree-droupdown" aria-labelledby="dropdownMenuButton">
<li data-id="groupOrFlatTreeView" data-type="entity"> <i class="fa fa-list-ul"></i><span>Show flat tree</span> <li data-id="groupOrFlatTreeView" data-type="entity"> <i class="fa fa-list-ul"></i><span>Show flat tree</span>
</li> </li>
<li data-id="downloadBusinessMetadata"><i class="fa fa-download"></i> <span><a href="{{importTmplUrl}}"><span>Download Import template</span></a></span>
</li>
<li data-id="importBusinessMetadata"> <i class="fa fa-upload"></i><a href="javascript:void(0)"><span>Import Business Metadata</span></a>
</li>
</ul> </ul>
</button> </button>
</button>
</div> </div>
</div> </div>
<div id="c_entity" class="panel-collapse collapse jstree-with-action in"> <div id="c_entity" class="panel-collapse collapse jstree-with-action in">
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <div class=" btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i> <i class="fa fa-ellipsis-v"></i>
</div> </div>
<ul class="dropdown-menu glossary-dropdown" aria-labelledby="dropdownMenuButton"> <ul class="dropdown-menu tree-droupdown" aria-labelledby="dropdownMenuButton">
<li data-id="createGlossary" data-type="term"> <i class="fa fa-plus"></i><span>Create Glossary</span> <li data-id="createGlossary" data-type="term"> <i class="fa fa-plus"></i><span>Create Glossary</span>
</li> </li>
<li data-id="downloadTemplate" data-type="term"><i class="fa fa-download"></i> <span><a href="{{importTmplUrl}}"><span>Download Import template</span></a></span> <li data-id="downloadTemplate" data-type="term"><i class="fa fa-download"></i> <span><a href="{{importTmplUrl}}"><span>Download Import template</span></a></span>
......
...@@ -191,6 +191,12 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require ...@@ -191,6 +191,12 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
glossaryImportUrl: function() { glossaryImportUrl: function() {
return this.glossaryApiUrl() + '/import'; return this.glossaryApiUrl() + '/import';
}, },
businessMetadataImportTempUrl: function() {
return this.entitiesApiUrl() + '/businessmetadata/import/template';
},
businessMetadataImportUrl: function() {
return this.entitiesApiUrl() + '/businessmetadata/import';
},
categoryApiUrl: function(options) { categoryApiUrl: function(options) {
var guid = options && options.guid, var guid = options && options.guid,
list = options && options.list, list = options && options.list,
......
...@@ -19,25 +19,19 @@ ...@@ -19,25 +19,19 @@
define([ define([
"require", "require",
"backbone", "backbone",
"hbs!tmpl/glossary/ImportGlossaryLayoutView_tmpl", "hbs!tmpl/import/ImportLayoutView_tmpl",
"modules/Modal", "modules/Modal",
'utils/CommonViewFunction', 'utils/CommonViewFunction',
"utils/Utils", "utils/Utils",
"utils/UrlLinks", "utils/UrlLinks",
"dropzone" "dropzone"
], function(require, Backbone, ImportGlossaryLayoutViewTmpl, Modal, CommonViewFunction, Utils, UrlLinks, dropzone) { ], function(require, Backbone, ImportLayoutViewTmpl, Modal, CommonViewFunction, Utils, UrlLinks, dropzone) {
var ImportGlossaryLayoutView = Backbone.Marionette.LayoutView.extend( var ImportLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends ImportGlossaryLayoutView */ /** @lends ImportLayoutView */
{ {
_viewName: "ImportGlossaryLayoutView", _viewName: "ImportLayoutView",
template: ImportGlossaryLayoutViewTmpl, template: ImportLayoutViewTmpl,
templateHelpers: function() {
return {
importUrl: UrlLinks.glossaryImportUrl()
};
},
/** Layout sub regions */ /** Layout sub regions */
regions: {}, regions: {},
...@@ -50,14 +44,14 @@ define([ ...@@ -50,14 +44,14 @@ define([
return events; return events;
}, },
/** /**
* intialize a new ImportGlossaryLayoutView Layout * intialize a new ImportLayoutView Layout
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, "callback")); _.extend(this, _.pick(options, "callback", "isGlossary"));
var that = this; var that = this;
this.modal = new Modal({ this.modal = new Modal({
title: "Import Glossary", title: this.isGlossary ? "Import Glossary" : "Import Business Metadata",
content: this, content: this,
cancelText: "Cancel", cancelText: "Cancel",
okText: "upload", okText: "upload",
...@@ -88,7 +82,7 @@ define([ ...@@ -88,7 +82,7 @@ define([
var headers = {}; var headers = {};
headers[CommonViewFunction.restCsrfCustomHeader] = '""'; headers[CommonViewFunction.restCsrfCustomHeader] = '""';
this.$("#importGlossary").dropzone({ this.$("#importGlossary").dropzone({
url: UrlLinks.glossaryImportUrl(), url: that.isGlossary ? UrlLinks.glossaryImportUrl() : UrlLinks.businessMetadataImportUrl(),
clickable: true, clickable: true,
acceptedFiles: ".csv,.xls,.xlsx", acceptedFiles: ".csv,.xls,.xlsx",
autoProcessQueue: false, autoProcessQueue: false,
...@@ -108,11 +102,19 @@ define([ ...@@ -108,11 +102,19 @@ define([
this.addFile(file); this.addFile(file);
}, },
success: function(file, response) { success: function(file, response) {
that.modal.trigger("cancel"); if (response.successImportInfoList.length && response.failedImportInfoList.length === 0) {
Utils.notifySuccess({ that.modal.trigger("cancel");
content: "File: " + file.name + " added successfully" Utils.notifySuccess({
}); content: "File: " + file.name + " imported successfully"
that.callback(); });
} else if (response.failedImportInfoList.length) {
Utils.notifyError({
content: response.failedImportInfoList[0].remarks
});
}
if (that.callback) {
that.callback();
}
}, },
error: function(file, response, responseObj) { error: function(file, response, responseObj) {
Utils.defaultErrorHandler(null, responseObj, { defaultErrorMessage: (response.errorMessage) || response }); Utils.defaultErrorHandler(null, responseObj, { defaultErrorMessage: (response.errorMessage) || response });
...@@ -124,5 +126,5 @@ define([ ...@@ -124,5 +126,5 @@ define([
} }
} }
); );
return ImportGlossaryLayoutView; return ImportLayoutView;
}); });
\ No newline at end of file
...@@ -43,11 +43,14 @@ define([ ...@@ -43,11 +43,14 @@ define([
// Show/hide empty values in tree // Show/hide empty values in tree
showEmptyServiceType: '[data-id="showEmptyServiceType"]', showEmptyServiceType: '[data-id="showEmptyServiceType"]',
entityTreeLoader: '[data-id="entityTreeLoader"]' entityTreeLoader: '[data-id="entityTreeLoader"]',
importBusinessMetadata: "[data-id='importBusinessMetadata']",
downloadBusinessMetadata: "[data-id='downloadBusinessMetadata']"
}, },
templateHelpers: function() { templateHelpers: function() {
return { return {
apiBaseUrl: UrlLinks.apiBaseUrl apiBaseUrl: UrlLinks.apiBaseUrl,
importTmplUrl: UrlLinks.businessMetadataImportTempUrl()
}; };
}, },
events: function() { events: function() {
...@@ -79,6 +82,13 @@ define([ ...@@ -79,6 +82,13 @@ define([
that.ui[type + "SearchTree"].jstree(true).destroy(); that.ui[type + "SearchTree"].jstree(true).destroy();
that.renderEntityTree(); that.renderEntityTree();
}; };
events["click " + this.ui.importBusinessMetadata] = function(e) {
e.stopPropagation();
that.onClickImportBusinessMetadata();
};
events["click " + this.ui.downloadBusinessMetadata] = function(e) {
e.stopPropagation();
};
return events; return events;
}, },
...@@ -558,7 +568,14 @@ define([ ...@@ -558,7 +568,14 @@ define([
renderTree(); renderTree();
} }
}); });
},
onClickImportBusinessMetadata: function() {
var that = this;
require([
'views/import/ImportLayoutView'
], function(ImportLayoutView) {
var view = new ImportLayoutView({});
});
} }
}); });
return EntityTreeLayoutview; return EntityTreeLayoutview;
......
...@@ -711,12 +711,13 @@ define([ ...@@ -711,12 +711,13 @@ define([
onClickImportGlossary: function() { onClickImportGlossary: function() {
var that = this; var that = this;
require([ require([
'views/glossary/ImportGlossaryLayoutView' 'views/import/ImportLayoutView'
], function(ImportGlossaryLayoutView) { ], function(ImportLayoutView) {
var view = new ImportGlossaryLayoutView({ var view = new ImportLayoutView({
callback: function() { callback: function() {
that.refresh(); that.refresh();
} },
isGlossary: true
}); });
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment