diff --git a/SingularityService/src/main/java/com/hubspot/singularity/config/UIConfiguration.java b/SingularityService/src/main/java/com/hubspot/singularity/config/UIConfiguration.java index 28d430f7c5..e75f68a6ca 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/config/UIConfiguration.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/config/UIConfiguration.java @@ -66,6 +66,8 @@ public static RootUrlMode parse(String value) { private boolean hideNewDeployButton = false; private boolean hideNewRequestButton = false; + private boolean shortenSlaveUsageHostname = false; + /** * If true, the root of the server (http://.../singularity/) will open the UI. Otherwise, * the UI URI (http://.../singularity/ui/) must be used. @@ -109,6 +111,14 @@ public void setHideNewRequestButton(boolean hideNewRequestButton) { this.hideNewRequestButton = hideNewRequestButton; } + public boolean isShortenSlaveUsageHostname() { + return shortenSlaveUsageHostname; + } + + public void setShortenSlaveUsageHostname(boolean shortenSlaveUsageHostname) { + this.shortenSlaveUsageHostname = shortenSlaveUsageHostname; + } + public String getTitle() { return title; } diff --git a/SingularityService/src/main/java/com/hubspot/singularity/views/IndexView.java b/SingularityService/src/main/java/com/hubspot/singularity/views/IndexView.java index a28b869d60..2fe01b7736 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/views/IndexView.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/views/IndexView.java @@ -49,6 +49,8 @@ public class IndexView extends View { private final String shellCommands; + private final boolean shortenSlaveUsageHostname; + private final String timestampFormat; private final boolean showTaskDiskResource; @@ -111,6 +113,8 @@ public IndexView(String singularityUriBase, String appRoot, SingularityConfigura throw Throwables.propagate(e); } + this.shortenSlaveUsageHostname = configuration.getUiConfiguration().isShortenSlaveUsageHostname(); + this.timestampFormat = configuration.getUiConfiguration().getTimestampFormat(); this.timestampWithSecondsFormat = configuration.getUiConfiguration().getTimestampWithSecondsFormat(); @@ -234,6 +238,10 @@ public String getRedirectOnUnauthorizedUrl() { return redirectOnUnauthorizedUrl; } + public boolean isShortenSlaveUsageHostname() { + return shortenSlaveUsageHostname; + } + @Override public String toString() { return "IndexView{" + @@ -261,6 +269,7 @@ public String toString() { ", taskS3LogOmitPrefix='" + taskS3LogOmitPrefix + '\'' + ", warnIfScheduledJobIsRunningPastNextRunPct=" + warnIfScheduledJobIsRunningPastNextRunPct + ", shellCommands='" + shellCommands + '\'' + + ", shortenSlaveUsageHostname=" + shortenSlaveUsageHostname + ", timestampFormat='" + timestampFormat + '\'' + ", showTaskDiskResource=" + showTaskDiskResource + ", timestampWithSecondsFormat='" + timestampWithSecondsFormat + '\'' + diff --git a/SingularityUI/app/actions/api/slaves.es6 b/SingularityUI/app/actions/api/slaves.es6 index 6d93de76ff..8a2e803398 100644 --- a/SingularityUI/app/actions/api/slaves.es6 +++ b/SingularityUI/app/actions/api/slaves.es6 @@ -54,4 +54,7 @@ export const RemoveExpiringSlaveState = buildJsonApiAction( }) ); - +export const FetchSlaveUsages = buildApiAction( + 'FETCH_SLAVE_USAGES', + {url : '/usage/slaves'} +); diff --git a/SingularityUI/app/assets/index.mustache b/SingularityUI/app/assets/index.mustache index aa45a2b9b2..364b080e4f 100644 --- a/SingularityUI/app/assets/index.mustache +++ b/SingularityUI/app/assets/index.mustache @@ -44,6 +44,7 @@ slaveHttpsPort: {{{slaveHttpsPort}}}, {{/slaveHttpsPort}} shellCommands: {{{shellCommands}}}, + shortenSlaveUsageHostname : {{{shortenSlaveUsageHostname}}}, redirectOnUnauthorizedUrl: "{{{redirectOnUnauthorizedUrl}}}", globalRefreshInterval: 60000, sentryDsn: "{{{sentryDsn}}}" diff --git a/SingularityUI/app/components/common/Navigation.jsx b/SingularityUI/app/components/common/Navigation.jsx index 94b5f3c969..c472790843 100644 --- a/SingularityUI/app/components/common/Navigation.jsx +++ b/SingularityUI/app/components/common/Navigation.jsx @@ -62,6 +62,7 @@ const Navigation = (props) => {