1
0
Fork 0

Add Server Build Feature Definition

Add the UI for the phabricator plugin build feature configuration.
This commit is contained in:
Steven Cooney 2019-05-30 15:45:32 +01:00
parent 0dbf491410
commit 96a32ef190
7 changed files with 76 additions and 9 deletions

View file

@ -1,4 +0,0 @@
package uk.xlab.teamcity.phabricator;
public class AppCommon {
}

View file

@ -0,0 +1,8 @@
package uk.xlab.teamcity.phabricator;
public class Constants {
public static final String BUILD_FEATURE_TYPE = "phabricator-build-feature";
public static final String PLUGIN_NAME = "phabricator";
public static final String PLUGIN_DISPLAY_NAME = "Phabricator Plugin";
public static final String PHABRICATOR_URL_SETTING = "phabricator_url_setting";
}

View file

@ -1,4 +0,0 @@
package uk.xlab.teamcity.phabricator;
public class AppServer {
}

View file

@ -0,0 +1,56 @@
package uk.xlab.teamcity.phabricator;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
import jetbrains.buildServer.log.Loggers;
import jetbrains.buildServer.serverSide.BuildFeature;
import jetbrains.buildServer.web.openapi.PluginDescriptor;
public class PhabricatorPluginBuildFeature extends BuildFeature {
private final String myEditUrl;
public PhabricatorPluginBuildFeature(@NotNull final PluginDescriptor pluginDescriptor) {
myEditUrl = pluginDescriptor.getPluginResourcesPath("phabricatorBuildFeature.jsp");
Loggers.SERVER.info("Phabricator build feature registered");
}
@Override
public String getType() {
return Constants.BUILD_FEATURE_TYPE;
}
@Override
public String getDisplayName() {
return Constants.PLUGIN_DISPLAY_NAME;
}
@Override
public String getEditParametersUrl() {
return myEditUrl;
}
@Override
public boolean isMultipleFeaturesPerBuildTypeAllowed() {
return false;
}
/**
* Populates the Parameters Description on the build features page
*/
@NotNull
@Override
public String describeParameters(@NotNull final Map<String, String> params) {
String url = "";
for(String key : params.keySet()){
if(key.equals(Constants.PHABRICATOR_URL_SETTING)){
url = params.get(key);
}
}
return String.format("Phabricator URL: %s", url);
}
}

View file

@ -3,4 +3,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-autowire="constructor">
</beans>
<bean class="uk.xlab.teamcity.phabricator.PhabricatorPluginBuildFeature"></bean>
</beans>

View file

@ -0,0 +1,9 @@
<%@ taglib prefix="props" tagdir="/WEB-INF/tags/props" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="propertiesBean" scope="request" type="jetbrains.buildServer.controllers.BasePropertiesBean"/>
<c:set var="phabricatorUrl" value="${propertiesBean.properties['phabricator_url_setting']}" />
<tr><td colspan="2">Report build status in real-time to your Phabricator instance.</td></tr>
<tr><th>Phabricator URL:</th><td><props:textProperty name="phabricator_url_setting"/></td></tr>