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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robin Leber
masterarbeit-frontend
Commits
4f15b675
Commit
4f15b675
authored
1 year ago
by
Robin Leber
Browse files
Options
Downloads
Patches
Plain Diff
editor ausgegliedert
parent
f623b802
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/functions/codeEditor.js
+12
-24
12 additions, 24 deletions
src/functions/codeEditor.js
src/functions/contextmenu.js
+2
-2
2 additions, 2 deletions
src/functions/contextmenu.js
with
14 additions
and
26 deletions
src/functions/codeEditor.js
+
12
−
24
View file @
4f15b675
...
@@ -5,12 +5,23 @@ import { createCustomCode } from "./api";
...
@@ -5,12 +5,23 @@ import { createCustomCode } from "./api";
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
handlePipeBinding
,
getPipesForFilter
}
from
"
./pipeBinding
"
;
import
{
handlePipeBinding
,
getPipesForFilter
}
from
"
./pipeBinding
"
;
export
const
codeEditor
=
(
instance
)
=>
{
let
editorValues
=
{
doc
:
"
const amqp = require('amqplib/callback_api');
\n\n
const rabbitmqUrl = 'amqp://mquser:mqpass@rabbit:5672';
\n\n
amqp.connect(rabbitmqUrl, (error0, connection) => {
\n
if (error0) {
\n
throw error0;
\n
}
\n
connection.createChannel((error1, channel) => {
\n
if (error1) {
\n
throw error1;
\n
}
\n\n\n\n
//TODO: Code logic here
\n
});
\n
"
,
extensions
:
[
basicSetup
,
javascript
()],
};
let
editorStartState
=
EditorState
.
create
(
editorValues
);
const
editor
=
new
EditorView
({
state
:
editorStartState
,
});
export
const
codeEditorElement
=
(
instance
)
=>
{
if
(
document
.
getElementById
(
`codeEditor
${
window
.
selectedFilter
}
`
))
{
if
(
document
.
getElementById
(
`codeEditor
${
window
.
selectedFilter
}
`
))
{
const
codeEditor
=
document
.
getElementById
(
const
codeEditor
=
document
.
getElementById
(
`codeEditor
${
window
.
selectedFilter
}
`
`codeEditor
${
window
.
selectedFilter
}
`
);
);
codeEditor
.
style
.
visibility
=
"
visible
"
;
codeEditor
.
style
.
visibility
=
"
visible
"
;
handlePipeBinding
(
getPipesForFilter
(),
editor
);
}
else
{
}
else
{
var
diagram
=
document
.
getElementById
(
"
Diagram
"
);
var
diagram
=
document
.
getElementById
(
"
Diagram
"
);
...
@@ -45,30 +56,7 @@ export const codeEditor = (instance) => {
...
@@ -45,30 +56,7 @@ export const codeEditor = (instance) => {
closingX
.
addEventListener
(
"
click
"
,
()
=>
handleCancel
(
editorContainer
));
closingX
.
addEventListener
(
"
click
"
,
()
=>
handleCancel
(
editorContainer
));
editorContainer
.
appendChild
(
closingX
);
editorContainer
.
appendChild
(
closingX
);
let
editorValues
;
if
(
filterToCode
.
type
.
includes
(
"
Sender
"
))
editorValues
=
{
doc
:
"
// publisher.js
\n
const amqp = require('amqplib/callback_api');
\n\n
const rabbitmqUrl = 'amqp://mquser:mqpass@rabbit:5672';
\n\n
amqp.connect(rabbitmqUrl, (error0, connection) => {
\n
if (error0) {
\n
throw error0;
\n
}
\n
connection.createChannel((error1, channel) => {
\n
if (error1) {
\n
throw error1;
\n
}
\n\n
// DO NOT CHANGE
\n
const queue = process.env.QUEUE_NAME
\n\n
channel.assertQueue(queue, {
\n
durable: false
\n
});
\n\n
const sendMessage = () => {
\n
const msg = 'Hello World! ' + new Date().toISOString();
\n
channel.sendToQueue(queue, Buffer.from(msg));
\n
console.log(
\"
[x] Sent '%s'
\"
, msg);
\n
};
\n\n
setInterval(sendMessage, 1000);
\n
});
\n
});
\n
"
,
extensions
:
[
basicSetup
,
javascript
()],
};
else
if
(
filterToCode
.
type
.
includes
(
"
Receiver
"
))
{
editorValues
=
{
doc
:
"
// consumer.js
\n
const amqp = require('amqplib/callback_api');
\n\n
const rabbitmqUrl = 'amqp://mquser:mqpass@rabbit:5672';
\n\n
amqp.connect(rabbitmqUrl, (error0, connection) => {
\n\t
if (error0) {
\n\t\t
throw error0;
\n\t
}
\n\t
connection.createChannel((error1, channel) => {
\n\t\t
if (error1) {
\n\t\t\t
throw error1;
\n\t\t
}
\n\n\t\t
// DO NOT CHANGE
\n
const queue = process.env.QUEUE_NAME
\n\n\t\t
channel.assertQueue(queue, {
\n\t\t\t
durable: false
\n\t\t
});
\n\n\t\t
console.log(
\"
[*] Waiting for messages in %s. To exit press CTRL+C
\"
, queue);
\n\n\t\t
// Funktion, um eine Nachricht aus der Queue zu konsumieren
\n\t\t
const consumeMessage = () => {
\n\t\t\t
channel.get(queue, { noAck: false }, (error, msg) => {
\n\t\t\t\t
if (error) {
\n\t\t\t\t\t
throw error;
\n\t\t\t\t
}
\n\t\t\t\t
if (msg) {
\n\t\t\t\t\t
console.log(
\"
[x] Received '%s'
\"
, msg.content.toString());
\n\t\t\t\t\t
// Nachricht bestätigen (acknowledge)
\n\t\t\t\t\t
channel.ack(msg);
\n\t\t\t\t
} else {
\n\t\t\t\t\t
console.log(
\"
[x] No message received at this interval.
\"
);
\n\t\t\t\t
}
\n\t\t\t
});
\n\t\t
};
\n\n\t\t
// Setze ein Intervall von 3 Sekunden
\n\t\t
setInterval(consumeMessage, 3000);
\n\t
});
\n
});
\n
"
,
extensions
:
[
basicSetup
,
javascript
()],
};
}
else
{
editorValues
=
{
doc
:
"
const amqp = require('amqplib/callback_api');
\n\n
const rabbitmqUrl = 'amqp://mquser:mqpass@rabbit:5672';
\n\n
amqp.connect(rabbitmqUrl, (error0, connection) => {
\n
if (error0) {
\n
throw error0;
\n
}
\n
connection.createChannel((error1, channel) => {
\n
if (error1) {
\n
throw error1;
\n
}
\n\n\n\n
//TODO: Code logic here
\n
});
\n
"
,
extensions
:
[
basicSetup
,
javascript
()],
};
}
let
editorStartState
=
EditorState
.
create
(
editorValues
);
const
editor
=
new
EditorView
({
state
:
editorStartState
,
});
handlePipeBinding
(
getPipesForFilter
(),
editor
);
handlePipeBinding
(
getPipesForFilter
(),
editor
);
// createPipesElements(editor);
editorContainer
.
appendChild
(
editor
.
dom
);
editorContainer
.
appendChild
(
editor
.
dom
);
var
buttonContainer
=
document
.
createElement
(
"
div
"
);
var
buttonContainer
=
document
.
createElement
(
"
div
"
);
...
...
This diff is collapsed.
Click to expand it.
src/functions/contextmenu.js
+
2
−
2
View file @
4f15b675
import
{
duplicatePipe
,
duplicateFilter
,
extendPipe
}
from
"
./duplication
"
;
import
{
duplicatePipe
,
duplicateFilter
,
extendPipe
}
from
"
./duplication
"
;
import
{
codeEditor
}
from
"
./codeEditor
"
;
import
{
codeEditor
Element
}
from
"
./codeEditor
"
;
import
{
scaleOut
}
from
"
./api
"
;
import
{
scaleOut
}
from
"
./api
"
;
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
showCheck
}
from
"
./visualValidation
"
;
...
@@ -59,7 +59,7 @@ export const initContextmenu = (instance) => {
...
@@ -59,7 +59,7 @@ export const initContextmenu = (instance) => {
duplicateFilter
(
instance
);
duplicateFilter
(
instance
);
});
});
$
(
"
body
"
).
on
(
"
click
"
,
"
.code-filter
"
,
(
event
)
=>
{
$
(
"
body
"
).
on
(
"
click
"
,
"
.code-filter
"
,
(
event
)
=>
{
codeEditor
(
instance
);
codeEditor
Element
(
instance
);
});
});
$
(
"
body
"
).
on
(
"
click
"
,
"
.scale-out
"
,
(
event
)
=>
{
$
(
"
body
"
).
on
(
"
click
"
,
"
.scale-out
"
,
(
event
)
=>
{
scaleOut
(
window
.
selectedFilter
);
scaleOut
(
window
.
selectedFilter
);
...
...
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