Add button for server-del command

WebUI counterpart of: https://fedorahosted.org/freeipa/ticket/5588

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Pavel Vomacka 2016-06-24 12:08:04 +02:00 committed by Petr Vobornik
parent e65ce4fedc
commit 7f4de88ea1
3 changed files with 72 additions and 1 deletions

View File

@ -222,6 +222,7 @@ return {
},
{
$type: 'details',
$factory: topology.servers_facet,
disable_facet_tabs: true,
sections: [
{
@ -253,6 +254,30 @@ return {
}
]
}
],
actions: [
{
$factory: IPA.delete_action,
name: 'server_del',
method: 'del',
label: '@i18n:objects.servers.remove_server',
needs_confirm: true,
confirm_msg: '@i18n:objects.servers.remove_server_msg',
confirm_dialog: {
$factory: IPA.confirm_dialog,
title: '@i18n:objects.servers.remove_server',
ok_label: '@i18n:buttons.remove',
ok_button_class: 'btn btn-danger'
}
}
],
control_buttons_right: [
{
name: 'server_del',
label: '@i18n:objects.servers.remove_server',
icon: 'fa-exclamation-circle',
button_class: 'btn btn-danger'
}
]
}
]
@ -458,6 +483,45 @@ topology.location_adapter = declare([mod_field.Adapter], {
}
});
topology.servers_facet = function(spec, no_init) {
spec = spec || {};
var that = IPA.details_facet(spec, no_init);
/**
* Creates buttons on the right side of facet.
*/
that.create_controls = function() {
that.create_control_buttons(that.controls_left);
that.create_action_dropdown(that.controls_left);
that.control_buttons = that.control_buttons_right;
that.create_control_buttons(that.controls_right);
};
/**
* Inits right facet buttons.
*/
that.init_servers_facet = function() {
that.init_details_facet();
var buttons_spec = {
$factory: IPA.control_buttons_widget,
name: 'control-buttons',
css_class: 'control-buttons',
buttons: spec.control_buttons_right
};
that.control_buttons_right = IPA.build(buttons_spec);
that.control_buttons_right.init(that);
};
if (!no_init) that.init_servers_facet();
return that;
};
topology.serverroles_search_facet = function(spec) {
spec = spec || {};
@ -1404,7 +1468,6 @@ topology.register = function() {
ctor: topology.TopologyGraphFacet,
spec: topology.topology_graph_facet_spec
});
};
phases.on('registration', topology.register);

View File

@ -545,6 +545,10 @@
"label": "Server Roles",
"label_singular": "Server Role",
},
"servers": {
"remove_server": "Delete Server",
"remove_server_msg": "Deleting a server removes it permanently from the topology. Note that this is a non-reversible action."
},
"service": {
"certificate": "Service Certificate",
"delete_key_unprovision": "Delete Key, Unprovision",

View File

@ -690,6 +690,10 @@ class i18n_messages(Command):
"label": _("Server Roles"),
"label_singular": _("Server Role"),
},
"servers": {
"remove_server": _("Delete Server"),
"remove_server_msg": _("Deleting a server removes it permanently from the topology. Note that this is a non-reversible action.")
},
"service": {
"certificate": _("Service Certificate"),
"delete_key_unprovision": _("Delete Key, Unprovision"),