You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/03/18 02:10:19 UTC
[1/2] incubator-atlas git commit: ATLAS-1469: updated UI to send null
tag attribute value when no input is provided
Repository: incubator-atlas
Updated Branches:
refs/heads/0.8-incubating 909ec7a67 -> 298fdb9d2
ATLAS-1469: updated UI to send null tag attribute value when no input is provided
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/31320f72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/31320f72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/31320f72
Branch: refs/heads/0.8-incubating
Commit: 31320f727246e8acee705fc9d6d927e06d636e07
Parents: 909ec7a
Author: kevalbhatt <kb...@apache.org>
Authored: Thu Mar 16 12:55:15 2017 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Fri Mar 17 19:03:12 2017 -0700
----------------------------------------------------------------------
dashboardv2/public/css/scss/graph.scss | 12 ++++++++++++
.../detail_page/DetailPageLayoutView_tmpl.html | 2 +-
.../js/templates/graph/LineageLayoutView_tmpl.html | 4 ++++
dashboardv2/public/js/views/tag/addTagModalView.js | 2 +-
4 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/31320f72/dashboardv2/public/css/scss/graph.scss
----------------------------------------------------------------------
diff --git a/dashboardv2/public/css/scss/graph.scss b/dashboardv2/public/css/scss/graph.scss
index aec7ce0..38ddb47 100644
--- a/dashboardv2/public/css/scss/graph.scss
+++ b/dashboardv2/public/css/scss/graph.scss
@@ -45,6 +45,18 @@
.label {
fill: $color_suva_gray_approx;
}
+ image {
+ &.nodeImage {
+ -moz-transition: all 0.3s;
+ -webkit-transition: all 0.3s;
+ transition: all 0.3s;
+ &:hover {
+ -moz-transform: scale(1.4);
+ -webkit-transform: scale(1.4);
+ transform: scale(1.4);
+ }
+ }
+ }
}
.overlay {}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/31320f72/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
index 6ff10f9..3c04cb0 100644
--- a/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
@@ -49,7 +49,7 @@
<div class="atlast-tabbable">
<h4 class="lineageLabel">LINEAGE</h4>
<div class="panel panel-default lineageLayout">
- <div id="r_lineageLayoutView" style="height:385px">
+ <div id="r_lineageLayoutView" style="height:405px">
<div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/31320f72/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html b/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html
index f67e811..ec01f3f 100644
--- a/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html
@@ -22,6 +22,10 @@
<i class="fa fa-refresh fa-spin-custom"></i>
</div>
<svg width=100% height=350></svg>
+ <div class="legends">
+ <i class="fa fa-long-arrow-right" aria-hidden="true" style="margin-right: 12px; color:#8bc152;"> <span>Lineage</span></i>
+ <i class="fa fa-long-arrow-right" aria-hidden="true" style="color:#fb4200;"> <span>Impact</span></i>
+ </div>
<div class="zoomButtonGroup">
<button type="button" class="zoomButton" id="zoom_in">+</button>
<button type="button" class="zoomButton" id="zoom_out">-</button>
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/31320f72/dashboardv2/public/js/views/tag/addTagModalView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js
index cda5cf6..8beec4b 100644
--- a/dashboardv2/public/js/views/tag/addTagModalView.js
+++ b/dashboardv2/public/js/views/tag/addTagModalView.js
@@ -66,7 +66,7 @@ define(['require',
var tagAttributeNames = this.$(".attrName");
tagAttributeNames.each(function(i, item) {
var selection = $(item).data("key");
- tagAttributes[selection] = $(item).val();
+ tagAttributes[selection] = $(item).val() || null;
});
var obj = {
tagName: tagName,
[2/2] incubator-atlas git commit: ATLAS-1659: fix to update full-text
search string when traits/tags are added/removed from entity
Posted by ma...@apache.org.
ATLAS-1659: fix to update full-text search string when traits/tags are added/removed from entity
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/298fdb9d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/298fdb9d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/298fdb9d
Branch: refs/heads/0.8-incubating
Commit: 298fdb9d2e14227676da7448bdb5d54a1a6a1db6
Parents: 31320f7
Author: apoorvnaik <an...@hortonworks.com>
Authored: Wed Mar 8 14:06:09 2017 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Fri Mar 17 19:04:01 2017 -0700
----------------------------------------------------------------------
.../repository/graph/FullTextMapperV2.java | 57 ++++++++++++++++----
.../graph/v1/AtlasEntityChangeNotifier.java | 42 ++++++++++++++-
2 files changed, 88 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/298fdb9d/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java b/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
index e029c39..a60ef9e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
@@ -54,7 +54,7 @@ public class FullTextMapperV2 {
@Inject
public FullTextMapperV2(AtlasTypeRegistry typeRegistry) {
- this.entityGraphRetriever = new EntityGraphRetriever(typeRegistry);
+ entityGraphRetriever = new EntityGraphRetriever(typeRegistry);
Configuration configuration = null;
@@ -69,23 +69,42 @@ public class FullTextMapperV2 {
}
}
- public String map(String guid) throws AtlasBaseException {
+ /**
+ * Map newly associated/defined classifications for the entity with given GUID
+ * @param guid Entity guid
+ * @param classifications new classifications added to the entity
+ * @return Full text string ONLY for the added classifications
+ * @throws AtlasBaseException
+ */
+ public String getIndexTextForClassifications(String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
String ret = null;
- RequestContext context = RequestContext.get();
- AtlasEntityWithExtInfo entity = context.getInstanceV2(guid);
+ AtlasEntityWithExtInfo entityWithExtInfo = getAndCacheEntity(guid);
- if (entity == null) {
- entity = entityGraphRetriever.toAtlasEntityWithExtInfo(guid);
+ if (entityWithExtInfo != null) {
+ StringBuilder sb = new StringBuilder();
- if (entity != null) {
- context.cache(entity);
+ if (CollectionUtils.isNotEmpty(classifications)) {
+ for (AtlasClassification classification : classifications) {
+ sb.append(classification.getTypeName()).append(FULL_TEXT_DELIMITER);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Cache miss -> GUID = {}", guid);
+ mapAttributes(classification.getAttributes(), entityWithExtInfo, sb, new HashSet<String>());
}
}
+
+ ret = sb.toString();
}
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("FullTextMapperV2.map({}): {}", guid, ret);
+ }
+
+ return ret;
+ }
+
+ public String getIndexTextForEntity(String guid) throws AtlasBaseException {
+ String ret = null;
+ AtlasEntityWithExtInfo entity = getAndCacheEntity(guid);
+
if (entity != null) {
StringBuilder sb = new StringBuilder();
@@ -179,4 +198,22 @@ public class FullTextMapperV2 {
sb.append(String.valueOf(value)).append(FULL_TEXT_DELIMITER);
}
}
+
+ private AtlasEntityWithExtInfo getAndCacheEntity(String guid) throws AtlasBaseException {
+ RequestContext context = RequestContext.get();
+ AtlasEntityWithExtInfo entityWithExtInfo = context.getInstanceV2(guid);
+
+ if (entityWithExtInfo == null) {
+ entityWithExtInfo = entityGraphRetriever.toAtlasEntityWithExtInfo(guid);
+
+ if (entityWithExtInfo != null) {
+ context.cache(entityWithExtInfo);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Cache miss -> GUID = {}", guid);
+ }
+ }
+ }
+ return entityWithExtInfo;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/298fdb9d/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
index 41674fe..8719cd4 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
@@ -41,6 +41,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -85,6 +86,10 @@ public class AtlasEntityChangeNotifier {
}
public void onClassificationAddedToEntity(String entityId, List<AtlasClassification> classifications) throws AtlasBaseException {
+ // Only new classifications need to be used for a partial full text string which can be
+ // appended to the existing fullText
+ updateFullTextMapping(entityId, classifications);
+
ITypedReferenceableInstance entity = toITypedReferenceable(entityId);
List<ITypedStruct> traits = toITypedStructs(classifications);
@@ -102,6 +107,9 @@ public class AtlasEntityChangeNotifier {
}
public void onClassificationDeletedFromEntity(String entityId, List<String> traitNames) throws AtlasBaseException {
+ // Since the entity has already been modified in the graph, we need to recursively remap the entity
+ doFullTextMapping(entityId);
+
ITypedReferenceableInstance entity = toITypedReferenceable(entityId);
if (entity == null || CollectionUtils.isEmpty(traitNames)) {
@@ -202,7 +210,7 @@ public class AtlasEntityChangeNotifier {
}
try {
- String fullText = fullTextMapperV2.map(guid);
+ String fullText = fullTextMapperV2.getIndexTextForEntity(guid);
GraphHelper.setProperty(atlasVertex, Constants.ENTITY_TEXT_PROPERTY_KEY, fullText);
} catch (AtlasBaseException e) {
@@ -210,4 +218,36 @@ public class AtlasEntityChangeNotifier {
}
}
}
+
+ private void updateFullTextMapping(String entityId, List<AtlasClassification> classifications) {
+ try {
+ if(!AtlasRepositoryConfiguration.isFullTextSearchEnabled()) {
+ return;
+ }
+ } catch (AtlasException e) {
+ LOG.warn("Unable to determine if FullText is disabled. Proceeding with FullText mapping");
+ }
+
+ if (StringUtils.isEmpty(entityId) || CollectionUtils.isEmpty(classifications)) {
+ return;
+ }
+ AtlasVertex atlasVertex = AtlasGraphUtilsV1.findByGuid(entityId);
+
+ try {
+ String classificationFullText = fullTextMapperV2.getIndexTextForClassifications(entityId, classifications);
+ String existingFullText = (String) GraphHelper.getProperty(atlasVertex, Constants.ENTITY_TEXT_PROPERTY_KEY);
+
+ String newFullText = existingFullText + " " + classificationFullText;
+ GraphHelper.setProperty(atlasVertex, Constants.ENTITY_TEXT_PROPERTY_KEY, newFullText);
+ } catch (AtlasBaseException e) {
+ LOG.error("FullText mapping failed for Vertex[ guid = {} ]", entityId, e);
+ }
+ }
+
+ private void doFullTextMapping(String guid) {
+ AtlasEntityHeader entityHeader = new AtlasEntityHeader();
+ entityHeader.setGuid(guid);
+
+ doFullTextMapping(Collections.singletonList(entityHeader));
+ }
}
\ No newline at end of file