more UI polishing
authorEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 11 Aug 2011 09:34:20 +0000 (13:34 +0400)
committerEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 11 Aug 2011 09:34:20 +0000 (13:34 +0400)
nuget-server/resources/tool/installTool-loading.jsp [new file with mode: 0644]
nuget-server/resources/tool/installTool-show.jsp [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/tab/InstallToolController.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstallableTool.java [new file with mode: 0644]
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/ServerSettingsController.java
nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/ToolsModel.java

diff --git a/nuget-server/resources/tool/installTool-loading.jsp b/nuget-server/resources/tool/installTool-loading.jsp
new file mode 100644 (file)
index 0000000..f1e687a
--- /dev/null
@@ -0,0 +1,21 @@
+<%--\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
+<%@ include file="/include-internal.jsp" %>\r
+<div id="nugetInstallFormResreshInner">\r
+  <forms:saving/>\r
+  Fetching available NuGet.exe Command Line versions\r
+</div>\r
+\r
diff --git a/nuget-server/resources/tool/installTool-show.jsp b/nuget-server/resources/tool/installTool-show.jsp
new file mode 100644 (file)
index 0000000..1960b63
--- /dev/null
@@ -0,0 +1,62 @@
+<%--\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
+<%@ 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
+             scope="request"/>\r
+<div id="nugetInstallFormResreshInner">\r
+  <c:choose>\r
+    <c:when test="${fn:length(available) eq 0}">\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>\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
index f15be715905094e37bfb79d83f66a20960bc20fa..1b6f1ab99f9f0947f590a2b97dba2f363a4a1057 100644 (file)
@@ -15,6 +15,7 @@
   --%>\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="installerUrl" type="java.lang.String" scope="request"/>\r
 \r
 <c:set var="installedPluginsCount" value="${fn:length(tools.installed)}"/>\r
 <p>\r
 </c:choose>\r
 \r
 <div class="addNew">\r
-  <a href="#" onclick="return BS.NuGet.InstallPopup.show();">Install NuGet.exe Command Line client</a>\r
+  <a href="#" onclick="return BS.NuGet.InstallPopup.show();">\r
+    Install NuGet.exe Command Line client\r
+    <forms:saving id="nugetInstallLinkSaving"/>\r
+  </a>\r
 </div>\r
 \r
 <script type="text/javascript">\r
     },\r
 \r
     show : function() {\r
-      this.showCentered();\r
+      var that = this;\r
+      that.showCentered();\r
+      $('nugetInstallFormResresh').refresh("nugetInstallLinkSaving", null, function() {\r
+          that.showCentered();\r
+      });\r
+\r
       return false;\r
     },\r
 \r
         action="foo.html"\r
         closeCommand="BS.NuGet.InstallPopup.close();"\r
         saveCommand="BS.NuGet.InstallPopup.save();">\r
-  This is modal dialog\r
+  <c:set var="actualInstallerUrl"><c:url value="${installerUrl}"/></c:set>\r
+  <bs:refreshable containerId="nugetInstallFormResresh" pageUrl="${actualInstallerUrl}">\r
+    <jsp:include page="installTool-loading.jsp"/>\r
+  </bs:refreshable>\r
+  <div class="popupSaveButtonsBlock">\r
+    <a href="javascript://" onclick="BS.NuGet.InstallPopup.close();" class="cancel">Close</a>\r
+    <br clear="all"/>\r
+  </div>\r
+\r
 </bs:modalDialog>
\ No newline at end of file
index 743841ad1f847f477da3bd45a95048a4de508b42..6023d1ec9313a7c0f71dd72cf1f8a43b0d10c7ee 100644 (file)
@@ -35,6 +35,8 @@
   <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.InstallToolController"/>\r
+\r
 \r
   <bean class="jetbrains.buildServer.nuget.server.toolRegistry.impl.NuGetToolManagerImpl"/>\r
 </beans>
\ No newline at end of file
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstallToolController.java b/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstallToolController.java
new file mode 100644 (file)
index 0000000..71f2a6a
--- /dev/null
@@ -0,0 +1,92 @@
+/*\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 jetbrains.buildServer.controllers.AuthorizationInterceptor;\r
+import jetbrains.buildServer.controllers.BaseFormXmlController;\r
+import jetbrains.buildServer.controllers.BasePropertiesBean;\r
+import jetbrains.buildServer.controllers.RequestPermissionsChecker;\r
+import jetbrains.buildServer.nuget.server.toolRegistry.NuGetToolManager;\r
+import jetbrains.buildServer.serverSide.auth.AccessDeniedException;\r
+import jetbrains.buildServer.serverSide.auth.AuthorityHolder;\r
+import jetbrains.buildServer.web.openapi.PluginDescriptor;\r
+import jetbrains.buildServer.web.openapi.WebControllerManager;\r
+import org.jdom.Element;\r
+import org.jetbrains.annotations.NotNull;\r
+import org.springframework.web.servlet.ModelAndView;\r
+\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
+ * Date: 11.08.11 12:12\r
+ */\r
+public class InstallToolController extends BaseFormXmlController {\r
+  private final String myPath;\r
+  private final NuGetToolManager myToolsManager;\r
+  private final PluginDescriptor myDescriptor;\r
+\r
+  public InstallToolController(@NotNull final AuthorizationInterceptor auth,\r
+                               @NotNull final PermissionChecker checker,\r
+                               @NotNull final WebControllerManager web,\r
+                               @NotNull final NuGetToolManager toolsManager,\r
+                               @NotNull final PluginDescriptor descriptor) {\r
+    myToolsManager = toolsManager;\r
+    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
+        checker.assertAccess(authorityHolder);\r
+      }\r
+    });\r
+    web.registerController(myPath, this);\r
+  }\r
+\r
+  @NotNull\r
+  public String getPath() {\r
+    return myPath;\r
+  }\r
+\r
+\r
+  @Override\r
+  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("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
+  }\r
+}\r
diff --git a/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstallableTool.java b/nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/tab/InstallableTool.java
new file mode 100644 (file)
index 0000000..748dbff
--- /dev/null
@@ -0,0 +1,49 @@
+/*\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
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 12:41\r
+ */\r
+public class InstallableTool {\r
+  private String myId;\r
+  private String myVersion;\r
+  private boolean myIsAllreadyInstalled;\r
+\r
+  public InstallableTool(String id, String version, boolean isAllreadyInstalled) {\r
+    myId = id;\r
+    myVersion = version;\r
+    myIsAllreadyInstalled = isAllreadyInstalled;\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
+  public boolean isAllreadyInstalled() {\r
+    return myIsAllreadyInstalled;\r
+  }\r
+}\r
index af6fd930b65ab2c1918c9ba68a98cb431e7c8926..a5c04e9f6617d25b65864c35eaaa0868188632cb 100644 (file)
@@ -20,7 +20,6 @@ import jetbrains.buildServer.controllers.AuthorizationInterceptor;
 import jetbrains.buildServer.controllers.BaseController;\r
 import jetbrains.buildServer.controllers.RequestPermissionsChecker;\r
 import jetbrains.buildServer.nuget.server.toolRegistry.NuGetToolManager;\r
-import jetbrains.buildServer.serverSide.SBuildServer;\r
 import jetbrains.buildServer.serverSide.auth.AccessDeniedException;\r
 import jetbrains.buildServer.serverSide.auth.AuthorityHolder;\r
 import jetbrains.buildServer.web.openapi.PluginDescriptor;\r
@@ -38,16 +37,17 @@ import javax.servlet.http.HttpServletResponse;
 public class ServerSettingsController 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 SBuildServer server,\r
-                                  @NotNull final AuthorizationInterceptor auth,\r
+  public ServerSettingsController(@NotNull final AuthorizationInterceptor auth,\r
                                   @NotNull final PermissionChecker checker,\r
                                   @NotNull final WebControllerManager web,\r
                                   @NotNull final NuGetToolManager toolsManager,\r
+                                  @NotNull final InstallToolController installer,\r
                                   @NotNull final PluginDescriptor descriptor) {\r
-    super(server);\r
     myToolsManager = toolsManager;\r
+    myInstaller = installer;\r
     myDescriptor = descriptor;\r
     myPath = descriptor.getPluginResourcesPath("tool/nuget-server-tab.html");\r
     auth.addPathBasedPermissionsChecker(myPath, new RequestPermissionsChecker() {\r
@@ -67,6 +67,7 @@ public class ServerSettingsController extends BaseController {
   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("installerUrl", myInstaller.getPath());\r
     return mv;\r
   }\r
 }\r
index 2221b9a76a2c0804aeb3c9c124ba0908d02c4903..ca160a5bfed9091703ebbe750a02d108cfbf33f7 100644 (file)
@@ -32,12 +32,4 @@ public class ToolsModel {
   public Collection<NuGetInstalledTool> getInstalled() {\r
     return Collections.emptyList();\r
   }\r
-\r
-  public boolean isToolsToInstallComputed() {\r
-    return false;\r
-  }\r
-\r
-  public Collection<NuGetTool> getToolsToInstall() {\r
-    return Collections.emptyList();\r
-  }\r
 }\r