[Kimchi-devel] [PATCH 2/3] Fix issue #339: Changes UI to handle deactivation of non-persistent pools
Royce Lv
lvroyce at linux.vnet.ibm.com
Fri Mar 7 09:57:05 UTC 2014
Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 2014年03月07日 08:15, Rodrigo Trujillo wrote:
> This patch implements a checking in the UI in order to warn the user
> that if pool is not persistent it will be removed when deactivated.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.storage_main.js | 30 +++++++++++++++++++++++++-----
> ui/pages/i18n.html.tmpl | 3 ++-
> ui/pages/tabs/storage.html.tmpl | 2 +-
> 3 files changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
> index 886feef..c2c721d 100644
> --- a/ui/js/src/kimchi.storage_main.js
> +++ b/ui/js/src/kimchi.storage_main.js
> @@ -99,13 +99,33 @@ kimchi.storageBindClick = function() {
> kimchi.message.error(err.responseJSON.reason);
> });
> });
> +
> $('.pool-deactivate').on('click', function(event) {
> var poolName = $(this).data('name');
> - kimchi.changePoolState(poolName, 'deactivate', function() {
> - kimchi.doListStoragePools();
> - }, function(err) {
> - kimchi.message.error(err.responseJSON.reason);
> - });
> + var settings = {
> + title : i18n['KCHAPI6001M'],
> + content : i18n['KCHPOOL6012M'],
> + confirm : i18n['KCHAPI6002M'],
> + cancel : i18n['KCHAPI6003M']
> + };
> + if (!$(this).data('persistent')) {
> + kimchi.confirm(settings, function() {
> + kimchi.changePoolState(poolName, 'deactivate', function() {
> + kimchi.doListStoragePools();
> + }, function(err) {
> + kimchi.message.error(err.responseJSON.reason);
> + });
> + }, function() {
> + return false;
> + });
> + }
> + else {
> + kimchi.changePoolState(poolName, 'deactivate', function() {
> + kimchi.doListStoragePools();
> + }, function(err) {
> + kimchi.message.error(err.responseJSON.reason);
> + });
> + }
> });
>
> $('.storage-action').on('click', function() {
> diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
> index a7dddf4..08429c5 100644
> --- a/ui/pages/i18n.html.tmpl
> +++ b/ui/pages/i18n.html.tmpl
> @@ -111,7 +111,8 @@ var i18n = {
> 'KCHPOOL6008E': "$_("Server name can not be blank.")",
> 'KCHPOOL6009E': "$_("This is not a valid Server Name or IP. please, modify it.")",
> 'KCHPOOL6010M': "$_("Looking for available partitions ...")",
> - 'KCHPOOL6011M': "$_("No available partitions found.")"
> + 'KCHPOOL6011M': "$_("No available partitions found.")",
> + 'KCHPOOL6012M': "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")"
> };
> </script>
> </body>
> diff --git a/ui/pages/tabs/storage.html.tmpl b/ui/pages/tabs/storage.html.tmpl
> index 4fbdce5..c20c954 100644
> --- a/ui/pages/tabs/storage.html.tmpl
> +++ b/ui/pages/tabs/storage.html.tmpl
> @@ -72,7 +72,7 @@
> <div class="btn dropdown popable storage-action" data-state="{state}" data-type="{type}" data-name="{name}">
> <span class="text">$_("Actions")</span><span class="arrow"></span>
> <div class="popover actionsheet right-side" style="width: 250px">
> - <button class="button-big pool-deactivate" data-stat="{state}" data-name="{name}"><span class="text">$_("Deactivate")</span></button>
> + <button class="button-big pool-deactivate" data-stat="{state}" data-name="{name}" data-persistent="{persistent}"><span class="text">$_("Deactivate")</span></button>
> <button class="button-big pool-activate" data-stat="{state}" data-name="{name}"><span class="text">$_("Activate")</span></button>
> <button class="button-big red pool-delete" data-stat="{state}" data-name="{name}"><span class="text">$_("Undefine")</span></button>
> </div>
More information about the Kimchi-devel
mailing list