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
ffd2e2b5
Commit
ffd2e2b5
authored
5 years ago
by
kevalbhatt
Committed by
nixonrodrigues
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3657 : UI: changes for entity purge audits
Signed-off-by:
nixonrodrigues
<
nixon@apache.org
>
parent
506ffc97
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
538 additions
and
675 deletions
+538
-675
business-metadata.scss
dashboardv3/public/css/scss/business-metadata.scss
+12
-2
override.scss
dashboardv3/public/css/scss/override.scss
+1
-1
VEntityList.js
dashboardv3/public/js/collection/VEntityList.js
+8
-0
Router.js
dashboardv3/public/js/router/Router.js
+1
-1
AdministratorLayoutView_tmpl.html
...templates/administrator/AdministratorLayoutView_tmpl.html
+7
-1
AdminAuditTableLayoutView_tmpl.html
...ic/js/templates/audit/AdminAuditTableLayoutView_tmpl.html
+44
-87
CreateAuditTableLayoutView_tmpl.html
...c/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
+1
-1
Enums.js
dashboardv3/public/js/utils/Enums.js
+2
-1
UrlLinks.js
dashboardv3/public/js/utils/UrlLinks.js
+2
-2
Utils.js
dashboardv3/public/js/utils/Utils.js
+6
-0
AdministratorLayoutView.js
.../public/js/views/administrator/AdministratorLayoutView.js
+13
-2
PurgeAuditTableLayoutView.js
...ublic/js/views/administrator/PurgeAuditTableLayoutView.js
+0
-518
AdminAuditTableLayoutView.js
...oardv3/public/js/views/audit/AdminAuditTableLayoutView.js
+370
-0
CreateAuditTableLayoutView.js
...ardv3/public/js/views/audit/CreateAuditTableLayoutView.js
+3
-2
QueryBuilderView.js
dashboardv3/public/js/views/search/QueryBuilderView.js
+68
-57
No files found.
dashboardv3/public/css/scss/business-metadata.scss
View file @
ffd2e2b5
...
...
@@ -67,14 +67,24 @@
}
}
.business-metadata-details
{
.business-metadata-details
,
.admin-details
{
.expandable
.attr-details
{
max-height
:
300px
;
overflow
:
auto
;
margin-left
:
30px
;
width
:
calc
(
100%
-
30px
);
}
.admin-type-dropdown
{
width
:
100px
;
}
.expandable
.admin-attr-details
{
max-height
:
100px
;
margin-left
:
20px
;
width
:
calc
(
100%
-
27px
);
}
}
.tab-pane
{
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/css/scss/override.scss
View file @
ffd2e2b5
...
...
@@ -249,7 +249,7 @@
overflow-x
:
hidden
;
}
.
purge
-details
{
.
admin
-details
{
.tab-pane.active
{
min-height
:
400px
;
}
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/collection/VEntityList.js
View file @
ffd2e2b5
...
...
@@ -54,6 +54,14 @@ define(['require',
}
catch
(
e
)
{
console
.
log
(
e
);
}
},
getAdminData
:
function
(
options
)
{
var
url
=
UrlLinks
.
adminApiUrl
();
options
=
_
.
extend
({
contentType
:
'application/json'
,
dataType
:
'json'
},
options
);
return
this
.
constructor
.
nonCrudOperation
.
call
(
this
,
url
,
'POST'
,
options
);
}
},
//Static Class Members
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/router/Router.js
View file @
ffd2e2b5
...
...
@@ -486,7 +486,7 @@ define([
var
that
=
this
;
require
([
"views/site/Header"
,
"views/site/SideNavLayoutView"
,
'views/administrator/AdministratorLayoutView'
],
function
(
Header
,
SideNavLayoutView
,
AdministratorLayoutView
)
{
var
value
=
Utils
.
getUrlState
.
getQueryParams
(),
paramObj
=
_
.
extend
({
value
:
value
,
guid
:
null
},
that
.
preFetchedCollectionLists
);
paramObj
=
_
.
extend
({
value
:
value
,
guid
:
null
},
that
.
preFetchedCollectionLists
,
that
.
sharedObj
);
that
.
renderViewIfNotExists
(
that
.
getHeaderOptions
(
Header
));
that
.
renderViewIfNotExists
({
view
:
App
.
rSideNav
,
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/templates/administrator/AdministratorLayoutView_tmpl.html
View file @
ffd2e2b5
...
...
@@ -22,11 +22,12 @@
<ul
class=
"nav nav-tabs"
data-id=
"tab-list"
>
<li
role=
"businessMetadata"
class=
"tab active"
><a
href=
"#tab-businessMetadata"
aria-controls=
"tab-businessMetadata"
role=
"tab"
data-toggle=
"tab"
>
Business Metadata
</a></li>
<li
role=
"enum"
><a
href=
"#tab-enum"
aria-controls=
"tab-enum"
role=
"tab"
data-toggle=
"tab"
>
Enumerations
</a></li>
<li
role=
"admin"
><a
href=
"#tab-admin"
aria-controls=
"tab-admin"
role=
"tab"
data-toggle=
"tab"
>
Audits
</a></li>
</ul>
</div>
</div>
<div>
<div
class=
"tab-content
purge
-details"
>
<div
class=
"tab-content
admin
-details"
>
<div
id=
"tab-businessMetadata"
role=
"businessMetadata"
class=
"tab-pane active animated fadeIn"
>
<div
id=
"r_businessMetadataTableLayoutView"
>
</div>
...
...
@@ -35,6 +36,10 @@
<div
id=
"r_enumTableLayoutView"
>
</div>
</div>
<div
id=
"tab-admin"
role=
"admin"
class=
"tab-pane animated fadeIn"
>
<div
id=
"r_adminTableLayoutView"
>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/templates/a
dministrator/Purge
AuditTableLayoutView_tmpl.html
→
dashboardv3/public/js/templates/a
udit/Admin
AuditTableLayoutView_tmpl.html
View file @
ffd2e2b5
...
...
@@ -14,107 +14,65 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<div
class=
"page-title clearfix"
>
<!-- <div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i>
</div> -->
<div
class=
"row"
>
<div
class=
"col-sm-12 default-tab"
>
<ul
class=
"nav nav-tabs"
data-id=
"tab-list"
>
<li
role=
"purgeaudit"
class=
"tab active"
><a
href=
"#tab-audit"
aria-controls=
"tab-audit"
role=
"tab"
data-toggle=
"tab"
>
Audits
</a></li>
<li
role=
"namespace"
><a
href=
"#tab-namespace"
aria-controls=
"tab-namespace"
role=
"tab"
data-toggle=
"tab"
>
Namespace
</a></li>
</ul>
</div>
</div>
</div>
<div>
<div
class=
"tab-content purge-details"
>
<div
id=
"tab-audit"
role=
"purgeaudit"
class=
"tab-pane active animated fadeIn"
>
<div
id=
"r_auditTableLayoutView"
>
<div
class=
"fontLoader-relative"
>
<div
class=
"tab-content admin-details"
>
<div
id=
"tab-audit"
role=
"adminaudit"
>
<div
id=
"r_auditTableLayoutView"
>
<div
class=
"fontLoader-relative"
>
<i
class=
"fa fa-refresh fa-spin-custom"
></i>
</div>
<div
class=
"position-relative"
>
<div
class=
"tableOverlay"
></div>
<!-- Not for table Loader its only for initial loading -->
<div
class=
"fontLoader"
>
<i
class=
"fa fa-refresh fa-spin-custom"
></i>
</div>
<div
class=
"position-relative"
>
<div
class=
"tableOverlay"
></div>
<!-- Not for table Loader its only for initial loading -->
<div
class=
"fontLoader"
>
<i
class=
"fa fa-refresh fa-spin-custom"
></i>
</div>
<div
class=
"attributeResultContainer form-group "
>
<button
class=
"btn-action btn-sm attribute-filter-text"
data-id=
'purgeAttrFilter'
>
<i
class=
"fa fa-angle-right"
></i>
Filters
</button>
<div
class=
"attribute-filter-container hide"
>
<div
class=
"panel panel-default expand_collapse_panel-icon"
data-id=
"purgeRegion"
>
<div
class=
"panel-heading"
data-toggle=
"collapse"
href=
"#collapsePurge"
aria-expanded=
"true"
>
<h4
class=
"panel-title"
>
<a>
Purge
</a>
</h4>
<div
class=
"btn-group pull-right"
>
<button
type=
"button"
title=
"Collapse"
><i
class=
"ec-icon fa"
></i></button>
</div>
<div
class=
"attributeResultContainer form-group "
>
<button
class=
"btn-action btn-sm attribute-filter-text"
data-id=
'adminAttrFilter'
>
<i
class=
"fa fa-angle-right"
></i>
Filters
</button>
<div
class=
"attribute-filter-container hide"
>
<div
class=
"panel panel-default expand_collapse_panel-icon"
data-id=
"adminRegion"
>
<div
class=
"panel-heading"
data-toggle=
"collapse"
href=
"#collapseAdmin"
aria-expanded=
"true"
>
<h4
class=
"panel-title"
>
<a>
Admin
</a>
</h4>
<div
class=
"btn-group pull-right"
>
<button
type=
"button"
title=
"Collapse"
><i
class=
"ec-icon fa"
></i></button>
</div>
<div
id=
"collapsePurge"
class=
"panel-collapse collapse in"
>
<div
class=
"panel-body
"
>
<div
id=
'r_attributeQueryBuilderPurge'
class=
'attribute-querybuilder'
>
<div
class=
'fontLoader'
><i
class=
'fa fa-refresh fa-spin-custom'
></i></div
>
</div>
</div
>
<div
id=
"collapseAdmin"
class=
"panel-collapse collapse in
"
>
<div
class=
"panel-body"
>
<div
id=
'r_attributeQueryBuilderAdmin'
class=
'attribute-querybuilder'
>
<
div
class=
'fontLoader'
><i
class=
'fa fa-refresh fa-spin-custom'
></i><
/div>
</div>
</div>
</div>
<div
class=
'attribute-result-footer'
>
<div
type=
"ok"
class=
"btn btn-atlas ok search"
data-id=
'attrApply'
>
Apply
</div>
<div
type=
"ok"
class=
"btn btn-atlas ok"
data-id=
'attrClose'
>
Close
</div>
</div>
</div>
<div
class=
"pull-right"
>
<select
class=
"pull-right form-controlrow-margin-bottom"
data-id=
"purgeType"
></select>
<div
class=
'attribute-result-footer'
>
<div
type=
"ok"
class=
"btn btn-atlas ok search"
data-id=
'attrApply'
>
Apply
</div>
<div
type=
"ok"
class=
"btn btn-atlas ok"
data-id=
'attrClose'
>
Close
</div>
</div>
</div>
<div
class=
'attr-filter-overlay hide'
></div>
<div
class=
"auditTable"
style=
"display: none"
>
<div
id=
"r_purgeAuditTableLayoutView"
></div>
<div>
<span
class=
"labelShowRecord pull-left"
data-id=
"pageRecordText"
></span>
</div>
<div
class=
"pagination-box"
>
<div
class=
"backgrid-paginator pull-right"
>
<ul>
<li>
<button
type=
"button"
data-id=
"previousAuditData"
title=
"Previous"
disabled=
true
>
<i
class=
"fa fa-angle-left"
aria-hidden=
"true"
></i>
</button>
</li>
<li
class=
"active"
>
<a
href=
"javascript:void(0)"
data-id=
"activePage"
></a>
</li>
<li>
<button
type=
"button"
data-id=
"nextAuditData"
title=
"Next"
>
<i
class=
"fa fa-angle-right"
aria-hidden=
"true"
></i>
</button>
</li>
</ul>
</div>
</div>
<div
class=
"pull-right admin-type-dropdown"
>
<select
class=
"pull-right form-controlrow-margin-bottom"
data-id=
"adminType"
></select>
</div>
</div>
</div>
<div
class=
"no-data"
data-id=
"showDefault"
>
<div
class=
"position-relative thick-border"
>
<div
style=
"padding-top: 20px; "
class=
"table-responsive tableBorder"
>
<table
class=
"table table-hover backgrid table-quickMenu"
>
<tbody>
<tr
class=
"empty"
>
<td
colspan=
"16"
><span>
No Records found!
</span></td>
</tr>
</tbody>
</table>
</div>
<div
class=
"auditTable"
style=
"display: none"
>
<div
class=
'attr-filter-overlay hide'
></div>
<div
id=
"r_adminAuditTableLayoutView"
></div>
</div>
</div>
</div>
<div
id=
"tab-namespace"
role=
"namespace"
class=
"tab-pane animated fadeIn"
>
<div
id=
"r_namespaceTableLayoutView"
>
<div
class=
"no-data"
data-id=
"showDefault"
>
<div
class=
"position-relative thick-border"
>
<div
style=
"padding-top: 20px; "
class=
"table-responsive tableBorder"
>
<table
class=
"table table-hover backgrid table-quickMenu"
>
<tbody>
<tr
class=
"empty"
>
<td
colspan=
"16"
><span>
No Records found!
</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/templates/audit/CreateAuditTableLayoutView_tmpl.html
View file @
ffd2e2b5
...
...
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<h4
class=
"entity-name"
style=
"word-break: break-word;"
>
Name:
<span
data-id=
"name"
></span></h4>
<h4
class=
"entity-name"
style=
"word-break: break-word;"
data-id=
"nameContainer"
>
Name:
<span
data-id=
"name"
></span></h4>
<div
class=
"panel-group server-stats-container auditStatusContainer clearfix"
id=
"accordion"
>
<div
class=
"panel panel-default custom-panel expand_collapse_panel-icon hide col-sm-5"
data-id=
"detailsAttribute"
>
<div
class=
"panel-heading"
data-toggle=
"collapse"
href=
"#detailAttributeTableCollapse"
aria-expanded=
"true"
>
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/utils/Enums.js
View file @
ffd2e2b5
...
...
@@ -212,4 +212,4 @@ define(['require'], function(require) {
1
:
"true"
};
return
Enums
;
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/utils/UrlLinks.js
View file @
ffd2e2b5
...
...
@@ -227,8 +227,8 @@ define(['require', 'utils/Enums', 'utils/Utils', 'underscore'], function(require
sessionApiUrl
:
function
()
{
return
this
.
baseUrl
+
'/admin/session'
;
},
purge
ApiUrl
:
function
()
{
return
this
.
baseUrl
+
'/admin/audit'
;
admin
ApiUrl
:
function
()
{
return
this
.
baseUrl
+
'/admin/audit
s
'
;
}
});
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/utils/Utils.js
View file @
ffd2e2b5
...
...
@@ -411,6 +411,12 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
matchString
:
"detailPage"
});
},
isPurgePage
:
function
(
url
)
{
return
this
.
checkTabUrl
({
url
:
url
,
matchString
:
"purge"
});
},
getLastValue
:
function
()
{
return
this
.
getQueryUrl
().
lastValue
;
},
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/administrator/AdministratorLayoutView.js
View file @
ffd2e2b5
...
...
@@ -38,7 +38,8 @@ define(['require',
/** Layout sub regions */
regions
:
{
RBusinessMetadataTableLayoutView
:
"#r_businessMetadataTableLayoutView"
,
REnumTableLayoutView
:
'#r_enumTableLayoutView'
REnumTableLayoutView
:
'#r_enumTableLayoutView'
,
RAdminTableLayoutView
:
'#r_adminTableLayoutView'
},
/** ui selector cache */
...
...
@@ -67,7 +68,7 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'
guid'
,
'entityDefCollection'
,
'businessMetadataDefCollection'
,
'enumDefCollection
'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'
entityDefCollection'
,
'businessMetadataDefCollection'
,
'enumDefCollection'
,
'searchTableFilters
'
));
},
onShow
:
function
()
{
...
...
@@ -79,6 +80,7 @@ define(['require',
},
bindEvents
:
function
()
{
this
.
renderEnumLayoutView
();
this
.
renderAdminLayoutView
();
},
onRender
:
function
()
{
this
.
renderBusinessMetadataLayoutView
();
...
...
@@ -99,6 +101,15 @@ define(['require',
});
that
.
REnumTableLayoutView
.
show
(
view
);
});
},
renderAdminLayoutView
:
function
(
obj
)
{
var
that
=
this
;
require
([
"views/audit/AdminAuditTableLayoutView"
],
function
(
AdminAuditTableLayoutView
)
{
var
view
=
new
AdminAuditTableLayoutView
({
searchTableFilters
:
that
.
searchTableFilters
});
that
.
RAdminTableLayoutView
.
show
(
view
);
});
}
});
return
AdministratorLayoutView
;
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/administrator/PurgeAuditTableLayoutView.js
deleted
100644 → 0
View file @
506ffc97
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define
([
'require'
,
'backbone'
,
'hbs!tmpl/audit/PurgeAuditTableLayoutView_tmpl'
,
'collection/VEntityList'
,
'models/VSearch'
,
'utils/Utils'
,
'utils/Enums'
,
'utils/UrlLinks'
,
'utils/CommonViewFunction'
],
function
(
require
,
Backbone
,
PurgeAuditTableLayoutView_tmpl
,
VEntityList
,
VSearch
,
Utils
,
Enums
,
UrlLinks
,
CommonViewFunction
)
{
'use strict'
;
var
PurgeAuditTableLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
/** @lends AuditTableLayoutView */
{
_viewName
:
'PurgeAuditTableLayoutView'
,
template
:
PurgeAuditTableLayoutView_tmpl
,
/** Layout sub regions */
regions
:
{
RAuditTableLayoutView
:
"#r_purgeAuditTableLayoutView"
,
RQueryBuilderPurge
:
"#r_attributeQueryBuilderPurge"
,
RNamespaceTableLayoutView
:
"#r_namespaceTableLayoutView"
},
/** ui selector cache */
ui
:
{
auditCreate
:
"[data-id='auditCreate']"
,
previousAuditData
:
"[data-id='previousAuditData']"
,
nextAuditData
:
"[data-id='nextAuditData']"
,
pageRecordText
:
"[data-id='pageRecordText']"
,
activePage
:
"[data-id='activePage']"
,
purgeEntityClick
:
"[data-id='purgeEntity']"
,
purgeType
:
"[data-id='purgeType']"
,
attrFilter
:
"[data-id='purgeAttrFilter']"
,
purgeRegion
:
"[data-id='purgeRegion']"
,
attrApply
:
"[data-id='attrApply']"
,
showDefault
:
"[data-id='showDefault']"
,
attrClose
:
"[data-id='attrClose']"
,
tablist
:
'[data-id="tab-list"] li'
},
/** ui events hash */
events
:
function
()
{
var
events
=
{},
that
=
this
;
events
[
"click "
+
this
.
ui
.
purgeEntityClick
]
=
"onClickPurgeEntity"
;
events
[
"change "
+
this
.
ui
.
purgeType
]
=
"onClickPurgeType"
;
events
[
"click "
+
this
.
ui
.
nextAuditData
]
=
"onClickNextAuditData"
;
events
[
"click "
+
this
.
ui
.
previousAuditData
]
=
"onClickPreviousAuditData"
;
events
[
"click "
+
this
.
ui
.
attrFilter
]
=
function
(
e
)
{
// this.$('.fa-chevron-right').toggleClass('fa-chevron-down');
this
.
$
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
this
.
$
(
'.attributeResultContainer'
).
addClass
(
"overlay"
);
this
.
$
(
'.attribute-filter-container, .attr-filter-overlay'
).
toggleClass
(
'hide'
);
// this.$('.attribute-filter-container').toggleClass('attribute-filter-container')
this
.
onClickAttrFilter
();
};
events
[
"click "
+
this
.
ui
.
attrClose
]
=
function
(
e
)
{
that
.
closeAttributeModel
();
};
events
[
"click "
+
this
.
ui
.
attrApply
]
=
function
(
e
)
{
that
.
okAttrFilterButton
(
e
);
};
events
[
"click "
+
this
.
ui
.
tablist
]
=
function
(
e
)
{
var
tabValue
=
$
(
e
.
currentTarget
).
attr
(
'role'
);
Utils
.
setUrl
({
url
:
Utils
.
getUrlState
.
getQueryUrl
().
queyParams
[
0
],
urlParams
:
{
tabActive
:
tabValue
||
'properties'
},
mergeBrowserUrl
:
false
,
trigger
:
false
,
updateTabState
:
true
});
};
return
events
;
},
/**
* intialize a new AuditTableLayoutView Layout
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'value'
,
'guid'
,
'entity'
,
'entityName'
,
'attributeDefs'
,
'nameSpaceCollection'
));
this
.
entityCollection
=
new
VEntityList
();
this
.
limit
=
26
;
this
.
entityCollection
.
url
=
UrlLinks
.
purgeApiUrl
();
this
.
entityCollection
.
modelAttrName
=
"events"
;
this
.
entityModel
=
new
this
.
entityCollection
.
model
();
this
.
pervOld
=
[];
this
.
onlyPurge
=
true
;
this
.
commonTableOptions
=
{
collection
:
this
.
entityCollection
,
includeFilter
:
false
,
includePagination
:
false
,
includePageSize
:
false
,
includeAtlasTableSorting
:
true
,
includeFooterRecords
:
false
,
gridOpts
:
{
className
:
"table table-hover backgrid table-quickMenu"
,
emptyText
:
'No records found!'
},
filterOpts
:
{},
paginatorOpts
:
{}
};
this
.
currPage
=
1
;
this
.
isFilters
=
null
;
this
.
purgeAttrFilters
=
[{
"id"
:
"startTime"
,
"label"
:
"startTime (date)"
,
"operators"
:
[
"="
,
"!="
,
">"
,
"<"
,
">="
,
"<="
],
"optgroup"
:
"Select Purge Attribute"
,
"plugin"
:
"daterangepicker"
,
"plugin_config"
:
{
"locale"
:
{
"format"
:
"MM/DD/YYYY h:mm A"
},
"showDropdowns"
:
true
,
"singleDatePicker"
:
true
,
"timePicker"
:
true
},
"type"
:
"date"
},
{
"id"
:
"endTime"
,
"label"
:
"endTime (date)"
,
"operators"
:
[
"="
,
"!="
,
">"
,
"<"
,
">="
,
"<="
],
"optgroup"
:
"Select Purge Attribute"
,
"plugin"
:
"daterangepicker"
,
"plugin_config"
:
{
"locale"
:
{
"format"
:
"MM/DD/YYYY h:mm A"
},
"showDropdowns"
:
true
,
"singleDatePicker"
:
true
,
"timePicker"
:
true
},
"type"
:
"date"
}]
},
onRender
:
function
()
{
var
str
=
'<option>All</option><option>Purge</option>'
;
this
.
ui
.
purgeType
.
html
(
str
);
this
.
ui
.
purgeType
.
select2
({});
this
.
bindEvents
();
this
.
ui
.
purgeRegion
.
hide
();
this
.
getPurgeParam
();
this
.
entityCollection
.
comparator
=
function
(
model
)
{
return
-
model
.
get
(
'timestamp'
);
}
},
onShow
:
function
()
{
if
(
this
.
value
&&
this
.
value
.
tabActive
)
{
this
.
$
(
'.nav.nav-tabs'
).
find
(
'[role="'
+
this
.
value
.
tabActive
+
'"]'
).
addClass
(
'active'
).
siblings
().
removeClass
(
'active'
);
this
.
$
(
'.tab-content'
).
find
(
'[role="'
+
this
.
value
.
tabActive
+
'"]'
).
addClass
(
'active'
).
siblings
().
removeClass
(
'active'
);
$
(
"html, body"
).
animate
({
scrollTop
:
(
this
.
$
(
'.tab-content'
).
offset
().
top
+
1200
)
},
1000
);
}
},
bindEvents
:
function
()
{
this
.
renderNameSpaceLayoutView
();
},
renderNameSpaceLayoutView
:
function
(
obj
)
{
var
that
=
this
;
require
([
'views/name_space/AllNameSpaceTableLayoutView'
],
function
(
AllNameSpaceTableLayoutView
)
{
that
.
RNamespaceTableLayoutView
.
show
(
new
AllNameSpaceTableLayoutView
({
nameSpaceCollection
:
that
.
nameSpaceCollection
}));
});
},
getToOffset
:
function
()
{
return
((
this
.
limit
-
1
)
*
this
.
currPage
);
},
getFromOffset
:
function
(
toOffset
)
{
// +2 because of toOffset is alrady in minus and limit is +1;
return
((
toOffset
-
this
.
limit
)
+
2
);
},
renderOffset
:
function
(
options
)
{
var
entityLength
;
if
(
options
.
nextClick
)
{
options
.
previous
.
removeAttr
(
"disabled"
);
if
(
this
.
entityCollection
.
length
!=
0
)
{
this
.
currPage
++
;
}
}
else
if
(
options
.
previousClick
)
{
options
.
next
.
removeAttr
(
"disabled"
);
if
(
this
.
currPage
>
1
&&
this
.
entityCollection
.
models
.
length
)
{
this
.
currPage
--
;
}
}
if
(
this
.
entityCollection
.
models
.
length
===
this
.
limit
)
{
// Because we have 1 extra record.
entityLength
=
this
.
entityCollection
.
models
.
length
-
1
;
}
else
{
entityLength
=
this
.
entityCollection
.
models
.
length
}
this
.
ui
.
activePage
.
attr
(
'title'
,
"Page "
+
this
.
currPage
);
this
.
ui
.
activePage
.
text
(
this
.
currPage
);
var
toOffset
=
this
.
getToOffset
();
this
.
ui
.
pageRecordText
.
html
(
"Showing <u>"
+
entityLength
+
" records</u> From "
+
this
.
getFromOffset
(
toOffset
)
+
" - "
+
toOffset
);
},
getPurgeParam
:
function
()
{
var
that
=
this
;
that
.
fetchCollection
({
next
:
that
.
ui
.
nextAuditData
,
nextClick
:
false
,
previous
:
that
.
ui
.
previousAuditData
,
isPurge
:
that
.
onlyPurge
});
},
closeAttributeModel
:
function
()
{
var
that
=
this
;
that
.
$
(
'.attributeResultContainer'
).
removeClass
(
"overlay"
);
that
.
$
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
that
.
$
(
'.attribute-filter-container, .attr-filter-overlay'
).
toggleClass
(
'hide'
);
},
getAttributes
:
function
()
{
var
purgeAttributes
=
[{
"attributeName"
:
"operation"
,
"operator"
:
"like"
,
"attributeValue"
:
"PURGE"
}];
if
(
!
this
.
onlyPurge
)
{
purgeAttributes
.
push
({
"attributeName"
:
"userName"
,
"operator"
:
"like"
,
"attributeValue"
:
"admin"
})
}
if
(
this
.
isFilters
)
{
_
.
each
(
this
.
isFilters
,
function
(
purgeFilter
)
{
purgeAttributes
.
push
({
"attributeName"
:
purgeFilter
.
id
,
"operator"
:
purgeFilter
.
operator
,
"attributeValue"
:
Date
.
parse
(
purgeFilter
.
value
).
toString
(),
})
})
this
.
isFilters
=
null
;
}
return
purgeAttributes
;
},
renderQueryBuilder
:
function
(
obj
,
rQueryBuilder
)
{
var
that
=
this
;
require
([
'views/search/QueryBuilderView'
],
function
(
QueryBuilderView
)
{
rQueryBuilder
.
show
(
new
QueryBuilderView
(
obj
));
});
},
onClickAttrFilter
:
function
()
{
var
that
=
this
;
this
.
ui
.
purgeRegion
.
show
();
require
([
'views/search/QueryBuilderView'
],
function
(
QueryBuilderView
)
{
that
.
RQueryBuilderPurge
.
show
(
new
QueryBuilderView
({
purgeAttrFilters
:
that
.
purgeAttrFilters
}));
});
},
okAttrFilterButton
:
function
(
options
)
{
var
that
=
this
,
isFilterValidate
=
true
,
queryBuilderRef
=
that
.
RQueryBuilderPurge
.
currentView
.
ui
.
builder
;
if
(
queryBuilderRef
.
data
(
"queryBuilder"
))
{
var
queryBuilder
=
queryBuilderRef
.
queryBuilder
(
"getRules"
);
queryBuilder
?
that
.
isFilters
=
queryBuilder
.
rules
:
isFilterValidate
=
false
;
}
if
(
isFilterValidate
)
{
that
.
closeAttributeModel
();
that
.
getPurgeParam
();
}
},
fetchCollection
:
function
(
options
)
{
var
that
=
this
,
purgeParam
=
{
condition
:
"AND"
,
criterion
:
that
.
getAttributes
()
};
this
.
$
(
'.fontLoader'
).
show
();
this
.
$
(
'.tableOverlay'
).
show
();
if
(
that
.
entityCollection
.
models
.
length
>
1
)
{
if
(
options
.
nextClick
)
{
this
.
pervOld
.
push
(
that
.
entityCollection
.
first
().
get
(
'eventKey'
));
}
}
var
apiObj
=
{
sort
:
false
,
success
:
function
(
dataOrCollection
,
response
)
{
if
(
!
(
that
.
ui
.
pageRecordText
instanceof
jQuery
))
{
return
;
}
that
.
entityCollection
.
fullCollection
.
reset
(
dataOrCollection
);
if
(
that
.
entityCollection
.
models
.
length
<
that
.
limit
)
{
options
.
previous
.
attr
(
'disabled'
,
true
);
options
.
next
.
attr
(
'disabled'
,
true
);
}
that
.
renderOffset
(
options
);
that
.
entityCollection
.
sort
();
if
(
that
.
entityCollection
.
models
.
length
)
{
if
(
that
.
entityCollection
&&
(
that
.
entityCollection
.
models
.
length
<
that
.
limit
&&
that
.
currPage
==
1
)
&&
that
.
next
==
that
.
entityCollection
.
last
().
get
(
'eventKey'
))
{
options
.
next
.
attr
(
'disabled'
,
true
);
options
.
previous
.
removeAttr
(
"disabled"
);
}
else
{
that
.
next
=
that
.
entityCollection
.
last
().
get
(
'eventKey'
);
if
(
that
.
pervOld
.
length
===
0
)
{
options
.
previous
.
attr
(
'disabled'
,
true
);
}
}
}
that
.
renderTableLayoutView
();
that
.
$
(
'.fontLoader'
).
hide
();
that
.
$
(
'.tableOverlay'
).
hide
();
that
.
$
(
'.auditTable'
).
show
();
// Only for first time table show because we never hide after first render.
},
silent
:
true
,
reset
:
true
}
$
.
extend
(
that
.
entityCollection
.
queryParams
,
{
limit
:
25
,
offset
:
0
,
auditFilters
:
purgeParam
});
$
.
extend
(
apiObj
,
{
contentType
:
'application/json'
,
dataType
:
'json'
,
data
:
JSON
.
stringify
(
that
.
entityCollection
.
queryParams
)
})
this
.
entityCollection
.
constructor
.
nonCrudOperation
.
call
(
this
,
UrlLinks
.
purgeApiUrl
(),
"POST"
,
apiObj
);
},
renderTableLayoutView
:
function
()
{
var
that
=
this
;
this
.
ui
.
showDefault
.
hide
();
require
([
'utils/TableLayout'
],
function
(
TableLayout
)
{
var
cols
=
new
Backgrid
.
Columns
(
that
.
getAuditTableColumns
());
that
.
RAuditTableLayoutView
.
show
(
new
TableLayout
(
_
.
extend
({},
that
.
commonTableOptions
,
{
columns
:
cols
})));
if
(
!
(
that
.
entityCollection
.
models
.
length
<
that
.
limit
))
{
that
.
RAuditTableLayoutView
.
$el
.
find
(
'table tr'
).
last
().
hide
();
}
});
},
getAuditTableColumns
:
function
()
{
var
that
=
this
;
return
this
.
entityCollection
.
constructor
.
getTableCols
({
result
:
{
label
:
""
,
cell
:
"html"
,
editable
:
false
,
sortable
:
false
,
cell
:
Backgrid
.
ExpandableCell
,
fixWidth
:
"20"
,
accordion
:
false
,
expand
:
function
(
el
,
model
)
{
var
purgeValues
=
''
;
if
(
model
.
attributes
.
params
)
{
var
guids
=
model
.
attributes
.
result
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
);
_
.
each
(
guids
,
function
(
purgeGuid
)
{
// purgeGuid.trim();
purgeValues
+=
'<a class="blue-link" data-id="purgeEntity" >'
+
purgeGuid
.
trim
()
+
'</a></br>'
;
})
}
else
{
purgeValues
=
''
;
}
var
purgeText
=
'<div class="row"><div class="col-sm-2">Purge Entities: </div><div class="col-sm-10">'
+
purgeValues
+
'</div></div>'
;
/* set expanded row's content */
$
(
el
).
append
(
$
(
'<div>'
).
html
(
purgeText
));
}
},
userName
:
{
label
:
"Users"
,
cell
:
"html"
,
editable
:
false
,
sortable
:
function
(
e
,
attr
,
order
)
{
return
function
(
left
,
right
)
{
// no-op
if
(
order
==
null
)
return
0
;
var
l
=
left
.
get
(
attr
),
r
=
right
.
get
(
attr
),
t
;
// if descending order, swap left and right
if
(
order
===
1
)
t
=
l
,
l
=
r
,
r
=
t
;
// compare as usual
if
(
l
===
r
)
return
0
;
else
if
(
l
<
r
)
return
-
1
;
return
1
;
}
}
},
operation
:
{
label
:
"Operation"
,
cell
:
"String"
,
editable
:
false
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
if
(
rawValue
===
"PURGE"
&&
model
.
attributes
.
params
)
{
var
purgeLength
=
model
.
attributes
.
result
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
).
length
;
return
purgeLength
===
1
?
purgeLength
+
" entity purged."
:
purgeLength
+
" entities purged."
;
}
else
{
return
"No entity purged."
;
}
}
})
},
clientId
:
{
label
:
"Client ID"
,
cell
:
"String"
,
editable
:
false
},
startTime
:
{
label
:
"Start Time"
,
cell
:
"html"
,
editable
:
false
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
return
new
Date
(
rawValue
);
}
})
},
endTime
:
{
label
:
"End Time"
,
cell
:
"html"
,
editable
:
false
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
return
new
Date
(
rawValue
);
}
})
}
},
this
.
entityCollection
);
},
onClickPurgeType
:
function
(
e
,
value
)
{
this
.
onlyPurge
=
e
.
currentTarget
.
value
===
"Purge"
?
true
:
false
;
this
.
getPurgeParam
();
},
onClickPurgeEntity
:
function
(
e
)
{
var
that
=
this
;
require
([
'modules/Modal'
,
'views/audit/AuditTableLayoutView'
,
'views/audit/CreateAuditTableLayoutView'
,
],
function
(
Modal
,
AuditTableLayoutView
,
CreateAuditTableLayoutView
)
{
var
obj
=
{
guid
:
$
(
e
.
target
).
text
(),
},
modal
=
new
Modal
({
title
:
"Purged Entity Details : "
+
obj
.
guid
,
content
:
new
AuditTableLayoutView
(
obj
),
mainClass
:
"modal-full-screen"
,
okCloses
:
true
,
showFooter
:
false
,
}).
open
();
modal
.
on
(
'closeModal'
,
function
()
{
$
(
'.modal'
).
css
({
'padding-right'
:
'0px !important'
});
modal
.
trigger
(
'cancel'
);
});
modal
.
$el
.
on
(
'click'
,
'td a'
,
function
()
{
modal
.
trigger
(
'cancel'
);
});
});
},
onClickNextAuditData
:
function
()
{
var
that
=
this
;
this
.
ui
.
previousAuditData
.
removeAttr
(
"disabled"
);
$
.
extend
(
this
.
entityCollection
.
queryParams
,
{
startKey
:
function
()
{
return
that
.
next
;
}
});
this
.
fetchCollection
({
next
:
this
.
ui
.
nextAuditData
,
nextClick
:
true
,
previous
:
this
.
ui
.
previousAuditData
});
},
onClickPreviousAuditData
:
function
()
{
var
that
=
this
;
this
.
ui
.
nextAuditData
.
removeAttr
(
"disabled"
);
$
.
extend
(
this
.
entityCollection
.
queryParams
,
{
startKey
:
function
()
{
return
that
.
pervOld
.
pop
();
}
});
this
.
fetchCollection
({
next
:
this
.
ui
.
nextAuditData
,
previousClick
:
true
,
previous
:
this
.
ui
.
previousAuditData
});
},
});
return
PurgeAuditTableLayoutView
;
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/audit/AdminAuditTableLayoutView.js
0 → 100644
View file @
ffd2e2b5
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define
([
'require'
,
'backbone'
,
'hbs!tmpl/audit/AdminAuditTableLayoutView_tmpl'
,
'collection/VEntityList'
,
'utils/Utils'
,
'utils/UrlLinks'
,
'utils/CommonViewFunction'
],
function
(
require
,
Backbone
,
AdminAuditTableLayoutView_tmpl
,
VEntityList
,
Utils
,
UrlLinks
,
CommonViewFunction
)
{
'use strict'
;
var
AdminAuditTableLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
/** @lends AuditTableLayoutView */
{
_viewName
:
'AdminAuditTableLayoutView'
,
template
:
AdminAuditTableLayoutView_tmpl
,
/** Layout sub regions */
regions
:
{
RAuditTableLayoutView
:
"#r_adminAuditTableLayoutView"
,
RQueryBuilderAdmin
:
"#r_attributeQueryBuilderAdmin"
},
/** ui selector cache */
ui
:
{
adminEntityClick
:
"[data-id='adminEntity']"
,
adminType
:
"[data-id='adminType']"
,
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
.
adminEntityClick
]
=
"onClickAdminEntity"
;
events
[
"change "
+
this
.
ui
.
adminType
]
=
"onClickAdminType"
;
events
[
"click "
+
this
.
ui
.
attrFilter
]
=
function
(
e
)
{
this
.
$
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
this
.
$
(
'.attributeResultContainer'
).
addClass
(
"overlay"
);
this
.
$
(
'.attribute-filter-container, .attr-filter-overlay'
).
toggleClass
(
'hide'
);
this
.
onClickAttrFilter
();
};
events
[
"click "
+
this
.
ui
.
attrClose
]
=
function
(
e
)
{
that
.
closeAttributeModel
();
};
events
[
"click "
+
this
.
ui
.
attrApply
]
=
function
(
e
)
{
that
.
okAttrFilterButton
(
e
);
};
return
events
;
},
/**
* intialize a new AdminTableLayoutView Layout
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'searchTableFilters'
));
this
.
entityCollection
=
new
VEntityList
();
this
.
limit
=
25
;
this
.
entityCollection
.
url
=
UrlLinks
.
adminApiUrl
();
this
.
entityCollection
.
modelAttrName
=
"events"
;
this
.
onlyAdmin
=
true
;
this
.
commonTableOptions
=
{
collection
:
this
.
entityCollection
,
includeFilter
:
false
,
includePagination
:
true
,
includeFooterRecords
:
true
,
includePageSize
:
true
,
includeAtlasTableSorting
:
true
,
includeTableLoader
:
true
,
includeColumnManager
:
false
,
gridOpts
:
{
className
:
"table table-hover backgrid table-quickMenu"
,
emptyText
:
'No records found!'
},
columnOpts
:
{
opts
:
{
initialColumnsVisible
:
null
,
saveState
:
false
},
visibilityControlOpts
:
{
buttonTemplate
:
_
.
template
(
"<button class='btn btn-action btn-sm pull-right'>Columns <i class='fa fa-caret-down'></i></button>"
)
},
el
:
this
.
ui
.
colManager
},
filterOpts
:
{},
paginatorOpts
:
{}
};
this
.
isFilters
=
null
;
this
.
adminAttrFilters
=
[{
"id"
:
"startTime"
,
"label"
:
"startTime (date)"
,
"operators"
:
[
"="
,
"!="
,
">"
,
"<"
,
">="
,
"<="
],
"plugin"
:
"daterangepicker"
,
"plugin_config"
:
{
"locale"
:
{
"format"
:
"MM/DD/YYYY h:mm A"
},
"showDropdowns"
:
true
,
"singleDatePicker"
:
true
,
"timePicker"
:
true
},
"type"
:
"date"
},
{
"id"
:
"endTime"
,
"label"
:
"endTime (date)"
,
"operators"
:
[
"="
,
"!="
,
">"
,
"<"
,
">="
,
"<="
],
"plugin"
:
"daterangepicker"
,
"plugin_config"
:
{
"locale"
:
{
"format"
:
"MM/DD/YYYY h:mm A"
},
"showDropdowns"
:
true
,
"singleDatePicker"
:
true
,
"timePicker"
:
true
},
"type"
:
"date"
}]
},
onRender
:
function
()
{
var
str
=
'<option>All</option><option>Admin</option>'
;
this
.
ui
.
adminType
.
html
(
str
);
this
.
ui
.
adminType
.
select2
({});
this
.
ui
.
adminRegion
.
hide
();
this
.
getAdminCollection
();
this
.
entityCollection
.
comparator
=
function
(
model
)
{
return
-
model
.
get
(
'timestamp'
);
}
},
bindEvents
:
function
()
{},
closeAttributeModel
:
function
()
{
var
that
=
this
;
that
.
$
(
'.attributeResultContainer'
).
removeClass
(
"overlay"
);
that
.
$
(
'.fa-angle-right'
).
toggleClass
(
'fa-angle-down'
);
that
.
$
(
'.attribute-filter-container, .attr-filter-overlay'
).
toggleClass
(
'hide'
);
},
getAttributes
:
function
()
{
var
adminAttributes
=
[{
"attributeName"
:
"userName"
,
"operator"
:
"like"
,
"attributeValue"
:
"admin"
}];
if
(
!
this
.
onlyAdmin
)
{
adminAttributes
.
push
({
"attributeName"
:
"operation"
,
"operator"
:
"like"
,
"attributeValue"
:
"PURGE"
})
}
if
(
this
.
isFilters
)
{
_
.
each
(
this
.
isFilters
,
function
(
adminFilter
)
{
adminAttributes
.
push
({
"attributeName"
:
adminFilter
.
id
,
"operator"
:
adminFilter
.
operator
,
"attributeValue"
:
Date
.
parse
(
adminFilter
.
value
).
toString
(),
})
})
this
.
isFilters
=
null
;
}
return
adminAttributes
;
},
onClickAttrFilter
:
function
()
{
var
that
=
this
;
this
.
ui
.
adminRegion
.
show
();
require
([
'views/search/QueryBuilderView'
],
function
(
QueryBuilderView
)
{
that
.
RQueryBuilderAdmin
.
show
(
new
QueryBuilderView
({
adminAttrFilters
:
that
.
adminAttrFilters
,
searchTableFilters
:
that
.
searchTableFilters
}));
});
},
okAttrFilterButton
:
function
(
options
)
{
var
that
=
this
,
isFilterValidate
=
true
,
queryBuilderRef
=
that
.
RQueryBuilderAdmin
.
currentView
.
ui
.
builder
;
if
(
queryBuilderRef
.
data
(
"queryBuilder"
))
{
var
queryBuilder
=
queryBuilderRef
.
queryBuilder
(
"getRules"
);
if
(
queryBuilder
)
{
that
.
isFilters
=
queryBuilder
.
rules
;
that
.
searchTableFilters
[
"adminAttrFilters"
]
=
CommonViewFunction
.
attributeFilter
.
generateUrl
({
value
:
queryBuilder
,
formatedDateToLong
:
true
});
}
else
{
isFilterValidate
=
false
}
}
if
(
isFilterValidate
)
{
that
.
closeAttributeModel
();
that
.
getAdminCollection
();
}
},
getAdminCollection
:
function
()
{
var
that
=
this
,
adminParam
=
{
condition
:
"AND"
,
criterion
:
that
.
getAttributes
()
};
this
.
$
(
'.fontLoader'
).
show
();
this
.
$
(
'.tableOverlay'
).
show
();
$
.
extend
(
that
.
entityCollection
.
queryParams
,
{
limit
:
this
.
limit
,
offset
:
0
,
auditFilters
:
adminParam
});
var
apiObj
=
{
sort
:
false
,
data
:
that
.
entityCollection
.
queryParams
,
success
:
function
(
dataOrCollection
,
response
)
{
that
.
entityCollection
.
fullCollection
.
reset
(
dataOrCollection
);
that
.
renderTableLayoutView
();
that
.
$
(
'.fontLoader'
).
hide
();
that
.
$
(
'.tableOverlay'
).
hide
();
that
.
$
(
'.auditTable'
).
show
();
},
silent
:
true
,
reset
:
true
}
this
.
entityCollection
.
getAdminData
(
apiObj
);
},
renderTableLayoutView
:
function
()
{
var
that
=
this
;
this
.
ui
.
showDefault
.
hide
();
require
([
'utils/TableLayout'
],
function
(
TableLayout
)
{
var
cols
=
new
Backgrid
.
Columns
(
that
.
getAuditTableColumns
());
that
.
RAuditTableLayoutView
.
show
(
new
TableLayout
(
_
.
extend
({},
that
.
commonTableOptions
,
{
columns
:
cols
})));
});
},
getAuditTableColumns
:
function
()
{
var
that
=
this
;
return
this
.
entityCollection
.
constructor
.
getTableCols
({
result
:
{
label
:
""
,
cell
:
"html"
,
editable
:
false
,
sortable
:
false
,
cell
:
Backgrid
.
ExpandableCell
,
fixWidth
:
"20"
,
accordion
:
false
,
alwaysVisible
:
true
,
expand
:
function
(
el
,
model
)
{
var
adminValues
=
'<div class="col-sm-6">'
,
newColumn
=
''
;
el
.
attr
(
'colspan'
,
'6'
);
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
=
''
;
}
var
adminText
=
'<div class="row"><div class="col-sm-12 attr-details admin-attr-details"><div class="col-sm-2">Admin Entities: </div><div class="col-sm-10">'
+
adminValues
+
'</div></div></div>'
;
$
(
el
).
append
(
$
(
'<div>'
).
html
(
adminText
));
}
},
userName
:
{
label
:
"Users"
,
cell
:
"html"
,
editable
:
false
},
operation
:
{
label
:
"Operation"
,
cell
:
"String"
,
editable
:
false
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
if
(
rawValue
===
"PURGE"
&&
model
.
attributes
.
params
)
{
var
adminLength
=
model
.
attributes
.
result
.
replace
(
'['
,
''
).
replace
(
']'
,
''
).
split
(
','
).
length
;
return
adminLength
===
1
?
adminLength
+
" entity purged."
:
adminLength
+
" entities purged."
;
}
else
{
return
"No entity purged."
;
}
}
})
},
clientId
:
{
label
:
"Client ID"
,
cell
:
"String"
,
editable
:
false
},
startTime
:
{
label
:
"Start Time"
,
cell
:
"html"
,
editable
:
false
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
return
new
Date
(
rawValue
);
}
})
},
endTime
:
{
label
:
"End Time"
,
cell
:
"html"
,
editable
:
false
,
formatter
:
_
.
extend
({},
Backgrid
.
CellFormatter
.
prototype
,
{
fromRaw
:
function
(
rawValue
,
model
)
{
return
new
Date
(
rawValue
);
}
})
}
},
this
.
entityCollection
);
},
onClickAdminType
:
function
(
e
,
value
)
{
this
.
onlyAdmin
=
e
.
currentTarget
.
value
===
"Admin"
?
false
:
true
;
this
.
getAdminCollection
();
},
onClickAdminEntity
:
function
(
e
)
{
var
that
=
this
;
require
([
'modules/Modal'
,
'views/audit/AuditTableLayoutView'
,
'views/audit/CreateAuditTableLayoutView'
,
],
function
(
Modal
,
AuditTableLayoutView
,
CreateAuditTableLayoutView
)
{
var
obj
=
{
guid
:
$
(
e
.
target
).
text
(),
},
modal
=
new
Modal
({
title
:
"Admin Entity Details : "
+
obj
.
guid
,
content
:
new
AuditTableLayoutView
(
obj
),
mainClass
:
"modal-full-screen"
,
okCloses
:
true
,
showFooter
:
false
,
}).
open
();
modal
.
on
(
'closeModal'
,
function
()
{
$
(
'.modal'
).
css
({
'padding-right'
:
'0px !important'
});
modal
.
trigger
(
'cancel'
);
});
modal
.
$el
.
on
(
'click'
,
'td a'
,
function
()
{
modal
.
trigger
(
'cancel'
);
});
});
}
});
return
AdminAuditTableLayoutView
;
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/audit/CreateAuditTableLayoutView.js
View file @
ffd2e2b5
...
...
@@ -39,6 +39,7 @@ define(['require',
ui
:
{
auditValue
:
"[data-id='auditValue']"
,
name
:
"[data-id='name']"
,
nameContainer
:
"[data-id='nameContainer']"
,
noData
:
"[data-id='noData']"
,
tableAudit
:
"[data-id='tableAudit']"
,
auditHeaderValue
:
"[data-id='auditHeaderValue']"
,
...
...
@@ -156,8 +157,8 @@ define(['require',
that
.
noDetailsShow
();
}
}
else
if
(
detailObj
==
"Deleted entity"
)
{
th
at
.
updateName
(
this
.
entityName
?
this
.
entityName
:
"Entity
"
);
}
else
if
(
detailObj
==
"Deleted entity"
||
detailObj
==
"Purged entity"
)
{
th
is
.
entityName
?
that
.
updateName
(
this
.
entityName
)
:
this
.
ui
.
nameContainer
.
empty
().
append
(
"<h4 class='text-center'><i>No Records Found!</i></h4>
"
);
}
}
});
...
...
This diff is collapsed.
Click to expand it.
dashboardv3/public/js/views/search/QueryBuilderView.js
View file @
ffd2e2b5
...
...
@@ -54,9 +54,8 @@ define(['require',
* @constructs
*/
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
_
.
pick
(
options
,
'attrObj'
,
'value'
,
'typeHeaders'
,
'entityDefCollection'
,
'enumDefCollection'
,
'classificationDefCollection'
,
'
tag'
,
'type'
,
'searchTableFilters'
,
'systemAttrArr
'
));
_
.
extend
(
this
,
_
.
pick
(
options
,
'attrObj'
,
'value'
,
'typeHeaders'
,
'entityDefCollection'
,
'enumDefCollection'
,
'classificationDefCollection'
,
'
businessMetadataDefCollection'
,
'tag'
,
'type'
,
'searchTableFilters'
,
'systemAttrArr'
,
'adminAttrFilters
'
));
this
.
attrObj
=
_
.
sortBy
(
this
.
attrObj
,
'name'
);
//this.systemAttrArr = _.sortBy(this.systemAttrArr, 'name');
this
.
filterType
=
this
.
tag
?
'tagFilters'
:
'entityFilters'
;
},
bindEvents
:
function
()
{},
...
...
@@ -312,70 +311,82 @@ define(['require',
onRender
:
function
()
{
var
that
=
this
,
filters
=
[],
isGroupView
=
fals
e
,
isGroupView
=
tru
e
,
placeHolder
=
'--Select Attribute--'
;
if
(
this
.
attrObj
.
length
>
0
&&
this
.
systemAttrArr
.
length
>
0
)
{
isGroupView
=
true
;
}
else
if
(
this
.
attrObj
.
length
===
0
||
this
.
systemAttrArr
.
length
===
0
)
{
isGroupView
=
false
;
}
if
(
this
.
attrObj
.
length
===
0
)
{
placeHolder
=
'--Select System Attribute--'
;
}
if
(
this
.
value
)
{
var
rules_widgets
=
CommonViewFunction
.
attributeFilter
.
extractUrl
({
"value"
:
this
.
searchTableFilters
[
this
.
filterType
][(
this
.
tag
?
this
.
value
.
tag
:
this
.
value
.
type
)],
"formatDate"
:
true
});
}
_
.
each
(
this
.
attrObj
,
function
(
obj
)
{
var
type
=
that
.
tag
?
'Classification'
:
'Entity'
;
var
returnObj
=
that
.
getObjDef
(
obj
,
rules_widgets
,
isGroupView
,
'Select '
+
type
+
' Attribute'
);
if
(
returnObj
)
{
filters
.
push
(
returnObj
);
}
});
var
sortMap
=
{
"__guid"
:
1
,
"__typeName"
:
2
,
"__timestamp"
:
3
,
"__modificationTimestamp"
:
4
,
"__createdBy"
:
5
,
"__modifiedBy"
:
6
,
"__isIncomplete"
:
7
,
"__state"
:
8
,
"__classificationNames"
:
9
,
"__propagatedClassificationNames"
:
10
,
"__labels"
:
11
,
"__customAttributes"
:
12
,
}
this
.
systemAttrArr
=
_
.
sortBy
(
this
.
systemAttrArr
,
function
(
obj
)
{
return
sortMap
[
obj
.
name
]
})
_
.
each
(
this
.
systemAttrArr
,
function
(
obj
)
{
var
returnObj
=
that
.
getObjDef
(
obj
,
rules_widgets
,
isGroupView
,
'Select System Attribute'
,
true
);
if
(
returnObj
)
{
filters
.
push
(
returnObj
);
var
rules_widgets
=
null
;
if
(
this
.
adminAttrFilters
)
{
filters
=
this
.
adminAttrFilters
;
rules_widgets
=
CommonViewFunction
.
attributeFilter
.
extractUrl
({
"value"
:
this
.
searchTableFilters
?
this
.
searchTableFilters
[
"adminAttrFilters"
]
:
null
,
"formatDate"
:
true
});;
}
else
{
if
(
this
.
value
)
{
var
rules_widgets
=
CommonViewFunction
.
attributeFilter
.
extractUrl
({
"value"
:
this
.
searchTableFilters
[
this
.
filterType
][(
this
.
tag
?
this
.
value
.
tag
:
this
.
value
.
type
)],
"formatDate"
:
true
});
}
});
if
(
this
.
type
)
{
var
entityDef
=
this
.
entityDefCollection
.
fullCollection
.
find
({
name
:
that
.
options
.
applicableType
}),
businessMetadataAttributeDefs
=
null
;
if
(
entityDef
)
{
BusinessMetadataAttributeDefs
=
entityDef
.
get
(
"businessAttributeDefs"
);
_
.
each
(
this
.
attrObj
,
function
(
obj
)
{
var
type
=
that
.
tag
?
that
.
value
.
tag
:
that
.
value
.
type
;
var
returnObj
=
that
.
getObjDef
(
obj
,
rules_widgets
,
isGroupView
,
(
type
+
' Attribute'
));
if
(
returnObj
)
{
filters
.
push
(
returnObj
);
}
});
var
sortMap
=
{
"__guid"
:
1
,
"__typeName"
:
2
,
"__timestamp"
:
3
,
"__modificationTimestamp"
:
4
,
"__createdBy"
:
5
,
"__modifiedBy"
:
6
,
"__isIncomplete"
:
7
,
"__state"
:
8
,
"__classificationNames"
:
9
,
"__propagatedClassificationNames"
:
10
,
"__labels"
:
11
,
"__customAttributes"
:
12
,
}
if
(
BusinessMetadataAttributeDefs
)
{
_
.
each
(
BusinessMetadataAttributeDefs
,
function
(
attributes
,
key
)
{
var
sortedAttributes
=
_
.
sortBy
(
attributes
,
function
(
obj
)
{
return
obj
.
name
;
});
this
.
systemAttrArr
=
_
.
sortBy
(
this
.
systemAttrArr
,
function
(
obj
)
{
return
sortMap
[
obj
.
name
]
})
_
.
each
(
this
.
systemAttrArr
,
function
(
obj
)
{
var
returnObj
=
that
.
getObjDef
(
obj
,
rules_widgets
,
isGroupView
,
'System Attribute'
,
true
);
if
(
returnObj
)
{
filters
.
push
(
returnObj
);
}
});
if
(
this
.
type
)
{
var
pushBusinessMetadataFilter
=
function
(
sortedAttributes
,
businessMetadataKey
)
{
_
.
each
(
sortedAttributes
,
function
(
attrDetails
)
{
var
returnObj
=
that
.
getObjDef
(
attrDetails
,
rules_widgets
,
isGroupView
,
'
Select
Business Metadata Attribute'
,
true
);
var
returnObj
=
that
.
getObjDef
(
attrDetails
,
rules_widgets
,
isGroupView
,
'Business Metadata Attribute'
,
true
);
if
(
returnObj
)
{
returnObj
.
id
=
k
ey
+
"."
+
returnObj
.
id
;
returnObj
.
label
=
k
ey
+
": "
+
returnObj
.
label
;
returnObj
.
id
=
businessMetadataK
ey
+
"."
+
returnObj
.
id
;
returnObj
.
label
=
businessMetadataK
ey
+
": "
+
returnObj
.
label
;
returnObj
.
data
=
{
'entityType'
:
"businessMetadata"
};
filters
.
push
(
returnObj
);
}
});
});
};
if
(
this
.
value
.
type
==
"_ALL_ENTITY_TYPES"
)
{
this
.
businessMetadataDefCollection
.
each
(
function
(
model
)
{
var
sortedAttributes
=
model
.
get
(
'attributeDefs'
);
sortedAttributes
=
_
.
sortBy
(
sortedAttributes
,
function
(
obj
)
{
return
obj
.
name
;
});
pushBusinessMetadataFilter
(
sortedAttributes
,
model
.
get
(
'name'
));
})
}
else
{
var
entityDef
=
this
.
entityDefCollection
.
fullCollection
.
find
({
name
:
this
.
value
.
type
}),
businessMetadataAttributeDefs
=
null
;
if
(
entityDef
)
{
businessMetadataAttributeDefs
=
entityDef
.
get
(
"businessAttributeDefs"
);
}
if
(
businessMetadataAttributeDefs
)
{
_
.
each
(
businessMetadataAttributeDefs
,
function
(
attributes
,
key
)
{
var
sortedAttributes
=
_
.
sortBy
(
attributes
,
function
(
obj
)
{
return
obj
.
name
;
});
pushBusinessMetadataFilter
(
sortedAttributes
,
key
);
});
}
}
}
}
filters
=
_
.
uniq
(
filters
,
'id'
);
...
...
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