Commit 74eafd3e by Hemanth Yamijala

ATLAS-817 Asset details page -- generate schema dynamically based on…

ATLAS-817 Asset details page -- generate schema dynamically based on attributeDefinitions (kevalbhatt18 via yhemanth)
parent 353ea964
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*/ */
body { body {
font-family: 'Raleway', sans-serif; font-family: 'Source Sans Pro', sans-serif;
background-color: #f6f7fb; background-color: #f6f7fb;
color: #686868; color: #686868;
} }
......
...@@ -28,7 +28,7 @@ $color_star_dust_approx: #9a9a9a; ...@@ -28,7 +28,7 @@ $color_star_dust_approx: #9a9a9a;
$color_mirage_approx: #1c1e2a; $color_mirage_approx: #1c1e2a;
$concrete: #f2f2f2; $concrete: #f2f2f2;
//fonts //fonts
$font_0: Raleway; $font_0: Source Sans Pro;
$font_1: sans-serif; $font_1: sans-serif;
$font_2: FontAwesome; $font_2: FontAwesome;
//fonts //fonts
...@@ -123,10 +123,20 @@ hr { ...@@ -123,10 +123,20 @@ hr {
border-top: 1px solid #1c1e2a border-top: 1px solid #1c1e2a
} }
th {
text-transform: capitalize;
}
ul { ul {
list-style: none; list-style: none;
} }
.table {
.table {
width: auto;
}
}
.close { .close {
font-size: 2em; font-size: 2em;
} }
......
...@@ -70,3 +70,11 @@ ...@@ -70,3 +70,11 @@
border: 1px #DDDDDD solid; border: 1px #DDDDDD solid;
} }
.select2-container--default .select2-selection--multiple {
background-color: $color_white_lilac_approx !important;
border: 1px #e8e9ee solid !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border-color: #8fa5b1 !important;
}
...@@ -74,7 +74,7 @@ ul.tabs li.tab { ...@@ -74,7 +74,7 @@ ul.tabs li.tab {
letter-spacing: 0.8px; letter-spacing: 0.8px;
border-bottom: 1px solid $color_mirage_approx; border-bottom: 1px solid $color_mirage_approx;
a { a {
font-size: 12px; font-size: 14px;
font-weight: 600; font-weight: 600;
color: $white; color: $white;
display: block; display: block;
......
...@@ -81,10 +81,6 @@ ...@@ -81,10 +81,6 @@
border-color: $color_bali_hai_approx; border-color: $color_bali_hai_approx;
} }
.tagList {
margin-top: 10px;
}
.select2-container { .select2-container {
width: 100% !important; width: 100% !important;
/*margin:15px 0px;*/ /*margin:15px 0px;*/
...@@ -108,7 +104,7 @@ ...@@ -108,7 +104,7 @@
padding: 5px 10px; padding: 5px 10px;
border: 1px $tag_color solid; border: 1px $tag_color solid;
color: $tag_color; color: $tag_color;
font-size: 12px; font-size: 14px;
text-transform: uppercase; text-transform: uppercase;
border-radius: 4px; border-radius: 4px;
margin-right: 3px; margin-right: 3px;
...@@ -151,12 +147,12 @@ ...@@ -151,12 +147,12 @@
} }
.addTagText { .addTagText {
font-size: 12px; font-size: 14px;
font-weight: 600; font-weight: 600;
} }
.addTagPlus { .addTagPlus {
font-size: 12px; font-size: 14px;
font-weight: 600; font-weight: 600;
} }
...@@ -180,12 +176,13 @@ ...@@ -180,12 +176,13 @@
color: $action_gray; color: $action_gray;
border-radius: 4px; border-radius: 4px;
} }
.inputAttribute { .inputAttribute {
display: inline-block; display: inline-block;
padding: 5px 10px; padding: 5px 10px;
border: 1px $action_gray solid; border: 1px $action_gray solid;
color: $action_gray; color: $action_gray;
font-size: 12px; font-size: 14px;
text-transform: uppercase; text-transform: uppercase;
border-radius: 4px; border-radius: 4px;
margin-right: 3px; margin-right: 3px;
...@@ -203,3 +200,13 @@ ...@@ -203,3 +200,13 @@
background-color: $action_gray; background-color: $action_gray;
} }
} }
form-control .tagInpput {
margin-bottom: 15px;
margin-top: 15px;
}
// .select2-container--default .select2-selection--multiple {
// background-color: #f6f7fb;
// border: 1px #e8e9ee solid;
// }
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
padding: 6px 12px; padding: 6px 12px;
background-color: $color_havelock_blue_approx; background-color: $color_havelock_blue_approx;
color: $white; color: $white;
font-size: 12px; font-size: 14px;
text-transform: uppercase; text-transform: uppercase;
//Instead of the line below you could use @include border-radius($radius, $vertical-radius) //Instead of the line below you could use @include border-radius($radius, $vertical-radius)
border-radius: 4px; border-radius: 4px;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<link rel="stylesheet" href="js/libs/select2/css/select2.min.css"> <link rel="stylesheet" href="js/libs/select2/css/select2.min.css">
<link rel="stylesheet" href="js/libs/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="js/libs/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="js/libs/jquery-asBreadcrumbs/css/asBreadcrumbs.css"> <link rel="stylesheet" href="js/libs/jquery-asBreadcrumbs/css/asBreadcrumbs.css">
<link href='https://fonts.googleapis.com/css?family=Raleway:400,400italic,600,600italic,700,700italic' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600,600italic,700,700italic' rel='stylesheet' type='text/css'>
<link href="css/bootstrap-sidebar.css" rel="stylesheet"> <link href="css/bootstrap-sidebar.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet"> <link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet">
......
...@@ -37,6 +37,7 @@ define(['require', ...@@ -37,6 +37,7 @@ define(['require',
if (!this.modelAttrName) { if (!this.modelAttrName) {
throw new Error("this.modelAttrName not defined for " + this); throw new Error("this.modelAttrName not defined for " + this);
} }
this.keyList = resp[this.modelAttrName].dataType.attributeDefinitions;
var arr = []; var arr = [];
resp[this.modelAttrName].rows.forEach(function(d) { resp[this.modelAttrName].rows.forEach(function(d) {
arr.push(d); arr.push(d);
......
...@@ -22,7 +22,7 @@ define(['require', ...@@ -22,7 +22,7 @@ define(['require',
], function(require, Globals, VBaseModel) { ], function(require, Globals, VBaseModel) {
'use strict'; 'use strict';
var VCatalog = VBaseModel.extend({ var VCatalog = VBaseModel.extend({
urlRoot: Globals.baseURL + '/api/atlas/v1/taxonomies/taxonomy1', urlRoot: Globals.baseURL + '/api/atlas/v1/taxonomies',
defaults: {}, defaults: {},
......
...@@ -33,9 +33,6 @@ define([ ...@@ -33,9 +33,6 @@ define([
'!/taxonomy/detailCatalog/(*url)': 'detailCatalog', '!/taxonomy/detailCatalog/(*url)': 'detailCatalog',
'!/search/searchResult': 'searchResult', '!/search/searchResult': 'searchResult',
'!/detailPage/:id': 'detailPage', '!/detailPage/:id': 'detailPage',
'!/detailPage/:id': 'detailPage',
'!/detailPage/:id': 'detailPage',
'!/tag': 'commonAction', '!/tag': 'commonAction',
'!/taxonomy': 'commonAction', '!/taxonomy': 'commonAction',
'!/search': 'commonAction', '!/search': 'commonAction',
...@@ -120,13 +117,15 @@ define([ ...@@ -120,13 +117,15 @@ define([
} else { } else {
var view = App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView; var view = App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView;
if (view.dblClick == false && view.singleClick == false && !Globals.saveApplicationState.tabState.stateChanged) { if (view.dblClick == false && view.singleClick == false && !Globals.saveApplicationState.tabState.stateChanged) {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(url,true); App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(url, true);
view.dblClick == false; view.dblClick == false;
}/* else if (view.firstManualClick) { }
view.firstManualClick = false; /* else if (view.firstManualClick) {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(url); view.firstManualClick = false;
}*/ else if (view.singleClick) { App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(url);
}*/
else if (view.singleClick) {
view.singleClick = false; view.singleClick = false;
} }
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
...@@ -184,6 +183,7 @@ define([ ...@@ -184,6 +183,7 @@ define([
'tag': tagName 'tag': tagName
})); }));
} else { } else {
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(tagName); App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(tagName);
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
} }
...@@ -213,7 +213,7 @@ define([ ...@@ -213,7 +213,7 @@ define([
if (Utils.getUrlState.isTagTab()) { if (Utils.getUrlState.isTagTab()) {
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(); App.rSideNav.currentView.RTagLayoutView.currentView.manualRender();
} else if (Utils.getUrlState.isTaxonomyTab()) { } else if (Utils.getUrlState.isTaxonomyTab()) {
App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(undefined,true); App.rSideNav.currentView.RBusinessCatalogLayoutView.currentView.manualRender(undefined, true);
} }
} }
App.rNContent.$el.html(''); App.rNContent.$el.html('');
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* 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.
--> -->
<table class="table table-bordered table-striped"> <table class="table table-quickMenu">
<thead> <thead>
<tr> <tr>
<th>Key</th> <th>Key</th>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</ol> </ol>
<header class="clearfix"> <header class="clearfix">
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<a href="javascript:void(0);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="user-dropdown">Hello Micheal <i class="fa fa-user user-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></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<!-- <li><a href="#">Edit Profile</a></li> <!-- <li><a href="#">Edit Profile</a></li>
<li><a href="#">Change Password</a></li> --> <li><a href="#">Change Password</a></li> -->
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* 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.
--> -->
<table class="table table-bordered table-striped"> <table class="table table-quickMenu">
<thead> <thead>
<tr> <tr>
<th>Key</th> <th>Key</th>
......
...@@ -14,4 +14,7 @@ ...@@ -14,4 +14,7 @@
* 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.
--> -->
<div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
<div id="r_tagLayoutView"></div> <div id="r_tagLayoutView"></div>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="row row-margin-bottom"> <div class="row row-margin-bottom">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" name="name" data-id="attributeId" placeholder="Attribute name" required="" value={{name}}> <input type="text" class="form-control row-margin-top" name="name" data-id="attributeId" placeholder="Attribute name" required="" value={{name}}>
</div> </div>
</div> </div>
</div> </div>
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<div class="page-title clearfix"> <div class="page-title clearfix">
<h1><span data-id="title"></span> <h1><span data-id="title"></span>
<!-- <small>8 Asset</small><button data-id="editButton" class="hide btn btn-default pull-right editbutton" data-id="editText"><i class="fa fa-pencil"></i></button>--></h1> <!-- <small>8 Asset</small><button data-id="editButton" class="hide btn btn-default pull-right editbutton" data-id="editText"><i class="fa fa-pencil"></i></button>--></h1>
<p data-id="description"></p>
<div data-id="showAttribute"> <div data-id="showAttribute">
</div> </div>
<div class="dropdown addTag-dropdown" data-id="addTagListBtn"> <div class="dropdown addTag-dropdown" data-id="addTagListBtn">
......
...@@ -15,9 +15,12 @@ ...@@ -15,9 +15,12 @@
* limitations under the License. * limitations under the License.
--> -->
<div> <div>
<!-- <button class="add-tag btn btn-success pull-right" data-id="addTag" style="margin-bottom:10px">Add Tag</button> --> <!-- <button class="add-tag btn btn-success pull-right" data-id="addTag" style="margin-bottom:10px">Add Tag</button> -->
</div> </div>
<table class="table table-bordered table-striped"> <div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
<table class="table table-quickMenu">
<thead> <thead>
<tr> <tr>
<th>Tag</th> <th>Tag</th>
......
...@@ -17,8 +17,11 @@ ...@@ -17,8 +17,11 @@
<form name="tagDefinitionform" class="css-form"> <form name="tagDefinitionform" class="css-form">
<!-- <h4 style="margin-bottom:30px"></h4> --> <!-- <h4 style="margin-bottom:30px"></h4> -->
<div class="form-group"> <div class="form-group">
<input class="form-control" data-id="tagName" placeholder="Create tag"> <input class="form-control row-margin-bottom" data-id="tagName" placeholder="Create tag">
</input> </input>
<select class="form-control tagList" data-id="parentTag" multiple></select> <input class="form-control row-margin-bottom" data-id="description" placeholder="Description">
</input>
<span class="row-margin-bottom">Parent Tag</span>
<select class="form-control tagList" data-id="parentTag" multiple="multiple"></select>
</div> </div>
</form> </form>
...@@ -46,7 +46,13 @@ define(['require', 'utils/Utils', 'modules/Modal'], function(require, Utils, Mod ...@@ -46,7 +46,13 @@ define(['require', 'utils/Utils', 'modules/Modal'], function(require, Utils, Mod
Utils.notifySuccess({ Utils.notifySuccess({
content: "Tag " + options.tagName + " has been deleted successfully" content: "Tag " + options.tagName + " has been deleted successfully"
}); });
options.collection.fetch({ reset: true }); if (options.callback) {
options.callback();
}
if (options.collection) {
options.collection.fetch({ reset: true });
}
}, },
error: function(error, data, status) { error: function(error, data, status) {
var message = "Tag " + options.tagName + " could not be deleted"; var message = "Tag " + options.tagName + " could not be deleted";
......
...@@ -151,7 +151,7 @@ define(['require', 'utils/Globals'], function(require, Globals) { ...@@ -151,7 +151,7 @@ define(['require', 'utils/Globals'], function(require, Globals) {
if (options.mergeBrowserUrl) { if (options.mergeBrowserUrl) {
var param = Utils.getUrlState.getQueryParams(); var param = Utils.getUrlState.getQueryParams();
if (param) { if (param) {
options.urlParams = _.extend(param, options.urlParams); options.urlParams = $.extend(param, options.urlParams);
} }
} }
if (options.urlParams) { if (options.urlParams) {
...@@ -163,7 +163,7 @@ define(['require', 'utils/Globals'], function(require, Globals) { ...@@ -163,7 +163,7 @@ define(['require', 'utils/Globals'], function(require, Globals) {
options.url += urlParams; options.url += urlParams;
} }
if (options.updateTabState) { if (options.updateTabState) {
_.extend(Globals.saveApplicationState.tabState, options.updateTabState()); $.extend(Globals.saveApplicationState.tabState, options.updateTabState());
} }
Backbone.history.navigate(options.url, { trigger: options.trigger != undefined ? options.trigger : true }); Backbone.history.navigate(options.url, { trigger: options.trigger != undefined ? options.trigger : true });
} }
......
...@@ -90,7 +90,7 @@ define(['require', ...@@ -90,7 +90,7 @@ define(['require',
globalVent: that.globalVent, globalVent: that.globalVent,
columns: cols, columns: cols,
gridOpts: { gridOpts: {
className: "table table-bordered table-hover table-condensed backgrid table-quickMenu", className: "table table-quickMenu",
}, },
}))); })));
}); });
......
...@@ -187,7 +187,8 @@ define(['require', ...@@ -187,7 +187,8 @@ define(['require',
} }
} }
} }
parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover"></i></div><a href="javascript:void(0)" data-href=' + hrefUrl + '>' + model.get('name') + '</a>'; var name = model.get('name').split('.');
parentLi = '<div class="tools"><i class="fa fa-refresh fa-spin-custom taxanomyloader"></i><i class="fa fa-ellipsis-h termPopover"></i></div><a href="javascript:void(0)" data-href="' + hrefUrl + '">' + name[name.length - 1] + '</a>';
}); });
if (href) { if (href) {
that.fetchCollection(href); that.fetchCollection(href);
...@@ -199,7 +200,8 @@ define(['require', ...@@ -199,7 +200,8 @@ define(['require',
function createTerm() { function createTerm() {
_.each(that.chiledCollection.fullCollection.models, function(model, key) { _.each(that.chiledCollection.fullCollection.models, function(model, key) {
chiledLi += '<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><a href="javascript:void(0)" data-href=/api' + model.get('href').split("/api")[1] + '>' + model.get('name') + '</a></li>'; var name = model.get('name').split('.');
chiledLi += '<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><a href="javascript:void(0)" data-href="/api' + model.get('href').split("/api")[1] + '">' + name[name.length - 1] + '</a></li>';
}); });
that.ui.chiledList.html(chiledLi); that.ui.chiledList.html(chiledLi);
} }
......
...@@ -76,7 +76,7 @@ define(['require', ...@@ -76,7 +76,7 @@ define(['require',
} }
}; };
events["click " + this.ui.tagClick] = function(e) { events["click " + this.ui.tagClick] = function(e) {
if (!e.target.nodeName.toLocaleLowerCase() == "i") { if (e.target.nodeName.toLocaleLowerCase() != "i") {
Utils.setUrl({ Utils.setUrl({
url: '#!/tag/tagAttribute/' + e.currentTarget.textContent, url: '#!/tag/tagAttribute/' + e.currentTarget.textContent,
mergeBrowserUrl: false, mergeBrowserUrl: false,
...@@ -161,7 +161,6 @@ define(['require', ...@@ -161,7 +161,6 @@ define(['require',
onRender: function() { onRender: function() {
var that = this; var that = this;
this.ui.editBox.hide(); this.ui.editBox.hide();
this.fetchCollection();
this.ui.appendList.on('click', 'div', function(e) { this.ui.appendList.on('click', 'div', function(e) {
if (e.target.nodeName == "INPUT") { if (e.target.nodeName == "INPUT") {
return false; return false;
...@@ -197,7 +196,9 @@ define(['require', ...@@ -197,7 +196,9 @@ define(['require',
CommonViewFunction.deleteTag({ CommonViewFunction.deleteTag({
'tagName': tagName, 'tagName': tagName,
'guid': that.id, 'guid': that.id,
'collection': that.collection callback: function() {
that.fetchCollection();
}
}); });
}, },
addTagToTerms: function(tagObject) { addTagToTerms: function(tagObject) {
...@@ -236,7 +237,9 @@ define(['require', ...@@ -236,7 +237,9 @@ define(['require',
var view = new AddTagModalView({ var view = new AddTagModalView({
vent: that.vent, vent: that.vent,
guid: that.id, guid: that.id,
modalCollection: that.collection callback: function() {
that.fetchCollection();
}
}); });
/*view.saveTagData = function() { /*view.saveTagData = function() {
override saveTagData function override saveTagData function
......
...@@ -89,15 +89,21 @@ define(['require', ...@@ -89,15 +89,21 @@ define(['require',
this.listenTo(this.schemaCollection, "reset", function(value) { this.listenTo(this.schemaCollection, "reset", function(value) {
this.renderTableLayoutView(); this.renderTableLayoutView();
$('.schemaTable').show(); $('.schemaTable').show();
this.$('.fontLoader').hide();
}, this); }, this);
this.listenTo(this.schemaCollection, "error", function(value) { this.listenTo(this.schemaCollection, "error", function(value) {
$('.schemaTable').hide(); $('.schemaTable').hide();
this.$('.fontLoader').hide();
}, this); }, this);
}, },
onRender: function() { onRender: function() {
this.schemaCollection.fetch({ reset: true }); this.schemaCollection.fetch({ reset: true });
this.renderTableLayoutView(); this.renderTableLayoutView();
}, },
fetchCollection: function() {
this.$('.fontLoader').show();
this.schemaCollection.fetch({ reset: true });
},
renderTableLayoutView: function() { renderTableLayoutView: function() {
var that = this; var that = this;
require(['utils/TableLayout'], function(TableLayout) { require(['utils/TableLayout'], function(TableLayout) {
...@@ -106,38 +112,55 @@ define(['require', ...@@ -106,38 +112,55 @@ define(['require',
globalVent: that.globalVent, globalVent: that.globalVent,
columns: cols, columns: cols,
gridOpts: { gridOpts: {
className: "table table-bordered table-hover table-condensed backgrid table-quickMenu", className: "table table-quickMenu",
}, },
}))); })));
}); });
}, },
getSchemaTableColumns: function() { getSchemaTableColumns: function() {
var that = this; var that = this;
return this.schemaCollection.constructor.getTableCols({ var col = {};
name: { if (this.schemaCollection.keyList) {
label: "Name", _.each(this.schemaCollection.keyList, function(obj, key) {
cell: "Html", col[obj.name] = {
editable: false, cell: "Html",
sortable: false, editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { sortable: false,
fromRaw: function(rawValue, model) { orderable: true,
return '<div><a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a></div>'; formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
} fromRaw: function(rawValue, model) {
}) if (model) {
}, if (!_.isArray(rawValue) && _.isObject(rawValue)) {
comment: { if (rawValue.id) {
label: "Comment", return '<div><a href="#!/detailPage/' + rawValue.id + '">' + rawValue.$typeName$ + '</a></div>';
cell: "html", } else {
editable: false, return rawValue.$typeName$;
sortable: false }
}, } else if (_.isArray(rawValue)) {
type: { var links = "";
label: "DataType", _.each(rawValue, function(val, key) {
cell: "html", if (val.id) {
editable: false, links += '<div><a href="#!/detailPage/' + val.id + '">' + val.$typeName$ + '</a></div>';
sortable: false } else {
}, links += '<div>' + val.$typeName$ + '</div>';
tag: { }
});
return links;
} else if (model.get('$id$') && model.get('$id$').id && model.get('name') == rawValue) {
return '<div><a href="#!/detailPage/' + model.get('$id$').id + '">' + rawValue + '</a></div>';
} else {
return rawValue;
}
} else {
return rawValue;
}
}
})
};
});
col['tag'] = {
label: "Tags", label: "Tags",
cell: "Html", cell: "Html",
editable: false, editable: false,
...@@ -152,16 +175,20 @@ define(['require', ...@@ -152,16 +175,20 @@ define(['require',
return '<div class="tagList">' + atags + '<a href="javascript:void(0);" class="inputTag" data-id="addTag" data-guid="' + model.get('$id$').id + '"><i style="right:0" class="fa fa-plus"></i></a></div>'; return '<div class="tagList">' + atags + '<a href="javascript:void(0);" class="inputTag" data-id="addTag" data-guid="' + model.get('$id$').id + '"><i style="right:0" class="fa fa-plus"></i></a></div>';
} }
}) })
} };
}, this.schemaCollection); }
return this.schemaCollection.constructor.getTableCols(col, this.schemaCollection);
}, },
onClickSchemaTag: function(e) { onClickSchemaTag: function(e) {
var that = this; var that = this;
require(['views/tag/addTagModalView'], function(AddTagModalView) { require(['views/tag/addTagModalView'], function(AddTagModalView) {
var view = new AddTagModalView({ var view = new AddTagModalView({
vent: that.vent,
guid: that.$(e.currentTarget).data("guid"), guid: that.$(e.currentTarget).data("guid"),
modalCollection: that.schemaCollection callback: function() {
that.fetchCollection();
}
}); });
// view.saveTagData = function() { // view.saveTagData = function() {
//override saveTagData function //override saveTagData function
...@@ -186,7 +213,9 @@ define(['require', ...@@ -186,7 +213,9 @@ define(['require',
CommonViewFunction.deleteTag({ CommonViewFunction.deleteTag({
'tagName': tagName, 'tagName': tagName,
'guid': guid, 'guid': guid,
'collection': that.tagCollection callback: function() {
that.fetchCollection();
}
}); });
} }
}); });
......
...@@ -51,11 +51,15 @@ define(['require', ...@@ -51,11 +51,15 @@ define(['require',
}, },
renderSearchResultLayoutView: function() { renderSearchResultLayoutView: function() {
var that = this; var that = this;
require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) { require(['views/search/SearchResultLayoutView'], function(SearchResultLayoutView) {
var value = { var value = {};
'query': that.value.query, if (that.value) {
'searchType': that.value.searchType value = {
}; 'query': that.value.query,
'searchType': that.value.searchType
};
}
that.RSearchResultLayoutView.show(new SearchResultLayoutView({ that.RSearchResultLayoutView.show(new SearchResultLayoutView({
value: value, value: value,
tag: that.tag tag: that.tag
......
...@@ -36,7 +36,8 @@ define(['require', ...@@ -36,7 +36,8 @@ define(['require',
ui: { ui: {
tagName: "[data-id='tagName']", tagName: "[data-id='tagName']",
parentTag: "[data-id='parentTag']" parentTag: "[data-id='parentTag']",
description: "[data-id='description']"
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -63,12 +64,16 @@ define(['require', ...@@ -63,12 +64,16 @@ define(['require',
tagCollectionList: function() { tagCollectionList: function() {
this.ui.parentTag.empty(); this.ui.parentTag.empty();
var str = '<option selected="true" style="display:none;"></option>'; var str = '';
for (var i = 0; i < this.tagCollection.fullCollection.models.length; i++) { for (var i = 0; i < this.tagCollection.fullCollection.models.length; i++) {
var tags = this.tagCollection.fullCollection.models[i].get("tags"); var tags = this.tagCollection.fullCollection.models[i].get("tags");
str += '<option>' + tags + '</option>'; str += '<option>' + tags + '</option>';
this.ui.parentTag.html(str); this.ui.parentTag.html(str);
} }
this.ui.parentTag.select2({
placeholder: "Select parent Tag",
allowClear: true
});
}, },
fetchCollection: function() { fetchCollection: function() {
$.extend(this.tagCollection.queryParams, { type: 'TRAIT' }); $.extend(this.tagCollection.queryParams, { type: 'TRAIT' });
......
...@@ -44,6 +44,7 @@ define(['require', ...@@ -44,6 +44,7 @@ define(['require',
addTagListBtn: '[data-id="addTagListBtn"]', addTagListBtn: '[data-id="addTagListBtn"]',
addTagtext: '[data-id="addTagtext"]', addTagtext: '[data-id="addTagtext"]',
addTagPlus: '[data-id="addTagPlus"]', addTagPlus: '[data-id="addTagPlus"]',
description: '[data-id="description"]',
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -70,6 +71,10 @@ define(['require', ...@@ -70,6 +71,10 @@ define(['require',
attributeData = ""; attributeData = "";
_.each(this.tagCollection.models, function(attr) { _.each(this.tagCollection.models, function(attr) {
var traitTypes = attr.get("traitTypes"); var traitTypes = attr.get("traitTypes");
if (traitTypes[0].typeDescription != null) {
var descriptionValue = traitTypes[0].typeDescription;
that.ui.description.html(descriptionValue);
}
_.each(traitTypes[0].attributeDefinitions, function(value, key) { _.each(traitTypes[0].attributeDefinitions, function(value, key) {
attributeData += '<span class="inputAttribute">' + value.name + '</span>'; attributeData += '<span class="inputAttribute">' + value.name + '</span>';
}); });
...@@ -79,6 +84,13 @@ define(['require', ...@@ -79,6 +84,13 @@ define(['require',
that.ui.addTagPlus.show(); that.ui.addTagPlus.show();
} }
that.ui.showAttribute.html(attributeData); that.ui.showAttribute.html(attributeData);
}, this);
this.listenTo(this.tagCollection, 'error', function(error, response) {
if (response.responseJSON && response.responseJSON.error) {
Utils.notifyError({
content: response.responseJSON.error
});
}
}, this); }, this);
}, },
......
...@@ -122,7 +122,10 @@ define(['require', ...@@ -122,7 +122,10 @@ define(['require',
CommonViewFunction.deleteTag({ CommonViewFunction.deleteTag({
'tagName': tagName, 'tagName': tagName,
'guid': that.guid, 'guid': that.guid,
'collection': that.collection callback: function() {
that.$('.fontLoader').show();
that.collection.fetch({ reset: true });
}
}); });
} }
}); });
......
...@@ -41,7 +41,7 @@ define(['require', ...@@ -41,7 +41,7 @@ define(['require',
createTag: "[data-id='createTag']", createTag: "[data-id='createTag']",
tags: "[data-id='tags']", tags: "[data-id='tags']",
offLineSearchTag: "[data-id='offlineSearchTag']", offLineSearchTag: "[data-id='offlineSearchTag']",
deleteTerm: "[data-id='deleteTerm']", deleteTerm: "[data-id='deleteTerm']"
}, },
/** ui events hash */ /** ui events hash */
...@@ -52,7 +52,7 @@ define(['require', ...@@ -52,7 +52,7 @@ define(['require',
this.onTagList(e, true); this.onTagList(e, true);
}*/ }*/
events["click " + this.ui.tags] = 'onTagList'; events["click " + this.ui.tags] = 'onTagList';
// events["click " + this.ui.referesh] = 'refereshClick'; // events["click " + this.ui.referesh] = 'refereshClick';
events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag'; events["keyup " + this.ui.offLineSearchTag] = 'offlineSearchTag';
events["click " + this.ui.deleteTerm] = 'onDeleteTerm'; events["click " + this.ui.deleteTerm] = 'onDeleteTerm';
return events; return events;
...@@ -77,7 +77,6 @@ define(['require', ...@@ -77,7 +77,6 @@ define(['require',
var that = this; var that = this;
this.listenTo(this.tagCollection, "reset", function() { this.listenTo(this.tagCollection, "reset", function() {
this.tagsAndTypeGenerator('tagCollection'); this.tagsAndTypeGenerator('tagCollection');
this.createTagAction();
}, this); }, this);
this.ui.tagsParent.on('click', 'li.parent-node a', function() { this.ui.tagsParent.on('click', 'li.parent-node a', function() {
that.setUrl(this.getAttribute("href")); that.setUrl(this.getAttribute("href"));
...@@ -104,29 +103,45 @@ define(['require', ...@@ -104,29 +103,45 @@ define(['require',
this.tagCollection.fetch({ reset: true }); this.tagCollection.fetch({ reset: true });
}, },
manualRender: function(tagName) { manualRender: function(tagName) {
this.setValues(tagName); this.tag = tagName;
if (!this.createTag) {
this.setValues(true);
}
}, },
setValues: function(tagName) { setValues: function(manual) {
if (Utils.getUrlState.isTagTab() || Utils.getUrlState.isInitial()) { if (Utils.getUrlState.isTagTab() || Utils.getUrlState.isInitial()) {
if (!this.tag && !tagName) { if (!this.tag) {
this.selectFirst = false; this.selectFirst = false;
this.ui.tagsParent.find('li').first().addClass('active'); this.ui.tagsParent.find('li').first().addClass('active');
Utils.setUrl({ Utils.setUrl({
url: this.ui.tagsParent.find('li a').first().attr("href"), url: this.ui.tagsParent.find('li a').first().attr("href"),
mergeBrowserUrl: false, mergeBrowserUrl: false,
trigger: true trigger: true,
updateTabState: function() {
return { tagUrl: this.url, stateChanged: true };
}
}); });
} else { } else {
Utils.setUrl({
url: Utils.getUrlState.getQueryUrl().hash,
updateTabState: function() {
return { tagUrl: this.url, stateChanged: true };
}
});
var tag = Utils.getUrlState.getLastValue(); var tag = Utils.getUrlState.getLastValue();
if (tagName) { if (this.tag) {
tag = tagName;
} else if (this.tag) {
tag = this.tag; tag = this.tag;
} }
this.ui.tagsParent.find('li').removeClass('active'); this.ui.tagsParent.find('li').removeClass('active');
this.ui.tagsParent.find('li').filter(function() { var target = this.ui.tagsParent.find('li').filter(function() {
return $(this).text() === tag; return $(this).text() === tag;
}).addClass('active'); }).addClass('active');
if (this.createTag || !manual) {
$('#sidebar-wrapper').animate({
scrollTop: target.offset().top - 100
}, 500);
}
} }
} }
}, },
...@@ -137,7 +152,7 @@ define(['require', ...@@ -137,7 +152,7 @@ define(['require',
var tagName = model.get("tags"); var tagName = model.get("tags");
if (searchString) { if (searchString) {
if (tagName.search(new RegExp(searchString, "i")) != -1) { if (tagName.search(new RegExp(searchString, "i")) != -1) {
str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-trash-o" data-id="deleteTerm"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str; str = '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + tagName + '">' + tagName + '</a></li>' + str;
} else { } else {
return; return;
} }
...@@ -148,6 +163,10 @@ define(['require', ...@@ -148,6 +163,10 @@ define(['require',
}); });
this.ui.tagsParent.empty().html(str); this.ui.tagsParent.empty().html(str);
this.setValues(); this.setValues();
this.createTagAction();
if (this.createTag) {
this.createTag = false;
}
}, },
...@@ -186,23 +205,23 @@ define(['require', ...@@ -186,23 +205,23 @@ define(['require',
onCreateButton: function(ref) { onCreateButton: function(ref) {
var that = this; var that = this;
this.name = ref.ui.tagName.val(); this.name = ref.ui.tagName.val();
this.description = ref.ui.description.val();
if (ref.ui.parentTag.val().length <= 1 && ref.ui.parentTag.val()[0] == "") { var superTypes = [];
var superTypes = []; if (ref.ui.parentTag.val() && ref.ui.parentTag.val()) {
} else { superTypes = ref.ui.parentTag.val();
var superTypes = ref.ui.parentTag.val();
} }
this.json.traitTypes[0] = { this.json.traitTypes[0] = {
attributeDefinitions: this.collection.toJSON(), attributeDefinitions: this.collection.toJSON(),
typeName: this.name, typeName: this.name,
typeDescription: null, typeDescription: this.description,
superTypes: superTypes, superTypes: superTypes,
hierarchicalMetaTypeName: "org.apache.atlas.typesystem.types.TraitType" hierarchicalMetaTypeName: "org.apache.atlas.typesystem.types.TraitType"
}; };
new this.tagCollection.model().set(this.json).save(null, { new this.tagCollection.model().set(this.json).save(null, {
success: function(model, response) { success: function(model, response) {
that.createTag = true;
that.fetchCollections(); that.fetchCollections();
that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val()); that.setUrl('#!/tag/tagAttribute/' + ref.ui.tagName.val(), true);
Utils.notifySuccess({ Utils.notifySuccess({
content: that.name + " has been created" content: that.name + " has been created"
}); });
...@@ -218,7 +237,7 @@ define(['require', ...@@ -218,7 +237,7 @@ define(['require',
}); });
}, },
setUrl: function(url) { setUrl: function(url, create) {
Utils.setUrl({ Utils.setUrl({
url: url, url: url,
mergeBrowserUrl: false, mergeBrowserUrl: false,
...@@ -264,7 +283,7 @@ define(['require', ...@@ -264,7 +283,7 @@ define(['require',
Utils.setUrl({ Utils.setUrl({
url: '#!/search/searchResult', url: '#!/search/searchResult',
urlParams: { urlParams: {
query: this.ui.tagsParent.find('li.active').find("a").text(), query: this.ui.tagsParent.find('li.active').find("a").text(),
searchType: "fulltext", searchType: "fulltext",
dslChecked: false dslChecked: false
}, },
......
...@@ -45,7 +45,7 @@ define(['require', ...@@ -45,7 +45,7 @@ define(['require',
*/ */
initialize: function(options) { initialize: function(options) {
var that = this; var that = this;
_.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid')); _.extend(this, _.pick(options, 'vent', 'modalCollection', 'guid', 'callback'));
this.collection = new VTagList(); this.collection = new VTagList();
this.commonCollection = new VCommonList(); this.commonCollection = new VCommonList();
this.modal = new Modal({ this.modal = new Modal({
...@@ -79,7 +79,7 @@ define(['require', ...@@ -79,7 +79,7 @@ define(['require',
}, this); }, this);
}, },
tagsCollection: function() { tagsCollection: function() {
var str = '<option selected="true" style="display:none;"></option>'; var str = '<option selected="selected" disabled="disabled">-- Select Tag --</option>';
for (var i = 0; i < this.collection.fullCollection.models.length; i++) { for (var i = 0; i < this.collection.fullCollection.models.length; i++) {
var tags = this.collection.fullCollection.models[i].get("tags"); var tags = this.collection.fullCollection.models[i].get("tags");
str += '<option>' + tags + '</option>'; str += '<option>' + tags + '</option>';
...@@ -135,18 +135,25 @@ define(['require', ...@@ -135,18 +135,25 @@ define(['require',
data: JSON.stringify(json), data: JSON.stringify(json),
beforeSend: function() {}, beforeSend: function() {},
success: function(data) { success: function(data) {
that.modalCollection.fetch({ reset: true });
Utils.notifySuccess({ Utils.notifySuccess({
content: "Tag " + tagName + " has been added to entity" content: "Tag " + tagName + " has been added to entity"
}); });
if (that.callback) {
that.callback();
}
if (that.modalCollection) {
that.modalCollection.fetch({ reset: true });
}
}, },
error: function(error, data, status) { error: function(error, data, status) {
var message = "Tag " + tagName + " could not be added";
if (error && error.responseText) { if (error && error.responseText) {
var data = JSON.parse(error.responseText); var data = JSON.parse(error.responseText);
Utils.notifyError({ message = data.error;
content: data.error
});
} }
Utils.notifyError({
content: message
});
}, },
complete: function() {} complete: function() {}
}); });
......
...@@ -21,6 +21,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset ...@@ -21,6 +21,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags) ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES: ALL CHANGES:
ATLAS-817 Asset details page -- generate schema dynamically based on attributeDefinitions (kevalbhatt18 via yhemanth)
ATLAS-495 Atlas Ranger Authorization Plugin (nixonrodrigues via shwethags) ATLAS-495 Atlas Ranger Authorization Plugin (nixonrodrigues via shwethags)
ATLAS-805 Quickstart is failing if run after queries to the business taxonomy API (jspeidel via shwethags) ATLAS-805 Quickstart is failing if run after queries to the business taxonomy API (jspeidel via shwethags)
ATLAS-774 Better error handling from login.jsp (nixonrodrigues via shwethags) ATLAS-774 Better error handling from login.jsp (nixonrodrigues via shwethags)
......
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