Merge pull request #1402 from satti-hari-krishna-reddy/main

fixing few things to make pipelines show up in the triggers ui
This commit is contained in:
Aditya
2024-05-22 22:06:15 +05:30
committed by GitHub
3 changed files with 33 additions and 41 deletions
+9 -6
View File
@@ -805,7 +805,7 @@ If you're interested, please let me know a time that works for you, or set up a
.then((responseJson) => {
setWebHooks(responseJson.webhooks || []); // Handling the case where the result is null or undefined
setAllSchedules(responseJson.schedules || []);
// setPipelines(responseJson.pipelines || []);
setPipelines(responseJson.pipelines || []);
})
.catch((error) => {
// toast(error.toString());
@@ -990,11 +990,13 @@ If you're interested, please let me know a time that works for you, or set up a
}
const data = {
command: pipeline.command,
name: pipeline.name,
type: state,
environment: pipeline.environment,
workflow_id: pipeline.workflow_id,
trigger_id: pipeline.trigger_id,
start_node: pipeline.start_node,
};
if (state === "start") toast("starting the pipeline");
@@ -1025,6 +1027,7 @@ If you're interested, please let me know a time that works for you, or set up a
if (state === "start") toast("Successfully created pipeline");
else toast("Sucessfully stopped the pipeline");
}
setTimeout(handleGetAllTriggers, 1000);
})
.catch((error) => {
//toast(error.toString());
@@ -4938,7 +4941,7 @@ If you're interested, please let me know a time that works for you, or set up a
<ListItemText>
<Button
style={{ marginLeft: "18%" }}
style={{ marginLeft: "140px" }}
variant={
webhook.status === "running" ? "contained" : "outlined"
}
@@ -4960,10 +4963,10 @@ If you're interested, please let me know a time that works for you, or set up a
</List>
)}
{/* <div style={{ marginTop: 20, marginBottom: 20 }}>
<div style={{ marginTop: 20, marginBottom: 20 }}>
<h2 style={{ display: "inline" }}>Tenzir Pipelines</h2>
<span style={{ marginLeft: 25 }}>
Controls a pipeline to run things.{" "}
Controls the Tenzir pipeline operations.{" "}
<a
target="_blank"
rel="noopener noreferrer"
@@ -5010,7 +5013,7 @@ If you're interested, please let me know a time that works for you, or set up a
primary="Workflow"
style={{ maxWidth: 315, minWidth: 315 }}
/>
<ListItemText primary="Actions" />
<ListItemText primary="Actions" style={{ marginLeft: '120px' }} />
</ListItem>
{pipelines.map((pipeline, index) => {
var bgColor = "#27292d";
@@ -5063,7 +5066,7 @@ If you're interested, please let me know a time that works for you, or set up a
);
})}
</List>
)}*/}
)}
</div>
) : null;
+22 -30
View File
@@ -1362,7 +1362,7 @@ const AngularWorkflow = (defaultprops) => {
const topic = document.getElementById('topic')?.value;
const bootstrapServers = document.getElementById('bootstrap_servers')?.value;
const groupId = document.getElementById('group_id')?.value;
const autoOffsetReset = document.getElementById('auto_offset_reset')?.value;
//const autoOffsetReset = document.getElementById('auto_offset_reset')?.value;
if(topic) {
trigger.parameters.push({
@@ -1391,12 +1391,12 @@ const AngularWorkflow = (defaultprops) => {
});
}
if (autoOffsetReset) {
trigger.parameters.push({
name: "auto_offset_reset",
value: autoOffsetReset
});
}
// if (autoOffsetReset) {
// trigger.parameters.push({
// name: "auto_offset_reset",
// value: autoOffsetReset
// });
// }
setTenzirConfigModalOpen(false);
};
@@ -7488,12 +7488,6 @@ const AngularWorkflow = (defaultprops) => {
const data = usecase;
data.start_node = mappedStartnode
if (data.type === "create") {
toast("Creating pipeline");
} else if (data.type === "stop") {
toast("stopping pipeline");
}
const url = `${globalUrl}/api/v1/triggers/pipeline`;
fetch(url, {
method: "POST",
@@ -7512,12 +7506,8 @@ const AngularWorkflow = (defaultprops) => {
return response.json();
})
.then((responseJson) => {
if (!responseJson.success) {
if (responseJson.reason !== undefined) {
toast("Failed to set pipeline: " + responseJson.reason);
} else {
toast.error("Failed to stop pipeline")
}
if (!responseJson.success && data.type !== "delete") {
toast("Failed to set pipeline: " + responseJson.reason);
} else {
if (data.type === "create") {
toast("Pipeline will be created!");
@@ -8026,7 +8016,7 @@ const AngularWorkflow = (defaultprops) => {
/*
if (trigger.trigger_type === "PIPELINE") {
if (userdata.support !== true) {
return null
return null
}
}
*/
@@ -14381,7 +14371,7 @@ const AngularWorkflow = (defaultprops) => {
const topic = (selectedTrigger?.parameters?.find(param => param.name === "topic")?.value) || ''
const bootstrapServers = (selectedTrigger?.parameters?.find(param => param.name === "bootstrap_servers")?.value) || ''
const groupId = (selectedTrigger?.parameters?.find(param => param.name === "group_id")?.value) || ''
const autoOffsetReset = (selectedTrigger?.parameters?.find(param => param.name === "auto_offset_reset")?.value) || ''
// const autoOffsetReset = (selectedTrigger?.parameters?.find(param => param.name === "auto_offset_reset")?.value) || ''
let command = "from kafka"
if(topic) {
@@ -14402,11 +14392,13 @@ const AngularWorkflow = (defaultprops) => {
} else {
command = `${command},group.id=${selectedTrigger.id}`
}
if(autoOffsetReset) {
command = `${command},auto.offset.reset=${autoOffsetReset}`
} else {
command = `${command},auto.offset.reset=earliest`
}
// if(autoOffsetReset) {
// command = `${command},auto.offset.reset=${autoOffsetReset}`
// } else {
// command = `${command},auto.offset.reset=earliest`
// }
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}`
@@ -19462,8 +19454,8 @@ const AngularWorkflow = (defaultprops) => {
pointerEvents: "auto",
color: "white",
minWidth: 600,
minHeight: 500,
maxHeight: 500,
minHeight: 450,
maxHeight: 450,
padding: 15,
overflow: "hidden",
zIndex: 10012,
@@ -19532,7 +19524,7 @@ const AngularWorkflow = (defaultprops) => {
placeholder={"tenzir"}
defaultValue={(selectedTrigger?.parameters?.find(param => param.name === "group_id")?.value) || ''}
/>
<b>auto.offest.reset</b>
{/* <b>auto.offest.reset</b>
<TextField
id="auto_offset_reset"
style={{
@@ -19546,7 +19538,7 @@ const AngularWorkflow = (defaultprops) => {
color="primary"
placeholder={"earliest"}
defaultValue={(selectedTrigger?.parameters?.find(param => param.name === "auto_offset_reset")?.value) || ''}
/>
/> */}
</>
)}
</DialogContent>
+1 -4
View File
@@ -2091,8 +2091,6 @@ func handlePipeline(incRequest shuffle.ExecutionRequest) error {
if err != nil {
log.Printf("[ERROR] Failed Deleting Pipeline %s", err)
return err
} else {
log.Printf("[INFO] successfully deleted the Pipeline: %s", pipelineId)
}
} else if incRequest.Type == "PIPELINE_STOP" {
log.Printf("[INFO] Should stop the pipeline %#v", identifier)
@@ -2301,7 +2299,7 @@ func createPipeline(command, identifier string) (string, error) {
if err != nil {
if strings.Contains(fmt.Sprintf("%s", err), "no existing pipeline found") {
log.Printf("[INFO] No existing pipeline found with name: %s. Creating a new one!", identifier)
log.Printf("[INFO] No existing pipeline found with id: %s. Creating a new one!", identifier)
} else {
log.Printf("[ERROR] Failed to search for existing pipeline but continuing anyway : %s", err)
}
@@ -2327,7 +2325,6 @@ func createPipeline(command, identifier string) (string, error) {
command = command[:startIndex] + baseUrl + command[endIndex:]
}
}
requestBody := map[string]interface{}{
"definition": command,
"name": identifier,