Commit 3709842a by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2562: UI for Glossary

parent 4ba39dca
...@@ -98,14 +98,15 @@ module.exports = function(grunt) { ...@@ -98,14 +98,15 @@ module.exports = function(grunt) {
'select2.full.min.js': { 'select2/dist/js': 'select2' }, 'select2.full.min.js': { 'select2/dist/js': 'select2' },
'backgrid-select-all.min.js': { 'backgrid-select-all': 'backgrid-select-all' }, 'backgrid-select-all.min.js': { 'backgrid-select-all': 'backgrid-select-all' },
'moment.min.js': { 'moment/min': 'moment/js' }, 'moment.min.js': { 'moment/min': 'moment/js' },
'moment-timezone-with-data.min.js' : {'moment-timezone/builds' : 'moment-timezone'}, 'moment-timezone-with-data.min.js': { 'moment-timezone/builds': 'moment-timezone' },
'jquery.placeholder.js': { 'jquery-placeholder': 'jquery-placeholder/js' }, 'jquery.placeholder.js': { 'jquery-placeholder': 'jquery-placeholder/js' },
'platform.js': { 'platform': 'platform' }, 'platform.js': { 'platform': 'platform' },
'query-builder.standalone.min.js': { 'jQuery-QueryBuilder/dist/js': 'jQueryQueryBuilder/js' }, 'query-builder.standalone.min.js': { 'jQuery-QueryBuilder/dist/js': 'jQueryQueryBuilder/js' },
'daterangepicker.js': { 'bootstrap-daterangepicker': 'bootstrap-daterangepicker/js' }, 'daterangepicker.js': { 'bootstrap-daterangepicker': 'bootstrap-daterangepicker/js' },
'nv.d3.min.js': { 'nvd3/build': 'nvd3' }, 'nv.d3.min.js': { 'nvd3/build': 'nvd3' },
'jquery.sparkline.min.js': { 'jquery-sparkline': 'sparkline' }, 'jquery.sparkline.min.js': { 'jquery-sparkline': 'sparkline' },
'table-dragger.js': { 'table-dragger/dist': 'table-dragger' } 'table-dragger.js': { 'table-dragger/dist': 'table-dragger' },
'jstree.min.js': { 'jstree/dist': 'jstree' }
} }
}, },
...@@ -127,16 +128,22 @@ module.exports = function(grunt) { ...@@ -127,16 +128,22 @@ module.exports = function(grunt) {
'select2.min.css': { 'select2/dist/css': 'select2/css' }, 'select2.min.css': { 'select2/dist/css': 'select2/css' },
'backgrid-select-all.min.css': { 'backgrid-select-all': 'backgrid-select-all' }, 'backgrid-select-all.min.css': { 'backgrid-select-all': 'backgrid-select-all' },
'font-awesome.min.css': { 'font-awesome/css': 'font-awesome/css' }, 'font-awesome.min.css': { 'font-awesome/css': 'font-awesome/css' },
'*': { '*': [{
'expand': true, 'expand': true,
'dot': true, 'dot': true,
'cwd': nodeModulePath + 'font-awesome', 'cwd': nodeModulePath + 'font-awesome',
'src': ['fonts/*.*'], 'src': ['fonts/*.*'],
'dest': libPath + 'font-awesome/' 'dest': libPath + 'font-awesome/'
}, }, {
'expand': true,
'dot': true,
'cwd': nodeModulePath + 'jstree/dist/themes/',
'src': ['**'],
'dest': libPath + 'jstree/css/'
}],
'query-builder.default.min.css': { 'jQuery-QueryBuilder/dist/css': 'jQueryQueryBuilder/css' }, 'query-builder.default.min.css': { 'jQuery-QueryBuilder/dist/css': 'jQueryQueryBuilder/css' },
'daterangepicker.css': { 'bootstrap-daterangepicker': 'bootstrap-daterangepicker/css' }, 'daterangepicker.css': { 'bootstrap-daterangepicker': 'bootstrap-daterangepicker/css' },
'nv.d3.min.css': { 'nvd3/build': 'nvd3/css' } 'nv.d3.min.css': { 'nvd3/build': 'nvd3/css' },
} }
}, },
...@@ -160,7 +167,7 @@ module.exports = function(grunt) { ...@@ -160,7 +167,7 @@ module.exports = function(grunt) {
{ 'dagre-d3': 'dagre-d3' }, { 'dagre-d3': 'dagre-d3' },
{ 'platform': 'platform/' }, { 'platform': 'platform/' },
{ 'jQuery-QueryBuilder': 'jQueryQueryBuilder/' }, { 'jQuery-QueryBuilder': 'jQueryQueryBuilder/' },
{'moment-timezone' : 'moment-timezone'} { 'moment-timezone': 'moment-timezone' }
], ],
'LICENSE.md': [{ 'backbone.babysitter': 'backbone-babysitter' }, 'LICENSE.md': [{ 'backbone.babysitter': 'backbone-babysitter' },
{ 'backbone.wreqr': 'backbone-wreqr' }, { 'backbone.wreqr': 'backbone-wreqr' },
...@@ -179,6 +186,14 @@ module.exports = function(grunt) { ...@@ -179,6 +186,14 @@ module.exports = function(grunt) {
} }
} }
}, },
rename: {
main: {
files: [
{ src: [libPath + '/jstree/css/default/style.min.css'], dest: libPath + '/jstree/css/default/default-theme.min.css' },
{ src: [libPath + '/jstree/css/default-dark/style.min.css'], dest: libPath + '/jstree/css/default-dark/default-dark-theme.min.css' },
]
}
},
sass: { sass: {
dist: { dist: {
files: { files: {
...@@ -296,8 +311,12 @@ module.exports = function(grunt) { ...@@ -296,8 +311,12 @@ module.exports = function(grunt) {
}); });
} }
} else { } else {
key = Object.keys(obj); if (fileName == "*") {
options.libFiles.push({ 'src': pathPrefix.srcPrefix + key + "/" + fileName, 'dest': pathPrefix.destPrefix + obj[key] + "/" + fileName }); options.libFiles.push(obj);
} else {
key = Object.keys(obj);
options.libFiles.push({ 'src': pathPrefix.srcPrefix + key + "/" + fileName, 'dest': pathPrefix.destPrefix + obj[key] + "/" + fileName });
}
} }
}; };
...@@ -305,16 +324,12 @@ module.exports = function(grunt) { ...@@ -305,16 +324,12 @@ module.exports = function(grunt) {
var options = npmCopy[key].options, var options = npmCopy[key].options,
files = npmCopy[key].files; files = npmCopy[key].files;
for (var fileName in files) { for (var fileName in files) {
if (fileName == "*") { createPath({
libFiles.push(files[fileName]); 'obj': files[fileName],
} else { 'libFiles': libFiles,
createPath({ 'pathPrefix': options,
'obj': files[fileName], 'fileName': fileName
'libFiles': libFiles, });
'pathPrefix': options,
'fileName': fileName
});
}
} }
}; };
grunt.config.set('copy.libs', { files: libFiles }); grunt.config.set('copy.libs', { files: libFiles });
...@@ -326,6 +341,7 @@ module.exports = function(grunt) { ...@@ -326,6 +341,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin'); grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-template'); grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-contrib-rename');
require('load-grunt-tasks')(grunt); require('load-grunt-tasks')(grunt);
...@@ -333,6 +349,7 @@ module.exports = function(grunt) { ...@@ -333,6 +349,7 @@ module.exports = function(grunt) {
'clean', 'clean',
'copy:libs', 'copy:libs',
'copy:dist', 'copy:dist',
'rename',
'sass:dist', 'sass:dist',
'template', 'template',
'setupProxies:server', 'setupProxies:server',
...@@ -344,6 +361,7 @@ module.exports = function(grunt) { ...@@ -344,6 +361,7 @@ module.exports = function(grunt) {
'clean', 'clean',
'copy:libs', 'copy:libs',
'copy:build', 'copy:build',
'rename',
'sass:build', 'sass:build',
'template' 'template'
]); ]);
...@@ -352,6 +370,7 @@ module.exports = function(grunt) { ...@@ -352,6 +370,7 @@ module.exports = function(grunt) {
'clean', 'clean',
'copy:libs', 'copy:libs',
'copy:dist', 'copy:dist',
'rename',
'sass:dist', 'sass:dist',
'uglify', 'uglify',
'cssmin', 'cssmin',
...@@ -365,6 +384,7 @@ module.exports = function(grunt) { ...@@ -365,6 +384,7 @@ module.exports = function(grunt) {
'clean', 'clean',
'copy:libs', 'copy:libs',
'copy:build', 'copy:build',
'rename',
'sass:build', 'sass:build',
'uglify', 'uglify',
'cssmin', 'cssmin',
......
...@@ -37,8 +37,10 @@ ...@@ -37,8 +37,10 @@
"jquery-asBreadcrumbs": "0.2.2", "jquery-asBreadcrumbs": "0.2.2",
"jquery-placeholder": "2.3.1", "jquery-placeholder": "2.3.1",
"jquery-sparkline": "2.4.0", "jquery-sparkline": "2.4.0",
"jstree": "^3.3.5",
"moment": "2.21.0", "moment": "2.21.0",
"moment-timezone": "0.5.14", "moment-timezone": "0.5.14",
"npm": "^5.8.0",
"nvd3": "1.8.5", "nvd3": "1.8.5",
"platform": "1.3.4", "platform": "1.3.4",
"pnotify": "3.2.0", "pnotify": "3.2.0",
...@@ -56,6 +58,7 @@ ...@@ -56,6 +58,7 @@
"grunt-contrib-copy": "1.0.0", "grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "2.0.0", "grunt-contrib-cssmin": "2.0.0",
"grunt-contrib-htmlmin": "2.2.0", "grunt-contrib-htmlmin": "2.2.0",
"grunt-contrib-rename": "^0.2.0",
"grunt-contrib-uglify": "2.1.0", "grunt-contrib-uglify": "2.1.0",
"grunt-contrib-watch": "1.0.0", "grunt-contrib-watch": "1.0.0",
"grunt-middleware-proxy": "1.0.7", "grunt-middleware-proxy": "1.0.7",
......
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.jstree-contextmenu {
z-index: 99;
}
.jstree-default-dark {
background: transparent !important;
.jstree-clicked,
.jstree-wholerow-clicked {
background: $color_jungle_green_approx !important;
}
.jstree-hovered {
background: $color_star_dust_approx;
}
.jstree-anchor {
color: #dbdbdb;
}
.jstree-search {
color: #fbfece !important
}
li[role="treeitem"] {
.jstree-wholerow-clicked {
.tools {
display: inline-block;
}
}
.tools {
display: none;
position: relative;
width: 9%;
float: right;
text-align: center;
cursor: pointer;
}
}
}
\ No newline at end of file
...@@ -94,11 +94,11 @@ $color_celeste_approx: #1D1F2B; ...@@ -94,11 +94,11 @@ $color_celeste_approx: #1D1F2B;
} }
} }
.popup-tag { .popup-tag-term {
display: none; display: none;
} }
.popover-tag { .popover-tag-term {
.btn { .btn {
display: block; display: block;
} }
...@@ -112,7 +112,8 @@ $color_celeste_approx: #1D1F2B; ...@@ -112,7 +112,8 @@ $color_celeste_approx: #1D1F2B;
} }
} }
} }
.table-responsive{
.table-responsive {
position: relative; position: relative;
} }
......
...@@ -31,4 +31,5 @@ ...@@ -31,4 +31,5 @@
@import "tag.scss"; @import "tag.scss";
@import "search.scss"; @import "search.scss";
@import "profile-table.scss"; @import "profile-table.scss";
@import "glossary.scss";
@import "override.scss"; @import "override.scss";
\ No newline at end of file
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
<link href="js/libs/jQueryQueryBuilder/css/query-builder.default.min.css?bust=<%- bust %>" rel="stylesheet"> <link href="js/libs/jQueryQueryBuilder/css/query-builder.default.min.css?bust=<%- bust %>" rel="stylesheet">
<link href="js/libs/bootstrap-daterangepicker/css/daterangepicker.css?bust=<%- bust %>" rel="stylesheet"> <link href="js/libs/bootstrap-daterangepicker/css/daterangepicker.css?bust=<%- bust %>" rel="stylesheet">
<link rel="stylesheet" href="js/libs/nvd3/css/nv.d3.min.css?bust=<%- bust %>"> <link rel="stylesheet" href="js/libs/nvd3/css/nv.d3.min.css?bust=<%- bust %>">
<link href="js/libs/jstree/css/default-dark/default-dark-theme.min.css?bust=<%- bust %>" rel="stylesheet">
<link href="js/libs/jstree/css/default/default-theme.min.css?bust=<%- bust %>" rel="stylesheet">
<link href="css/style.css?bust=<%- bust %>" rel="stylesheet"> <link href="css/style.css?bust=<%- bust %>" rel="stylesheet">
</head> </head>
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require',
'utils/Globals',
'collection/BaseCollection',
'models/VGlossary',
'utils/UrlLinks'
], function(require, Globals, BaseCollection, VGlossary, UrlLinks) {
'use strict';
var VGlossaryList = BaseCollection.extend(
//Prototypal attributes
{
url: UrlLinks.glossaryApiUrl(),
model: VGlossary,
initialize: function() {
this.modelName = 'VGlossary';
this.modelAttrName = '';
},
parseRecords: function(resp, options) {
if (_.isEmpty(this.modelAttrName)) {
return resp;
} else {
return resp[this.modelAttrName]
}
},
getCategory: function(options) {
var url = UrlLinks.categoryApiUrl({ "guid": options.guid, "related": options.related }),
apiOptions = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options.ajaxOptions);
return this.constructor.nonCrudOperation.call(this, url, 'GET', apiOptions);
},
getTerm: function(options) {
var url = UrlLinks.termApiUrl({ "guid": options.guid, "related": options.related }),
apiOptions = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options.ajaxOptions);
return this.constructor.nonCrudOperation.call(this, url, 'GET', apiOptions);
}
},
//Static Class Members
{
/**
* Table Cols to be passed to Backgrid
* UI has to use this as base and extend this.
*
*/
tableCols: {}
}
);
return VGlossaryList;
});
\ No newline at end of file
...@@ -53,9 +53,11 @@ define(['require', ...@@ -53,9 +53,11 @@ define(['require',
entities.push(temp); entities.push(temp);
}); });
return entities; return entities;
} else { } else if (resp.entities) {
this.dynamicTable = false; this.dynamicTable = false;
return resp.entities ? resp.entities : []; return resp.entities ? resp.entities : [];
} else {
return resp ? resp : [];
} }
}, },
getBasicRearchResult: function(options) { getBasicRearchResult: function(options) {
......
...@@ -114,11 +114,11 @@ require.config({ ...@@ -114,11 +114,11 @@ require.config({
'daterangepicker': { 'daterangepicker': {
'deps': ['jquery', 'moment'] 'deps': ['jquery', 'moment']
}, },
'moment-timezone' : { 'moment-timezone': {
'deps' : ['moment'] 'deps': ['moment']
}, },
'moment':{ 'moment': {
'exports':['moment'] 'exports': ['moment']
}, },
'nvd3': { 'nvd3': {
'deps': ['d3'] 'deps': ['d3']
...@@ -126,6 +126,9 @@ require.config({ ...@@ -126,6 +126,9 @@ require.config({
'sparkline': { 'sparkline': {
'deps': ['jquery'], 'deps': ['jquery'],
'exports': ['sparkline'] 'exports': ['sparkline']
},
'jstree': {
'deps': ['jquery']
} }
}, },
...@@ -167,7 +170,8 @@ require.config({ ...@@ -167,7 +170,8 @@ require.config({
'daterangepicker': 'libs/bootstrap-daterangepicker/js/daterangepicker', 'daterangepicker': 'libs/bootstrap-daterangepicker/js/daterangepicker',
'nvd3': 'libs/nvd3/nv.d3.min', 'nvd3': 'libs/nvd3/nv.d3.min',
'sparkline': 'libs/sparkline/jquery.sparkline.min', 'sparkline': 'libs/sparkline/jquery.sparkline.min',
'table-dragger': 'libs/table-dragger/table-dragger' 'table-dragger': 'libs/table-dragger/table-dragger',
'jstree': 'libs/jstree/jstree.min'
}, },
/** /**
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require',
'utils/Globals',
'models/BaseModel',
'utils/UrlLinks'
], function(require, Globals, VBaseModel, UrlLinks) {
'use strict';
var VGlossary = VBaseModel.extend({
urlRoot: UrlLinks.glossaryApiUrl(),
defaults: {},
serverSchema: {},
idAttribute: 'guid',
initialize: function() {
this.modelName = 'VGlossary';
},
toString: function() {
return this.get('name');
},
createEditCategory: function(options) {
var type = "POST",
url = UrlLinks.categoryApiUrl();
if (options.guid) {
type = "PUT";
url = UrlLinks.categoryApiUrl({ guid: options.guid });
}
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, type, options);
},
createEditTerm: function(options) {
var type = "POST",
url = UrlLinks.termApiUrl();
if (options.guid) {
type = "PUT";
url = UrlLinks.termApiUrl({ guid: options.guid });
}
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, type, options);
},
deleteCategory: function(guid, options) {
var url = UrlLinks.categoryApiUrl({ "guid": guid });
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
deleteTerm: function(guid, options) {
var url = UrlLinks.termApiUrl({ "guid": guid });
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
assignTermToEntity: function(guid, options) {
var url = UrlLinks.termToEntityApiUrl(guid);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'POST', options);
},
assignTermToCategory: function(options) {
return this.createEditCategory(options);
},
assignCategoryToTerm: function(options) {
return this.createEditTerm(options);
},
removeTermFromEntity: function(guid, options) {
var url = UrlLinks.termToEntityApiUrl(guid);
options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);
return this.constructor.nonCrudOperation.call(this, url, 'DELETE', options);
},
removeTermFromCategory: function() {
},
removeCategoryFromTerm: function() {}
}, {});
return VGlossary;
});
\ No newline at end of file
...@@ -24,8 +24,8 @@ define([ ...@@ -24,8 +24,8 @@ define([
'utils/Globals', 'utils/Globals',
'utils/Utils', 'utils/Utils',
'utils/UrlLinks', 'utils/UrlLinks',
'collection/VTagList' 'collection/VGlossaryList'
], function($, _, Backbone, App, Globals, Utils, UrlLinks, VTagList) { ], function($, _, Backbone, App, Globals, Utils, UrlLinks, VGlossaryList) {
var AppRouter = Backbone.Router.extend({ var AppRouter = Backbone.Router.extend({
routes: { routes: {
// Define some URL routes // Define some URL routes
...@@ -36,6 +36,8 @@ define([ ...@@ -36,6 +36,8 @@ define([
'!/detailPage/:id': 'detailPage', '!/detailPage/:id': 'detailPage',
'!/tag': 'commonAction', '!/tag': 'commonAction',
'!/search': 'commonAction', '!/search': 'commonAction',
'!/glossary': 'commonAction',
'!/glossary/:id': 'glossaryDetailPage',
// Default // Default
'*actions': 'defaultAction' '*actions': 'defaultAction'
}, },
...@@ -45,14 +47,19 @@ define([ ...@@ -45,14 +47,19 @@ define([
this.bindCommonEvents(); this.bindCommonEvents();
this.listenTo(this, 'route', this.postRouteExecute, this); this.listenTo(this, 'route', this.postRouteExecute, this);
this.searchVent = new Backbone.Wreqr.EventAggregator(); this.searchVent = new Backbone.Wreqr.EventAggregator();
this.glossaryCollection = new VGlossaryList([], {});
this.preFetchedCollectionLists = { this.preFetchedCollectionLists = {
'entityDefCollection': this.entityDefCollection, 'entityDefCollection': this.entityDefCollection,
'typeHeaders': this.typeHeaders, 'typeHeaders': this.typeHeaders,
'enumDefCollection': this.enumDefCollection, 'enumDefCollection': this.enumDefCollection,
'classificationDefCollection': this.classificationDefCollection 'classificationDefCollection': this.classificationDefCollection,
'glossaryCollection': this.glossaryCollection
} }
this.sharedObj = { this.sharedObj = {
searchTableColumns: {}, searchTableColumns: {},
glossary: {
selectedItem: {}
},
searchTableFilters: { searchTableFilters: {
tagFilters: {}, tagFilters: {},
entityFilters: {} entityFilters: {}
...@@ -169,6 +176,31 @@ define([ ...@@ -169,6 +176,31 @@ define([
} }
}); });
}, },
glossaryDetailPage: function(id) {
var that = this;
if (id) {
require([
'views/site/Header',
'views/glossary/GlossaryDetailLayoutView',
'views/site/SideNavLayoutView'
], function(Header, GlossaryDetailLayoutView, SideNavLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams();
App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView(
_.extend({}, that.preFetchedCollectionLists, that.sharedObj, { 'guid': id, 'value': paramObj })
));
} else {
App.rSideNav.currentView.RGlossaryLayoutView.currentView.manualRender(_.extend({}, { 'guid': id, 'value': paramObj }));
App.rSideNav.currentView.selectTab();
}
App.rNContent.show(new GlossaryDetailLayoutView(_.extend({
'guid': id,
'value': paramObj
}, that.preFetchedCollectionLists, that.sharedObj)));
});
}
},
commonAction: function() { commonAction: function() {
var that = this; var that = this;
require([ require([
...@@ -188,8 +220,11 @@ define([ ...@@ -188,8 +220,11 @@ define([
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
if (Utils.getUrlState.isTagTab()) { if (Utils.getUrlState.isTagTab()) {
App.rSideNav.currentView.RTagLayoutView.currentView.manualRender(); App.rSideNav.currentView.RTagLayoutView.currentView.manualRender();
} else if (Utils.getUrlState.isGlossaryTab()) {
App.rSideNav.currentView.RGlossaryLayoutView.currentView.manualRender(_.extend({}, paramObj));
} }
} }
if (Globals.entityCreate && Utils.getUrlState.isSearchTab()) { if (Globals.entityCreate && Utils.getUrlState.isSearchTab()) {
App.rNContent.show(new SearchDetailLayoutView( App.rNContent.show(new SearchDetailLayoutView(
_.extend({ _.extend({
......
...@@ -30,6 +30,14 @@ ...@@ -30,6 +30,14 @@
</button> </button>
</div> </div>
</div> </div>
<div class="form-group">
<span class="control-label-sm-pr pull-left">Term:</span>
<div class="pull-left" data-id="termList">
<button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm">
<i class="fa fa-plus"> </i>
</button>
</div>
</div>
<div class="form-group" style="display: none;" data-id="propagatedTagDiv"> <div class="form-group" style="display: none;" data-id="propagatedTagDiv">
<span class="control-label-sm-pr pull-left">Propagated Classifications:</span> <span class="control-label-sm-pr pull-left">Propagated Classifications:</span>
<div class="pull-left" data-id="propagatedTagList"> <div class="pull-left" data-id="propagatedTagList">
......
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<div id="r_glossaryTree"></div>
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<form name="tagDefinitionform" class="form-horizontal" data-id="categoryTermForm">
<div class="form-group">
<label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label>
<div class="col-sm-10">
<input class="form-control" data-id="displayName" name="displayName" value="{{modelJSON.displayName}}" placeholder="Name(required)" autofocus/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="description">Short Description</label>
<div class="col-sm-10">
<input class="form-control" name="shortDescription" data-id="shortDescription" value="{{modelJSON.shortDescription}}" placeholder="Short Description" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="description">Long Description</label>
<div class="col-sm-10">
<textarea class="form-control" name="longDescription" data-id="longDescription" placeholder="Long Description">{{modelJSON.longDescription}}</textarea>
</div>
</div>
</form>
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<form name="tagDefinitionform" class="form-horizontal" data-id="glossaryForm">
<div class="form-group">
<label class="control-label col-sm-2 {{#if create}}required{{/if}}" for="name">Name</label>
<div class="col-sm-10">
<input class="form-control" name="displayName" value="{{displayName}}" data-id="displayName" placeholder="Display Name(required)" autofocus/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="description">Short Description</label>
<div class="col-sm-10">
<input class="form-control" name="shortDescription" data-id="shortDescription" value="{{shortDescription}}" placeholder="Short Description" />
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="description">Long Description</label>
<div class="col-sm-10">
<textarea class="form-control" name="longDescription" data-id="longDescription" placeholder="Long Description">{{longDescription}}</textarea>
</div>
</div>
</form>
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<div class="page-title clearfix">
<div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
<div data-id="details" class="clearfix form-horizontal col-sm-12">
<h1 class="row title"><span data-id="title"></span></h1>
<button type="button" data-id="editButton" class="btn btn-sm btn-action pull-right"><i class="fa fa-pencil"></i></button>
<div class="form-group clearfix">
<span class="pull-left text-muted">Short Description:&nbsp;</span>
<div class="pull-left">
<p data-id="shortDescription"></p>
</div>
</div>
<div class="form-group clearfix">
<span class="pull-left text-muted">Long Description:&nbsp;</span>
<div class="pull-left">
<p data-id="longDescription"></p>
</div>
</div>
{{#if isTermView}}
<div class="form-group clearfix">
<span class="control-label-sm-pr pull-left">Categories:</span>
<div class="pull-left" data-id="categoryList">
<button class="btn btn-action btn-sm" title="Add Category" data-id="addCategory">
<i class="fa fa-plus"> </i>
</button>
</div>
</div>
{{/if}} {{#if isCategoryView}}
<div class="form-group clearfix">
<span class="control-label-sm-pr pull-left">Term:</span>
<div class="pull-left" data-id="termList">
<button class="btn btn-action btn-sm" title="Add Term" data-id="addTerm">
<i class="fa fa-plus"> </i>
</button>
</div>
</div>
{{/if}}
</div>
</div>
<div class="container-fluid gray-bg">
<div class="row">
<div class="col-sm-custom">
<div id="r_searchResultLayoutView">
<div class="fontLoader" style="display: block;min-height: 50px;position:relative;margin-top: 25px;">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<div class="col-sm-12 add-seperator">
<div class="row">
{{#unless isAssignView}}
<div class="col-sm-8 no-padding" style="margin-top: 5px;">
<span class="pull-left">Terms</span>
<label class="switch pull-left">
<input type="checkbox" class="switch-input" name="glossaryView" value="text" />
<span class="switch-slider"></span>
</label>
<span class="pull-left">Category</span>
</div>
<div class="{{#if isAssignView}}col-sm-2{{else}}col-sm-4{{/if}} no-padding-right">
<button type="button" class="btn btn-action btn-md pull-right" title="Refresh" data-id="refreshGlossary" onclick="this.blur();" type="button"><i class="fa fa-refresh"></i></button>
<button type="button" class="btn btn-action btn-md pull-right" data-id="createGlossary" type="button"><i class="fa fa-plus"></i></button>
{{/unless}}
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="no-padding col-sm-12 term-view">
<div>
<input type="text" class="form-control" data-id="searchTerm" placeholder="{{#if isAssignView}}Search Term{{else}}Search Glossary, Term{{/if}}">
</div>
<div data-id="termTree" style="margin-top: 5px;">
</div>
</div>
<div class="col-sm-12 no-padding category-view" style="display: none;">
<div>
<input type="text" class="form-control" data-id="searchCategory" placeholder="{{#if isAssignView}}Search Catalog{{else}}Search Glossary, Category{{/if}}">
</div>
<div data-id="categoryTree" style="margin-top: 5px;">
</div>
</div>
</div>
</div>
\ No newline at end of file
...@@ -36,11 +36,13 @@ ...@@ -36,11 +36,13 @@
id="historicalentities"/> id="historicalentities"/>
<b>Show historical entities</b></label> <b>Show historical entities</b></label>
</div> </div>
{{#ifCond fromView '!==' "glossary"}}
<div class="inline" data-id="containerCheckBox" style="display: none;"> <div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="subclassifications"> <label class="checkbox-inline btn" for="subclassifications">
<input type="checkbox" data-id="checkSubClassification" data-value="excludeSC" id="subclassifications"/> <input type="checkbox" data-id="checkSubClassification" data-value="excludeSC" id="subclassifications"/>
<b>Exclude sub-classifications</b></label> <b>Exclude sub-classifications</b></label>
</div> </div>
{{/ifCond}}
{{#ifCond fromView '!==' "classification"}} {{#ifCond fromView '!==' "classification"}}
<div class="inline" data-id="containerCheckBox" style="display: none;"> <div class="inline" data-id="containerCheckBox" style="display: none;">
<label class="checkbox-inline btn" for="subtypes"> <label class="checkbox-inline btn" for="subtypes">
......
...@@ -19,15 +19,19 @@ ...@@ -19,15 +19,19 @@
<a href="{{apiBaseUrl}}/index.html"><i class="fa fa-globe"></i> Apache Atlas</a> <a href="{{apiBaseUrl}}/index.html"><i class="fa fa-globe"></i> Apache Atlas</a>
</li> </li>
<ul class="tabs" style="width: 100%;" role="tablist"> <ul class="tabs" style="width: 100%;" role="tablist">
<li role="presentation" class="{{tabClass}}"><a href="#tab-search" aria-controls="tab-search" data-name="tab-search" role="tab" data-toggle="tab" class=""><i class="fa fa-search"></i> Search</a></li> <li role="presentation" class="tab col-sm-3"><a href="#tab-search" aria-controls="tab-search" data-name="tab-search" role="tab" data-toggle="tab" class=""><i class="fa fa-search"></i> Search</a></li>
<li role="presentation" class="{{tabClass}}"><a href="#tab-tag" aria-controls="tab-tag" data-name="tab-tag" role="tab" data-toggle="tab"><i class="fa fa-tags"></i> Classification</a></li> <li role="presentation" class="tab col-sm-5"><a href="#tab-classification" aria-controls="tab-classification" data-name="tab-classification" role="tab" data-toggle="tab"><i class="fa fa-tags"></i> Classification</a></li>
<li role="presentation" class="tab col-sm-4"><a href="#tab-glossary" aria-controls="tab-glossary" data-name="tab-glossary" role="tab" data-toggle="tab"><i class="fa fa-folder-open"></i> Glossary</a></li>
</ul> </ul>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane" id="tab-tag"> <div role="tabpanel" class="tab-pane" id="tab-classification">
<div id="r_tagLayoutView"></div> <div id="r_tagLayoutView"></div>
</div> </div>
<div role="tabpanel" class="tab-pane" id="tab-search"> <div role="tabpanel" class="tab-pane" id="tab-search">
<div id="r_searchLayoutView"></div> <div id="r_searchLayoutView"></div>
</div> </div>
<div role="tabpanel" class="tab-pane" id="tab-glossary">
<div id="r_glossaryLayoutView"></div>
</div>
</div> </div>
...@@ -27,7 +27,8 @@ define(['require'], function(require) { ...@@ -27,7 +27,8 @@ define(['require'], function(require) {
tabState: { tabState: {
stateChanged: false, stateChanged: false,
tagUrl: "#!/tag", tagUrl: "#!/tag",
searchUrl: "#!/search" searchUrl: "#!/search",
glossaryUrl: "#!/glossary"
}, },
detailPageState: {} detailPageState: {}
}; };
......
...@@ -46,7 +46,13 @@ define(['require'], function(require) { ...@@ -46,7 +46,13 @@ define(['require'], function(require) {
tag: { tag: {
addAttributeSuccessMessage: "Classification attribute is added successfully", addAttributeSuccessMessage: "Classification attribute is added successfully",
updateTagDescriptionMessage: "Classification description is updated successfully" updateTagDescriptionMessage: "Classification description is updated successfully"
},
glossary: {
removeTermfromCategory: "Remove Term Assignment",
removeTermfromEntity: "Remove Term Assignment",
removeCategoryfromTerm: "Remove Category Assignment"
} }
}; };
return Messages; return Messages;
}); });
\ No newline at end of file
...@@ -120,6 +120,51 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require ...@@ -120,6 +120,51 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
return saveSearchUrl; return saveSearchUrl;
} }
}, },
glossaryApiUrl: function(options) {
var guid = options && options.guid,
glossaryUrl = this.baseUrlV2 + '/glossary';
if (guid) {
return glossaryUrl + '/' + guid;
} else {
return glossaryUrl;
}
},
categoryApiUrl: function(options) {
var guid = options && options.guid,
list = options && options.list,
related = options && options.related,
categoryUrl = this.glossaryApiUrl() + '/' + (list ? 'categories' : 'category');
if (guid) {
if (related) {
return categoryUrl + '/' + guid + "/related";
} else {
return categoryUrl + '/' + guid;
}
} else {
return categoryUrl;
}
},
termApiUrl: function(options) {
var guid = options && options.guid,
list = options && options.list,
related = options && options.related,
termUrl = this.glossaryApiUrl() + '/' + (list ? 'terms' : 'term');
if (guid) {
if (related) {
return termUrl + '/' + guid + "/related";
} else {
return termUrl + '/' + guid;
}
} else {
return termUrl;
}
},
termToEntityApiUrl: function(guid) {
var termUrl = this.termApiUrl({ list: true });
if (guid) {
return termUrl + '/' + guid + '/assignedEntities';
}
},
versionApiUrl: function() { versionApiUrl: function() {
return this.baseUrl + '/admin/version'; return this.baseUrl + '/admin/version';
}, },
......
...@@ -283,6 +283,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -283,6 +283,8 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
urlUpdate['tagUrl'] = options.url; urlUpdate['tagUrl'] = options.url;
} else if (Utils.getUrlState.isSearchTab(options.url)) { } else if (Utils.getUrlState.isSearchTab(options.url)) {
urlUpdate['searchUrl'] = options.url; urlUpdate['searchUrl'] = options.url;
} else if (Utils.getUrlState.isGlossaryTab(options.url)) {
urlUpdate['glossaryUrl'] = options.url;
} }
$.extend(Globals.saveApplicationState.tabState, urlUpdate); $.extend(Globals.saveApplicationState.tabState, urlUpdate);
} }
...@@ -313,6 +315,9 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -313,6 +315,9 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
isSearchTab: function(url) { isSearchTab: function(url) {
return this.getQueryUrl(url).firstValue == "search"; return this.getQueryUrl(url).firstValue == "search";
}, },
isGlossaryTab: function(url) {
return this.getQueryUrl(url).firstValue == "glossary";
},
isDetailPage: function(url) { isDetailPage: function(url) {
return this.getQueryUrl(url).firstValue == "detailPage"; return this.getQueryUrl(url).firstValue == "detailPage";
}, },
......
...@@ -50,6 +50,7 @@ define(['require', ...@@ -50,6 +50,7 @@ define(['require',
/** ui selector cache */ /** ui selector cache */
ui: { ui: {
tagClick: '[data-id="tagClick"]', tagClick: '[data-id="tagClick"]',
termClick: '[data-id="termClick"]',
propagatedTagDiv: '[data-id="propagatedTagDiv"]', propagatedTagDiv: '[data-id="propagatedTagDiv"]',
title: '[data-id="title"]', title: '[data-id="title"]',
editButton: '[data-id="editButton"]', editButton: '[data-id="editButton"]',
...@@ -57,8 +58,11 @@ define(['require', ...@@ -57,8 +58,11 @@ define(['require',
description: '[data-id="description"]', description: '[data-id="description"]',
editBox: '[data-id="editBox"]', editBox: '[data-id="editBox"]',
deleteTag: '[data-id="deleteTag"]', deleteTag: '[data-id="deleteTag"]',
deleteTerm: '[data-id="deleteTerm"]',
addTag: '[data-id="addTag"]', addTag: '[data-id="addTag"]',
addTerm: '[data-id="addTerm"]',
tagList: '[data-id="tagList"]', tagList: '[data-id="tagList"]',
termList: '[data-id="termList"]',
propagatedTagList: '[data-id="propagatedTagList"]', propagatedTagList: '[data-id="propagatedTagList"]',
fullscreenPanel: "#fullscreen_panel", fullscreenPanel: "#fullscreen_panel",
tablist: '[data-id="tab-list"] li' tablist: '[data-id="tab-list"] li'
...@@ -81,7 +85,19 @@ define(['require', ...@@ -81,7 +85,19 @@ define(['require',
}); });
} }
}; };
events["click " + this.ui.termClick] = function(e) {
if (e.target.nodeName.toLocaleLowerCase() != "i") {
Utils.setUrl({
url: '#!/glossary/' + $(e.currentTarget).find('i').data('guid'),
mergeBrowserUrl: false,
urlParams: { gType: "term" },
trigger: true
});
}
};
events["click " + this.ui.addTerm] = 'onClickAddTermBtn';
events["click " + this.ui.deleteTag] = 'onClickTagCross'; events["click " + this.ui.deleteTag] = 'onClickTagCross';
events["click " + this.ui.deleteTerm] = 'onClickTermCross';
events["click " + this.ui.addTag] = 'onClickAddTagBtn'; events["click " + this.ui.addTag] = 'onClickAddTagBtn';
events["click " + this.ui.tablist] = function(e) { events["click " + this.ui.tablist] = function(e) {
var tabValue = $(e.currentTarget).attr('role'); var tabValue = $(e.currentTarget).attr('role');
...@@ -101,7 +117,7 @@ define(['require', ...@@ -101,7 +117,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'collection', 'id', 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection')); _.extend(this, _.pick(options, 'value', 'collection', 'id', 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'glossaryCollection'));
this.bindEvents(); this.bindEvents();
$('body').addClass("detail-page"); $('body').addClass("detail-page");
}, },
...@@ -156,6 +172,9 @@ define(['require', ...@@ -156,6 +172,9 @@ define(['require',
} else { } else {
this.generateTag([]); this.generateTag([]);
} }
if (collectionJSON.relationshipAttributes && collectionJSON.relationshipAttributes.meanings) {
this.generateTerm(collectionJSON.relationshipAttributes.meanings);
}
if (Globals.entityTypeConfList && _.isEmptyArray(Globals.entityTypeConfList)) { if (Globals.entityTypeConfList && _.isEmptyArray(Globals.entityTypeConfList)) {
this.ui.editButtonContainer.html(ButtonsTmpl({ btn_edit: true })); this.ui.editButtonContainer.html(ButtonsTmpl({ btn_edit: true }));
} else { } else {
...@@ -326,6 +345,30 @@ define(['require', ...@@ -326,6 +345,30 @@ define(['require',
} }
})); }));
}, },
onClickTermCross: function(e) {
var $el = $(e.currentTarget),
termGuid = $el.data('guid'),
termName = $el.text(),
that = this,
termObj = _.find(this.collection.first().get('entity').relationshipAttributes.meanings, { guid: termGuid });
CommonViewFunction.removeCategoryTermAssociation({
termGuid: termGuid,
model: {
guid: that.id,
relationshipGuid: termObj.relationshipGuid
},
collection: that.glossaryCollection,
msg: "<div class='ellipsis'>Remove: " + "<b>" + _.escape(termName) + "</b> assignment from" + " " + "<b>" + this.name + "?</b></div>",
titleMessage: Messages.glossary.removeTermfromEntity,
isEntityView: true,
buttonText: "Remove",
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
callback: function() {
that.fetchCollection();
}
});
},
generateTag: function(tagObject) { generateTag: function(tagObject) {
var that = this, var that = this,
tagData = "", tagData = "",
...@@ -338,7 +381,7 @@ define(['require', ...@@ -338,7 +381,7 @@ define(['require',
val.entityGuid === that.id ? tag['self'].push(val) : tag['propagated'].push(val); val.entityGuid === that.id ? tag['self'].push(val) : tag['propagated'].push(val);
}); });
_.each(tag.self, function(val) { _.each(tag.self, function(val) {
tagData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.typeName + ' data-id="tagClick"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="deleteTag" data-type="tag" title="Delete Tag"></i></span>'; tagData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.typeName + ' data-id="tagClick"><span>' + val.typeName + '</span><i class="fa fa-close" data-id="deleteTag" data-type="tag" title="Remove Tag"></i></span>';
}); });
_.each(tag.propagated, function(val) { _.each(tag.propagated, function(val) {
propagatedTagListData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.typeName + ' data-id="tagClick"><span>' + val.typeName + '</span></span>'; propagatedTagListData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.typeName + ' data-id="tagClick"><span>' + val.typeName + '</span></span>';
...@@ -350,6 +393,15 @@ define(['require', ...@@ -350,6 +393,15 @@ define(['require',
this.ui.propagatedTagList.html(propagatedTagListData); this.ui.propagatedTagList.html(propagatedTagListData);
}, },
generateTerm: function(data) {
var that = this,
termData = "";
_.each(data, function(val) {
termData += '<span class="btn btn-action btn-sm btn-icon btn-blue" title=' + val.displayText + ' data-id="termClick"><span>' + val.displayText + '</span><i class="fa fa-close" data-id="deleteTerm" data-guid="' + val.guid + '" data-type="term" title="Remove Term"></i></span>';
});
this.ui.termList.find("span.btn").remove();
this.ui.termList.prepend(termData);
},
hideLoader: function() { hideLoader: function() {
Utils.hideTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail')); Utils.hideTitleLoader(this.$('.page-title .fontLoader'), this.$('.entityDetail'));
}, },
...@@ -381,6 +433,23 @@ define(['require', ...@@ -381,6 +433,23 @@ define(['require',
}); });
}); });
}, },
onClickAddTermBtn: function(e) {
var that = this;
require(['views/glossary/AssignTermLayoutView'], function(AssignTermLayoutView) {
var view = new AssignTermLayoutView({
guid: that.id,
callback: function() {
that.fetchCollection();
},
showLoader: that.showLoader.bind(that),
hideLoader: that.hideLoader.bind(that),
glossaryCollection: that.glossaryCollection
});
view.modal.on('ok', function() {
Utils.showTitleLoader(that.$('.page-title .fontLoader'), that.$('.entityDetail'));
});
});
},
renderEntityDetailTableLayoutView: function(obj) { renderEntityDetailTableLayoutView: function(obj) {
var that = this; var that = this;
require(['views/entity/EntityDetailTableLayoutView'], function(EntityDetailTableLayoutView) { require(['views/entity/EntityDetailTableLayoutView'], function(EntityDetailTableLayoutView) {
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require',
'backbone',
'hbs!tmpl/glossary/AssignTermLayoutViewTmpl',
'utils/Utils',
'utils/UrlLinks',
'modules/Modal'
], function(require, Backbone, AssignTermLayoutViewTmpl, Utils, UrlLinks, Modal) {
var AssignTermLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends AssignTermLayoutView */
{
_viewName: 'AssignTermLayoutView',
template: AssignTermLayoutViewTmpl,
templateHelpers: function() {
return {};
},
/** Layout sub regions */
regions: {
RGlossaryTree: "#r_glossaryTree"
},
/** ui selector cache */
ui: {},
/** ui events hash */
events: function() {
var events = {};
return events;
},
/**
* intialize a new AssignTermLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'glossaryCollection', 'guid', 'callback', 'hideLoader', 'isCategoryView', 'categoryData', 'isTermView', 'termData'));
var that = this;
this.options = options;
if (!this.isCategoryView && !this.isTermView) {
this.isEntityView = true;
}
this.glossary = {
selectedItem: {}
}
var title = "";
if (this.isCategoryView || this.isEntityView) {
title = ("Assign term to " + (this.isCategoryView ? "Category" : "entity"))
} else {
title = "Assign Category to term";
}
this.modal = new Modal({
"title": title,
"content": this,
"cancelText": "Cancel",
"okCloses": false,
"okText": "Assign",
"allowCancel": true
});
this.modal.open();
this.modal.on('closeModal', function() {
that.modal.trigger('cancel');
if (that.assignTermError && that.hideLoader) {
that.hideLoader();
}
if (options.onModalClose) {
options.onModalClose()
}
});
this.modal.on('ok', function() {
that.assignTerm();
});
},
bindEvents: function() {},
onRender: function() {
this.renderGlossaryTree();
},
assignTerm: function() {
this.assignTermError = false;
var that = this,
data = [],
selectedItem = this.glossary.selectedItem,
selectedGuid = selectedItem.guid,
ajaxOptions = {
success: function(rModel, response) {
Utils.notifySuccess({
content: (that.isCategoryView ? "Term" : "Category") + " is associated successfully "
});
that.modal.trigger('closeModal');
if (that.callback) {
that.callback();
}
},
cust_error: function() {
that.assignTermError = true;
}
},
model = new this.glossaryCollection.model();
if (this.isCategoryView) {
data = _.extend({}, this.categoryData);
if (data.terms) {
data.terms.push({ "termGuid": selectedGuid });
} else {
data.terms = [{ "termGuid": selectedGuid }];
}
model.assignTermToCategory(_.extend(ajaxOptions, { data: JSON.stringify(data), guid: data.guid }));
} else if (this.isTermView) {
data = _.extend({}, this.termData);
if (data.categories) {
data.categories.push({ "categoryGuid": selectedGuid });
} else {
data.categories = [{ "categoryGuid": selectedGuid }];
}
model.assignCategoryToTerm(_.extend(ajaxOptions, { data: JSON.stringify(data), guid: data.guid }));
} else {
data.push({ "guid": that.guid });
model.assignTermToEntity(selectedGuid, _.extend(ajaxOptions, { data: JSON.stringify(data) }));
}
},
renderGlossaryTree: function() {
var that = this;
require(['views/glossary/GlossaryLayoutView'], function(GlossaryLayoutView) {
that.RGlossaryTree.show(new GlossaryLayoutView(_.extend({
"isAssignTermView": that.isCategoryView,
"isAssignCategoryView": that.isTermView,
"isAssignEntityView": that.isEntityView,
"glossary": that.glossary
}, that.options)));
});
},
});
return AssignTermLayoutView;
});
\ No newline at end of file
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require',
'backbone',
'hbs!tmpl/glossary/CreateEditCategoryTermLayoutView_tmpl',
'utils/Utils',
'utils/UrlLinks'
], function(require, Backbone, CreateEditCategoryTermLayoutViewTmpl, Utils, UrlLinks) {
var CreateEditCategoryTermLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends CreateEditCategoryTermLayoutView */
{
_viewName: 'CreateEditCategoryTermLayoutView',
template: CreateEditCategoryTermLayoutViewTmpl,
templateHelpers: function() {
return {
create: this.create,
modelJSON: this.modelJSON
};
},
/** Layout sub regions */
regions: {},
/** ui selector cache */
ui: {
"qualifiedName": "[data-id='qualifiedName']",
"displayName": "[data-id='displayName']",
"shortDescription": "[data-id='shortDescription']",
"longDescription": "[data-id='longDescription']",
"categoryTermForm": "[data-id='categoryTermForm']"
},
/** ui events hash */
events: function() {
var events = {};
return events;
},
/**
* intialize a new CreateEditCategoryTermLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'glossaryCollection', 'modelJSON'));
if (!this.modelJSON) {
this.create = true;
}
},
bindEvents: function() {},
onRender: function() {}
});
return CreateEditCategoryTermLayoutView;
});
\ No newline at end of file
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['require',
'backbone',
'hbs!tmpl/glossary/CreateEditGlossaryLayoutView_tmpl',
'utils/Utils',
'utils/UrlLinks'
], function(require, Backbone, CreateEditGlossaryLayoutViewTmpl, Utils, UrlLinks) {
var CreateEditGlossaryLayoutView = Backbone.Marionette.LayoutView.extend(
/** @lends CreateEditGlossaryLayoutView */
{
_viewName: 'CreateEditGlossaryLayoutView',
template: CreateEditGlossaryLayoutViewTmpl,
templateHelpers: function() {
return {
create: this.create
};
},
/** Layout sub regions */
regions: {},
/** ui selector cache */
ui: {
"qualifiedName": "[data-id='qualifiedName']",
"displayName": "[data-id='displayName']",
"shortDescription": "[data-id='shortDescription']",
"longDescription": "[data-id='longDescription']",
"glossaryForm": "[data-id='glossaryForm']"
},
/** ui events hash */
events: function() {
var events = {};
return events;
},
/**
* intialize a new CreateEditGlossaryLayoutView Layout
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'glossaryCollection', 'model'));
if (!this.model) {
this.create = true;
}
},
bindEvents: function() {},
onRender: function() {}
});
return CreateEditGlossaryLayoutView;
});
\ No newline at end of file
...@@ -174,12 +174,12 @@ define(['require', ...@@ -174,12 +174,12 @@ define(['require',
that.$('.multiSelectTag').hide(); that.$('.multiSelectTag').hide();
Utils.generatePopover({ Utils.generatePopover({
el: that.$('[data-id="showMoreLess"]'), el: that.$('[data-id="showMoreLess"]'),
contentClass: 'popover-tag', contentClass: 'popover-tag-term',
viewFixedPopover: true, viewFixedPopover: true,
popoverOptions: { popoverOptions: {
container: null, container: null,
content: function() { content: function() {
return $(this).find('.popup-tag').children().clone(); return $(this).find('.popup-tag-term').children().clone();
} }
} }
}); });
......
...@@ -36,8 +36,12 @@ define(['require', ...@@ -36,8 +36,12 @@ define(['require',
events['click ' + this.ui.backButton] = function() { events['click ' + this.ui.backButton] = function() {
var queryParams = Utils.getUrlState.getQueryParams(), var queryParams = Utils.getUrlState.getQueryParams(),
urlPath = "searchUrl"; urlPath = "searchUrl";
if (queryParams && queryParams.from && queryParams.from == "classification") { if (queryParams && queryParams.from) {
urlPath = "tagUrl"; if (queryParams.from == "classification") {
urlPath = "tagUrl";
} else if(queryParams.from == "glossary"){
urlPath = "glossaryUrl";
}
} }
Utils.setUrl({ Utils.setUrl({
url: Globals.saveApplicationState.tabState[urlPath], url: Globals.saveApplicationState.tabState[urlPath],
......
...@@ -29,14 +29,14 @@ define(['require', ...@@ -29,14 +29,14 @@ define(['require',
regions: { regions: {
RTagLayoutView: "#r_tagLayoutView", RTagLayoutView: "#r_tagLayoutView",
RSearchLayoutView: "#r_searchLayoutView" RSearchLayoutView: "#r_searchLayoutView",
RGlossaryLayoutView: "#r_glossaryLayoutView"
}, },
ui: { ui: {
tabs: '.tabs li a', tabs: '.tabs li a',
}, },
templateHelpers: function() { templateHelpers: function() {
return { return {
tabClass: this.tabClass,
apiBaseUrl: UrlLinks.apiBaseUrl apiBaseUrl: UrlLinks.apiBaseUrl
}; };
}, },
...@@ -60,11 +60,14 @@ define(['require', ...@@ -60,11 +60,14 @@ define(['require',
} }
} }
if (elementName.name == "tab-tag") { if (elementName.name == "tab-classification") {
urlString = tabStateUrls.tagUrl; //'#!/tag'; urlString = tabStateUrls.tagUrl; //'#!/tag';
} else if (elementName.name == "tab-search") { } else if (elementName.name == "tab-search") {
urlString = tabStateUrls.searchUrl; // '#!/search'; urlString = tabStateUrls.searchUrl; // '#!/search';
} else if (elementName.name == "tab-glossary") {
urlString = tabStateUrls.glossaryUrl; // '#!/glossary';
} }
Utils.setUrl({ Utils.setUrl({
url: urlString, url: urlString,
mergeBrowserUrl: false, mergeBrowserUrl: false,
...@@ -75,40 +78,35 @@ define(['require', ...@@ -75,40 +78,35 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'searchTableColumns', 'searchTableFilters')); this.options = options;
this.tabClass = "tab col-sm-6";
}, },
onRender: function() { onRender: function() {
this.renderTagLayoutView(); this.renderTagLayoutView();
this.renderSearchLayoutView(); this.renderSearchLayoutView();
this.renderGlossaryLayoutView();
this.selectTab(); this.selectTab();
}, },
renderTagLayoutView: function() { renderTagLayoutView: function() {
var that = this; var that = this;
require(['views/tag/TagLayoutView'], function(TagLayoutView) { require(['views/tag/TagLayoutView'], function(TagLayoutView) {
that.RTagLayoutView.show(new TagLayoutView({ that.RTagLayoutView.show(new TagLayoutView(
collection: that.classificationDefCollection, _.extend(that.options, {
tag: that.tag, "collection": that.options.classificationDefCollection
value: that.value, })
enumDefCollection: that.enumDefCollection, ));
typeHeaders: that.typeHeaders
}));
}); });
}, },
renderSearchLayoutView: function() { renderSearchLayoutView: function() {
var that = this; var that = this;
require(['views/search/SearchLayoutView'], function(SearchLayoutView) { require(['views/search/SearchLayoutView'], function(SearchLayoutView) {
that.RSearchLayoutView.show(new SearchLayoutView({ that.RSearchLayoutView.show(new SearchLayoutView(that.options));
value: that.value, });
searchVent: that.searchVent, },
typeHeaders: that.typeHeaders, renderGlossaryLayoutView: function() {
entityDefCollection: that.entityDefCollection, var that = this;
enumDefCollection: that.enumDefCollection, require(['views/glossary/GlossaryLayoutView'], function(GlossaryLayoutView) {
classificationDefCollection: that.classificationDefCollection, that.RGlossaryLayoutView.show(new GlossaryLayoutView(that.options));
searchTableColumns: that.searchTableColumns,
searchTableFilters: that.searchTableFilters
}));
}); });
}, },
selectTab: function() { selectTab: function() {
...@@ -121,12 +119,18 @@ define(['require', ...@@ -121,12 +119,18 @@ define(['require',
if (Utils.getUrlState.isSearchTab() || Utils.getUrlState.isInitial()) { if (Utils.getUrlState.isSearchTab() || Utils.getUrlState.isInitial()) {
activeTab({ "view": "search" }); activeTab({ "view": "search" });
} else if (Utils.getUrlState.isTagTab()) { } else if (Utils.getUrlState.isTagTab()) {
activeTab({ "view": "tag" }); activeTab({ "view": "classification" });
} else if (Utils.getUrlState.isGlossaryTab()) {
activeTab({ "view": "glossary" });
} else if (Utils.getUrlState.isDetailPage()) { } else if (Utils.getUrlState.isDetailPage()) {
var queryParams = Utils.getUrlState.getQueryParams(), var queryParams = Utils.getUrlState.getQueryParams(),
view = "search"; view = "search";
if (queryParams && queryParams.from && queryParams.from == "classification") { if (queryParams && queryParams.from) {
view = "tag"; if (queryParams.from == "classification") {
view = "tag";
} else if (queryParams.from == "glossary") {
view = "glossary";
}
} }
activeTab({ "view": view }); activeTab({ "view": view });
} }
......
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