Skip to content
Snippets Groups Projects
Commit 73473629 authored by Robin Leber's avatar Robin Leber
Browse files

pipeBinding even if pipe is not named

parent 8bac1011
No related branches found
No related tags found
No related merge requests found
import { appState } from "./state"; import { appState } from "./state";
import { errorFeedbackSimple } from "./feedback"; import { showCheck } from "./visualValidation";
export const getPipesForFilter = () => { export const getPipesForFilter = () => {
const filter = window.selectedFilter; const filter = window.selectedFilter;
const connections = appState.getConnection(filter); const connections = appState.getConnection(filter);
const pipeMapping = []; const pipeMapping = [];
let defaultCount = 1;
connections && connections &&
connections.forEach((connection) => { connections.forEach((connection) => {
const pipeName = appState.getPipe(connection); const pipeName = appState.getPipe(connection);
if (!pipeName) { if (!pipeName) {
errorFeedbackSimple("Name Your Pipes!"); const pipeName = `Default${defaultCount}`;
appState.addPipe(connection, pipeName);
const pipe = { pipeName, connection };
pipeMapping.push(pipe);
const spanToChange = document.querySelector(`#${connection} #PipeName`);
spanToChange.innerHTML = `"${pipeName}"`;
showCheck(connection);
defaultCount++;
} else { } else {
const pipe = { pipeName, connection }; const pipe = { pipeName, connection };
pipeMapping.push(pipe); pipeMapping.push(pipe);
...@@ -24,7 +32,7 @@ export const handlePipeBinding = (pipeMapping, editor) => { ...@@ -24,7 +32,7 @@ export const handlePipeBinding = (pipeMapping, editor) => {
pipeMapping.forEach((pipe) => { pipeMapping.forEach((pipe) => {
if ( if (
editorCodeText.includes( editorCodeText.includes(
`const ${pipe.pipeName.replace(/\s+/g, "")}Pipea = "${pipe.pipeName}"` `const ${pipe.pipeName.replace(/\s+/g, "")}Pipe = "${pipe.pipeName}"`
) )
) { ) {
return; return;
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment