mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
column formatting Allow optional formatting for columns Provide Data formate for host modificaiton
date format
This commit is contained in:
parent
6f6d50f37f
commit
d14ef576c3
@ -227,21 +227,28 @@ IPA.target_section = function(spec) {
|
||||
that.add_field(that.attribute_table);
|
||||
|
||||
|
||||
/*TODO these next two functions are work arounds for missing attribute
|
||||
permissions for the filter text. Remove them once that has been fixed */
|
||||
that.filter_text.update = function(){
|
||||
var value = that.filter_text.values && that.filter_text.values.length ?
|
||||
that.filter_text.values[0] : '';
|
||||
$('input[name="'+that.filter_text.name+'"]', that.filter_text.container).val(value);
|
||||
$('input[name="'+that.filter_text.name+'"]',
|
||||
that.filter_text.container).val(value);
|
||||
|
||||
var label = $('label[name="'+that.filter_text.name+'"]',
|
||||
that.filter_text.container);
|
||||
var input = $('input[name="'+that.filter_text.name+'"]',
|
||||
that.filter_text.container);
|
||||
|
||||
label.css('display', 'none');
|
||||
input.css('display', 'inline');
|
||||
|
||||
label.css('display', 'none');
|
||||
input.css('display', 'inline');
|
||||
};
|
||||
|
||||
that.filter_text.save = function(){
|
||||
var input = $('input[name="'+that.filter_text.name+'"]',
|
||||
that.filter_text.container);
|
||||
var value = $.trim(input.val());
|
||||
return value === '' ? [] : [value];
|
||||
};
|
||||
|
||||
var target_types = [
|
||||
{
|
||||
|
@ -103,6 +103,32 @@ IPA.host_add_dialog = function (spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
/* Take an LDAP format date in UTC and format it */
|
||||
IPA.utc_date_column_format = function(value){
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (value.length != "20101119025910Z".length){
|
||||
return value;
|
||||
}
|
||||
/* We only handle GMT */
|
||||
if (value.charAt(value.length -1) !== 'Z'){
|
||||
return value;
|
||||
}
|
||||
|
||||
var date = new Date();
|
||||
|
||||
date.setUTCFullYear(
|
||||
value.substring(0, 4),
|
||||
value.substring(4, 6),
|
||||
value.substring(6, 8));
|
||||
date.setUTCHours(
|
||||
value.substring(8, 10),
|
||||
value.substring(10, 12),
|
||||
value.substring(12, 14));
|
||||
var formated = date.toString();
|
||||
return formated;
|
||||
};
|
||||
|
||||
IPA.host_search_facet = function (spec) {
|
||||
|
||||
@ -115,7 +141,9 @@ IPA.host_search_facet = function (spec) {
|
||||
that.create_column({name:'fqdn'});
|
||||
that.create_column({name:'description'});
|
||||
//TODO use the value of this field to set enrollment status
|
||||
that.create_column({name:'krblastpwdchange', label:'Enrolled?'});
|
||||
that.create_column({name:'krblastpwdchange', label:'Enrolled?',
|
||||
format:IPA.utc_date_column_format
|
||||
});
|
||||
that.create_column({name:'nshostlocation'});
|
||||
|
||||
that.search_facet_init();
|
||||
|
@ -1005,6 +1005,9 @@ IPA.column = function (spec) {
|
||||
|
||||
var that = {};
|
||||
|
||||
if (spec.format){
|
||||
that.format = spec.format;
|
||||
}
|
||||
that.name = spec.name;
|
||||
that.label = spec.label;
|
||||
that.primary_key = spec.primary_key;
|
||||
@ -1025,8 +1028,13 @@ IPA.column = function (spec) {
|
||||
container.empty();
|
||||
|
||||
var value = record[that.name];
|
||||
if (that.format && value){
|
||||
value = that.format(value);
|
||||
}
|
||||
|
||||
value = value ? value.toString() : '';
|
||||
|
||||
|
||||
container.append(value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user