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
d9a692ea
Commit
d9a692ea
authored
11 months ago
by
Robin Leber
Browse files
Options
Downloads
Patches
Plain Diff
FEAT: editor, no saves when cancel
parent
3884f041
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/functions/codeEditor.js
+11
-2
11 additions, 2 deletions
src/functions/codeEditor.js
src/functions/codeEditorHandler.js
+16
-0
16 additions, 0 deletions
src/functions/codeEditorHandler.js
src/functions/naming.js
+1
-1
1 addition, 1 deletion
src/functions/naming.js
with
28 additions
and
3 deletions
src/functions/codeEditor.js
+
11
−
2
View file @
d9a692ea
...
@@ -3,7 +3,11 @@ import { EditorState } from "@codemirror/state";
...
@@ -3,7 +3,11 @@ import { EditorState } from "@codemirror/state";
import
{
javascript
}
from
"
@codemirror/lang-javascript
"
;
import
{
javascript
}
from
"
@codemirror/lang-javascript
"
;
import
{
createCustomCode
}
from
"
./api
"
;
import
{
createCustomCode
}
from
"
./api
"
;
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
handlePipeBinding
,
getPipesForFilter
}
from
"
./pipeBinding
"
;
import
{
handlePipeBinding
,
getPipesForFilter
,
deleteWrittenCode
,
}
from
"
./codeEditorHandler
"
;
let
editorValues
=
{
let
editorValues
=
{
doc
:
"
// Please don't remove comments!
\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
// START PIPE-BINDING
\n
// INCOMING PIPES
\n
// OUTGOING PIPES
\n
// END PIPE-BINDING
\n\n
// TODO: Code logic here
\n\n\n\t
});
\n
});
\n
"
,
doc
:
"
// Please don't remove comments!
\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
// START PIPE-BINDING
\n
// INCOMING PIPES
\n
// OUTGOING PIPES
\n
// END PIPE-BINDING
\n\n
// TODO: Code logic here
\n\n\n\t
});
\n
});
\n
"
,
...
@@ -140,7 +144,12 @@ export const codeEditorElement = (instance) => {
...
@@ -140,7 +144,12 @@ export const codeEditorElement = (instance) => {
};
};
const
handleCancel
=
(
node
)
=>
{
const
handleCancel
=
(
node
)
=>
{
node
.
style
.
visibility
=
"
hidden
"
;
if
(
confirm
(
"
No changes will be saved!
"
))
{
node
.
style
.
visibility
=
"
hidden
"
;
deleteWrittenCode
(
node
.
editor
);
}
else
{
return
;
}
};
};
const
handleSubmit
=
(
node
,
code
)
=>
{
const
handleSubmit
=
(
node
,
code
)
=>
{
const
requestBody
=
{
const
requestBody
=
{
...
...
This diff is collapsed.
Click to expand it.
src/functions/
pipeBinding
.js
→
src/functions/
codeEditorHandler
.js
+
16
−
0
View file @
d9a692ea
...
@@ -235,3 +235,19 @@ export const renamePipeNamesInCode = (editor, oldName, newName) => {
...
@@ -235,3 +235,19 @@ export const renamePipeNamesInCode = (editor, oldName, newName) => {
});
});
editor
.
dispatch
(
transaction
);
editor
.
dispatch
(
transaction
);
};
};
export
const
deleteWrittenCode
=
(
editor
)
=>
{
const
codeString
=
editor
.
state
.
doc
.
toString
();
const
from
=
"
// TODO: Code logic here
"
;
const
fromIndex
=
codeString
.
indexOf
(
from
);
const
transaction
=
editor
.
state
.
update
({
changes
:
[
{
from
:
fromIndex
+
from
.
length
,
to
:
editor
.
state
.
doc
.
length
,
insert
:
"
\n\n\n\t
});
\n
});
\n
"
,
},
],
});
editor
.
dispatch
(
transaction
);
};
This diff is collapsed.
Click to expand it.
src/functions/naming.js
+
1
−
1
View file @
d9a692ea
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
showCheck
}
from
"
./visualValidation
"
;
import
{
appState
}
from
"
./state
"
;
import
{
appState
}
from
"
./state
"
;
import
{
renamePipeNamesInCode
}
from
"
./
pipeBinding
"
;
import
{
renamePipeNamesInCode
}
from
"
./
codeEditorHandler
"
;
export
const
namePipe
=
(
instance
)
=>
{
export
const
namePipe
=
(
instance
)
=>
{
let
newPipeName
;
let
newPipeName
;
...
...
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