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 @@ -66,6 +66,12 @@ public static RootUrlMode parse(String value) {
@NotNull
private String taskS3LogOmitPrefix = "";

@NotEmpty
private String timestampFormat = "lll";

@NotEmpty
private String timestampWithSecondsFormat = "lll:ss";

public boolean isHideNewDeployButton() {
return hideNewDeployButton;
}
Expand Down Expand Up @@ -150,4 +156,19 @@ public void setTaskS3LogOmitPrefix(String taskS3LogOmitPrefix) {
this.taskS3LogOmitPrefix = taskS3LogOmitPrefix;
}

public String getTimestampFormat() {
return timestampFormat;
}

public void setTimestampFormat(String timestampFormat) {
this.timestampFormat = timestampFormat;
}

public String getTimestampWithSecondsFormat() {
return timestampWithSecondsFormat;
}

public void setTimestampWithSecondsFormat(String timestampWithSecondsFormat) {
this.timestampWithSecondsFormat = timestampWithSecondsFormat;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class IndexView extends View {

private final Integer warnIfScheduledJobIsRunningPastNextRunPct;

private final String timestampFormat;

private final String timestampWithSecondsFormat;

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

Expand Down Expand Up @@ -76,6 +80,10 @@ public IndexView(String singularityUriBase, String appRoot, SingularityConfigura
this.taskS3LogOmitPrefix = configuration.getUiConfiguration().getTaskS3LogOmitPrefix();

this.warnIfScheduledJobIsRunningPastNextRunPct = configuration.getWarnIfScheduledJobIsRunningPastNextRunPct();

this.timestampFormat = configuration.getUiConfiguration().getTimestampFormat();

this.timestampWithSecondsFormat = configuration.getUiConfiguration().getTimestampWithSecondsFormat();
}

public String getAppRoot() {
Expand Down Expand Up @@ -158,6 +166,14 @@ public Integer getWarnIfScheduledJobIsRunningPastNextRunPct() {
return warnIfScheduledJobIsRunningPastNextRunPct;
}

public String getTimestampFormat() {
return timestampFormat;
}

public String getTimestampWithSecondsFormat() {
return timestampWithSecondsFormat;
}

@Override
public String toString() {
return "IndexView[" +
Expand All @@ -180,6 +196,8 @@ public String toString() {
", finishedTaskLogPath='" + finishedTaskLogPath + '\'' +
", commonHostnameSuffixToOmit='" + commonHostnameSuffixToOmit + '\'' +
", warnIfScheduledJobIsRunningPastNextRunPct='" + warnIfScheduledJobIsRunningPastNextRunPct + '\'' +
", timestampFormat='" + timestampFormat + '\'' +
", timestampWithSecondsFormat='" + timestampWithSecondsFormat + '\'' +
']';
}
}
2 changes: 2 additions & 0 deletions SingularityUI/app/assets/_index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
taskS3LogOmitPrefix: "{{{ taskS3LogOmitPrefix }}}",
slaveHttpPort: {{{slaveHttpPort}}},
warnIfScheduledJobIsRunningPastNextRunPct: {{{warnIfScheduledJobIsRunningPastNextRunPct}}},
timestampFormat: localStorage.getItem('timestampFormatOverride') || "{{{timestampFormat}}}",
timestampWithSecondsFormat: localStorage.getItem('timestampWithSecondsFormatOverride') || "{{{timestampWithSecondsFormat}}}",
{{#slaveHttpsPort}}
slaveHttpsPort: {{{slaveHttpsPort}}}
{{/slaveHttpsPort}}
Expand Down
6 changes: 3 additions & 3 deletions SingularityUI/app/handlebarsHelpers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Handlebars.registerHelper 'withLast', (list, options) ->
Handlebars.registerHelper 'timestampFromNow', (timestamp) ->
return '' if not timestamp
timeObject = moment timestamp
"#{timeObject.fromNow()} (#{ timeObject.format 'lll'})"
"#{timeObject.fromNow()} (#{ timeObject.format window.config.timestampFormat})"

Handlebars.registerHelper 'ifTimestampInPast', (timestamp, options) ->
return options.inverse @ if not timestamp
Expand All @@ -81,12 +81,12 @@ Handlebars.registerHelper 'timestampDuration', (timestamp) ->
Handlebars.registerHelper 'timestampFormatted', (timestamp) ->
return '' if not timestamp
timeObject = moment timestamp
timeObject.format 'lll'
timeObject.format window.config.timestampFormat

Handlebars.registerHelper 'timestampFormattedWithSeconds', (timestamp) ->
return '' if not timestamp
timeObject = moment timestamp
timeObject.format 'lll:ss'
timeObject.format window.config.timestampWithSecondsFormat

# 'DRIVER_NOT_RUNNING' => 'Driver not running'
Handlebars.registerHelper 'humanizeText', (text) ->
Expand Down
2 changes: 2 additions & 0 deletions SingularityUI/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ exports.config =
commonHostnameSuffixToOmit: process.env.SINGULARITY_COMMON_HOSTNAME_SUFFIX_TO_OMIT ? ""
taskS3LogOmitPrefix: process.env.SINGULARITY_TASK_S3_LOG_OMIT_PREFIX ? ''
warnIfScheduledJobIsRunningPastNextRunPct: process.env.SINGULARITY_WARN_IF_SCHEDULED_JOB_IS_RUNNING_PAST_NEXT_RUN_PCT ? 200
timestampFormat: process.env.SINGULARITY_TIMESTAMP_FORMAT ? 'lll'
timestampWithSecondsFormat: process.env.SINGULARITY_TIMESTAMP_WITH_SECONDS_FORMAT ? 'lll:ss'

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