Skip to content

Commit

Permalink
[Graph] Remove inferred edges leftover code (#50006)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Nov 11, 2019
1 parent 0491589 commit cbad2be
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,18 +894,13 @@ module.exports = (function () {
existingEdge.doc_count = Math.max(existingEdge.doc_count, edge.doc_count);
continue;
}
// Inferred edges were a feature that used Levenshtein edit distance on node labels
// to determine connections - removed that feature but may bring back.

const inferred = edge.inferred ? true : false;
const newEdge = {
'source': srcWrapperObj,
'target': targetWrapperObj,
'weight': edge.weight,
'width': edge.width,
'id': edge.id,
'doc_count': edge.doc_count,
'inferred': inferred
};
if (edge.label) {
newEdge.label = edge.label;
Expand Down
55 changes: 0 additions & 55 deletions x-pack/legacy/plugins/graph/public/angular/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,61 +377,6 @@
} }}"
>{{mc.v2}}</small>
</div>



<div class="gphSidebar__panel" ng-if="(detail.inferredEdge)">
<div class="gphSidebar__header">
<span class="kuiIcon fa-cog"></span>
{{ ::'xpack.graph.sidebar.similarLabelsTitle' | i18n: { defaultMessage: 'Similar labels' } }}
</div>

<div class="form-group form-group-sm gphFormGroup--small">
<div style="line-height: 24px;">
<button
tooltip="{{ ::'xpack.graph.sidebar.similarLabels.mergeTargetToSrcButtonTooltip' | i18n: {
defaultMessage: 'Merge {targetLabel} into {srcLabel}',
values: { targetLabel: detail.inferredEdge.topTarget.label, srcLabel: detail.inferredEdge.topSrc.label },
} }}"
type="button" style="vertical-align: top;" class="kuiButton kuiButton--basic kuiButton--small"
ng-click="performMerge(detail.inferredEdge.topTarget.id, detail.inferredEdge.topSrc.id)">
<span class="kui fa-chevron-circle-down"></span>
</button>
<svg width="24" height="24">
<circle class="gphNode__circle " r="10" cx="12" cy="12" ng-attr-style="fill:{{detail.inferredEdge.topSrc.color}}" />

<text ng-if="detail.inferredEdge.topSrc.icon" class="fa gphNode__text" text-anchor="middle" x="12" y="16">{{detail.inferredEdge.topSrc.icon.code}}</text>
</svg>
<span style="vertical-align: top;">{{detail.inferredEdge.topSrc.label}}</span>
</div>
<div style="line-height: 24px;">
<button
tooltip="{{ ::'xpack.graph.sidebar.similarLabels.mergeSrcToTargetButtonTooltip' | i18n: {
defaultMessage: 'Merge {srcLabel} into {targetLabel}',
values: { targetLabel: detail.inferredEdge.topTarget.label, srcLabel: detail.inferredEdge.topSrc.label },
} }}"
type="button" style="vertical-align: top;" class="kuiButton kuiButton--basic kuiButton--small"
ng-click="performMerge(detail.inferredEdge.topSrc.id, detail.inferredEdge.topTarget.id)">
<span class="kuiIcon fa-chevron-circle-up"></span>
</button>

<svg width="24" height="24">
<circle class="gphNode__circle " r="10" cx="12" cy="12" ng-attr-style="fill:{{detail.inferredEdge.topTarget.color}}" />

<text ng-if="detail.inferredEdge.topTarget.icon" class="fa gphNode__text" text-anchor="middle" x="12" y="16">{{detail.inferredEdge.topTarget.icon.code}}</text>
</svg>
<span style="vertical-align: top;">{{detail.inferredEdge.topTarget.label}}</span>

</div>

<div
class="col-sm-10"
i18n-id="xpack.graph.sidebar.similarLabels.keyTermsText"
i18n-default-message="Key terms: {inferredEdgeLabel}"
i18n-values="{ html_inferredEdgeLabel: '<small>' + detail.inferredEdge.label + '</small>' }"
></div>
</div>
</div>
</div>
<!-- end edge-merge detail panel -->

Expand Down
6 changes: 1 addition & 5 deletions x-pack/legacy/plugins/graph/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,7 @@ export function initGraphApp(angularModule, deps) {
};

$scope.clickEdge = function (edge) {
if (edge.inferred) {
$scope.setDetail ({ 'inferredEdge': edge });
}else {
$scope.workspace.getAllIntersections($scope.handleMergeCandidatesCallback, [edge.topSrc, edge.topTarget]);
}
$scope.workspace.getAllIntersections($scope.handleMergeCandidatesCallback, [edge.topSrc, edge.topTarget]);
};

$scope.submit = function (searchTerm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
stroke: $euiColorDarkShade;
stroke-opacity: 0.95;
}

&--inferred {
stroke-dasharray: 5, 5;
}
}

.gphNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ describe('graph_visualization', () => {
];
const edges: GroupAwareWorkspaceEdge[] = [
{
inferred: false,
isSelected: true,
label: '',
topSrc: nodes[0],
Expand All @@ -91,7 +90,6 @@ describe('graph_visualization', () => {
width: 2,
},
{
inferred: false,
isSelected: true,
label: '',
topSrc: nodes[1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export function GraphVisualization({
}}
className={classNames('gphEdge', {
'gphEdge--selected': edge.isSelected,
'gphEdge--inferred': edge.inferred,
})}
style={{ strokeWidth: edge.width }}
strokeLinecap="round"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ describe('deserialize', () => {
},
],
links: [
{ inferred: false, label: '', weight: 5, width: 5, source: 2, target: 0 },
{ inferred: false, label: '', weight: 5, width: 5, source: 2, target: 4 },
{ label: '', weight: 5, width: 5, source: 2, target: 0 },
{ label: '', weight: 5, width: 5, source: 2, target: 4 },
],
urlTemplates: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ describe('serialize', () => {

// A <-> C
appState.workspace.edges.push({
inferred: false,
label: '',
source: appState.workspace.nodes[2],
target: appState.workspace.nodes[0],
Expand All @@ -148,7 +147,6 @@ describe('serialize', () => {

// C <-> E
appState.workspace.edges.push({
inferred: false,
label: '',
source: appState.workspace.nodes[2],
target: appState.workspace.nodes[4],
Expand Down Expand Up @@ -187,15 +185,13 @@ describe('serialize', () => {
"indexPattern": "Testindexpattern",
"links": Array [
Object {
"inferred": false,
"label": "",
"source": 2,
"target": 0,
"weight": 5,
"width": 5,
},
Object {
"inferred": false,
"label": "",
"source": 2,
"target": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ function serializeNode(
}

function serializeEdge(
{ source, target, weight, width, inferred, label }: WorkspaceEdge,
{ source, target, weight, width, label }: WorkspaceEdge,
allNodes: WorkspaceNode[] = []
): SerializedEdge {
return {
weight,
width,
inferred,
label,
source: allNodes.indexOf(source),
target: allNodes.indexOf(target),
Expand Down
2 changes: 0 additions & 2 deletions x-pack/legacy/plugins/graph/public/types/workspace_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export interface WorkspaceNode {
export interface WorkspaceEdge {
weight: number;
width: number;
inferred: boolean;
label: string;
source: WorkspaceNode;
target: WorkspaceNode;
Expand All @@ -60,7 +59,6 @@ export interface ServerResultEdge {
weight: number;
width: number;
doc_count?: number;
inferred: boolean;
}

export interface GraphData {
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -4314,10 +4314,6 @@
"xpack.graph.sidebar.selections.selectNoneButtonLabel": "なし",
"xpack.graph.sidebar.selections.selectNoneButtonTooltip": "どれも選択しません",
"xpack.graph.sidebar.selectionsTitle": "選択項目",
"xpack.graph.sidebar.similarLabels.keyTermsText": "キー用語: {inferredEdgeLabel}",
"xpack.graph.sidebar.similarLabels.mergeSrcToTargetButtonTooltip": "{srcLabel} を {targetLabel} に結合します",
"xpack.graph.sidebar.similarLabels.mergeTargetToSrcButtonTooltip": "{targetLabel} を {srcLabel} に結合します",
"xpack.graph.sidebar.similarLabelsTitle": "類似ラベル",
"xpack.graph.sidebar.styleVerticesTitle": "スタイルが選択された頂点",
"xpack.graph.sidebar.topMenu.addLinksButtonTooltip": "既存の用語の間にリンクを追加します",
"xpack.graph.sidebar.topMenu.blacklistButtonTooltip": "選択項目がワークスペースに戻らないようブラックリストに追加します",
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -4315,10 +4315,6 @@
"xpack.graph.sidebar.selections.selectNoneButtonLabel": "无",
"xpack.graph.sidebar.selections.selectNoneButtonTooltip": "不选择任何内容",
"xpack.graph.sidebar.selectionsTitle": "选择的内容",
"xpack.graph.sidebar.similarLabels.keyTermsText": "关键字词:{inferredEdgeLabel}",
"xpack.graph.sidebar.similarLabels.mergeSrcToTargetButtonTooltip": "将 {srcLabel} 合并到 {targetLabel}",
"xpack.graph.sidebar.similarLabels.mergeTargetToSrcButtonTooltip": "将 {targetLabel} 合并到 {srcLabel}",
"xpack.graph.sidebar.similarLabelsTitle": "类似标签",
"xpack.graph.sidebar.styleVerticesTitle": "样式选择的顶点",
"xpack.graph.sidebar.topMenu.addLinksButtonTooltip": "在现有字词之间添加链接",
"xpack.graph.sidebar.topMenu.blacklistButtonTooltip": "返回工作空间时选择的黑名单",
Expand Down

0 comments on commit cbad2be

Please sign in to comment.