Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
masterarbeit-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robin Leber
masterarbeit-frontend
Commits
918172a9
Commit
918172a9
authored
Jun 21, 2024
by
Robin Leber
Browse files
Options
Downloads
Patches
Plain Diff
FIX: correct pipe binding for queue and topic, with name and without
parent
e0a8f01c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/functions/pipeBinding.js
+11
-7
11 additions, 7 deletions
src/functions/pipeBinding.js
src/functions/state.js
+1
-1
1 addition, 1 deletion
src/functions/state.js
src/main.js
+13
-5
13 additions, 5 deletions
src/main.js
with
25 additions
and
13 deletions
src/functions/pipeBinding.js
+
11
−
7
View file @
918172a9
...
@@ -8,15 +8,17 @@ export const getPipesForFilter = () => {
...
@@ -8,15 +8,17 @@ export const getPipesForFilter = () => {
let
defaultCount
=
1
;
let
defaultCount
=
1
;
connections
&&
connections
&&
connections
.
forEach
((
connection
)
=>
{
connections
.
forEach
((
connection
)
=>
{
const
pipeName
=
appState
.
getPipe
(
connection
);
const
pipeName
=
appState
.
getPipe
(
connection
.
pipeId
);
if
(
!
pipeName
)
{
if
(
!
pipeName
)
{
const
pipeName
=
`Default
${
defaultCount
}
`
;
const
pipeName
=
`Default
${
defaultCount
}
`
;
appState
.
addPipe
(
connection
,
pipeName
);
appState
.
addPipe
(
connection
,
pipeName
);
const
pipe
=
{
pipeName
,
connection
};
const
pipe
=
{
pipeName
,
connection
};
pipeMapping
.
push
(
pipe
);
pipeMapping
.
push
(
pipe
);
const
spanToChange
=
document
.
querySelector
(
`#
${
connection
}
#PipeName`
);
const
spanToChange
=
document
.
querySelector
(
`#
${
connection
.
pipeId
}
#PipeName`
);
spanToChange
.
innerHTML
=
`"
${
pipeName
}
"`
;
spanToChange
.
innerHTML
=
`"
${
pipeName
}
"`
;
showCheck
(
connection
);
showCheck
(
connection
.
pipeId
);
defaultCount
++
;
defaultCount
++
;
}
else
{
}
else
{
const
pipe
=
{
pipeName
,
connection
};
const
pipe
=
{
pipeName
,
connection
};
...
@@ -32,17 +34,19 @@ export const handlePipeBinding = (pipeMapping, editor) => {
...
@@ -32,17 +34,19 @@ export const handlePipeBinding = (pipeMapping, editor) => {
pipeMapping
.
forEach
((
pipe
)
=>
{
pipeMapping
.
forEach
((
pipe
)
=>
{
if
(
if
(
editorCodeText
.
includes
(
editorCodeText
.
includes
(
`const
${
pipe
.
pipeName
.
replace
(
/
\s
+/g
,
""
)}
Pipe
= "
${
pipe
.
pipeName
}
"`
`const
${
makeValidConstName
(
pipe
.
pipeName
)}
= "
${
pipe
.
pipeName
}
"`
)
)
)
{
)
{
return
;
return
;
}
else
{
}
else
{
let
queue
=
pipe
.
connection
.
pipeType
===
"
Queue
"
?
true
:
false
;
let
line
=
editor
.
state
.
doc
.
line
(
lineNumber
);
let
line
=
editor
.
state
.
doc
.
line
(
lineNumber
);
let
position
=
line
.
from
;
let
position
=
line
.
from
;
let
pipeNameUserGiven
=
pipe
.
pipeName
;
let
pipeNameUserGiven
=
pipe
.
pipeName
;
let
pipeNameDeklaration
=
makeValidConstName
(
pipeNameUserGiven
);
let
pipeNameDeklaration
=
makeValidConstName
(
pipeNameUserGiven
);
pipeNameUserGiven
.
replace
(
/
\s
+/g
,
""
);
let
insertCode
=
`\t\tconst
${
pipeNameDeklaration
}
= "
${
pipeNameUserGiven
}
";\n\t\tawait channel.
${
let
insertCode
=
`\t\tconst
${
pipeNameDeklaration
}
= "
${
pipeNameUserGiven
}
"\n\t\tawait channel.assertQueue(
${
pipeNameDeklaration
}
, {\n\t\t\tdurable: false\n\t\t});\n`
;
queue
?
"
assertQueue
"
:
"
assertTopic
"
}
(
${
pipeNameDeklaration
}
, {\n\t\t\tdurable: false\n\t\t});\n`
;
let
transaction
=
editor
.
state
.
update
({
let
transaction
=
editor
.
state
.
update
({
changes
:
{
changes
:
{
from
:
position
,
from
:
position
,
...
@@ -50,7 +54,7 @@ export const handlePipeBinding = (pipeMapping, editor) => {
...
@@ -50,7 +54,7 @@ export const handlePipeBinding = (pipeMapping, editor) => {
},
},
});
});
editor
.
dispatch
(
transaction
);
editor
.
dispatch
(
transaction
);
lineNumber
++
;
lineNumber
=
lineNumber
+
4
;
}
}
});
});
};
};
...
...
...
...
This diff is collapsed.
Click to expand it.
src/functions/state.js
+
1
−
1
View file @
918172a9
...
@@ -19,7 +19,7 @@ export const appState = (() => {
...
@@ -19,7 +19,7 @@ export const appState = (() => {
},
},
removeConnectionValue
:
(
value
)
=>
{
removeConnectionValue
:
(
value
)
=>
{
for
(
let
[
key
,
values
]
of
state
.
connections
)
{
for
(
let
[
key
,
values
]
of
state
.
connections
)
{
const
newValues
=
values
.
filter
((
val
)
=>
val
!==
value
);
const
newValues
=
values
.
filter
((
val
)
=>
val
.
pipeId
!==
value
);
if
(
newValues
.
length
===
0
)
{
if
(
newValues
.
length
===
0
)
{
state
.
connections
.
delete
(
key
);
state
.
connections
.
delete
(
key
);
}
else
{
}
else
{
...
...
...
...
This diff is collapsed.
Click to expand it.
src/main.js
+
13
−
5
View file @
918172a9
...
@@ -36,11 +36,19 @@ function App() {
...
@@ -36,11 +36,19 @@ function App() {
if
(
!
isConnectionAllowed
(
source
,
target
))
{
if
(
!
isConnectionAllowed
(
source
,
target
))
{
return
false
;
return
false
;
}
}
if
(
source
.
getAttribute
(
"
class
"
).
includes
(
"
Filter
"
))
{
appState
.
addConnection
(
source
.
id
,
target
.
id
);
const
pipe
=
source
.
getAttribute
(
"
class
"
).
includes
(
"
Filter
"
)
}
else
{
?
target
appState
.
addConnection
(
target
.
id
,
source
.
id
);
:
source
;
}
const
filter
=
source
.
getAttribute
(
"
class
"
).
includes
(
"
Filter
"
)
?
source
:
target
;
appState
.
addConnection
(
filter
.
id
,
{
pipeId
:
pipe
.
id
,
pipeType
:
pipe
.
textContent
.
replace
(
/
\s
+/g
,
""
).
split
(
`"`
)[
0
],
});
return
true
;
return
true
;
});
});
...
...
...
...
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
sign in
to comment