Repository: ranger Updated Branches: refs/heads/master 5c39c2127 -> ab2a7df91
http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/scripts/views/policies/PolicyTimeList.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/policies/PolicyTimeList.js b/security-admin/src/main/webapp/scripts/views/policies/PolicyTimeList.js new file mode 100644 index 0000000..0d88072 --- /dev/null +++ b/security-admin/src/main/webapp/scripts/views/policies/PolicyTimeList.js @@ -0,0 +1,166 @@ +/* + * 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 XAGlobals = require('utils/XAGlobals'); + var localization = require('utils/XALangSupport'); + var localization = require('utils/XALangSupport'); + require('bootstrap-editable'); + require('bootstrap-datetimepicker'); + + var PolicyTimeItem = Backbone.Marionette.ItemView.extend({ + _msvName : 'PolicyTimeItem', + template : require('hbs!tmpl/policies/PolicyTimeItem_tmpl'), + tagName : 'tr', + templateHelpers : function(){ + }, + ui : { + 'startTime' : '[data-js="startTime"]', + 'endTime': '[data-js="endTime"]', + 'timezone': '[data-js="timezone"]', + }, + events : { + 'click [data-action="delete"]' : 'evDelete', + 'change [data-js="startTimeInput"]' : 'onInputStartTimeChange', + 'change [data-js="endTimeInput"]' : 'onInputEndTimeChange', + 'change [data-js="timezone"]' : 'onTimezoneChange' + + }, + + initialize : function(options) { + _.extend(this, _.pick(options,'')); + }, + + onRender : function() { + var that = this; + var startTime = this.$el.find(this.ui.startTime).datetimepicker({autoclose:true}), + endTime = this.$el.find(this.ui.endTime).datetimepicker({autoclose:true});; + + startTime.on('changeDate', function(ev){ + that.$el.find(that.ui.endTime).datetimepicker('setStartDate', ev.date); + }); + this.$el.find(this.ui.timezone).select2({ + data: XAGlobals.Timezones, + multiple: false, + closeOnSelect: true, + placeholder: 'Select Timezone', + maximumSelectionSize : 1, + width: '220px', + allowClear: true, + width:180 + }); + }, + onInputStartTimeChange : function(e) { + if(!_.isEmpty($(e.currentTarget).val()) && !_.isUndefined($(e.currentTarget).val())){ + this.model.set('startTime', $(e.currentTarget).val()); + }else{ + this.model.unset('startTime'); + } + }, + onInputEndTimeChange : function(e) { + if(!_.isEmpty($(e.currentTarget).val()) && !_.isUndefined($(e.currentTarget).val())){ + this.model.set('endTime', $(e.currentTarget).val()); + }else{ + this.model.unset('endTime'); + } + }, + onTimezoneChange : function(e) { + if(!_.isEmpty($(e.currentTarget).val()) && !_.isUndefined($(e.currentTarget).val())){ + this.model.set('timeZone', $(e.currentTarget).val()); + }else{ + this.model.unset('timeZone'); + } + }, + evDelete : function(){ + var that = this; + this.collection.remove(this.model); + }, + }); + + var PolicyTimeList = Backbone.Marionette.CompositeView.extend({ + _msvName : 'PolicyTimeList', + template : require('hbs!tmpl/policies/PolicyTimeList_tmpl'), + templateHelpers :function(){ + return { + 'fieldLabel' : this.fieldLabel, + 'errorMsg' : localization.tt('validationMessages.setTimeZoneErrorMsg'), + }; + }, + getItemView : function(item){ + if(!item){ + return; + } + return PolicyTimeItem; + }, + itemViewContainer : ".js-formInput", + itemViewOptions : function() { + return { + 'collection' : this.collection, + }; + }, + events : { + 'click [data-action="addTime"]' : 'addNew' + }, + initialize : function(options) { + _.extend(this, _.pick(options, 'fieldLabel')); + if(this.collection.length == 0){ + this.collection.add(new Backbone.Model()); + } + this.bind("ok", this.onSave); + }, + onRender : function(){ + }, + addNew : function(){ + var that =this; + this.$('table').show(); + this.collection.add(new Backbone.Model()); + }, + onSave: function (modal) { + var self = this + if(! _.isUndefined(this.collection.models)){ + var error = _.some(this.collection.models, function(m){ + var startTime = new Date(m.get('startTime')), endTime = new Date(m.get('endTime')); + if(_.isEmpty(m.get('endTime')) && _.isEmpty(m.get('startTime')) && !_.isEmpty(m.get('timeZone'))){ + modal.preventClose(); + modal.$content.find('.errorMsg').removeClass('display-none'); + return true + } else if(startTime.valueOf() > endTime.valueOf() ){ + modal.preventClose(); + modal.$content.find('.errorMsg').html('Start date can not be later in time than end date.').removeClass('display-none'); + return true; + } + }); + if(error){ + return + } + } + this.model.set('validitySchedules', _.reject(this.collection.toJSON(), function(m){ return (_.isEmpty(m) || (_.isEmpty(m.startTime) && _.isEmpty(m.endTime)))})); + } + }); + return PolicyTimeList; +}); http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js index 4b15ab7..1b82128 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js +++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js @@ -44,7 +44,7 @@ define(function(require){ template : RangerPolicycreateTmpl, templateHelpers : function(){ - var infoMsg = '', displayClass = 'hide'; + var infoMsg = '', displayClass = 'hide', policyTimeStatus = '', expiredClass = 'hide'; if(XAUtil.isMaskingPolicy(this.model.get('policyType'))){ if(XAUtil.isTagBasedDef(this.rangerServiceDefModel)){ infoMsg = localization.tt('msg.maskingPolicyInfoMsgForTagBased'), displayClass = 'show'; @@ -54,10 +54,19 @@ define(function(require){ }else if(XAUtil.isRowFilterPolicy(this.model.get('policyType'))){ infoMsg = localization.tt('msg.rowFilterPolicyInfoMsg'), displayClass = 'show'; } + if(this.editPolicy && !_.isEmpty(this.model.get('validitySchedules'))){ + if(XAUtil.policyExpierd(this.model)){ + expiredClass = 'hide'; + }else{ + policyTimeStatus = localization.tt('msg.policyExpired'), expiredClass = 'show'; + } + } return { editPolicy : this.editPolicy, infoMsg : infoMsg, - displayClass : displayClass + displayClass : displayClass, + policyTimeStatus : policyTimeStatus, + expiredClass : expiredClass }; }, breadCrumbs :function(){ http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js index 04dad2e..6d511e1 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js +++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js @@ -33,6 +33,7 @@ define(function(require){ var VXAuditMapList = require('collections/VXAuditMapList'); var VXUserList = require('collections/VXUserList'); var PermissionList = require('views/policies/PermissionList'); + var vPolicyTimeList = require('views/policies/PolicyTimeList'); var RangerPolicyResource = require('models/RangerPolicyResource'); var BackboneFormDataType = require('models/BackboneFormDataType'); @@ -63,7 +64,9 @@ define(function(require){ } return { 'id' : this.model.id, 'policyType' : policyType.label, - 'conditionType' : conditionType + 'conditionType' : conditionType, + 'policyTimeBtnLabel': (this.model.has('validitySchedules') && this.model.get('validitySchedules').length > 0) ? localization.tt('lbl.editValidityPeriod') + : localization.tt('lbl.addValidityPeriod') }; }, initialize: function(options) { @@ -101,6 +104,7 @@ define(function(require){ ui : { 'denyConditionItems' : '[data-js="denyConditionItems"]', 'allowExcludePerm' : '[data-js="allowExcludePerm"]', + 'policyTimeBtn' : '[data-js="policyTimeBtn"]' }, /** fields for the form */ @@ -110,22 +114,22 @@ define(function(require){ }, getSchema : function(){ var attrs = {},that = this; - var basicSchema = ['name','isEnabled']; + var basicSchema = ['name','isEnabled','policyPriority','policyLabels']; var schemaNames = this.getPolicyBaseFieldNames(); - + var formDataType = new BackboneFormDataType(); attrs = formDataType.getFormElements(this.rangerServiceDefModel.get('resources'),this.rangerServiceDefModel.get('enums'), attrs, this, true); - + var attr1 = _.pick(_.result(this.model,'schemaBase'),basicSchema); var attr2 = _.pick(_.result(this.model,'schemaBase'),schemaNames); return _.extend(attr1,_.extend(attrs,attr2)); }, /** on render callback */ render: function(options) { - var that = this; + var that = this; Backbone.Form.prototype.render.call(this, options); //initialize path plugin for hdfs component : resourcePath - if(!_.isUndefined(this.initilializePathPlugin) && this.initilializePathPlugin){ + if(!_.isUndefined(this.initilializePathPlugin) && this.initilializePathPlugin){ this.initializePathPlugins(this.pathPluginOpts); } this.renderCustomFields(); @@ -134,12 +138,44 @@ define(function(require){ } //checkParent this.renderParentChildHideShow(); - + //to show error msg on below the field(only for policy name) this.fields.isEnabled.$el.find('.control-label').removeClass(); this.fields.name.$el.find('.help-inline').removeClass('help-inline').addClass('help-block margin-left-5') this.initializePlugins(); + this.setPolicyValidityTime(); + }, + setPolicyValidityTime : function(){ + var that = this; + this.$el.find(this.ui.policyTimeBtn).on('click', function(e){ + var view = new vPolicyTimeList({ + collection: that.model.has('validitySchedules') ? new Backbone.Collection(that.model.get('validitySchedules')) : new Backbone.Collection(), + model : that.model + }); + var modal = new Backbone.BootstrapModal({ + content : view, + title : 'Policy Validity Period', + okText :"Save", + animate : true,focusOk:false, + escape:false, + // allowCancel:false, + modalOptions:{ + backdrop: 'static', + keyboard: false + }, + }).open(); + + modal.$el.addClass('modal-policy-time'); + //To prevent modal being close by click out of modal + modal.$el.find('.cancel, .close, .ok').on('click', function(e){ + modal._preventClose = false; + }); + modal.on('shown', function(a){ + this.preventClose(); + }); + }); + }, initializePlugins : function() { var that = this; this.$(".wrap-header").each(function(i, ele) { @@ -246,13 +282,16 @@ define(function(require){ }*/ this.model.set(resourceDef.name, obj) } - },this) + },this); } }, setUpSwitches :function(){ var that = this; this.fields.isAuditEnabled.editor.setValue(this.model.get('isAuditEnabled')); this.fields.isEnabled.editor.setValue(this.model.get('isEnabled')); + if(this.model.has('policyPriority')){ + this.fields.policyPriority.editor.setValue(this.model.get('policyPriority') == 1 ? true : false); + } }, /** all custom field rendering */ renderCustomFields: function(){ @@ -456,6 +495,9 @@ define(function(require){ } this.model.set('service',this.rangerService.get('name')); this.model.set('name', _.escape(this.model.get('name'))); + if(this.model.has('policyPriority')){ + this.model.set('policyPriority', this.model.get('policyPriority') ? 1 : 0); + } }, setPermissionsToColl : function(list, policyItemList) { list.each(function(m){ @@ -766,8 +808,7 @@ define(function(require){ return obj; }, getPolicyBaseFieldNames : function(){ - var fields = ['isAuditEnabled','description','policyLabels']; - return fields; + return ['description','isAuditEnabled']; }, getResources : function(){ if(XAUtil.isMaskingPolicy(this.model.get('policyType'))){ @@ -784,6 +825,5 @@ define(function(require){ return this.rangerServiceDefModel.get('resources'); }, }); - return RangerPolicyForm; }); http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js index fa7f191..bd46034 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js +++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js @@ -116,6 +116,7 @@ define(function(require) { details.id = this.policy.get('id'); details.name = this.policy.get('name'); details.isEnabled = this.policy.get('isEnabled') ? localization.tt('lbl.ActiveStatus_STATUS_ENABLED') : localization.tt('lbl.ActiveStatus_STATUS_DISABLED'); + details.policyPriority = this.policy.get('policyPriority') == 1 ? localization.tt('lbl.override') : localization.tt('lbl.normal'); details.description = this.policy.get('description'); details.isAuditEnabled = this.policy.get('isAuditEnabled') ? XAEnums.AuditStatus.AUDIT_ENABLED.label : XAEnums.AuditStatus.AUDIT_DISABLED.label; details.resources = []; @@ -167,6 +168,9 @@ define(function(require) { details.createTime = Globalize.format(new Date(this.policy.get('createTime')), "MM/dd/yyyy hh:mm tt"); details.updatedBy = this.policy.get('updatedBy'); details.updateTime = Globalize.format(new Date(this.policy.get('updateTime')), "MM/dd/yyyy hh:mm tt"); + if(this.policy.has('validitySchedules')){ + details.validitySchedules = this.policy.get('validitySchedules'); + } //get policyItems this.createPolicyItems(); http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js index f23d18c..b849799 100644 --- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js +++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js @@ -203,11 +203,22 @@ define(function(require){ var that = this; var cols = { id : { - cell : "uri", - href: function(model){ - return '#!/service/'+that.rangerService.id+'/policies/'+model.id+'/edit'; - }, + cell : 'html', label : localization.tt("lbl.policyId"), + formatter: _.extend({}, Backgrid.CellFormatter.prototype, { + fromRaw: function (rawValue, model) { + if(!_.isEmpty(model.attributes.validitySchedules) && !XAUtil.policyExpierd(model)){ + return '<div class="" style="position: relative; text-align: center;">\ + <!--<i class="icon-exclamation-sign backgrigModelId" title="Policy expired"></i>-->\ + <a class="" href="#!/service/'+that.rangerService.id+'/policies/'+model.id+'/edit">'+model.id+'</a>\ + </div>'; + }else{ + return '<div class="" style="position: relative; text-align: center;">\ + <a class="" href="#!/service/'+that.rangerService.id+'/policies/'+model.id+'/edit">'+model.id+'</a>\ + </div>'; + } + } + }), editable: false, sortable : false }, http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/styles/xa.css ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css index 9eb99d9..ebb6284 100644 --- a/security-admin/src/main/webapp/styles/xa.css +++ b/security-admin/src/main/webapp/styles/xa.css @@ -1755,11 +1755,19 @@ td.html-cell.renderable:last-child { } .policy-form .field-isEnabled{ margin-left: 413px; -margin-bottom: 12px !important; +margin-bottom: 0px !important; } .policy-form .field-isEnabled .controls{ margin-left:30px; } +.policy-form .field-policyPriority{ + margin-left: 413px; + margin-bottom: 0px !important; +} +.policy-form .field-policyPriority .controls{ + margin-top: -45px; + margin-left: 127px; +} .margin-bottom-5{ margin-bottom: 5px; } @@ -1824,6 +1832,7 @@ margin-top: -29px; } .margin-left-5{ margin-left:5px; + line-height:15px; } .tr-inactive { background-color: #F5F5F5; @@ -2298,3 +2307,29 @@ textarea:read-only{ .white-space-normal{ white-space: normal !important; } +.date-input-width-127{ + width: 148px; +} +.modal-policy-time { + width: 720px; + margin-left: -333px; +} +.modal-policy-time .modal-header { + background-color: #eff3f8; + border-radius: 6px 6px 0px 0px; +} +.add-on .icon-th,.icon-remove{ + line-height: 1.5; +} +.timeClock{ + margin-left: 12px; + color: #4c504b; + font-size: large; + margin-top: 10px +} +.backgrigModelId{ + position: absolute; + left: 0; + top: 3px; + color:#bd362f; +} http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/templates/helpers/XAHelpers.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js index 946b6a3..e58bece 100644 --- a/security-admin/src/main/webapp/templates/helpers/XAHelpers.js +++ b/security-admin/src/main/webapp/templates/helpers/XAHelpers.js @@ -563,6 +563,9 @@ && ( !_.isUndefined(rowFilterDef.resources) ) && rowFilterDef.resources.length > 0 ) ? options.fn(this) : options.inverse(this); }); + Handlebars.registerHelper('blankCheck', function(context, options) { + return _.isUndefined(context) || _.isEmpty(context) ? '--' : context; + }); return HHelpers; }); http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/templates/policies/PolicyTimeItem_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/policies/PolicyTimeItem_tmpl.html b/security-admin/src/main/webapp/templates/policies/PolicyTimeItem_tmpl.html new file mode 100644 index 0000000..488babb --- /dev/null +++ b/security-admin/src/main/webapp/templates/policies/PolicyTimeItem_tmpl.html @@ -0,0 +1,38 @@ +{{!-- + 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. +--}} +<td> + <div class="input-append date form_datetime" data-date-format="yyyy/mm/dd hh:ii:ss" data-js="startTime"> + <input class="date-input-width-127" size="16" type="text" value="{{this.startTime}}" readonly data-js="startTimeInput"/> + <span class="add-on"><i class="icon-remove"></i></span> + <span class="add-on"><i class="icon-th"></i></span> + </div> +</td> +<td> + <div class="input-append date form_datetime" data-date-format="yyyy/mm/dd hh:ii:ss" data-js="endTime"> + <input class="date-input-width-127" size="16" type="text" value="{{this.endTime}}" readonly data-js="endTimeInput"/> + <span class="add-on"><i class="icon-remove"></i></span> + <span class="add-on"><i class="icon-th"></i></span> + </div> +</td> +<td> + <input type="text" data-js="timezone" value="{{this.timeZone}}" placeholder="Select timezone" class="date-input-width-127" /> +</td> +<td> + <button type="button" class="btn btn-small btn-danger" data-action="delete"> + <i class="icon-remove"></i> + </button> +</td> http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/templates/policies/PolicyTimeList_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/policies/PolicyTimeList_tmpl.html b/security-admin/src/main/webapp/templates/policies/PolicyTimeList_tmpl.html new file mode 100644 index 0000000..0eea670 --- /dev/null +++ b/security-admin/src/main/webapp/templates/policies/PolicyTimeList_tmpl.html @@ -0,0 +1,40 @@ +{{!-- + 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. +--}} +<div class="alert alert-danger errorMsg display-none">{{errorMsg}}</div> +<div class="control-group"> + <label class="control-label">{{fieldLabel}}</label> + <div class="controls"> + <table class="table table-bordered table-condensed"> + <thead> + <tr> + <th style="text-align: center;">Start Time</th> + <th style="text-align: center;">End Time</th> + <th style="text-align: center;">Time zone</th> + </tr> + </thead> + <tbody class="js-formInput"> + </tbody> + </table> + </div> +</div> +<div class="control-group"> + <div class="controls" style="margin-top:-14px"> + <button type="button" class="btn btn-small" data-action="addTime" title="Add"> + <i class="icon-plus"></i> + </button> + </div> +</div> http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html b/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html index 78a56c6..e85faa8 100644 --- a/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html +++ b/security-admin/src/main/webapp/templates/policies/RangerPolicyCreate_tmpl.html @@ -28,6 +28,10 @@ <button type="button" class="close" data-dismiss="alert">×</button> <i class="icon-info-sign searchInfoUserAccess padding-right-10"></i>{{{infoMsg}}} </div> + <!-- <div class="alert alert-danger {{expiredClass}}" data-id="policyInfoAlert"> + <button type="button" class="close" data-dismiss="alert">×</button> + <i class="icon-time icon-3 padding-right-10 timeClock"></i>{{{policyTimeStatus}}} + </div> --> <div data-id="r_form"></div> <div class="form-actions form-policy"> {{#if editPolicy}} http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/templates/policies/RangerPolicyForm_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/policies/RangerPolicyForm_tmpl.html b/security-admin/src/main/webapp/templates/policies/RangerPolicyForm_tmpl.html index 859aced..9596c6f 100644 --- a/security-admin/src/main/webapp/templates/policies/RangerPolicyForm_tmpl.html +++ b/security-admin/src/main/webapp/templates/policies/RangerPolicyForm_tmpl.html @@ -13,12 +13,16 @@ language governing permissions and limitations under the License. --}} <form class="form-horizontal"> <fieldset> <p class="formHeader"> - Policy Details : + Policy Details : </p> {{#if policyType}} <div class="control-group field-id"> <label class="control-label" for="c1836_id">Policy Type</label> - <div class="controls"><label class="label label-ranger" style="margin-top: 5px; margin-left: 9px;">{{policyType}}</label></div> + <div class="controls"> + <label class="label label-ranger" style="margin-top: 5px; margin-left: 9px;">{{policyType}}</label> + <a href="javascript:void(0);" data-js="policyTimeBtn" data-id="1" class="btn btn-primary pull-right" title="set time for policy"><i class="icon-time icon-large"></i> {{policyTimeBtnLabel}} </a> + </div> + </div> {{/if}} {{#if id}} @@ -53,7 +57,7 @@ language governing permissions and limitations under the License. --}} Conditions :</p> <div class="wrap position-relative"> - + <div class="" data-customfields="groupPermsAllowExclude"> <div class="control-group" style="margin-left: -100px;"> <label class="control-label">Exclude :</label> @@ -102,4 +106,3 @@ language governing permissions and limitations under the License. --}} {{/compare}} </fieldset> </form> - http://git-wip-us.apache.org/repos/asf/ranger/blob/ab2a7df9/security-admin/src/main/webapp/templates/policies/RangerPolicyRO_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/policies/RangerPolicyRO_tmpl.html b/security-admin/src/main/webapp/templates/policies/RangerPolicyRO_tmpl.html index 6d2eb3f..6566d53 100644 --- a/security-admin/src/main/webapp/templates/policies/RangerPolicyRO_tmpl.html +++ b/security-admin/src/main/webapp/templates/policies/RangerPolicyRO_tmpl.html @@ -117,6 +117,35 @@ </tbody> </table> </div> +{{#if PolicyDetails.validitySchedules}} +<div id="policyItems" class="row-fluid"> + <p class="formHeader">Validity Period :<i class="icon-time icon-large pull-right"></i></p> + + <table class="table-permission table-condensed table-read-only" + style="width: 100%"> + <thead> + <tr> + <th>Start Time</th> + <th>End Time</th> + <th>Time zone</th> + </tr> + </thead> + <tbody> + {{#each PolicyDetails.validitySchedules}} + <tr> + <th>{{blankCheck this.startTime}}</th> + <th>{{blankCheck this.endTime}}</th> + <th>{{#if this.timeZone}} + <span class="label label-info">{{this.timeZone}}</span> + {{else}} -- + {{/if}} + </th> + </tr> + {{/each}} + </tbody> + </table> +</div> +{{/if}} {{#each PolicyDetails.policyItemsCond}} <div id="policyItems" class="row-fluid">