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
813bab64
Commit
813bab64
authored
4 years ago
by
kevalbhatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3822:- UI changes: Audit entries for TypeDefs CREATE, UPDATE and DELETE
parent
892df242
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
322 additions
and
138 deletions
+322
-138
business-metadata.scss
dashboardv2/public/css/scss/business-metadata.scss
+21
-2
common.scss
dashboardv2/public/css/scss/common.scss
+11
-0
override.scss
dashboardv2/public/css/scss/override.scss
+10
-2
AdminAuditTableLayoutView_tmpl.html
...ic/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
+0
-3
Enums.js
dashboardv2/public/js/utils/Enums.js
+18
-1
AdminAuditTableLayoutView.js
...oardv2/public/js/views/audit/AdminAuditTableLayoutView.js
+101
-61
business-metadata.scss
dashboardv3/public/css/scss/business-metadata.scss
+21
-2
common.scss
dashboardv3/public/css/scss/common.scss
+11
-0
override.scss
dashboardv3/public/css/scss/override.scss
+10
-2
AdminAuditTableLayoutView_tmpl.html
...ic/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
+0
-3
Enums.js
dashboardv3/public/js/utils/Enums.js
+18
-1
AdminAuditTableLayoutView.js
...oardv3/public/js/views/audit/AdminAuditTableLayoutView.js
+101
-61
No files found.
dashboardv2/public/css/scss/business-metadata.scss
View file @
813bab64
...
...
@@ -90,6 +90,10 @@
.business-metadata-details
,
.admin-details
{
.tableOverlay
{
background-color
:
transparent
;
}
.expandable
.attr-details
{
max-height
:
300px
;
overflow
:
auto
;
...
...
@@ -97,8 +101,18 @@
width
:
calc
(
100%
-
30px
);
}
.admin-type-dropdown
{
width
:
100px
;
.expandable
.admin-audit-details
{
display
:
flex
;
flex-wrap
:
wrap
;
margin-left
:
20px
;
.attr-type-container
{
border
:
1px
solid
#ddd
;
border-radius
:
4px
;
padding
:
5px
10px
;
margin
:
5px
;
width
:
32%
;
}
}
.expandable
.admin-attr-details
{
...
...
@@ -108,6 +122,11 @@
}
}
.admin-details
.expandable
.admin-audit-details
.attr-type-container
{
max-height
:
200px
;
overflow
:
auto
;
}
.tab-pane
{
.business-metadata-attr-page
{
position
:
absolute
;
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/public/css/scss/common.scss
View file @
813bab64
...
...
@@ -318,4 +318,14 @@ pre {
font-size
:
11px
;
animation
:
spin
1000ms
infinite
linear
;
}
}
.attr-details
{
ul
{
list-style
:
disc
;
li
{
cursor
:
pointer
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv2/public/css/scss/override.scss
View file @
813bab64
...
...
@@ -63,13 +63,22 @@
.modal-body
{
position
:
relative
;
padding
:
15px
;
max-height
:
calc
(
100vh
-
2
00
px
);
max-height
:
calc
(
100vh
-
2
15
px
);
min-height
:
70px
;
overflow
:
auto
;
.btn
+
.btn
{
margin-bottom
:
2px
;
}
.admin-audit-details
{
border
:
1px
solid
#ddd
;
border-radius
:
4px
;
tr
>
td
:nth-child
(
2
)
{
text-align
:
right
;
}
}
}
.modal-full-screen
{
...
...
@@ -77,7 +86,6 @@
height
:
80vh
;
.modal-content
{
height
:
inherit
;
width
:
100%
;
}
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/public/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
View file @
813bab64
...
...
@@ -51,9 +51,6 @@
<div
type=
"ok"
class=
"btn btn-atlas ok"
data-id=
'attrClose'
>
Close
</div>
</div>
</div>
<div
class=
"pull-right admin-type-dropdown"
>
<select
class=
"pull-right form-controlrow-margin-bottom"
data-id=
"adminType"
></select>
</div>
</div>
<div
class=
"auditTable"
style=
"display: none"
>
<div
class=
'attr-filter-overlay hide'
></div>
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/public/js/utils/Enums.js
View file @
813bab64
...
...
@@ -41,7 +41,24 @@ define(["require", "backbone"], function(require) {
ENTITY_PURGE
:
"Entity Purged"
,
BUSINESS_ATTRIBUTE_ADD
:
"Business Attribute(s) Added"
,
BUSINESS_ATTRIBUTE_UPDATE
:
"Business Attribute(s) Updated"
,
BUSINESS_ATTRIBUTE_DELETE
:
"Business Attribute(s) Deleted"
BUSINESS_ATTRIBUTE_DELETE
:
"Business Attribute(s) Deleted"
,
TYPE_DEF_UPDATE
:
"Type Updated"
,
TYPE_DEF_CREATE
:
"Type Created"
,
TYPE_DEF_DELETE
:
"Type Deleted"
}
Enums
.
category
=
{
PRIMITIVE
:
"Primitive"
,
OBJECT_ID_TYPE
:
"Object Id type"
,
ENUM
:
"Enum"
,
STRUCT
:
"Struct"
,
CLASSIFICATION
:
"Classification"
,
ENTITY
:
"Entity"
,
ARRAY
:
"Array"
,
MAP
:
"Map"
,
RELATIONSHIP
:
"Relationship"
,
BUSINESS_METADATA
:
"Business Metadata"
,
PURGE
:
"Purge Entities"
}
Enums
.
entityStateReadOnly
=
{
...
...
This diff is collapsed.
Click to expand it.
dashboardv2/public/js/views/audit/AdminAuditTableLayoutView.js
View file @
813bab64
...
...
@@ -22,8 +22,9 @@ define(['require',
'collection/VEntityList'
,
'utils/Utils'
,
'utils/UrlLinks'
,
'utils/CommonViewFunction'
],
function
(
require
,
Backbone
,
AdminAuditTableLayoutView_tmpl
,
VEntityList
,
Utils
,
UrlLinks
,
CommonViewFunction
)
{
'utils/CommonViewFunction'
,
'utils/Enums'
],
function
(
require
,
Backbone
,
AdminAuditTableLayoutView_tmpl
,
VEntityList
,
Utils
,
UrlLinks
,
CommonViewFunction
,
Enums
)
{
'use strict'
;
var
AdminAuditTableLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
...
...
@@ -41,20 +42,21 @@ define(['require',
/** ui selector cache */
ui
:
{
admin
EntityClick
:
"[data-id='admin
Entity']"
,
admin
Type
:
"[data-id='adminType
']"
,
admin
PurgedEntityClick
:
"[data-id='adminPurged
Entity']"
,
admin
AuditEntityDetails
:
"[data-id='adminAuditEntityDetails
']"
,
attrFilter
:
"[data-id='adminAttrFilter']"
,
adminRegion
:
"[data-id='adminRegion']"
,
attrApply
:
"[data-id='attrApply']"
,
showDefault
:
"[data-id='showDefault']"
,
attrClose
:
"[data-id='attrClose']"
},
/** ui events hash */
events
:
function
()
{
var
events
=
{},
that
=
this
;
events
[
"click "
+
this
.
ui
.
admin
EntityClick
]
=
"onClickAdmin
Entity"
;
events
[
"c
hange "
+
this
.
ui
.
adminType
]
=
"onClickAdminType
"
;
events
[
"click "
+
this
.
ui
.
admin
PurgedEntityClick
]
=
"onClickAdminPurged
Entity"
;
events
[
"c
lick "
+
this
.
ui
.
adminAuditEntityDetails
]
=
"showAdminAuditEntity
"
;
events
[
"click "
+
this
.
ui
.
attrFilter
]
=
function
(
e
)
{
this
.
ui
.
attrFilter
.
find
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
this
.
$
(
'.attributeResultContainer'
).
addClass
(
"overlay"
);
...
...
@@ -104,11 +106,9 @@ define(['require',
paginatorOpts
:
{}
};
this
.
isFilters
=
null
;
this
.
adminAuditEntityData
=
{};
},
onRender
:
function
()
{
var
str
=
'<option>All</option><option>Purged</option>'
;
this
.
ui
.
adminType
.
html
(
str
);
this
.
ui
.
adminType
.
select2
({});
this
.
ui
.
adminRegion
.
hide
();
this
.
getAdminCollection
();
this
.
entityCollection
.
comparator
=
function
(
model
)
{
...
...
@@ -116,6 +116,10 @@ define(['require',
}
this
.
renderTableLayoutView
();
},
onShow
:
function
()
{
this
.
$
(
'.fontLoader'
).
show
();
this
.
$
(
'.tableOverlay'
).
show
();
},
bindEvents
:
function
()
{},
closeAttributeModel
:
function
()
{
var
that
=
this
;
...
...
@@ -133,19 +137,6 @@ define(['require',
"attributeValue"
:
(
adminFilter
.
type
==
"date"
&&
options
.
isDateParsed
)
?
Date
.
parse
(
adminFilter
.
value
).
toString
()
:
adminFilter
.
value
})
})
}
else
{
adminAttributes
=
[{
"attributeName"
:
"userName"
,
"operator"
:
"="
,
"attributeValue"
:
"admin"
}];
if
(
this
.
onlyPurged
===
true
)
{
adminAttributes
.
push
({
"attributeName"
:
"operation"
,
"operator"
:
"="
,
"attributeValue"
:
"PURGE"
})
}
}
return
adminAttributes
;
},
...
...
@@ -163,7 +154,7 @@ define(['require',
if
(
queryBuilderRef
.
data
(
"queryBuilder"
))
{
var
queryBuilder
=
queryBuilderRef
.
queryBuilder
(
"getRules"
);
if
(
queryBuilder
)
{
that
.
isFilters
=
queryBuilder
.
rules
;
that
.
isFilters
=
queryBuilder
.
rules
.
length
?
queryBuilder
.
rules
:
null
;
}
else
{
isFilterValidate
=
false
}
...
...
@@ -185,24 +176,27 @@ define(['require',
criterion
:
that
.
getAttributes
(
options
)
};
options
.
isDateParsed
=
false
;
var
auditQueryParam
=
{
condition
:
"AND"
,
criterion
:
that
.
getAttributes
(
options
)
};
that
.
searchTableFilters
[
"adminAttrFilters"
]
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
auditQueryParam
,
formatedDateToLong
:
true
});
this
.
$
(
'.fontLoader'
).
show
();
this
.
$
(
'.tableOverlay'
).
show
();
$
.
extend
(
that
.
entityCollection
.
queryParams
,
{
auditFilters
:
adminParam
});
if
(
this
.
isFilters
)
{
var
auditQueryParam
=
{
condition
:
"AND"
,
criterion
:
that
.
getAttributes
(
options
)
};
that
.
searchTableFilters
[
"adminAttrFilters"
]
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
auditQueryParam
,
formatedDateToLong
:
true
});
}
$
.
extend
(
that
.
entityCollection
.
queryParams
,
{
auditFilters
:
that
.
isFilters
?
adminParam
:
null
});
var
apiObj
=
{
sort
:
false
,
data
:
that
.
entityCollection
.
queryParams
,
success
:
function
(
dataOrCollection
,
response
)
{
that
.
entityCollection
.
state
.
pageSize
=
that
.
entityCollection
.
queryParams
.
limit
||
25
;
that
.
entityCollection
.
fullCollection
.
reset
(
dataOrCollection
,
option
);
},
complete
:
function
()
{
that
.
$
(
'.fontLoader'
).
hide
();
that
.
$
(
'.tableOverlay'
).
hide
();
that
.
$
(
'.auditTable'
).
show
();
},
silent
:
true
,
reset
:
true
}
this
.
entityCollection
.
getAdminData
(
apiObj
);
...
...
@@ -217,6 +211,14 @@ define(['require',
})));
});
},
createTableWithValues
:
function
(
tableDetails
,
isAdminAudit
)
{
var
attrTable
=
CommonViewFunction
.
propertyTable
({
scope
:
this
,
valueObject
:
tableDetails
,
fromAdminAudit
:
isAdminAudit
});
return
attrTable
;
},
getAuditTableColumns
:
function
()
{
var
that
=
this
;
return
this
.
entityCollection
.
constructor
.
getTableCols
({
...
...
@@ -230,25 +232,50 @@ define(['require',
accordion
:
false
,
alwaysVisible
:
true
,
expand
:
function
(
el
,
model
)
{
var
adminValues
=
'<div class="col-sm-6">'
,
newColumn
=
''
;
var
operation
=
model
.
get
(
'operation'
),
results
=
model
.
get
(
'result'
)
||
null
,
adminText
=
'No records found'
,
adminTypDetails
=
null
;
el
.
attr
(
'colspan'
,
'7'
);
if
(
model
.
attributes
.
params
)
{
var
guids
=
model
.
attributes
.
result
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
);
_
.
each
(
guids
,
function
(
adminGuid
,
index
)
{
if
(
index
%
5
==
0
&&
index
!=
0
)
{
adminValues
+=
'</div><div class="col-sm-6">'
;
}
adminValues
+=
'<a class="blue-link" data-id="adminEntity" >'
+
adminGuid
.
trim
()
+
'</a></br>'
;
})
adminValues
+=
'</div>'
;
}
else
{
adminValues
=
''
;
if
(
results
)
{
var
adminValues
=
null
;
if
(
operation
==
"PURGE"
)
{
adminValues
=
'<ul class="col-sm-6">'
;
var
guids
=
results
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
);
adminTypDetails
=
Enums
.
category
[
operation
];
_
.
each
(
guids
,
function
(
adminGuid
,
index
)
{
if
(
index
%
5
==
0
&&
index
!=
0
)
{
adminValues
+=
'</ul><ul class="col-sm-6">'
;
}
adminValues
+=
'<li class="blue-link" data-id="adminPurgedEntity" >'
+
adminGuid
.
trim
()
+
'</li>'
;
})
adminValues
+=
'</ul>'
;
adminText
=
'<div class="row"><div class="attr-details"><h4 style="word-break: break-word;">'
+
adminTypDetails
+
'</h4>'
+
adminValues
+
'</div></div>'
;
}
else
{
var
resultData
=
JSON
.
parse
(
results
),
typeName
=
model
.
get
(
'params'
).
split
(
','
),
typeContainer
=
''
;
_
.
each
(
typeName
,
function
(
name
)
{
var
typeData
=
resultData
[
name
],
adminValues
=
(
typeName
.
length
==
1
)
?
'<ul class="col-sm-4">'
:
'<ul>'
;
adminTypDetails
=
Enums
.
category
[
name
]
+
" "
+
Enums
.
auditAction
[
operation
];
typeContainer
+=
'<div class="attr-type-container"><h4 style="word-break: break-word;">'
+
adminTypDetails
+
'</h4>'
;
_
.
each
(
typeData
,
function
(
typeDefObj
,
index
)
{
if
(
index
%
5
==
0
&&
index
!=
0
&&
typeName
.
length
==
1
)
{
adminValues
+=
'</ul><ul class="col-sm-4">'
;
}
var
panelId
=
typeDefObj
.
name
.
split
(
" "
).
join
(
""
)
+
model
.
get
(
'startTime'
);
that
.
adminAuditEntityData
[
panelId
]
=
typeDefObj
;
adminValues
+=
'<li class="blue-link" data-id="adminAuditEntityDetails" data-auditEntityId='
+
panelId
+
'>'
+
typeDefObj
.
name
+
'</li>'
;
});
adminValues
+=
'</ul>'
;
typeContainer
+=
adminValues
+
'</div>'
;
})
var
typeClass
=
(
typeName
.
length
==
1
)
?
null
:
"admin-audit-details"
;
adminText
=
'<div class="row"><div class="attr-details '
+
typeClass
+
'">'
+
typeContainer
+
'</div></div>'
;
}
}
var
adminText
=
'<div class="row"><div class="col-sm-12 attr-details admin-attr-details"><div class="col-sm-2">Purged Entities: </div><div class="col-sm-10">'
+
adminValues
+
'</div></div></div>'
;
$
(
el
).
append
(
$
(
'<div>'
).
html
(
adminText
));
}
},
userName
:
{
...
...
@@ -292,34 +319,47 @@ define(['require',
})
}
},
this
.
entityCollection
);
},
defaultPagination
:
function
()
{
$
.
extend
(
this
.
entityCollection
.
queryParams
,
{
limit
:
this
.
limit
,
offset
:
this
.
offset
});
this
.
renderTableLayoutView
();
},
onClickAdminType
:
function
(
e
,
value
)
{
this
.
onlyPurged
=
e
.
currentTarget
.
value
===
"Purged"
;
this
.
isFilters
=
null
;
this
.
defaultPagination
();
this
.
getAdminCollection
();
showAdminAuditEntity
:
function
(
e
)
{
var
typeDefObj
=
this
.
adminAuditEntityData
[
e
.
target
.
dataset
.
auditentityid
],
typeDetails
=
this
.
createTableWithValues
(
typeDefObj
,
true
),
view
=
'<table class="table admin-audit-details bold-key" ><tbody >'
+
typeDetails
+
'</tbody></table>'
,
modalData
=
{
title
:
Enums
.
category
[
typeDefObj
.
category
]
+
" Type Details: "
+
typeDefObj
.
name
,
htmlContent
:
view
,
mainClass
:
"modal-full-screen"
,
okCloses
:
true
,
showFooter
:
false
,
width
:
"40%"
};
this
.
showModal
(
modalData
);
},
onClickAdminEntity
:
function
(
e
)
{
onClickAdmin
Purged
Entity
:
function
(
e
)
{
var
that
=
this
;
require
([
'modules/Modal'
,
'views/audit/AuditTableLayoutView'
],
function
(
Modal
,
AuditTableLayoutView
)
{
require
([
'views/audit/AuditTableLayoutView'
],
function
(
AuditTableLayoutView
)
{
var
obj
=
{
guid
:
$
(
e
.
target
).
text
(),
},
modal
=
new
Modal
(
{
modal
Data
=
{
title
:
"Purged Entity Details: "
+
obj
.
guid
,
content
:
new
AuditTableLayoutView
(
obj
),
mainClass
:
"modal-full-screen"
,
okCloses
:
true
,
showFooter
:
false
,
}).
open
();
};
that
.
showModal
(
modalData
);
});
},
showModal
:
function
(
modalObj
,
title
)
{
var
that
=
this
;
require
([
'modules/Modal'
],
function
(
Modal
)
{
var
modal
=
new
Modal
(
modalObj
).
open
();
modal
.
on
(
'closeModal'
,
function
()
{
$
(
'.modal'
).
css
({
'padding-right'
:
'0px !important'
});
modal
.
trigger
(
'cancel'
);
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/css/scss/business-metadata.scss
View file @
813bab64
...
...
@@ -90,6 +90,10 @@
.business-metadata-details
,
.admin-details
{
.tableOverlay
{
background-color
:
transparent
;
}
.expandable
.attr-details
{
max-height
:
300px
;
overflow
:
auto
;
...
...
@@ -97,8 +101,18 @@
width
:
calc
(
100%
-
30px
);
}
.admin-type-dropdown
{
width
:
100px
;
.expandable
.admin-audit-details
{
display
:
flex
;
flex-wrap
:
wrap
;
margin-left
:
20px
;
.attr-type-container
{
border
:
1px
solid
#ddd
;
border-radius
:
4px
;
padding
:
5px
10px
;
margin
:
5px
;
width
:
32%
;
}
}
.expandable
.admin-attr-details
{
...
...
@@ -108,6 +122,11 @@
}
}
.admin-details
.expandable
.admin-audit-details
.attr-type-container
{
max-height
:
200px
;
overflow
:
auto
;
}
.tab-pane
{
.business-metadata-attr-page
{
position
:
absolute
;
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/css/scss/common.scss
View file @
813bab64
...
...
@@ -317,4 +317,14 @@ pre {
font-size
:
11px
;
animation
:
spin
1000ms
infinite
linear
;
}
}
.attr-details
{
ul
{
list-style
:
disc
;
li
{
cursor
:
pointer
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/css/scss/override.scss
View file @
813bab64
...
...
@@ -67,13 +67,22 @@
.modal-body
{
position
:
relative
;
padding
:
15px
;
max-height
:
calc
(
100vh
-
2
00
px
);
max-height
:
calc
(
100vh
-
2
15
px
);
min-height
:
70px
;
overflow
:
auto
;
.btn
+
.btn
{
margin-bottom
:
2px
;
}
.admin-audit-details
{
border
:
1px
solid
#ddd
;
border-radius
:
4px
;
tr
>
td
:nth-child
(
2
)
{
text-align
:
right
;
}
}
}
.modal-full-screen
{
...
...
@@ -81,7 +90,6 @@
height
:
80vh
;
.modal-content
{
height
:
inherit
;
width
:
100%
;
}
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
View file @
813bab64
...
...
@@ -51,9 +51,6 @@
<div
type=
"ok"
class=
"btn btn-atlas ok"
data-id=
'attrClose'
>
Close
</div>
</div>
</div>
<div
class=
"pull-right admin-type-dropdown"
>
<select
class=
"pull-right form-controlrow-margin-bottom"
data-id=
"adminType"
></select>
</div>
</div>
<div
class=
"auditTable"
style=
"display: none"
>
<div
class=
'attr-filter-overlay hide'
></div>
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/utils/Enums.js
View file @
813bab64
...
...
@@ -41,7 +41,24 @@ define(["require", "backbone"], function(require) {
ENTITY_PURGE
:
"Entity Purged"
,
BUSINESS_ATTRIBUTE_ADD
:
"Business Attribute(s) Added"
,
BUSINESS_ATTRIBUTE_UPDATE
:
"Business Attribute(s) Updated"
,
BUSINESS_ATTRIBUTE_DELETE
:
"Business Attribute(s) Deleted"
BUSINESS_ATTRIBUTE_DELETE
:
"Business Attribute(s) Deleted"
,
TYPE_DEF_UPDATE
:
"Type Updated"
,
TYPE_DEF_CREATE
:
"Type Created"
,
TYPE_DEF_DELETE
:
"Type Deleted"
}
Enums
.
category
=
{
PRIMITIVE
:
"Primitive"
,
OBJECT_ID_TYPE
:
"Object Id type"
,
ENUM
:
"Enum"
,
STRUCT
:
"Struct"
,
CLASSIFICATION
:
"Classification"
,
ENTITY
:
"Entity"
,
ARRAY
:
"Array"
,
MAP
:
"Map"
,
RELATIONSHIP
:
"Relationship"
,
BUSINESS_METADATA
:
"Business Metadata"
,
PURGE
:
"Purge Entities"
}
Enums
.
entityStateReadOnly
=
{
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/audit/AdminAuditTableLayoutView.js
View file @
813bab64
...
...
@@ -22,8 +22,9 @@ define(['require',
'collection/VEntityList'
,
'utils/Utils'
,
'utils/UrlLinks'
,
'utils/CommonViewFunction'
],
function
(
require
,
Backbone
,
AdminAuditTableLayoutView_tmpl
,
VEntityList
,
Utils
,
UrlLinks
,
CommonViewFunction
)
{
'utils/CommonViewFunction'
,
'utils/Enums'
],
function
(
require
,
Backbone
,
AdminAuditTableLayoutView_tmpl
,
VEntityList
,
Utils
,
UrlLinks
,
CommonViewFunction
,
Enums
)
{
'use strict'
;
var
AdminAuditTableLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
...
...
@@ -41,20 +42,21 @@ define(['require',
/** ui selector cache */
ui
:
{
admin
EntityClick
:
"[data-id='admin
Entity']"
,
admin
Type
:
"[data-id='adminType
']"
,
admin
PurgedEntityClick
:
"[data-id='adminPurged
Entity']"
,
admin
AuditEntityDetails
:
"[data-id='adminAuditEntityDetails
']"
,
attrFilter
:
"[data-id='adminAttrFilter']"
,
adminRegion
:
"[data-id='adminRegion']"
,
attrApply
:
"[data-id='attrApply']"
,
showDefault
:
"[data-id='showDefault']"
,
attrClose
:
"[data-id='attrClose']"
},
/** ui events hash */
events
:
function
()
{
var
events
=
{},
that
=
this
;
events
[
"click "
+
this
.
ui
.
admin
EntityClick
]
=
"onClickAdmin
Entity"
;
events
[
"c
hange "
+
this
.
ui
.
adminType
]
=
"onClickAdminType
"
;
events
[
"click "
+
this
.
ui
.
admin
PurgedEntityClick
]
=
"onClickAdminPurged
Entity"
;
events
[
"c
lick "
+
this
.
ui
.
adminAuditEntityDetails
]
=
"showAdminAuditEntity
"
;
events
[
"click "
+
this
.
ui
.
attrFilter
]
=
function
(
e
)
{
this
.
ui
.
attrFilter
.
find
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
this
.
$
(
'.attributeResultContainer'
).
addClass
(
"overlay"
);
...
...
@@ -104,11 +106,9 @@ define(['require',
paginatorOpts
:
{}
};
this
.
isFilters
=
null
;
this
.
adminAuditEntityData
=
{};
},
onRender
:
function
()
{
var
str
=
'<option>All</option><option>Purged</option>'
;
this
.
ui
.
adminType
.
html
(
str
);
this
.
ui
.
adminType
.
select2
({});
this
.
ui
.
adminRegion
.
hide
();
this
.
getAdminCollection
();
this
.
entityCollection
.
comparator
=
function
(
model
)
{
...
...
@@ -116,6 +116,10 @@ define(['require',
}
this
.
renderTableLayoutView
();
},
onShow
:
function
()
{
this
.
$
(
'.fontLoader'
).
show
();
this
.
$
(
'.tableOverlay'
).
show
();
},
bindEvents
:
function
()
{},
closeAttributeModel
:
function
()
{
var
that
=
this
;
...
...
@@ -133,19 +137,6 @@ define(['require',
"attributeValue"
:
(
adminFilter
.
type
==
"date"
&&
options
.
isDateParsed
)
?
Date
.
parse
(
adminFilter
.
value
).
toString
()
:
adminFilter
.
value
})
})
}
else
{
adminAttributes
=
[{
"attributeName"
:
"userName"
,
"operator"
:
"="
,
"attributeValue"
:
"admin"
}];
if
(
this
.
onlyPurged
===
true
)
{
adminAttributes
.
push
({
"attributeName"
:
"operation"
,
"operator"
:
"="
,
"attributeValue"
:
"PURGE"
})
}
}
return
adminAttributes
;
},
...
...
@@ -163,7 +154,7 @@ define(['require',
if
(
queryBuilderRef
.
data
(
"queryBuilder"
))
{
var
queryBuilder
=
queryBuilderRef
.
queryBuilder
(
"getRules"
);
if
(
queryBuilder
)
{
that
.
isFilters
=
queryBuilder
.
rules
;
that
.
isFilters
=
queryBuilder
.
rules
.
length
?
queryBuilder
.
rules
:
null
;
}
else
{
isFilterValidate
=
false
}
...
...
@@ -185,24 +176,27 @@ define(['require',
criterion
:
that
.
getAttributes
(
options
)
};
options
.
isDateParsed
=
false
;
var
auditQueryParam
=
{
condition
:
"AND"
,
criterion
:
that
.
getAttributes
(
options
)
};
that
.
searchTableFilters
[
"adminAttrFilters"
]
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
auditQueryParam
,
formatedDateToLong
:
true
});
this
.
$
(
'.fontLoader'
).
show
();
this
.
$
(
'.tableOverlay'
).
show
();
$
.
extend
(
that
.
entityCollection
.
queryParams
,
{
auditFilters
:
adminParam
});
if
(
this
.
isFilters
)
{
var
auditQueryParam
=
{
condition
:
"AND"
,
criterion
:
that
.
getAttributes
(
options
)
};
that
.
searchTableFilters
[
"adminAttrFilters"
]
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
auditQueryParam
,
formatedDateToLong
:
true
});
}
$
.
extend
(
that
.
entityCollection
.
queryParams
,
{
auditFilters
:
that
.
isFilters
?
adminParam
:
null
});
var
apiObj
=
{
sort
:
false
,
data
:
that
.
entityCollection
.
queryParams
,
success
:
function
(
dataOrCollection
,
response
)
{
that
.
entityCollection
.
state
.
pageSize
=
that
.
entityCollection
.
queryParams
.
limit
||
25
;
that
.
entityCollection
.
fullCollection
.
reset
(
dataOrCollection
,
option
);
},
complete
:
function
()
{
that
.
$
(
'.fontLoader'
).
hide
();
that
.
$
(
'.tableOverlay'
).
hide
();
that
.
$
(
'.auditTable'
).
show
();
},
silent
:
true
,
reset
:
true
}
this
.
entityCollection
.
getAdminData
(
apiObj
);
...
...
@@ -217,6 +211,14 @@ define(['require',
})));
});
},
createTableWithValues
:
function
(
tableDetails
,
isAdminAudit
)
{
var
attrTable
=
CommonViewFunction
.
propertyTable
({
scope
:
this
,
valueObject
:
tableDetails
,
fromAdminAudit
:
isAdminAudit
});
return
attrTable
;
},
getAuditTableColumns
:
function
()
{
var
that
=
this
;
return
this
.
entityCollection
.
constructor
.
getTableCols
({
...
...
@@ -230,25 +232,50 @@ define(['require',
accordion
:
false
,
alwaysVisible
:
true
,
expand
:
function
(
el
,
model
)
{
var
adminValues
=
'<div class="col-sm-6">'
,
newColumn
=
''
;
var
operation
=
model
.
get
(
'operation'
),
results
=
model
.
get
(
'result'
)
||
null
,
adminText
=
'No records found'
,
adminTypDetails
=
null
;
el
.
attr
(
'colspan'
,
'7'
);
if
(
model
.
attributes
.
params
)
{
var
guids
=
model
.
attributes
.
result
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
);
_
.
each
(
guids
,
function
(
adminGuid
,
index
)
{
if
(
index
%
5
==
0
&&
index
!=
0
)
{
adminValues
+=
'</div><div class="col-sm-6">'
;
}
adminValues
+=
'<a class="blue-link" data-id="adminEntity" >'
+
adminGuid
.
trim
()
+
'</a></br>'
;
})
adminValues
+=
'</div>'
;
}
else
{
adminValues
=
''
;
if
(
results
)
{
var
adminValues
=
null
;
if
(
operation
==
"PURGE"
)
{
adminValues
=
'<ul class="col-sm-6">'
;
var
guids
=
results
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
);
adminTypDetails
=
Enums
.
category
[
operation
];
_
.
each
(
guids
,
function
(
adminGuid
,
index
)
{
if
(
index
%
5
==
0
&&
index
!=
0
)
{
adminValues
+=
'</ul><ul class="col-sm-6">'
;
}
adminValues
+=
'<li class="blue-link" data-id="adminPurgedEntity" >'
+
adminGuid
.
trim
()
+
'</li>'
;
})
adminValues
+=
'</ul>'
;
adminText
=
'<div class="row"><div class="attr-details"><h4 style="word-break: break-word;">'
+
adminTypDetails
+
'</h4>'
+
adminValues
+
'</div></div>'
;
}
else
{
var
resultData
=
JSON
.
parse
(
results
),
typeName
=
model
.
get
(
'params'
).
split
(
','
),
typeContainer
=
''
;
_
.
each
(
typeName
,
function
(
name
)
{
var
typeData
=
resultData
[
name
],
adminValues
=
(
typeName
.
length
==
1
)
?
'<ul class="col-sm-4">'
:
'<ul>'
;
adminTypDetails
=
Enums
.
category
[
name
]
+
" "
+
Enums
.
auditAction
[
operation
];
typeContainer
+=
'<div class="attr-type-container"><h4 style="word-break: break-word;">'
+
adminTypDetails
+
'</h4>'
;
_
.
each
(
typeData
,
function
(
typeDefObj
,
index
)
{
if
(
index
%
5
==
0
&&
index
!=
0
&&
typeName
.
length
==
1
)
{
adminValues
+=
'</ul><ul class="col-sm-4">'
;
}
var
panelId
=
typeDefObj
.
name
.
split
(
" "
).
join
(
""
)
+
model
.
get
(
'startTime'
);
that
.
adminAuditEntityData
[
panelId
]
=
typeDefObj
;
adminValues
+=
'<li class="blue-link" data-id="adminAuditEntityDetails" data-auditEntityId='
+
panelId
+
'>'
+
typeDefObj
.
name
+
'</li>'
;
});
adminValues
+=
'</ul>'
;
typeContainer
+=
adminValues
+
'</div>'
;
})
var
typeClass
=
(
typeName
.
length
==
1
)
?
null
:
"admin-audit-details"
;
adminText
=
'<div class="row"><div class="attr-details '
+
typeClass
+
'">'
+
typeContainer
+
'</div></div>'
;
}
}
var
adminText
=
'<div class="row"><div class="col-sm-12 attr-details admin-attr-details"><div class="col-sm-2">Purged Entities: </div><div class="col-sm-10">'
+
adminValues
+
'</div></div></div>'
;
$
(
el
).
append
(
$
(
'<div>'
).
html
(
adminText
));
}
},
userName
:
{
...
...
@@ -292,34 +319,47 @@ define(['require',
})
}
},
this
.
entityCollection
);
},
defaultPagination
:
function
()
{
$
.
extend
(
this
.
entityCollection
.
queryParams
,
{
limit
:
this
.
limit
,
offset
:
this
.
offset
});
this
.
renderTableLayoutView
();
},
onClickAdminType
:
function
(
e
,
value
)
{
this
.
onlyPurged
=
e
.
currentTarget
.
value
===
"Purged"
;
this
.
isFilters
=
null
;
this
.
defaultPagination
();
this
.
getAdminCollection
();
showAdminAuditEntity
:
function
(
e
)
{
var
typeDefObj
=
this
.
adminAuditEntityData
[
e
.
target
.
dataset
.
auditentityid
],
typeDetails
=
this
.
createTableWithValues
(
typeDefObj
,
true
),
view
=
'<table class="table admin-audit-details bold-key" ><tbody >'
+
typeDetails
+
'</tbody></table>'
,
modalData
=
{
title
:
Enums
.
category
[
typeDefObj
.
category
]
+
" Type Details: "
+
typeDefObj
.
name
,
htmlContent
:
view
,
mainClass
:
"modal-full-screen"
,
okCloses
:
true
,
showFooter
:
false
,
width
:
"40%"
};
this
.
showModal
(
modalData
);
},
onClickAdminEntity
:
function
(
e
)
{
onClickAdmin
Purged
Entity
:
function
(
e
)
{
var
that
=
this
;
require
([
'modules/Modal'
,
'views/audit/AuditTableLayoutView'
],
function
(
Modal
,
AuditTableLayoutView
)
{
require
([
'views/audit/AuditTableLayoutView'
],
function
(
AuditTableLayoutView
)
{
var
obj
=
{
guid
:
$
(
e
.
target
).
text
(),
},
modal
=
new
Modal
(
{
modal
Data
=
{
title
:
"Purged Entity Details: "
+
obj
.
guid
,
content
:
new
AuditTableLayoutView
(
obj
),
mainClass
:
"modal-full-screen"
,
okCloses
:
true
,
showFooter
:
false
,
}).
open
();
};
that
.
showModal
(
modalData
);
});
},
showModal
:
function
(
modalObj
,
title
)
{
var
that
=
this
;
require
([
'modules/Modal'
],
function
(
Modal
)
{
var
modal
=
new
Modal
(
modalObj
).
open
();
modal
.
on
(
'closeModal'
,
function
()
{
$
(
'.modal'
).
css
({
'padding-right'
:
'0px !important'
});
modal
.
trigger
(
'cancel'
);
...
...
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