Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend V2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Frontend V2
Commits
0b2c51da
Commit
0b2c51da
authored
4 weeks ago
by
Michael Behrisch
Browse files
Options
Downloads
Patches
Plain Diff
feat: displays appropriate error message if backend service is not running
parent
09b8c960
Branches
fix/sharelink
No related tags found
1 merge request
!467
feat: :sparkles: New InsightAnalytics View to get an overview about all queries executed
Pipeline
#146552
passed
4 weeks ago
Stage: tag-release
Stage: get-release-tag
Stage: container-image
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/insight-analytics/InsightAnalyticsDialog.tsx
+17
-8
17 additions, 8 deletions
src/lib/insight-analytics/InsightAnalyticsDialog.tsx
src/lib/insight-analytics/insightanalytics.service.ts
+20
-3
20 additions, 3 deletions
src/lib/insight-analytics/insightanalytics.service.ts
with
37 additions
and
11 deletions
src/lib/insight-analytics/InsightAnalyticsDialog.tsx
+
17
−
8
View file @
0b2c51da
...
...
@@ -23,8 +23,13 @@ export function InsightAnalyticsDialog(props: Props) {
const
jsonData
=
await
fetchData
(
projectionType
);
setData
(
jsonData
);
setLastRefreshTime
(
new
Date
());
}
catch
(
error
)
{
}
catch
(
error
:
any
)
{
console
.
error
(
'
Error fetching data:
'
,
error
);
setData
({
status
:
'
error
'
,
error
:
error
.
message
,
errorDetails
:
error
.
response
?.
data
?.
detail
||
error
.
details
||
error
.
stack
,
});
}
};
...
...
@@ -110,14 +115,18 @@ export function InsightAnalyticsDialog(props: Props) {
{
data
&&
data
.
status
===
'
success
'
?
(
<
InsightAnalyticsScatterPlot
queries
=
{
data
.
queries
}
radiusType
=
{
radiusType
}
/>
)
:
data
&&
data
.
status
===
'
error
'
?
(
<>
<
div
className
=
"space-y-4"
>
<
p
className
=
"text-red-500 font-bold"
>
Error Message from Backend Knowledge Analytics service:
</
p
>
<
code
>
{
data
.
error
}
</
code
>
<
details
>
<
summary
>
Error Details
</
summary
>
<
code
>
{
data
.
errorDetails
}
</
code
>
</
details
>
</>
<
pre
className
=
"p-4 bg-red-50 border border-red-200 rounded text-red-600 whitespace-pre-wrap"
>
{
data
.
error
}
</
pre
>
{
data
.
errorDetails
&&
(
<
details
className
=
"mt-4"
>
<
summary
className
=
"cursor-pointer text-secondary-700"
>
Error Details
</
summary
>
<
pre
className
=
"mt-2 p-4 bg-red-50 border border-red-200 rounded text-red-600 whitespace-pre-wrap"
>
{
data
.
errorDetails
}
</
pre
>
</
details
>
)
}
</
div
>
)
:
(
<
p
>
Loading data...
</
p
>
)
}
...
...
This diff is collapsed.
Click to expand it.
src/lib/insight-analytics/insightanalytics.service.ts
+
20
−
3
View file @
0b2c51da
import
{
ProjectionType
,
Query
}
from
"
./types
"
;
export
const
fetchData
=
async
(
projector
:
ProjectionType
)
=>
{
const
controller
=
new
AbortController
();
const
timeoutId
=
setTimeout
(()
=>
controller
.
abort
(),
10000
);
// 30 seconds timeout
try
{
const
response
=
await
fetch
(
`http://localhost:8003/query/
${
projector
}
`
);
const
response
=
await
fetch
(
`http://localhost:8003/query/
${
projector
}
`
,
{
signal
:
controller
.
signal
});
if
(
!
response
.
ok
)
{
throw
new
Error
(
`HTTP error! status:
${
response
.
status
}
`
);
}
const
jsonData
=
await
response
.
json
();
console
.
log
(
'
Fetched data:
'
,
jsonData
);
return
jsonData
;
}
catch
(
error
)
{
console
.
error
(
'
Error fetching data:
'
,
error
);
if
(
error
instanceof
Error
)
{
if
(
error
.
name
===
'
AbortError
'
)
{
throw
new
Error
(
'
Request timed out after 30 seconds. Please check if Insight Analytics Service is running.
'
);
}
console
.
error
(
'
Error fetching data:
'
,
error
);
throw
new
Error
(
'
Failed to connect to Insight Analytics Service. Please verify the service is running.
'
);
}
throw
error
;
}
finally
{
clearTimeout
(
timeoutId
);
}
};
export
const
computeQueryComplexity
=
(
query
:
Query
):
number
=>
{
return
query
.
nodes
.
length
+
query
.
edges
.
length
*
2
+
(
query
.
query
.
match
(
/
\b(
MATCH|WHERE|WITH|RETURN|ORDER BY|LIMIT
)\b
/g
)
||
[]).
length
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment