Add Server Build Feature Definition
Add the UI for the phabricator plugin build feature configuration.
This commit is contained in:
parent
0dbf491410
commit
96a32ef190
7 changed files with 76 additions and 9 deletions
|
@ -1,4 +0,0 @@
|
||||||
package uk.xlab.teamcity.phabricator;
|
|
||||||
|
|
||||||
public class AppCommon {
|
|
||||||
}
|
|
|
@ -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";
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
package uk.xlab.teamcity.phabricator;
|
|
||||||
|
|
||||||
public class AppServer {
|
|
||||||
}
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,4 +3,6 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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"
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
|
||||||
default-autowire="constructor">
|
default-autowire="constructor">
|
||||||
</beans>
|
|
||||||
|
<bean class="uk.xlab.teamcity.phabricator.PhabricatorPluginBuildFeature"></bean>
|
||||||
|
</beans>
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in a new issue