Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
query-service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Microservices
query-service
Commits
c50803ae
Verified
Commit
c50803ae
authored
2 months ago
by
Marcos Pieras
Committed by
Dennis Collaris
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: WIP appearance check
parent
e9ab5ca7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/readers/appearanceCheck.ts
+54
-0
54 additions, 0 deletions
src/readers/appearanceCheck.ts
src/readers/insightProcessor.ts
+7
-0
7 additions, 0 deletions
src/readers/insightProcessor.ts
with
61 additions
and
0 deletions
src/readers/appearanceCheck.ts
0 → 100644
+
54
−
0
View file @
c50803ae
import
type
{
InsightModel
}
from
'
ts-common
'
;
import
type
{
GraphQueryResultMetaFromBackend
}
from
'
ts-common/src/model/webSocket/graphResult
'
;
import
type
{
SaveState
}
from
'
ts-common
'
;
export
type
AppearanceMap
=
{
[
key
:
string
]:
{
count
:
number
;
queries
:
string
[]
};
};
export
function
appearanceCheck
(
result
:
GraphQueryResultMetaFromBackend
,
insight
:
InsightModel
,
ss
:
SaveState
,
queryIndex
:
number
,
appeareanceResult
:
{
nodeAppearance
:
AppearanceMap
;
edgeAppearances
:
AppearanceMap
;
},
)
{
const
nameQuery
=
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
name
;
const
queryNodesID
=
result
.
nodes
.
filter
(
node
=>
!
insight
.
entitiesAppearances
?.
nodeLabel
||
node
.
label
===
insight
.
entitiesAppearances
.
nodeLabel
)
.
map
(
node
=>
node
.
_id
);
const
queryEdgesID
=
result
.
edges
.
filter
(
edge
=>
!
insight
.
entitiesAppearances
?.
edgeLabel
||
edge
.
label
===
insight
.
entitiesAppearances
.
edgeLabel
)
.
map
(
edge
=>
edge
.
_id
);
trackEntityAppearances
(
queryNodesID
,
appeareanceResult
.
nodeAppearance
,
nameQuery
?
nameQuery
:
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
id
?.
toString
()
||
'
default-id
'
,
);
trackEntityAppearances
(
queryEdgesID
,
appeareanceResult
.
edgeAppearances
,
nameQuery
?
nameQuery
:
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
id
?.
toString
()
||
'
default-id
'
,
);
}
export
const
trackEntityAppearances
=
(
entities
:
string
[],
appearances
:
AppearanceMap
,
queryId
:
string
,
// Changed to string
)
=>
{
for
(
const
entity
of
entities
)
{
if
(
!
appearances
[
entity
])
{
appearances
[
entity
]
=
{
count
:
0
,
queries
:
[]
};
}
appearances
[
entity
].
count
++
;
appearances
[
entity
].
queries
.
push
(
queryId
);
}
};
This diff is collapsed.
Click to expand it.
src/readers/insightProcessor.ts
+
7
−
0
View file @
c50803ae
...
@@ -9,6 +9,7 @@ import { query2Cypher } from '../utils/cypher/converter';
...
@@ -9,6 +9,7 @@ import { query2Cypher } from '../utils/cypher/converter';
import
{
queryService
}
from
'
./queryService
'
;
import
{
queryService
}
from
'
./queryService
'
;
import
{
statCheck
}
from
'
./statCheck
'
;
import
{
statCheck
}
from
'
./statCheck
'
;
import
{
diffCheck
}
from
'
./diffCheck
'
;
import
{
diffCheck
}
from
'
./diffCheck
'
;
import
{
type
AppearanceMap
,
appearanceCheck
}
from
'
./appearanceCheck
'
;
import
{
VariableNode
}
from
'
../utils/lexical
'
;
import
{
VariableNode
}
from
'
../utils/lexical
'
;
import
{
populateTemplate
}
from
'
../utils/insights
'
;
import
{
populateTemplate
}
from
'
../utils/insights
'
;
import
{
RabbitMqBroker
}
from
'
ts-common/rabbitMq
'
;
import
{
RabbitMqBroker
}
from
'
ts-common/rabbitMq
'
;
...
@@ -87,6 +88,9 @@ export const insightProcessor = async () => {
...
@@ -87,6 +88,9 @@ export const insightProcessor = async () => {
const
queries
=
ss
.
queryStates
.
openQueryArray
;
const
queries
=
ss
.
queryStates
.
openQueryArray
;
const
visualizations
=
ss
.
visualizations
.
openVisualizationArray
;
const
visualizations
=
ss
.
visualizations
.
openVisualizationArray
;
const
nodeAppearances
:
AppearanceMap
=
{};
const
edgeAppearances
:
AppearanceMap
=
{};
for
(
const
queryIndex
in
queries
)
{
for
(
const
queryIndex
in
queries
)
{
const
visualQuery
=
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
graph
;
const
visualQuery
=
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
graph
;
const
queryBuilderSettings
=
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
settings
;
const
queryBuilderSettings
=
ss
.
queryStates
.
openQueryArray
[
queryIndex
].
settings
;
...
@@ -104,6 +108,9 @@ export const insightProcessor = async () => {
...
@@ -104,6 +108,9 @@ export const insightProcessor = async () => {
insight
=
await
diffCheck
(
insight
,
ss
,
result
);
insight
=
await
diffCheck
(
insight
,
ss
,
result
);
}
else
if
(
insight
.
alarmMode
===
'
conditional
'
&&
insight
.
conditionsCheck
&&
insight
.
conditionsCheck
.
length
>
0
)
{
}
else
if
(
insight
.
alarmMode
===
'
conditional
'
&&
insight
.
conditionsCheck
&&
insight
.
conditionsCheck
.
length
>
0
)
{
insight
=
statCheck
(
insight
,
result
);
insight
=
statCheck
(
insight
,
result
);
}
else
if
(
insight
.
alarmMode
===
'
entitiesAppearances
'
)
{
appearanceCheck
(
result
,
insight
,
ss
,
Number
(
queryIndex
),
{
nodeAppearance
:
nodeAppearances
,
edgeAppearances
:
edgeAppearances
});
log
.
info
(
'
LogicSet resultSet:
'
,
nodeAppearances
);
}
}
if
(
insight
.
userId
==
null
)
return
;
// fixes ts but never is the case
if
(
insight
.
userId
==
null
)
return
;
// fixes ts but never is the case
...
...
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