-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(canvas): Add a container for Pipes
- Loading branch information
1 parent
7136d90
commit 53672a9
Showing
7 changed files
with
148 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/camel-catalog/assembly/src/main/resources/schemas/PipeConfiguration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"description": "Schema for Pipe configuration", | ||
"properties": { | ||
"name": { | ||
"title": "Name", | ||
"description": "Name of the Pipe", | ||
"type": "string" | ||
}, | ||
"labels": { | ||
"additionalProperties": { | ||
"default": "", | ||
"type": "string" | ||
}, | ||
"title": "Additional Labels", | ||
"description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels", | ||
"type": "object" | ||
}, | ||
"annotations": { | ||
"additionalProperties": { | ||
"default": "", | ||
"type": "string" | ||
}, | ||
"title": "Additional Annotations", | ||
"description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations", | ||
"type": "object" | ||
} | ||
}, | ||
"required": [ | ||
"name" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { getValue } from './get-value'; | ||
import { setValue } from './set-value'; | ||
import { PipeMetadata } from '../models/camel/entities/pipe-overrides'; | ||
|
||
export const getCustomSchemaFromPipe = (metadata: PipeMetadata) => { | ||
const name = getValue(metadata, 'name', ''); | ||
const annotations = getValue(metadata, 'annotations', {} as Record<string, unknown>); | ||
const labels = getValue(metadata, 'labels', {} as Record<string, unknown>); | ||
|
||
const customSchema = { | ||
name, | ||
labels: labels, | ||
annotations: annotations, | ||
}; | ||
|
||
return customSchema; | ||
}; | ||
|
||
export const updatePipeFromCustomSchema = (metadata: PipeMetadata, value: Record<string, unknown>): void => { | ||
const previousName = getValue(metadata, 'name'); | ||
const newName: string = getValue(value, 'name'); | ||
setValue(metadata, 'name', newName ?? previousName); | ||
|
||
const newLabels = Object.assign({}, getValue(value, 'labels', {})); | ||
const newAnnotations = Object.assign({}, getValue(value, 'annotations', {})); | ||
|
||
setValue(metadata, 'labels', newLabels); | ||
setValue(metadata, 'annotations', newAnnotations); | ||
}; |