Skip to content

Commit

Permalink
ATLAS-4686 : UI improvements to support Atlas Relationship Search
Browse files Browse the repository at this point in the history
Signed-off-by: Pinal Shah <[email protected]>
(cherry picked from commit cb0bde4)
  • Loading branch information
farhank31 authored and pinal-shah committed Oct 20, 2022
1 parent 2818699 commit 88b2815
Show file tree
Hide file tree
Showing 67 changed files with 4,730 additions and 147 deletions.
4 changes: 4 additions & 0 deletions dashboardv2/public/css/scss/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
font-weight: bold;
}
}

.relationship-detailpage-panel {
width: 58% !important;
}
}

pre {
Expand Down
41 changes: 39 additions & 2 deletions dashboardv2/public/css/scss/override.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
/* override.scss */

.tabs li.tab.active {
border-bottom: 2px solid $color_keppel_approx;
border-bottom: 2px solid $white;

a {
color: $color_keppel_approx;
color: $white;
}
}

Expand Down Expand Up @@ -622,4 +622,41 @@ div.columnmanager-dropdown-container {
ul {
list-style: disc
}
}

#r_searchLayoutView {
.nav-tabs {
border-bottom: 1px solid #38bb9b;

li {
text-align: center;
width: 50%;
font-size: 14px;

a:hover {
background-color: transparent !important;
border-color: transparent !important;
border: 1px solid #38bb9b !important;
}

a {
color: #38bb9b;
}
}

& li:first-child {
margin-left: 0px;
}

li.active>a {
background-color: transparent !important;
border-bottom-color: #323544 !important;
border: 1px solid #38bb9b;
color: #fff;
}

li.active>a:hover {
background-color: #323544 !important;
}
}
}
2 changes: 1 addition & 1 deletion dashboardv2/public/css/scss/tab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ul.tabs li.tab {
a {
font-size: 14px;
font-weight: 600;
color: $white;
color: $color_keppel_approx;
display: block;
text-decoration: none;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion dashboardv2/public/css/scss/tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
border-color: $color_bali_hai_approx;
}

.entityLink {
.entityLink, .relationLink {
font-size: 16px;
}

Expand Down
58 changes: 58 additions & 0 deletions dashboardv2/public/js/collection/VRelationshipSearchList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* 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',
'collection/BaseCollection',
'models/VRelationshipSearch',
'utils/UrlLinks'
], function(require, BaseCollection, VRelationshipSearch, UrlLinks) {
'use strict';
var VRelationshipSearchList = BaseCollection.extend(
//Prototypal attributes
{
url: UrlLinks.baseURL,

model: VRelationshipSearch,

initialize: function() {
this.modelName = 'VRelationshipSearch';
this.modelAttrName = 'results';
},
getRelationship: function(id, options) {
var url = UrlLinks.relationshipApiUrl(id);

options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);

return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
}
},
//Static Class Members
{
/**
* Table Cols to be passed to Backgrid
* UI has to use this as base and extend this.
*
*/
tableCols: {}
}
);
return VRelationshipSearchList;
});
87 changes: 87 additions & 0 deletions dashboardv2/public/js/collection/VRelationshipSearchResultList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* 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',
'collection/BaseCollection',
'models/VRelationSearch',
'utils/UrlLinks'
], function(require, BaseCollection, VRelationSearch, UrlLinks) {
'use strict';
var VRelationshipSearchResultList = BaseCollection.extend(
//Prototypal attributes
{
url: UrlLinks.relationshipSearchApiUrl(),

model: VRelationSearch,

initialize: function(options) {
_.extend(this, options);
this.modelName = 'VRelationshipSearchResultList';
this.modelAttrName = '';
this.dynamicTable = false;
},
parseRecords: function(resp, options) {
this.queryType = resp.queryType;
this.queryText = resp.queryText;
this.referredEntities = resp.referredEntities;
if (resp.attributes) {
this.dynamicTable = true;
var entities = [];
_.each(resp.attributes.values, function(obj) {
var temp = {};
_.each(obj, function(val, index) {
var key = resp.attributes.name[index];
if (key == "__guid") {
key = "guid"
}
temp[key] = val;
});
entities.push(temp);
});
return entities;
} else if (resp.entities) {
this.dynamicTable = false;
return resp.entities ? resp.entities : [];
} else {
return [];
}
},
getBasicRearchResult: function(options) {
var url = UrlLinks.relationshipSearchApiUrl('basic');

options = _.extend({
contentType: 'application/json',
dataType: 'json',
}, options);
options.data = JSON.stringify(options.data);

return this.constructor.nonCrudOperation.call(this, url, 'POST', options);
}
},
//Static Class Members
{
/**
* Table Cols to be passed to Backgrid
* UI has to use this as base and extend this.
*
*/
tableCols: {}
}
);
return VRelationshipSearchResultList;
});
22 changes: 20 additions & 2 deletions dashboardv2/public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,14 @@ require(['App',
'utils/UrlLinks',
'collection/VEntityList',
'collection/VTagList',
'collection/VRelationshipSearchList',
'utils/Enums',
'utils/Utils',
'utils/Overrides',
'bootstrap',
'd3',
'select2'
], function(App, Router, Helper, CommonViewFunction, Globals, UrlLinks, VEntityList, VTagList, Enums, Utils) {
], function(App, Router, Helper, CommonViewFunction, Globals, UrlLinks, VEntityList, VTagList, VRelationshipSearchList, Enums, Utils) {
var that = this;
this.asyncFetchCounter = 5 + (Enums.addOnEntities.length + 1);
// entity
Expand All @@ -238,6 +239,11 @@ require(['App',
this.businessMetadataDefCollection = new VEntityList();
this.businessMetadataDefCollection.url = UrlLinks.businessMetadataDefApiUrl();
this.businessMetadataDefCollection.modelAttrName = "businessMetadataDefs";
//relationship
this.relationshipDefCollection = new VRelationshipSearchList();
this.relationshipDefCollection.url = UrlLinks.relationshipDefApiUrl();
this.relationshipDefCollection.modelAttrName = "relationshipDefs";
this.relationshipEventAgg = new Backbone.Wreqr.EventAggregator();

App.appRouter = new Router({
entityDefCollection: this.entityDefCollection,
Expand All @@ -246,7 +252,9 @@ require(['App',
classificationDefCollection: this.classificationDefCollection,
metricCollection: this.metricCollection,
classificationAndMetricEvent: this.classificationAndMetricEvent,
businessMetadataDefCollection: this.businessMetadataDefCollection
businessMetadataDefCollection: this.businessMetadataDefCollection,
relationshipDefCollection: this.relationshipDefCollection,
relationshipEventAgg: this.relationshipEventAgg
});

var startApp = function() {
Expand Down Expand Up @@ -387,6 +395,16 @@ require(['App',
startApp();
}
});
this.relationshipDefCollection.fetch({
async: true,
complete: function() {
that.relationshipDefCollection.fullCollection.comparator = function(model) {
return model.get('name').toLowerCase();
};
that.relationshipDefCollection.fullCollection.sort({ silent: true });
that.relationshipEventAgg.trigger("Relationship:Update");
}
});
CommonViewFunction.fetchRootEntityAttributes({
url: UrlLinks.rootEntityDefUrl(Enums.addOnEntities[0]),
entity: Enums.addOnEntities,
Expand Down
54 changes: 54 additions & 0 deletions dashboardv2/public/js/models/VRelationSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* 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',
'models/BaseModel',
'utils/UrlLinks'
], function(require, VBaseModel, UrlLinks) {
'use strict';
var VRelationSearch = VBaseModel.extend({
urlRoot: UrlLinks.relationshipSearchApiUrl(),

defaults: {},

serverSchema: {},

idAttribute: 'id',

initialize: function() {
this.modelName = 'VRelationSearch';
},
toString: function() {
return this.get('name');
},
/*************************
* Non - CRUD operations
*************************/
getEntity: function(id, options) {
var url = UrlLinks.relationApiUrl({ guid: id });

options = _.extend({
contentType: 'application/json',
dataType: 'json'
}, options);

return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
}
}, {});
return VRelationSearch;
});
Loading

0 comments on commit 88b2815

Please sign in to comment.