polish install tool IU
[teamcity/dotNetPackagesSupport.git] / nuget-server / resources / tool / tools.js
index 9b56c2bd8eb94ab472c3c296f7c71a184c25640c..a573ab3f60df62f936fc67b613b1b5feff3117b1 100644 (file)
@@ -18,23 +18,63 @@ if (!BS) BS = {};
 \r
 if (!BS.NuGet) BS.NuGet = {};\r
 \r
-BS.NuGet.InstallPopup = OO.extend(BS.AbstractModalDialog, {\r
-  getContainer : function() {\r
-    return $('nugetInstallFormDialog');\r
+BS.NuGet.Tools = {\r
+  refreshPackagesList : function() {\r
+    $('nugetPackagesList').refresh();\r
   },\r
 \r
-  show : function() {\r
-    var that = this;\r
-    that.showCentered();\r
-    $('nugetInstallFormResresh').refresh("nugetInstallLinkSaving", null, function() {\r
+  InstallPopup : OO.extend(BS.PluginPropertiesForm, OO.extend(BS.AbstractModalDialog, {\r
+    getContainer : function() {\r
+      return $('nugetInstallFormDialog');\r
+    },\r
+\r
+    formElement : function() {\r
+      return $('nugetInstallForm');\r
+    },\r
+\r
+    disableSubmit : function() {\r
+      $('installNuGetApplyButton').disabled = true;\r
+    },\r
+\r
+    enableSubmit : function() {\r
+      $('installNuGetApplyButton').disabled = false;\r
+    },\r
+\r
+    refreshForm : function() {\r
+      var that = this;\r
+      that.enableSubmit();\r
+      $('nugetInstallFormResresh').refresh("nugetInstallLinkSaving", null, function() {\r
+        that.showCentered();\r
+      });\r
+      return false;\r
+    },\r
+\r
+    show : function() {\r
+      var that = this;\r
       that.showCentered();\r
-    });\r
+      that.refreshForm();\r
+      return false;\r
+    },\r
+\r
+    save : function() {\r
+\r
+      BS.Util.show($('installNuGetApplyProgress'));\r
+      BS.FormSaver.save(this, this.formElement().action, OO.extend(BS.ErrorsAwareListener, {\r
+        onCompleteSave: function(form, responseXML, err) {\r
+          BS.Util.hide($('installNuGetApplyProgress'));\r
+          var wereErrors = BS.XMLResponse.processErrors(responseXML, {}, form.propertiesErrorsHandler);\r
+          BS.ErrorsAwareListener.onCompleteSave(form, responseXML, err);\r
+\r
+          alert("wereError = " + wereErrors);\r
+          if (!wereErrors) {\r
+            BS.NuGet.Tools.refreshPackagesList();\r
+            //form.close();\r
+          }\r
+        }\r
+      }));\r
+    }\r
+  }))\r
+};\r
 \r
-    return false;\r
-  },\r
 \r
-  save : function() {\r
-    alert('save');\r
-  }\r
-});\r
 \r