Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
5c9cb781
Commit
5c9cb781
authored
Mar 26, 2020
by
kevalbhatt
Committed by
nixonrodrigues
Mar 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3686 : UI : Allows user to add search weight in business-metadata for suggestion API.
Signed-off-by:
nixonrodrigues
<
nixon@apache.org
>
parent
0d0a3899
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
43 deletions
+65
-43
BusinessMetadataAttributeItemView_tmpl.html
...ness_metadata/BusinessMetadataAttributeItemView_tmpl.html
+18
-0
BusinessMetadataAttrTableLayoutView.js
.../business_metadata/BusinessMetadataAttrTableLayoutView.js
+5
-6
BusinessMetadataAttributeItemView.js
...ws/business_metadata/BusinessMetadataAttributeItemView.js
+27
-14
BusinessMetadataTableLayoutView.js
...iews/business_metadata/BusinessMetadataTableLayoutView.js
+10
-10
CreateBusinessMetadataLayoutView.js
...ews/business_metadata/CreateBusinessMetadataLayoutView.js
+5
-13
No files found.
dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
View file @
5c9cb781
...
...
@@ -44,6 +44,24 @@
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-sm-3 required"
for=
"type"
>
Search Weight
</label>
<div
class=
"col-sm-8"
>
<select
class=
"form-control searchWeightSelector"
data-id=
"searchWeightSelector"
>
<option>
0
</option>
<option>
1
</option>
<option>
2
</option>
<option>
3
</option>
<option>
4
</option>
<option
selected=
"selected"
>
5
</option>
<option>
6
</option>
<option>
7
</option>
<option>
8
</option>
<option>
9
</option>
<option>
10
</option>
</select>
</div>
</div>
<div
class=
"form-group"
data-id=
"multiValueSelect"
>
<label
class=
"control-label col-sm-3"
for=
"multiValSelect"
>
Enable Multivalues
</label>
<div
class=
"col-sm-8"
>
...
...
dashboardv3/public/js/views/business_metadata/BusinessMetadataAttrTableLayoutView.js
View file @
5c9cb781
...
...
@@ -103,14 +103,11 @@ define(['require',
that
.
newAttr
=
isAttrEdit
?
false
:
true
;
_
.
each
(
attrributes
,
function
(
attrObj
)
{
if
(
attrObj
.
name
===
attrName
)
{
attrDetails
.
attrTypeName
=
attrObj
.
typeName
;
attrDetails
=
$
.
extend
(
true
,
{},
attrObj
)
;
if
(
attrObj
.
typeName
.
includes
(
'array'
))
{
attrDetails
.
attrT
ypeName
=
attrObj
.
typeName
.
replace
(
"array<"
,
""
).
replace
(
">"
,
""
);
attrDetails
.
t
ypeName
=
attrObj
.
typeName
.
replace
(
"array<"
,
""
).
replace
(
">"
,
""
);
attrDetails
.
multiValued
=
true
;
}
attrDetails
.
attrEntityType
=
attrObj
.
options
&&
attrObj
.
options
.
applicableEntityTypes
?
JSON
.
parse
(
attrObj
.
options
.
applicableEntityTypes
)
:
null
;
attrDetails
.
maxStrLength
=
attrObj
.
options
&&
attrObj
.
options
.
maxStrLength
?
attrObj
.
options
.
maxStrLength
:
null
;
attrDetails
.
enumValues
=
attrObj
.
enumValues
?
attrObj
.
enumValues
:
null
;
}
});
this
.
showDetails
=
false
;
...
...
@@ -121,10 +118,12 @@ define(['require',
enumDefCollection
.
fetch
({
reset
:
true
});
that
.
businessMetadataAttr
.
reset
(
that
.
model
.
get
(
"attributeDefs"
));
},
onUpdateBusinessMetadata
:
function
()
{
onUpdateBusinessMetadata
:
function
(
fetch
)
{
that
.
showDetails
=
true
;
that
.
toggleBusinessMetadataDetailsAttrView
();
if
(
fetch
)
{
that
.
entityDefCollection
.
fetch
({
silent
:
true
});
}
},
parent
:
that
.
$el
,
businessMetadataDefCollection
:
that
.
businessMetadataDefCollection
,
...
...
dashboardv3/public/js/views/business_metadata/BusinessMetadataAttributeItemView.js
View file @
5c9cb781
...
...
@@ -40,6 +40,7 @@ define(['require',
attributeInput
:
"[data-id='attributeInput']"
,
close
:
"[data-id='close']"
,
dataTypeSelector
:
"[data-id='dataTypeSelector']"
,
searchWeightSelector
:
"[data-id='searchWeightSelector']"
,
entityTypeSelector
:
"[data-id='entityTypeSelector']"
,
enumTypeSelectorContainer
:
"[data-id='enumTypeSelectorContainer']"
,
enumTypeSelector
:
"[data-id='enumTypeSelector']"
,
...
...
@@ -57,6 +58,9 @@ define(['require',
events
[
"keyup "
+
this
.
ui
.
attributeInput
]
=
function
(
e
)
{
this
.
model
.
set
({
"name"
:
e
.
target
.
value
.
trim
()
});
};
events
[
"change "
+
this
.
ui
.
searchWeightSelector
]
=
function
(
e
)
{
this
.
model
.
set
({
"searchWeight"
:
e
.
target
.
value
.
trim
()
});
};
events
[
"change "
+
this
.
ui
.
dataTypeSelector
]
=
function
(
e
)
{
var
obj
=
{
options
:
this
.
model
.
get
(
'options'
)
||
{}
};
delete
obj
.
enumValues
;
...
...
@@ -142,13 +146,16 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
"typeHeaders"
,
"businessMetadataDefCollection"
,
"enumDefCollection"
,
"isAttrEdit"
,
"
attrDetails"
,
"
viewId"
,
"collection"
));
_
.
extend
(
this
,
_
.
pick
(
options
,
"typeHeaders"
,
"businessMetadataDefCollection"
,
"enumDefCollection"
,
"isAttrEdit"
,
"viewId"
,
"collection"
));
this
.
viewId
=
options
.
model
?
options
.
model
.
cid
:
this
.
viewId
;
},
onRender
:
function
()
{
var
that
=
this
,
entitytypes
=
''
,
enumTypes
=
[];
enumTypes
=
[],
searchWeightValue
=
'5'
,
stringLengthValue
=
'50'
,
applicableEntityType
=
''
;
this
.
typeHeaders
.
fullCollection
.
each
(
function
(
model
)
{
if
(
model
.
toJSON
().
category
==
"ENTITY"
)
{
that
.
ui
.
entityTypeSelector
.
append
(
"<option>"
+
model
.
get
(
'name'
)
+
"</option>"
);
...
...
@@ -162,34 +169,42 @@ define(['require',
selectionAdapter
:
$
.
fn
.
select2
.
amd
.
require
(
"TagHideDeleteButtonAdapter"
)
});
this
.
ui
.
entityTypeSelector
.
html
(
entitytypes
);
this
.
ui
.
entityTypeSelector
.
on
(
'select2:open'
,
function
(
e
)
{
// to make selected option disable in dropdown added remove-from-list class
$
(
'.select2-dropdown--below'
).
addClass
(
'remove-from-list'
);
});
this
.
ui
.
stringLengthValue
.
val
(
'50'
).
trigger
(
'change'
);
//default length for string is 50
if
(
this
.
model
.
get
(
"searchWeight"
)
&&
this
.
model
.
get
(
"searchWeight"
)
!=
-
1
)
{
searchWeightValue
=
this
.
model
.
get
(
"searchWeight"
);
}
if
(
this
.
model
.
get
(
"options"
))
{
stringLengthValue
=
this
.
model
.
get
(
"options"
).
maxStrLength
||
'50'
;
applicableEntityType
=
this
.
model
.
get
(
"options"
).
applicableEntityTypes
?
JSON
.
parse
(
this
.
model
.
get
(
"options"
).
applicableEntityTypes
)
:
null
;
}
this
.
ui
.
stringLengthValue
.
val
(
stringLengthValue
).
trigger
(
'change'
);
//default length for string is 50
this
.
ui
.
searchWeightSelector
.
val
(
searchWeightValue
).
trigger
(
'change'
);
this
.
ui
.
enumValueSelector
.
attr
(
"disabled"
,
"false"
);
// cannot edit the values
this
.
emumTypeSelectDisplay
();
this
.
ui
.
enumTypeSelectorContainer
.
hide
();
this
.
ui
.
enumTypeSelector
.
hide
();
this
.
ui
.
enumValueSelectorContainer
.
hide
();
if
(
this
.
isAttrEdit
)
{
var
typeName
=
this
.
model
.
get
(
"typeName"
);
this
.
ui
.
close
.
hide
();
this
.
ui
.
createNewEnum
.
hide
();
// cannot add new businessMetadata on edit view
this
.
ui
.
attributeInput
.
val
(
this
.
attrDetails
.
name
);
this
.
ui
.
attributeInput
.
val
(
this
.
model
.
get
(
"name"
)
);
this
.
ui
.
attributeInput
.
attr
(
"disabled"
,
"false"
);
this
.
ui
.
dataTypeSelector
.
attr
(
"disabled"
,
"false"
);
this
.
ui
.
dataTypeSelector
.
attr
(
"disabled"
,
"false"
);
this
.
ui
.
multiValueSelect
.
hide
();
this
.
ui
.
dataTypeSelector
.
val
(
t
his
.
attrDetails
.
attrT
ypeName
);
if
(
t
his
.
attrDetails
.
attrT
ypeName
==
"string"
)
{
this
.
ui
.
dataTypeSelector
.
val
(
typeName
);
if
(
typeName
==
"string"
)
{
this
.
ui
.
stringLengthContainer
.
show
();
this
.
ui
.
stringLengthValue
.
show
();
this
.
ui
.
stringLengthValue
.
val
(
this
.
attrDetails
.
maxStrLength
);
}
else
{
this
.
ui
.
stringLengthContainer
.
hide
();
this
.
ui
.
stringLengthValue
.
hide
();
}
_
.
each
(
this
.
attrDetails
.
attrEntityType
,
function
(
valName
)
{
if
(
applicableEntityType
)
{
_
.
each
(
applicableEntityType
,
function
(
valName
)
{
that
.
ui
.
entityTypeSelector
.
find
(
'option'
).
each
(
function
(
o
)
{
var
$el
=
$
(
this
)
if
(
$el
.
data
(
"name"
)
===
valName
)
{
...
...
@@ -197,16 +212,14 @@ define(['require',
}
})
});
this
.
ui
.
entityTypeSelector
.
val
(
this
.
attrDetails
.
attrEntityType
).
trigger
(
'change'
);
if
(
this
.
attrDetails
&&
this
.
attrDetails
.
attrTypeName
)
{
var
typeName
=
this
.
attrDetails
.
attrTypeName
;
}
this
.
ui
.
entityTypeSelector
.
val
(
applicableEntityType
).
trigger
(
'change'
);
if
(
typeName
!=
"string"
&&
typeName
!=
"boolean"
&&
typeName
!=
"byte"
&&
typeName
!=
"short"
&&
typeName
!=
"int"
&&
typeName
!=
"float"
&&
typeName
!=
"double"
&&
typeName
!=
"long"
&&
typeName
!=
"date"
)
{
this
.
ui
.
enumTypeSelector
.
attr
(
"disabled"
,
"false"
);
this
.
ui
.
dataTypeSelector
.
val
(
"enumeration"
).
trigger
(
'change'
);
this
.
ui
.
enumTypeSelector
.
val
(
typeName
).
trigger
(
'change'
);
}
}
if
(
this
.
attrDetails
&&
this
.
attrDetails
.
multiValued
)
{
if
(
this
.
model
.
get
(
"multiValued"
))
{
this
.
ui
.
multiValueSelect
.
show
();
$
(
this
.
ui
.
multiValueSelectStatus
).
prop
(
'checked'
,
true
).
trigger
(
'change'
);
this
.
ui
.
multiValueSelectStatus
.
attr
(
"disabled"
,
"false"
);
...
...
dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
View file @
5c9cb781
...
...
@@ -146,14 +146,11 @@ define(['require',
that
.
guid
=
guid
;
_
.
each
(
attrributes
,
function
(
attrObj
)
{
if
(
attrObj
.
name
===
attrName
)
{
attrDetails
.
attrTypeName
=
attrObj
.
typeName
;
attrDetails
=
$
.
extend
(
true
,
{},
attrObj
)
;
if
(
attrObj
.
typeName
.
includes
(
'array'
))
{
attrDetails
.
attrT
ypeName
=
attrObj
.
typeName
.
replace
(
"array<"
,
""
).
replace
(
">"
,
""
);
attrDetails
.
t
ypeName
=
attrObj
.
typeName
.
replace
(
"array<"
,
""
).
replace
(
">"
,
""
);
attrDetails
.
multiValued
=
true
;
}
attrDetails
.
attrEntityType
=
attrObj
.
options
&&
attrObj
.
options
.
applicableEntityTypes
?
JSON
.
parse
(
attrObj
.
options
.
applicableEntityTypes
)
:
null
;
attrDetails
.
maxStrLength
=
attrObj
.
options
&&
attrObj
.
options
.
maxStrLength
?
attrObj
.
options
.
maxStrLength
:
null
;
attrDetails
.
enumValues
=
attrObj
.
enumValues
?
attrObj
.
enumValues
:
null
;
}
});
...
...
@@ -165,13 +162,14 @@ define(['require',
onEditCallback
:
function
()
{
that
.
businessMetadataDefCollection
.
fullCollection
.
sort
({
silent
:
true
});
that
.
renderTableLayoutView
();
},
onUpdateBusinessMetadata
:
function
()
{
enumDefCollection
.
fetch
({
reset
:
true
});
onUpdateBusinessMetadata
:
function
(
fetch
)
{
that
.
showDetails
=
true
;
that
.
toggleBusinessMetadataDetailsAttrView
();
if
(
fetch
)
{
enumDefCollection
.
fetch
({
reset
:
true
});
that
.
entityDefCollection
.
fetch
({
silent
:
true
});
}
},
parent
:
that
.
$el
,
businessMetadataDefCollection
:
that
.
businessMetadataDefCollection
,
...
...
@@ -203,11 +201,13 @@ define(['require',
that
.
toggleBusinessMetadataDetailsAttrView
();
require
([
"views/business_metadata/CreateBusinessMetadataLayoutView"
],
function
(
CreateBusinessMetadataLayoutView
)
{
that
.
view
=
new
CreateBusinessMetadataLayoutView
({
onUpdateBusinessMetadata
:
function
()
{
enumDefCollection
.
fetch
({
reset
:
true
});
onUpdateBusinessMetadata
:
function
(
fetch
)
{
that
.
showDetails
=
true
;
that
.
toggleBusinessMetadataDetailsAttrView
();
if
(
fetch
)
{
enumDefCollection
.
fetch
({
reset
:
true
});
that
.
entityDefCollection
.
fetch
({
silent
:
true
});
}
},
businessMetadataDefCollection
:
that
.
businessMetadataDefCollection
,
enumDefCollection
:
enumDefCollection
,
...
...
dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
View file @
5c9cb781
...
...
@@ -54,7 +54,6 @@ define(['require',
businessMetadataDefCollection
:
this
.
businessMetadataDefCollection
,
enumDefCollection
:
this
.
enumDefCollection
,
isAttrEdit
:
this
.
isAttrEdit
,
attrDetails
:
this
.
attrDetails
,
viewId
:
this
.
cid
,
collection
:
this
.
collection
};
...
...
@@ -104,16 +103,9 @@ define(['require',
this
.
create
=
true
;
}
if
(
!
this
.
isNewBusinessMetadata
)
{
this
.
collection
=
this
.
isAttrEdit
?
new
Backbone
.
Collection
([{
"name"
:
this
.
attrDetails
.
name
,
"typeName"
:
this
.
attrDetails
.
attrTypeName
,
"isOptional"
:
true
,
"cardinality"
:
"SINGLE"
,
"valuesMinCount"
:
0
,
"valuesMaxCount"
:
1
,
"isUnique"
:
false
,
"isIndexable"
:
false
}])
:
new
Backbone
.
Collection
([{
this
.
collection
=
this
.
isAttrEdit
?
new
Backbone
.
Collection
([
this
.
attrDetails
])
:
new
Backbone
.
Collection
([{
"name"
:
""
,
"typeName"
:
"string"
,
"isOptional"
:
true
,
...
...
@@ -263,7 +255,7 @@ define(['require',
content
:
"Business Metadata "
+
name
+
Messages
.
getAbbreviationMsg
(
false
,
'addSuccessMessage'
)
});
}
that
.
options
.
onUpdateBusinessMetadata
();
that
.
options
.
onUpdateBusinessMetadata
(
true
);
},
silent
:
true
,
reset
:
true
,
...
...
@@ -306,7 +298,7 @@ define(['require',
that
.
selectedBusinessMetadata
.
set
(
model
.
businessMetadataDefs
[
0
]);
}
that
.
options
.
onEditCallback
();
that
.
options
.
onUpdateBusinessMetadata
();
that
.
options
.
onUpdateBusinessMetadata
(
true
);
},
silent
:
true
,
reset
:
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