@@ -44,9 +44,7 @@ export class InsightTemplateHtml
4444
4545 const { insight } = this . data ;
4646
47- let startTime = '' ;
48- let formattedStartTime = '' ;
49- let hasCustomTime = false ;
47+ let timeInfoHtml = '' ;
5048
5149 const menuItems = [ ] ;
5250 if ( ( < CodeObjectInsight > insight ) ?. prefixedCodeObjectId ) {
@@ -60,10 +58,23 @@ export class InsightTemplateHtml
6058
6159 console . log ( 'insight' , codeObjectId , insightType , customStartTime ) ;
6260
63- startTime = actualStartTime ?. format ( 'L' ) || '' ;
64- formattedStartTime = actualStartTime ?. fromNow ( ) || formattedStartTime ;
65- hasCustomTime = ! ! customStartTime ;
61+ const startTime = actualStartTime ?. format ( 'L' ) || '' ;
62+ const formattedStartTime = actualStartTime ?. fromNow ( ) || '' ;
63+ const identicalStartTimes = actualStartTime ?. valueOf ( ) === customStartTime ?. valueOf ( ) ;
6664
65+ const timeInfoVisibilityClass = ! ! customStartTime ? '' : 'hidden' ;
66+ const refreshButtonVisibilityClass = identicalStartTimes ? 'hidden' : '' ;
67+ const timeInfoMessage = identicalStartTimes
68+ ? `Age of data: ${ formattedStartTime } `
69+ : `Applying the new time filter. Wait a few minutes and then refresh.` ;
70+
71+ timeInfoHtml = `
72+ <div class="list-item-time-info ${ timeInfoVisibilityClass } ">
73+ <span class="list-item-time-info-message" title="${ startTime } ">${ timeInfoMessage } </span>
74+ <a href="#" class="custom-start-date-refresh-link ${ refreshButtonVisibilityClass } ">Refresh</a>
75+ </div>
76+ ` ;
77+
6778 menuItems . push ( `
6879 <li
6980 class="list-item-menu-item custom-start-date-recalculate-link"
@@ -77,36 +88,18 @@ export class InsightTemplateHtml
7788
7889 const threeDotImageUri = this . _viewUris . image ( 'three-dots.svg' ) ;
7990
80- // let menuHtml = menuItems?.length > 0
81- // ? `<ul class="list-item-menu sf-menu sf-js-enabled">
82- // <li class="list-item-menu">
83- // <img class="list-item-icon" src="${threeDotImageUri}" height="15">
84- // <ul>
85- // ${menuItems.join("")}
86- // </ul>
87- // </li>
88- // </ul>`
89- // : ``;
90- let menuHtml = menuItems ?. length > 0
91- ? `<div
92- class="list-item-icon custom-start-date-recalculate-link codicon codicon-calendar"
93- src="${ threeDotImageUri } "
94- title="Recalculate\n\nClick to recalculate this insight only using new data"
95- height="15"
96- ></div>`
91+ const menuItemsHtml = menuItems . length > 0
92+ ? `<li class="list-item-menu">
93+ <img class="list-item-icon" src="${ threeDotImageUri } " height="15">
94+ <ul>
95+ ${ menuItems . join ( "" ) }
96+ </ul>
97+ </li>`
9798 : `` ;
98- // const menuItemsHtml = menuItems.length > 0
99- // ? `<li class="list-item-menu-item">
100- // <img class="list-item-icon" src="${threeDotImageUri}" height="15">
101- // <ul>
102- // ${menuItems.join("")}
103- // </ul>
104- // </li>`
105- // : ``;
106- // const menuHtml = `
107- // <ul class="list-item-menu sf-menu sf-js-enabled">
108- // ${menuItemsHtml}
109- // </ul>`;
99+ const menuHtml = `
100+ <ul class="list-item-menu sf-menu sf-js-enabled">
101+ ${ menuItemsHtml }
102+ </ul>` ;
110103
111104 let title = "" ;
112105 let tooltip = "" ;
@@ -118,14 +111,6 @@ export class InsightTemplateHtml
118111 tooltip = ( < ITitle > this . data . title ) . tooltip ;
119112 }
120113
121- const timeInfoVisibilityClass = hasCustomTime ? '' : 'hidden' ;
122- const timeInfoHtml = `
123- <div class="list-item-time-info ${ timeInfoVisibilityClass } ">
124- <span class="list-item-time-info-message" title="${ startTime } ">Age of data: ${ formattedStartTime } </span>
125- <a href="#" class="custom-start-date-refresh-link">Refresh</a>
126- </div>
127- ` ;
128-
129114 const html = /*html*/ `
130115 <div class="list-item insight">
131116 <div class="list-item-top-area">
@@ -134,8 +119,8 @@ export class InsightTemplateHtml
134119 ${ timeInfoHtml }
135120 ${ descriptionHtml }
136121 </div>
137- ${ menuHtml }
138122 ${ iconHtml }
123+ ${ menuHtml }
139124 </div>
140125 ${ bodyHtml }
141126 ${ buttonsHtml }
0 commit comments