Skip to content

Commit 2a2e564

Browse files
author
Noam Kfir
committed
Show age of data based on actual start time, cleanup
1 parent 57811ca commit 2a2e564

File tree

3 files changed

+36
-13
lines changed

3 files changed

+36
-13
lines changed

src/views-ui/codeAnalytics/main.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,19 @@ vscode-panel-view {
101101
right: 0;
102102
min-width: unset;
103103
font-family: var(--font-family);
104-
cursor: pointer;
105104

106105
&, &:hover, &.sfHover {
107106
background: transparent;
108107
}
108+
109+
cursor: pointer;
110+
* {
111+
cursor: pointer;
112+
}
113+
114+
li {
115+
padding: 4px 8px;
116+
}
109117
}
110118

111119
ul {

src/views/codeAnalytics/InsightListView/IInsightListViewItemsCreator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Moment } from "moment";
12
import { decimal, integer } from "vscode-languageclient";
23
import { UsageStatusResults } from "../../../services/analyticsProvider";
34
import { IListViewItemBase } from "../../ListView/IListViewItem";
@@ -12,7 +13,8 @@ export interface CodeObjectInsight extends Insight{
1213
importance: InsightImporance,
1314
severity: decimal,
1415
decorators: CodeObjectDecorator[],
15-
customStartTime: Date,
16+
actualStartTime?: Moment,
17+
customStartTime?: Moment,
1618
prefixedCodeObjectId: string,
1719
}
1820

src/views/codeAnalytics/InsightListView/ItemRender/insightTemplateHtml.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,33 @@ export class InsightTemplateHtml
4444

4545
const { insight } = this.data;
4646

47+
let startTime = '';
4748
let formattedStartTime = '';
49+
let hasCustomTime = false;
4850

4951
const menuItems = [];
5052
if((<CodeObjectInsight>insight)?.prefixedCodeObjectId) {
5153
const codeObjectInsight = <CodeObjectInsight>insight;
5254
const {
5355
prefixedCodeObjectId: codeObjectId,
5456
type: insightType,
57+
actualStartTime,
5558
customStartTime,
5659
} = codeObjectInsight;
5760

5861
console.log('insight', codeObjectId, insightType, customStartTime);
5962

60-
formattedStartTime = customStartTime?.toDateString() || formattedStartTime;
61-
62-
const customStartDateLinkStates = {
63-
unset: { label: 'Recalculate', action: 'reset' },
64-
};
65-
const state = customStartDateLinkStates.unset;
63+
startTime = actualStartTime?.format('L') || '';
64+
formattedStartTime = actualStartTime?.fromNow() || formattedStartTime;
65+
hasCustomTime = !!customStartTime;
6666

6767
menuItems.push(`
6868
<li
6969
class="list-item-menu-item custom-start-date-recalculate-link"
7070
data-code-object-id="${codeObjectId}"
7171
data-insight-type="${insightType}"
7272
>
73-
<i class="codicon codicon-calendar"></i>
74-
${state.label}
73+
Recalculate
7574
</li>
7675
`);
7776
}
@@ -88,6 +87,18 @@ export class InsightTemplateHtml
8887
</li>
8988
</ul>`
9089
: ``;
90+
// const menuItemsHtml = menuItems.length > 0
91+
// ? `<li class="list-item-menu-item">
92+
// <img class="list-item-icon" src="${threeDotImageUri}" height="15">
93+
// <ul>
94+
// ${menuItems.join("")}
95+
// </ul>
96+
// </li>`
97+
// : ``;
98+
// const menuHtml = `
99+
// <ul class="list-item-menu sf-menu sf-js-enabled">
100+
// ${menuItemsHtml}
101+
// </ul>`;
91102

92103
let title = "";
93104
let tooltip = "";
@@ -99,11 +110,13 @@ export class InsightTemplateHtml
99110
tooltip = (<ITitle>this.data.title).tooltip;
100111
}
101112

113+
const timeInfoVisibilityClass = hasCustomTime ? '' : 'hidden';
102114
const timeInfoHtml = `
103-
<div class="list-item-time-info hidden">
104-
<span class="list-item-time-info-message">Insight calculated since ${formattedStartTime}</span>
115+
<div class="list-item-time-info ${timeInfoVisibilityClass}">
116+
<span class="list-item-time-info-message" title="${startTime}">Age of data: ${formattedStartTime}</span>
105117
<a href="#" class="custom-start-date-refresh-link">Refresh</a>
106-
</div>`;
118+
</div>
119+
`;
107120

108121
const html = /*html*/`
109122
<div class="list-item insight">

0 commit comments

Comments
 (0)