mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed navigation buttons for HBAC Test.
The Back, Next, and New Test buttons in HBAC Test have been fixed to work properly. Ticket #388
This commit is contained in:
committed by
Endi S. Dewata
parent
d040b93e38
commit
9276e51bce
@@ -405,7 +405,7 @@ IPA.adder_dialog = function(spec) {
|
|||||||
'class': 'adder-dialog-buttons'
|
'class': 'adder-dialog-buttons'
|
||||||
}).appendTo(container);
|
}).appendTo(container);
|
||||||
|
|
||||||
var p = $('<p/>').appendTo(buttons_panel);
|
var div = $('<div/>').appendTo(buttons_panel);
|
||||||
IPA.button({
|
IPA.button({
|
||||||
name: 'add',
|
name: 'add',
|
||||||
label: '>>',
|
label: '>>',
|
||||||
@@ -414,9 +414,9 @@ IPA.adder_dialog = function(spec) {
|
|||||||
that.update_buttons();
|
that.update_buttons();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).appendTo(p);
|
}).appendTo(div);
|
||||||
|
|
||||||
p = $('<p/>').appendTo(buttons_panel);
|
div = $('<div/>').appendTo(buttons_panel);
|
||||||
IPA.button({
|
IPA.button({
|
||||||
name: 'remove',
|
name: 'remove',
|
||||||
label: '<<',
|
label: '<<',
|
||||||
@@ -425,7 +425,7 @@ IPA.adder_dialog = function(spec) {
|
|||||||
that.update_buttons();
|
that.update_buttons();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).appendTo(p);
|
}).appendTo(div);
|
||||||
|
|
||||||
that.filter_field = $('input[name=filter]', that.container);
|
that.filter_field = $('input[name=filter]', that.container);
|
||||||
|
|
||||||
|
@@ -702,6 +702,18 @@ IPA.facet_group = function(spec) {
|
|||||||
return that.facets.get(name);
|
return that.facets.get(name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.get_facet_index = function(name) {
|
||||||
|
return that.facets.get_key_index(name);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.get_facet_by_index = function(index) {
|
||||||
|
return that.facets.get_value_by_index(index);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.get_facet_count = function(index) {
|
||||||
|
return that.facets.length;
|
||||||
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -204,22 +204,31 @@ IPA.hbac.test_facet = function(spec) {
|
|||||||
style: 'float: right'
|
style: 'float: right'
|
||||||
}).appendTo(container);
|
}).appendTo(container);
|
||||||
|
|
||||||
that.back_button = IPA.button({
|
var facet_group = that.entity.get_facet_group('default');
|
||||||
name: 'back',
|
var index = facet_group.get_facet_index(that.name);
|
||||||
label: 'Back',
|
|
||||||
click: function() {
|
if (index > 0) {
|
||||||
if (!that.back_button.hasClass('action-button-disabled')) {
|
that.back_button = IPA.button({
|
||||||
that.back();
|
name: 'back',
|
||||||
|
label: 'Back',
|
||||||
|
icon: 'ui-icon ui-icon-triangle-1-w',
|
||||||
|
click: function() {
|
||||||
|
if (!that.back_button.hasClass('action-button-disabled')) {
|
||||||
|
that.back();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
}).appendTo(buttons);
|
||||||
}
|
|
||||||
}).appendTo(buttons);
|
buttons.append(' ');
|
||||||
|
}
|
||||||
|
|
||||||
that.next_button = IPA.button({
|
that.next_button = IPA.button({
|
||||||
name: 'next',
|
name: 'next',
|
||||||
label: 'Next',
|
label: 'Next',
|
||||||
|
icon: 'ui-icon ui-icon-triangle-1-e',
|
||||||
click: function() {
|
click: function() {
|
||||||
if (!that.add_button.hasClass('action-button-disabled')) {
|
if (!that.next_button.hasClass('action-button-disabled')) {
|
||||||
that.next();
|
that.next();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -227,6 +236,30 @@ IPA.hbac.test_facet = function(spec) {
|
|||||||
}).appendTo(buttons);
|
}).appendTo(buttons);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.back = function() {
|
||||||
|
var facet_group = that.entity.get_facet_group('default');
|
||||||
|
var index = facet_group.get_facet_index(that.name);
|
||||||
|
if (index <= 0) return;
|
||||||
|
|
||||||
|
var facet = facet_group.get_facet_by_index(index - 1);
|
||||||
|
|
||||||
|
var state = {};
|
||||||
|
state[that.entity.name+'-facet'] = facet.name;
|
||||||
|
IPA.nav.push_state(state);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.next = function() {
|
||||||
|
var facet_group = that.entity.get_facet_group('default');
|
||||||
|
var index = facet_group.get_facet_index(that.name);
|
||||||
|
if (index >= facet_group.get_facet_count() - 1) return;
|
||||||
|
|
||||||
|
var facet = facet_group.get_facet_by_index(index + 1);
|
||||||
|
|
||||||
|
var state = {};
|
||||||
|
state[that.entity.name+'-facet'] = facet.name;
|
||||||
|
IPA.nav.push_state(state);
|
||||||
|
};
|
||||||
|
|
||||||
that.get_pkeys = function(data) {
|
that.get_pkeys = function(data) {
|
||||||
var result = data.result.result;
|
var result = data.result.result;
|
||||||
var pkey_name = that.managed_entity.metadata.primary_key;
|
var pkey_name = that.managed_entity.metadata.primary_key;
|
||||||
@@ -261,7 +294,7 @@ IPA.hbac.test_facet = function(spec) {
|
|||||||
|
|
||||||
command.on_success = function(data, text_status, xhr) {
|
command.on_success = function(data, text_status, xhr) {
|
||||||
if (that.filter) that.filter.focus();
|
if (that.filter) that.filter.focus();
|
||||||
that.load(data); // table_facet.load()
|
that.load(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
command.on_error = function(xhr, text_status, error_thrown) {
|
command.on_error = function(xhr, text_status, error_thrown) {
|
||||||
@@ -271,6 +304,10 @@ IPA.hbac.test_facet = function(spec) {
|
|||||||
command.execute();
|
command.execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.reset = function() {
|
||||||
|
that.table.set_values([]);
|
||||||
|
};
|
||||||
|
|
||||||
that.save = function(record) {
|
that.save = function(record) {
|
||||||
if (that.selected_values && that.selected_values.length) {
|
if (that.selected_values && that.selected_values.length) {
|
||||||
record[that.name] = that.selected_values[0];
|
record[that.name] = that.selected_values[0];
|
||||||
@@ -336,6 +373,11 @@ IPA.hbac.test_rules_facet = function(spec) {
|
|||||||
that.create_buttons(container);
|
that.create_buttons(container);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.reset = function() {
|
||||||
|
that.table.set_values([]);
|
||||||
|
if (that.enabled) that.enabled.attr('checked', false);
|
||||||
|
if (that.disabled) that.enabled.attr('checked', false);
|
||||||
|
};
|
||||||
|
|
||||||
that.save = function(record) {
|
that.save = function(record) {
|
||||||
if (that.selected_values && that.selected_values.length) {
|
if (that.selected_values && that.selected_values.length) {
|
||||||
@@ -409,6 +451,7 @@ IPA.hbac.test_run_facet = function(spec) {
|
|||||||
that.back_button = IPA.button({
|
that.back_button = IPA.button({
|
||||||
name: 'back',
|
name: 'back',
|
||||||
label: 'Back',
|
label: 'Back',
|
||||||
|
icon: 'ui-icon ui-icon-triangle-1-w',
|
||||||
click: function() {
|
click: function() {
|
||||||
if (!that.back_button.hasClass('action-button-disabled')) {
|
if (!that.back_button.hasClass('action-button-disabled')) {
|
||||||
that.back();
|
that.back();
|
||||||
@@ -417,6 +460,8 @@ IPA.hbac.test_run_facet = function(spec) {
|
|||||||
}
|
}
|
||||||
}).appendTo(buttons);
|
}).appendTo(buttons);
|
||||||
|
|
||||||
|
buttons.append(' ');
|
||||||
|
|
||||||
that.new_test_button = IPA.button({
|
that.new_test_button = IPA.button({
|
||||||
name: 'new_test',
|
name: 'new_test',
|
||||||
label: 'New Test',
|
label: 'New Test',
|
||||||
@@ -429,6 +474,36 @@ IPA.hbac.test_run_facet = function(spec) {
|
|||||||
}).appendTo(buttons);
|
}).appendTo(buttons);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.new_test = function() {
|
||||||
|
var facet = that.entity.get_facet('user');
|
||||||
|
facet.reset();
|
||||||
|
|
||||||
|
facet = that.entity.get_facet('targethost');
|
||||||
|
facet.reset();
|
||||||
|
|
||||||
|
facet = that.entity.get_facet('service');
|
||||||
|
facet.reset();
|
||||||
|
|
||||||
|
facet = that.entity.get_facet('sourcehost');
|
||||||
|
facet.reset();
|
||||||
|
|
||||||
|
facet = that.entity.get_facet('rules');
|
||||||
|
facet.reset();
|
||||||
|
|
||||||
|
facet = that.entity.get_facet('run');
|
||||||
|
facet.reset();
|
||||||
|
|
||||||
|
var state = {};
|
||||||
|
state[that.entity.name+'-facet'] = 'user';
|
||||||
|
IPA.nav.push_state(state);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.reset = function() {
|
||||||
|
that.test_result.text('');
|
||||||
|
that.table.empty();
|
||||||
|
that.table.set_values([]);
|
||||||
|
};
|
||||||
|
|
||||||
that.refresh = function() {
|
that.refresh = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -126,12 +126,6 @@ body {
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input_link {
|
|
||||||
text-decoration: none;
|
|
||||||
position: relative;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
@@ -950,10 +944,6 @@ a, .ui-widget-content a {
|
|||||||
padding: 0.4em 1em;
|
padding: 0.4em 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
[title=">>"] {
|
|
||||||
margin-top: 1em !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.sub-nav-off > a:link, span.sub-nav-off > a:visited{
|
span.sub-nav-off > a:link, span.sub-nav-off > a:visited{
|
||||||
color:white;
|
color:white;
|
||||||
}
|
}
|
||||||
@@ -967,15 +957,25 @@ span.main-separator{
|
|||||||
padding:0.1em;
|
padding:0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button {
|
.button {
|
||||||
background: none;
|
text-decoration: none;
|
||||||
background-image:none;
|
cursor: pointer;
|
||||||
font-family: "Liberation Sans", Arial, sans-serif;
|
display: inline-block;
|
||||||
font-size: 0.9em;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button .button-label {
|
.button-label {
|
||||||
padding: 0 0.2em;
|
padding: 0 0.2em;
|
||||||
|
display: inline-block;
|
||||||
|
height: 16px;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
background: none;
|
||||||
|
background-image: none;
|
||||||
|
font-family: "Liberation Sans", Arial, sans-serif;
|
||||||
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button-disabled {
|
.action-button-disabled {
|
||||||
@@ -1068,7 +1068,7 @@ table.scrollable tbody {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 3em;
|
height: 3em;
|
||||||
line-height: 3em;
|
line-height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.adder-dialog-top input[name=filter] {
|
.adder-dialog-top input[name=filter] {
|
||||||
@@ -1151,6 +1151,10 @@ table.scrollable tbody {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adder-dialog-buttons .button {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.adder-dialog-internal {
|
.adder-dialog-internal {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border: none;
|
border: none;
|
||||||
|
@@ -44,7 +44,7 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function() {
|
|||||||
|
|
||||||
that.remove = function(key) {
|
that.remove = function(key) {
|
||||||
|
|
||||||
var i = that.keys.indexOf(key);
|
var i = that.get_key_index(key);
|
||||||
if (i<0) return null;
|
if (i<0) return null;
|
||||||
|
|
||||||
that.keys.splice(i, 1);
|
that.keys.splice(i, 1);
|
||||||
@@ -63,5 +63,17 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function() {
|
|||||||
that.length = that.keys.length;
|
that.length = that.keys.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.get_key_index = function(key) {
|
||||||
|
return that.keys.indexOf(key);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.get_key_by_index = function(index) {
|
||||||
|
return that.keys[index];
|
||||||
|
};
|
||||||
|
|
||||||
|
that.get_value_by_index = function(index) {
|
||||||
|
return that.values[index];
|
||||||
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
@@ -1792,7 +1792,7 @@ IPA.button = function(spec) {
|
|||||||
name: spec.name,
|
name: spec.name,
|
||||||
href: spec.href || '#' + (spec.name || 'button'),
|
href: spec.href || '#' + (spec.name || 'button'),
|
||||||
title: spec.title || spec.label,
|
title: spec.title || spec.label,
|
||||||
'class': 'ui-state-default ui-corner-all input_link',
|
'class': 'ui-state-default ui-corner-all button',
|
||||||
style: spec.style,
|
style: spec.style,
|
||||||
click: spec.click,
|
click: spec.click,
|
||||||
blur: spec.blur
|
blur: spec.blur
|
||||||
|
Reference in New Issue
Block a user