Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheus.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheus.js
Commits
8197216c
Commit
8197216c
authored
Jul 29, 2016
by
jgould
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bold matches
parent
0673ed52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
src/matrix/metadata_util.js
src/matrix/metadata_util.js
+7
-4
No files found.
src/matrix/metadata_util.js
View file @
8197216c
...
@@ -162,6 +162,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
...
@@ -162,6 +162,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
// check for term:searchText
// check for term:searchText
var
matches
=
[];
var
matches
=
[];
var
regex
=
null
;
var
regex
=
null
;
var
regexMatch
=
null
;
var
searchModel
=
model
;
var
searchModel
=
model
;
var
token
=
tokens
!=
null
&&
tokens
.
length
>
0
?
tokens
[
tokens
.
selectionStartIndex
]
var
token
=
tokens
!=
null
&&
tokens
.
length
>
0
?
tokens
[
tokens
.
selectionStartIndex
]
:
''
;
:
''
;
...
@@ -192,7 +193,8 @@ morpheus.MetadataUtil.autocomplete = function (model) {
...
@@ -192,7 +193,8 @@ morpheus.MetadataUtil.autocomplete = function (model) {
var
set
=
new
morpheus
.
Set
();
var
set
=
new
morpheus
.
Set
();
// regex used to determine if a string starts with substring `q`
// regex used to determine if a string starts with substring `q`
regex
=
new
RegExp
(
'
^
'
+
morpheus
.
Util
.
escapeRegex
(
token
),
'
i
'
);
regex
=
new
RegExp
(
morpheus
.
Util
.
escapeRegex
(
token
),
'
i
'
);
regexMatch
=
new
RegExp
(
'
(
'
+
morpheus
.
Util
.
escapeRegex
(
token
)
+
'
)
'
,
'
i
'
);
// iterate through the pool of strings and for any string that
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
// contains the substring `q`, add it to the `matches` array
var
max
=
10
;
var
max
=
10
;
...
@@ -259,7 +261,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
...
@@ -259,7 +261,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
value
:
quotedField
+
'
:
'
+
quotedValue
,
value
:
quotedField
+
'
:
'
+
quotedValue
,
label
:
'
<span style="font-weight:300;">
'
+
field
label
:
'
<span style="font-weight:300;">
'
+
field
+
'
:</span>
'
+
'
:</span>
'
+
'
<span
style="font-weight:900;">
'
+
val
+
'
<span
>
'
+
val
.
replace
(
regexMatch
,
'
<b>$1</b>
'
)
+
'
</span>
'
+
'
</span>
'
});
});
...
@@ -272,6 +274,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
...
@@ -272,6 +274,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
if
(
regex
==
null
)
{
if
(
regex
==
null
)
{
regex
=
new
RegExp
(
'
.*
'
,
'
i
'
);
regex
=
new
RegExp
(
'
.*
'
,
'
i
'
);
}
}
for
(
var
j
=
0
;
j
<
searchModel
.
getMetadataCount
();
j
++
)
{
for
(
var
j
=
0
;
j
<
searchModel
.
getMetadataCount
();
j
++
)
{
var
v
=
searchModel
.
get
(
j
);
var
v
=
searchModel
.
get
(
j
);
var
dataType
=
morpheus
.
VectorUtil
.
getDataType
(
v
);
var
dataType
=
morpheus
.
VectorUtil
.
getDataType
(
v
);
...
@@ -285,7 +288,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
...
@@ -285,7 +288,7 @@ morpheus.MetadataUtil.autocomplete = function (model) {
}
}
matches
.
push
({
matches
.
push
({
value
:
quotedField
+
'
:
'
,
value
:
quotedField
+
'
:
'
,
label
:
'
<span style="font-weight:300;">
'
+
field
label
:
'
<span style="font-weight:300;">
'
+
(
regexMatch
==
null
?
field
:
field
.
replace
(
regexMatch
,
'
<b>$1</b>
'
))
+
'
:</span>
'
,
+
'
:</span>
'
,
show
:
true
show
:
true
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment