Commit 58a58956 by kevalbhatt

ATLAS-3624 : Beta UI : Allow user to add mutlti-valued attributes in namespaces

parent 91d2b8ea
...@@ -24,8 +24,19 @@ ...@@ -24,8 +24,19 @@
} }
.namespace-tree-child { .namespace-tree-child {
padding-left: 20px; &.entity-detail-table table {
td {
&:nth-child(1) {
width: 35%;
}
word-break: break-all;
}
}
padding-left: 5px;
margin-top: 10px; margin-top: 10px;
font-weight: 100;
} }
} }
...@@ -61,8 +72,8 @@ ...@@ -61,8 +72,8 @@
.expandable .attr-details { .expandable .attr-details {
max-height: 300px; max-height: 300px;
overflow: auto; overflow: auto;
margin-left: 100px; margin-left: 30px;
width: calc(100% - 100px); width: calc(100% - 30px);
} }
} }
...@@ -124,7 +135,6 @@ ...@@ -124,7 +135,6 @@
.name-space-details { .name-space-details {
.backgrid { .backgrid {
td.expandable-content { td.expandable-content {
width: 100%;
max-width: none; max-width: none;
background: #f8f8f8; background: #f8f8f8;
......
...@@ -77,7 +77,11 @@ ...@@ -77,7 +77,11 @@
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div id="r_entityUserDefineView"></div> <div id="r_entityUserDefineView">
<div class="fontLoader-relative">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
</div>
<div id="r_entityLabelDefineView"></div> <div id="r_entityLabelDefineView"></div>
<div id="r_entityNameSpaceView"></div> <div id="r_entityNameSpaceView"></div>
</div> </div>
......
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
</select> </select>
</div> </div>
</div> </div>
<!-- <div class="form-group" data-id="multiValueSelect"> <div class="form-group" data-id="multiValueSelect">
<label class="control-label col-sm-3" for="multiValSelect">Enable Multivalues</label> <label class="control-label col-sm-3" for="multiValSelect">Enable Multivalues</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="checkbox" class="form-check-input multi-value-select" data-id="multiValueSelectStatus"> <input type="checkbox" class="form-check-input multi-value-select" data-id="multiValueSelectStatus">
</div> </div>
</div> --> </div>
<div class="form-group enumtype-container" data-id="enumTypeSelectorContainer"> <div class="form-group enumtype-container" data-id="enumTypeSelectorContainer">
<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>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</tr> </tr>
</table> </table>
<ul class="dropdown-menu pull-right multi-level" role="menu" aria-labelledby="dropdownMenu"> <ul class="dropdown-menu pull-right multi-level" role="menu" aria-labelledby="dropdownMenu">
<li><a href="#!/administrator" data-id="purgeSearch">Administration</a></li> <li><a href="javascript:void(0)" data-id='administrator'>Administration</a></li>
<li class="dropdown-submenu"> <li class="dropdown-submenu">
<a tabindex="-1" href="javascript:void(0)"> Help </span></a> <a tabindex="-1" href="javascript:void(0)"> Help </span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
......
...@@ -28,7 +28,8 @@ define(['require'], function(require) { ...@@ -28,7 +28,8 @@ define(['require'], function(require) {
stateChanged: false, stateChanged: false,
tagUrl: "#!/tag", tagUrl: "#!/tag",
searchUrl: "#!/search", searchUrl: "#!/search",
glossaryUrl: "#!/glossary" glossaryUrl: "#!/glossary",
administratorUrl: "#!/administrator"
}, },
detailPageState: {} detailPageState: {}
}; };
......
...@@ -340,6 +340,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -340,6 +340,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
urlUpdate['searchUrl'] = options.url; urlUpdate['searchUrl'] = options.url;
} else if (Utils.getUrlState.isGlossaryTab(options.url)) { } else if (Utils.getUrlState.isGlossaryTab(options.url)) {
urlUpdate['glossaryUrl'] = options.url; urlUpdate['glossaryUrl'] = options.url;
} else if (Utils.getUrlState.isAdministratorTab(options.url)) {
urlUpdate['administratorUrl'] = options.url;
} }
$.extend(Globals.saveApplicationState.tabState, urlUpdate); $.extend(Globals.saveApplicationState.tabState, urlUpdate);
} }
...@@ -561,6 +563,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -561,6 +563,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
urlPath = "tagUrl"; urlPath = "tagUrl";
} else if (queryParams.from == "glossary") { } else if (queryParams.from == "glossary") {
urlPath = "glossaryUrl"; urlPath = "glossaryUrl";
} else if (queryParams.from == "namespace") {
urlPath = "administratorUrl";
} }
} }
Utils.setUrl({ Utils.setUrl({
......
...@@ -67,7 +67,7 @@ define(['require', ...@@ -67,7 +67,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'guid', 'entity', 'entityName', 'attributeDefs', 'nameSpaceCollection', 'enumDefCollection')); _.extend(this, _.pick(options, 'value', 'guid', 'entity', 'entityName', 'attributeDefs', 'entityDefCollection', 'nameSpaceCollection', 'enumDefCollection'));
}, },
onShow: function() { onShow: function() {
...@@ -87,7 +87,7 @@ define(['require', ...@@ -87,7 +87,7 @@ define(['require',
renderNameSpaceLayoutView: function(obj) { renderNameSpaceLayoutView: function(obj) {
var that = this; var that = this;
require(['views/name_space/NameSpaceTableLayoutView'], function(NameSpaceTableLayoutView) { require(['views/name_space/NameSpaceTableLayoutView'], function(NameSpaceTableLayoutView) {
that.RNamespaceTableLayoutView.show(new NameSpaceTableLayoutView({ nameSpaceCollection: that.nameSpaceCollection })); that.RNamespaceTableLayoutView.show(new NameSpaceTableLayoutView({ nameSpaceCollection: that.nameSpaceCollection, entityDefCollection: that.entityDefCollection }));
}); });
}, },
renderEnumLayoutView: function(obj) { renderEnumLayoutView: function(obj) {
......
...@@ -185,6 +185,7 @@ define(['require', ...@@ -185,6 +185,7 @@ define(['require',
cell: "html", cell: "html",
editable: false, editable: false,
sortable: false, sortable: false,
fixWidth: "20",
cell: Backgrid.ExpandableCell, cell: Backgrid.ExpandableCell,
accordion: false, accordion: false,
expand: function(el, model) { expand: function(el, model) {
......
...@@ -245,7 +245,7 @@ define(['require', ...@@ -245,7 +245,7 @@ define(['require',
enumDefCollection: this.enumDefCollection, enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection, classificationDefCollection: this.classificationDefCollection,
glossaryCollection: this.glossaryCollection, glossaryCollection: this.glossaryCollection,
nameSpaceCollection: this.nameSpaceCollection, nameSpaceCollection: this.activeEntityDef.get('namespaceAttributeDefs'),
searchVent: this.searchVent, searchVent: this.searchVent,
attributeDefs: (function() { attributeDefs: (function() {
return that.getEntityDef(collectionJSON); return that.getEntityDef(collectionJSON);
...@@ -255,7 +255,9 @@ define(['require', ...@@ -255,7 +255,9 @@ define(['require',
this.renderEntityDetailTableLayoutView(obj); this.renderEntityDetailTableLayoutView(obj);
this.renderEntityUserDefineView(obj); this.renderEntityUserDefineView(obj);
this.renderEntityLabelDefineView(obj); this.renderEntityLabelDefineView(obj);
if (obj.nameSpaceCollection) {
this.renderEntityNameSpaceView(obj); this.renderEntityNameSpaceView(obj);
}
this.renderRelationshipLayoutView(obj); this.renderRelationshipLayoutView(obj);
this.renderAuditTableLayoutView(obj); this.renderAuditTableLayoutView(obj);
this.renderTagTableLayoutView(obj); this.renderTagTableLayoutView(obj);
......
...@@ -62,39 +62,21 @@ define([ ...@@ -62,39 +62,21 @@ define([
initialize: function(options) { initialize: function(options) {
var that = this; var that = this;
_.extend(this, _.pick(options, "entity", "nameSpaceCollection", "enumDefCollection", "guid", "fetchCollection")); _.extend(this, _.pick(options, "entity", "nameSpaceCollection", "enumDefCollection", "guid", "fetchCollection"));
this.editMode - false; this.editMode = false;
this.$("editBox").hide(); this.$("editBox").hide();
var nameSpaceSet = {};
this.treeData = [];
this.actualCollection = new Backbone.Collection( this.actualCollection = new Backbone.Collection(
_.map(this.entity.namespaceAttributes, function(val, key) { _.map(this.entity.namespaceAttributes, function(val, key) {
var foundNameSpace = that.nameSpaceCollection.fullCollection.find({ name: key }); var foundNameSpace = that.nameSpaceCollection[key];
var tempData = {
text: key,
name: key,
parent: "#",
icon: "fa fa-folder-o",
children: []
}
if (foundNameSpace) { if (foundNameSpace) {
var attributeDefs = foundNameSpace.get("attributeDefs");
_.each(val, function(aVal, aKey) { _.each(val, function(aVal, aKey) {
var foundAttr = _.find(attributeDefs, function(o) { var foundAttr = _.find(foundNameSpace, function(o) {
return o.name === aKey return o.name === aKey
}); });
if (foundAttr) { if (foundAttr) {
var treVal = aKey + " : " + (foundAttr.typeName === "date" ? moment(aVal).format("MM/DD/YYYY") : aVal);
tempData.children.push({
text: treVal,
name: treVal,
icon: "fa fa-file-o",
children: []
})
val[aKey] = { value: aVal, typeName: foundAttr.typeName }; val[aKey] = { value: aVal, typeName: foundAttr.typeName };
} }
}) })
} }
that.treeData.push(tempData);
return _.extend({}, val, { __internal_UI_nameSpaceName: key }); return _.extend({}, val, { __internal_UI_nameSpaceName: key });
})); }));
this.collection = new Backbone.Collection(); this.collection = new Backbone.Collection();
...@@ -230,22 +212,38 @@ define([ ...@@ -230,22 +212,38 @@ define([
var modelObj = { isNew: true }; var modelObj = { isNew: true };
this.collection.unshift(modelObj); this.collection.unshift(modelObj);
}, },
generateTree: function() { renderNamespace: function() {
this.ui.namespaceTree.jstree({ var li = ""
plugins: ["core", "sort", "changed", "wholerow", "conditionalselect"], this.actualCollection.forEach(function(obj) {
conditionalselect: function(node) { var attrLi = "";
return false; _.each(obj.attributes, function(val, key) {
}, if (key !== "__internal_UI_nameSpaceName") {
state: { opened: true, selected: false }, var newVal = val;
core: { if (_.isObject(val) && !_.isUndefinedNull(val.value)) {
multiple: false, newVal = val.value;
data: this.treeData if (newVal.length > 0 && val.typeName.indexOf("date") > -1) {
newVal = _.map(newVal, function(dates) {
return moment(dates).format("MM/DD/YYYY");
});
} }
}) if (val.typeName === "date") {
newVal = moment(newVal).format("MM/DD/YYYY");
}
}
attrLi += "<tr><td>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + _.escape(newVal) + "</td></tr>";
}
});
li += "<ul class='namespace-tree-parent'><li class='table'>" + _.escape(obj.get("__internal_UI_nameSpaceName")) + "</li>" +
"<li class='namespace-tree-child entity-detail-table'>" +
"<table class='table'>" + attrLi + "</table>" +
"</li></ul>";
});
this.ui.namespaceTree.html(li);
}, },
onRender: function() { onRender: function() {
this.panelOpenClose(); this.panelOpenClose();
this.generateTree(); this.renderNamespace();
} }
}); });
}); });
\ No newline at end of file
...@@ -349,10 +349,8 @@ define(['require', ...@@ -349,10 +349,8 @@ define(['require',
} }
if (isMultiCheck) { if (isMultiCheck) {
obj.multiValued = true; obj.multiValued = true;
if (obj.typeName == "string" || obj.typeName == "int" || obj.typeName == "float") {
obj.typeName = "array<" + obj.typeName + ">"; obj.typeName = "array<" + obj.typeName + ">";
} }
}
}); });
var notifyObj = { var notifyObj = {
modal: true, modal: true,
...@@ -489,10 +487,8 @@ define(['require', ...@@ -489,10 +487,8 @@ define(['require',
} }
if (isMultiCheck) { if (isMultiCheck) {
obj.multiValued = true; obj.multiValued = true;
if (obj.typeName == "string" || obj.typeName == "int" || obj.typeName == "float") {
obj.typeName = "array<" + obj.typeName + ">"; obj.typeName = "array<" + obj.typeName + ">";
} }
}
}); });
var notifyObj = { var notifyObj = {
......
...@@ -70,6 +70,7 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp ...@@ -70,6 +70,7 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
this.ui.enumCancleBtn.attr("disabled", "true"); this.ui.enumCancleBtn.attr("disabled", "true");
}; };
events["click " + this.ui.enumOkBtn] = function(e) { events["click " + this.ui.enumOkBtn] = function(e) {
this.ui.enumCancleBtn.attr("disabled", "true");
this.onUpdateEnum(); this.onUpdateEnum();
}; };
return events; return events;
...@@ -173,6 +174,9 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp ...@@ -173,6 +174,9 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
return; return;
} }
this.ui.enumOkBtn.attr("disabled", "true"); this.ui.enumOkBtn.attr("disabled", "true");
this.ui.enumSelector.attr("disabled", "true");
this.ui.valueSelector.attr("disabled", "true");
this.ui.enumCancleBtn.attr("disabled", "true");
if (enumName) { if (enumName) {
var enumDef = enumName.get("elementDefs"); var enumDef = enumName.get("elementDefs");
if (enumDef.length === selectedEnumValues.length) { if (enumDef.length === selectedEnumValues.length) {
...@@ -231,6 +235,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp ...@@ -231,6 +235,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
complete: function(model, status) { complete: function(model, status) {
that.emumTypeSelectDisplay(); that.emumTypeSelectDisplay();
that.ui.enumOkBtn.removeAttr("disabled"); that.ui.enumOkBtn.removeAttr("disabled");
that.ui.enumSelector.removeAttr("disabled");
that.ui.valueSelector.removeAttr("disabled");
if (that.options.closeModal) { if (that.options.closeModal) {
that.options.closeModal(); that.options.closeModal();
} }
...@@ -246,6 +252,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp ...@@ -246,6 +252,8 @@ define(["require", "backbone", "hbs!tmpl/name_space/EnumCreateUpdateItemView_tmp
content: "No updated values" content: "No updated values"
}); });
that.ui.enumOkBtn.removeAttr("disabled"); that.ui.enumOkBtn.removeAttr("disabled");
that.ui.enumSelector.removeAttr("disabled");
that.ui.valueSelector.removeAttr("disabled");
if (that.options.closeModal) { if (that.options.closeModal) {
that.options.closeModal(); that.options.closeModal();
} }
......
...@@ -63,7 +63,7 @@ define(['require', ...@@ -63,7 +63,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr')); _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr', 'entityDefCollection'));
this.commonTableOptions = { this.commonTableOptions = {
collection: this.nameSpaceAttr, collection: this.nameSpaceAttr,
includeFilter: false, includeFilter: false,
...@@ -141,6 +141,7 @@ define(['require', ...@@ -141,6 +141,7 @@ define(['require',
that.renderTableLayoutView(); that.renderTableLayoutView();
that.showDetails = true; that.showDetails = true;
that.toggleNamespaceDetailsAttrView(); that.toggleNamespaceDetailsAttrView();
that.entityDefCollection.fetch({ silent: true });
}, },
parent: that.$el, parent: that.$el,
tagCollection: that.nameSpaceCollection, tagCollection: that.nameSpaceCollection,
...@@ -189,7 +190,7 @@ define(['require', ...@@ -189,7 +190,7 @@ define(['require',
}) })
}, },
typeName: { typeName: {
label: "typeName", label: "Type Name",
cell: "html", cell: "html",
editable: false, editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
......
...@@ -57,9 +57,7 @@ define(['require', ...@@ -57,9 +57,7 @@ define(['require',
this.model.set({ "name": e.target.value.trim() }); this.model.set({ "name": e.target.value.trim() });
}; };
events["change " + this.ui.dataTypeSelector] = function(e) { events["change " + this.ui.dataTypeSelector] = function(e) {
//this.ui.multiValueSelect.hide();
if (e.target.value.trim() === 'enumeration' || e.target.value.trim() === 'Enumeration') { if (e.target.value.trim() === 'enumeration' || e.target.value.trim() === 'Enumeration') {
// this.model.set({ "typeName": "enum" });
this.ui.enumTypeSelectorContainer.show(); this.ui.enumTypeSelectorContainer.show();
this.emumTypeSelectDisplay(); this.emumTypeSelectDisplay();
this.ui.stringLengthContainer.hide(); this.ui.stringLengthContainer.hide();
...@@ -67,13 +65,9 @@ define(['require', ...@@ -67,13 +65,9 @@ define(['require',
this.model.set({ "typeName": e.target.value.trim() }); this.model.set({ "typeName": e.target.value.trim() });
this.model.set({ "enumValues": null }); this.model.set({ "enumValues": null });
this.ui.stringLengthContainer.show(); this.ui.stringLengthContainer.show();
//this.ui.multiValueSelect.show();
this.ui.enumTypeSelectorContainer.hide(); this.ui.enumTypeSelectorContainer.hide();
this.ui.enumValueSelectorContainer.hide(); this.ui.enumValueSelectorContainer.hide();
} else { } else {
// if (e.target.value.trim() === 'int' || e.target.value.trim() === 'float') {
// this.ui.multiValueSelect.show();
// }
this.model.set({ "typeName": e.target.value.trim() }); this.model.set({ "typeName": e.target.value.trim() });
this.model.set({ "enumValues": null }); this.model.set({ "enumValues": null });
this.ui.enumTypeSelectorContainer.hide(); this.ui.enumTypeSelectorContainer.hide();
...@@ -101,9 +95,9 @@ define(['require', ...@@ -101,9 +95,9 @@ define(['require',
events["change " + this.ui.enumValueSelector] = function(e) { events["change " + this.ui.enumValueSelector] = function(e) {
this.model.set({ "enumValues": this.ui.enumValueSelector.val() }); this.model.set({ "enumValues": this.ui.enumValueSelector.val() });
}; };
// events["change " + this.ui.multiValueSelectStatus] = function(e) { events["change " + this.ui.multiValueSelectStatus] = function(e) {
// this.model.set({ "multiValueSelect": e.target.checked }); this.model.set({ "multiValueSelect": e.target.checked });
// }; };
events["click " + this.ui.close] = 'onCloseButton'; events["click " + this.ui.close] = 'onCloseButton';
events["click " + this.ui.createNewEnum] = 'onCreateUpdateEnum'; events["click " + this.ui.createNewEnum] = 'onCreateUpdateEnum';
return events; return events;
...@@ -150,7 +144,7 @@ define(['require', ...@@ -150,7 +144,7 @@ define(['require',
this.ui.attributeInput.attr("disabled", "false"); this.ui.attributeInput.attr("disabled", "false");
this.ui.dataTypeSelector.attr("disabled", "false"); this.ui.dataTypeSelector.attr("disabled", "false");
this.ui.dataTypeSelector.attr("disabled", "false"); this.ui.dataTypeSelector.attr("disabled", "false");
//this.ui.multiValueSelect.hide(); this.ui.multiValueSelect.hide();
this.ui.dataTypeSelector.val(this.parentView.attrDetails.attrTypeName); this.ui.dataTypeSelector.val(this.parentView.attrDetails.attrTypeName);
if (this.parentView.attrDetails.attrTypeName == "string") { if (this.parentView.attrDetails.attrTypeName == "string") {
this.ui.stringLengthContainer.show(); this.ui.stringLengthContainer.show();
...@@ -176,11 +170,11 @@ define(['require', ...@@ -176,11 +170,11 @@ define(['require',
this.ui.enumTypeSelector.val(typeName).trigger('change'); this.ui.enumTypeSelector.val(typeName).trigger('change');
} }
} }
// if (this.parentView.attrDetails.multiValued) { if (this.parentView.attrDetails && this.parentView.attrDetails.multiValued) {
// this.ui.multiValueSelect.show(); this.ui.multiValueSelect.show();
// $(this.ui.multiValueSelectStatus).prop('checked', true).trigger('change'); $(this.ui.multiValueSelectStatus).prop('checked', true).trigger('change');
// this.ui.multiValueSelectStatus.attr("disabled", "false"); this.ui.multiValueSelectStatus.attr("disabled", "false");
// } }
} }
}, },
showEnumValues: function(enumName) { showEnumValues: function(enumName) {
......
...@@ -106,7 +106,8 @@ define([ ...@@ -106,7 +106,8 @@ define([
guid: that.options.namespaceID, guid: that.options.namespaceID,
typeHeaders: that.typeHeaders, typeHeaders: that.typeHeaders,
enumDefCollection: that.enumDefCollection, enumDefCollection: that.enumDefCollection,
selectedNameSpace:that.selectedNameSpace selectedNameSpace: that.selectedNameSpace,
entityDefCollection: that.options.entityDefCollection
})); }));
}); });
} }
......
...@@ -79,7 +79,7 @@ define(['require', ...@@ -79,7 +79,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'nameSpaceAttr', 'selectedNameSpace')); _.extend(this, _.pick(options, 'guid', 'entity', 'entityName', 'attributeDefs', 'typeHeaders', 'nameSpaceCollection', 'entityDefCollection', 'nameSpaceAttr', 'selectedNameSpace'));
this.limit = 10; this.limit = 10;
this.offset = 0; this.offset = 0;
this.pervOld = []; this.pervOld = [];
...@@ -188,6 +188,7 @@ define(['require', ...@@ -188,6 +188,7 @@ define(['require',
enumDefCollection.fetch({ reset: true }); enumDefCollection.fetch({ reset: true });
that.showDetails = true; that.showDetails = true;
that.toggleNamespaceDetailsAttrView(); that.toggleNamespaceDetailsAttrView();
that.entityDefCollection.fetch({ silent: true });
}, },
parent: that.$el, parent: that.$el,
tagCollection: that.nameSpaceCollection, tagCollection: that.nameSpaceCollection,
...@@ -224,6 +225,7 @@ define(['require', ...@@ -224,6 +225,7 @@ define(['require',
enumDefCollection.fetch({ reset: true }); enumDefCollection.fetch({ reset: true });
that.showDetails = true; that.showDetails = true;
that.toggleNamespaceDetailsAttrView(); that.toggleNamespaceDetailsAttrView();
that.entityDefCollection.fetch({ silent: true });
}, },
tagCollection: that.nameSpaceCollection, tagCollection: that.nameSpaceCollection,
enumDefCollection: enumDefCollection, enumDefCollection: enumDefCollection,
...@@ -256,7 +258,7 @@ define(['require', ...@@ -256,7 +258,7 @@ define(['require',
editable: false, editable: false,
sortable: false, sortable: false,
cell: Backgrid.ExpandableCell, cell: Backgrid.ExpandableCell,
fixWidth: "50", fixWidth: "20",
accordion: false, accordion: false,
alwaysVisible: true, alwaysVisible: true,
expand: function(el, model) { expand: function(el, model) {
...@@ -298,7 +300,7 @@ define(['require', ...@@ -298,7 +300,7 @@ define(['require',
editable: false, editable: false,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
return '<a title= "' + model.get('name') + '" href ="#!/administrator/namespace/' + model.get('guid') + '">' + model.get('name') + '</a>'; return '<a title= "' + model.get('name') + '" href ="#!/administrator/namespace/' + model.get('guid') + '?from=namespace">' + model.get('name') + '</a>';
} }
}) })
}, },
......
...@@ -63,6 +63,7 @@ define(['require', ...@@ -63,6 +63,7 @@ define(['require',
'classificationDefCollection', 'classificationDefCollection',
'nameSpaceCollection', 'nameSpaceCollection',
'tag', 'tag',
'type',
'searchTableFilters', 'searchTableFilters',
'systemAttrArr')); 'systemAttrArr'));
this.attrObj = _.sortBy(this.attrObj, 'name'); this.attrObj = _.sortBy(this.attrObj, 'name');
...@@ -365,29 +366,28 @@ define(['require', ...@@ -365,29 +366,28 @@ define(['require',
filters.push(returnObj); filters.push(returnObj);
} }
}); });
if (this.attrObj.length > 0) { if (this.type) {
var entityDef = this.entityDefCollection.fullCollection.find({ name: that.options.applicableType }),
var sortedNamespaceData = _.sortBy(this.nameSpaceCollection.models, function(obj) { namespaceAttributeDefs = null;
return obj.get('name') if (entityDef) {
}); namespaceAttributeDefs = entityDef.get("namespaceAttributeDefs");
_.each(sortedNamespaceData, function(obj) { }
var namespaceName = obj.get('name'); if (namespaceAttributeDefs) {
_.each(namespaceAttributeDefs, function(attributes, key) {
var sortedNamespaceAttr = _.sortBy(obj.attributes.attributeDefs, function(obj) { var sortedAttributes = _.sortBy(attributes, function(obj) {
return obj.name; return obj.name;
}); });
_.each(sortedNamespaceAttr, function(attrDetails) { _.each(sortedAttributes, function(attrDetails) {
if (attrDetails.options && attrDetails.options.applicableEntityTypes && that.options.applicableType && (JSON.parse(attrDetails.options.applicableEntityTypes).indexOf(that.options.applicableType) != -1)) {
var returnObj = that.getObjDef(attrDetails, rules_widgets, isGroupView, 'Select Namespace Attribute', true); var returnObj = that.getObjDef(attrDetails, rules_widgets, isGroupView, 'Select Namespace Attribute', true);
if (returnObj) { if (returnObj) {
returnObj.id = namespaceName + "." + returnObj.id; returnObj.id = key + "." + returnObj.id;
returnObj.label = namespaceName + ": " + returnObj.label; returnObj.label = key + ": " + returnObj.label;
returnObj.data = { 'entityType': "namespace" }; returnObj.data = { 'entityType': "namespace" };
filters.push(returnObj); filters.push(returnObj);
} }
}
})
}); });
});
}
} }
filters = _.uniq(filters, 'id'); filters = _.uniq(filters, 'id');
if (filters && !_.isEmpty(filters)) { if (filters && !_.isEmpty(filters)) {
......
...@@ -133,7 +133,7 @@ define([ ...@@ -133,7 +133,7 @@ define([
this.showDefaultPage(); this.showDefaultPage();
}, },
showDefaultPage: function() { showDefaultPage: function() {
if (this.options.value) { if (Utils.getUrlState.isSearchTab() && this.options.value) {
if ( if (
!this.options.value.type && !this.options.value.type &&
!this.options.value.tag && !this.options.value.tag &&
......
...@@ -30,8 +30,9 @@ define(['require', ...@@ -30,8 +30,9 @@ define(['require',
'utils/Messages', 'utils/Messages',
'utils/Enums', 'utils/Enums',
'utils/UrlLinks', 'utils/UrlLinks',
'moment',
'platform' 'platform'
], function(require, Backbone, tableDragger, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks, platform) { ], function(require, Backbone, tableDragger, SearchResultLayoutViewTmpl, Modal, VEntity, Utils, Globals, VSearchList, VCommon, CommonViewFunction, Messages, Enums, UrlLinks, moment, platform) {
'use strict'; 'use strict';
var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend( var SearchResultLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -801,6 +802,20 @@ define(['require', ...@@ -801,6 +802,20 @@ define(['require',
if (obj && obj.attributes) { if (obj && obj.attributes) {
_.each(obj.attributes, function(namespaceValue, attributeName) { _.each(obj.attributes, function(namespaceValue, attributeName) {
if (attributeName.indexOf('.') != -1) { if (attributeName.indexOf('.') != -1) {
var isDate = false,
namespace = that.options.nameSpaceCollection.fullCollection.find({ "name": attributeName.split('.')[0] });
if (namespace) {
var getAttributes = namespace.get('attributeDefs');
getAttributes.every(function(attrTypeCheck) {
if (attributeName.split('.')[1] === attrTypeCheck.name && attrTypeCheck.typeName.indexOf("date") > -1) {
isDate = true;
}
return !isDate;
});
}
if (isDate) {
namespaceValue = moment(namespaceValue).format("MM/DD/YYYY")
}
namespaceStr += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + attributeName + ': ' + namespaceValue + '</label>'; namespaceStr += '<label class="btn btn-action btn-xs btn-blue no-pointer">' + attributeName + ': ' + namespaceValue + '</label>';
} }
}) })
......
...@@ -142,46 +142,25 @@ define([ ...@@ -142,46 +142,25 @@ define([
this.ui.nameSpaceSearchTree.jstree(true).deselect_all(); this.ui.nameSpaceSearchTree.jstree(true).deselect_all();
this.namespaceID = null; this.namespaceID = null;
} }
// if (this.options.value === undefined) {
// this.options.value = {};
// }
// if (!this.options.value.tag) {
// this.ui.nameSpaceSearchTree.jstree(true).deselect_all();
// this.nameSpaceId = null;
// } else {
// if (that.options.value.tag.indexOf("*") != -1) {
// that.ui.nameSpaceSearchTree.jstree(true).deselect_all();
// }
// var dataFound = this.nameSpaceCollection.fullCollection.find(function(obj) {
// return obj.get("name") === that.options.value.tag;
// });
// if (dataFound) {
// if ((this.nameSpaceId && this.nameSpaceId !== dataFound.get("guid")) || this.nameSpaceId === null) {
// if (this.nameSpaceId) {
// this.ui.nameSpaceSearchTree.jstree(true).deselect_node(this.nameSpaceId);
// }
// this.fromManualRender = true;
// this.nameSpaceId = dataFound.get("guid");
// this.ui.nameSpaceSearchTree.jstree(true).select_node(dataFound.get("guid"));
// }
// }
// if (!dataFound && Globals[that.options.value.tag]) {
// this.fromManualRender = true;
// this.typeId = Globals[that.options.value.tag].guid;
// this.ui.nameSpaceSearchTree.jstree(true).select_node(this.typeId);
// }
// }
}, },
onNodeSelect: function(nodeData) { onNodeSelect: function(nodeData) {
var that = this, var that = this,
options = nodeData.node.original, options = nodeData.node.original,
url = "#!/administrator/namespace"; url = "#!/administrator/namespace",
trigger = true,
queryParams = Utils.getUrlState.getQueryParams();
if (options.parent === undefined) { if (options.parent === undefined) {
url += "/" + options.id; url += "/" + options.id;
}
if (queryParams && queryParams.from === "namespace" && Utils.getUrlState.getQueryUrl().queyParams[0] === url) {
trigger = false;
}
if (trigger) {
this.triggerUrl(url); this.triggerUrl(url);
} else {
//this.triggerSearch();
} }
}, },
onViewEditNameSpace: function() { onViewEditNameSpace: function() {
var selectedNode = this.ui.nameSpaceSearchTree.jstree("get_selected", true); var selectedNode = this.ui.nameSpaceSearchTree.jstree("get_selected", true);
...@@ -194,16 +173,6 @@ define([ ...@@ -194,16 +173,6 @@ define([
} }
} }
}, },
// triggerSearch: function(params, url) {
// var serachUrl = url ? url : "#!/search/searchResult";
// Utils.setUrl({
// url: serachUrl,
// urlParams: params,
// mergeBrowserUrl: false,
// trigger: true,
// updateTabState: true
// });
// },
triggerUrl: function(url) { triggerUrl: function(url) {
Utils.setUrl({ Utils.setUrl({
url: url, url: url,
...@@ -252,32 +221,6 @@ define([ ...@@ -252,32 +221,6 @@ define([
}; };
return nodeStructure; return nodeStructure;
}; };
// getChildren = function(options) {
// var children = options.children,
// data = [],
// dataWithoutEmptyTag = [],
// isAttrNode = true;
// if (children && children.length) {
// _.each(children, function(attrDetail) {
// var nodeDetails = {
// name: _.escape(attrDetail.name),
// model: attrDetail
// },
// nodeProperties = {
// parent: options.parent,
// text: _.escape(attrDetail.name),
// model: attrDetail,
// id: options.parent + "_" + _.escape(attrDetail.name)
// },
// getNodeDetails = generateNode(nodeDetails, isAttrNode),
// classificationNode = _.extend(getNodeDetails, nodeProperties);
// data.push(classificationNode);
// });
// } else {
// return null;
// }
// return data;
// };
_.each(namsSpaceTreeData, function(filterNode) { _.each(namsSpaceTreeData, function(filterNode) {
nameSpaceList.push(generateNode(filterNode)); nameSpaceList.push(generateNode(filterNode));
}); });
......
...@@ -34,6 +34,7 @@ define(['require', ...@@ -34,6 +34,7 @@ define(['require',
ui: { ui: {
backButton: "[data-id='backButton']", backButton: "[data-id='backButton']",
menuHamburger: "[data-id='menuHamburger']", menuHamburger: "[data-id='menuHamburger']",
administrator: "[data-id='administrator']",
signOut: "[data-id='signOut']" signOut: "[data-id='signOut']"
}, },
events: function() { events: function() {
...@@ -52,6 +53,16 @@ define(['require', ...@@ -52,6 +53,16 @@ define(['require',
var path = Utils.getBaseUrl(window.location.pathname); var path = Utils.getBaseUrl(window.location.pathname);
window.location = path + "/logout.html"; window.location = path + "/logout.html";
}; };
events['click ' + this.ui.administrator] = function() {
Utils.setUrl({
url: "#!/administrator",
mergeBrowserUrl: false,
trigger: true,
updateTabState: true
});
};
return events; return events;
}, },
......
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