You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by olgasmola <ol...@gmail.com> on 2012/06/25 14:43:14 UTC

[PATCH] CS-15329: Instances with Error states appear in Instances

list after creating.

---
 ui/scripts/instances.js           |   15 ++++++++++++++-
 ui/scripts/sharedFunctions.js     |    9 ++++++++-
 ui/scripts/ui/widgets/listView.js |   12 +++++++++++-
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index b892fd7..779011d 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -537,6 +537,7 @@
                   dataType: "json",
                   success: function(json) {
                     var jid = json.deployvirtualmachineresponse.jobid;
+					var vmid = json.deployvirtualmachineresponse.id;
                     args.response.success(
                       {_custom:
                        {jobId: jid,
@@ -548,7 +549,19 @@
                         },
                         getActionFilter: function() {
                           return vmActionfilter;
-                        }
+                        },
+						getUpdatedData: function() {
+							var item;
+							$.ajax({
+							  url: createURL("listVirtualMachines&id="+vmid),
+							  dataType: "json",
+							  async: false,
+							  success: function(json) {
+								item = json.listvirtualmachinesresponse.virtualmachine[0];
+							  }
+							});
+							return item;
+						}
                        }
                       }
                     );
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index e7d2aeb..e0fb8e8 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -82,7 +82,14 @@ var pollAsyncJobResult = function(args) {
         }
         else if (result.jobstatus == 2) { // Failed          
           var msg = (result.jobresult.errortext == null)? "": result.jobresult.errortext;
-          args.error({message: msg});
+		  if (args._custom.getUpdatedData != null && args._custom.getActionFilter != null) {
+			args.error({message: msg, updatedData: args._custom.getUpdatedData(), actionFilter: args._custom.getActionFilter()});
+		  } else if (args._custom.getUpdatedData != null && args._custom.getActionFilter == null) {
+			args.error({message: msg, updatedData: args._custom.getUpdatedData()});
+		  }
+		  else {
+			args.error({message: msg});
+		  }
         }
       }
     },
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index 0f20592..96ba8e1 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -93,7 +93,17 @@
 
                 // Error
                 function(args) {
-                  $item.remove();
+					if (args && args.updatedData) {
+						if ($item.is(':visible') && !isHeader) {
+							replaceItem(
+							  $item,
+							  args.updatedData,
+							  args.actionFilter
+							);
+						}
+					} else {
+						$item.remove();
+					}
                 }
               );
             }
-- 
1.7.10.msysgit.1




Re: [PATCH] CS-15329: Instances with Error states appear in Instances

Posted by Olga Smola <ol...@gmail.com>.
Jessica,

thank you for review, problem with tab set in my editor will be solved with
next my patches.

Olga

On Wed, Jun 27, 2012 at 1:59 AM, Jessica Tomechak <
jessica.tomechak@gmail.com> wrote:

> >
> > -----Original Message-----
> > From: Jessica Wang [mailto:Jessica.Wang@citrix.com]
> > Sent: Tuesday, June 26, 2012 3:12 PM
> > To: olga smola (olya.smola@gmail.com)
> > Cc: cloudstack-dev@incubator.apache.org
> > Subject: RE: [PATCH] CS-15329: Instances with Error states appear in
> > Instances
> >
> > Olga,
> >
> > I just reviewed and pushed your patch to master branch.
> >
> > I also checked in another change:
> > (1) to distinguish between getUpdatedItem() and getUpdatedData(), I
> > renamed getUpdatedData() to getUpdatedItemWhenAsyncJobFails() since it's
> > being called only when async job fails.
> > (2) to fix the space problem (tab size is not 2) from your patch.
> >
> > Jessica
> >
> > -----Original Message-----
> > From: olgasmola [mailto:olya.smola@gmail.com]
> > Sent: Monday, June 25, 2012 5:43 AM
> > To: cloudstack-dev@incubator.apache.org
> > Subject: [PATCH] CS-15329: Instances with Error states appear in
> Instances
> >
> > list after creating.
> >
> > ---
> >  ui/scripts/instances.js           |   15 ++++++++++++++-
> >  ui/scripts/sharedFunctions.js     |    9 ++++++++-
> >  ui/scripts/ui/widgets/listView.js |   12 +++++++++++-
> >  3 files changed, 33 insertions(+), 3 deletions(-)
> >
> > diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index
> > b892fd7..779011d 100644
> > --- a/ui/scripts/instances.js
> > +++ b/ui/scripts/instances.js
> > @@ -537,6 +537,7 @@
> >                   dataType: "json",
> >                   success: function(json) {
> >                     var jid = json.deployvirtualmachineresponse.jobid;
> > +                                       var vmid =
> > json.deployvirtualmachineresponse.id;
> >                     args.response.success(
> >                       {_custom:
> >                        {jobId: jid,
> > @@ -548,7 +549,19 @@
> >                         },
> >                         getActionFilter: function() {
> >                           return vmActionfilter;
> > -                        }
> > +                        },
> > +                                               getUpdatedData:
> function()
> > {
> > +                                                       var item;
> > +                                                       $.ajax({
> > +                                                         url:
> > createURL("listVirtualMachines&id="+vmid),
> > +                                                         dataType:
> "json",
> > +                                                         async: false,
> > +                                                         success:
> > function(json) {
> > +                                                               item =
> > json.listvirtualmachinesresponse.virtualmachine[0];
> > +                                                         }
> > +                                                       });
> > +                                                       return item;
> > +                                               }
> >                        }
> >                       }
> >                     );
> > diff --git a/ui/scripts/sharedFunctions.js
> b/ui/scripts/sharedFunctions.js
> > index e7d2aeb..e0fb8e8 100644
> > --- a/ui/scripts/sharedFunctions.js
> > +++ b/ui/scripts/sharedFunctions.js
> > @@ -82,7 +82,14 @@ var pollAsyncJobResult = function(args) {
> >         }
> >         else if (result.jobstatus == 2) { // Failed
> >           var msg = (result.jobresult.errortext == null)? "":
> > result.jobresult.errortext;
> > -          args.error({message: msg});
> > +                 if (args._custom.getUpdatedData != null &&
> > args._custom.getActionFilter != null) {
> > +                       args.error({message: msg, updatedData:
> > args._custom.getUpdatedData(), actionFilter:
> > args._custom.getActionFilter()});
> > +                 } else if (args._custom.getUpdatedData != null &&
> > args._custom.getActionFilter == null) {
> > +                       args.error({message: msg, updatedData:
> > args._custom.getUpdatedData()});
> > +                 }
> > +                 else {
> > +                       args.error({message: msg});
> > +                 }
> >         }
> >       }
> >     },
> > diff --git a/ui/scripts/ui/widgets/listView.js
> > b/ui/scripts/ui/widgets/listView.js
> > index 0f20592..96ba8e1 100644
> > --- a/ui/scripts/ui/widgets/listView.js
> > +++ b/ui/scripts/ui/widgets/listView.js
> > @@ -93,7 +93,17 @@
> >
> >                 // Error
> >                 function(args) {
> > -                  $item.remove();
> > +                                       if (args && args.updatedData) {
> > +                                               if ($item.is(':visible')
> > && !isHeader) {
> > +                                                       replaceItem(
> > +                                                         $item,
> > +
> args.updatedData,
> > +
> args.actionFilter
> > +                                                       );
> > +                                               }
> > +                                       } else {
> > +                                               $item.remove();
> > +                                       }
> >                 }
> >               );
> >             }
> > --
> > 1.7.10.msysgit.1
> >
> >
> >
> >
> Would any of Olga's UI changes require changes to documentation? If they
> are cosmetic, it's not an issue.
>
> Jessica T.
> CloudStack Tech Pubs
>

RE: [PATCH] CS-15329: Instances with Error states appear in Instances

Posted by Jessica Wang <Je...@citrix.com>.
Jessica T,

This one (CS-15329) is cosmetic.

Jessica W.


-----Original Message-----
From: Jessica Tomechak [mailto:jessica.tomechak@gmail.com] 
Sent: Tuesday, June 26, 2012 3:59 PM
To: cloudstack-dev@incubator.apache.org
Cc: Radhika Nair
Subject: Re: [PATCH] CS-15329: Instances with Error states appear in Instances

>
> -----Original Message-----
> From: Jessica Wang [mailto:Jessica.Wang@citrix.com]
> Sent: Tuesday, June 26, 2012 3:12 PM
> To: olga smola (olya.smola@gmail.com)
> Cc: cloudstack-dev@incubator.apache.org
> Subject: RE: [PATCH] CS-15329: Instances with Error states appear in
> Instances
>
> Olga,
>
> I just reviewed and pushed your patch to master branch.
>
> I also checked in another change:
> (1) to distinguish between getUpdatedItem() and getUpdatedData(), I
> renamed getUpdatedData() to getUpdatedItemWhenAsyncJobFails() since it's
> being called only when async job fails.
> (2) to fix the space problem (tab size is not 2) from your patch.
>
> Jessica
>
> -----Original Message-----
> From: olgasmola [mailto:olya.smola@gmail.com]
> Sent: Monday, June 25, 2012 5:43 AM
> To: cloudstack-dev@incubator.apache.org
> Subject: [PATCH] CS-15329: Instances with Error states appear in Instances
>
> list after creating.
>
> ---
>  ui/scripts/instances.js           |   15 ++++++++++++++-
>  ui/scripts/sharedFunctions.js     |    9 ++++++++-
>  ui/scripts/ui/widgets/listView.js |   12 +++++++++++-
>  3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index
> b892fd7..779011d 100644
> --- a/ui/scripts/instances.js
> +++ b/ui/scripts/instances.js
> @@ -537,6 +537,7 @@
>                   dataType: "json",
>                   success: function(json) {
>                     var jid = json.deployvirtualmachineresponse.jobid;
> +                                       var vmid =
> json.deployvirtualmachineresponse.id;
>                     args.response.success(
>                       {_custom:
>                        {jobId: jid,
> @@ -548,7 +549,19 @@
>                         },
>                         getActionFilter: function() {
>                           return vmActionfilter;
> -                        }
> +                        },
> +                                               getUpdatedData: function()
> {
> +                                                       var item;
> +                                                       $.ajax({
> +                                                         url:
> createURL("listVirtualMachines&id="+vmid),
> +                                                         dataType: "json",
> +                                                         async: false,
> +                                                         success:
> function(json) {
> +                                                               item =
> json.listvirtualmachinesresponse.virtualmachine[0];
> +                                                         }
> +                                                       });
> +                                                       return item;
> +                                               }
>                        }
>                       }
>                     );
> diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
> index e7d2aeb..e0fb8e8 100644
> --- a/ui/scripts/sharedFunctions.js
> +++ b/ui/scripts/sharedFunctions.js
> @@ -82,7 +82,14 @@ var pollAsyncJobResult = function(args) {
>         }
>         else if (result.jobstatus == 2) { // Failed
>           var msg = (result.jobresult.errortext == null)? "":
> result.jobresult.errortext;
> -          args.error({message: msg});
> +                 if (args._custom.getUpdatedData != null &&
> args._custom.getActionFilter != null) {
> +                       args.error({message: msg, updatedData:
> args._custom.getUpdatedData(), actionFilter:
> args._custom.getActionFilter()});
> +                 } else if (args._custom.getUpdatedData != null &&
> args._custom.getActionFilter == null) {
> +                       args.error({message: msg, updatedData:
> args._custom.getUpdatedData()});
> +                 }
> +                 else {
> +                       args.error({message: msg});
> +                 }
>         }
>       }
>     },
> diff --git a/ui/scripts/ui/widgets/listView.js
> b/ui/scripts/ui/widgets/listView.js
> index 0f20592..96ba8e1 100644
> --- a/ui/scripts/ui/widgets/listView.js
> +++ b/ui/scripts/ui/widgets/listView.js
> @@ -93,7 +93,17 @@
>
>                 // Error
>                 function(args) {
> -                  $item.remove();
> +                                       if (args && args.updatedData) {
> +                                               if ($item.is(':visible')
> && !isHeader) {
> +                                                       replaceItem(
> +                                                         $item,
> +                                                         args.updatedData,
> +                                                         args.actionFilter
> +                                                       );
> +                                               }
> +                                       } else {
> +                                               $item.remove();
> +                                       }
>                 }
>               );
>             }
> --
> 1.7.10.msysgit.1
>
>
>
>
Would any of Olga's UI changes require changes to documentation? If they
are cosmetic, it's not an issue.

Jessica T.
CloudStack Tech Pubs

Re: [PATCH] CS-15329: Instances with Error states appear in Instances

Posted by Jessica Tomechak <je...@gmail.com>.
>
> -----Original Message-----
> From: Jessica Wang [mailto:Jessica.Wang@citrix.com]
> Sent: Tuesday, June 26, 2012 3:12 PM
> To: olga smola (olya.smola@gmail.com)
> Cc: cloudstack-dev@incubator.apache.org
> Subject: RE: [PATCH] CS-15329: Instances with Error states appear in
> Instances
>
> Olga,
>
> I just reviewed and pushed your patch to master branch.
>
> I also checked in another change:
> (1) to distinguish between getUpdatedItem() and getUpdatedData(), I
> renamed getUpdatedData() to getUpdatedItemWhenAsyncJobFails() since it's
> being called only when async job fails.
> (2) to fix the space problem (tab size is not 2) from your patch.
>
> Jessica
>
> -----Original Message-----
> From: olgasmola [mailto:olya.smola@gmail.com]
> Sent: Monday, June 25, 2012 5:43 AM
> To: cloudstack-dev@incubator.apache.org
> Subject: [PATCH] CS-15329: Instances with Error states appear in Instances
>
> list after creating.
>
> ---
>  ui/scripts/instances.js           |   15 ++++++++++++++-
>  ui/scripts/sharedFunctions.js     |    9 ++++++++-
>  ui/scripts/ui/widgets/listView.js |   12 +++++++++++-
>  3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index
> b892fd7..779011d 100644
> --- a/ui/scripts/instances.js
> +++ b/ui/scripts/instances.js
> @@ -537,6 +537,7 @@
>                   dataType: "json",
>                   success: function(json) {
>                     var jid = json.deployvirtualmachineresponse.jobid;
> +                                       var vmid =
> json.deployvirtualmachineresponse.id;
>                     args.response.success(
>                       {_custom:
>                        {jobId: jid,
> @@ -548,7 +549,19 @@
>                         },
>                         getActionFilter: function() {
>                           return vmActionfilter;
> -                        }
> +                        },
> +                                               getUpdatedData: function()
> {
> +                                                       var item;
> +                                                       $.ajax({
> +                                                         url:
> createURL("listVirtualMachines&id="+vmid),
> +                                                         dataType: "json",
> +                                                         async: false,
> +                                                         success:
> function(json) {
> +                                                               item =
> json.listvirtualmachinesresponse.virtualmachine[0];
> +                                                         }
> +                                                       });
> +                                                       return item;
> +                                               }
>                        }
>                       }
>                     );
> diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
> index e7d2aeb..e0fb8e8 100644
> --- a/ui/scripts/sharedFunctions.js
> +++ b/ui/scripts/sharedFunctions.js
> @@ -82,7 +82,14 @@ var pollAsyncJobResult = function(args) {
>         }
>         else if (result.jobstatus == 2) { // Failed
>           var msg = (result.jobresult.errortext == null)? "":
> result.jobresult.errortext;
> -          args.error({message: msg});
> +                 if (args._custom.getUpdatedData != null &&
> args._custom.getActionFilter != null) {
> +                       args.error({message: msg, updatedData:
> args._custom.getUpdatedData(), actionFilter:
> args._custom.getActionFilter()});
> +                 } else if (args._custom.getUpdatedData != null &&
> args._custom.getActionFilter == null) {
> +                       args.error({message: msg, updatedData:
> args._custom.getUpdatedData()});
> +                 }
> +                 else {
> +                       args.error({message: msg});
> +                 }
>         }
>       }
>     },
> diff --git a/ui/scripts/ui/widgets/listView.js
> b/ui/scripts/ui/widgets/listView.js
> index 0f20592..96ba8e1 100644
> --- a/ui/scripts/ui/widgets/listView.js
> +++ b/ui/scripts/ui/widgets/listView.js
> @@ -93,7 +93,17 @@
>
>                 // Error
>                 function(args) {
> -                  $item.remove();
> +                                       if (args && args.updatedData) {
> +                                               if ($item.is(':visible')
> && !isHeader) {
> +                                                       replaceItem(
> +                                                         $item,
> +                                                         args.updatedData,
> +                                                         args.actionFilter
> +                                                       );
> +                                               }
> +                                       } else {
> +                                               $item.remove();
> +                                       }
>                 }
>               );
>             }
> --
> 1.7.10.msysgit.1
>
>
>
>
Would any of Olga's UI changes require changes to documentation? If they
are cosmetic, it's not an issue.

Jessica T.
CloudStack Tech Pubs

RE: [PATCH] CS-15329: Instances with Error states appear in Instances

Posted by Jessica Wang <Je...@citrix.com>.
Olga,

I just reviewed and pushed your patch to master branch.

I also checked in another change:
(1) to distinguish between getUpdatedItem() and getUpdatedData(), I renamed getUpdatedData() to getUpdatedItemWhenAsyncJobFails() since it's being called only when async job fails. 
(2) to fix the space problem (tab size is not 2) from your patch.

Jessica

-----Original Message-----
From: olgasmola [mailto:olya.smola@gmail.com] 
Sent: Monday, June 25, 2012 5:43 AM
To: cloudstack-dev@incubator.apache.org
Subject: [PATCH] CS-15329: Instances with Error states appear in Instances

list after creating.

---
 ui/scripts/instances.js           |   15 ++++++++++++++-
 ui/scripts/sharedFunctions.js     |    9 ++++++++-
 ui/scripts/ui/widgets/listView.js |   12 +++++++++++-
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index b892fd7..779011d 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -537,6 +537,7 @@
                   dataType: "json",
                   success: function(json) {
                     var jid = json.deployvirtualmachineresponse.jobid;
+					var vmid = json.deployvirtualmachineresponse.id;
                     args.response.success(
                       {_custom:
                        {jobId: jid,
@@ -548,7 +549,19 @@
                         },
                         getActionFilter: function() {
                           return vmActionfilter;
-                        }
+                        },
+						getUpdatedData: function() {
+							var item;
+							$.ajax({
+							  url: createURL("listVirtualMachines&id="+vmid),
+							  dataType: "json",
+							  async: false,
+							  success: function(json) {
+								item = json.listvirtualmachinesresponse.virtualmachine[0];
+							  }
+							});
+							return item;
+						}
                        }
                       }
                     );
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index e7d2aeb..e0fb8e8 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -82,7 +82,14 @@ var pollAsyncJobResult = function(args) {
         }
         else if (result.jobstatus == 2) { // Failed          
           var msg = (result.jobresult.errortext == null)? "": result.jobresult.errortext;
-          args.error({message: msg});
+		  if (args._custom.getUpdatedData != null && args._custom.getActionFilter != null) {
+			args.error({message: msg, updatedData: args._custom.getUpdatedData(), actionFilter: args._custom.getActionFilter()});
+		  } else if (args._custom.getUpdatedData != null && args._custom.getActionFilter == null) {
+			args.error({message: msg, updatedData: args._custom.getUpdatedData()});
+		  }
+		  else {
+			args.error({message: msg});
+		  }
         }
       }
     },
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index 0f20592..96ba8e1 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -93,7 +93,17 @@
 
                 // Error
                 function(args) {
-                  $item.remove();
+					if (args && args.updatedData) {
+						if ($item.is(':visible') && !isHeader) {
+							replaceItem(
+							  $item,
+							  args.updatedData,
+							  args.actionFilter
+							);
+						}
+					} else {
+						$item.remove();
+					}
                 }
               );
             }
-- 
1.7.10.msysgit.1