RANGER-203: missed fixs in earlier commit on UI fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/a63bf0aa Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/a63bf0aa Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/a63bf0aa Branch: refs/heads/master Commit: a63bf0aaabd1be9094e0029bc0e50a7439733f9f Parents: 4dd6903 Author: Gautam Borad <[email protected]> Authored: Wed Feb 25 01:06:20 2015 -0800 Committer: Madhan Neethiraj <[email protected]> Committed: Wed Feb 25 01:06:20 2015 -0800 ---------------------------------------------------------------------- .../scripts/views/service/ConfigurationList.js | 110 +++++++++++++++++++ .../service/ConfigurationItem_tmpl.html | 24 ++++ .../service/ConfigurationList_tmpl.html | 41 +++++++ 3 files changed, 175 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a63bf0aa/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js b/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js new file mode 100644 index 0000000..17ab912 --- /dev/null +++ b/security-admin/src/main/webapp/scripts/views/service/ConfigurationList.js @@ -0,0 +1,110 @@ +/* + * 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'); + var VXGroupList = require('collections/VXGroupList'); + var VXUserList = require('collections/VXUserList'); + require('bootstrap-editable'); + + var ConfigItem = Backbone.Marionette.ItemView.extend({ + _msvName : 'FormInputItem', + template : require('hbs!tmpl/service/ConfigurationItem_tmpl'), + tagName : 'tr', + templateHelpers : function(){ + }, + ui : { + 'name' : '[data-js="name"]', + 'value': '[data-js="value"]' + }, + events : { + 'click [data-action="delete"]' : 'evDelete', + 'change [data-js="name"]' : 'onInputNameChange', + 'change [data-js="value"]' : 'onInputValueChange' + + }, + + initialize : function(options) { + _.extend(this, _.pick(options,'')); + }, + + onRender : function() { + }, + onInputNameChange : function(e) { + this.model.set('name', $(e.currentTarget).val()); + }, + onInputValueChange : function(e) { + this.model.set('value', $(e.currentTarget).val()); + }, + evDelete : function(){ + var that = this; + this.collection.remove(this.model); + }, + }); + + var ConfigurationList = Backbone.Marionette.CompositeView.extend({ + _msvName : 'ConfigurationList', + template : require('hbs!tmpl/service/ConfigurationList_tmpl'), + templateHelpers :function(){ + }, + getItemView : function(item){ + if(!item){ + return; + } + return ConfigItem; + }, + itemViewContainer : ".js-formInput", + itemViewOptions : function() { + return { + 'collection' : this.collection, + }; + }, + events : { + 'click [data-action="addGroup"]' : 'addNew' + }, + initialize : function(options) { + _.extend(this, _.pick(options, '')); +// this.listenTo(this.groupList, 'sync', this.render, this); + if(this.collection.length == 0) + this.collection.add(new Backbone.Model()); + }, + onRender : function(){ +// this.$('table').hide(); + + }, + addNew : function(){ + var that =this; + this.$('table').show(); + this.collection.add(new Backbone.Model()); + }, + }); + + return ConfigurationList; + +}); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/a63bf0aa/security-admin/src/main/webapp/templates/service/ConfigurationItem_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/service/ConfigurationItem_tmpl.html b/security-admin/src/main/webapp/templates/service/ConfigurationItem_tmpl.html new file mode 100644 index 0000000..a225b1b --- /dev/null +++ b/security-admin/src/main/webapp/templates/service/ConfigurationItem_tmpl.html @@ -0,0 +1,24 @@ +{{!-- + 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><input type="text" data-js="name" value={{this.name}}></td> +<td><input type="text" data-js="value" value={{this.value}}></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/incubator-ranger/blob/a63bf0aa/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html ---------------------------------------------------------------------- diff --git a/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html b/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html new file mode 100644 index 0000000..dc68ef9 --- /dev/null +++ b/security-admin/src/main/webapp/templates/service/ConfigurationList_tmpl.html @@ -0,0 +1,41 @@ +{{!-- + 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="control-group"> + <label class="control-label">Add New Configurations</label> + <div class="controls"> + <table class="table table-bordered table-condensed" style="width:30%"> + <thead> + <tr> + <th style="text-align: center;">Name</th> + <th style="text-align: center;">Value</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="addGroup" title="Add"> + <i class="icon-plus"></i> + </button> + <!-- <button type="button" class="btn btn-small" data-action="addGroup" title="Add"> + Add New Configuration + </button> --> + </div> +</div>
