Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,23 @@ export function catalogSelectorSearchFilter() {
let fieldNum = 0;
return found &&
FIELDS_TO_SEARCH.reduce((match, field) => {
if (match) return true;
if (match) {
return true;
}
fieldNum++;
if (!item.hasOwnProperty(field) || !item[field]) return false;
if (!item.hasOwnProperty(field) || !item[field]) {
return false;
}
let text = item[field];
if (!text.toLowerCase) {
text = JSON.stringify(text).toLowerCase();
} else {
text = text.toLowerCase();
}
let index = text.indexOf(part);
if (index == -1) return false;
if (index == -1) {
return false;
}
// found, set relevance -- uses an ad hoc heuristic preferring first fields and short text length,
// earlier occurrences and earlier words weighted more highly (smaller number is better)
let score = fieldNum * (2 / (1 + wordNum)) * Math.log(1 + text.length * index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
*/
import angular from 'angular';
import {Entity} from "../util/model/entity.model";
import {D3Blueprint} from "../util/d3-blueprint";
import {D3BlueprintMgmtView} from "../util/d3-blueprint-mgmt-view";
import {D3BlueprintLandscapeView} from "../util/d3-blueprint-landscape-view";
import {EntityFamily} from '../util/model/entity.model';
import {graphicalEditEntityState} from '../../views/main/graphical/edit/entity/edit.entity.controller';
import {graphicalEditSpecState} from '../../views/main/graphical/edit/spec/edit.spec.controller';
Expand All @@ -43,13 +44,15 @@ export function designerDirective($log, $state, $q, iconGenerator, catalogApi, b
return tAttrs.templateUrl || TEMPLATE_URL;
},
scope: {
mode: '@?',
onSelectionChange: '<?'
},
link: link
};

function link($scope, $element) {
let blueprintGraph = new D3Blueprint($element[0]).center();
let blueprintGraph = $scope.mode=='landscape' ? new D3BlueprintLandscapeView($element[0]) : new D3BlueprintMgmtView($element[0]);
blueprintGraph.center();

$scope.blueprint = blueprintService.get();
$scope.$watch('blueprint', ()=> {
Expand Down
Loading