Skip to content

The Unified and Autonomous Development Platform

Emphasize @ and \ escaping in field description

Robin Shen417622a7cac5
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/CacheSpec.java b/server-core/src/main/java/io/onedev/server/ci/job/CacheSpec.java
index acb8b75ecc..d9cce82b82 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/CacheSpec.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/CacheSpec.java
@@ -21,7 +21,7 @@ public class CacheSpec implements Serializable {
private String path;
@Editable(order=100, description="Specify key of the cache. Caches with same key can be reused by different builds. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
@RegEx(interpolative=true, value="[a-zA-Z0-9\\-_]+", message="Can only contain alphanumeric, dash and underscore")
@@ -35,7 +35,7 @@ public class CacheSpec implements Serializable {
@Editable(order=200, description="Specify path to cache. Non-absolute path is considered to be relative to job workspace. "
+ "Specify \".\" (without quote) to cache workspace itself. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@Path
@NotEmpty
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/EnvVar.java b/server-core/src/main/java/io/onedev/server/ci/job/EnvVar.java
index 4f14f508fa..9c301489a4 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/EnvVar.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/EnvVar.java
@@ -20,7 +20,7 @@ public class EnvVar implements Serializable {
private String value;
@Editable(order=100, description="Specify name of the environment variable. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@VariableName
@NotEmpty
@@ -33,7 +33,7 @@ public class EnvVar implements Serializable {
}
@Editable(order=200, description="Specify value of the environment variable. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getValue() {
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/Job.java b/server-core/src/main/java/io/onedev/server/ci/job/Job.java
index c41d30fb52..f6e131132a 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/Job.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/Job.java
@@ -99,7 +99,7 @@ public class Job implements Serializable, Validatable {
}
@Editable(order=110, description="Specify docker image of the job. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getImage() {
@@ -126,7 +126,7 @@ public class Job implements Serializable, Validatable {
@Editable(order=120, description="Specify commands to execute in above image, with one command per line. "
+ "For Windows based images, commands will be interpretated by cmd.exe, and for Unix/Linux "
+ "based images, commands will be interpretated by shell. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative
@Code(language = Code.SHELL, variableProvider="getVariables")
@Size(min=1, message="may not be empty")
@@ -220,7 +220,7 @@ public class Job implements Serializable, Validatable {
@Editable(order=9115, group="Artifacts & Reports", description="Optionally specify files to publish as job artifacts. "
+ "Artifact files are relative to OneDev workspace, and may use * or ? for pattern match. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@Patterns(interpolative = true)
@NameOfEmptyValue("No artifacts")
@@ -244,7 +244,7 @@ public class Job implements Serializable, Validatable {
@Editable(order=9200, name="CPU Requirement", group="Resource Requirements", description="Specify CPU requirement of the job. "
+ "Refer to <a href='https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu' target='_blank'>kubernetes documentation</a> for details. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getCpuRequirement() {
@@ -257,7 +257,7 @@ public class Job implements Serializable, Validatable {
@Editable(order=9300, group="Resource Requirements", description="Specify memory requirement of the job. "
+ "Refer to <a href='https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory' target='_blank'>kubernetes documentation</a> for details. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getMemoryRequirement() {
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/JobDependency.java b/server-core/src/main/java/io/onedev/server/ci/job/JobDependency.java
index 1c1c44204f..b5b0db0605 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/JobDependency.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/JobDependency.java
@@ -59,7 +59,7 @@ public class JobDependency implements Serializable {
@Editable(order=300, name="Artifacts to Retrieve", description="Optionally specify artifacts to retrieve "
+ "from the dependency into job workspace. Leave empty to do not retrieve any artifacts. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@Patterns(interpolative = true)
@NameOfEmptyValue("Do not retrieve")
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/JobReport.java b/server-core/src/main/java/io/onedev/server/ci/job/JobReport.java
index dec4fa45bf..d4f780f17c 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/JobReport.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/JobReport.java
@@ -24,7 +24,7 @@ public abstract class JobReport implements Serializable {
private transient PatternSet patternSet;
@Editable(order=100, description="Specify files relative to OneDev workspace. Use * or ? for pattern match. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@Patterns(interpolative = true)
@NotEmpty
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/JobService.java b/server-core/src/main/java/io/onedev/server/ci/job/JobService.java
index e61bd67a31..a4de412ed9 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/JobService.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/JobService.java
@@ -31,7 +31,7 @@ public class JobService implements Serializable {
private String memoryRequirement = "128m";
@Editable(order=100, description="Specify name of the service, which can be used to access "
- + "the service. <b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "the service. <b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@VariableName
@NotEmpty
@@ -44,7 +44,7 @@ public class JobService implements Serializable {
}
@Editable(order=200, description="Specify docker image of the service. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getImage() {
@@ -56,7 +56,7 @@ public class JobService implements Serializable {
}
@Editable(order=220, description="Optionally specify arguments to run above image. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
public String getArguments() {
return arguments;
@@ -79,7 +79,7 @@ public class JobService implements Serializable {
@Editable(order=400, description="Specify command to check readiness of the service. This command will "
+ "be interpretated by cmd.exe on Windows images, and by shell on Linux images. It will be "
+ "executed repeatedly until a zero code is returned to indicate service ready. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@NotEmpty
public String getReadinessCheckCommand() {
return readinessCheckCommand;
diff --git a/server-core/src/main/java/io/onedev/server/ci/job/ProjectDependency.java b/server-core/src/main/java/io/onedev/server/ci/job/ProjectDependency.java
index 7852bde204..655d613e7c 100644
--- a/server-core/src/main/java/io/onedev/server/ci/job/ProjectDependency.java
+++ b/server-core/src/main/java/io/onedev/server/ci/job/ProjectDependency.java
@@ -66,7 +66,7 @@ public class ProjectDependency implements Serializable {
}
@Editable(order=300, name="Build", description="Specify build to retrieve artifacts from. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables", literalSuggester="suggestBuilds")
@NotEmpty
public String getBuildNumber() {
@@ -98,7 +98,7 @@ public class ProjectDependency implements Serializable {
}
@Editable(order=400, name="Artifacts to Retrieve", description="Specify artifacts to retrieve into job workspace. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@Patterns(suggester="suggestArtifacts", interpolative=true)
@NotEmpty
diff --git a/server-core/src/main/java/io/onedev/server/web/behavior/InterpolativeAssistBehavior.java b/server-core/src/main/java/io/onedev/server/web/behavior/InterpolativeAssistBehavior.java
index ee8ed6e720..b10ba3bb65 100644
--- a/server-core/src/main/java/io/onedev/server/web/behavior/InterpolativeAssistBehavior.java
+++ b/server-core/src/main/java/io/onedev/server/web/behavior/InterpolativeAssistBehavior.java
@@ -5,7 +5,6 @@ import java.util.List;
import java.util.stream.Collectors;
import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
import io.onedev.commons.codeassist.FenceAware;
import io.onedev.commons.codeassist.InputSuggestion;
@@ -57,11 +56,6 @@ public abstract class InterpolativeAssistBehavior extends ANTLRAssistBehavior {
return null;
}
- @Override
- protected List<String> getHints(TerminalExpect terminalExpect) {
- return Lists.newArrayList("Prepend '\\' to escape '@' or '\\'");
- }
-
@Override
protected Optional<String> describe(ParseExpect parseExpect, String suggestedLiteral) {
if (suggestedLiteral.equals("@"))
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/InterpolativePatternsEditSupport.java b/server-core/src/main/java/io/onedev/server/web/editable/InterpolativePatternsEditSupport.java
index 093554eca9..63630ea7ac 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/InterpolativePatternsEditSupport.java
+++ b/server-core/src/main/java/io/onedev/server/web/editable/InterpolativePatternsEditSupport.java
@@ -71,8 +71,7 @@ public class InterpolativePatternsEditSupport implements EditSupport {
protected List<String> getHints(TerminalExpect terminalExpect) {
return Lists.newArrayList(
"Pattern containing spaces or starting with dash needs to be quoted",
- "Use * or ? for wildcard match",
- "Prepend '\\' to escape '@' or '\\'");
+ "Use * or ? for wildcard match");
}
};
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.css b/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.css
index f6654c3cd8..5e6e8409f3 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.css
+++ b/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.css
@@ -15,10 +15,6 @@
.property-viewer .CodeMirror .CodeMirror-cursor {
border-left: none;
}
-.CodeMirror-hints>.tips {
- background: #F0F0F0;
- padding: 8px;
-}
.CodeMirror-hint {
padding: 4px;
}
\ No newline at end of file
diff --git a/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.js b/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.js
index b3780a44d9..d04b1b2000 100644
--- a/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.js
+++ b/server-core/src/main/java/io/onedev/server/web/editable/code/code-support.js
@@ -47,22 +47,6 @@ onedev.server.codeSupport = {
onedev.server.codeSupport.trackWidth(inputId);
},
showVariables: function(inputId, variables, line, start, end) {
- for (var i = 0; i < variables.length; i++) {
- if (i == variables.length-1) {
- variables[i].render = function(element, self, data) {
- var $element = $(element);
- $element.append(data.text);
- $element.parent().append(
- "<li class='tips'>" +
- "<div>Prepend '\\' to escape '@' or '\\'</div>" +
- "</li>");
- };
- } else {
- variables[i].render = function(element, self, data) {
- $(element).append(data.text);
- };
- }
- }
$("#" + inputId).data("showHintCallback")({
list: variables,
from: CodeMirror.Pos(line, start-1),
diff --git a/server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/JobHtmlReport.java b/server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/JobHtmlReport.java
index c505167840..8902e3aaa9 100644
--- a/server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/JobHtmlReport.java
+++ b/server-plugin/server-plugin-report-html/src/main/java/io/onedev/server/plugin/report/html/JobHtmlReport.java
@@ -34,7 +34,7 @@ public class JobHtmlReport extends JobReport {
private String startPage;
@Editable(order=1000, description="Specify report name. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getReportName() {
@@ -46,7 +46,7 @@ public class JobHtmlReport extends JobReport {
}
@Editable(order=1100, description="Specify start page of the report relative to workspace, for instance: api/index.html. "
- + "<b>Note:</b> Type '@' to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>")
+ + "<b>Note:</b> Type <tt>@</tt> to <a href='https://github.com/theonedev/onedev/wiki/Variable-Substitution'>insert variable</a>, use <tt>\\</tt> to escape normal occurrences of <tt>@</tt> or <tt>\\</tt>")
@Interpolative(variableSuggester="suggestVariables")
@NotEmpty
public String getStartPage() {