File tree Expand file tree Collapse file tree
SingularityService/src/main/java/com/hubspot/singularity
SingularityUI/app/components/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ public static RootUrlMode parse(String value) {
4343 @ JsonProperty
4444 private Optional <String > navColor = Optional .empty ();
4545
46+ @ JsonProperty
47+ private List <UINavLinkConfiguration > formattedNavLinks = Collections .emptyList ();
48+
4649 @ JsonProperty
4750 private String baseUrl ;
4851
@@ -109,6 +112,7 @@ public static RootUrlMode parse(String value) {
109112
110113 // e.g. {"QA": "https://singularity-qa.my-paas.net", "Production": "https://singularity-prod.my-paas.net"}
111114 @ JsonProperty
115+ @ Deprecated
112116 private Map <String , String > navTitleLinks = Collections .emptyMap ();
113117
114118 @ JsonProperty
@@ -351,4 +355,12 @@ public Optional<String> getCostsApiUrlFormat() {
351355 public void setCostsApiUrlFormat (Optional <String > costsApiUrlFormat ) {
352356 this .costsApiUrlFormat = costsApiUrlFormat ;
353357 }
358+
359+ public List <UINavLinkConfiguration > getFormattedNavLinks () {
360+ return formattedNavLinks ;
361+ }
362+
363+ public void setFormattedNavLinks (List <UINavLinkConfiguration > formattedNavLinks ) {
364+ this .formattedNavLinks = formattedNavLinks ;
365+ }
354366}
Original file line number Diff line number Diff line change 1+ package com .hubspot .singularity .config ;
2+
3+ import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
4+ import javax .annotation .Nullable ;
5+ import javax .validation .constraints .NotNull ;
6+
7+ @ JsonIgnoreProperties (ignoreUnknown = true )
8+ public class UINavLinkConfiguration {
9+ private String title ;
10+ private String linkFormat ;
11+ private Boolean divider = false ;
12+ private String tooltip ;
13+
14+ public String getTitle () {
15+ return title ;
16+ }
17+
18+ public void setTitle (String title ) {
19+ this .title = title ;
20+ }
21+
22+ public String getLinkFormat () {
23+ return linkFormat ;
24+ }
25+
26+ public void setLinkFormat (String linkFormat ) {
27+ this .linkFormat = linkFormat ;
28+ }
29+
30+ public Boolean getDivider () {
31+ return divider ;
32+ }
33+
34+ public void setDivider (Boolean divider ) {
35+ this .divider = divider ;
36+ }
37+
38+ @ Nullable
39+ public String getTooltip () {
40+ return tooltip ;
41+ }
42+
43+ public void setTooltip (@ Nullable String tooltip ) {
44+ this .tooltip = tooltip ;
45+ }
46+ }
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ public IndexView(
171171 }
172172
173173 try {
174- this .navTitleLinks = ow .writeValueAsString (uiConfiguration .getNavTitleLinks ());
174+ this .navTitleLinks = ow .writeValueAsString (uiConfiguration .getFormattedNavLinks ());
175175 } catch (JsonProcessingException e ) {
176176 throw new RuntimeException (e );
177177 }
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import classnames from 'classnames';
66import Utils from '../../utils' ;
77
88import { Glyphicon } from 'react-bootstrap' ;
9+ import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger' ;
10+ import ToolTip from 'react-bootstrap/lib/Tooltip' ;
911
1012function handleSearchClick ( event , toggleGlobalSearch ) {
1113 event . preventDefault ( ) ;
@@ -58,11 +60,29 @@ const Navigation = (props) => {
5860 { config . title } < span className = "caret" />
5961 </ a >
6062 < ul className = "dropdown-menu" >
61- { Object . keys ( config . navTitleLinks ) . map ( ( linkTitle , index ) =>
62- < li key = { index } >
63- < a href = { config . navTitleLinks [ linkTitle ] . replace ( '{CURRENT_PATH}' , currentPathForLink ( props . location . pathname ) ) } > { linkTitle } </ a >
64- </ li >
65- ) }
63+ { config . navTitleLinks . map ( ( linkConfig , index ) => {
64+ if ( linkConfig [ 'divider' ] ) {
65+ return ( < li key = { index } role = "separator" className = "divider" > </ li > ) ;
66+ }
67+ let link = ( < a href = { linkConfig [ 'linkFormat' ] . replace ( '{CURRENT_PATH}' , currentPathForLink ( props . location . pathname ) ) } > { linkConfig [ 'title' ] } </ a > ) ;
68+ if ( 'tooltip' in linkConfig ) {
69+ const tooltip = (
70+ < ToolTip id = "view-nav-tip" >
71+ { linkConfig [ 'tooltip' ] }
72+ </ ToolTip >
73+ ) ;
74+ link = (
75+ < OverlayTrigger placement = "right" id = "view-nav-tip-overlay" overlay = { tooltip } >
76+ { link }
77+ </ OverlayTrigger >
78+ ) ;
79+ }
80+ return (
81+ < li key = { index } >
82+ { link }
83+ </ li >
84+ ) ;
85+ } ) }
6686 </ ul >
6787 </ li >
6888 </ ul >
You can’t perform that action at this time.
0 commit comments