--%>\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
<%@ 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
--- /dev/null
+/*\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
--- /dev/null
+/*\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
~ 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
\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
--- /dev/null
+/*\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
@NotNull\r
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
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
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
\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
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
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
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
\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
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
@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
--- /dev/null
+/*\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
--- /dev/null
+/*\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
\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
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
"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