RANGER-799 : Ranger UI fixes - partial search not working on Policy listing page
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/082d0f28 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/082d0f28 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/082d0f28 Branch: refs/heads/ranger-0.5 Commit: 082d0f282885eee9fa3c2f13f1e763e77d425f2e Parents: 4b6b641 Author: Gautam Borad <[email protected]> Authored: Fri Feb 12 15:55:30 2016 +0530 Committer: Gautam Borad <[email protected]> Committed: Mon Feb 22 11:05:10 2016 +0530 ---------------------------------------------------------------------- .../org/apache/ranger/util/RangerRestUtil.java | 14 - security-admin/src/main/webapp/ajax_failure.jsp | 31 -- .../src/main/webapp/ajax_success.html | 26 -- .../src/main/webapp/images/data-grey.png | Bin 1468 -> 0 bytes .../main/webapp/images/database_table_32.png | Bin 1329 -> 0 bytes .../src/main/webapp/images/folder.png | Bin 920 -> 0 bytes .../src/main/webapp/images/folder2.png | Bin 946 -> 0 bytes security-admin/src/main/webapp/images/hbase.jpg | Bin 4575 -> 0 bytes security-admin/src/main/webapp/images/hdfs.jpg | Bin 5232 -> 0 bytes security-admin/src/main/webapp/images/hive.png | Bin 20483 -> 0 bytes security-admin/src/main/webapp/images/hline.png | Bin 99 -> 0 bytes security-admin/src/main/webapp/images/knox.gif | Bin 2347 -> 0 bytes security-admin/src/main/webapp/images/knox1.png | Bin 34126 -> 0 bytes .../src/main/webapp/images/router-grey.png | Bin 1533 -> 0 bytes security-admin/src/main/webapp/images/storm.png | Bin 6174 -> 0 bytes .../src/main/webapp/images/storm1.png | Bin 19620 -> 0 bytes .../src/main/webapp/images/task-grey.png | Bin 1187 -> 0 bytes security-admin/src/main/webapp/index.html | 5 - security-admin/src/main/webapp/login.jsp | 17 - .../collection_bases/VXAuditRecordListBase.js | 60 --- .../scripts/collections/VXAuditRecordList.js | 36 -- .../webapp/scripts/controllers/Controller.js | 38 +- .../src/main/webapp/scripts/mgrs/SessionMgr.js | 3 +- .../scripts/model_bases/VXAuditRecordBase.js | 106 ----- .../main/webapp/scripts/models/VXAuditRecord.js | 80 ---- .../src/main/webapp/scripts/models/VXGroup.js | 13 +- .../main/webapp/scripts/models/VXPortalUser.js | 4 +- .../src/main/webapp/scripts/modules/XALinks.js | 8 +- .../scripts/modules/globalize/message/en.js | 11 +- .../src/main/webapp/scripts/utils/XAUtils.js | 5 +- .../scripts/views/accounts/AccountCreate.js | 133 ------ .../views/accounts/AccountDetailLayout.js | 90 ---- .../scripts/views/accounts/AccountForm.js | 86 ---- .../views/accounts/AccountTableLayout.js | 194 --------- .../webapp/scripts/views/common/AddGroup.js | 80 ++-- .../webapp/scripts/views/common/BreadCrumbs.js | 2 +- .../scripts/views/common/FormInputItemList.js | 426 ------------------- .../main/webapp/scripts/views/common/TopNav.js | 2 +- .../scripts/views/common/UserPermissionList.js | 124 ++---- .../webapp/scripts/views/common/XABackgrid.js | 20 +- .../scripts/views/common/XATableLayout.js | 10 +- .../webapp/scripts/views/folders/FolderInfo.js | 173 -------- .../webapp/scripts/views/kms/KMSTableLayout.js | 44 +- .../webapp/scripts/views/kms/KmsKeyCreate.js | 13 +- .../views/permissions/ModulePermissionCreate.js | 93 ++-- .../views/permissions/ModulePermissionForm.js | 51 ++- .../views/permissions/ModulePermsTableLayout.js | 50 +-- .../scripts/views/policies/PermissionList.js | 15 +- .../views/policies/RangerPolicyTableLayout.js | 11 +- .../views/policymanager/ServiceLayout.js | 7 +- .../webapp/scripts/views/reports/AuditLayout.js | 244 +++++------ .../scripts/views/reports/LoginSessionDetail.js | 3 - .../views/reports/OperationDiffDetail.js | 67 +-- .../views/reports/PlugableServiceDiffDetail.js | 4 - .../scripts/views/reports/UserAccessLayout.js | 43 +- .../scripts/views/service/ConfigurationList.js | 8 +- .../scripts/views/service/ServiceCreate.js | 23 +- .../webapp/scripts/views/service/ServiceForm.js | 26 +- .../scripts/views/service/ServiceTableLayout.js | 164 ------- .../webapp/scripts/views/user/UserProfile.js | 24 +- .../scripts/views/user/UserProfileForm.js | 21 +- .../webapp/scripts/views/users/GroupCreate.js | 20 +- .../webapp/scripts/views/users/UserCreate.js | 38 +- .../main/webapp/scripts/views/users/UserForm.js | 23 +- .../scripts/views/users/UserTableLayout.js | 24 +- .../templates/accounts/AccountCreate_tmpl.html | 28 -- .../accounts/AccountDetailLayout_tmpl.html | 88 ---- .../templates/accounts/AccountForm_tmpl.html | 23 - .../accounts/AccountTableLayout_tmpl.html | 31 -- .../templates/asset/AssetCreate_tmpl.html | 36 -- .../webapp/templates/asset/AssetForm_tmpl.html | 69 --- .../templates/asset/AssetTableLayout_tmpl.html | 29 -- .../webapp/templates/common/Footer_tmpl.html | 14 - .../common/PolicyManagerLayout_tmpl.html | 274 ------------ .../templates/common/ProfileBar_tmpl.html | 37 -- .../webapp/templates/common/TopNav_tmpl.html | 1 - .../templates/common/UserPermissionList.html | 1 - .../webapp/templates/common/breadcrumbs.html | 16 - .../webapp/templates/common/formInputItem.html | 54 --- .../templates/common/formInputItemList.html | 42 -- .../templates/folders/FolderInfo_tmpl.html | 134 ------ .../templates/hbase/HbasePolicyCreate_tmpl.html | 48 --- .../templates/hbase/HbasePolicyForm_tmpl.html | 56 --- .../templates/hbase/HbaseTableLayout_tmpl.html | 41 -- .../templates/hdfs/HDFSTableLayout_tmpl.html | 41 -- .../templates/hdfs/PolicyCreate_tmpl.html | 48 --- .../webapp/templates/hdfs/PolicyForm_tmpl.html | 61 --- .../main/webapp/templates/helpers/XAHelpers.js | 58 ++- .../templates/hive/HivePolicyCreate_tmpl.html | 49 --- .../templates/hive/HivePolicyForm_tmpl.html | 67 --- .../templates/hive/HiveTableLayout_tmpl.html | 41 -- .../webapp/templates/kms/KmsKeyCreate_tmpl.html | 1 - .../templates/kms/KmsTableLayout_tmpl.html | 9 - .../webapp/templates/knox/KnoxInfo_tmpl.html | 106 ----- .../templates/knox/KnoxPolicyCreate_tmpl.html | 49 --- .../templates/knox/KnoxPolicyForm_tmpl.html | 55 --- .../templates/knox/KnoxTableLayout_tmpl.html | 41 -- .../templates/license/LicenseCreate_tmpl.html | 47 -- .../templates/license/LicenseInfo_tmpl.html | 59 --- .../permissions/ModulePermissionForm_tmpl.html | 2 - .../templates/policies/PermissionList.html | 1 - .../reports/AssetOperationDiff_tmpl.html | 7 +- .../templates/reports/AuditLayout_tmpl.html | 2 - .../KnoxPolicyDeleteOperationDiff_tmpl.html | 1 - .../reports/KnoxPolicyOperationDiff_tmpl.html | 1 - .../KnoxPolicyUpdateOperationDiff_tmpl.html | 2 - .../reports/LoginSessionDetail_tmpl.html | 1 - .../PlugableServicePolicyDeleteDiff_tmpl.html | 1 - .../PlugableServicePolicyUpdateDiff_tmpl.html | 1 - .../reports/PolicyDeleteOperationDiff_tmpl.html | 1 - .../reports/PolicyOperationDiff_tmpl.html | 1 - .../reports/PolicyUpdateOperationDiff_tmpl.html | 3 - .../reports/UserAccessLayout_tmpl.html | 23 +- .../reports/UserUpdateOperationDiff_tmpl.html | 2 - .../service/ConfigurationList_tmpl.html | 3 - .../templates/service/ServiceCreate_tmpl.html | 2 +- .../templates/storm/StormPolicyCreate_tmpl.html | 49 --- .../templates/storm/StormPolicyForm_tmpl.html | 55 --- .../templates/storm/StormTableLayout_tmpl.html | 41 -- .../templates/user/UserProfileForm_tmpl.html | 12 - .../main/webapp/themejs/1.3.0/bootstrap.min.js | 1 - 121 files changed, 508 insertions(+), 4271 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/java/org/apache/ranger/util/RangerRestUtil.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/util/RangerRestUtil.java b/security-admin/src/main/java/org/apache/ranger/util/RangerRestUtil.java index eb34b42..6672c5a 100644 --- a/security-admin/src/main/java/org/apache/ranger/util/RangerRestUtil.java +++ b/security-admin/src/main/java/org/apache/ranger/util/RangerRestUtil.java @@ -101,26 +101,12 @@ public class RangerRestUtil { userProfile.getFirstName(), gjUser.getFirstName(), StringUtil.VALIDATION_NAME, "Invalid first name", MessageEnums.INVALID_INPUT_DATA, null, "firstName")); - - userProfile.setLastName(restErrorUtil.validateStringForUpdate( - userProfile.getLastName(), gjUser.getLastName(), - StringUtil.VALIDATION_NAME, "Invalid last name", - MessageEnums.INVALID_INPUT_DATA, null, "lastName")); - // firstName if (!stringUtil.isValidName(userProfile.getFirstName())) { logger.info("Invalid first name." + userProfile); messageList.add(MessageEnums.INVALID_INPUT_DATA.getMessage(null, "firstName")); } - - // lastName - if (!stringUtil.isValidName(userProfile.getLastName())) { - logger.info("Invalid last name." + userProfile); - messageList.add(MessageEnums.INVALID_INPUT_DATA.getMessage(null, - "lastName")); - } - // create the public screen name userProfile.setPublicScreenName(userProfile.getFirstName() + " " + userProfile.getLastName()); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/ajax_failure.jsp ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/ajax_failure.jsp b/security-admin/src/main/webapp/ajax_failure.jsp deleted file mode 100644 index b48064c..0000000 --- a/security-admin/src/main/webapp/ajax_failure.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<!-- - 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. ---> -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<% - int ajaxReturnCode = 401; - //PropertiesUtil.getIntProperty("ranger.ajax.auth.required.code", 401); - response.sendError(ajaxReturnCode); -%> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>Insert title here</title> -</head> -<body> -Failure -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/ajax_success.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/ajax_success.html b/security-admin/src/main/webapp/ajax_success.html deleted file mode 100644 index 52023ca..0000000 --- a/security-admin/src/main/webapp/ajax_success.html +++ /dev/null @@ -1,26 +0,0 @@ -<!-- - 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. ---> -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>Insert title here</title> -</head> -<body> -Success -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/data-grey.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/data-grey.png b/security-admin/src/main/webapp/images/data-grey.png deleted file mode 100644 index dabec13..0000000 Binary files a/security-admin/src/main/webapp/images/data-grey.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/database_table_32.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/database_table_32.png b/security-admin/src/main/webapp/images/database_table_32.png deleted file mode 100644 index 14bb068..0000000 Binary files a/security-admin/src/main/webapp/images/database_table_32.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/folder.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/folder.png b/security-admin/src/main/webapp/images/folder.png deleted file mode 100644 index 0613c6b..0000000 Binary files a/security-admin/src/main/webapp/images/folder.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/folder2.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/folder2.png b/security-admin/src/main/webapp/images/folder2.png deleted file mode 100644 index 85da97f..0000000 Binary files a/security-admin/src/main/webapp/images/folder2.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/hbase.jpg ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/hbase.jpg b/security-admin/src/main/webapp/images/hbase.jpg deleted file mode 100644 index 27c177a..0000000 Binary files a/security-admin/src/main/webapp/images/hbase.jpg and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/hdfs.jpg ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/hdfs.jpg b/security-admin/src/main/webapp/images/hdfs.jpg deleted file mode 100644 index 2f6dad2..0000000 Binary files a/security-admin/src/main/webapp/images/hdfs.jpg and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/hive.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/hive.png b/security-admin/src/main/webapp/images/hive.png deleted file mode 100644 index b7939b1..0000000 Binary files a/security-admin/src/main/webapp/images/hive.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/hline.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/hline.png b/security-admin/src/main/webapp/images/hline.png deleted file mode 100644 index b488b95..0000000 Binary files a/security-admin/src/main/webapp/images/hline.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/knox.gif ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/knox.gif b/security-admin/src/main/webapp/images/knox.gif deleted file mode 100644 index 3edc8fd..0000000 Binary files a/security-admin/src/main/webapp/images/knox.gif and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/knox1.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/knox1.png b/security-admin/src/main/webapp/images/knox1.png deleted file mode 100644 index 56265c7..0000000 Binary files a/security-admin/src/main/webapp/images/knox1.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/router-grey.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/router-grey.png b/security-admin/src/main/webapp/images/router-grey.png deleted file mode 100644 index 5424139..0000000 Binary files a/security-admin/src/main/webapp/images/router-grey.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/storm.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/storm.png b/security-admin/src/main/webapp/images/storm.png deleted file mode 100644 index 510cc92..0000000 Binary files a/security-admin/src/main/webapp/images/storm.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/storm1.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/storm1.png b/security-admin/src/main/webapp/images/storm1.png deleted file mode 100644 index a5b36c7..0000000 Binary files a/security-admin/src/main/webapp/images/storm1.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/images/task-grey.png ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/images/task-grey.png b/security-admin/src/main/webapp/images/task-grey.png deleted file mode 100644 index 6c76084..0000000 Binary files a/security-admin/src/main/webapp/images/task-grey.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/index.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/index.html b/security-admin/src/main/webapp/index.html index f1d0b75..31833b6 100644 --- a/security-admin/src/main/webapp/index.html +++ b/security-admin/src/main/webapp/index.html @@ -75,12 +75,7 @@ </section> <div class='notifications top-right ranger-notifications'></div> <section id="r_content" class="row-fluid" style="min-height: 450px;"> - - - <!-- <img src="images/loading-blue.gif" style="margin-left: 43%;margin-top: 1%;width:4%;" /> --> - <div class="loading-img"> - <div id="center"> <div class="letter_container_1"> <span>L</span> http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/login.jsp ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/login.jsp b/security-admin/src/main/webapp/login.jsp index 0db6882..39fb327 100644 --- a/security-admin/src/main/webapp/login.jsp +++ b/security-admin/src/main/webapp/login.jsp @@ -38,11 +38,6 @@ <script type="text/javascript"> $(document).ready(function() { - /* $('#signin-container').submit(function() { - document.location = 'dashboard.html'; - return false; - }); */ - var updateBoxPosition = function() { $('#signin-container').css({ 'margin-top' : ($(window).height() - $('#signin-container').height()) / 2 @@ -80,22 +75,10 @@ </span> <button type="submit" class="btn btn-primary btn-block" id="signIn" tabindex="4" > Sign In - <!--<img id="signInLoading" src="images/loading.gif" style="visibility: hidden;" /> --> <i id="signInLoading" class="icon-spinner icon-spin pull-right icon-sign-in"></i> </button> </fieldset> </form> - <!-- <div class="social"> - <p> - ...or sign in with - </p> - - <a href="javascript:void(0);" title="" tabindex="5" class="twitter"> <i class="icon-twitter"></i> </a> - - <a href="javascript:void(0);" title="" tabindex="6" class="facebook"> <i class="icon-facebook"></i> </a> - - <a href="javascript:void(0);" title="" tabindex="7" class="google"> <i class="icon-google-plus"></i> </a> - </div> --> </section> </body> http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/collection_bases/VXAuditRecordListBase.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/collection_bases/VXAuditRecordListBase.js b/security-admin/src/main/webapp/scripts/collection_bases/VXAuditRecordListBase.js deleted file mode 100644 index 1cd1fb1..0000000 --- a/security-admin/src/main/webapp/scripts/collection_bases/VXAuditRecordListBase.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var XABaseCollection = require('collections/XABaseCollection'); - var XAGlobals = require('utils/XAGlobals'); - var VXAuditRecord = require('models/VXAuditRecord'); - - var VXAuditRecordListBase = XABaseCollection.extend( - /** @lends VXAuditRecordListBase.prototype */ - { - url: XAGlobals.baseURL + 'assets/audit/report', - - model : VXAuditRecord, - - /** - * VXAuditRecordListBase initialize method - * @augments XABaseCollection - * @constructs - */ - initialize : function() { - this.modelName = 'VXAuditRecord'; - this.modelAttrName = 'vXAuditRecords'; - this.bindErrorEvents(); - } - },{ - // static class members - /** - * Table Cols to be passed to Backgrid - * UI has to use this as base and extend this. - * - */ - - tableCols : {} - - }); - - return VXAuditRecordListBase; -}); - - http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/collections/VXAuditRecordList.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/collections/VXAuditRecordList.js b/security-admin/src/main/webapp/scripts/collections/VXAuditRecordList.js deleted file mode 100644 index 09c434a..0000000 --- a/security-admin/src/main/webapp/scripts/collections/VXAuditRecordList.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var VXAuditRecordListBase = require('collection_bases/VXAuditRecordListBase'); - - var VXAuditRecordList = VXAuditRecordListBase.extend( - /** @lends VXAuditRecordList.prototype */ - { - },{ - // static class members - }); - - return VXAuditRecordList; -}); - - http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/controllers/Controller.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/controllers/Controller.js b/security-admin/src/main/webapp/scripts/controllers/Controller.js index edbc5b9..351dcdf 100755 --- a/security-admin/src/main/webapp/scripts/controllers/Controller.js +++ b/security-admin/src/main/webapp/scripts/controllers/Controller.js @@ -62,12 +62,7 @@ define(function(require) { var RangerPolicyList = require('collections/RangerPolicyList'); var VXGroupList = require('collections/VXGroupList'); var VXUserList = require('collections/VXUserList'); - var policyList = new RangerPolicyList([],{ - queryParams : { - //'resourceType' : XAEnums.AssetType.ASSET_HDFS.value, - //'assetId' : assetId - } - }); + var policyList = new RangerPolicyList(); var that = this; this.groupList = new VXGroupList(); this.userList = new VXUserList(); @@ -283,18 +278,12 @@ define(function(require) { var RangerPolicyList = require('collections/RangerPolicyList'); var rangerService = new RangerService({id : serviceId}); - var rangerPolicyList = new RangerPolicyList(); - rangerPolicyList.url = XAUtil.getServicePoliciesURL(serviceId); - rangerService.fetch({ cache : false, async : false }); - rangerPolicyList.fetch({ - cache : false, - }); App.rContent.show(new view({ - collection : rangerPolicyList, + collection : new RangerPolicyList(), rangerService : rangerService })); }, @@ -345,13 +334,8 @@ define(function(require) { var ModulePermissionList = require('collections/VXModuleDefList'); var modulePermission = new ModulePermission(); - var modulePermissionList = new ModulePermissionList(); - - modulePermissionList.fetch({ - cache : false, - }); App.rContent.show(new view({ - collection : modulePermissionList + collection : new ModulePermissionList() })); }, @@ -402,22 +386,6 @@ define(function(require) { kmsServiceName : kmsServiceName })); }, -// kmsKeyEditAction : function(kmsServiceName, keyName){ -// MAppState.set({ 'currentTab' : XAGlobals.AppTabs.KMS.value }); -// var view = require('views/kms/KmsKeyCreate'); -// var VXKmsKey = require('models/VXKmsKey'); -// var kmsKeyModel = new VXKmsKey({'name' : keyName}); -// var data = {'provider': kmsServiceName} -// kmsKeyModel.fetch({ -// cache : true, -// data : data -// }).done(function(){ -// App.rContent.show(new view({ -// model : kmsKeyModel, -// kmsServiceName : kmsServiceName -// })); -// }); -// }, /**************** ERROR PAGE ******************************/ pageNotFoundAction : function() { var XAUtils = require('utils/XAUtils'); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/mgrs/SessionMgr.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/mgrs/SessionMgr.js b/security-admin/src/main/webapp/scripts/mgrs/SessionMgr.js index 6449c50..e7a3856 100644 --- a/security-admin/src/main/webapp/scripts/mgrs/SessionMgr.js +++ b/security-admin/src/main/webapp/scripts/mgrs/SessionMgr.js @@ -132,8 +132,7 @@ define(function(require){ return this.userInRole('ROLE_KEY_ADMIN') ? true : false; }; SessionMgr.isUser = function(){ - var roles = this.getRoleInUserSchool(); - return $.inArray('ROLE_USER',roles) != -1 ? true : false ; + return this.userInRole('ROLE_USER') ? true : false; }; return SessionMgr; }); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/model_bases/VXAuditRecordBase.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/model_bases/VXAuditRecordBase.js b/security-admin/src/main/webapp/scripts/model_bases/VXAuditRecordBase.js deleted file mode 100644 index fb1e8fb..0000000 --- a/security-admin/src/main/webapp/scripts/model_bases/VXAuditRecordBase.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var XABaseModel = require('models/XABaseModel'); - var XAGlobals = require('utils/XAGlobals'); - - var VXAuditRecordBase = XABaseModel.extend( - /** @lends VXAuditRecordBase.prototype */ - { - urlRoot: XAGlobals.baseURL + 'assets/audit/report', - - defaults: {}, - - serverSchema : { - "id" : { - "dataType" : "Long" - }, - "version" : { - "dataType" : "int" - }, - "createDate" : { - "dataType" : "Date" - }, - "updateDate" : { - "dataType" : "Date" - }, - "permList" : { - "dataType" : "list", - "listType" : "VNameValue" - }, - "forUserId" : { - "dataType" : "Long" - }, - "status" : { - "dataType" : "int" - }, - "priGrpId" : { - "dataType" : "Long" - }, - "updatedBy" : { - "dataType" : "String" - }, - "isSystem" : { - "dataType" : "boolean" - }, - "date" : { - "dataType" : "Date" - }, - "resource" : { - "dataType" : "String" - }, - "action" : { - "dataType" : "String" - }, - "result" : { - "dataType" : "String" - }, - "user" : { - "dataType" : "String" - }, - "enforcer" : { - "dataType" : "String" - } - }, - - - idAttribute: 'id', - - /** - * VXAuditRecordBase initialize method - * @augments XABaseModel - * @constructs - */ - initialize: function() { - this.modelName = 'VXAuditRecordBase'; - } - - }, { - // static class members - }); - - return VXAuditRecordBase; - -}); - - http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/models/VXAuditRecord.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/models/VXAuditRecord.js b/security-admin/src/main/webapp/scripts/models/VXAuditRecord.js deleted file mode 100644 index 0e89a7f..0000000 --- a/security-admin/src/main/webapp/scripts/models/VXAuditRecord.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var VXAuditRecordBase = require('model_bases/VXAuditRecordBase'); - - var VXAuditRecord = VXAuditRecordBase.extend( - /** @lends VXAuditRecord.prototype */ - { - /** - * @function schema - * This method is meant to be used by UI, - * by default we will remove the unrequired attributes from serverSchema - */ - - schemaBase : function(){ - var attrs = _.omit(this.serverSchema, 'id', 'createDate', 'updateDate', "version", - "createDate", "updateDate", "displayOption", - "permList", "forUserId", "status", "priGrpId", - "updatedBy","isSystem"); - - _.each(attrs, function(o){ - o.type = 'Hidden'; - }); - - // Overwrite your schema definition here - return _.extend(attrs,{ - /*name : { - type : 'Text', - title : 'Folder Name *', - validators : ['required'], - },*/ - - }); - }, - - /*links : { - detail: { - href: 'javascript:void(0)', - label : this.toString() - }, - list: { - href: 'javascript:void(0)', - label : this.toString() - }, - },*/ - - /** This models toString() */ - toString : function(){ - return /*this.get('name')*/; - } - - }, { - // static class members - }); - - return VXAuditRecord; - -}); - - http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/models/VXGroup.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/models/VXGroup.js b/security-admin/src/main/webapp/scripts/models/VXGroup.js index 3aa3615..46cb97e 100644 --- a/security-admin/src/main/webapp/scripts/models/VXGroup.js +++ b/security-admin/src/main/webapp/scripts/models/VXGroup.js @@ -78,18 +78,7 @@ define(function(require){ } }); }, - - /*links : { - detail: { - href: 'javascript:void(0)', - label : this.toString() - }, - list: { - href: 'javascript:void(0)', - label : this.toString() - }, - },*/ - + /** This models toString() */ toString : function(){ return /*this.get('name')*/; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/models/VXPortalUser.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/models/VXPortalUser.js b/security-admin/src/main/webapp/scripts/models/VXPortalUser.js index 079fc9c..ad7526a 100644 --- a/security-admin/src/main/webapp/scripts/models/VXPortalUser.js +++ b/security-admin/src/main/webapp/scripts/models/VXPortalUser.js @@ -56,8 +56,8 @@ define(function(require){ }, lastName : { type : 'Text', - title : localization.tt("lbl.lastName")+' *', - validators : [{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9\s_-]*[a-zA-Z0-9]+$/,message :'Last name should start with alphabets & can have underscore, hyphen, space.'}], + title : localization.tt("lbl.lastName"), + validators : ['required',{type:'regexp',regexp:/^[a-zA-Z][a-zA-Z0-9\s_-]*[a-zA-Z0-9]+$/,message :'Last name should start with alphabets & can have underscore, hyphen, space.'}], editorAttrs : { 'placeholder' : localization.tt("lbl.lastName")} }, emailAddress : { http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/modules/XALinks.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/modules/XALinks.js b/security-admin/src/main/webapp/scripts/modules/XALinks.js index e15b45d..4bcffbc 100755 --- a/security-admin/src/main/webapp/scripts/modules/XALinks.js +++ b/security-admin/src/main/webapp/scripts/modules/XALinks.js @@ -80,7 +80,7 @@ define(function(require) { title: 'h.keyEdit' }, KmsKeyForService : { - href : 'javascrit:;', + href : 'javascript:void(0);', text : 'KMS_TEST1', title: 'KMS_TEST1' }, @@ -110,12 +110,12 @@ define(function(require) { title: 'h.managePolices' }, PolicyCreate: { - href : 'javascipt:;', + href : 'javascript:void(0);', text: 'h.createPolicy', title: 'h.createPolicy' }, PolicyEdit: { - href : 'javascipt:;', + href : 'javascript:void(0);', text: 'h.editPolicy', title: 'h.editPolicy' }, @@ -178,7 +178,7 @@ define(function(require) { text : 'lbl.sessionDetail' }, ServiceCreate : { - href : "javascript:void(0);", + href : 'javascript:void(0);', text : 'lbl.createService', title: 'lbl.createService' }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js index fa02166..6485b7f 100644 --- a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js +++ b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js @@ -313,8 +313,8 @@ define(function(require) { youDontHavePermission : 'You don\'t have permission for the resource !!', myProfileError :'Your password does not match. Please try again with proper password', myProfileSuccess :'Profile Edited successfully', - userNameAlreadyExist : 'User name already exists', - groupNameAlreadyExist : 'Group name already exists', + userNameAlreadyExist : 'User name already exists', + groupNameAlreadyExist : 'Group name already exists', yourAuditLogginIsOff :'You must have at least one or more user/group access defined for the policy.', policyNotHavingPerm : 'The policy does not have any permissions so audit logging cannot be turned off', areSureWantToLogout : 'Are you sure want to logout ?', @@ -324,8 +324,11 @@ define(function(require) { policyDisabledMsg : 'This policy is currently in disabled state.', noRecordsFound : 'No Records Found', keyDeleteMsg : 'Key deleted successfully', - rolloverSuccessfully : 'Key rollover successfully' - + rolloverSuccessfully : 'Key rollover successfully', + userCreatedSucc : 'User created successfully', + userUpdatedSucc : 'User updated successfully', + grpUpdatedSucc : 'Group updated successfully', + grpCreatedSucc : 'Group created successfully', }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/utils/XAUtils.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js index b8a061f..db727ed 100644 --- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js +++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js @@ -1101,7 +1101,7 @@ define(function(require) { }; XAUtils.showErrorMsg = function(respMsg){ var respArr = respMsg.split(/\([0-9]*\)/); - respArr.shift(); + respArr = respArr.filter(function(str){ return str; }); _.each(respArr, function(str){ var validationMsg = str.split(','), erroCodeMsg = ''; //get code from string @@ -1113,7 +1113,8 @@ define(function(require) { } var reason = str.lastIndexOf("reason") != -1 ? (str.substring(str.lastIndexOf("reason")+7, str.indexOf("field[")-3 )) : str; - var erroMsg = erroCodeMsg +"<br/>"+XAUtils.capitaliseFirstLetter(reason); + erroCodeMsg = erroCodeMsg != "" ? erroCodeMsg +"<br/>" : ""; + var erroMsg = erroCodeMsg +""+ XAUtils.capitaliseFirstLetter(reason); return XAUtils.notifyError('Error', erroMsg); }); }; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js deleted file mode 100644 index 75c2967..0000000 --- a/security-admin/src/main/webapp/scripts/views/accounts/AccountCreate.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var App = require('App'); - var Backbone = require('backbone'); - var Communicator = require('communicator'); - var XAUtil = require('utils/XAUtils'); - var XALinks = require('modules/XALinks'); - - var AccountCreate_tmpl = require('hbs!tmpl/accounts/AccountCreate_tmpl'); - var AccountForm = require('views/accounts/AccountForm'); - - var AccountCreate = Backbone.Marionette.Layout.extend( - /** @lends AccountCreate */ - { - _viewName : 'AccountCreate', - - template: AccountCreate_tmpl, - breadCrumbs :function(){ - if(this.model.isNew()) - return [XALinks.get('Accounts'), XALinks.get('AccountCreate')]; - else - return [XALinks.get('Accounts'), XALinks.get('AccountEdit')]; - } , - - /** Layout sub regions */ - regions: { - 'rForm' :'div[data-id="r_form"]' - }, - - /** ui selector cache */ - ui: { - 'btnSave' : '[data-id="save"]', - 'btnCancel' : '[data-id="cancel"]' - }, - - /** ui events hash */ - events: function() { - var events = {}; - events['click ' + this.ui.btnSave] = 'onSave'; - events['click ' + this.ui.btnCancel] = 'onCancel'; - return events; - }, - - /** - * intialize a new AccountCreate ItemView - * @constructs - */ - initialize: function(options) { - console.log("initialized a AccountCreate ItemView"); - - _.extend(this, _.pick(options, '')); - - - - this.bindEvents(); - }, - - /** all events binding here */ - bindEvents : function(){ - /*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/ - /*this.listenTo(communicator.vent,'someView:someEvent', this.someEventHandler, this)'*/ - }, - - /** on render callback */ - onRender: function() { - this.form = new AccountForm({ - model : this.model, - template : require('hbs!tmpl/accounts/AccountForm_tmpl') - }); - this.rForm.show(this.form); - if(!this.model.isNew()){ - this.form.setUpSwitches(); - } - this.initializePlugins(); - }, - - /** all post render plugin initialization */ - initializePlugins: function(){ - }, - - onSave: function(){ - var errors = this.form.commit({validate : false}); - if(! _.isEmpty(errors)){ - return; - } - this.model.save(); - /*this.model.save({},{ - wait: true, - success: function () { - var msg = 'Account created successfully'; - XAUtil.notifySuccess('Success', msg); - App.appRouter.navigate("#!/accounts",{trigger: true}); - console.log("success"); - }, - error: function (model, response, options) { - XAUtil.notifyError('Error', 'Error creating Account!'); - console.log("error"); - } - });*/ - }, - onCancel: function(){ - App.appRouter.navigate("#!/accounts",{trigger: true}); - }, - /** on close */ - onClose: function(){ - App.appRouter.navigate("#!/accounts",{trigger: true}); - } - - }); - - return AccountCreate; -}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js deleted file mode 100644 index f23813f..0000000 --- a/security-admin/src/main/webapp/scripts/views/accounts/AccountDetailLayout.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var Backbone = require('backbone'); - var Communicator = require('communicator'); - - var AccountdetaillayoutTmpl = require('hbs!tmpl/accounts/AccountDetailLayout_tmpl'); - - - var AccountDetailLayout = Backbone.Marionette.Layout.extend( - /** @lends AccountDetailLayout */ - { - _viewName : 'AccountDetailLayout', - - template: AccountdetaillayoutTmpl, - - /** Layout sub regions */ - regions: { - rAccountDetail : '#r_accDetail' - }, - - /** ui selector cache */ - ui: {}, - - /** ui events hash */ - events: function() { - var events = {}; - //events['change ' + this.ui.input] = 'onInputChange'; - return events; - }, - - /** - * intialize a new AccountDetailLayout Layout - * @constructs - */ - initialize: function(options) { - console.log("initialized a AccountDetailLayout Layout"); - - _.extend(this, _.pick(options, '')); - - this.bindEvents(); - }, - - /** all events binding here */ - bindEvents : function(){ - /*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/ - /*this.listenTo(communicator.vent,'someView:someEvent', this.someEventHandler, this)'*/ - }, - - /** on render callback */ - onRender: function() { - this.initializePlugins(); - this.renderDetailView(); - }, - renderDetailView : function(){ - var that = this; - - }, - /** all post render plugin initialization */ - initializePlugins: function(){ - }, - - /** on close */ - onClose: function(){ - } - - }); - - return AccountDetailLayout; -}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js deleted file mode 100644 index 718b9d6..0000000 --- a/security-admin/src/main/webapp/scripts/views/accounts/AccountForm.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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(function(require){ - 'use strict'; - - var Backbone = require('backbone'); - var Communicator = require('communicator'); - var localization = require('utils/XALangSupport'); - var XAEnums = require('utils/XAEnums'); - - require('Backbone.BootstrapModal'); - require('backbone-forms.list'); - require('backbone-forms.templates'); - require('backbone-forms'); - - var AccountForm = Backbone.Form.extend( - /** @lends AccountForm */ - { - _viewName : 'AccountForm', - /** - * intialize a new AccountForm Form View - * @constructs - */ - initialize: function(options) { - console.log("initialized a AccountForm Form View"); - Backbone.Form.prototype.initialize.call(this, options); - - _.extend(this, _.pick(options, '')); - - this.bindEvents(); - }, - - /*schema : function(){ - return _.pick(_.result(this.model.schema),'customerName', 'accountStatus', 'accountCode'); - }, -*/ - /** all events binding here */ - bindEvents : function(){ - /*this.on('field:change', function(form, fieldEditor){ - this.evFieldChange(form, fieldEditor); - });*/ - }, - - /** on render callback */ - onRender: function() { - this.initializePlugins(); - /*if(!this.model.isNew()){ - this.setUpSwitches(); - }*/ - }, - setUpSwitches :function(){ - var that = this; - var accountStatus = false; - _.each(_.toArray(XAEnums.BooleanValue),function(m){ - if(parseInt(that.model.get('accountStatus')) == m.value) - accountStatus = (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false; - }); - this.fields.accountStatus.editor.setValue(accountStatus); - }, - - /** all post render plugin initialization */ - initializePlugins: function(){ - } - - }); - - return AccountForm; -}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js b/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js deleted file mode 100644 index 1bb863b..0000000 --- a/security-admin/src/main/webapp/scripts/views/accounts/AccountTableLayout.js +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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(function(require) {'use strict'; - - var Backbone = require('backbone'); - var Communicator = require('communicator'); - - var XALinks = require('modules/XALinks'); - var XAEnums = require('utils/XAEnums'); - var localization = require('utils/XALangSupport'); - var XABackgrid = require('views/common/XABackgrid'); - var XATableLayout = require('views/common/XATableLayout'); - - var AccounttablelayoutTmpl = require('hbs!tmpl/accounts/AccountTableLayout_tmpl'); - - require('backgrid'); - require('backgrid-paginator'); - //require('backbone-pageable'); - require('jquery-toggles'); - - var AccountTableLayout = Backbone.Marionette.Layout.extend( - /** @lends AccountTableLayout */ - { - _viewName : 'AccountTableLayout', - - template : AccounttablelayoutTmpl, - breadCrumbs : [XALinks.get('Accounts')], - - /** Layout sub regions */ - regions : { - 'rTableList' : 'div[data-id="r_tableList"]', - 'rPagination' : 'div[data-id="r_pagination"]' - }, - - /** ui selector cache */ - ui : {}, - - /** ui events hash */ - events : function() { - var events = {}; - //events['change ' + this.ui.input] = 'onInputChange'; - return events; - }, - - /** - * intialize a new AccountTableLayout Layout - * @constructs - */ - initialize : function(options) { - console.log("initialized a AccountTableLayout Layout"); - - _.extend(this, _.pick(options, '')); - - this.bindEvents(); - }, - - /** all events binding here */ - bindEvents : function() { - /*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/ - /*this.listenTo(communicator.vent,'someView:someEvent', this.someEventHandler, this)'*/ - }, - - /** on render callback */ - onRender : function() { - this.initializePlugins(); - this.renderTable(); - }, - - /** all post render plugin initialization */ - initializePlugins : function() { - }, - - renderTable : function() { - /*if(! this.collection.length){ - return; - }*/ - /*var TableRow = Backgrid.Row.extend({ - }); - - this.rTableList.show(new Backgrid.Grid({ - className: 'table table-bordered table-condensed backgrid', - columns : this.getColumns(), - collection : this.collection, - row : TableRow - })); - - - this.rPagination.show(new Backgrid.Extension.Paginator({ - collection : this.collection, - className: "pagination", - controls : { - rewind : { - label : "«", - title : "First" - }, - back : { - label : "â¹", - title : "Previous" - }, - forward : { - label : "âº", - title : "Next" - }, - fastForward : { - label : "»", - title : "Last" - } - }, - }));*/ - this.rTableList.show(new XATableLayout({ - columns: this.getColumns(), - collection: this.collection, - includeFilter : false, - gridOpts : { - header : XABackgrid, - emptyText : 'No Accounts found!' - } - })); - }, - - getColumns : function() { - var cols = { - //id : {}, - customerName : { - label : "Customer Name", - cell : "uri", - href: function(model){ - return '#!/account/'+model.get('id')+'/user/' + 1; - } - }, - accountStatus : { - label : "Status", - /*cell :"Switch", - formatter : _.extend({}, Backgrid.CellFormatter.prototype, { - fromRaw : function(rawValue) { - var status; - _.each(_.toArray(XAEnums.BooleanValue),function(m){ - if(parseInt(rawValue) == m.value){ - status = (m.label == XAEnums.BooleanValue.BOOL_TRUE.label) ? true : false; - return ; - } - }); - //You can use rawValue to custom your html, you can change this value using the name parameter. - return status; - } - }),*/ - formatter : _.extend({}, Backgrid.CellFormatter.prototype, { - fromRaw : function(rawValue) { - return rawValue == XAEnums.ActiveStatus.STATUS_ENABLED.value ? XAEnums.ActiveStatus.STATUS_ENABLED.label: XAEnums.ActiveStatus.STATUS_DISABLED.label; - } - }) - } - /*action : { - cell :"uri", - label : localization.tt("lbl.action"), - href: function(model){ - return '#!/accounts/' + model.id+'/edit'; - }, - title : 'Edit', - editable:false, - iconKlass :'icon-edit', - iconTitle :'Edit' - - - }*/ - }; - return this.collection.constructor.getTableCols(cols, this.collection); - }, - - /** on close */ - onClose : function() { - } - }); - - return AccountTableLayout; -}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/common/AddGroup.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/common/AddGroup.js b/security-admin/src/main/webapp/scripts/views/common/AddGroup.js index ecee740..1246e57 100644 --- a/security-admin/src/main/webapp/scripts/views/common/AddGroup.js +++ b/security-admin/src/main/webapp/scripts/views/common/AddGroup.js @@ -27,7 +27,7 @@ define(function(require){ var XAEnums = require('utils/XAEnums'); var localization = require('utils/XALangSupport'); var VXGroup = require('models/VXGroup'); - var AddGroup_tmpl = require('hbs!tmpl/common/AddGroup_tmpl'); + var AddGroup_tmpl = require('hbs!tmpl/common/AddGroup_tmpl'); require('bootstrap-editable'); var AddGroup = Backbone.Marionette.ItemView.extend( @@ -61,7 +61,6 @@ define(function(require){ */ initialize: function(options) { console.log("initialized a AddGroup ItemView"); - _.extend(this, _.pick(options)); this.bindEvents(); }, @@ -94,38 +93,30 @@ define(function(require){ return; } that.checkDirtyFieldForGroup(values); - if(!_.isArray(values)) - values=values.toString().split(','); + if(!_.isArray(values)) values=values.toString().split(','); + var valArr = []; - if(!_.isUndefined($(that.el).find('.select2-container-multi')) && $(that.el).find('.select2-container-multi').length > 0){ + if(!_.isUndefined($(that.el).find('.select2-container-multi')) + && $(that.el).find('.select2-container-multi').length > 0){ values = $(that.el).find('.select2-container-multi').select2('data') - }else{ + } else { var groupNameList = that.model.get('groupNameList'); values = _.map(that.model.get('groupIdList'),function(id,i){ return {'id': id, 'text': groupNameList[i]};}); } + valArr = _.map(values,function(val,i){ return "<span class='label label-inverse'>" + val.text + "</span>" },that); + that.groupArr = values; that.firstTimeEditGroup = true; - $(this).html(valArr.join(" ")); - /*if(valArr.length > 0){ - that.$('.field-groupIdList').removeClass('error'); - that.ui.errorMsg.hide(); - }else{ - that.$('.field-groupIdList').addClass('error'); - that.ui.errorMsg.show(); - }*/ - }, success: function(response, newValue) { - console.log(newValue); that.firstTimeEditGroup = false; - //that.model.set('group',newValue); - } }); + this.$('[id^="tags-edit-"]').click(function(e) { e.stopPropagation(); e.preventDefault(); @@ -140,9 +131,7 @@ define(function(require){ var valuesSoFar = {}; for (var i = 0; i < array.length; ++i) { var value = array[i]; - if (Object.prototype.hasOwnProperty.call(valuesSoFar, value)) { - return true; - } + if (Object.prototype.hasOwnProperty.call(valuesSoFar, value)) { return true; } valuesSoFar[value] = true; } return false; @@ -162,22 +151,12 @@ define(function(require){ var data = []; if(!_.isUndefined(that.groupArr) && that.firstTimeEditGroup){ data = that.groupArr; - } - else + } else { data = element.select2('data'); + } callback(data); }, - /*createSearchChoice: function(term, data) { - if ($(data).filter(function() { - return this.text.localeCompare(term) === 0; - }).length === 0) { - return { - id : term, - text: term - }; - } - },*/ ajax: { url: "service/xusers/groups", dataType: 'json', @@ -187,20 +166,19 @@ define(function(require){ results: function (data, page) { var results = [],selectedVals = []; groupCnt = data.resultSize - if(!_.isEmpty(that.$('.tags').data('editable').input.$input.val())) + + if(!_.isEmpty(that.$('.tags').data('editable').input.$input.val())) { selectedVals = that.$('.tags').data('editable').input.$input.val().split(','); + } if(data.resultSize != "0"){ - //if(data.vXGroups.length > 1){ - results = data.vXGroups.map(function(m, i){ return {id : (m.id).toString(), text: m.name}; }); - if(!_.isEmpty(selectedVals)) - results = XAUtil.filterResultByIds(results, selectedVals); - // console.log(results.length); - groupCnt = results.length; - return {results : results}; - // } - // results = [{id : (data.vXGroups.id)+"", text: data.vXGroups.name}]; - // return {results : results}; + results = data.vXGroups.map(function(m, i){ return {id : (m.id).toString(), text: m.name}; }); + if(!_.isEmpty(selectedVals)) { + results = XAUtil.filterResultByIds(results, selectedVals); + } + groupCnt = results.length; + return {results : results}; } + return {results : results}; } }, @@ -211,20 +189,18 @@ define(function(require){ return result.text; }, formatNoMatches: function(result){ - if(groupCnt > 0) - return 'Please enter one more character.' - else - return 'No group found.'; + return groupCnt > 0 ? 'Please enter one more character.' : 'No group found.'; } }; }, checkDirtyFieldForGroup : function(changeValues){ var groupIdList = []; - if(!_.isArray(changeValues)) - changeValues = [changeValues]; - changeValues = _.map(changeValues, function(val){return parseInt(val);}); - if(!_.isUndefined(this.model.get('groupIdList'))) + if(!_.isArray(changeValues)) changeValues = [changeValues]; + + changeValues = _.map(changeValues, function(val){ return parseInt(val); }); + if(!_.isUndefined(this.model.get('groupIdList'))){ groupIdList = this.model.get('groupIdList'); + } XAUtil.checkDirtyField(groupIdList, changeValues, this.$el); }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js b/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js index c1f2d4b..0093740 100644 --- a/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js +++ b/security-admin/src/main/webapp/scripts/views/common/BreadCrumbs.js @@ -49,7 +49,7 @@ define(function(require) { },this);*/ }, onRender : function(){ - + this.$el.find('li:last a').addClass('_allowNav'); }, reRenderBookmarks : function(){ this.breadcrumb = this.setLast(this.breadcrumb); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/common/FormInputItemList.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/common/FormInputItemList.js b/security-admin/src/main/webapp/scripts/views/common/FormInputItemList.js deleted file mode 100644 index ca1ebc4..0000000 --- a/security-admin/src/main/webapp/scripts/views/common/FormInputItemList.js +++ /dev/null @@ -1,426 +0,0 @@ -/* - * 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(function(require) { - 'use strict'; - - var Backbone = require('backbone'); - var App = require('App'); - var XAEnums = require('utils/XAEnums'); - var XAUtil = require('utils/XAUtils'); - var localization = require('utils/XALangSupport'); - var VXGroup = require('models/VXGroup'); - require('bootstrap-editable'); - - var FormInputItem = Backbone.Marionette.ItemView.extend({ - _msvName : 'FormInputItem', - template : require('hbs!tmpl/common/formInputItem'), - tagName : 'tr', - templateHelpers : function(){ - - return { - permissions : _.flatten(_.pick(XAEnums.XAPermType, XAUtil.getPerms(this.policyType))), - policyKnox : this.policyType == XAEnums.AssetType.ASSET_KNOX.value ? true :false, - policyStorm : this.policyType == XAEnums.AssetType.ASSET_STORM.value ? true :false, - isModelNew : !this.model.has('editMode'), - stormPerms : this.stormPermsIds.length == 14 ? _.union(this.stormPermsIds,[-1]) : this.stormPermsIds - - }; - }, - ui : { - selectGroups : '[data-js="selectGroups"]', - inputIPAddress : '[data-js="ipAddress"]', - tags : '[class=tags]' - }, - events : { - 'click [data-action="delete"]' : 'evDelete', - 'click td' : 'evClickTD', - 'change [data-js="selectGroups"]': 'evSelectGroup', - 'change [data-js="ipAddress"]' : 'evIPAddress' - }, - - initialize : function(options) { - _.extend(this, _.pick(options, 'groupList','policyType')); - //this.subjectList = this.mStudent.getSubjectList(); - this.stormPermsIds = []; - if(this.policyType == XAEnums.AssetType.ASSET_STORM.value){ - if(this.model.has('editMode') && this.model.get('editMode')){ - this.stormPermsIds = _.map(this.model.get('_vPermList'), function(p){ - if(XAEnums.XAPermType.XA_PERM_TYPE_ADMIN.value != p.permType) - return p.permType; - }); - } - } - }, - - onRender : function() { - var that = this; - if(!_.isUndefined(this.model.get('groupId'))){ - this.ui.selectGroups.val(this.model.get('groupId').split(',')); - } - if(!_.isUndefined(this.model.get('ipAddress'))){ - this.ui.inputIPAddress.val(this.model.get('ipAddress').toString()); - } - if(this.model.has('editMode') && this.model.get('editMode')){ - _.each(this.model.get('_vPermList'), function(p){ - this.$el.find('input[data-id="' + p.permType + '"]').attr('checked', 'checked'); - },this); - } - this.createGroupDropDown(); - this.groupDropDownChange(); - if(this.policyType == XAEnums.AssetType.ASSET_STORM.value){ - this.renderStormPerms(); - } - }, - groupDropDownChange : function(){ - var that = this; - this.ui.selectGroups.on('change',function(e){ - // console.log(e.currentTarget.value); - that.checkDirtyFieldForDropDown(e); - var duplicateGroupName = false; - - that.toggleAddButton(e); - if(e.removed != undefined){ - var gIdArr = [],gNameArr = []; - gIdArr = _.without(that.model.get('groupId').split(','), e.removed.id); - if(that.model.get('groupName') != undefined) - gNameArr = _.without(that.model.get('groupName').split(','), e.removed.text); - if(!_.isEmpty(gIdArr)){ - that.model.set('groupId',gIdArr.join(',')); - that.model.set('groupName',gNameArr.join(',')); - }else{ - that.model.unset('groupId'); - that.model.unset('groupName'); - } - return; - } - if(!_.isUndefined(e.added)){ - that.model.set('groupId', e.currentTarget.value); - } - }); - }, - createGroupDropDown :function(){ - var that = this; - if(this.model.has('editMode') && !_.isEmpty(this.ui.selectGroups.val())){ - var temp = this.ui.selectGroups.val().split(","); - _.each(temp , function(id){ - if(_.isUndefined(that.groupList.get(id))){ - var group = new VXGroup({id : id}); - group.fetch({async:false}).done(function(){ - that.groupList.add(group); - }); - } - }); - } - this.groupArr = this.groupList.map(function(m){ - return { id : m.id+"" , text : m.get('name')}; - }); - this.ui.selectGroups.select2({ - closeOnSelect : true, - placeholder : 'Select Group', - // maximumSelectionSize : 1, - width :'220px', - tokenSeparators: [",", " "], - tags : this.groupArr, - initSelection : function (element, callback) { - var data = []; - console.log(that.groupList); - - $(element.val().split(",")).each(function () { - var obj = _.findWhere(that.groupArr,{id:this}); - // if(!_.isUndefined(obj)) - data.push({id: this, text: obj.text}); - /*else{ - var group = new VXGroup({id : this}); - group.fetch().done(function(){ - data.push({id: group.id, text: group.get('name')}); - }); - }*/ - }); - callback(data); - }, - createSearchChoice: function(term, data) { - /* if ($(data).filter(function() { - return this.text.localeCompare(term) === 0; - }).length === 0) { - return { - id : term, - text: term - }; - }*/ - }, - ajax: { - url: "service/xusers/groups", - dataType: 'json', - data: function (term, page) { - return {name : term, isVisible : XAEnums.VisibilityStatus.STATUS_VISIBLE.value}; - }, - results: function (data, page) { - var results = [] , selectedVals = []; - /*if(!_.isEmpty(that.ui.selectGroups.select2('val'))) - selectedVals = that.ui.selectGroups.select2('val');*/ - selectedVals = that.getGroupSelectdValues(); - if(data.resultSize != "0"){ - //if(data.vXGroups.length > 1){ - - results = data.vXGroups.map(function(m, i){ return {id : m.id+"", text: m.name}; }); - if(!_.isEmpty(selectedVals)) - results = XAUtil.filterResultByIds(results, selectedVals); - // console.log(results.length); - return {results : results}; - //} - // results = [{id : data.vXGroups.id+"", text: data.vXGroups.name}]; - // return {results : results}; - } - return {results : results}; - } - }, - formatResult : function(result){ - return result.text; - }, - formatSelection : function(result){ - return result.text; - }, - formatNoMatches: function(result){ - return 'No group found.'; - } - }).on('select2-focus', XAUtil.select2Focus); - }, - getGroupSelectdValues : function(){ - var vals = [],selectedVals = []; - this.collection.each(function(m){ - if(!_.isUndefined(m.get('groupId'))){ - vals.push.apply(vals, m.get('groupId').split(',')); - } - }); - if(!_.isEmpty(this.ui.selectGroups.select2('val'))) - selectedVals = this.ui.selectGroups.select2('val'); - vals.push.apply(vals , selectedVals); - vals = $.unique(vals); - return vals; - }, - evDelete : function(){ - var that = this; - this.collection.remove(this.model); - this.toggleAddButton(); - }, - evClickTD : function(e){ - var $el = $(e.currentTarget),permList =[],perms =[]; - if($(e.toElement).is('td')){ - var $checkbox = $el.find('input'); - $checkbox.is(':checked') ? $checkbox.prop('checked',false) : $checkbox.prop('checked',true); - } - var curPerm = $el.find('input').data('id'); - if(!_.isUndefined(curPerm)){ - var perms = []; - if(this.model.has('_vPermList')){ - if(_.isArray(this.model.get('_vPermList'))) - perms = this.model.get('_vPermList'); - else - perms.push(this.model.get('_vPermList')); - } - /* permMapList = [ {id: 18, groupId : 1, permType :5}, {id: 18, groupId : 1, permType :4}, {id: 18, groupId : 2, permType :5} ] - [1] => [ {id: 18, groupId : 1, permType :5}, {id: 19, groupId : 1, permType :4} ] - [2] => [ {id: 20, groupId : 2, permType :5} ] - { groupId : 1, - _vPermList : [ { id: 18, permType : 5 }, { id: 19, permType : 4 } ] - } - this.model => { groupId : 2, - _vPermList : [ { id: 20, permType : 5 }, { permType : 6 } ] - } - - */ -// perms = this.model.has('_vPermList') ? this.model.get('_vPermList'): []; - - if($el.find('input[type="checkbox"]').is(':checked')){ - perms.push({permType : curPerm}); - if(curPerm == XAEnums.XAPermType.XA_PERM_TYPE_ADMIN.value){ - $el.parent().find('input[type="checkbox"]:not(:checked)[data-id!="'+curPerm+'"]').map(function(){ - perms.push({ permType :$(this).data('id')}); - // return { permType :$(this).data('id')}; - }); - $el.parent().find('input[type="checkbox"]').prop('checked',true); - } - } else { - perms = _.reject(perms,function(el) { return el.permType == curPerm; }); - } - - this.checkDirtyFieldForCheckBox(perms); - if(!_.isEmpty(perms)) - this.model.set('_vPermList', perms); - else - this.model.unset('_vPermList'); - } - }, - checkDirtyFieldForCheckBox : function(perms){ - var permList = []; - if(!_.isUndefined(this.model.get('_vPermList'))) - permList = _.map(this.model.attributes._vPermList,function(obj){return obj.permType;}); - perms = _.map(perms,function(obj){return obj.permType;}); - XAUtil.checkDirtyField(permList, perms, this.$el); - }, - toggleAddButton : function(e){ - var temp = []; - this.collection.each(function(m){ - if(!_.isUndefined(m.get('groupId'))){ - temp.push.apply(temp, m.get('groupId').split(',')); - - } - }); - if(!_.isUndefined(e)){ - if( !_.isUndefined(e.added) && ((temp.length + 1) == this.groupList.length)) - $('[data-action="addGroup"]').hide(); - if(!_.isUndefined(e.removed)) - $('[data-action="addGroup"]').show(); - }else{ - $('[data-action="addGroup"]').show(); - } - }, - evIPAddress :function(e){ - if(!_.isEmpty($(e.currentTarget).val())) - this.model.set('ipAddress',$(e.currentTarget).val().split(',')); - else - this.model.unset('ipAddress'); - }, - renderStormPerms :function(){ - var that = this; - var permArr = _.pick(XAEnums.XAPermType, XAUtil.getStormActions(this.policyType)); - this.stormPerms = _.map(permArr,function(m){return {text:m.label, value:m.value};}); - this.stormPerms.push({'value' : -1, 'text' : 'Select/Deselect All'}); - this.ui.tags.editable({ - placement: 'right', -// emptytext : 'Please select', - source: this.stormPerms, - display: function(idList,srcData) { - if(_.isEmpty(idList.toString())){ - $(this).html(''); - return; - } - if(!_.isArray(idList)) - idList = [idList]; -// that.checkDirtyFieldForGroup(values); - var permTypeArr = []; - var valArr = _.map(idList, function(id){ - if(!(parseInt(id) <= 0) && (!_.isNaN(parseInt(id)))){ - var obj = _.findWhere(srcData,{'value' : parseInt(id)}); - permTypeArr.push({permType : obj.value}); - return "<span class='label label-inverse'>" + obj.text + "</span>"; - } - }); - - if(that.model.has('_vPermList')){ - var adminPerm = _.where(that.model.get('_vPermList'),{'permType': XAEnums.XAPermType.XA_PERM_TYPE_ADMIN.value }); - permTypeArr = _.isEmpty(adminPerm) ? permTypeArr : _.union(permTypeArr,adminPerm); - } - that.model.set('_vPermList', permTypeArr); -// if(!_.isEmpty(perms)) -// that.model.set('_vPermList', perms); -// that.model.set('_vPermList', permTypeArr); - $(this).html(valArr.join(" ")); - }, - }); - this.$('[id^="tags-edit-"]').click(function(e) { - e.stopPropagation(); - e.preventDefault(); - that.$('#' + $(this).data('editable') ).editable('toggle'); - that.$('input[type="checkbox"][value="-1"]').click(function(e){ - var checkboxlist =$(this).closest('.editable-checklist').find('input[type="checkbox"][value!=-1]') - $(this).is(':checked') ? checkboxlist.prop('checked',true) : checkboxlist.prop('checked',false); - - }); - }); - - }, - checkDirtyFieldForDropDown : function(e){ - //that.model.has('groupId') - var groupIdList =[]; - if(!_.isUndefined(this.model.get('groupId'))) - groupIdList = this.model.get('groupId').split(','); - XAUtil.checkDirtyField(groupIdList, e.val, $(e.currentTarget)); - }, - - }); - - - - return Backbone.Marionette.CompositeView.extend({ - _msvName : 'FormInputItemList', - template : require('hbs!tmpl/common/formInputItemList'), - //tagName : 'ul', - //className : 'timeline-container', - templateHelpers :function(){ - console.log(XAUtil.getPermHeaders(this.policyType)); - return { - permHeaders : XAUtil.getPermHeaders(this.policyType) - }; - }, - getItemView : function(item){ - if(!item){ - return; - } - return FormInputItem; - }, - itemViewContainer : ".js-formInput", - itemViewOptions : function() { - return { - 'collection' : this.collection, - 'groupList' : this.groupList, - 'policyType' : this.policyType, - }; - }, - events : { - 'click [data-action="addGroup"]' : 'addNew' - }, - initialize : function(options) { - _.extend(this, _.pick(options, 'groupList','policyType')); - //this.hiveGroupPerm = _.has(options,'hiveGroupPerm') ? true : false; - this.listenTo(this.groupList, 'sync', this.render, this); - if(this.collection.length == 0) - this.collection.add(new Backbone.Model()); - }, - onRender : function(){ - //console.log("onRender of ArtifactFormNoteList called"); - this.toggleAddButton(); - }, - addNew : function(){ - var that =this; - if(this.groupList.length > this.collection.length){ - this.collection.add(new Backbone.Model()); - this.toggleAddButton(); - } - }, - toggleAddButton : function(){ - var groupIds=[]; - this.collection.each(function(m){ - if(!_.isUndefined(m.get('groupId'))){ - var temp = m.get('groupId').split(','); - groupIds.push.apply(groupIds,temp); - } - }); - if(groupIds.length == this.groupList.length) - this.$('button[data-action="addGroup"]').hide(); - else - this.$('button[data-action="addGroup"]').show(); - }, - }); - -}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/082d0f28/security-admin/src/main/webapp/scripts/views/common/TopNav.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/common/TopNav.js b/security-admin/src/main/webapp/scripts/views/common/TopNav.js index 0e7c6e9..bc5d17c 100644 --- a/security-admin/src/main/webapp/scripts/views/common/TopNav.js +++ b/security-admin/src/main/webapp/scripts/views/common/TopNav.js @@ -53,6 +53,7 @@ define(function(require){ initialize: function(options) { console.log("initialized a TopNav ItemView"); _.extend(this, _.pick(options, '')); + this.bindEvents(); this.appState = options.appState; this.appState.on('change:currentTab', this.highlightNav,this); @@ -110,7 +111,6 @@ define(function(require){ this.$('#nav' + this.appState.get('currentTab')).parent().addClass('active'); }, mainManuURLS : function() { - }, /** on close */ onClose: function(){
