mirror of https://github.com/apache/archiva.git
better to use a select2 binding
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1452603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
41a4df1640
commit
f945442570
|
@ -70,6 +70,7 @@ $.ajax({
|
||||||
"jquery.json": "jquery.json-2.3.min",
|
"jquery.json": "jquery.json-2.3.min",
|
||||||
"knockout": "knockout-2.2.0.debug",
|
"knockout": "knockout-2.2.0.debug",
|
||||||
"knockout.simpleGrid": "knockout.simpleGrid",
|
"knockout.simpleGrid": "knockout.simpleGrid",
|
||||||
|
"knockout.select2": "knockout.select2",
|
||||||
"knockout.sortable": "knockout-sortable",
|
"knockout.sortable": "knockout-sortable",
|
||||||
"jquery.iframe.transport": "jquery.iframe-transport-1.4",
|
"jquery.iframe.transport": "jquery.iframe-transport-1.4",
|
||||||
"jquery.fileupload": "jquery.fileupload-5.10.0",
|
"jquery.fileupload": "jquery.fileupload-5.10.0",
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
||||||
"knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2"]
|
"knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2","knockout.select2"]
|
||||||
, function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) {
|
, function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) {
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
@ -1388,7 +1388,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
this.availableUserManagerImpls=ko.observableArray([]);
|
this.availableUserManagerImpls=ko.observableArray([]);
|
||||||
this.availableRbacManagerImpls=ko.observableArray([]);
|
this.availableRbacManagerImpls=ko.observableArray([]);
|
||||||
|
|
||||||
this.allRoleNames=[];
|
this.allRoleNames=ko.observableArray([]);
|
||||||
|
|
||||||
findUserManagerImplementationInformation=function(id){
|
findUserManagerImplementationInformation=function(id){
|
||||||
for(var i= 0;i<self.userManagerImplementationInformations().length;i++){
|
for(var i= 0;i<self.userManagerImplementationInformations().length;i++){
|
||||||
|
@ -1694,7 +1694,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
self.modifiesLdapGroupMappings().push(ldapGroupMapping);
|
self.modifiesLdapGroupMappings().push(ldapGroupMapping);
|
||||||
}
|
}
|
||||||
$.log('modifyLdapGroupMapping:'+ldapGroupMapping.group()+','+self.modifiesLdapGroupMappings().length);
|
$.log('modifyLdapGroupMapping:'+ldapGroupMapping.group()+','+self.modifiesLdapGroupMappings().length);
|
||||||
//$("#ldap-group-mappings-div select" ).select2({width: "element"});
|
|
||||||
};
|
};
|
||||||
//olamy could be better but some reason doesn't work and I didn't find enough to understand why :-)
|
//olamy could be better but some reason doesn't work and I didn't find enough to understand why :-)
|
||||||
/*self.gridldapMappingsViewModel = new ko.simpleGrid.viewModel({
|
/*self.gridldapMappingsViewModel = new ko.simpleGrid.viewModel({
|
||||||
|
@ -1726,11 +1725,15 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
|
|
||||||
this.newLdapGroupMapping=ko.observable(new LdapGroupMapping("",[],false,null));
|
this.newLdapGroupMapping=ko.observable(new LdapGroupMapping("",[],false,null));
|
||||||
|
|
||||||
this.ldapSelectOptionCaption = $.i18n.prop('redback.runtime.ldap.mapping.select.group');
|
|
||||||
|
|
||||||
addLdapGroupMapping=function(){
|
addLdapGroupMapping=function(){
|
||||||
// FIXME validate datas from ldapGroupMapping
|
// FIXME validate datas from ldapGroupMapping
|
||||||
$.log("addLdapGroupMapping:"+self.newLdapGroupMapping().group());
|
$.log("addLdapGroupMapping:"+self.newLdapGroupMapping().group());
|
||||||
|
clearUserMessages();
|
||||||
|
|
||||||
|
if (self.newLdapGroupMapping().roleNames().length<1){
|
||||||
|
displayErrorMessage( $.i18n.prop('redback-runtime-ldap-group-mapping.role.mandatory'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var mainContent=$("#main-content");
|
var mainContent=$("#main-content");
|
||||||
var saveButton = mainContent.find("#redback-runtime-configuration-save" );
|
var saveButton = mainContent.find("#redback-runtime-configuration-save" );
|
||||||
|
@ -1748,7 +1751,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
self.redbackRuntimeConfiguration().ldapGroupMappings
|
self.redbackRuntimeConfiguration().ldapGroupMappings
|
||||||
.unshift(new LdapGroupMapping(self.newLdapGroupMapping().group(),self.newLdapGroupMapping().roleNames(),false,self.modifyLdapGroupMapping));
|
.unshift(new LdapGroupMapping(self.newLdapGroupMapping().group(),self.newLdapGroupMapping().roleNames(),false,self.modifyLdapGroupMapping));
|
||||||
$.log("addLdapGroupMapping:"+self.redbackRuntimeConfiguration().ldapGroupMappings().length);
|
$.log("addLdapGroupMapping:"+self.redbackRuntimeConfiguration().ldapGroupMappings().length);
|
||||||
$("#ldap-group-mappings-div select" ).select2({width: "element"});
|
|
||||||
var message=$.i18n.prop('redback-runtime-ldap-group-mapping.added');
|
var message=$.i18n.prop('redback-runtime-ldap-group-mapping.added');
|
||||||
displaySuccessMessage(message);
|
displaySuccessMessage(message);
|
||||||
},
|
},
|
||||||
|
@ -1761,9 +1763,9 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
function(){
|
function(){
|
||||||
removeMediumSpinnerImg(userMessages);
|
removeMediumSpinnerImg(userMessages);
|
||||||
$.log("addLdapGroupMapping#always");
|
$.log("addLdapGroupMapping#always");
|
||||||
//self.newLdapGroupMapping().group("");
|
//self.newLdapGroupMapping.group("");
|
||||||
//self.newLdapGroupMapping().roleNames([]);
|
//self.newLdapGroupMapping.roleNames([]);
|
||||||
self.newLdapGroupMapping=ko.observable(new LdapGroupMapping("",[],false,null));
|
//self.newLdapGroupMapping(new LdapGroupMapping("",[],false,null));
|
||||||
saveButton.button('reset');
|
saveButton.button('reset');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -1788,7 +1790,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$.log("deleteLdapGroupMapping:"+ldapGroupMapping.group());
|
$.log("deleteLdapGroupMapping:"+ldapGroupMapping.group());
|
||||||
self.redbackRuntimeConfiguration().ldapGroupMappings.remove(ldapGroupMapping);
|
self.redbackRuntimeConfiguration().ldapGroupMappings.remove(ldapGroupMapping);
|
||||||
$("#ldap-group-mappings-div select" ).select2({width: "element"});
|
|
||||||
var message=$.i18n.prop('redback-runtime-ldap-group-mapping.deleted');
|
var message=$.i18n.prop('redback-runtime-ldap-group-mapping.deleted');
|
||||||
displaySuccessMessage(message);
|
displaySuccessMessage(message);
|
||||||
},
|
},
|
||||||
|
@ -1953,7 +1954,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
return item.name;
|
return item.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
redbackRuntimeConfigurationViewModel.allRoleNames=allRoleNames;
|
redbackRuntimeConfigurationViewModel.allRoleNames=ko.observableArray(allRoleNames);
|
||||||
if (redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapConfiguration().useRoleNameAsGroup()) {
|
if (redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapConfiguration().useRoleNameAsGroup()) {
|
||||||
// if using groups == roles add all as mapping except already mapped
|
// if using groups == roles add all as mapping except already mapped
|
||||||
$.each(groups,function(idx,item){
|
$.each(groups,function(idx,item){
|
||||||
|
@ -1978,7 +1979,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||||
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
|
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
|
||||||
activateRedbackRuntimeGeneralFormValidation();
|
activateRedbackRuntimeGeneralFormValidation();
|
||||||
activateLdapConfigurationFormValidation();
|
activateLdapConfigurationFormValidation();
|
||||||
$("#ldap-group-mappings-div select" ).select2({width: "element"});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LdapGroupMapping=function(group,roleNames,automatic,subscribeFn){
|
LdapGroupMapping=function(group,roleNames,automatic,subscribeFn){
|
||||||
|
|
|
@ -1265,12 +1265,13 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select data-bind="options: ldapGroups,value: $parent.newLdapGroupMapping().group" size="1">
|
<select data-bind="options: ldapGroups,value: $parent.newLdapGroupMapping().group, select2: { }"
|
||||||
|
size="1" style="min-width: 150px">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select data-bind="options: $parent.allRoleNames, selectedOptions: $parent.newLdapGroupMapping().roleNames"
|
<select data-bind="options: $parent.allRoleNames, selectedOptions: $parent.newLdapGroupMapping().roleNames, select2: { }"
|
||||||
size="5" multiple="true" ></select>
|
size="5" multiple="true" style="min-width: 200px"></select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{each(i, ldapGroupMapping) ldapGroupMappings()}}
|
{{each(i, ldapGroupMapping) ldapGroupMappings()}}
|
||||||
|
@ -1284,8 +1285,9 @@
|
||||||
${ldapGroupMapping.group}
|
${ldapGroupMapping.group}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="roles-group-mapping-${ldapGroupMapping.group()}" data-bind="options: $parent.allRoleNames, selectedOptions: ldapGroupMapping.roleNames"
|
<select id="roles-group-mapping-${ldapGroupMapping.group()}"
|
||||||
size="5" multiple="true" ></select>
|
data-bind="options: $parent.allRoleNames, selectedOptions: ldapGroupMapping.roleNames, select2: { }"
|
||||||
|
size="5" multiple="true" style="min-width: 200px"></select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
Loading…
Reference in New Issue