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
571f8d4e
Commit
571f8d4e
authored
8 years ago
by
kevalbhatt
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1632: entity UI updated to show array-entity type attributes as read-only
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
72641fb7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
28 deletions
+58
-28
CreateEntityLayoutView.js
dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
+58
-28
No files found.
dashboardv2/public/js/views/entity/CreateEntityLayoutView.js
View file @
571f8d4e
...
@@ -426,7 +426,7 @@ define(['require',
...
@@ -426,7 +426,7 @@ define(['require',
getFieldSet
:
function
(
data
,
alloptional
,
attributeInput
)
{
getFieldSet
:
function
(
data
,
alloptional
,
attributeInput
)
{
return
'<fieldset class="scheduler-border'
+
(
alloptional
?
" alloptional"
:
""
)
+
'"><legend class="scheduler-border">'
+
data
.
name
+
'</legend>'
+
attributeInput
+
'</fieldset>'
;
return
'<fieldset class="scheduler-border'
+
(
alloptional
?
" alloptional"
:
""
)
+
'"><legend class="scheduler-border">'
+
data
.
name
+
'</legend>'
+
attributeInput
+
'</fieldset>'
;
},
},
getSelect
:
function
(
value
,
entityValue
)
{
getSelect
:
function
(
value
,
entityValue
,
disabled
)
{
if
(
value
.
typeName
===
"boolean"
)
{
if
(
value
.
typeName
===
"boolean"
)
{
return
'<select class="form-control row-margin-bottom '
+
(
value
.
isOptional
===
true
?
"false"
:
"true"
)
+
'" data-type="'
+
value
.
typeName
+
'" data-key="'
+
value
.
name
+
'" data-id="entityInput">'
+
return
'<select class="form-control row-margin-bottom '
+
(
value
.
isOptional
===
true
?
"false"
:
"true"
)
+
'" data-type="'
+
value
.
typeName
+
'" data-key="'
+
value
.
name
+
'" data-id="entityInput">'
+
'<option value="">--Select true or false--</option><option value="true">true</option>'
+
'<option value="">--Select true or false--</option><option value="true">true</option>'
+
...
@@ -439,7 +439,7 @@ define(['require',
...
@@ -439,7 +439,7 @@ define(['require',
splitTypeName
=
value
.
typeName
;
splitTypeName
=
value
.
typeName
;
}
}
return
'<select class="form-control row-margin-bottom entityInputBox '
+
(
value
.
isOptional
===
true
?
"false"
:
"true"
)
+
'" data-type="'
+
value
.
typeName
+
return
'<select class="form-control row-margin-bottom entityInputBox '
+
(
value
.
isOptional
===
true
?
"false"
:
"true"
)
+
'" data-type="'
+
value
.
typeName
+
'" data-key="'
+
value
.
name
+
'"data-id="entitySelectData" data-queryData="'
+
splitTypeName
+
'">'
+
(
this
.
guid
?
entityValue
:
""
)
+
'</select>'
;
'" data-key="'
+
value
.
name
+
'"
'
+
(
disabled
?
'disabled data-skip="true"'
:
""
)
+
'
data-id="entitySelectData" data-queryData="'
+
splitTypeName
+
'">'
+
(
this
.
guid
?
entityValue
:
""
)
+
'</select>'
;
}
}
},
},
...
@@ -498,15 +498,16 @@ define(['require',
...
@@ -498,15 +498,16 @@ define(['require',
if
(
splitTypeName
.
length
>
1
)
{
if
(
splitTypeName
.
length
>
1
)
{
splitTypeName
=
splitTypeName
[
1
].
split
(
">"
)[
0
];
splitTypeName
=
splitTypeName
[
1
].
split
(
">"
)[
0
];
if
(
splitTypeName
&&
this
.
entityDefCollection
.
fullCollection
.
find
({
name
:
splitTypeName
}))
{
if
(
splitTypeName
&&
this
.
entityDefCollection
.
fullCollection
.
find
({
name
:
splitTypeName
}))
{
if
(
!
_
.
contains
(
this
.
searchQueryList
,
splitTypeName
))
{
if
(
!
_
.
contains
(
this
.
searchQueryList
,
splitTypeName
)
&&
!
value
.
isOptional
)
{
this
.
searchQueryList
.
push
(
splitTypeName
);
this
.
searchQueryList
.
push
(
splitTypeName
);
$
.
extend
(
this
.
searchCollection
.
queryParams
,
{
query
:
splitTypeName
});
$
.
extend
(
this
.
searchCollection
.
queryParams
,
{
query
:
splitTypeName
});
++
this
.
asyncFetchLOVCounter
;
++
this
.
asyncFetchLOVCounter
;
this
.
searchCollection
.
fetch
({
reset
:
true
});
this
.
searchCollection
.
fetch
({
reset
:
true
});
}
}
return
this
.
getSelect
(
value
,
entityValue
,
value
.
isOptional
);
}
}
}
}
return
this
.
getSelect
(
value
,
entityValue
);
return
this
.
getSelect
(
value
,
entityValue
,
false
);
// Don't disable select for non entity attributes.
}
else
if
(
typeName
.
indexOf
(
"map"
)
>
-
1
)
{
}
else
if
(
typeName
.
indexOf
(
"map"
)
>
-
1
)
{
return
this
.
getTextArea
(
value
,
entityValue
);
return
this
.
getTextArea
(
value
,
entityValue
);
}
else
{
}
else
{
...
@@ -561,6 +562,9 @@ define(['require',
...
@@ -561,6 +562,9 @@ define(['require',
}
}
try
{
try
{
this
.
ui
.
entityInputData
.
find
(
"input,select,textarea"
).
each
(
function
()
{
this
.
ui
.
entityInputData
.
find
(
"input,select,textarea"
).
each
(
function
()
{
if
(
$
(
this
).
data
(
'skip'
)
===
true
)
{
return
;
}
var
value
=
$
(
this
).
val
();
var
value
=
$
(
this
).
val
();
if
(
$
(
this
).
val
()
&&
$
(
this
).
val
().
trim
)
{
if
(
$
(
this
).
val
()
&&
$
(
this
).
val
().
trim
)
{
value
=
$
(
this
).
val
().
trim
();
value
=
$
(
this
).
val
().
trim
();
...
@@ -705,10 +709,11 @@ define(['require',
...
@@ -705,10 +709,11 @@ define(['require',
keyData
=
$
(
this
).
data
(
"key"
),
keyData
=
$
(
this
).
data
(
"key"
),
typeData
=
$
(
this
).
data
(
"type"
),
typeData
=
$
(
this
).
data
(
"type"
),
queryData
=
$
(
this
).
data
(
"querydata"
),
queryData
=
$
(
this
).
data
(
"querydata"
),
skip
=
$
(
this
).
data
(
'skip'
),
placeholderName
=
"Select a "
+
typeData
+
" from the dropdown list"
;
placeholderName
=
"Select a "
+
typeData
+
" from the dropdown list"
;
//add options.
//add options.
if
(
that
.
selectStoreCollection
.
length
&&
!
this
.
options
.
length
)
{
if
(
that
.
selectStoreCollection
.
length
&&
!
this
.
options
.
length
&&
!
skip
)
{
that
.
selectStoreCollection
.
where
({
queryText
:
queryData
}).
forEach
(
function
(
model
)
{
that
.
selectStoreCollection
.
where
({
queryText
:
queryData
}).
forEach
(
function
(
model
)
{
var
obj
=
model
.
toJSON
();
var
obj
=
model
.
toJSON
();
if
(
obj
.
status
)
{
if
(
obj
.
status
)
{
...
@@ -726,40 +731,65 @@ define(['require',
...
@@ -726,40 +731,65 @@ define(['require',
// Select Value.
// Select Value.
if
(
that
.
guid
)
{
if
(
that
.
guid
)
{
var
dataValue
=
that
.
entityData
.
get
(
"entity"
).
attributes
[
keyData
];
var
dataValue
=
that
.
entityData
.
get
(
"entity"
).
attributes
[
keyData
],
var
selectedValue
=
[];
referredEntities
=
that
.
entityData
.
get
(
"referredEntities"
),
var
setValue
=
function
(
selectValue
)
{
selectedValue
=
[];
var
obj
=
selectValue
.
toJSON
();
if
(
!
skip
)
{
if
(
dataValue
!==
null
&&
_
.
isArray
(
dataValue
))
{
_
.
each
(
dataValue
,
function
(
obj
)
{
//Uncoment when array of entity is not read-only
if
(
obj
.
guid
===
selectValue
.
attributes
.
guid
)
{
selectedValue
.
push
(
selectValue
.
attributes
.
labelName
);
// var setValue = function(selectValue) {
}
// var obj = selectValue.toJSON();
});
// if (dataValue !== null && _.isArray(dataValue)) {
}
else
if
(
dataValue
!==
null
)
{
// _.each(dataValue, function(obj) {
if
(
dataValue
.
guid
===
selectValue
.
attributes
.
guid
)
{
// if (obj.guid === selectValue.attributes.guid) {
selectedValue
.
push
(
selectValue
.
attributes
.
labelName
);
// selectedValue.push(selectValue.attributes.labelName);
}
// }
// });
// } else if (dataValue !== null) {
// if (dataValue.guid === selectValue.attributes.guid) {
// selectedValue.push(selectValue.attributes.labelName);
// }
// }
// }
// that.selectStoreCollection.each(function(storedValue) {
// var obj = storedValue.toJSON();
// if (obj.status) {
// if (!Enums.entityStateReadOnly[obj.status]) {
// setValue(storedValue);
// }
// } else {
// setValue(storedValue);
// }
// });
if
(
dataValue
)
{
var
storeEntity
=
that
.
selectStoreCollection
.
findWhere
({
guid
:
dataValue
.
guid
});
var
refEntiyFound
=
referredEntities
[
dataValue
.
guid
]
if
(
storeEntity
)
{
var
name
=
Utils
.
getName
(
storeEntity
,
'displayText'
);
}
else
if
(
!
storeEntity
&&
refEntiyFound
&&
refEntiyFound
.
typeName
)
{
that
.
selectStoreCollection
.
push
(
refEntiyFound
);
var
name
=
Utils
.
getName
(
refEntiyFound
,
'displayText'
);
var
str
=
'<option>'
+
name
+
'</option>'
;
that
.
$
(
'select[data-queryData="'
+
refEntiyFound
.
typeName
+
'"]'
).
append
(
str
);
}
}
if
(
name
&&
name
.
length
)
{
selectedValue
.
push
(
name
);
}
}
that
.
selectStoreCollection
.
each
(
function
(
storedValue
)
{
var
obj
=
storedValue
.
toJSON
();
if
(
obj
.
status
)
{
if
(
!
Enums
.
entityStateReadOnly
[
obj
.
status
])
{
setValue
(
storedValue
);
}
}
}
else
{
setValue
(
storedValue
);
}
}
});
// Array of string.
// Array of string.
if
(
selectedValue
.
length
===
0
&&
dataValue
&&
dataValue
.
length
&&
$this
.
data
(
'querydata'
)
===
"string"
)
{
if
(
selectedValue
.
length
===
0
&&
dataValue
&&
dataValue
.
length
&&
(
$this
.
data
(
'querydata'
)
===
"string"
||
skip
===
true
)
)
{
var
str
=
""
;
var
str
=
""
;
_
.
each
(
dataValue
,
function
(
obj
)
{
_
.
each
(
dataValue
,
function
(
obj
)
{
if
(
_
.
isString
(
obj
))
{
if
(
_
.
isString
(
obj
))
{
selectedValue
.
push
(
obj
);
selectedValue
.
push
(
obj
);
str
+=
'<option>'
+
_
.
escape
(
obj
)
+
'</option>'
;
str
+=
'<option>'
+
_
.
escape
(
obj
)
+
'</option>'
;
}
else
if
(
_
.
isObject
(
obj
)
&&
obj
.
guid
&&
referredEntities
[
obj
.
guid
])
{
var
name
=
Utils
.
getName
(
referredEntities
[
obj
.
guid
],
'qualifiedName'
);
selectedValue
.
push
(
name
);
str
+=
'<option>'
+
name
+
'</option>'
;
}
}
});
});
$this
.
html
(
str
);
$this
.
html
(
str
);
...
...
This diff is collapsed.
Click to expand it.
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