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
9abc89bf
Commit
9abc89bf
authored
Dec 29, 2017
by
pratik24mac
Committed by
nixonrodrigues
Jan 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2272 : UI - Save the state of dragged columns using save search API.
parent
4516418b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
74 deletions
+116
-74
search.scss
dashboardv2/public/css/scss/search.scss
+9
-0
CommonViewFunction.js
dashboardv2/public/js/utils/CommonViewFunction.js
+70
-56
Enums.js
dashboardv2/public/js/utils/Enums.js
+14
-11
SearchLayoutView.js
dashboardv2/public/js/views/search/SearchLayoutView.js
+1
-1
SearchResultLayoutView.js
dashboardv2/public/js/views/search/SearchResultLayoutView.js
+21
-5
SaveSearchView.js
dashboardv2/public/js/views/search/save/SaveSearchView.js
+1
-1
No files found.
dashboardv2/public/css/scss/search.scss
View file @
9abc89bf
...
...
@@ -112,9 +112,18 @@ $color_celeste_approx: #1D1F2B;
}
}
}
.table-responsive
{
position
:
relative
;
}
.sindu_dragger
{
@extend
.gu-mirror
;
&
.sindu_column
{
li
{
float
:
none
!
important
;
display
:
table-cell
!
important
;
}
}
.gu-transit
{
box-shadow
:
0px
1px
15px
inset
;
}
...
...
dashboardv2/public/js/utils/CommonViewFunction.js
View file @
9abc89bf
...
...
@@ -296,26 +296,34 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
CommonViewFunction
.
generateObjectForSaveSearchApi
=
function
(
options
)
{
var
obj
=
{
name
:
options
.
name
,
guid
:
options
.
guid
,
searchParameters
:
{}
guid
:
options
.
guid
};
var
value
=
options
.
value
;
if
(
value
)
{
_
.
each
(
Enums
.
extractFromUrlForSearch
,
function
(
v
,
k
)
{
var
val
=
value
[
k
];
if
(
!
_
.
isUndefinedNull
(
val
))
{
if
(
k
==
"attributes"
)
{
val
=
val
.
split
(
','
);
}
else
if
(
_
.
contains
([
"tagFilters"
,
"entityFilters"
],
k
))
{
val
=
CommonViewFunction
.
attributeFilter
.
generateAPIObj
(
val
);
}
else
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
val
=
val
?
false
:
true
;
}
}
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
val
=
_
.
isUndefinedNull
(
val
)
?
true
:
val
;
_
.
each
(
Enums
.
extractFromUrlForSearch
,
function
(
svalue
,
skey
)
{
if
(
_
.
isObject
(
svalue
))
{
_
.
each
(
svalue
,
function
(
v
,
k
)
{
var
val
=
value
[
k
];
if
(
!
_
.
isUndefinedNull
(
val
))
{
if
(
k
==
"attributes"
)
{
val
=
val
.
split
(
','
);
}
else
if
(
_
.
contains
([
"tagFilters"
,
"entityFilters"
],
k
))
{
val
=
CommonViewFunction
.
attributeFilter
.
generateAPIObj
(
val
);
}
else
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
val
=
val
?
false
:
true
;
}
}
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
val
=
_
.
isUndefinedNull
(
val
)
?
true
:
val
;
}
if
(
!
obj
[
skey
])
{
obj
[
skey
]
=
{};
}
obj
[
skey
][
v
]
=
val
;
});
}
else
{
obj
[
skey
]
=
value
[
skey
];
}
obj
.
searchParameters
[
v
]
=
val
;
});
return
obj
;
}
...
...
@@ -326,50 +334,56 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
entityDefCollection
=
options
.
entityDefCollection
,
obj
=
{};
if
(
value
)
{
_
.
each
(
Enums
.
extractFromUrlForSearch
,
function
(
v
,
k
)
{
var
val
=
value
[
v
];
if
(
!
_
.
isUndefinedNull
(
val
))
{
if
(
k
==
"attributes"
)
{
val
=
val
.
join
(
','
);
}
else
if
(
k
==
"tagFilters"
)
{
if
(
classificationDefCollection
)
{
var
classificationDef
=
classificationDefCollection
.
fullCollection
.
findWhere
({
'name'
:
value
.
classification
})
attributeDefs
=
Utils
.
getNestedSuperTypeObj
({
collection
:
classificationDefCollection
,
attrMerge
:
true
,
data
:
classificationDef
.
toJSON
()
});
_
.
each
(
val
.
criterion
,
function
(
obj
)
{
var
attributeDef
=
_
.
findWhere
(
attributeDefs
,
{
'name'
:
obj
.
attributeName
});
if
(
attributeDef
)
{
obj
.
attributeValue
=
obj
.
attributeValue
;
obj
[
'attributeType'
]
=
attributeDef
.
typeName
;
_
.
each
(
Enums
.
extractFromUrlForSearch
,
function
(
svalue
,
skey
)
{
if
(
_
.
isObject
(
svalue
))
{
_
.
each
(
svalue
,
function
(
v
,
k
)
{
var
val
=
value
[
skey
][
v
];
if
(
!
_
.
isUndefinedNull
(
val
))
{
if
(
k
==
"attributes"
)
{
val
=
val
.
join
(
','
);
}
else
if
(
k
==
"tagFilters"
)
{
if
(
classificationDefCollection
)
{
var
classificationDef
=
classificationDefCollection
.
fullCollection
.
findWhere
({
'name'
:
value
[
skey
].
classification
})
attributeDefs
=
Utils
.
getNestedSuperTypeObj
({
collection
:
classificationDefCollection
,
attrMerge
:
true
,
data
:
classificationDef
.
toJSON
()
});
_
.
each
(
val
.
criterion
,
function
(
obj
)
{
var
attributeDef
=
_
.
findWhere
(
attributeDefs
,
{
'name'
:
obj
.
attributeName
});
if
(
attributeDef
)
{
obj
.
attributeValue
=
obj
.
attributeValue
;
obj
[
'attributeType'
]
=
attributeDef
.
typeName
;
}
});
}
});
}
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
.
criterion
});
}
else
if
(
k
==
"entityFilters"
)
{
if
(
entityDefCollection
)
{
var
entityDef
=
entityDefCollection
.
fullCollection
.
findWhere
({
'name'
:
value
.
typeName
})
,
attributeDefs
=
Utils
.
getNestedSuperTypeObj
({
collection
:
entityDefCollection
,
attrMerge
:
true
,
data
:
entityDef
.
toJSON
()
});
_
.
each
(
val
.
criterion
,
function
(
obj
)
{
var
attributeDef
=
_
.
findWhere
(
attributeDefs
,
{
'name'
:
obj
.
attributeName
})
;
if
(
attributeDef
)
{
obj
.
attributeValue
=
obj
.
attributeValue
;
obj
[
'attributeType'
]
=
attributeDef
.
typeName
;
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
.
criterion
});
}
else
if
(
k
==
"entityFilters"
)
{
if
(
entityDefCollection
)
{
var
entityDef
=
entityDefCollection
.
fullCollection
.
findWhere
({
'name'
:
value
[
skey
].
typeName
}),
attributeDefs
=
Utils
.
getNestedSuperTypeObj
(
{
collection
:
entityDefCollection
,
attrMerge
:
true
,
data
:
entityDef
.
toJSON
()
});
_
.
each
(
val
.
criterion
,
function
(
obj
)
{
var
attributeDef
=
_
.
findWhere
(
attributeDefs
,
{
'name'
:
obj
.
attributeName
});
if
(
attributeDef
)
{
obj
.
attributeValue
=
obj
.
attributeValue
;
obj
[
'attributeType'
]
=
attributeDef
.
typeName
;
}
})
;
}
});
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
.
criterion
});
}
else
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
val
=
val
?
false
:
true
;
}
}
val
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
"value"
:
val
.
criterion
})
;
}
else
if
(
_
.
contains
([
"includeDE"
,
"excludeST"
,
"excludeSC"
],
k
))
{
val
=
val
?
false
:
true
;
}
obj
[
k
]
=
val
;
}
);
}
else
{
obj
[
skey
]
=
value
[
skey
];
}
obj
[
k
]
=
val
;
});
return
obj
;
}
...
...
dashboardv2/public/js/utils/Enums.js
View file @
9abc89bf
...
...
@@ -57,17 +57,20 @@ define(['require'], function(require) {
'annual'
:
"Annual Distribution"
}
Enums
.
extractFromUrlForSearch
=
{
"pageLimit"
:
"limit"
,
"type"
:
"typeName"
,
"tag"
:
"classification"
,
"query"
:
"query"
,
"pageOffset"
:
"offset"
,
"includeDE"
:
"excludeDeletedEntities"
,
"excludeST"
:
"includeSubTypes"
,
"excludeSC"
:
"includeSubClassifications"
,
"tagFilters"
:
"tagFilters"
,
"entityFilters"
:
"entityFilters"
,
"attributes"
:
"attributes"
"searchParameters"
:
{
"pageLimit"
:
"limit"
,
"type"
:
"typeName"
,
"tag"
:
"classification"
,
"query"
:
"query"
,
"pageOffset"
:
"offset"
,
"includeDE"
:
"excludeDeletedEntities"
,
"excludeST"
:
"includeSubTypes"
,
"excludeSC"
:
"includeSubClassifications"
,
"tagFilters"
:
"tagFilters"
,
"entityFilters"
:
"entityFilters"
,
"attributes"
:
"attributes"
},
"uiParameters"
:
"uiParameters"
}
return
Enums
;
...
...
dashboardv2/public/js/views/search/SearchLayoutView.js
View file @
9abc89bf
...
...
@@ -161,7 +161,7 @@ define(['require',
},
applyValue
:
function
(
model
,
searchType
)
{
that
.
manualRender
(
_
.
extend
(
searchType
,
CommonViewFunction
.
generateUrlFromSaveSearchObject
({
value
:
model
.
get
(
'searchParameters'
)
,
value
:
{
"searchParameters"
:
model
.
get
(
'searchParameters'
),
'uiParameters'
:
model
.
get
(
'uiParameters'
)
}
,
classificationDefCollection
:
that
.
classificationDefCollection
,
entityDefCollection
:
that
.
entityDefCollection
})));
...
...
dashboardv2/public/js/views/search/SearchResultLayoutView.js
View file @
9abc89bf
...
...
@@ -211,6 +211,7 @@ define(['require',
this
.
ui
.
columnEmptyInfo
.
hide
();
}
}
this
.
columnOrder
=
this
.
getColumnOrder
(
this
.
REntityTableLayoutView
.
$el
.
find
(
'.colSort th.renderable'
));
this
.
triggerUrl
();
var
attributes
=
this
.
searchCollection
.
filterObj
.
attributes
;
if
((
excludeDefaultColumn
&&
attributes
)
&&
(
excludeDefaultColumn
.
length
>
attributes
.
length
||
_
.
difference
(
excludeDefaultColumn
,
attributes
).
length
))
{
...
...
@@ -297,10 +298,16 @@ define(['require',
}
}
},
getColumnOrderWithPosition
:
function
()
{
var
that
=
this
;
return
_
.
map
(
that
.
columnOrder
,
function
(
value
,
key
)
{
return
key
+
"::"
+
value
;
}).
join
(
","
);
},
triggerUrl
:
function
(
options
)
{
Utils
.
setUrl
(
_
.
extend
({
url
:
Utils
.
getUrlState
.
getQueryUrl
().
queyParams
[
0
],
urlParams
:
this
.
value
,
urlParams
:
this
.
columnOrder
?
_
.
extend
(
this
.
value
,
{
'uiParameters'
:
this
.
getColumnOrderWithPosition
()
})
:
this
.
value
,
mergeBrowserUrl
:
false
,
trigger
:
false
,
updateTabState
:
true
...
...
@@ -502,6 +509,11 @@ define(['require',
var
that
=
this
;
require
([
'utils/TableLayout'
],
function
(
TableLayout
)
{
// displayOrder added for column manager
if
(
that
.
value
.
uiParameters
)
{
var
savedColumnOrder
=
_
.
object
(
that
.
value
.
uiParameters
.
split
(
','
).
map
(
function
(
a
)
{
return
a
.
split
(
'::'
);
}));
// get Column position from string to object
}
var
columnCollection
=
Backgrid
.
Columns
.
extend
({
sortKey
:
"displayOrder"
,
comparator
:
function
(
item
)
{
...
...
@@ -509,24 +521,28 @@ define(['require',
},
setPositions
:
function
()
{
_
.
each
(
this
.
models
,
function
(
model
,
index
)
{
model
.
set
(
"displayOrder"
,
(
that
.
columnOrder
==
null
?
index
:
that
.
columnOrder
[
model
.
get
(
'label'
)]
)
+
1
,
{
silent
:
true
});
model
.
set
(
"displayOrder"
,
(
savedColumnOrder
==
null
?
index
:
parseInt
(
savedColumnOrder
[
model
.
get
(
'label'
)])
)
+
1
,
{
silent
:
true
});
});
return
this
;
}
});
var
columns
=
new
columnCollection
((
that
.
searchCollection
.
dynamicTable
?
that
.
getDaynamicColumns
(
that
.
searchCollection
.
toJSON
())
:
that
.
getFixedDslColumn
()));
columns
.
setPositions
().
sort
();
that
.
REntityTableLayoutView
.
show
(
new
TableLayout
(
_
.
extend
({},
that
.
commonTableOptions
,
{
var
table
=
new
TableLayout
(
_
.
extend
({},
that
.
commonTableOptions
,
{
columns
:
columns
})));
}));
that
.
REntityTableLayoutView
.
show
(
table
);
if
(
that
.
value
.
searchType
!==
"dsl"
)
{
that
.
ui
.
containerCheckBox
.
show
();
}
else
{
that
.
ui
.
containerCheckBox
.
hide
();
}
that
.
$
(
".ellipsis .inputAssignTag"
).
hide
();
table
.
trigger
(
"grid:refresh"
);
/*Event fire when table rendered*/
tableDragger
(
document
.
querySelector
(
".colSort"
)).
on
(
'drop'
,
function
(
from
,
to
,
el
)
{
that
.
columnOrder
=
that
.
getColumnOrder
(
el
.
querySelectorAll
(
'th'
));
that
.
columnOrder
=
that
.
getColumnOrder
(
el
.
querySelectorAll
(
'th.renderable'
));
table
.
trigger
(
"grid:refresh:update"
);
that
.
triggerUrl
();
});
that
.
checkTableFetch
();
});
...
...
dashboardv2/public/js/views/search/save/SaveSearchView.js
View file @
9abc89bf
...
...
@@ -147,7 +147,7 @@ define(['require',
if
(
options
&&
options
.
model
)
{
var
searchParameters
=
options
.
model
.
toJSON
().
searchParameters
,
params
=
CommonViewFunction
.
generateUrlFromSaveSearchObject
({
value
:
searchParameters
,
value
:
{
"searchParameters"
:
searchParameters
,
"uiParameters"
:
options
.
model
.
get
(
'uiParameters'
)}
,
classificationDefCollection
:
this
.
classificationDefCollection
,
entityDefCollection
:
this
.
entityDefCollection
});
...
...
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