Repository: incubator-ranger
Updated Branches:
  refs/heads/master 94bf5903b -> 2f8bcd234


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js 
b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
new file mode 100644
index 0000000..c3e8f4a
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
@@ -0,0 +1,345 @@
+/*
+ * 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 XAEnums             = require('utils/XAEnums');
+       var XALinks             = require('modules/XALinks');
+       var XAUtil                      = require('utils/XAUtils');
+       var localization        = require('utils/XALangSupport');
+       
+       var RangerServiceList   = require('collections/RangerServiceList');
+       var KmsKeyList                  = require('collections/VXKmsKeyList');
+       var KmsKey                              = require('models/VXKmsKey');
+       var XATableLayout               = require('views/common/XATableLayout');
+       var KmsTablelayoutTmpl  = require('hbs!tmpl/kms/KmsTableLayout_tmpl');
+
+       var KmsTableLayout = Backbone.Marionette.Layout.extend(
+       /** @lends KmsTableLayout */
+       {
+               _viewName : 'KmsTableLayout',
+               
+       template: KmsTablelayoutTmpl,
+       templateHelpers : function(){
+//             return { kmsServiceName : this.kmsServiceName };
+       },
+       breadCrumbs :[XALinks.get('Kms')],
+               /** Layout sub regions */
+       regions: {
+               'rTableList' :'div[data-id="r_tableList"]',
+       },
+
+       /** ui selector cache */
+       ui: {
+               tab             : '.nav-tabs',
+               addNewKey       : '[data-id="addNewKey"]',
+               deleteKeyBtn    : '[data-name="deleteKey"]',
+               visualSearch: '.visual_search',
+               selectServiceName       : '[data-js="serviceName"]'
+       },
+
+               /** ui events hash */
+               events: function() {
+                       var events = {};
+                       events['click '+this.ui.tab+' li a']  = 'onTabChange';
+                       events['click '+this.ui.deleteKeyBtn]  = 'onDelete';
+                       
+                       return events;
+               },
+
+       /**
+               * intialize a new KmsTableLayout Layout 
+               * @constructs
+               */
+               initialize: function(options) {
+                       console.log("initialized a KmsTableLayout Layout");
+                       _.extend(this, _.pick(options, 
'tab','kmsServiceName','kmsManagePage'));
+                       this.showKeyList = true;
+                       this.isKnownKmsServicePage =  this.kmsManagePage == 
'new' ? false : true;
+                       this.initializeKMSServices();
+                       if(this.isKnownKmsServicePage){
+                               this.getKeysForKmsService();    
+                       }
+                       this.bindEvents();
+               },
+
+               /** all events binding here */
+               bindEvents : function(){
+                       var that = this;
+                       /*this.listenTo(this.model, "change:foo", 
this.modelChanged, this);*/
+                       /*this.listenTo(communicator.vent,'someView:someEvent', 
this.someEventHandler, this)'*/
+               },
+               initializeKMSServices : function(){
+                       this.rangerKmsServList = new RangerServiceList();
+                       this.rangerKmsServList.queryParams['serviceType'] =  
'kms';
+                       this.rangerKmsServList.fetch({
+                               cache : false,
+                               async : false
+                       });
+               },
+               getKeysForKmsService : function() {
+                       this.collection.queryParams['provider'] = 
this.kmsServiceName;
+                       this.collection.fetch({
+                               cache : false,
+                               reset :true,
+                               error : function(model,resp){
+                                       var errorMsg = 'Error getting key 
list!!';
+                                       if(!_.isUndefined(resp) && 
!_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
+                                               errorMsg = 
resp.responseJSON.msgDesc;
+                                       }
+                                       XAUtil.notifyError('Error', errorMsg);
+                               }
+                       });
+               },
+               /** on render callback */
+               onRender: function() {
+                       this.initializePlugins();
+                       if(_.isUndefined(this.tab)){
+                               this.renderKeyTab();
+                       }
+                       if(this.isKnownKmsServicePage){
+                               
this.ui.selectServiceName.val(this.ksmServiceName);
+                               this.ui.addNewKey.attr('disabled',false);
+                               this.ui.addNewKey.attr('href','#!/kms/keys/'+ 
this.kmsServiceName +'/create')
+                               
+                       }else{
+                               this.ui.addNewKey.attr('disabled',true);
+                       }
+                       this.setupKmsServiceAutoComplete();
+                       this.addVisualSearch();
+               },
+               onTabChange : function(e){
+                       var that = this;
+                       this.showKeyList = $(e.currentTarget).attr('href') == 
'#keys' ? true : false;
+                       if(this.showKeyList){                           
+                               this.renderKeyTab();
+//                             this.addVisualSearch();
+                       }
+               },
+               renderKeyTab : function(){
+                       var that = this;
+                       this.renderKeyListTable();
+               },
+               renderKeyListTable : function(){
+                       var that = this;
+                       this.rTableList.show(new XATableLayout({
+                               columns: this.getColumns(),
+                               collection: this.collection,
+                               includeFilter : false,
+                               gridOpts : {
+                                       row: Backgrid.Row.extend({}),
+                                       emptyText : 'No Key found!'
+                               }
+                       }));    
+
+               },
+
+               getColumns : function(){
+                       var that = this;
+                       var cols = {
+                               
+                               name : {
+                                       label   : 
localization.tt("lbl.keyName"),
+                                       href: function(model){
+                                               return 
'#!/kms/keys/'+that.kmsServiceName+'/edit/'+model.get('name');
+                                       },
+                                       editable:false,
+                                       sortable:false,
+                                       cell :'uri'                             
                
+                               },
+                               cipher : {
+                                       label   : localization.tt("lbl.cipher"),
+                                       cell : 'string',
+                                       editable:false,
+                                       sortable:false,
+                               },
+                               versions : {
+                                       label   : 
localization.tt("lbl.version"),
+                                       cell : 'string',
+                                       editable:false,
+                                       sortable:false,
+                               },
+                               attributes : {
+                                       label: 
localization.tt("lbl.attributes"),
+                                       cell : 'html',
+                                       editable:false,
+                                       sortable:false,
+                                       formatter: _.extend({}, 
Backgrid.CellFormatter.prototype, {
+                                               fromRaw: function (rawValue) {
+                                                       var html = '';
+                                                       _.each(rawValue, 
function(val, key) {
+                                                               html += key+' 
<i class="icon-long-arrow-right icon-3"></i>  '+val+'<br/>';
+                                                       });
+                                                       return html;
+                                               }       
+                                       })      
+                               },
+                               length : {
+                                       label   : localization.tt("lbl.length"),
+                                       cell : 'string',
+                                       editable:false,
+                                       sortable:false,
+                               },
+                               created : {
+                                       label   : 
localization.tt("lbl.createdDate"),
+                                       cell : 'string',
+                                       click : false,
+                                       drag : false,
+                                       editable:false,
+                                       sortable:false,
+//                    sortType: 'toggle',
+//                    direction: 'descending',
+                                       formatter: _.extend({}, 
Backgrid.CellFormatter.prototype, {
+                                               fromRaw: function (rawValue, 
model) {
+                                                       
if(!_.isUndefined(rawValue))
+                                                       return 
Globalize.format(new Date(rawValue),  "MM/dd/yyyy hh:mm:ss tt");
+                                               }
+                                       })
+                               },
+                               operation : {
+                                               cell :  "html",
+                                               label : 
localization.tt("lbl.action"),
+                                               formatter: _.extend({}, 
Backgrid.CellFormatter.prototype, {
+                                                       fromRaw: function 
(rawValue,model) {
+                                                               return '<a 
href="#!/kms/keys/'+that.kmsServiceName+'/edit/'+model.get('name')+'" 
class="btn btn-mini" title="Rollover"><i class="icon-edit" /></a>\
+                                                                               
<a href="javascript:void(0);" data-name ="deleteKey" 
data-id="'+model.get('name')+'"  class="btn btn-mini btn-danger" 
title="Delete"><i class="icon-trash" /></a>';
+                                                               //You can use 
rawValue to custom your html, you can change this value using the name 
parameter.
+                                                       }
+                                               }),
+                                               editable: false,
+                                               sortable : false
+
+                               }
+                               
+                       };
+                       return this.collection.constructor.getTableCols(cols, 
this.collection);
+               },
+               
+               addVisualSearch : function(){
+                       var coll,placeholder;
+                       var searchOpt = [], serverAttrName = [];
+                       if(this.showKeyList){
+                               placeholder = 
localization.tt('h.searchForKeys');       
+                               coll = this.collection;
+                               searchOpt = ['Key Name'];
+                               serverAttrName  = [     {text : "Key Name", 
label :"name"}];
+                       }
+                       var query = (!_.isUndefined(coll.VSQuery)) ? 
coll.VSQuery : '';
+                       var pluginAttr = {
+                                     placeholder :placeholder,
+                                     container : this.ui.visualSearch,
+                                     query     : query,
+                                     callbacks :  { 
+                                         valueMatches :function(facet, 
searchTerm, callback) {
+                                                               switch (facet) {
+                                                               }     
+                                       
+                                                       }
+                                     }
+                               };
+                       XAUtil.addVisualSearch(searchOpt,serverAttrName, 
coll,pluginAttr);
+               },
+               /** all post render plugin initialization */
+               initializePlugins: function(){
+               },
+               setupKmsServiceAutoComplete : function(serviceName){
+                       var that = this, arr = [];
+                       this.ui.selectServiceName.select2({
+                               maximumSelectionSize : 1,
+                               closeOnSelect : true,
+                               width :'220px',
+                               placeholder : 'Please select KMS service',
+                               initSelection : function (element, callback) {
+                                       callback({ id : element.val(), text : 
element.val()});
+                               },
+                               ajax: { 
+                                       url: "service/plugins/services",
+                                       dataType: 'json',
+                                       data: function (term, page) {
+                                               return {name : term, 
'serviceType' : 'kms'};
+                                       },
+                                       results: function (data, page) { 
+                                               var results = [],selectedVals = 
[];
+                                               if(data.resultSize != "0"){
+                                                       results = 
data.services.map(function(m, i){     return {id : m.name, text: m.name};     
});
+                                                       return {results : 
results};
+                                               }
+                                               return { results : results };
+                                       }
+                               },      
+                               formatResult : function(result){
+                                       return result.text;
+                               },
+                               formatSelection : function(result){
+                                       return result.text;
+                               },
+                               formatNoMatches: function(result){
+                                       return 'No service found.';
+                               }
+                       })
+                       .on('select2-focus', XAUtil.select2Focus)
+                       .on('change',function(e) {
+                               that.kmsServiceName = (e.currentTarget.value)
+                               that.ui.addNewKey.attr('disabled',false);
+                               
that.ui.addNewKey.attr('href','#!/kms/keys/'+that.kmsServiceName+'/create')
+                               that.getKeysForKmsService();
+                       });
+                       
+               },
+               onDelete :function(e){
+                       var that = this;
+                       
+                       var obj = 
this.collection.get($(e.currentTarget).data('id'));
+                       var model = new KmsKey(obj.attributes);
+                       model.collection = this.collection;
+                       var url = 
model.urlRoot+"/"+model.get('name')+"?provider="+ this.kmsServiceName;
+                       XAUtil.confirmPopup({
+                               msg :'Are you sure want to delete ?',
+                               callback : function(){
+                                       XAUtil.blockUI();
+                                       
+                                       model.destroy({
+                                               'url' : url,
+                                               'success': function(model, 
response) {
+                                                       
XAUtil.blockUI('unblock');
+                                                       
that.collection.remove(model.get('id'));
+                                                       
XAUtil.notifySuccess('Success', localization.tt('msg.keyDeleteMsg'));
+                                                       that.renderKeyTab();
+                                                       that.collection.fetch();
+                                               },
+                                               'error': function (model, 
response, options) {
+                                                       
XAUtil.blockUI('unblock');
+                                                       
XAUtil.notifyError('Error', 'Error deleting key!');
+                                               }
+                                       });
+                               }
+                       });
+               },
+               /** on close */
+               onClose: function(){
+                       XAUtil.allowNavigation();
+               }
+
+       });
+
+       return KmsTableLayout; 
+});

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js 
b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
new file mode 100644
index 0000000..4bf9bd1
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyCreate.js
@@ -0,0 +1,186 @@
+/*
+ * 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.
+ */
+
+ 
+/* 
+ * Policy create view
+ */
+
+define(function(require){
+    'use strict';
+
+       var Backbone            = require('backbone');
+       var App                         = require('App');
+       var XAEnums                     = require('utils/XAEnums');
+       var XAUtil                      = require('utils/XAUtils');
+       var XALinks             = require('modules/XALinks');
+       var localization        = require('utils/XALangSupport');
+       
+       var KmsKeyCreateTmpl= require('hbs!tmpl/kms/KmsKeyCreate_tmpl');
+       var RKmsKeyForm         = require('views/kms/KmsKeyForm');
+//     var RangerServiceDef    = require('models/RangerServiceDef');
+
+       var KmsKeyCreate = Backbone.Marionette.Layout.extend(
+       /** @lends KmsKeyCreate */
+       {
+               _viewName : 'KmsKeyCreate',
+               
+       template : KmsKeyCreateTmpl,
+       templateHelpers : function(){
+               return {
+                       editPolicy : this.editPolicy
+               };
+       },
+       breadCrumbs :function(){
+               var opts = { 'kmsService' : this.kmsService, 
'kmsServiceDefModel' : this.kmsServiceDefModel }
+               if(this.model.isNew())
+                       return [XALinks.get('Kms'), 
XALinks.get('KmsServiceForKey', opts), XALinks.get('KmsKeyCreate')];
+               return [XALinks.get('Kms'), XALinks.get('KmsServiceForKey', 
opts), XALinks.get('KmsKeyEdit')];
+       } ,        
+
+               /** Layout sub regions */
+       regions: {
+                       'rForm' :'div[data-id="r_form"]'
+               },
+
+       /** ui selector cache */
+       ui: {
+                       'btnSave'       : '[data-id="save"]',
+                       'btnCancel' : '[data-id="cancel"]',
+                       'btnDelete' : '[data-id="delete"]',
+               },
+
+               /** ui events hash */
+               events: function() {
+                       var events = {};
+                       events['click ' + this.ui.btnSave]              = 
'onSave';
+                       events['click ' + this.ui.btnCancel]    = 'onCancel';
+                       events['click ' + this.ui.btnDelete]    = 'onDelete';
+                       
+                       return events;
+               },
+
+       /**
+               * intialize a new KmsKeyCreate Layout 
+               * @constructs
+               */
+               initialize: function(options) {
+                       var that = this;
+                       console.log("initialized a KmsKeyCreate Layout");
+
+                       _.extend(this, _.pick(options,'kmsServiceName'));
+                       this.getKmsInfoFromServiceName();
+                       that.form = new RKmsKeyForm({
+                               template : 
require('hbs!tmpl/kms/KmsKeyForm_tmpl'),
+                               model : this.model,
+                       });
+
+                       this.editPolicy = this.model.has('id') ? true : false;
+                       this.bindEvents();
+                       this.params = {};
+               },
+               
+               /** 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.rForm.show(this.form);
+                       this.rForm.$el.dirtyFields();
+                       
XAUtil.preventNavigation(localization.tt('dialogMsg.preventNavPolicyForm'),this.rForm.$el);
+               },
+               onSave: function(){
+                       var that =this ;
+                       var errors = this.form.commit({validate : false});
+                       if(! _.isEmpty(errors)){
+                               return;
+                       }
+                       var options = {
+                               url : this.model.urlRoot+"?provider="+ 
this.kmsServiceName,
+                               success: function () {
+                                       XAUtil.blockUI('unblock');
+                                       XAUtil.allowNavigation();
+                                       var msg = that.editGroup ? 'Key updated 
successfully' :'Key created successfully';
+                                       XAUtil.notifySuccess('Success', msg);
+                                       
App.appRouter.navigate("#!/kms/keys/edit/manage/"+that.kmsServiceName,{trigger: 
true});
+                               },
+                               error : function (model, resp, options) {
+                                       XAUtil.blockUI('unblock');
+                                       var errorMsg = 'Error creating Key!';
+                                       if(!_.isUndefined(resp) && 
!_.isUndefined(resp.responseJSON) && !_.isUndefined(resp.responseJSON.msgDesc)){
+                                               errorMsg = 
resp.responseJSON.msgDesc;
+                                       }
+                                       XAUtil.notifyError('Error', errorMsg);
+                               }
+                       }
+                       //to check model is new or not
+                       options.type = (this.model.has('versions')) ? 'PUT'  : 
'POST';
+                       this.form.beforeSave();
+                       XAUtil.blockUI();
+                       this.model.save({},options);
+               },
+               onCancel : function(){
+                       XAUtil.allowNavigation();
+                       
App.appRouter.navigate("#!/kms/keys/edit/manage/"+this.kmsServiceName,{trigger: 
true});
+               },
+               onDelete :function(){
+                       var that = this;
+                       var url = this.model.urlRoot+"?provider="+ 
this.kmsServiceName;
+                       XAUtil.confirmPopup({
+                               //msg :localize.tt('msg.confirmDelete'),
+                               msg :'Are you sure want to delete ?',
+                               callback : function(){
+                                       XAUtil.blockUI();
+                                       that.model.destroy({
+                                               url : url,
+                                               success: function(model, 
response) {
+                                                       
XAUtil.blockUI('unblock');
+                                                       
XAUtil.allowNavigation();
+                                                       
XAUtil.notifySuccess('Success', localization.tt('msg.keyDeleteMsg'));
+                                                       
App.appRouter.navigate("#!/kms/keys/edit/manage/"+that.kmsServiceName,{trigger: 
true});
+                                               },
+                                               error: function (model, 
response, options) {
+                                                       
XAUtil.blockUI('unblock');
+                                                       
XAUtil.notifyError('Error', 'Error deleting key!');
+                                               }
+                                       });
+                               }
+                       });
+               },
+               getKmsInfoFromServiceName : function() {
+                       var KmsServiceDef       = 
require('models/RangerServiceDef');
+                       var KmsService                  = 
require('models/RangerService');
+                       this.kmsService = new KmsService();
+                       this.kmsService.url = 
XAUtil.getRangerServiceByName(this.kmsServiceName);
+                       this.kmsService.fetch({ cache : false, async : false });
+                       this.kmsServiceDefModel = new KmsServiceDef({id : 
this.kmsService.id});
+                       this.kmsServiceDefModel.fetch({ cache : false, async : 
false })
+               },
+               /** on close */
+               onClose: function(){
+                       XAUtil.allowNavigation();
+               }
+
+       });
+
+       return KmsKeyCreate;
+});

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js 
b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js
new file mode 100644
index 0000000..f6ed100
--- /dev/null
+++ b/security-admin/src/main/webapp/scripts/views/kms/KmsKeyForm.js
@@ -0,0 +1,107 @@
+/*
+ * 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 XAEnums                     = require('utils/XAEnums');
+       var localization        = require('utils/XALangSupport');
+       
+       require('backbone-forms');
+       require('backbone-forms.templates');
+       var KmsKeyForm = Backbone.Form.extend(
+       /** @lends KmsKeyForm */
+       {
+               _viewName : 'KmsKeyForm',
+
+       /**
+               * intialize a new KmsKeyForm Form View 
+               * @constructs
+               */
+               initialize: function(options) {
+                       console.log("initialized a KmsKeyForm Form View");
+                       _.extend(this, _.pick(options,''));
+               Backbone.Form.prototype.initialize.call(this, options);
+
+                       this.bindEvents();
+               },
+               /** all events binding here */
+               bindEvents : function(){
+               },
+               schema : function(){
+                       return {
+                               name : {
+                                       type            : 'Text',
+                                       title           : 
localization.tt("lbl.keyName") +' *',
+                                       validators  : ['required'],
+                               },
+                               cipher : {
+                                       type            : 'Text',
+                                       title           : 
localization.tt("lbl.cipher"),
+                                       fieldAttrs      : {style : 
'display:none;'},
+                                       editorAttrs : {'disabled' : true}
+                               },
+                               length : {
+                                       type            : 'Number',
+                                       title           : 
localization.tt("lbl.length"),
+                                       fieldAttrs      : {style : 
'display:none;'},
+                                       editorAttrs : {'disabled' : true}
+                               },
+                               material : {
+                                       type            : 'Text',
+                                       title           : 
localization.tt("lbl.material"),
+                                       fieldAttrs      : {style : 
'display:none;'},
+                                       editorAttrs : {'disabled' : true}
+                               },
+                               description : {
+                                       type            : 'TextArea',
+                                       title           : 
localization.tt("lbl.description"),
+                               }
+                       };
+               },      
+               /** on render callback */
+               render: function(options) {
+                       Backbone.Form.prototype.render.call(this, options);
+                       this.initializePlugins();
+                       if(this.model.has('versions')){
+                               this.fields.cipher.$el.show();
+                               this.fields.length.$el.show();
+                               this.fields.material.$el.show();
+                               
this.fields.description.editor.$el.attr('disabled',true);
+                       }
+               },
+               /** all post render plugin initialization */
+               initializePlugins: function(){
+               },
+               beforeSave : function(){
+                       //to check model is new or not
+                       if(this.model.has('versions')){
+                               this.model.attributes = { 'name' : 
this.model.get('name') };
+                       }else{
+                               this.model.attributes = { 'name' : 
this.model.get('name'), 'description' : this.model.get('description')};      
+                       }
+                       
+               }
+               
+       });
+
+       return KmsKeyForm;
+});

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html 
b/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html
index 2bbd349..148ff85 100644
--- a/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html
+++ b/security-admin/src/main/webapp/templates/common/TopNav_tmpl.html
@@ -31,22 +31,22 @@
                {{/hasAccessToTab}}
                {{#hasAccessToTab  'Analytics'}}
                <li>
-                       <a href="#!/reports/userAccess" id="nav7"><i 
class="icon-beaker"></i> {{tt 'h.analytics'}} </a>
+                       <a href="#!/reports/userAccess" id="nav4"><i 
class="icon-beaker"></i> {{tt 'h.analytics'}} </a>
                </li>
                {{/hasAccessToTab}}
                {{#hasAccessToTab  'Audit'}}
                <li>
-                       <a href="#!/reports/audit/bigData" id="nav8"><i class=" 
icon-file-alt"></i> {{tt 'h.audit'}} </a>
+                       <a href="#!/reports/audit/bigData" id="nav5"><i class=" 
icon-file-alt"></i> {{tt 'h.audit'}} </a>
                </li>
                {{/hasAccessToTab}}
                {{#isSystemAdmin .}}
                <li>
-                       <a href="#!/permissions" id="nav8"><i class=" 
icon-file-alt"></i> {{tt 'h.permissions'}} </a>
+                       <a href="#!/permissions" id="nav6"><i class=" 
icon-file-alt"></i> {{tt 'h.permissions'}} </a>
                </li>
                {{/isSystemAdmin}}
         
-       <!--    <li>
-                       <a href="#" id="nav4"><i class="icon-cog"></i> {{tt 
'h.config'}} </a>
-               </li> -->
+               <li>
+                       <a href="#!/kms/keys/new/manage/service" id="nav7"><i 
class="icon-key"></i> {{tt 'h.kms'}} </a>
+               </li>
        </ul>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/templates/kms/KmsKeyCreate_tmpl.html
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/templates/kms/KmsKeyCreate_tmpl.html 
b/security-admin/src/main/webapp/templates/kms/KmsKeyCreate_tmpl.html
new file mode 100644
index 0000000..1249aed
--- /dev/null
+++ b/security-admin/src/main/webapp/templates/kms/KmsKeyCreate_tmpl.html
@@ -0,0 +1,30 @@
+{{!-- 
+  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.
+--}}
+<h4 class="wrap-header bold"> Key Detail </h4>
+<div class="wrap non-collapsible ">
+       <div data-id="r_form"></div>
+       <div class="form-actions form-policy" class="row-fluid">
+               <button type="button" data-id="save" class="btn btn-primary">
+                       Save
+               </button>
+               <button type="button" data-id="cancel" class="btn btn-inverse">
+                       Cancel
+               </button>
+               <!-- <button type="button" data-id="delete" class="btn 
btn-danger" >style="margin-left: 27%;"Delete</button> -->
+       </div>
+</div>
+

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html 
b/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html
new file mode 100644
index 0000000..7a0d4c0
--- /dev/null
+++ b/security-admin/src/main/webapp/templates/kms/KmsKeyForm_tmpl.html
@@ -0,0 +1,19 @@
+{{!-- 
+  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.
+--}}
+<form class="form-horizontal" >
+               <div class="" data-fields="*"></div>
+</form>

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2f8bcd23/security-admin/src/main/webapp/templates/kms/KmsTableLayout_tmpl.html
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/webapp/templates/kms/KmsTableLayout_tmpl.html 
b/security-admin/src/main/webapp/templates/kms/KmsTableLayout_tmpl.html
new file mode 100644
index 0000000..8437c04
--- /dev/null
+++ b/security-admin/src/main/webapp/templates/kms/KmsTableLayout_tmpl.html
@@ -0,0 +1,46 @@
+{{!-- 
+  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.
+--}}
+ <!--  <ul class="nav nav-tabs tabs clearfix">
+    <li data="groups" data-js="groups"> 
+      <a data-toggle="tab" href="#groups">Zones</a> 
+    </li>
+    <li class="active" data-js="users">
+      <a data-toggle="tab" href="#users">Keys</a> 
+    </li>
+  </ul> -->
+
+<h3 class="wrap-header bold"> {{tt 'lbl.keyManagement'}} </h3>
+<div class="wrap non-collapsible m-height ">
+       <fieldset>
+               <p class="formHeader" style="padding: 12px 4px;">
+                       Select Service : <input type="text" name="serviceName" 
data-js="serviceName" style="margin-left: 17px;font-weight: normal;font-size: 
13px;" >
+               </p>
+       </fieldset>
+       <div style=" margin-top: 14px; ">
+               <div class="span9">
+                       <div class="visual_search"></div>
+               </div>
+               <div class="clearfix">
+                       <!-- <input type="text" name="serviceName" 
data-js="serviceName" style="margin-top: 1px;margin-left: -17px;"> -->
+                       <a href="javascript:;" class="btn btn-primary 
btn-right" type="button" data-id="addNewKey"> {{tt 'lbl.addNewKey'}} </a>
+                       <a href="#!/group/create" class="btn btn-primary 
btn-right" type="button" data-id="addNewGroup" style="display:none;"> {{tt 
'lbl.addNewZone'}} </a>
+               </div>
+               <div data-id="r_tableList" class="clickable">
+          <b class="_prevNav"></b>
+               </div>
+       </div>
+</div>

Reply via email to