Skip to content

Commit 544baa9

Browse files
authored
Merge pull request #215 from digma-ai/feature/insight-date-reset
Feature/insight date reset
2 parents 89a1511 + e94430f commit 544baa9

File tree

17 files changed

+361
-64
lines changed

17 files changed

+361
-64
lines changed

images/three-dots.svg

Lines changed: 3 additions & 0 deletions
Loading

package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
"moment": "^2.29.3",
149149
"node-fetch": "^2.6.6",
150150
"sass": "^1.54.4",
151+
"superfish": "^1.7.10",
151152
"vscode-languageclient": "^7.0.0"
152153
},
153154
"scripts": {

src/services/analyticsProvider.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,25 @@ export class AnalyticsProvider
452452
});
453453
return response;
454454
}
455+
456+
public async setInsightCustomStartTime(
457+
codeObjectId: string,
458+
insightType: string,
459+
time: Date,
460+
): Promise<any> {
461+
const response: any [] = await this.send<any>(
462+
'PUT',
463+
`/CodeAnalytics/insights/start-time`,
464+
undefined,
465+
{
466+
Environment: this.state.environment,
467+
CodeObjectId: codeObjectId,
468+
InsightType: insightType,
469+
Time: time,
470+
},
471+
);
472+
return response;
473+
}
455474

456475
public async getErrorSummary(codeObjectIds: string [], currentEnv:boolean): Promise<MethodCodeObjectSummary []>
457476
{

src/views-ui/codeAnalytics/contracts.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decimal } from "vscode-languageclient"
1+
import { decimal } from "vscode-languageclient";
22

33
export namespace UiMessage
44
{
@@ -7,6 +7,7 @@ export namespace UiMessage
77
export class TabLoaded {
88
constructor(public selectedViewId?: string) {}
99
}
10+
1011
export class TabChanged {
1112
constructor(public viewId?: string) {}
1213
}
@@ -19,9 +20,11 @@ export namespace UiMessage
1920
constructor(public environment?: string) {}
2021

2122
}
23+
2224
export class GoToLine{
2325
constructor(public line?: number){}
2426
}
27+
2528
export class GoToLineByFrameId {
2629
constructor(public frameId?: number){}
2730
}
@@ -37,21 +40,34 @@ export namespace UiMessage
3740
export class OpenTracePanel {
3841
constructor(public traceIds?: string[], public traceLabels?:string[], public span?:string, public jaegerAddress?:string){}
3942
}
43+
4044
export class OpenRawTrace {
4145
constructor(public content?: string) {}
4246
}
47+
4348
export class WorkspaceOnlyChanged {
4449
constructor(public value?: boolean){}
4550
}
51+
4652
export class ErrorViewVisibilityChanged {
4753
constructor(public visible?: boolean){}
4854
}
55+
4956
export class NavigateErrorFlow {
5057
constructor(public offset?: number) {}
5158
}
59+
5260
export class OverlayVisibilityChanged {
5361
constructor(public visible?: boolean, public id?:string){}
5462
}
63+
64+
export class SetInsightCustomStartTime {
65+
constructor(
66+
public codeObjectId?: string,
67+
public insightType?: string,
68+
public time?: Date,
69+
) {}
70+
}
5571
}
5672

5773
export namespace Get
@@ -79,12 +95,15 @@ export namespace UiMessage
7995
export class SpanList {
8096
constructor(public htmlContent?: string) {}
8197
}
98+
8299
export class ErrorsList {
83100
constructor(public htmlContent?: string) {}
84101
}
102+
85103
export class StackDetails {
86104
constructor(public htmlContent?: string) {}
87105
}
106+
88107
export class CurrenStackInfo {
89108
constructor(public stackInfo?: {
90109
stackNumber: number
@@ -93,12 +112,15 @@ export namespace UiMessage
93112
canNavigateToNext: boolean,
94113
}) {}
95114
}
115+
96116
export class CodeObjectLabel {
97117
constructor(public htmlContent?: string) {}
98118
}
119+
99120
export class SpanObjectLabel {
100121
constructor(public htmlContent?: string) {}
101122
}
123+
102124
export class Overlay {
103125
constructor(public htmlContent?: string, public id?: string) {}
104126
}

src/views-ui/codeAnalytics/main.scss

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,48 @@ vscode-panel-view {
9191
}
9292
}
9393

94+
.list-item-menu {
95+
padding: 0;
96+
margin: 0;
97+
}
98+
99+
.sf-menu {
100+
li {
101+
right: 0;
102+
min-width: unset;
103+
font-family: var(--font-family);
104+
105+
&, &:hover, &.sfHover {
106+
background: transparent;
107+
}
108+
109+
cursor: pointer;
110+
* {
111+
cursor: pointer;
112+
}
113+
114+
li {
115+
color: var(--button-secondary-foreground);
116+
background: var(--button-secondary-background);
117+
}
118+
}
119+
120+
ul {
121+
left: unset;
122+
right: 0;
123+
min-width: unset;
124+
125+
li {
126+
color: var(--button-secondary-foreground);
127+
background: var(--button-secondary-background);
128+
}
129+
}
130+
}
131+
132+
.hidden {
133+
display: none;
134+
}
135+
94136
.summary-list-item {
95137
display: flex;
96138
background: var(--vscode-list-hoverBackground);

src/views-ui/codeAnalytics/main.ts

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { consume, publish } from "../common/contracts";
22
import { UiMessage } from "./contracts";
3+
34
window.addEventListener("load", () =>
45
{
56
let overlayVisibility = false;
@@ -88,10 +89,12 @@ window.addEventListener("load", () =>
8889
const errorsTab = $("#view-errors");
8990

9091
consume(UiMessage.Set.Overlay, e => {
91-
if(e.htmlContent)
92+
if(e.htmlContent) {
9293
showOverlay(e.htmlContent, e.id);
93-
else
94+
}
95+
else {
9496
hideOverlay();
97+
}
9598
});
9699

97100
consume(UiMessage.Set.ErrorsList, (event) => {
@@ -120,16 +123,24 @@ window.addEventListener("load", () =>
120123
changePage($(this), 1);
121124
});
122125
}
126+
127+
function initListItemMenus(){
128+
const menus: any = $('.list-item-menu');
129+
menus.superfish({
130+
delay: 10000,
131+
cssArrows: false,
132+
});
133+
}
134+
123135
consume(UiMessage.Set.InsightsList, (event) => {
124136

125137
if (event.htmlContent !== undefined) {
126138
insightsTab.find("#insightList").html(event.htmlContent);
127139
}
128140
initPaginationLists();
141+
initListItemMenus();
129142
});
130143

131-
132-
133144
consume(UiMessage.Set.GlobalInsightsList, (event) => {
134145
if (event.htmlContent !== undefined) {
135146
globalInsightsTab.find("#insightList").html(event.htmlContent);
@@ -154,6 +165,12 @@ window.addEventListener("load", () =>
154165
}
155166
});
156167

168+
consume(UiMessage.Set.SpanObjectLabel, (event) => {
169+
if (event.htmlContent !== undefined) {
170+
$("#spanScope").html(event.htmlContent);
171+
}
172+
});
173+
157174
/*error-view*/
158175
$(document).on("click", ".error-view-close", function () {
159176
hideOverlay();
@@ -197,6 +214,25 @@ window.addEventListener("load", () =>
197214
publish(new UiMessage.Notify.OpenHistogramPanel(spanName,spanInstrumentationLibrary));
198215
});
199216

217+
$(document).on("click", ".custom-start-date-recalculate-link", function () {
218+
const $this = $(this);
219+
const codeObjectId = $this.data("code-object-id");
220+
const insightType = $this.data("insight-type");
221+
222+
const $timeInfo = $this
223+
.closest('.list-item.insight')
224+
.find('.list-item-time-info');
225+
$timeInfo
226+
.find('.list-item-time-info-message')
227+
.text('Applying the new time filter. Wait a few minutes and then refresh.');
228+
$timeInfo.show();
229+
publish(new UiMessage.Notify.SetInsightCustomStartTime(codeObjectId, insightType, new Date()));
230+
});
231+
232+
$(document).on("click", ".custom-start-date-refresh-link", function () {
233+
publish(new UiMessage.Notify.TabRefreshRequested());
234+
});
235+
200236
$(document).on("click", ".trace-link", function () {
201237
const traceIds = $(this).data("trace-id").split(",");
202238
const traceLabels = $(this).data("trace-label")?.split(",");
@@ -207,6 +243,16 @@ window.addEventListener("load", () =>
207243
publish(new UiMessage.Notify.OpenTracePanel(traceIds,traceLabels,span, jaeger));
208244
});
209245

246+
$(document).on("click", ".reset-link", function () {
247+
const traceIds = $(this).data("trace-id").split(",");
248+
const traceLabels = $(this).data("trace-label")?.split(",");
249+
250+
const span = $(this).data("span-name");
251+
const jaeger = $(this).data("jaeger-address");
252+
253+
publish(new UiMessage.Notify.OpenTracePanel(traceIds,traceLabels,span, jaeger));
254+
});
255+
210256
$(document).on("click",".pagination-nav .prev", function(){
211257
var paginationListElement = $(this).closest('.pagination-list');
212258
prevPage(paginationListElement);

src/views/codeAnalytics/AdminInsights/adminInsights.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export class UnknownInsightInsight implements IListViewItemBase {
1111
return new InsightTemplateHtml({
1212
title: "The Digma Plugin probably requires an update",
1313
description: "We're getting wicked new insights but this plugin just ain't up to date. Please update the plugin via your vscode Settings.",
14-
icon: this.viewUris.image("update-required.png")
15-
}).renderHtml();
14+
icon: this.viewUris.image("update-required.png"),
15+
}, this.viewUris).renderHtml();
1616
}
1717
groupId: string | undefined;
1818
}
@@ -26,8 +26,8 @@ export class DuplicateSpanInsight implements IListViewItemBase {
2626
return new InsightTemplateHtml({
2727
title: "Duplicate span detected",
2828
description: "Two spans have the exact same identifier, please change the name to avoid getting the wires crossed...",
29-
icon: this.viewUris.image("update-required.png")
30-
}).renderHtml();
29+
icon: this.viewUris.image("update-required.png"),
30+
}, this.viewUris).renderHtml();
3131
}
3232
groupId: string | undefined = this.span.name;
3333
}

0 commit comments

Comments
 (0)