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
20f2fba7
Commit
20f2fba7
authored
Sep 22, 2017
by
kevalbhatt
Committed by
Madhan Neethiraj
Sep 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2156: save-search UI to allow user to edit name
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
454eb66a
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
83 deletions
+119
-83
SaveModalLayoutView_tmpl.html
...ic/js/templates/search/save/SaveModalLayoutView_tmpl.html
+2
-1
SaveSearchItemView_tmpl.html
...lic/js/templates/search/save/SaveSearchItemView_tmpl.html
+0
-0
SaveSearchView_tmpl.html
.../public/js/templates/search/save/SaveSearchView_tmpl.html
+2
-1
CommonViewFunction.js
dashboardv2/public/js/utils/CommonViewFunction.js
+5
-3
SearchLayoutView.js
dashboardv2/public/js/views/search/SearchLayoutView.js
+19
-20
SaveModalLayoutView.js
...oardv2/public/js/views/search/save/SaveModalLayoutView.js
+49
-14
SaveSearchItemView.js
...boardv2/public/js/views/search/save/SaveSearchItemView.js
+16
-4
SaveSearchView.js
dashboardv2/public/js/views/search/save/SaveSearchView.js
+26
-40
No files found.
dashboardv2/public/js/templates/search/
SaveAs
LayoutView_tmpl.html
→
dashboardv2/public/js/templates/search/
save/SaveModal
LayoutView_tmpl.html
View file @
20f2fba7
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-sm-2 required"
for=
"name"
>
Name
</label>
<label
class=
"control-label col-sm-2 required"
for=
"name"
>
Name
</label>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<input
class=
"form-control"
data-id=
"saveAsName"
placeholder=
"Name(required)"
autofocus
/>
<input
class=
"form-control"
data-id=
"saveAsName"
placeholder=
"Name(required)"
value=
"{{selectedModel.name}}"
autofocus
/>
</div>
</div>
</div>
</div>
</form>
</form>
\ No newline at end of file
dashboardv2/public/js/templates/search/SaveSearchItemView_tmpl.html
→
dashboardv2/public/js/templates/search/
save/
SaveSearchItemView_tmpl.html
View file @
20f2fba7
File moved
dashboardv2/public/js/templates/search/
SaveSearch
_tmpl.html
→
dashboardv2/public/js/templates/search/
save/SaveSearchView
_tmpl.html
View file @
20f2fba7
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
<button
type=
"button"
class=
"btn btn-action btn-sm"
data-id=
"saveAsBtn"
>
Save As
</button>
<button
type=
"button"
class=
"btn btn-action btn-sm"
data-id=
"saveAsBtn"
>
Save As
</button>
</div>
</div>
</div>
</div>
<ul
data-id=
"itemViewContent"
class=
"tag-tree saveSearchList gray-text"
>
<span
class=
"gray-text noFavoriteSearch"
>
You don't have any favorite search.
</span>
<ul
data-id=
"itemViewContent"
class=
"tag-tree saveSearchList"
>
<div
class=
"fontLoader-relative"
style=
"display: block;"
>
<div
class=
"fontLoader-relative"
style=
"display: block;"
>
<i
class=
"fa fa-refresh fa-spin-custom"
></i>
<i
class=
"fa fa-refresh fa-spin-custom"
></i>
</div>
</div>
...
...
dashboardv2/public/js/utils/CommonViewFunction.js
View file @
20f2fba7
...
@@ -447,9 +447,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
...
@@ -447,9 +447,8 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
CommonViewFunction
.
generateObjectForSaveSearchApi
=
function
(
options
)
{
CommonViewFunction
.
generateObjectForSaveSearchApi
=
function
(
options
)
{
var
obj
=
{
var
obj
=
{
name
:
options
.
name
,
name
:
options
.
name
,
searchParameters
:
{
guid
:
options
.
guid
,
excludeDeletedEntities
:
true
searchParameters
:
{}
}
};
};
var
value
=
options
.
value
;
var
value
=
options
.
value
;
if
(
value
)
{
if
(
value
)
{
...
@@ -470,6 +469,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
...
@@ -470,6 +469,9 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}
}
}
}
}
}
if
(
k
==
"includeDE"
)
{
val
=
_
.
isUndefinedNull
(
val
)
?
true
:
val
;
}
obj
.
searchParameters
[
v
]
=
val
;
obj
.
searchParameters
[
v
]
=
val
;
});
});
return
obj
;
return
obj
;
...
...
dashboardv2/public/js/views/search/SearchLayoutView.js
View file @
20f2fba7
...
@@ -102,8 +102,10 @@ define(['require',
...
@@ -102,8 +102,10 @@ define(['require',
type
:
null
,
type
:
null
,
tag
:
null
,
tag
:
null
,
attributes
:
null
,
attributes
:
null
,
tagFilters
:
null
,
pageOffset
:
null
,
pageOffset
:
null
,
pageLimit
:
null
,
pageLimit
:
null
,
entityFilters
:
null
,
includeDE
:
null
includeDE
:
null
}
}
};
};
...
@@ -119,7 +121,7 @@ define(['require',
...
@@ -119,7 +121,7 @@ define(['require',
},
},
renderSaveSearch
:
function
()
{
renderSaveSearch
:
function
()
{
var
that
=
this
;
var
that
=
this
;
require
([
'views/search/SaveSearchView'
],
function
(
SaveSearchView
)
{
require
([
'views/search/
save/
SaveSearchView'
],
function
(
SaveSearchView
)
{
var
saveSearchBaiscCollection
=
new
VSearchList
(),
var
saveSearchBaiscCollection
=
new
VSearchList
(),
saveSearchAdvanceCollection
=
new
VSearchList
(),
saveSearchAdvanceCollection
=
new
VSearchList
(),
saveSearchCollection
=
new
VSearchList
();
saveSearchCollection
=
new
VSearchList
();
...
@@ -137,6 +139,7 @@ define(['require',
...
@@ -137,6 +139,7 @@ define(['require',
tagObj
=
that
.
searchTableFilters
[
'tagFilters'
],
tagObj
=
that
.
searchTableFilters
[
'tagFilters'
],
urlObj
=
Utils
.
getUrlState
.
getQueryParams
();
urlObj
=
Utils
.
getUrlState
.
getQueryParams
();
if
(
urlObj
)
{
if
(
urlObj
)
{
// includeDE value in because we need to send "true","false" to the server.
if
(
urlObj
.
includeDE
==
"true"
)
{
if
(
urlObj
.
includeDE
==
"true"
)
{
urlObj
.
includeDE
=
true
;
urlObj
.
includeDE
=
true
;
}
else
{
}
else
{
...
@@ -329,8 +332,10 @@ define(['require',
...
@@ -329,8 +332,10 @@ define(['require',
type
:
null
,
type
:
null
,
tag
:
null
,
tag
:
null
,
attributes
:
null
,
attributes
:
null
,
tagFilters
:
null
,
pageOffset
:
null
,
pageOffset
:
null
,
pageLimit
:
null
,
pageLimit
:
null
,
entityFilters
:
null
,
includeDE
:
null
includeDE
:
null
}),
param
);
}),
param
);
},
},
...
@@ -439,6 +444,7 @@ define(['require',
...
@@ -439,6 +444,7 @@ define(['require',
this
.
value
=
paramObj
;
this
.
value
=
paramObj
;
}
}
if
(
this
.
value
)
{
if
(
this
.
value
)
{
this
.
ui
.
searchInput
.
val
(
this
.
value
.
query
||
""
);
if
(
this
.
value
.
dslChecked
==
"true"
)
{
if
(
this
.
value
.
dslChecked
==
"true"
)
{
if
(
!
this
.
ui
.
searchType
.
prop
(
"checked"
))
{
if
(
!
this
.
ui
.
searchType
.
prop
(
"checked"
))
{
this
.
ui
.
searchType
.
prop
(
"checked"
,
true
).
trigger
(
"change"
);
this
.
ui
.
searchType
.
prop
(
"checked"
,
true
).
trigger
(
"change"
);
...
@@ -470,7 +476,6 @@ define(['require',
...
@@ -470,7 +476,6 @@ define(['require',
}
}
}
}
}
}
this
.
ui
.
searchInput
.
val
(
this
.
value
.
query
||
""
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
ui
.
searchInput
.
focus
();
that
.
ui
.
searchInput
.
focus
();
},
0
);
},
0
);
...
@@ -482,15 +487,11 @@ define(['require',
...
@@ -482,15 +487,11 @@ define(['require',
triggerSearch
:
function
(
value
)
{
triggerSearch
:
function
(
value
)
{
var
params
=
{
var
params
=
{
searchType
:
this
.
type
,
searchType
:
this
.
type
,
dslChecked
:
this
.
ui
.
searchType
.
is
(
':checked'
),
dslChecked
:
this
.
ui
.
searchType
.
is
(
':checked'
)
tagFilters
:
null
,
entityFilters
:
null
,
attributes
:
null
,
includeDE
:
null
}
}
this
.
query
[
this
.
type
].
type
=
this
.
ui
.
typeLov
.
select2
(
'val'
)
||
null
;
params
[
'type'
]
=
this
.
ui
.
typeLov
.
select2
(
'val'
)
||
null
;
if
(
!
this
.
dsl
)
{
if
(
!
this
.
dsl
)
{
this
.
query
[
this
.
type
].
tag
=
this
.
ui
.
tagLov
.
select2
(
'val'
)
||
null
;
params
[
'tag'
]
=
this
.
ui
.
tagLov
.
select2
(
'val'
)
||
null
;
var
entityFilterObj
=
this
.
searchTableFilters
[
'entityFilters'
],
var
entityFilterObj
=
this
.
searchTableFilters
[
'entityFilters'
],
tagFilterObj
=
this
.
searchTableFilters
[
'tagFilters'
];
tagFilterObj
=
this
.
searchTableFilters
[
'tagFilters'
];
if
(
this
.
value
.
tag
)
{
if
(
this
.
value
.
tag
)
{
...
@@ -503,25 +504,27 @@ define(['require',
...
@@ -503,25 +504,27 @@ define(['require',
if
(
columnList
)
{
if
(
columnList
)
{
params
[
'attributes'
]
=
columnList
.
join
(
','
);
params
[
'attributes'
]
=
columnList
.
join
(
','
);
}
}
if
(
this
.
value
.
includeDE
)
{
if
(
_
.
isUndefinedNull
(
this
.
value
.
includeDE
))
{
params
[
'includeDE'
]
=
false
;
}
else
{
params
[
'includeDE'
]
=
this
.
value
.
includeDE
;
params
[
'includeDE'
]
=
this
.
value
.
includeDE
;
}
}
}
}
if
(
this
.
value
.
pageLimit
)
{
if
(
this
.
value
.
pageLimit
)
{
this
.
query
[
this
.
type
].
pageLimit
=
this
.
value
.
pageLimit
;
params
[
'pageLimit'
]
=
this
.
value
.
pageLimit
;
}
}
if
(
this
.
value
.
pageOffset
)
{
if
(
this
.
value
.
pageOffset
)
{
if
(
this
.
query
[
this
.
type
].
query
&&
this
.
query
[
this
.
type
].
query
!=
value
)
{
if
(
this
.
query
[
this
.
type
].
query
&&
this
.
query
[
this
.
type
].
query
!=
value
)
{
this
.
query
[
this
.
type
].
pageOffset
=
0
;
params
[
'pageOffset'
]
=
0
;
}
else
{
}
else
{
this
.
query
[
this
.
type
].
pageOffset
=
this
.
value
.
pageOffset
;
params
[
'pageOffset'
]
=
this
.
value
.
pageOffset
;
}
}
}
}
this
.
query
[
this
.
type
].
query
=
value
||
null
;
params
[
'query'
]
=
value
||
null
;
_
.
extend
(
this
.
query
[
this
.
type
],
params
);
Utils
.
setUrl
({
Utils
.
setUrl
({
url
:
'#!/search/searchResult'
,
url
:
'#!/search/searchResult'
,
urlParams
:
_
.
extend
({},
this
.
query
[
this
.
type
]
,
params
),
urlParams
:
_
.
extend
({},
this
.
query
[
this
.
type
]),
mergeBrowserUrl
:
false
,
mergeBrowserUrl
:
false
,
trigger
:
true
,
trigger
:
true
,
updateTabState
:
true
updateTabState
:
true
...
@@ -555,10 +558,6 @@ define(['require',
...
@@ -555,10 +558,6 @@ define(['require',
this
.
$
(
'.searchText'
).
text
(
'Search By Text'
);
this
.
$
(
'.searchText'
).
text
(
'Search By Text'
);
this
.
ui
.
searchInput
.
attr
(
"placeholder"
,
"Search By Text"
);
this
.
ui
.
searchInput
.
attr
(
"placeholder"
,
"Search By Text"
);
}
}
if
(
paramObj
&&
this
.
type
==
"basic"
)
{
this
.
query
[
this
.
type
].
attributes
=
paramObj
.
attributes
?
paramObj
.
attributes
:
null
;
this
.
query
[
this
.
type
].
includeDE
=
this
.
value
.
includeDE
;
}
if
(
Utils
.
getUrlState
.
isSearchTab
())
{
if
(
Utils
.
getUrlState
.
isSearchTab
())
{
Utils
.
setUrl
({
Utils
.
setUrl
({
url
:
'#!/search/searchResult'
,
url
:
'#!/search/searchResult'
,
...
...
dashboardv2/public/js/views/search/
SaveAs
LayoutView.js
→
dashboardv2/public/js/views/search/
save/SaveModal
LayoutView.js
View file @
20f2fba7
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
define
([
'require'
,
define
([
'require'
,
'backbone'
,
'backbone'
,
'hbs!tmpl/search/
SaveAs
LayoutView_tmpl'
,
'hbs!tmpl/search/
save/SaveModal
LayoutView_tmpl'
,
'utils/Utils'
,
'utils/Utils'
,
'modules/Modal'
,
'modules/Modal'
,
'utils/UrlLinks'
,
'utils/UrlLinks'
,
...
@@ -26,31 +26,39 @@ define(['require',
...
@@ -26,31 +26,39 @@ define(['require',
'models/VSearch'
,
'models/VSearch'
,
'utils/CommonViewFunction'
,
'utils/CommonViewFunction'
,
'utils/Messages'
'utils/Messages'
],
function
(
require
,
Backbone
,
Save
As
LayoutViewTmpl
,
Utils
,
Modal
,
UrlLinks
,
platform
,
VSearch
,
CommonViewFunction
,
Messages
)
{
],
function
(
require
,
Backbone
,
Save
Modal
LayoutViewTmpl
,
Utils
,
Modal
,
UrlLinks
,
platform
,
VSearch
,
CommonViewFunction
,
Messages
)
{
var
Save
As
LayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
({
var
Save
Modal
LayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
({
_viewName
:
'Save
As
LayoutView'
,
_viewName
:
'Save
Modal
LayoutView'
,
template
:
Save
As
LayoutViewTmpl
,
template
:
Save
Modal
LayoutViewTmpl
,
regions
:
{},
regions
:
{},
ui
:
{
ui
:
{
saveAsName
:
"[data-id='saveAsName']"
saveAsName
:
"[data-id='saveAsName']"
},
},
templateHelpers
:
function
()
{
return
{
selectedModel
:
this
.
selectedModel
?
this
.
selectedModel
.
toJSON
()
:
null
};
},
events
:
function
()
{
events
:
function
()
{
var
events
=
{};
var
events
=
{};
return
events
;
return
events
;
},
},
initialize
:
function
(
options
)
{
initialize
:
function
(
options
)
{
var
that
=
this
;
var
that
=
this
;
_
.
extend
(
this
,
_
.
pick
(
options
,
'
value'
,
'collection'
,
'searchVent'
,
'typeHeaders'
,
'fetchFavioriteCollection'
,
'getValue'
,
'isBasic
'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'
selectedModel'
,
'collection'
,
'getValue'
,
'isBasic'
,
'saveObj
'
));
this
.
model
=
new
VSearch
();
this
.
model
=
new
VSearch
();
if
(
this
.
saveObj
)
{
this
.
onCreateButton
();
}
else
{
var
modal
=
new
Modal
({
var
modal
=
new
Modal
({
title
:
'Enter your search name'
,
title
:
(
this
.
selectedModel
?
'Update'
:
'Create'
)
+
' your favorite search '
+
(
this
.
selectedModel
?
'name'
:
''
)
,
content
:
this
,
content
:
this
,
cancelText
:
"Cancel"
,
cancelText
:
"Cancel"
,
okCloses
:
false
,
okCloses
:
false
,
okText
:
'Create'
,
okText
:
this
.
selectedModel
?
'Update'
:
'Create'
,
allowCancel
:
true
allowCancel
:
true
}).
open
();
}).
open
();
modal
.
$el
.
find
(
'button.ok'
).
attr
(
"disabled"
,
"true"
);
modal
.
$el
.
find
(
'button.ok'
).
attr
(
"disabled"
,
"true"
);
...
@@ -69,29 +77,55 @@ define(['require',
...
@@ -69,29 +77,55 @@ define(['require',
modal
.
on
(
'closeModal'
,
function
()
{
modal
.
on
(
'closeModal'
,
function
()
{
modal
.
trigger
(
'cancel'
);
modal
.
trigger
(
'cancel'
);
});
});
}
},
},
onCreateButton
:
function
(
modal
)
{
onCreateButton
:
function
(
modal
)
{
var
that
=
this
,
var
that
=
this
,
obj
=
{
value
:
this
.
getValue
(),
name
:
this
.
ui
.
saveAsName
.
val
()
},
obj
=
{
name
:
this
.
ui
.
saveAsName
.
val
?
this
.
ui
.
saveAsName
.
val
()
:
null
};
saveObj
=
CommonViewFunction
.
generateObjectForSaveSearchApi
(
obj
);
if
(
this
.
selectedModel
)
{
// Update Name only.
var
saveObj
=
this
.
selectedModel
.
toJSON
();
saveObj
.
name
=
obj
.
name
;
}
else
{
obj
.
value
=
this
.
getValue
();
if
(
this
.
saveObj
)
{
// Save search Filter
_
.
extend
(
obj
,
this
.
saveObj
);
}
var
saveObj
=
CommonViewFunction
.
generateObjectForSaveSearchApi
(
obj
);
if
(
this
.
isBasic
)
{
if
(
this
.
isBasic
)
{
saveObj
[
'searchType'
]
=
"BASIC"
;
saveObj
[
'searchType'
]
=
"BASIC"
;
}
else
{
}
else
{
saveObj
[
'searchType'
]
=
"ADVANCED"
;
saveObj
[
'searchType'
]
=
"ADVANCED"
;
}
}
that
.
model
.
urlRoot
=
UrlLinks
.
saveSearchApiUrl
();
}
that
.
model
.
save
(
saveObj
,
{
this
.
model
.
urlRoot
=
UrlLinks
.
saveSearchApiUrl
();
this
.
model
.
save
(
saveObj
,
{
type
:
(
saveObj
.
guid
?
'PUT'
:
'POST'
),
success
:
function
(
model
,
data
)
{
success
:
function
(
model
,
data
)
{
if
(
that
.
collection
)
{
if
(
that
.
collection
)
{
that
.
collection
.
add
(
data
);
if
(
saveObj
.
guid
)
{
var
collectionRef
=
that
.
collection
.
find
({
guid
:
data
.
guid
});
if
(
collectionRef
)
{
collectionRef
.
set
(
data
);
}
}
Utils
.
notifySuccess
({
Utils
.
notifySuccess
({
content
:
obj
.
name
+
Messages
.
editSuccessMessage
});
}
else
{
that
.
collection
.
add
(
data
);
Utils
.
notifySuccess
({
content
:
obj
.
name
+
Messages
.
addSuccessMessage
content
:
obj
.
name
+
Messages
.
addSuccessMessage
});
});
}
}
}
}
});
});
if
(
modal
)
{
modal
.
trigger
(
'cancel'
);
modal
.
trigger
(
'cancel'
);
}
}
}
});
});
return
Save
As
LayoutView
;
return
Save
Modal
LayoutView
;
});
});
\ No newline at end of file
dashboardv2/public/js/views/search/SaveSearchItemView.js
→
dashboardv2/public/js/views/search/
save/
SaveSearchItemView.js
View file @
20f2fba7
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
*/
*/
define
([
'require'
,
define
([
'require'
,
'backbone'
,
'backbone'
,
'hbs!tmpl/search/SaveSearchItemView_tmpl'
,
'hbs!tmpl/search/
save/
SaveSearchItemView_tmpl'
,
'utils/UrlLinks'
,
'utils/UrlLinks'
,
'utils/Utils'
,
'utils/Utils'
,
'utils/CommonViewFunction'
,
'utils/CommonViewFunction'
,
'utils/Messages'
'utils/Messages'
],
function
(
require
,
Backbone
,
SaveSearchItemView
_t
mpl
,
UrlLinks
,
Utils
,
CommonViewFunction
,
Messages
)
{
],
function
(
require
,
Backbone
,
SaveSearchItemView
T
mpl
,
UrlLinks
,
Utils
,
CommonViewFunction
,
Messages
)
{
'use strict'
;
'use strict'
;
return
Backbone
.
Marionette
.
ItemView
.
extend
({
return
Backbone
.
Marionette
.
ItemView
.
extend
({
template
:
SaveSearchItemView
_t
mpl
,
template
:
SaveSearchItemView
T
mpl
,
tagName
:
'li'
,
tagName
:
'li'
,
className
:
'parent-node'
,
className
:
'parent-node'
,
ui
:
{
ui
:
{
...
@@ -61,6 +61,9 @@ define(['require',
...
@@ -61,6 +61,9 @@ define(['require',
this
.
trigger
(
'item:clicked'
);
this
.
trigger
(
'item:clicked'
);
this
.
ui
.
stateChange
.
parent
(
'li'
).
addClass
(
'active'
).
siblings
().
removeClass
(
'active'
);
this
.
ui
.
stateChange
.
parent
(
'li'
).
addClass
(
'active'
).
siblings
().
removeClass
(
'active'
);
},
},
modelEvents
:
{
'change'
:
'render'
},
showToolTip
:
function
(
e
)
{
showToolTip
:
function
(
e
)
{
var
that
=
this
;
var
that
=
this
;
Utils
.
generatePopover
({
Utils
.
generatePopover
({
...
@@ -69,7 +72,8 @@ define(['require',
...
@@ -69,7 +72,8 @@ define(['require',
popoverOptions
:
{
popoverOptions
:
{
content
:
function
()
{
content
:
function
()
{
return
"<ul class='saveSearchPopoverList'>"
+
return
"<ul class='saveSearchPopoverList'>"
+
"<li class='th' ><i class='fa fa-search'></i> <a href='javascript:void(0)' data-fn='onSearch'>Search </a></li>"
+
"<li class='listTerm' ><i class='fa fa-search'></i> <a href='javascript:void(0)' data-fn='onSearch'>Search </a></li>"
+
"<li class='listTerm' ><i class='fa fa-pencil'></i> <a href='javascript:void(0)' data-fn='onRename'>Rename</a></li>"
+
"<li class='listTerm' ><i class='fa fa-trash-o'></i> <a href='javascript:void(0)' data-fn='onDelete'>Delete</a></li>"
+
"<li class='listTerm' ><i class='fa fa-trash-o'></i> <a href='javascript:void(0)' data-fn='onDelete'>Delete</a></li>"
+
"</ul>"
;
"</ul>"
;
}
}
...
@@ -95,6 +99,14 @@ define(['require',
...
@@ -95,6 +99,14 @@ define(['require',
updateTabState
:
true
updateTabState
:
true
});
});
},
},
onRename
:
function
()
{
var
that
=
this
;
require
([
'views/search/save/SaveModalLayoutView'
],
function
(
SaveModalLayoutView
)
{
new
SaveModalLayoutView
({
'selectedModel'
:
that
.
model
,
'collection'
:
that
.
collection
,
'getValue'
:
that
.
getValue
,
'isBasic'
:
that
.
isBasic
});
});
},
onDelete
:
function
()
{
onDelete
:
function
()
{
var
that
=
this
;
var
that
=
this
;
var
notifyObj
=
{
var
notifyObj
=
{
...
...
dashboardv2/public/js/views/search/SaveSearchView.js
→
dashboardv2/public/js/views/search/
save/
SaveSearchView.js
View file @
20f2fba7
...
@@ -18,18 +18,18 @@
...
@@ -18,18 +18,18 @@
define
([
'require'
,
define
([
'require'
,
'backbone'
,
'backbone'
,
'hbs!tmpl/search/
SaveSearch
_tmpl'
,
'hbs!tmpl/search/
save/SaveSearchView
_tmpl'
,
'views/search/SaveSearchItemView'
,
'views/search/
save/
SaveSearchItemView'
,
'collection/VSearchList'
,
'collection/VSearchList'
,
'utils/Utils'
,
'utils/Utils'
,
'utils/UrlLinks'
,
'utils/UrlLinks'
,
'utils/CommonViewFunction'
,
'utils/CommonViewFunction'
,
'utils/Messages'
'utils/Messages'
],
function
(
require
,
Backbone
,
SaveSearch
_
Tmpl
,
SaveSearchItemView
,
VSearchList
,
Utils
,
UrlLinks
,
CommonViewFunction
,
Messages
)
{
],
function
(
require
,
Backbone
,
SaveSearch
View
Tmpl
,
SaveSearchItemView
,
VSearchList
,
Utils
,
UrlLinks
,
CommonViewFunction
,
Messages
)
{
'use strict'
;
'use strict'
;
return
Backbone
.
Marionette
.
CompositeView
.
extend
({
return
Backbone
.
Marionette
.
CompositeView
.
extend
({
template
:
SaveSearch
_
Tmpl
,
template
:
SaveSearch
View
Tmpl
,
childView
:
SaveSearchItemView
,
childView
:
SaveSearchItemView
,
childViewContainer
:
"[data-id='itemViewContent']"
,
childViewContainer
:
"[data-id='itemViewContent']"
,
ui
:
{
ui
:
{
...
@@ -68,23 +68,22 @@ define(['require',
...
@@ -68,23 +68,22 @@ define(['require',
this
.
bindEvents
();
this
.
bindEvents
();
},
},
bindEvents
:
function
()
{
bindEvents
:
function
()
{
this
.
listenTo
(
this
.
collection
,
"
reset error"
,
function
(
model
,
response
)
{
this
.
listenTo
(
this
.
collection
,
"
add reset error"
,
function
(
model
,
collection
)
{
this
.
$
(
'.fontLoader-relative'
).
hide
();
this
.
$
(
'.fontLoader-relative'
).
hide
();
if
(
model
&&
model
.
length
)
{
if
(
this
.
collection
&&
this
.
collection
.
length
)
{
this
.
$
(
"
[data-id='itemViewContent']"
).
text
(
""
);
this
.
$
(
"
.noFavoriteSearch"
).
hide
(
);
}
else
{
}
else
{
this
.
$
(
"
[data-id='itemViewContent']"
).
text
(
"You don't have any favorite search."
)
this
.
$
(
"
.noFavoriteSearch"
).
show
();
}
}
},
this
);
},
this
);
},
},
saveAs
:
function
(
e
)
{
saveAs
:
function
(
e
)
{
var
that
=
this
,
var
value
=
this
.
getValue
();
value
=
this
.
getValue
();
if
(
value
&&
(
value
.
type
||
value
.
tag
||
value
.
query
))
{
if
(
value
&&
(
value
.
type
||
value
.
tag
||
value
.
query
))
{
require
([
this
.
callSaveModalLayoutView
({
'
views/search/SaveAsLayoutView'
'
collection'
:
this
.
collection
,
],
function
(
SaveAsLayoutView
)
{
'getValue'
:
this
.
getValue
,
new
SaveAsLayoutView
({
'value'
:
that
.
value
,
'searchVent'
:
that
.
searchVent
,
'collection'
:
that
.
collection
,
'getValue'
:
that
.
getValue
,
'isBasic'
:
that
.
isBasic
});
'isBasic'
:
this
.
isBasic
});
});
}
else
{
}
else
{
Utils
.
notifyInfo
({
Utils
.
notifyInfo
({
...
@@ -99,45 +98,33 @@ define(['require',
...
@@ -99,45 +98,33 @@ define(['require',
modal
:
true
,
modal
:
true
,
html
:
true
,
html
:
true
,
ok
:
function
(
argument
)
{
ok
:
function
(
argument
)
{
that
.
onSaveNotifyOk
(
obj
);
that
.
callSaveModalLayoutView
({
'saveObj'
:
obj
,
'collection'
:
that
.
collection
,
'getValue'
:
that
.
getValue
,
'isBasic'
:
that
.
isBasic
})
},
},
cancel
:
function
(
argument
)
{}
cancel
:
function
(
argument
)
{}
},
},
selectedEl
=
this
.
$
(
'.saveSearchList li.active'
).
find
(
'div.item'
);
selectedEl
=
this
.
$
(
'.saveSearchList li.active'
).
find
(
'div.item'
);
obj
.
name
=
selectedEl
.
find
(
'a'
).
text
();
obj
.
name
=
selectedEl
.
find
(
'a'
).
text
();
obj
.
id
=
selectedEl
.
data
(
'id'
);
obj
.
gu
id
=
selectedEl
.
data
(
'id'
);
if
(
selectedEl
&&
selectedEl
.
length
)
{
if
(
selectedEl
&&
selectedEl
.
length
)
{
notifyObj
[
'text'
]
=
Messages
.
search
.
favoriteSearch
.
save
+
" <b>"
+
obj
.
name
+
"</b> ?"
;
notifyObj
[
'text'
]
=
Messages
.
search
.
favoriteSearch
.
save
+
" <b>"
+
obj
.
name
+
"</b> ?"
;
Utils
.
notifyConfirm
(
notifyObj
);
Utils
.
notifyConfirm
(
notifyObj
);
}
else
{
}
else
{
Utils
.
notifyInfo
({
Utils
.
notifyInfo
({
content
:
Messages
.
search
.
favoriteSearch
.
notSelectedElement
content
:
Messages
.
search
.
favoriteSearch
.
notSelected
Favorite
Element
})
})
}
}
},
},
onSaveNotifyOk
:
function
(
obj
)
{
callSaveModalLayoutView
:
function
(
options
)
{
var
that
=
this
require
([
if
(
obj
&&
obj
.
id
)
{
'views/search/save/SaveModalLayoutView'
var
model
=
new
this
.
collection
.
model
();
],
function
(
SaveModalLayoutView
)
{
obj
.
value
=
this
.
getValue
();
new
SaveModalLayoutView
(
options
);
var
saveObj
=
CommonViewFunction
.
generateObjectForSaveSearchApi
(
obj
);
saveObj
[
'guid'
]
=
obj
.
id
;
model
.
urlRoot
=
UrlLinks
.
saveSearchApiUrl
();
model
.
save
(
saveObj
,
{
type
:
'PUT'
,
success
:
function
(
model
,
data
)
{
if
(
that
.
collection
)
{
var
collectionRef
=
that
.
collection
.
find
({
guid
:
data
.
guid
});
if
(
collectionRef
)
{
collectionRef
.
set
(
data
);
}
}
Utils
.
notifySuccess
({
content
:
obj
.
name
+
Messages
.
editSuccessMessage
});
}
});
});
}
}
}
});
});
});
});
\ No newline at end of file
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