new version of NuGet tools layout
authorEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 11 Aug 2011 11:40:33 +0000 (15:40 +0400)
committerEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 11 Aug 2011 11:40:33 +0000 (15:40 +0400)
14 files changed:
nuget-server/resources/tool/installTool-loading.jsp
nuget-server/resources/tool/installTool-show.jsp
nuget-server/resources/tool/tools.css [new file with mode: 0644]
nuget-server/resources/tool/tools.js [new file with mode: 0644]
nuget-server/resources/tool/tools.jsp
nuget-server/src/META-INF/build-server-plugin-nuget.xml
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/NuGetInstallingTool.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/NuGetToolManager.java
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/impl/NuGetToolManagerImpl.java
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstallToolController.java
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstalledToolsController.java [moved from nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/ServerSettingsController.java with 70% similarity]
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/LocalTool.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/LocalToolState.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/ServerSettingsTab.java

index f1e687aff2e524e1cabaf7b77b0fff56247da525..95dcf97013e351228a96e7e6c4f349de72a883f2 100644 (file)
@@ -15,7 +15,7 @@
   --%>\r
 <%@ include file="/include-internal.jsp" %>\r
 <div id="nugetInstallFormResreshInner">\r
-  <forms:saving/>\r
-  Fetching available NuGet.exe Command Line versions\r
+  <forms:saving style="display: block"/>\r
+  Discovering available NuGet.exe Command Line versions\r
 </div>\r
 \r
index 1960b63967147c94b3b49e2efa775e71de5dd524..2542db78aac7531a9e22a731255267fb3ae539e0 100644 (file)
@@ -16,7 +16,7 @@
 <%@ include file="/include-internal.jsp" %>\r
 <%@ taglib prefix="props" tagdir="/WEB-INF/tags/props" %>\r
 <jsp:useBean id="available"\r
-             type="java.util.Collection<jetbrains.buildServer.nuget.server.toolRegistry.tab.InstallableTool>"\r
+             type="java.util.Collection<jetbrains.buildServer.nuget.server.toolRegistry.NuGetTool>"\r
              scope="request"/>\r
 <div id="nugetInstallFormResreshInner">\r
   <c:choose>\r
       No other NuGet.exe Command Line packages available\r
     </c:when>\r
     <c:otherwise>\r
-      <h4>Select NuGet.exe Command Line version to install:</h4>\r
-      <table style="padding-left: 5em;">\r
-        <c:forEach var="t" items="${available}">\r
-          <tr>\r
-            <td style="width: 10em; text-align: left;">\r
-              NuGet <c:out value="${t.version}"/>\r
-            </td>\r
-            <td>\r
-              <c:choose>\r
-              <c:when test="${t.allreadyInstalled}">\r
-              <strong>installed</strong>\r
-              </c:when>\r
-              <c:otherwise>\r
-              <input type="button" value="Install"/>\r
-              </c:otherwise>\r
-              </c:choose>\r
-          </tr>\r
-        </c:forEach>\r
+      <table class="runnerFormTable">\r
+        <tr>\r
+          <td colspan="2">\r
+            Select NuGet.exe Command Line to install:\r
+          </td>\r
+        </tr>\r
+        <tr>\r
+          <th><label for="tools">Version:<l:star/></label></th>\r
+          <td>\r
+            <forms:select name="tools" style="width:15em;">\r
+              <forms:option value="">-- Please choose version --</forms:option>\r
+              <c:forEach var="t" items="${available}">\r
+                <forms:option value="${t.id}"><c:out value="${t.version}"/></forms:option>\r
+              </c:forEach>\r
+            </forms:select>\r
+            <span class="smallNote">\r
+              Choose version of NuGet Commandline Tools to install.\r
+            </span>\r
+          </td>\r
+        </tr>\r
       </table>\r
     </c:otherwise>\r
   </c:choose>\r
-\r
-  <h4>Upload your own NuGet.exe Command Line:</h4>\r
-  <table>\r
-    <tr>\r
-      <td>NuGet Version<l:star/>:</td>\r
-      <td><props:textProperty name="version"/></td>\r
-    </tr>\r
-    <tr>\r
-      <td>NuGet.exe file<l:star/>:</td>\r
-      <td><input type="file" name="file"></td>\r
-    </tr>\r
-  </table>\r
-  <input type="button" value="Upload"/>\r
-\r
 </div>
\ No newline at end of file
diff --git a/nuget-server/resources/tool/tools.css b/nuget-server/resources/tool/tools.css
new file mode 100644 (file)
index 0000000..d03c327
--- /dev/null
@@ -0,0 +1,16 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
diff --git a/nuget-server/resources/tool/tools.js b/nuget-server/resources/tool/tools.js
new file mode 100644 (file)
index 0000000..9b56c2b
--- /dev/null
@@ -0,0 +1,40 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+if (!BS) BS = {};\r
+\r
+if (!BS.NuGet) BS.NuGet = {};\r
+\r
+BS.NuGet.InstallPopup = OO.extend(BS.AbstractModalDialog, {\r
+  getContainer : function() {\r
+    return $('nugetInstallFormDialog');\r
+  },\r
+\r
+  show : function() {\r
+    var that = this;\r
+    that.showCentered();\r
+    $('nugetInstallFormResresh').refresh("nugetInstallLinkSaving", null, function() {\r
+      that.showCentered();\r
+    });\r
+\r
+    return false;\r
+  },\r
+\r
+  save : function() {\r
+    alert('save');\r
+  }\r
+});\r
+\r
index 1b6f1ab99f9f0947f590a2b97dba2f363a4a1057..e4002bd683e5513c400abf06a686f33ed8d85027 100644 (file)
   ~ limitations under the License.\r
   --%>\r
 <%@ include file="/include-internal.jsp" %>\r
-<jsp:useBean id="tools" type="jetbrains.buildServer.nuget.server.toolRegistry.tab.ToolsModel" scope="request"/>\r
+<jsp:useBean id="tools" type="java.util.Collection<jetbrains.buildServer.nuget.server.toolRegistry.tab.LocalTool>" scope="request"/>\r
 <jsp:useBean id="installerUrl" type="java.lang.String" scope="request"/>\r
 \r
-<c:set var="installedPluginsCount" value="${fn:length(tools.installed)}"/>\r
+<c:set var="installedPluginsCount" value="${fn:length(tools)}"/>\r
 <p>\r
   TeamCity NuGet plugin requires to configure NuGet.Exe Command Line clients.\r
   There are\r
 \r
 <h2 class="noBorder">Installed NuGet Versions</h2>\r
 <c:choose>\r
-  <c:when test="${fn:length(tools.installed) eq 0}">\r
+  <c:when test="${installedPluginsCount eq 0}">\r
     <div>There are no installed NuGet.exe</div>\r
   </c:when>\r
   <c:otherwise>\r
-    <c:forEach var="tool" items="${tools.installed}">\r
-      <div>\r
-        NuGet version: <c:out value="${tool.version}"/>\r
-      </div>\r
-    </c:forEach>\r
+      <table class="dark borderBottom" cellpadding="0" cellspacing="0" style="width: 30em;">\r
+        <thead>\r
+        <tr>\r
+          <th class="header" style="width: 66%">Version</th>\r
+          <th class="header"></th>\r
+        </tr>\r
+        </thead>\r
+        <tbody>\r
+          <c:forEach var="tool" items="${tools}">\r
+            <tr>\r
+              <td><c:out value="${tool.version}"/></td>\r
+              <td>\r
+                <c:choose>\r
+                  <c:when test="${tool.state.installed}">\r
+                    <a href="#">Uninstall</a>\r
+                  </c:when>\r
+                  <c:when test="${tool.state.installing}">\r
+                    <bs:commentIcon text="Messages"/>\r
+                    Installing...\r
+                  </c:when>\r
+                </c:choose>\r
+              </td>\r
+            </tr>\r
+          </c:forEach>\r
+        </tbody>\r
+    </table>\r
   </c:otherwise>\r
 </c:choose>\r
 \r
 <div class="addNew">\r
   <a href="#" onclick="return BS.NuGet.InstallPopup.show();">\r
-    Install NuGet.exe Command Line client\r
+    Install\r
+    <c:if test="${installedPluginsCount gt 0}">addintional versions of</c:if>\r
+    NuGet.exe Command Line\r
     <forms:saving id="nugetInstallLinkSaving"/>\r
   </a>\r
 </div>\r
 \r
-<script type="text/javascript">\r
-  if (!BS) BS = {};\r
-  if (!BS.NuGet) BS.NuGet = {};\r
-  BS.NuGet.InstallPopup = OO.extend(BS.AbstractModalDialog, {\r
-    getContainer : function() {\r
-      return $('nugetInstallFormDialog');\r
-    },\r
-\r
-    show : function() {\r
-      var that = this;\r
-      that.showCentered();\r
-      $('nugetInstallFormResresh').refresh("nugetInstallLinkSaving", null, function() {\r
-          that.showCentered();\r
-      });\r
-\r
-      return false;\r
-    },\r
-\r
-    save : function() {\r
-      alert('save');\r
-    }\r
-  });\r
-</script>\r
-\r
 <bs:modalDialog\r
         formId="nugetInstallForm"\r
         title="Install NuGet.exe Command Line"\r
   <bs:refreshable containerId="nugetInstallFormResresh" pageUrl="${actualInstallerUrl}">\r
     <jsp:include page="installTool-loading.jsp"/>\r
   </bs:refreshable>\r
+\r
   <div class="popupSaveButtonsBlock">\r
-    <a href="javascript://" onclick="BS.NuGet.InstallPopup.close();" class="cancel">Close</a>\r
+    <a href="javascript://" onclick="BS.NuGet.InstallPopup.close();" class="cancel">Cancel</a>\r
+    <input class="submitButton" type="button" value="Install" id="agentPoolNameApplyButton" onclick="BS.NuGet.InstallPopup.save();"/>\r
     <br clear="all"/>\r
   </div>\r
-\r
 </bs:modalDialog>
\ No newline at end of file
index 6023d1ec9313a7c0f71dd72cf1f8a43b0d10c7ee..61359ed61a4233e5c62bef8a24c32201f30731c1 100644 (file)
@@ -34,7 +34,7 @@
 \r
   <bean class="jetbrains.buildServer.nuget.server.toolRegistry.tab.PermissionChecker"/>\r
   <bean class="jetbrains.buildServer.nuget.server.toolRegistry.tab.ServerSettingsTab"/>\r
-  <bean class="jetbrains.buildServer.nuget.server.toolRegistry.tab.ServerSettingsController"/>\r
+  <bean class="jetbrains.buildServer.nuget.server.toolRegistry.tab.InstalledToolsController"/>\r
   <bean class="jetbrains.buildServer.nuget.server.toolRegistry.tab.InstallToolController"/>\r
 \r
 \r
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/NuGetInstallingTool.java b/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/NuGetInstallingTool.java
new file mode 100644 (file)
index 0000000..af96e91
--- /dev/null
@@ -0,0 +1,30 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package jetbrains.buildServer.nuget.server.toolRegistry;\r
+\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+import java.util.Collection;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 14:01\r
+ */\r
+public interface NuGetInstallingTool extends NuGetTool {\r
+  @NotNull\r
+  Collection<String> getInstallMessages();\r
+}\r
index 38faf54e411c0587b439f0f2b1067ad96ab1de0e..f9b1634eb361801dc83e205d93369abb3880aca4 100644 (file)
@@ -32,6 +32,12 @@ public interface NuGetToolManager {
   Collection<NuGetInstalledTool> getInstalledTools();\r
 \r
   /**\r
+   * @return list of tools that are installing now\r
+   */\r
+  @NotNull\r
+  Collection<NuGetInstallingTool> getInstallingTool();\r
+\r
+  /**\r
    * @return fetches the full list of available and supported nuget tools\r
    */\r
   @NotNull\r
index f19bb7f88de8dfb64ddda6a1b524ecf316abed47..481818b85f3aeb0ffcf25b7f680b4bd477d02aee 100644 (file)
@@ -19,8 +19,9 @@ package jetbrains.buildServer.nuget.server.toolRegistry.impl;
 import jetbrains.buildServer.nuget.server.toolRegistry.*;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
+import java.io.File;\r
+import java.util.Arrays;\r
 import java.util.Collection;\r
-import java.util.Collections;\r
 \r
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
@@ -29,12 +30,90 @@ import java.util.Collections;
 public class NuGetToolManagerImpl implements NuGetToolManager {\r
   @NotNull\r
   public Collection<NuGetInstalledTool> getInstalledTools() {\r
-    return Collections.emptyList();\r
+    return Arrays.<NuGetInstalledTool>asList(\r
+            new NuGetInstalledTool() {\r
+              @NotNull\r
+              public File getPath() {\r
+                return new File(".");\r
+              }\r
+\r
+              @NotNull\r
+              public String getId() {\r
+                return "i1";\r
+              }\r
+\r
+              @NotNull\r
+              public String getVersion() {\r
+                return "i1.2.3.5";\r
+              }\r
+            },\r
+            new NuGetInstalledTool() {\r
+              @NotNull\r
+              public File getPath() {\r
+                return new File(".");\r
+              }\r
+\r
+              @NotNull\r
+              public String getId() {\r
+                return "i2";\r
+              }\r
+\r
+              @NotNull\r
+              public String getVersion() {\r
+                return "i2.4.5.7";\r
+              }\r
+            }\r
+    );\r
+  }\r
+\r
+  @NotNull\r
+  public Collection<NuGetInstallingTool> getInstallingTool() {\r
+    return Arrays.<NuGetInstallingTool>asList(\r
+            new NuGetInstallingTool() {\r
+              @NotNull\r
+              public Collection<String> getInstallMessages() {\r
+                return Arrays.asList("mgs1", "msg2", "msg3");\r
+              }\r
+\r
+              @NotNull\r
+              public String getId() {\r
+                return "ii-1";\r
+              }\r
+\r
+              @NotNull\r
+              public String getVersion() {\r
+                return "ii.1.2.43";\r
+              }\r
+            }\r
+    );\r
   }\r
 \r
   @NotNull\r
   public Collection<NuGetTool> getAvailableTools() {\r
-    return Collections.emptyList();\r
+    return Arrays.<NuGetTool>asList(\r
+            new NuGetTool() {\r
+              @NotNull\r
+              public String getId() {\r
+                return "a-1";\r
+              }\r
+\r
+              @NotNull\r
+              public String getVersion() {\r
+                return "a.3.5.6";\r
+              }\r
+            },\r
+            new NuGetTool() {\r
+              @NotNull\r
+              public String getId() {\r
+                return "a-2";\r
+              }\r
+\r
+              @NotNull\r
+              public String getVersion() {\r
+                return "a2.5.6.6";\r
+              }\r
+            }\r
+    );\r
   }\r
 \r
   public void installTool(@NotNull NuGetTool tool, @NotNull ActionProgress progress) {\r
index 71f2a6aa3ff0a2393e283aab7f38c1559a0ab682..7ef2424dc477292cdcc45f78b28c67c2c761fba7 100644 (file)
@@ -31,10 +31,7 @@ import org.springframework.web.servlet.ModelAndView;
 \r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
 import java.util.HashMap;\r
-import java.util.List;\r
 \r
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
@@ -54,7 +51,8 @@ public class InstallToolController extends BaseFormXmlController {
     myDescriptor = descriptor;\r
     myPath = descriptor.getPluginResourcesPath("tool/nuget-server-tab-install-tool.html");\r
     auth.addPathBasedPermissionsChecker(myPath, new RequestPermissionsChecker() {\r
-      public void checkPermissions(@NotNull AuthorityHolder authorityHolder, @NotNull HttpServletRequest request) throws AccessDeniedException {\r
+      public void checkPermissions(@NotNull AuthorityHolder authorityHolder,\r
+                                   @NotNull HttpServletRequest request) throws AccessDeniedException {\r
         checker.assertAccess(authorityHolder);\r
       }\r
     });\r
@@ -71,20 +69,12 @@ public class InstallToolController extends BaseFormXmlController {
   protected ModelAndView doGet(HttpServletRequest request, HttpServletResponse response) {\r
     ModelAndView mv = new ModelAndView(myDescriptor.getPluginResourcesPath("tool/installTool-show.jsp"));\r
 \r
-    mv.getModelMap().put("available", getInstallableTools());\r
+    mv.getModelMap().put("available", myToolsManager.getAvailableTools());\r
     mv.getModelMap().put("propertiesBean", new BasePropertiesBean(new HashMap<String, String>()));\r
 \r
     return mv;\r
   }\r
 \r
-  @NotNull\r
-  private Collection<InstallableTool> getInstallableTools() {\r
-    List<InstallableTool> list = new ArrayList<InstallableTool>();\r
-    list.add(new InstallableTool("t1", "4.3.4.555", false));\r
-    list.add(new InstallableTool("t2", "6.2.4.535", true));\r
-    return list;\r
-  }\r
-\r
   @Override\r
   protected void doPost(HttpServletRequest request, HttpServletResponse response, Element xmlResponse) {\r
 \r
similarity index 70%
rename from nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/ServerSettingsController.java
rename to nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstalledToolsController.java
index a5c04e9f6617d25b65864c35eaaa0868188632cb..b81c15cfb0bfa60876d090d196724f01e4aa89e6 100644 (file)
@@ -19,6 +19,8 @@ package jetbrains.buildServer.nuget.server.toolRegistry.tab;
 import jetbrains.buildServer.controllers.AuthorizationInterceptor;\r
 import jetbrains.buildServer.controllers.BaseController;\r
 import jetbrains.buildServer.controllers.RequestPermissionsChecker;\r
+import jetbrains.buildServer.nuget.server.toolRegistry.NuGetInstalledTool;\r
+import jetbrains.buildServer.nuget.server.toolRegistry.NuGetInstallingTool;\r
 import jetbrains.buildServer.nuget.server.toolRegistry.NuGetToolManager;\r
 import jetbrains.buildServer.serverSide.auth.AccessDeniedException;\r
 import jetbrains.buildServer.serverSide.auth.AuthorityHolder;\r
@@ -29,18 +31,22 @@ import org.springframework.web.servlet.ModelAndView;
 \r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+import java.util.List;\r
 \r
 /**\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 10.08.11 20:38\r
  */\r
-public class ServerSettingsController extends BaseController {\r
+public class InstalledToolsController extends BaseController {\r
   private final String myPath;\r
   private final NuGetToolManager myToolsManager;\r
   private final InstallToolController myInstaller;\r
   private final PluginDescriptor myDescriptor;\r
 \r
-  public ServerSettingsController(@NotNull final AuthorizationInterceptor auth,\r
+  public InstalledToolsController(@NotNull final AuthorizationInterceptor auth,\r
                                   @NotNull final PermissionChecker checker,\r
                                   @NotNull final WebControllerManager web,\r
                                   @NotNull final NuGetToolManager toolsManager,\r
@@ -49,7 +55,7 @@ public class ServerSettingsController extends BaseController {
     myToolsManager = toolsManager;\r
     myInstaller = installer;\r
     myDescriptor = descriptor;\r
-    myPath = descriptor.getPluginResourcesPath("tool/nuget-server-tab.html");\r
+    myPath = descriptor.getPluginResourcesPath("tool/nuget-server-tools.html");\r
     auth.addPathBasedPermissionsChecker(myPath, new RequestPermissionsChecker() {\r
       public void checkPermissions(@NotNull AuthorityHolder authorityHolder, @NotNull HttpServletRequest request) throws AccessDeniedException {\r
        checker.assertAccess(authorityHolder);\r
@@ -66,8 +72,33 @@ public class ServerSettingsController extends BaseController {
   @Override\r
   protected ModelAndView doHandle(HttpServletRequest request, HttpServletResponse response) throws Exception {\r
     ModelAndView mv = new ModelAndView(myDescriptor.getPluginResourcesPath("tool/tools.jsp"));\r
-    mv.getModelMap().put("tools", new ToolsModel());\r
+    mv.getModelMap().put("tools", getModel());\r
     mv.getModelMap().put("installerUrl", myInstaller.getPath());\r
     return mv;\r
   }\r
+\r
+  @NotNull\r
+  private Collection<LocalTool> getModel() {\r
+    final List<LocalTool> tools = new ArrayList<LocalTool>();\r
+\r
+    for (NuGetInstalledTool tool : myToolsManager.getInstalledTools()) {\r
+      tools.add(new LocalTool(\r
+              tool.getId(),\r
+              tool.getVersion(),\r
+              LocalToolState.INSTALLED, \r
+              Collections.<String>emptyList()\r
+      ));\r
+    }\r
+\r
+    for (NuGetInstallingTool tool : myToolsManager.getInstallingTool()) {\r
+      tools.add(new LocalTool(\r
+              tool.getId(),\r
+              tool.getVersion(),\r
+              LocalToolState.INSTALLING,\r
+              tool.getInstallMessages()\r
+      ));\r
+    }\r
+\r
+    return tools;\r
+  }\r
 }\r
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/LocalTool.java b/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/LocalTool.java
new file mode 100644 (file)
index 0000000..8e27362
--- /dev/null
@@ -0,0 +1,67 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package jetbrains.buildServer.nuget.server.toolRegistry.tab;\r
+\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 13:57\r
+ */\r
+public class LocalTool {\r
+  private final String myId;\r
+  private final String myVersion;\r
+  private final LocalToolState myState;\r
+  private final Collection<String> myStateMessages;\r
+\r
+  public LocalTool(@NotNull String id,\r
+                   @NotNull String version,\r
+                   @NotNull LocalToolState state,\r
+                   @NotNull Collection<String> stateMessages) {\r
+    myId = id;\r
+    myVersion = version;\r
+    myState = state;\r
+    myStateMessages = Collections.unmodifiableCollection(stateMessages);\r
+  }\r
+\r
+  @NotNull\r
+  public String getId() {\r
+    return myId;\r
+  }\r
+\r
+  @NotNull\r
+  public String getVersion() {\r
+    return myVersion;\r
+  }\r
+\r
+  @NotNull\r
+  public LocalToolState getState() {\r
+    return myState;\r
+  }\r
+\r
+  public boolean getContainesMessages() {\r
+    return !myStateMessages.isEmpty();\r
+  }\r
+\r
+  @NotNull\r
+  public Collection<String> getStateMessages() {\r
+    return myStateMessages;\r
+  }\r
+}\r
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/LocalToolState.java b/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/LocalToolState.java
new file mode 100644 (file)
index 0000000..86cdfd0
--- /dev/null
@@ -0,0 +1,51 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package jetbrains.buildServer.nuget.server.toolRegistry.tab;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 13:57\r
+ */\r
+public enum LocalToolState {\r
+  INSTALLED("Installed", false),\r
+  INSTALLING("Installing", true),\r
+  ;\r
+\r
+  private final String myName;\r
+  private final boolean myContainsMessages;\r
+\r
+  LocalToolState(String name, boolean containsMessages) {\r
+    myName = name;\r
+    myContainsMessages = containsMessages;\r
+  }\r
+\r
+  public boolean isInstalled() {\r
+    return this == INSTALLED;\r
+  }\r
+\r
+  public boolean isInstalling() {\r
+    return this == INSTALLING;\r
+  }\r
+\r
+  public String getName() {\r
+    return myName;\r
+  }\r
+\r
+  public boolean isContainsMessages() {\r
+    return myContainsMessages;\r
+  }\r
+}\r
index d5ad3d90ddfdac797c92875ed84fcc681d0adb09..91a4c2628850167e075ba6d6d69544497aacd5f5 100644 (file)
 \r
 package jetbrains.buildServer.nuget.server.toolRegistry.tab;\r
 \r
-import jetbrains.buildServer.web.openapi.PagePlaces;\r
-import jetbrains.buildServer.web.openapi.PlaceId;\r
-import jetbrains.buildServer.web.openapi.PositionConstraint;\r
-import jetbrains.buildServer.web.openapi.SimpleCustomTab;\r
+import jetbrains.buildServer.web.openapi.*;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
 /**\r
@@ -30,7 +27,8 @@ public class ServerSettingsTab extends SimpleCustomTab {
   private final PermissionChecker myChecker;\r
 \r
   public ServerSettingsTab(@NotNull final PagePlaces pagePlaces,\r
-                           @NotNull final ServerSettingsController controller,\r
+                           @NotNull final PluginDescriptor descriptor,\r
+                           @NotNull final InstalledToolsController controller,\r
                            @NotNull final PermissionChecker checker) {\r
     super(pagePlaces,\r
             PlaceId.ADMIN_SERVER_CONFIGURATION_TAB,\r
@@ -39,6 +37,8 @@ public class ServerSettingsTab extends SimpleCustomTab {
             "NuGet");\r
     myChecker = checker;\r
     setPosition(PositionConstraint.last());\r
+    addCssFile(descriptor.getPluginResourcesPath("tool/tools.css"));\r
+    addJsFile(descriptor.getPluginResourcesPath("tool/tools.js"));\r
     register();\r
   }\r
 \r