making start and stop buttons to work in PipelineSidebar
This commit is contained in:
@@ -1298,6 +1298,9 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
name: "topic",
|
name: "topic",
|
||||||
value: topic
|
value: topic
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
toast("please enter the topic name");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootstrapServers) {
|
if (bootstrapServers) {
|
||||||
@@ -1305,6 +1308,9 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
name: "bootstrap_servers",
|
name: "bootstrap_servers",
|
||||||
value: bootstrapServers
|
value: bootstrapServers
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
toast("please enter bootstrap server details");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupId) {
|
if (groupId) {
|
||||||
@@ -6895,6 +6901,20 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
} else if (selectedNode.data().trigger_type === "EMAIL") {
|
} else if (selectedNode.data().trigger_type === "EMAIL") {
|
||||||
setSelectedTrigger(selectedNode.data());
|
setSelectedTrigger(selectedNode.data());
|
||||||
stopMailSub(selectedTrigger, triggerindex);
|
stopMailSub(selectedTrigger, triggerindex);
|
||||||
|
} else if (selectedNode.data().trigger_type === "PIPELINE") {
|
||||||
|
setSelectedTrigger(selectedNode.data());
|
||||||
|
|
||||||
|
const pipelineConfig = {
|
||||||
|
command: "",
|
||||||
|
name: selectedNode.data().label,
|
||||||
|
type: "delete",
|
||||||
|
environment: selectedNode.data().environment,
|
||||||
|
workflow_id: workflow.id,
|
||||||
|
trigger_id: selectedNode.data().id,
|
||||||
|
start_node: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
submitPipeline(selectedNode.data(), triggerindex, pipelineConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7293,8 +7313,14 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const data = usecase;
|
const data = usecase;
|
||||||
if (data.type === "create") toast("Creating pipeline");
|
data.start_node = mappedStartnode
|
||||||
else toast("stopping pipeline");
|
|
||||||
|
if (data.type === "create") {
|
||||||
|
toast("Creating pipeline");
|
||||||
|
} else if (data.type === "stop") {
|
||||||
|
toast("stopping pipeline");
|
||||||
|
}
|
||||||
|
|
||||||
const url = `${globalUrl}/api/v1/triggers/pipeline`;
|
const url = `${globalUrl}/api/v1/triggers/pipeline`;
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -7316,8 +7342,14 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
if (!responseJson.success) {
|
if (!responseJson.success) {
|
||||||
toast("Failed to set pipeline: " + responseJson.reason);
|
toast("Failed to set pipeline: " + responseJson.reason);
|
||||||
} else {
|
} else {
|
||||||
if (data.type === "create") toast("Pipeline will be created!");
|
if (data.type === "create") {
|
||||||
else toast("Pipeline will be stopped!");
|
toast("Pipeline will be created!");
|
||||||
|
} else if (data.type === "stop") {
|
||||||
|
toast("Pipeline will be stopped!");
|
||||||
|
} else {
|
||||||
|
toast("Pipeline deleted!")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
trigger.parameters.push({
|
trigger.parameters.push({
|
||||||
name: data.name,
|
name: data.name,
|
||||||
@@ -13947,24 +13979,46 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
disabled={selectedTrigger.status === "running"}
|
disabled={selectedTrigger.status === "running"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
||||||
const topic = document.getElementById('topic')?.value;
|
const topic = (selectedTrigger?.parameters?.find(param => param.name === "topic")?.value) || ''
|
||||||
const bootstrapServers = document.getElementById('bootstrap_servers')?.value;
|
const bootstrapServers = (selectedTrigger?.parameters?.find(param => param.name === "bootstrap_servers")?.value) || ''
|
||||||
const groupId = document.getElementById('group_id')?.value;
|
const groupId = (selectedTrigger?.parameters?.find(param => param.name === "group_id")?.value) || ''
|
||||||
const autoOffsetReset = document.getElementById('auto_offset_reset')?.value;
|
const autoOffsetReset = (selectedTrigger?.parameters?.find(param => param.name === "auto_offset_reset")?.value) || ''
|
||||||
let command = "from kafka"
|
let command = "from kafka"
|
||||||
|
|
||||||
if(topic) command = `${command} --topic ${topic}`
|
if(topic) {
|
||||||
if(bootstrapServers) command = `${command} --set bootstrap.servers=${bootstrapServers}`
|
command = `${command} -t ${topic}`
|
||||||
if(groupId) command = `${command},group.id=${groupId}`
|
} else {
|
||||||
if(autoOffsetReset) command = `${command},auto.offset.reset=${autoOffsetReset}`
|
toast("please enter the topic name")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(bootstrapServers) {
|
||||||
|
command = `${command} -e -o stored -X bootstrap.servers=${bootstrapServers}`
|
||||||
|
} else {
|
||||||
|
toast("please enter the bootstrap servers details")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(groupId) {
|
||||||
|
command = `${command},group.id=${groupId}`
|
||||||
|
} else {
|
||||||
|
command = `${command},group.id=${selectedTrigger.id}`
|
||||||
|
}
|
||||||
|
if(autoOffsetReset) {
|
||||||
|
command = `${command},auto.offset.reset=${autoOffsetReset}`
|
||||||
|
} else {
|
||||||
|
command = `${command},auto.offset.reset=earliest`
|
||||||
|
}
|
||||||
|
command = `${command},client.id=${selectedTrigger.id},enable.auto.commit=true,auto.commit.interval.ms=1`
|
||||||
|
command = `${command} read json | to ${globalUrl}/api/v1/pipelines/pipeline_${selectedTrigger.id}`
|
||||||
|
|
||||||
const pipelineConfig = {
|
const pipelineConfig = {
|
||||||
command: command,
|
command: command,
|
||||||
name: selectedTrigger.label,
|
name: selectedTrigger.label,
|
||||||
type: "start",
|
type: "create",
|
||||||
environment: selectedTrigger.environment,
|
environment: selectedTrigger.environment,
|
||||||
workflow_id: workflow.id,
|
workflow_id: workflow.id,
|
||||||
trigger_id: selectedTrigger.id,
|
trigger_id: selectedTrigger.id,
|
||||||
|
start_node: "",
|
||||||
};
|
};
|
||||||
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
||||||
}}
|
}}
|
||||||
@@ -13977,7 +14031,15 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
disabled={selectedTrigger.status !== "running"}
|
disabled={selectedTrigger.status !== "running"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
toast("Should stop trigger");
|
const pipelineConfig = {
|
||||||
|
name: selectedTrigger.label,
|
||||||
|
type: "stop",
|
||||||
|
environment: selectedTrigger.environment,
|
||||||
|
workflow_id: workflow.id,
|
||||||
|
trigger_id: selectedTrigger.id,
|
||||||
|
start_node: "",
|
||||||
|
};
|
||||||
|
submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
@@ -15902,7 +15964,18 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
style={{paddingTop: 8, paddingLeft: 4, height: 25, width: 25, }}
|
style={{paddingTop: 8, paddingLeft: 4, height: 25, width: 25, }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
} else if (execution.execution_source === "pipeline") {
|
||||||
|
return (
|
||||||
|
<img
|
||||||
|
alt={"pipeline"}
|
||||||
|
src={
|
||||||
|
triggers.find((trigger) => trigger.trigger_type === "PIPELINE")
|
||||||
|
.large_image
|
||||||
|
}
|
||||||
|
style={{ width: size, height: size }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
execution.execution_parent !== null &&
|
execution.execution_parent !== null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user