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
adfc526e
Commit
adfc526e
authored
5 years ago
by
kevalbhatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3449: UI : Beta UI : Invalid Filter validation case for classification
parent
7ba3213e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
66 deletions
+52
-66
SearchDefaultLayoutView.js
...boardv3/public/js/views/search/SearchDefaultLayoutView.js
+52
-66
No files found.
dashboardv3/public/js/views/search/SearchDefaultLayoutView.js
View file @
adfc526e
...
...
@@ -124,6 +124,8 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
initialize
:
function
(
options
)
{
_
.
extend
(
this
.
options
,
options
);
this
.
hidenFilter
=
false
;
this
.
tagAttributeLength
=
0
;
this
.
entityAttributeLength
=
0
;
},
bindEvents
:
function
()
{},
onRender
:
function
()
{
...
...
@@ -138,34 +140,13 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
var
filters
=
CommonViewFunction
.
attributeFilter
.
extractUrl
({
"value"
:
isTag
?
this
.
options
.
value
.
tagFilters
:
this
.
options
.
value
.
entityFilters
,
"formatDate"
:
true
}),
rules
=
filters
.
rules
,
filtertype
=
isTag
?
"tagFilters"
:
"entityFilters"
,
that
=
this
,
col
=
[];
that
=
this
;
function
getIdFromRuleObject
(
rule
)
{
_
.
map
(
rule
.
rules
,
function
(
obj
,
key
)
{
if
(
_
.
has
(
obj
,
"condition"
))
{
return
getIdFromRuleObject
(
obj
);
}
else
{
return
col
.
push
(
obj
.
id
);
}
});
return
col
;
}
filters
.
rules
=
_
.
filter
(
rules
,
function
(
obj
,
key
)
{
return
obj
.
id
!=
$
(
e
.
currentTarget
).
data
(
"id"
);
});
if
(
filters
)
{
var
ruleUrl
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
filters
,
formatedDateToLong
:
true
});
that
.
options
.
searchTableFilters
[
filtertype
][
isTag
?
that
.
options
.
value
.
tag
:
that
.
options
.
value
.
type
]
=
ruleUrl
;
//this.makeFilterButtonActive(filtertype);
if
(
!
isTag
&&
that
.
options
.
value
&&
that
.
options
.
value
.
type
&&
that
.
options
.
searchTableColumns
)
{
if
(
!
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
])
{
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
]
=
[
"selected"
,
"name"
,
"owner"
,
"description"
,
"tag"
,
"typeName"
];
}
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
]
=
_
.
sortBy
(
_
.
union
(
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
],
getIdFromRuleObject
(
filters
)));
}
}
else
{
that
.
updateFilterOptions
(
filters
,
filtertype
,
isTag
);
}
if
(
filters
.
rules
.
length
==
0
)
{
if
(
isTag
)
{
...
...
@@ -262,101 +243,106 @@ define(["require", "backbone", "utils/Globals", "hbs!tmpl/search/SearchDefaultLa
if
(
that
.
options
.
value
.
tag
)
{
this
.
ui
.
classificationRegion
.
show
();
// this.ui.entityRegion.hide();
var
attrObj
=
that
.
options
.
classificationDefCollection
.
fullCollection
.
find
({
name
:
that
.
options
.
value
.
tag
});
if
(
attrObj
)
{
attrObj
=
Utils
.
getNestedSuperTypeObj
({
data
:
attrObj
.
toJSON
(),
var
attr
Tag
Obj
=
that
.
options
.
classificationDefCollection
.
fullCollection
.
find
({
name
:
that
.
options
.
value
.
tag
});
if
(
attr
Tag
Obj
)
{
attr
Tag
Obj
=
Utils
.
getNestedSuperTypeObj
({
data
:
attr
Tag
Obj
.
toJSON
(),
collection
:
that
.
options
.
classificationDefCollection
,
attrMerge
:
true
,
});
this
.
tagAttributeLength
=
attrTagObj
.
length
;
}
this
.
renderQueryBuilder
(
_
.
extend
({},
obj
,
{
tag
:
true
,
type
:
false
,
attrObj
:
attrObj
attrObj
:
attr
Tag
Obj
}),
this
.
RQueryBuilderClassification
);
this
.
ui
.
classificationName
.
html
(
that
.
options
.
value
.
tag
);
}
if
(
that
.
options
.
value
.
type
)
{
this
.
ui
.
entityRegion
.
show
();
var
attrObj
=
that
.
options
.
entityDefCollection
.
fullCollection
.
find
({
name
:
that
.
options
.
value
.
type
});
if
(
attrObj
)
{
attrObj
=
Utils
.
getNestedSuperTypeObj
({
data
:
attrObj
.
toJSON
(),
var
attr
Type
Obj
=
that
.
options
.
entityDefCollection
.
fullCollection
.
find
({
name
:
that
.
options
.
value
.
type
});
if
(
attr
Type
Obj
)
{
attr
Type
Obj
=
Utils
.
getNestedSuperTypeObj
({
data
:
attr
Type
Obj
.
toJSON
(),
collection
:
that
.
options
.
entityDefCollection
,
attrMerge
:
true
});
this
.
entityAttributeLength
=
attrTypeObj
.
length
;
}
this
.
renderQueryBuilder
(
_
.
extend
({},
obj
,
{
tag
:
false
,
type
:
true
,
attrObj
:
attrObj
attrObj
:
attr
Type
Obj
}),
this
.
RQueryBuilderEntity
);
this
.
ui
.
entityName
.
html
(
that
.
options
.
value
.
type
);
}
},
okAttrFilterButton
:
function
(
e
)
{
// var isTag = this.attrModal.tag ? true : false,
var
isTag
,
filtertype
,
queryBuilderRef
,
col
=
[]
,
isFilterValidate
=
true
,
that
=
this
;
if
(
this
.
options
.
value
.
tag
)
{
isTag
=
true
;
filtertype
=
isTag
?
"tagFilters"
:
"entityFilters"
;
queryBuilderRef
=
this
.
RQueryBuilderClassification
.
currentView
.
ui
.
builder
;
searchAttribute
();
if
(
this
.
tagAttributeLength
!==
0
)
{
queryBuilderRef
=
this
.
RQueryBuilderClassification
.
currentView
.
ui
.
builder
;
searchAttribute
();
}
}
if
(
this
.
options
.
value
.
type
)
{
isTag
=
false
;
filtertype
=
isTag
?
"tagFilters"
:
"entityFilters"
;
queryBuilderRef
=
this
.
RQueryBuilderEntity
.
currentView
.
ui
.
builder
;
searchAttribute
();
}
function
getIdFromRuleObject
(
rule
)
{
_
.
map
(
rule
.
rules
,
function
(
obj
,
key
)
{
if
(
_
.
has
(
obj
,
"condition"
))
{
return
getIdFromRuleObject
(
obj
);
}
else
{
return
col
.
push
(
obj
.
id
);
}
});
return
col
;
if
(
this
.
entityAttributeLength
!==
0
)
{
queryBuilderRef
=
this
.
RQueryBuilderEntity
.
currentView
.
ui
.
builder
;
searchAttribute
();
}
}
filterPopupStatus
();
function
searchAttribute
()
{
if
(
queryBuilderRef
.
data
(
"queryBuilder"
))
{
var
rule
=
queryBuilderRef
.
queryBuilder
(
"getRules"
);
}
if
(
rule
)
{
var
ruleUrl
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
rule
,
formatedDateToLong
:
true
});
that
.
options
.
searchTableFilters
[
filtertype
][
isTag
?
that
.
options
.
value
.
tag
:
that
.
options
.
value
.
type
]
=
ruleUrl
;
//this.makeFilterButtonActive(filtertype);
if
(
!
isTag
&&
that
.
options
.
value
&&
that
.
options
.
value
.
type
&&
that
.
options
.
searchTableColumns
)
{
if
(
!
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
])
{
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
]
=
[
"selected"
,
"name"
,
"owner"
,
"description"
,
"tag"
,
"typeName"
];
}
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
]
=
_
.
sortBy
(
_
.
union
(
that
.
options
.
searchTableColumns
[
that
.
options
.
value
.
type
],
getIdFromRuleObject
(
rule
)));
}
rule
?
that
.
updateFilterOptions
(
rule
,
filtertype
,
isTag
)
:
isFilterValidate
=
false
;
}
function
filterPopupStatus
()
{
if
(
isFilterValidate
)
{
if
(
$
(
e
.
currentTarget
).
hasClass
(
"search"
))
{
// this.$('.attribute-filter-container').hide();
// that.$('.fa-chevron-right').toggleClass('fa-chevron-down');
that
.
$
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
that
.
$
(
'.attribute-filter-container, .attr-filter-overlay'
).
toggleClass
(
'hide'
);
that
.
searchAttrFilter
();
that
.
$
(
'.attributeResultContainer'
).
removeClass
(
"overlay"
);
//console.log('Done')
}
}
}
},
getIdFromRuleObj
:
function
(
rule
)
{
var
col
=
[]
_
.
map
(
rule
.
rules
,
function
(
obj
,
key
)
{
if
(
_
.
has
(
obj
,
"condition"
))
{
return
this
.
getIdFromRuleObj
(
obj
);
}
else
{
return
col
.
push
(
obj
.
id
);
}
});
return
col
;
},
updateFilterOptions
:
function
(
rule
,
filtertype
,
isTag
)
{
var
ruleUrl
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
rule
,
formatedDateToLong
:
true
});
this
.
options
.
searchTableFilters
[
filtertype
][
isTag
?
this
.
options
.
value
.
tag
:
this
.
options
.
value
.
type
]
=
ruleUrl
;
if
(
!
isTag
&&
this
.
options
.
value
&&
this
.
options
.
value
.
type
&&
this
.
options
.
searchTableColumns
)
{
if
(
!
this
.
options
.
searchTableColumns
[
this
.
options
.
value
.
type
])
{
this
.
options
.
searchTableColumns
[
this
.
options
.
value
.
type
]
=
[
"selected"
,
"name"
,
"owner"
,
"description"
,
"tag"
,
"typeName"
];
}
this
.
options
.
searchTableColumns
[
this
.
options
.
value
.
type
]
=
_
.
sortBy
(
_
.
union
(
this
.
options
.
searchTableColumns
[
this
.
options
.
value
.
type
],
this
.
getIdFromRuleObj
(
rule
)));
}
},
renderQueryBuilder
:
function
(
obj
,
rQueryBuilder
)
{
var
that
=
this
;
require
([
'views/search/QueryBuilderView'
],
function
(
QueryBuilderView
)
{
...
...
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