Skip to content

Commit

Permalink
Fix unparsable code
Browse files Browse the repository at this point in the history
  • Loading branch information
YolanFery committed Dec 24, 2024
1 parent 588b877 commit ae40db5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions hexa/pipeline_templates/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type PipelineTemplate {
config: String # The configuration of the pipeline template.
versions: [PipelineTemplateVersion!] # The list of versions of the pipeline template.
currentVersion: PipelineTemplateVersion # The current version of the pipeline template.
sourcePipeline: Pipeline # The source pipeline of the pipeline template.
}

"""
Expand Down
2 changes: 1 addition & 1 deletion hexa/pipeline_templates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_pipeline(self, code, workspace, user):
source_template=self.template,
code=code,
name=source_pipeline.name,
description=source_pipeline.description,
description=self.template.description,
config=source_pipeline.config,
workspace=workspace,
)
Expand Down
2 changes: 1 addition & 1 deletion hexa/pipeline_templates/schema/mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def resolve_create_pipeline_from_template_version(_, info, **kwargs):
except PipelineTemplateVersion.DoesNotExist:
return {"success": False, "errors": ["PIPELINE_TEMPLATE_VERSION_NOT_FOUND"]}

pipeline_code = f"{template_version.template.source_pipeline.code} (from Template)"
pipeline_code = template_version.template.source_pipeline.code
if Pipeline.objects.filter(workspace=workspace, code=pipeline_code).exists():
return {"success": False, "errors": ["PIPELINE_ALREADY_EXISTS"]}
pipeline = template_version.create_pipeline(pipeline_code, workspace, request.user)
Expand Down
9 changes: 8 additions & 1 deletion hexa/pipeline_templates/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ def resolve_pipeline_template_versions(


@pipeline_template_object.field("currentVersion")
def resolve_pipeline_current_version(
def resolve_pipeline_template_current_version(
pipeline_template: PipelineTemplate, info, **kwargs
):
return pipeline_template.last_version


@pipeline_template_object.field("sourcePipeline")
def resolve_pipeline_template_source_pipeline(
pipeline_template: PipelineTemplate, info, **kwargs
):
return pipeline_template.source_pipeline


bindables = [
pipeline_template_object,
pipeline_template_permissions,
Expand Down

0 comments on commit ae40db5

Please sign in to comment.