Commit 506ffc97 by kevalbhatt Committed by nixonrodrigues

ATLAS-3662 : UI: Business Metadata validation improvements

parent 2e69f922
...@@ -157,6 +157,7 @@ define(['require', ...@@ -157,6 +157,7 @@ define(['require',
this.multiSelectEntity = []; this.multiSelectEntity = [];
this.searchType = 'Basic Search'; this.searchType = 'Basic Search';
this.columnOrder = null; this.columnOrder = null;
this.defaultColumns = ["selected", "name", "description", "typeName", "owner", "tag", "term"];
if (this.value) { if (this.value) {
if (this.value.searchType && this.value.searchType == 'dsl') { if (this.value.searchType && this.value.searchType == 'dsl') {
this.searchType = 'Advanced Search'; this.searchType = 'Advanced Search';
...@@ -221,7 +222,7 @@ define(['require', ...@@ -221,7 +222,7 @@ define(['require',
this.updateColumnList(state); this.updateColumnList(state);
var excludeDefaultColumn = []; var excludeDefaultColumn = [];
if (this.value && this.value.type) { if (this.value && this.value.type) {
excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "term"); excludeDefaultColumn = _.difference(this.searchTableColumns[this.value.type], this.defaultColumns);
if (this.searchTableColumns[this.value.type] === null) { if (this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show(); this.ui.columnEmptyInfo.show();
} else { } else {
...@@ -371,7 +372,7 @@ define(['require', ...@@ -371,7 +372,7 @@ define(['require',
} }
if (isPostMethod && isSearchTab) { if (isPostMethod && isSearchTab) {
var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag") : null, var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.difference(this.searchTableColumns[this.value.type], this.defaultColumns) : null,
filterObj = { filterObj = {
'entityFilters': entityFilters, 'entityFilters': entityFilters,
'tagFilters': tagFilters, 'tagFilters': tagFilters,
......
...@@ -277,3 +277,12 @@ pre { ...@@ -277,3 +277,12 @@ pre {
margin-left: 5px; margin-left: 5px;
float: left; float: left;
} }
.errorValidate {
border-color: red !important;
}
.errorValidate+span .select2-selection {
border-color: red !important;
}
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-3 required" for="name">Name</label> <label class="control-label col-sm-3 required" for="name">Name</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control attributeInput" data-id="attributeInput" placeholder="Attribute name"> <input class="form-control attributeInput require" data-id="attributeInput" placeholder="Attribute name">
</input> </input>
</div> </div>
</div> </div>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<div class=""> <div class="">
<label class="control-label col-sm-3 required" for="enumType">Enum Name</label> <label class="control-label col-sm-3 required" for="enumType">Enum Name</label>
<div class="col-sm-5"> <div class="col-sm-5">
<select class="form-control enumTypeSelector" data-id="enumTypeSelector" multiple="false"> <select class="form-control enumTypeSelector require" data-id="enumTypeSelector" multiple="false">
</select> </select>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<div class="stringlength-container"> <div class="stringlength-container">
<label class="control-label col-sm-3 required" for="name">Max length</label> <label class="control-label col-sm-3 required" for="name">Max length</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" class="form-control stringLengthVal" data-id="stringLength" placeholder="Maximum length"> <input type="number" class="form-control stringLengthVal require" data-id="stringLength" placeholder="Maximum length">
</div> </div>
</div> </div>
</div> </div>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label> <label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label>
{{#if create}} {{#if create}}
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control businessMetadata-name" data-id="name" placeholder="Name(required)" autofocus /> <input class="form-control businessMetadata-name require" data-id="name" placeholder="Name(required)" autofocus />
</div> </div>
{{else}} {{else}}
<span class="ellipsis-with-margin control-label text-left col-sm-10" data-id="title"></span> {{/if}} <span class="ellipsis-with-margin control-label text-left col-sm-10" data-id="title"></span> {{/if}}
......
...@@ -72,7 +72,6 @@ define(['require', ...@@ -72,7 +72,6 @@ define(['require',
filterOpts: {}, filterOpts: {},
paginatorOpts: {} paginatorOpts: {}
}; };
this.isFilters = null;
this.showDetails = true; this.showDetails = true;
}, },
onRender: function() { onRender: function() {
......
...@@ -47,33 +47,7 @@ define([ ...@@ -47,33 +47,7 @@ define([
initialize: function(options) { initialize: function(options) {
_.extend(this, options); _.extend(this, options);
}, },
bindEvents: function() { bindEvents: function() {},
// this.listenTo(this.businessMetadataDefCollection, 'reset', function() {
// if (!this.model) {
// this.model = this.businessMetadataDefCollection.fullCollection.findWhere({ guid: this.guid });
// if (this.model) {
// this.renderTagDetail();
// } else {
// this.$('.fontLoader').hide();
// Utils.notifyError({
// content: 'Tag Not Found'
// });
// }
// }
// }, this);
// this.listenTo(this.collection, 'error', function(error, response) {
// if (response.responseJSON && response.responseJSON.error) {
// Utils.notifyError({
// content: response.responseJSON.error
// });
// } else {
// Utils.notifyError({
// content: 'Something went wrong'
// });
// }
// this.$('.fontLoader').hide();
// }, this);
},
onRender: function() { onRender: function() {
this.updateView(); this.updateView();
}, },
......
...@@ -32,10 +32,7 @@ define(['require', ...@@ -32,10 +32,7 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
title: '[data-id="title"]', title: '[data-id="title"]',
editBox: '[data-id="editBox"]',
saveButton: "[data-id='saveButton']",
description: '[data-id="description"]', description: '[data-id="description"]',
publishButton: '[data-id="publishButton"]',
backButton: '[data-id="backButton"]' backButton: '[data-id="backButton"]'
}, },
/** ui events hash */ /** ui events hash */
...@@ -51,16 +48,15 @@ define(['require', ...@@ -51,16 +48,15 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'model', 'enumDefCollection', 'typeHeaders')); _.extend(this, _.pick(options, 'model'));
}, },
onRender: function() { onRender: function() {
this.renderDetail(); this.renderDetail();
}, },
renderDetail: function() { renderDetail: function() {
var that = this; this.ui.title.html('<span>' + this.model.get('name') + '</span>');
this.ui.title.html('<span>' + that.model.get('name') + '</span>'); if (this.model.get('description')) {
if (that.model.get('description')) { this.ui.description.text((this.model.get('description')));
this.ui.description.text((that.model.get('description')));
} }
} }
}); });
......
...@@ -19,14 +19,9 @@ ...@@ -19,14 +19,9 @@
define(['require', define(['require',
'backbone', 'backbone',
'hbs!tmpl/business_metadata/BusinessMetadataTableLayoutView_tmpl', 'hbs!tmpl/business_metadata/BusinessMetadataTableLayoutView_tmpl',
'collection/VEntityList',
'models/VSearch',
'utils/Utils', 'utils/Utils',
'utils/Messages', 'utils/Messages'
'utils/Enums', ], function(require, Backbone, BusinessMetadataTableLayoutView_tmpl, Utils, Messages) {
'utils/UrlLinks',
'utils/CommonViewFunction'
], function(require, Backbone, BusinessMetadataTableLayoutView_tmpl, VEntityList, VSearch, Utils, Messages, Enums, UrlLinks, CommonViewFunction) {
'use strict'; 'use strict';
var BusinessMetadataTableLayoutView = Backbone.Marionette.LayoutView.extend( var BusinessMetadataTableLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -47,18 +42,12 @@ define(['require', ...@@ -47,18 +42,12 @@ define(['require',
businessMetadataAttrPage: "[data-id='businessMetadataAttrPage']", businessMetadataAttrPage: "[data-id='businessMetadataAttrPage']",
businessMetadataAttrPageTitle: "[data-id='businessMetadataAttrPageTitle']", businessMetadataAttrPageTitle: "[data-id='businessMetadataAttrPageTitle']",
businessMetadataDetailPage: "[data-id='businessMetadataDetailPage']", businessMetadataDetailPage: "[data-id='businessMetadataDetailPage']",
auditCreate: "[data-id='auditCreate']",
pageRecordText: "[data-id='pageRecordText']",
activePage: "[data-id='activePage']",
createBusinessMetadata: "[data-id='createBusinessMetadata']", createBusinessMetadata: "[data-id='createBusinessMetadata']",
attributeEdit: "[data-id='attributeEdit']", attributeEdit: "[data-id='attributeEdit']",
addAttribute: '[data-id="addAttribute"]', addAttribute: '[data-id="addAttribute"]',
businessMetadataAttrPageOk: '[data-id="businessMetadataAttrPageOk"]', businessMetadataAttrPageOk: '[data-id="businessMetadataAttrPageOk"]',
colManager: "[data-id='colManager']", colManager: "[data-id='colManager']",
deleteBusinessMetadata: '[data-id="deleteBusinessMetadata"]', deleteBusinessMetadata: '[data-id="deleteBusinessMetadata"]'
businessMetadataAttrFontLoader: '.business-metadata-attr-fontLoader',
businessMetadataAttrTableOverlay: '.businessMetadata-attr-tableOverlay'
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -80,9 +69,6 @@ define(['require', ...@@ -80,9 +69,6 @@ define(['require',
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'businessMetadataDefCollection', 'entityDefCollection', 'businessMetadataAttr', 'selectedBusinessMetadata')); _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'businessMetadataDefCollection', 'entityDefCollection', 'businessMetadataAttr', 'selectedBusinessMetadata'));
this.limit = 10; this.limit = 10;
this.offset = 0;
this.pervOld = [];
this.onlyPurge = true;
this.newAttr = false; this.newAttr = false;
this.commonTableOptions = { this.commonTableOptions = {
collection: this.businessMetadataDefCollection, collection: this.businessMetadataDefCollection,
...@@ -111,8 +97,6 @@ define(['require', ...@@ -111,8 +97,6 @@ define(['require',
filterOpts: {}, filterOpts: {},
paginatorOpts: {} paginatorOpts: {}
}; };
this.currPage = 1;
this.isFilters = null;
this.guid = null; this.guid = null;
this.showDetails = true; // toggle between sttribute page and detail page this.showDetails = true; // toggle between sttribute page and detail page
}, },
...@@ -225,11 +209,10 @@ define(['require', ...@@ -225,11 +209,10 @@ define(['require',
that.toggleBusinessMetadataDetailsAttrView(); that.toggleBusinessMetadataDetailsAttrView();
that.entityDefCollection.fetch({ silent: true }); that.entityDefCollection.fetch({ silent: true });
}, },
tagCollection: that.businessMetadataDefCollection, businessMetadataDefCollection: that.businessMetadataDefCollection,
enumDefCollection: enumDefCollection, enumDefCollection: enumDefCollection,
typeHeaders: typeHeaders, typeHeaders: typeHeaders,
isNewBusinessMetadata: isNewBusinessMetadata, isNewBusinessMetadata: isNewBusinessMetadata
businessMetadataDefCollection: businessMetadataDefCollection
}); });
that.RModal.show(that.view); that.RModal.show(that.view);
}); });
...@@ -272,7 +255,6 @@ define(['require', ...@@ -272,7 +255,6 @@ define(['require',
var applicableEntityTypes = '', var applicableEntityTypes = '',
typeName = attrObj.typeName; typeName = attrObj.typeName;
if (attrObj.options && attrObj.options.applicableEntityTypes) { if (attrObj.options && attrObj.options.applicableEntityTypes) {
// attrEntityTypes = JSON.parse(attrObj.options.applicableEntityTypes).join(', ');
var entityTypes = JSON.parse(attrObj.options.applicableEntityTypes); var entityTypes = JSON.parse(attrObj.options.applicableEntityTypes);
_.each(entityTypes, function(values) { _.each(entityTypes, function(values) {
applicableEntityTypes += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + values + '</label>'; applicableEntityTypes += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + values + '</label>';
...@@ -283,11 +265,11 @@ define(['require', ...@@ -283,11 +265,11 @@ define(['require',
} }
attrRow += "<tr> <td style='display:table-cell'>" + _.escape(attrObj.name) + "</td><td style='display:table-cell'>" + typeName + "</td><td style='display:table-cell'>" + applicableEntityTypes + "</td><td style='display:table-cell'> <div class='btn btn-action btn-sm' style='margin-left:0px;' data-id='attributeEdit' data-guid='" + model.get('guid') + "' data-name ='" + _.escape(attrObj.name) + "' data-action='attributeEdit' >Edit</div> </td></tr> "; attrRow += "<tr> <td style='display:table-cell'>" + _.escape(attrObj.name) + "</td><td style='display:table-cell'>" + typeName + "</td><td style='display:table-cell'>" + applicableEntityTypes + "</td><td style='display:table-cell'> <div class='btn btn-action btn-sm' style='margin-left:0px;' data-id='attributeEdit' data-guid='" + model.get('guid') + "' data-name ='" + _.escape(attrObj.name) + "' data-action='attributeEdit' >Edit</div> </td></tr> ";
}); });
var purgeText = '<div class="row"><div class="col-sm-12 attr-details"><table style="padding: 50px;">' + attrTableHeading + attrRow + '</table></div></div>'; var adminText = '<div class="row"><div class="col-sm-12 attr-details"><table style="padding: 50px;">' + attrTableHeading + attrRow + '</table></div></div>';
$(el).append($('<div>').html(purgeText)); $(el).append($('<div>').html(adminText));
} else { } else {
var purgeText = '<div class="row"><div class="col-sm-12 attr-details"><h5 class="text-center"> No attributes to show.</h5></div></div>'; var adminText = '<div class="row"><div class="col-sm-12 attr-details"><h5 class="text-center"> No attributes to show.</h5></div></div>';
$(el).append($('<div>').html(purgeText)); $(el).append($('<div>').html(adminText));
} }
} }
...@@ -364,7 +346,6 @@ define(['require', ...@@ -364,7 +346,6 @@ define(['require',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
return "<button type='button' data-id='addAttribute' data-guid='" + model.get('guid') + "'' title='' class='btn btn-action btn-xs ' style='margin-bottom: 10px;' data-action='createAttr' data-original-title='Add Business Metadata attribute'><i class='fa fa-plus'></i> Attributes</button>"; return "<button type='button' data-id='addAttribute' data-guid='" + model.get('guid') + "'' title='' class='btn btn-action btn-xs ' style='margin-bottom: 10px;' data-action='createAttr' data-original-title='Add Business Metadata attribute'><i class='fa fa-plus'></i> Attributes</button>";
// "<button type='button' data-id='deleteBusinessMetadata' data-guid='" + model.get('guid') + "'' title='' class='btn btn-action btn-xs ' style='margin-bottom: 10px;' data-action='createAttr' data-original-title='Delete BusinessMetadata'><i class='fa fa-trash-o'></i> Delete</button>";
} }
}) })
} }
...@@ -386,7 +367,6 @@ define(['require', ...@@ -386,7 +367,6 @@ define(['require',
onNotifyDeleteOk: function(data) { onNotifyDeleteOk: function(data) {
var that = this, var that = this,
deleteBusinessMetadataData = that.businessMetadataDefCollection.fullCollection.findWhere({ guid: that.guid }); deleteBusinessMetadataData = that.businessMetadataDefCollection.fullCollection.findWhere({ guid: that.guid });
// that.$('.position-relative .fontLoader').addClass('show');
that.$('.tableOverlay').show(); that.$('.tableOverlay').show();
if (deleteBusinessMetadataData) { if (deleteBusinessMetadataData) {
var businessMetadataName = deleteBusinessMetadataData.get("name"); var businessMetadataName = deleteBusinessMetadataData.get("name");
......
...@@ -15,13 +15,12 @@ ...@@ -15,13 +15,12 @@
* 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.
*/ */
define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemView_tmpl", "utils/Utils", "utils/UrlLinks", "utils/Messages"], function( define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemView_tmpl", "utils/Utils", "utils/UrlLinks"], function(
require, require,
Backbone, Backbone,
EnumCreateUpdateItemViewTmpl, EnumCreateUpdateItemViewTmpl,
Utils, Utils,
UrlLinks, UrlLinks
Messages
) { ) {
"use strict"; "use strict";
...@@ -81,13 +80,9 @@ define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemV ...@@ -81,13 +80,9 @@ define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemV
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
this.enumDefCollection = options.enumDefCollection; _.extend(this, _.pick(options, "businessMetadataDefCollection", "enumDefCollection"));
this.businessMetadataDefCollection = options.businessMetadataDefCollection;
}, },
onRender: function() { onRender: function() {
var that = this,
entitytypes = "",
enumTypes = [];
this.ui.enumValueSelectorContainer.hide(); this.ui.enumValueSelectorContainer.hide();
this.bindEvents(); this.bindEvents();
this.emumTypeSelectDisplay(); this.emumTypeSelectDisplay();
...@@ -107,8 +102,7 @@ define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemV ...@@ -107,8 +102,7 @@ define(["require", "backbone", "hbs!tmpl/business_metadata/EnumCreateUpdateItemV
var enumValues = "", var enumValues = "",
selectedValues = [], selectedValues = [],
selectedEnum = this.enumDefCollection.fullCollection.findWhere({ name: enumName }), selectedEnum = this.enumDefCollection.fullCollection.findWhere({ name: enumName }),
selectedEnumValues = selectedEnum ? selectedEnum.get("elementDefs") : null, selectedEnumValues = selectedEnum ? selectedEnum.get("elementDefs") : null;
savedValues = [];
_.each(selectedEnumValues, function(enumVal, index) { _.each(selectedEnumValues, function(enumVal, index) {
selectedValues.push(_.unescape(enumVal.value)); selectedValues.push(_.unescape(enumVal.value));
enumValues += "<option>" + enumVal.value + "</option>"; enumValues += "<option>" + enumVal.value + "</option>";
......
...@@ -163,6 +163,7 @@ define(['require', ...@@ -163,6 +163,7 @@ define(['require',
this.multiSelectEntity = []; this.multiSelectEntity = [];
this.searchType = 'Basic Search'; this.searchType = 'Basic Search';
this.columnOrder = null; this.columnOrder = null;
this.defaultColumns = ["selected", "name", "description", "typeName", "owner", "tag", "term"];
if (this.value) { if (this.value) {
if (this.value.searchType && this.value.searchType == 'dsl') { if (this.value.searchType && this.value.searchType == 'dsl') {
this.searchType = 'Advanced Search'; this.searchType = 'Advanced Search';
...@@ -227,7 +228,7 @@ define(['require', ...@@ -227,7 +228,7 @@ define(['require',
this.updateColumnList(state); this.updateColumnList(state);
var excludeDefaultColumn = []; var excludeDefaultColumn = [];
if (this.value && this.value.type) { if (this.value && this.value.type) {
excludeDefaultColumn = _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "term"); excludeDefaultColumn = _.difference(this.searchTableColumns[this.value.type], this.defaultColumns);
if (this.searchTableColumns[this.value.type] === null) { if (this.searchTableColumns[this.value.type] === null) {
this.ui.columnEmptyInfo.show(); this.ui.columnEmptyInfo.show();
} else { } else {
...@@ -380,7 +381,7 @@ define(['require', ...@@ -380,7 +381,7 @@ define(['require',
} }
if (isPostMethod && isSearchTab) { if (isPostMethod && isSearchTab) {
var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag") : null, var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.difference(this.searchTableColumns[this.value.type], this.defaultColumns) : null,
filterObj = { filterObj = {
'entityFilters': entityFilters, 'entityFilters': entityFilters,
'tagFilters': tagFilters, 'tagFilters': tagFilters,
...@@ -793,14 +794,14 @@ define(['require', ...@@ -793,14 +794,14 @@ define(['require',
} }
}) })
}; };
col['businessMetaData'] = { col['businessMetadata'] = {
label: "Business MetaData", label: "Business Metadata",
cell: "Html", cell: "Html",
editable: false, editable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
alwaysVisible: true, //Backgrid.ColumnManager.js -> render() to hide the name in dropdownlist alwaysVisible: true, //Backgrid.ColumnManager.js -> render() to hide the name in dropdownlist
renderable: _.contains(columnToShow, 'businessMetaData'), renderable: _.contains(columnToShow, 'businessMetadata'),
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var obj = model.toJSON(), var obj = model.toJSON(),
......
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