Skip to content

Commit

Permalink
Merge pull request #139 from Jougan-0/addMesheryAndUpdateCapabilities
Browse files Browse the repository at this point in the history
Add meshery and update capabilities
  • Loading branch information
Mohd Uzair authored Aug 16, 2024
2 parents ce49a71 + 6386002 commit bd10ea3
Showing 1 changed file with 10 additions and 49 deletions.
59 changes: 10 additions & 49 deletions scripts/convertComponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,52 +314,8 @@ func containsSchemaVersion(fileData []byte, schemaVersion string) bool {
}

func createNewCapabilities() []capability.Capability {
return []capability.Capability{
{
SchemaVersion: "capability.meshery.io/v1alpha1",
Version: "0.7.0",
DisplayName: "Performance Test",
Description: "Initiate a performance test. Meshery will execute the load generation, collect metrics, and present the results.",
Kind: "action",
Type: "operator",
SubType: "perf-test",
EntityState: &[]capability.CapabiliyEntityState{"declaration", "instance"},
Status: "enabled",
},
{
SchemaVersion: "capability.meshery.io/v1alpha1",
Version: "0.7.0",
DisplayName: "Workload Configuration",
Description: "Configure the workload-specific setting of a component",
Kind: "mutate",
Type: "configuration",
SubType: "config",
EntityState: &[]capability.CapabiliyEntityState{"declaration"},
Status: "enabled",
},
{
SchemaVersion: "capability.meshery.io/v1alpha1",
Version: "0.7.0",
DisplayName: "Labels and Annotations Configuration",
Description: "Configure Labels And Annotations for the component",
Kind: "mutate",
Type: "configuration",
SubType: "labels-and-annotations",
EntityState: &[]capability.CapabiliyEntityState{"declaration"},
Status: "enabled",
},
{
SchemaVersion: "capability.meshery.io/v1alpha1",
Version: "0.7.0",
DisplayName: "Relationships",
Description: "View relationships for the component",
Kind: "view",
Type: "configuration",
SubType: "relationship",
EntityState: &[]capability.CapabiliyEntityState{"declaration", "instance"},
Status: "enabled",
},
}
var capabilities []capability.Capability
return capabilities
}

func mapMetadata(oldMetadata map[string]interface{}) model.ModelDefinition_Metadata {
Expand All @@ -372,6 +328,9 @@ func mapMetadata(oldMetadata map[string]interface{}) model.ModelDefinition_Metad
case "capabilities":
if capabilities, ok := value.([]capability.Capability); ok {
newModelMetadata.Capabilities = &capabilities
} else {
var capabilities []capability.Capability
newModelMetadata.Capabilities = &capabilities
}
case "isAnnotation":
if isAnnotation, ok := value.(bool); ok {
Expand Down Expand Up @@ -411,16 +370,15 @@ func createNewRegistrant(oldRegistrantID uuid.UUID, hostname string) connection.
Status: connection.Discovered,
Type: "registry",
}

switch newRegistrant.Kind {
case "artifacthub":
newRegistrant.Name = "Artifact Hub"
case "github":
newRegistrant.Name = "GitHub"
newRegistrant.Name = "Github"
case "kubernetes":
newRegistrant.Name = "Kubernetes"
case "meshery":
newRegistrant.Name = "Meshery"
newRegistrant.Name = "meshery"
default:
newRegistrant.Kind = "Unknown"
}
Expand Down Expand Up @@ -587,6 +545,9 @@ func getGhostPointer(metadata map[string]interface{}, key string) *component.Com
}

func getShapePointer(metadata map[string]interface{}, key string) *component.ComponentDefinitionStylesShape {
if metadata[key] == nil {
return nil
}
shape, _ := metadata[key].(string)
if shape == "" {
return nil
Expand Down

0 comments on commit bd10ea3

Please sign in to comment.