Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Locale;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotEmpty;
Expand Down Expand Up @@ -52,14 +53,6 @@ public static RootUrlMode parse(String value) {
@NotEmpty
private String finishedTaskLogPath = "stdout";

public String getRunningTaskLogPath() {
return runningTaskLogPath;
}

public String getFinishedTaskLogPath() {
return finishedTaskLogPath;
}

private boolean hideNewDeployButton = false;
private boolean hideNewRequestButton = false;

Expand All @@ -70,6 +63,9 @@ public String getFinishedTaskLogPath() {
@JsonProperty
private String rootUrlMode = RootUrlMode.INDEX_CATCHALL.name();

@NotNull
private String taskS3LogOmitPrefix = "";

public boolean isHideNewDeployButton() {
return hideNewDeployButton;
}
Expand Down Expand Up @@ -137,4 +133,20 @@ public void setRunningTaskLogPath(String runningTaskLogPath) {
public void setFinishedTaskLogPath(String finishedTaskLogPath) {
this.finishedTaskLogPath = finishedTaskLogPath;
}

public String getRunningTaskLogPath() {
return runningTaskLogPath;
}

public String getFinishedTaskLogPath() {
return finishedTaskLogPath;
}

public String getTaskS3LogOmitPrefix() {
return taskS3LogOmitPrefix;
}

public void setTaskS3LogOmitPrefix(String taskS3LogOmitPrefix) {
this.taskS3LogOmitPrefix = taskS3LogOmitPrefix;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class IndexView extends View {

private final String commonHostnameSuffixToOmit;

private final String taskS3LogOmitPrefix;

public IndexView(String singularityUriBase, String appRoot, SingularityConfiguration configuration) {
super("index.mustache");

Expand Down Expand Up @@ -68,6 +70,8 @@ public IndexView(String singularityUriBase, String appRoot, SingularityConfigura
this.finishedTaskLogPath = configuration.getUiConfiguration().getFinishedTaskLogPath();

this.commonHostnameSuffixToOmit = configuration.getCommonHostnameSuffixToOmit().or("");

this.taskS3LogOmitPrefix = configuration.getUiConfiguration().getTaskS3LogOmitPrefix();
}

public String getAppRoot() {
Expand Down Expand Up @@ -142,6 +146,10 @@ public String getCommonHostnameSuffixToOmit() {
return commonHostnameSuffixToOmit;
}

public String getTaskS3LogOmitPrefix() {
return taskS3LogOmitPrefix;
}

@Override
public String toString() {
return "IndexView[" +
Expand Down
1 change: 1 addition & 0 deletions SingularityUI/app/assets/_index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
runningTaskLogPath: "{{{ runningTaskLogPath }}}",
finishedTaskLogPath: "{{{ finishedTaskLogPath }}}",
commonHostnameSuffixToOmit: "{{{ commonHostnameSuffixToOmit }}}",
taskS3LogOmitPrefix: "{{{ taskS3LogOmitPrefix }}}",
slaveHttpPort: {{{slaveHttpPort}}},
{{#slaveHttpsPort}}
slaveHttpsPort: {{{slaveHttpsPort}}}
Expand Down
7 changes: 6 additions & 1 deletion SingularityUI/app/collections/TaskS3Logs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ S3Log = require '../models/S3Log'
PaginableCollection = require './PaginableCollection'

class TaskS3Logs extends PaginableCollection

model: S3Log

url: -> "#{ config.apiRoot }/logs/task/#{ @taskId }"

initialize: (models, { @taskId }) =>

parse: (model) ->
for m in model
m.taskId = @taskId
model

module.exports = TaskS3Logs
8 changes: 8 additions & 0 deletions SingularityUI/app/handlebarsHelpers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,11 @@ Handlebars.registerHelper 'getLabelClass', (state) ->
'danger'
else
'default'

Handlebars.registerHelper 'trimS3File', (filename, taskId) ->
unless config.taskS3LogOmitPrefix
return filename

finalRegex = config.taskS3LogOmitPrefix.replace('%taskId', taskId.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')).replace('%index', '[0-9]+').replace('%s', '[0-9]+')

return filename.replace(new RegExp(finalRegex), '')
2 changes: 1 addition & 1 deletion SingularityUI/app/templates/taskDetail/taskS3Logs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<tr>
<td>
<a class="long-link" href="{{ getUrl }}" target="_blank" title="{{ key }}">
{{ shortKey }}
{{ trimS3File shortKey taskId }}
</a>
</td>
<td>
Expand Down
1 change: 1 addition & 0 deletions SingularityUI/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ exports.config =
runningTaskLogPath: process.env.SINGULARITY_RUNNING_TASK_LOG_PATH ? "stdout"
finishedTaskLogPath: process.env.SINGULARITY_FINISHED_TASK_LOG_PATH ? "stdout"
commonHostnameSuffixToOmit: process.env.SINGULARITY_COMMON_HOSTNAME_SUFFIX_TO_OMIT ? ""
taskS3LogOmitPrefix: process.env.SINGULARITY_TASK_S3_LOG_OMIT_PREFIX ? ''

compiledTemplate = handlebars.compile(indexTemplate)(templateData)
fs.writeFileSync destination, compiledTemplate